andymin
07/09/2020, 8:14 PMsrc
* commonMain
* commonTest
* jvm1Main
* jvm2Main
* jvm2Test
I want it so that running check
or build
would run jvm2Test
and commonTest
so I setup my `build.gradle`:
kotlin {
jvm('jvm1')
jvm('jvm2')
sourceSets {
commonMain { dependencies { ... } }
commonTest {
dependencies {
implementation kotlin('test-annotations-common')
}
}
jvm1Main {
dependsOn commonMain
dependencies { ... }
}
jvm2Main {
dependsOn commonMain
dependencies { ... }
}
jvm2Test {
dependsOn commonTest
dependencies {
implementation kotlin('test')
implementation kotlin('test-junit')
}
}
}
}
However, running ./gradlew build
tries to compile commonTest
through both jvm1Test
and jvm2Test
, and fails since jvm1Test
doesn't have any test dependencies. Is there a way to disable jvm1Test
or decouple it from commonTest
?Erik Christensen
07/09/2020, 11:21 PMjvm()
. I don't think you can remove a dependsOn()
relation -- seems like a bad thing to try doing even if it can be done.
Anything in commonTest is supposed to be able to run on all targets that you're building. Is there a reason why you want to build jvm1, but not run tests on it?andymin
07/10/2020, 1:28 AMErik Christensen
07/10/2020, 1:47 AMtasks.getByName("jvm1Test").enabled = false
-- or something like that.andymin
07/10/2020, 5:55 PM