https://kotlinlang.org logo
Title
g

gildor

06/10/2018, 10:14 AM
I have a question about Kotlin MPP libraries publishing for Kotlin/Native Currently you can publish library as .klib that contains binaries for multiple targets, but it looks like not a perfect solution for pure K/N library, as library author I would like to publish library for K/N (without platform-specific code) so other K/N projects could use it, but building and publishing binaries for particular platform is not flexible enough, for example you cannot publish library for macos using linux CI or just publish for any non-cross-compiled targets. Is there any consideration to allow publish IR or even source code K/N compatible libraries (as klib or any other format) that can be used easily by any K/N project. And yeah, I heard about idea to use IR as a format for distribution of Kotlin libraries, but looks like this is not near future plan, and it’s not critical for JVM or JS, but for K/N this looks like a way to publish libraries is much more flexible and the only really platform-independent way. Maybe it would be nice to try with K/N even if it’s impossible to do for other Kotlin platforms
o

olonho

06/11/2018, 7:27 AM
yes, we are evaluating pure IR libs but it requires tremendous infrastructure effort in the compiler and serializer. So we will be there, just not immediately
g

gildor

06/11/2018, 7:35 AM
Thanks for confirmation
So what is current recommendation for Kotlin libraries authors? Just do not build libraries and recommend to copy implementation or use something like gradle composite builds instead?
o

olonho

06/11/2018, 8:04 AM
Currently we suggest to use Gradle build variants https://code.tutsplus.com/tutorials/using-gradle-build-variants--cms-25005 and publish them as Maven artifact with multiple variants
g

gildor

06/11/2018, 8:08 AM
Build variants is Android Gradle plugin feature, not a feature of Gradle
Anyway, I can configure build to publish library for different platforms, I got it, thanks.