Johan Vergeer
10/20/2018, 10:23 AMNikky
10/20/2018, 10:30 AMkotlin {
sourceSets.maybeCreate("main").kotlin.apply {
srcDir(rootDir.resolve("something"))
srcDir(config.getGeneratedSrc)
}
}
this is how i do itNikky
10/20/2018, 10:33 AM"test"
Nikky
10/20/2018, 10:35 AMcompileClasspath += main.output + test.output
runtimeClasspath += main.output + test.output
for java, i think will want to do something similarJohan Vergeer
10/20/2018, 11:19 AMNikky
10/20/2018, 11:20 AMJohan Vergeer
10/20/2018, 11:32 AMkotlin {
sourceSets {
maybeCreate("integrationTest").kotlin.apply {
srcDir("src/testIntegration/kotlin")
}
maybeCreate("integrationTest").resources.apply {
srcDir("src/testIntegration/resources")
}
}
Johan Vergeer
10/20/2018, 11:32 AMcompileClasspath += main.output + test.output
runtimeClasspath += main.output + test.output
eskatos
10/20/2018, 12:45 PMJohan Vergeer
10/20/2018, 1:12 PMkotlin
sourceSets.create("integrationTest") {
java.srcDir("src/integrationTest/kotlin")
resources.srcDir("src/integrationTest/resources")
compileClasspath += sourceSets["main"].output + configurations["testRuntimeClasspath"]
runtimeClasspath += output + compileClasspath + sourceSets["test"].runtimeClasspath
}
task<Test>("integrationTest") {
description = "Runs the integration tests"
group = "verification"
testClassesDirs = sourceSets["integrationTest"].output.classesDirs
classpath = sourceSets["integrationTest"].runtimeClasspath
// mustRunAfter(tasks["test"])
}
I took the code snippet from the Gradle website Paul showed me (I did have to upgrade to Gradle 4.10.2 though, and changed some things
Since I have kotlin code the sources are located in src/main/kotlin
and src/integrationTest/kotlin
I also added sourceSets["test"].runtimeClasspath
to the runtimeClassPath.Johan Vergeer
10/20/2018, 1:13 PMintegrationTest
taskeskatos
10/20/2018, 1:14 PMsrc/integrationTest/kotlin
src dir to the kotlin convention of the source set instead of on java
Johan Vergeer
10/20/2018, 1:15 PMkotlin.srcDir("...")
, but that didn’t workeskatos
10/20/2018, 1:15 PMeskatos
10/20/2018, 1:15 PMKotlinSourceSet
convention of your integrationTest
source setJohan Vergeer
10/20/2018, 1:16 PMJohan Vergeer
10/20/2018, 1:19 PMkotlin
sourceSets {
create("integrationTest") {
withConvention(KotlinSourceSet::class) {
kotlin.srcDir("src/integrationTest/kotlin")
resources.srcDir("src/integrationTest/resources")
compileClasspath += sourceSets["main"].output + configurations["testRuntimeClasspath"]
runtimeClasspath += output + compileClasspath + sourceSets["test"].runtimeClasspath
}
}
}
Johan Vergeer
10/20/2018, 1:19 PMJohan Vergeer
10/20/2018, 1:21 PM@Test
annotation import from import org.junit.jupiter.api.Test
to
Johan Vergeer
10/20/2018, 1:22 PMorg.junit.Test
Johan Vergeer
10/20/2018, 1:22 PMeskatos
10/20/2018, 1:22 PMJohan Vergeer
10/20/2018, 1:23 PMtask<Test>("integrationTest") {
description = "Runs the integration tests"
group = "verification"
testClassesDirs = sourceSets["integrationTest"].output.classesDirs
classpath = sourceSets["integrationTest"].runtimeClasspath
mustRunAfter(tasks["test"])
useJUnitPlatform()
}
Johan Vergeer
10/20/2018, 1:23 PMuseJunitPlatform()
Johan Vergeer
10/20/2018, 1:23 PMJohan Vergeer
10/20/2018, 1:24 PMJohan Vergeer
10/20/2018, 1:25 PMhttps://media.giphy.com/media/3oz8xIsloV7zOmt81G/giphy.gif▾
eskatos
10/20/2018, 1:26 PMeskatos
10/20/2018, 1:27 PMJohan Vergeer
10/20/2018, 2:07 PM