https://kotlinlang.org logo
#multiplatform
Title
# multiplatform
d

Dico

09/14/2019, 12:37 PM
Can I take a multiplatform project with only a jvm target, and change it to a jvm project with 2 jvm sourcesets?
n

Nicholas Bilyk

09/14/2019, 2:23 PM
So you want what should be "commonMain" to be another jvm source set (for now), correct?
Copy code
plugins {
    kotlin("jvm") version("1.3.31")
}

repositories {
    jcenter()
    mavenLocal()
}

sourceSets["main"].withConvention(KotlinSourceSet::class) {
    kotlin.srcDir("src/jvmMain/kotlin")
    kotlin.srcDir("src/commonMain/kotlin")
}
d

Dico

09/14/2019, 2:28 PM
Yes, that's right!
I have something similar right now with dependsOn, but this seems better, thanks!
n

Nicholas Bilyk

09/14/2019, 2:29 PM
oh, hm, your way might be better, you wouldn't want commonMain to see jvmMain..
2 Views