In Gradle (Groovy), I used to do this to configure source sets:
build.gradle
:
apply plugin: 'java'
apply from: 'gradle/test.gradle'
gradle/test.gradle
:
sourceSets {
unitTest {
compileClasspath += main.output
runtimeClasspath += main.output
}
}
And then I'd use the unitTest
source set for creating tasks.
When I try to do the same in IntelliJ for Gradle KTS:
build.gradle.kts
:
plugins {
java
}
apply(from = "gradle/test.gradle.kts")
gradle/test.gradle.kts
:
sourceSets {
create("unitTest") {
// Do configurations
}
}
If fails with a Unresolved reference: sourceSets
error.
How can I this same thing in Kotlin Gradle?