Publishing a pure Kotlin Multiplatform library seems quite challenging, or perhaps I haven't found the right approach.
In my experience, I have to specify each supported platform in my build script. However, when writing Multiplatform libraries, I primarily use Kotlin Multiplatform to
"share common code". I rarely write platform-specific code, partly because Kotlin's cinterop lacks documentation and source code examples, making platform-specific coding less appealing. Additionally, I need to set up various environments for my target platforms, which often requires a macOS machine or a well-configured GitHub macOS Action. This setup can be cumbersome, and I end up publishing numerous unnecessary Maven artifacts for each platform.
Does Kotlin 2.0 offer any optimizations for publishing only
commonMetadata
sourceSet? My goal is to publish a straightforward Multiplatform library that support all platforms and depends solely on the Kotlin std-lib. (Rust did such publishing processes very well for me.)