I'm working on a multiplatform library <https://gi...
# multiplatform
j
I'm working on a multiplatform library https://github.com/kmpdict/jmdict-kmp that has a mix of generated and expect/actual code in commonMain. When I publish, I can see that android & jvm artifacts have code in them, but the metadata artifact does not. This means consumers aren't able to access these functions from commonMain, despite the fact that they are indeed common! What's going on and how do I debug this?
j
How could the metadata artifact (the one without any platform qualification) contain binary code? That's the point of the platform-qualified artifacts. I have made my own library and consumed it in a multiplatform app and it works for me. The unqualified artifact has a .knm file; my guess is that the compiler and IDE get the information about the available symbols from it.
j
Right, my concern isn't that it's missing binary code. It's missing source files that I can see from other projects, which I assume is why my IDE cannot see anything my library provides in commonMain
You can grab any artifact from the last release and check for yourself. Comparing it to other KMP libraries, the metadata artifacts are essentially empty despite the fact all my code is in common or has an expect/actual
j
So the ability to find the sources is supported by a sources jar in the 'root' artifact. Example: https://github.com/CapnSpellcheck/cmp-animatedcounter/packages/2644895
I suspect this is entirely driven by your publishing methodology. I'm using the standard
maven-publish
plugin, not the "vanniktech" variant currently mentioned on the KMP library guide. But I have no idea whether "vanniktech" could even be the cause of this.
Oh, I see you're not even using that -
id("com.boswelja.publish")
j
I'm using the third party vanniktech plugin, but I had the same issue swapping off it (I just had to configure more)
com.boswelja.publish
is a precompiled script in my buildSrc just so I can share config across modules