-
Notifications
You must be signed in to change notification settings - Fork 3
/
build-it.gradle.kts
57 lines (47 loc) · 1.71 KB
/
build-it.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
49
50
51
52
53
54
55
56
57
import org.apache.tools.ant.taskdefs.condition.Os
import java.io.OutputStream
val integrationTestGroovy = createIntegrationTestTask("groovy", "build.gradle")
val integrationTestKotlin = createIntegrationTestTask("kotlin", "build.gradle.kts")
val integrationTests = task("integrationTests") {
dependsOn(integrationTestGroovy)
dependsOn(integrationTestKotlin)
mustRunAfter(tasks.getByName("test"))
}
tasks.getByName("check") {
dependsOn(integrationTests)
}
fun createIntegrationTestTask(dsl: String, script: String): Task {
val prepareIntegrationTest = task("prepareIntegrationTest${dsl.capitalize()}", Copy::class) {
val shadowJar = tasks.getByName("shadowJar")
dependsOn(shadowJar)
from(shadowJar.outputs) {
rename("(.*)-all.jar", "libs/$1.jar")
}
from(projectDir) {
include("gradle/**")
include("gradlew")
include("gradlew.bat")
}
from(file("integration-test")) {
rename("^_${script}$", script)
}
into("$buildDir/integrationTests/${dsl.toLowerCase()}-dsl")
}
return task("integrationTest${dsl.capitalize()}", Exec::class) {
dependsOn(prepareIntegrationTest)
workingDir = prepareIntegrationTest.destinationDir
standardOutput = object : OutputStream() {
override fun write(ignored: Int) {}
}
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
commandLine("cmd", "/c", "gradlew.bat")
} else {
commandLine("./gradlew")
}
if (System.getenv("CI") == "true") {
args("build", "--stacktrace", "--no-daemon")
} else {
args("build", "--stacktrace")
}
}
}