So I'm trying to make a kmp library that lives in ...
# multiplatform
g
So I'm trying to make a kmp library that lives in the land of pure Kotlin, do I really need to list all of the platform targets for that, I would assume it should work for all of them given it uses the most simple of Kotlin constructs and does not touch the parts of the language that are platform dependent
m
Yes, you need to declare all targets you want to support even if all of your library's code is utilizing built-in kotlin features and standard lib functions. Fortunately, this should be trivial though, you'll need to update the configuration of lib's build gradle file + your code should live in
commonMain
instead of
main
g
That is very unfortunate, but thank you. And for android that means that I have to include the Gradle plugin too?
m
The only exception to this is that if you want to target android, if all you do is simple pure kotlin, then it is just enough to target jvm
This is because java libraries are already consumable by android, not something really related to kmp.
So, you don't need Android gradle plugin
g
Is it known if the target requirements are ever going to change?
m
I don't have an idea about that honestly, but as I said it is not hard to make your platform independent library kmp compatible in the meantime.
g
Yeah I just have some 30 odd libraries that I am trying to move to KMP and the kotlin block is annoying to define programmatically (based on the last time I tried)
m
You can define a gradle convention plugin for that and publish it
g
True
Thank you for your help
👌 1
r
There's been some mention from JB about letting you publish "common only" libraries, but it seems quite a ways off