I'm trying to port and publish my library to KMM a...
# multiplatform
d
I'm trying to port and publish my library to KMM and I have to tell you this is hell on earth experience. • Wanted to use atomics. Failed to set up kotlinx-atomicfu, it assumes configuration in root-module, but even after hacks it failed with exceptions • gradle-kts constantly breaks completion/compilation • gradle-kts has very weird rules as to what goes where, plugin repositories were in main file, now they're in settings.kts, convention plugins have weird rules on deps declaration etc etc Especially publishing configuration. • All examples are trivial and assume everything in the root module • Article from Kotlin's dev-rel assumes the same and plainly doesn't work • Libraries on github do not use kts (it seems) • I cannot create sourcesJar and no examples on how to do this in KMM setting • Reading every other section of KMM guide makes me believe that it's all full of a lots and lots of workarounds and hacks I'm sure all this can be solved, but as the beginner I'm very frustrated and tired of battling the tools. Been at it all day and got nowhere. Can't even publish to maven local.
r
I’ve had a similar experience. It gets worse when you actually publish to central, maven users need additional metadata and nothing validates it works. We published 1.0 in arrow broken without knowing this and a few other mostly gradle kmp related issues that we are having to patch on subsequent releases
in our case just KMP
d
Ugh. I will try to examine arrow's build config. Thanks! Needed to vent a bit. Thought about deleting this post, but then I thought maybe someone from KMM team will read it (however lacking details and structure it is) and get the gist 🙂
I'm starting to feel that Gradle is a wrong foundation to build something as complex as KMM is. Language-wise they seem to nail the expect/actual story. But tooling-wise it's horrible. And the tooling will be a bottleneck in a cross-platform case.
y
d
Aha! And you also use vannictech's plugin instead of maven-publish. Just found that wire has it too. I'm going to give it a try, because it feels like
maven-publish
+`kmm` +
kts
alliance is fighting me 🙂
g
If it helps, we use
maven-publish
+
kmm
+
kts
for pbandk and publish to Maven Central via GitHub Actions. You can look at https://github.com/streem/pbandk/blob/master/runtime/build.gradle.kts for an example of the gradle config, along with some shared config in https://github.com/streem/pbandk/blob/master/build.gradle.kts and https://github.com/streem/pbandk/blob/master/buildSrc/src/main/kotlin/MavenPublicationExtensions.kt.
👍 1