How can you register additional variants to the `k...
# gradle
h
How can you register additional variants to the
kotlin
KotlinSoftwareComponent when using the multiplatform plugin? I want to publish my jvmTestSuite code. The java-test-fixture plugin works locally with the mpp plugin, but it does not publish the test-fixture variant for external consumption.
v
I have no idea, but just from looking at what components are registered, maybe it is
Copy code
components.named<AdhocComponentWithVariants>("adhocKotlin") {
    //...
}
πŸ€·β€β™‚οΈ
h
Ohhhh, I only used the kotlin component. That's exactly what I was looking for πŸŽ‰ thank you
πŸ‘Œ 1
v
Maybe the KMP DSL also has some way to do it, no idea. As I said, just wild guessing here. πŸ™‚
That's also not the
KotlinSoftwareComponent
component called
kotlin
, but it seems that component somehow consideres that
adhocKotlin
component. So maybe it is the intended way, no idea.
h
Well, I will just test it, but the module.json file looks good
πŸ‘Œ 1
It works:
Copy code
components.named<AdhocComponentWithVariants>("adhocKotlin") {
    addVariantsFromConfiguration(
        configurations.testFixturesApiElements.get(),
        JavaConfigurationVariantMapping("compile", true, configurations.testFixturesCompileClasspath.get())
    )
    addVariantsFromConfiguration(
        configurations.testFixturesRuntimeElements.get(),
        JavaConfigurationVariantMapping("runtime", true, configurations.testFixturesRuntimeClasspath.get())
    )
}
v
Great, except for using an internal class of course πŸ™‚
h
Yeah, but when looking at the code, it is needed for the dependency mapping that also uses an internal class
v
I didn't say you don't need it, I just said that makes it "not so great" πŸ˜„ Maybe worth a feature request to add some API πŸ€·β€β™‚οΈ
t