Open lihaoyi opened 2 weeks ago
CC @alexarchambault. Do you think this something we could configure Coursier to do without patching it? Or would this functionality need to be added to Coursier itself?
Coursier should support that, it's a matter of asking for the right types and extensions. I can have a look a bit later today.
Probably it makes sense to add a bit more info on how Kotlin Multiplatform ecosystem works, it may be useful in the future for the artifact filtering. In fact, Kotlin Multiplatform heavily relies on the Gradle Module metadata (this is what gets published as .module
file) to know what to fetch.
When Kotlin Multiplatform publishes artifacts for multiple targets, it has target-specific modules + root module (described here).
This can be seen on the example of kotlinx-html
library:
The root artifact has the necessary metadata to point to the platform-specific artifacts (like kotlinx-html-js
, kotlinx-html-iossimulatorarm64
, etc.), that allows to specify only root artifact instead of pointing to the each target-specific artifact individually. In Gradle terms I can do something like:
commonMain.dependencies {
implementation("org.jetbrains.kotlin:kotlinx-html:x.x.x"
}
or even (if we are not building common
code):
jsMain.dependencies {
implementation("org.jetbrains.kotlin:kotlinx-html:x.x.x"
}
and then if I have js
, iosArm64
, etc. targets registered the proper artifacts will be pulled. Instead of doing:
jsMain.dependencies {
implementation("org.jetbrains.kotlin:kotlinx-html-js:x.x.x"
}
And then target-specific artifact .module
file contains exact location and alias for the library file.
Thanks for the details @0xnm! We can definitely look at whether we can support the .module
files directly in Mill or if @alexarchambault can put some support upstream into Coursier
Follow up to https://github.com/com-lihaoyi/mill/issues/3611
The basic issue is that Coursier is unable to resolve Kotlin 2.0 dependencies, such as https://repo1.maven.org/maven2/org/jetbrains/kotlinx/kotlinx-html-js/0.11.0/. These dependencies do not contain
.jar
files, but instead contain.module
files and.klib
files:The success criteria is that after applying the following diff
The following command should not produce a compiler error: