Gleb Minaev
03/18/2023, 11:11 AMidea { module { testSources.from(<path to the source directory>) } }). But Kotlin source sets are not standard Gradle source set...
(Here is the use case.) I have a project with separate benchmarks source set. (Which is used in kotlinx.benchmark.) And benchmark tasks are marked as test ones. But the source set is not. So I want to "fix" the difference.Adam S
03/18/2023, 12:01 PMGleb Minaev
03/18/2023, 1:11 PMAdam S
03/18/2023, 1:12 PMAdam S
03/18/2023, 1:22 PMGleb Minaev
03/18/2023, 1:26 PMAdam S
03/18/2023, 1:30 PMcommonBenchmarkTests, that depends on commonTest
2. create a new platform specific source set, e.g. jvmBenchmarkTests, that depends on the common benchmark source set, and jvmMain
3. tell Kotlin that the JVM target should compile the jvmBenchmarkTests source set
kotlin {
jvm()
sourceSets {
val commonMain by getting { }
val commonTest by getting { }
val jvmMain by getting { }
val jvmTest by getting { }
val commonBenchmarkTests by creating {
description = "Common benchmarks"
dependsOn(commonMain)
}
val jvmBenchmarkTests by creating {
description = "JVM benchmarks"
dependsOn(jvmMain)
dependsOn(commonBenchmarkTests)
}
jvm {
compilations["test"].source(jvmBenchmarkTests)
}
}
}
IntelliJ seems to mark the new source sets as 'test', but I didn't try and compile it.