ManApart
12/23/2022, 7:46 PMSourceSet with name 'jvmTestIntegration' not found.
It's strange because it worked before (and works again if I revert) the bump from kotlin 1.6 to 1.7.
I saw in the "what's new in 1.7" that sourcesets and compiling both changed a bit, but I'm unable to understand how I could have broken things or what I need to do to fix it.
FWIW jvmTestIntegration
is meant to be a second test directory that contains slower running tests.
Any tips or pointing in the right direction would be much appreciated. 🙂
compilations {
val main by getting
val jvmTestIntegration by compilations.creating { //Breaks here
defaultSourceSet {
dependencies {
implementation(main.compileDependencyFiles + main.output.classesDirs)
implementation(kotlin("test-junit"))
}
}
tasks.register<Test>("test-integration") {
group = "verification"
description = "Runs the integration tests."
classpath = compileDependencyFiles + runtimeDependencyFiles + output.allOutputs
testClassesDirs = output.classesDirs
}
}
ManApart
12/23/2022, 8:15 PMVampire
12/23/2022, 8:18 PMsourceSets {
val jvmTestIntegration by creating {
and
compilations {
val testIntegration by compilations.creating {
In what you showed here you have
compilations {
val jvmTestIntegration by compilations.creating { //Breaks here
Is that intended?ManApart
12/23/2022, 8:20 PMManApart
12/23/2022, 8:21 PMcompilations
would make a difference, and I've been experimenting with the name of the val
just to see if that makes any difference (matching or not matching a source set)ManApart
12/23/2022, 8:25 PMManApart
12/23/2022, 8:30 PMintegrationTest2
then my sourceset must be named jvmIntegrationTest2
.
It seems that convention maybe changed in moving to 1.7?ManApart
12/23/2022, 8:31 PMintegrationTest2
. Renaming the sourceset to match doesn't fix the issue.Vampire
12/23/2022, 8:39 PMManApart
12/23/2022, 8:41 PMManApart
12/23/2022, 8:41 PMVampire
12/23/2022, 8:42 PMkotlin("multiplatform") version "1.7.21"
to my play project and then the example block from the docs you linked to and add a println(name)
in defaultSourceSet { ... }
it outputs jvmIntegrationTest
and if I change the compilation to jvmIntegrationTest
then it outputs jvmJvmIntegrationTest
ManApart
12/23/2022, 8:43 PMManApart
12/23/2022, 8:47 PMtestIntegration
to jvmTestIntegration
happening in 1.6 in the println but I can't get that far in 1.7 and it says it's unable to find testIntegration
which obviously doesn't have the transformation...ManApart
12/23/2022, 8:49 PMval testIntegrationSource = sourceSets.create("jvmTestIntegration") {
dependsOn(sourceSets["jvmMain"])
}
ManApart
12/23/2022, 8:51 PMval testIntegration by compilations.creating {
source(testIntegrationSource)
ManApart
12/23/2022, 8:55 PMcompilations
block closer to the top of the jvm
block.... testing...ManApart
12/23/2022, 8:59 PMwithJava()
is used before my block, it fails, if it's after my block, my block passes (though my tests aren't running in current state). I need to see if I can get tests passing again and then possibly remove withJava()
(I don't remember why I added it).ManApart
12/23/2022, 9:03 PMwithJava
removes my test task and the build fails. Moving it below compilations makes the gradle happy on 1.7, but my integration tests seem to be missing kotlin.test.*
ManApart
12/23/2022, 9:07 PM