I've got a Compose app that is using multiple JVM ...
# compose-desktop
s
I've got a Compose app that is using multiple JVM targets ("internal", and "production"). I was pretty sure this wouldn't work, but somehow it is. When I call
./gradlew :app:run
compose seems to be targeting the internal variant. I've changed the order, and no matter what it seems to choose the internal variant. Is there a way to choose what variant is run?
Copy code
val flavorAttribute = Attribute.of("com.example.flavor", String::class.java)

kotlin {
    jvm("jvmInternal") {
        attributes.attribute(flavorAttribute, "internal")
        compilations.all {
            kotlinOptions.jvmTarget = "17"
        }
    }

    jvm("jvmProduction") {
        attributes.attribute(flavorAttribute, "production")
        compilations.all {
            kotlinOptions.jvmTarget = "17"
        }
    }
o
I guess something like this could help:
Copy code
compose.desktop {
    application {
        ....
        from(kotlin.targets.getByName("jvmProduction"))
    }
}
To avoid the hardcoding, you’ll need to add some gradle property and if..else.
s
thank you