-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild.gradle.kts
48 lines (40 loc) · 1.38 KB
/
build.gradle.kts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
`java-library`
kotlin("jvm")
}
base.archivesBaseName = "modularLib"
val moduleName by extra("org.test.modularLib")
java {
sourceCompatibility = JavaVersion.VERSION_1_9
targetCompatibility = JavaVersion.VERSION_1_9
modularity.inferModulePath.set(true)
}
tasks.withType<KotlinCompile> {
kotlinOptions.jvmTarget = "9"
}
val integTest: SourceSet by sourceSets.creating
val integTestImplementation by configurations
dependencies {
integTestImplementation(project)
integTestImplementation(kotlin("test-junit"))
integTestImplementation("junit:junit:4.13")
}
val integTestJarTask = tasks.register<Jar>(integTest.jarTaskName) {
archiveClassifier.set("integration-tests")
from(integTest.output)
}
val integTestTask = tasks.register<Test>("integTest") {
testClassesDirs = integTest.output.classesDirs
// Make sure we run the 'Jar' containing the tests (and not just the 'classes' folder) so that test resources are also part of the test module
classpath = configurations[integTest.runtimeClasspathConfigurationName] + files(integTestJarTask)
}
tasks {
compileJava {
inputs.property("moduleName", moduleName)
options.compilerArgs = listOf(
"--patch-module", "$moduleName=${sourceSets.main.get().output.asPath}"
)
}
check { dependsOn(integTestTask) }
}