Problem using a published multiplatform library

Hey folks, I have a problem/question related to multiplatform publishing.

We have a set of libraries: GitHub - korlibs/korge-next: Mono-repo with all korlibs to shape KorGE 2.0 without having to wait hours for CI :) those libraries were all gradle submodules and published to central all at once for convenience. Now that some libraries are more mature and K/N supports has compatibility loading older library versions, we wanted to move back some libraries to its own repos.

It seemed to work and we were able for example to publish klock again in its own repo available on central here.
And artifacts seems to be published successfully, one artifact per platform.

But after trying to change the submodule with the published version, a strange error started to happen (like imports weren’t found):

> Task :korio:compileNativeCommonMainKotlinMetadata FAILED
e: /Users/runner/work/korge-next/korge-next/korio/src/nativeCommonMain/kotlin/com/soywiz/korio/async/FutureExt.kt: (3, 19): Unresolved reference: klock

Full log on CI

The thing that I have noticed is that the task name is called compileNativeCommonMainKotlinMetadata, so it seems to be covering the nativeCommon sourceset. There is no artifact for that nativeCommon, so maybe it cannot find any suitable library for that code. But why that task happening at all? Why it is not compiling only once for each platform and that’s it?
How can I solve this problem? Should I publish library variants for every single group of targets? ie. “nativeCommon”, “appleCommon”, “posixCommon”, “nativeNonMingw”, “nonJvm”, “nonJs”… I have a lot to avoid code duplication.

Any of you had this problem, and know how to solve that either by adjusting the published library or the code consuming it?

Thanks in advance!

1 Like