/
build.gradle.kts
62 lines (55 loc) · 1.57 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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
import org.gradle.api.tasks.testing.logging.TestLogEvent
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
id("com.vanniktech.maven.publish") version "0.25.3" apply false
}
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath("org.jetbrains.kotlinx:atomicfu-gradle-plugin:0.22.0")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.10")
}
}
allprojects {
repositories {
mavenCentral()
}
afterEvaluate {
tasks
.matching { task ->
task is KotlinCompile && !task.name.contains("test", ignoreCase = true)
}
.configureEach {
val EXPLICIT_API = "-Xexplicit-api=strict"
this as KotlinCompile
if (EXPLICIT_API !in kotlinOptions.freeCompilerArgs) {
kotlinOptions.freeCompilerArgs += EXPLICIT_API
}
}
tasks.withType<Test>().configureEach {
outputs.upToDateWhen { false }
useJUnitPlatform()
testLogging {
events = setOf(
TestLogEvent.PASSED,
TestLogEvent.SKIPPED,
TestLogEvent.FAILED,
)
}
afterSuite(
KotlinClosure2<TestDescriptor, TestResult, Unit>({ desc, result ->
if (desc.parent == null) { // will match the outermost suite
val output = "Results: ${result.resultType} " +
"(${result.testCount} tests, " +
"${result.successfulTestCount} passed, " +
"${result.failedTestCount} failed, " +
"${result.skippedTestCount} skipped)"
println(output)
}
})
)
}
}
}