simon.vergauwen
05/08/2023, 2:03 PMintegrationTest
sourceSet but for KMP? I tried doing it (for JVM target only, but KMP would be even better) but the code (attached in thread) seems to break the commonMain
& commonTest
sourceSets.. It's in a private project, but I can recreate a reproducible for YouTrack if this is a bug.ephemient
05/08/2023, 3:32 PMkotlin { jvm { compilations.create("bench") }; sourceSets { getByName("jvmBench").dependsOn(getByName("jvmMain")) } }
just fine: https://github.com/ephemient/aoc2022/blob/main/kt/build.gradle.ktsSebastian Sellmair [JB]
05/08/2023, 3:58 PMephemient
05/08/2023, 3:59 PMassociateWith
resulted in duplicate class definitionsSebastian Sellmair [JB]
05/08/2023, 4:00 PMmain
and test
are trees
commonMain, jvmMain, … are part of the ‘main’ tree
commonTest, jvmTest, … are part of the ‘test’ tree
commonBenchmark, jvmBenchmark, … would be part of the ‘benchmark’ treeassociateWith
shall be used (is also used for our default test compilations that we create for you)
If one tree should be able to see the internals of another tree, then `assocaiteephemient
05/08/2023, 4:04 PMSebastian Sellmair [JB]
05/08/2023, 4:05 PMsimon.vergauwen
05/08/2023, 4:32 PMassociateWith
fixed it 🥳 Thank you.
@Sebastian Sellmair [JB], does this look correct to you?
jvm {
compilations {
val integrationTest by compilations.creating {
// Create a test task to run the tests produced by this compilation:
tasks.register<Test>("integrationTest") {
description = "Run the integration tests"
group = "verification"
classpath = compileDependencyFiles + runtimeDependencyFiles + output.allOutputs
testClassesDirs = output.classesDirs
testLogging {
events("passed")
}
}
}
val test by compilations.getting
integrationTest.associateWith(test)
}
}
Btw can I still use dependsOn
for creating a common native sourceSet 🤔?
create("nativeMain") {
dependsOn(commonMain)
linuxX64Main.dependsOn(this)
macosX64Main.dependsOn(this)
mingwX64Main.dependsOn(this)
}
Sebastian Sellmair [JB]
05/09/2023, 7:26 AMDelicateKotlinGradlePluginApi
and shall be replaced by targetHierarchy.default()
, targetHierarchy.custom
or similar.
Also interesting: We plan that 1.9.20 will automatically create source sets like nativeMain
for you 👍simon.vergauwen
05/09/2023, 7:27 AM