https://kotlinlang.org logo
#multiplatform
Title
# multiplatform
s

Sujit

10/09/2019, 8:25 PM
Is there a blog post or sample app utilizing gradle kotlin DSL to publish KMP library (android and iOS) to bintray?
though I have never heard of publishing an iOS framework to bintray
s

Sujit

10/09/2019, 8:29 PM
Oh yeah, not looking to publish the iOS framework to bintray. I'm looking to publish a library for KMP that has android, iOS, and common component. I will probably distribute framework in some other distribution channel
s

Sam

10/09/2019, 8:49 PM
You can and probably should distribute the klib iOS binary rather than attempting to put the framework in some other distribution channel due to the 1 kotlin iOS framework per app limitation. If a user already has a kotlin framework in their app they will not be able to use your framework binary.
s

Sujit

10/09/2019, 8:51 PM
That's an interesting point @Sam. How does the
klib
integrate with xcode though? I've some confusion with that part. Any guide you can point me towards for this?
s

Sam

10/09/2019, 8:56 PM
It doesn't directly integrate with Xcode. It works similarly to how other dependencies such as kotlinx.serialization work. You create an umbrella framework for your app that holds all app specific code plus your dependencies using the multiplatform plugin. Then in Xcode you reference the built framework.
s

Sujit

10/09/2019, 9:01 PM
Yeah, I think I have that project going now. I've three MP projects going, where one of them is the "umbrella" for the other two. The way I'm building it is, those two are libraries that can be imported to other KMP projects via
dependencies
just like how I use
kotlinx-serialization
in my KMP project. So, that was the original question I had is: with kotlin DSL on gradle, I'm looking to publish those two libraries that I can then import in the umbrella KMP project, that xcode will build. So, is there a good doc/example on how I can do that with bintray. Or is there is better alternative to bintray for this kinda distribution?
k

Kris Wong

10/09/2019, 9:08 PM
i'm just using git submodules
s

Sam

10/09/2019, 9:10 PM
If you can get it posting them to a local maven repository, switching over to bintray isn't very difficult. I haven't tried it in several months or I would offer up more resources.
s

Sujit

10/09/2019, 9:22 PM
Yeah, currently I'm using it by publishing to local maven. I got that part working. That part had lots of resources, and was fairly easy to figure out. Now I wanna be able to distribute to central repo like bintray so that the other teams won't have to build the project themselves. Unfortunately, git submodule also does not work me because of the way other things are structured around this.
f

Fudge

10/09/2019, 10:49 PM
This is not kotlin gradle dsl, but it shouldn’t be too hard to convert https://natanfudge.github.io/fudgedocs/publish-kotlin-mpp-lib.html
s

Sujit

10/10/2019, 4:48 PM
These are fantastic. Thank you @louiscad, @Fudge, and @alex009! Really appreciate it.