-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle.kts
118 lines (101 loc) · 3.34 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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
import org.gradle.api.tasks.testing.logging.TestLogEvent
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
version = "0.9.0"
group = "org.ageseries.libage"
buildscript {
repositories {
mavenCentral()
}
}
repositories {
mavenCentral()
}
plugins {
java
kotlin("jvm") version "1.6.10"
jacoco
idea
id("org.jetbrains.dokka") version "1.6.10"
`maven-publish`
}
dependencies {
implementation("org.jetbrains.kotlin", "kotlin-stdlib", "1.6.10")
implementation("org.apache.commons", "commons-math3", "3.6.1")
implementation("org.jetbrains:annotations:23.0.0")
testImplementation("org.assertj", "assertj-core", "3.22.0")
testImplementation("org.junit.jupiter", "junit-jupiter-api", "5.8.2")
testRuntimeOnly("org.junit.jupiter", "junit-jupiter-engine", "5.8.2")
}
tasks {
named<Test>("test") {
useJUnitPlatform()
// *Always* run tests.
// Ideally we'd cache the test output and print that instead, but this will do for now.
outputs.upToDateWhen { false }
// Print pass/fail for all tests to console, and exceptions if there are any.
testLogging {
events =
setOf(TestLogEvent.FAILED, TestLogEvent.PASSED, TestLogEvent.SKIPPED, TestLogEvent.STANDARD_ERROR)
exceptionFormat = org.gradle.api.tasks.testing.logging.TestExceptionFormat.FULL
showExceptions = true
showCauses = true
showStackTraces = true
showStandardStreams = System.getenv("eln2.core.debug") != ""
// At log-level INFO or DEBUG, print everything.
debug {
events = TestLogEvent.values().toSet()
}
info {
events = debug.events
}
}
// Print a nice summary afterwards.
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)"
val startItem = "| "
val endItem = " |"
val repeatLength = startItem.length + output.length + endItem.length
println(
'\n' + "- ".repeat(repeatLength) + '\n' + startItem + output + endItem + '\n' + "-".repeat(
repeatLength
)
)
}
}))
}
jacocoTestReport {
reports {
xml.required.set(true)
csv.required.set(false)
}
}
dokkaHtml {
dokkaSourceSets.configureEach {
includeNonPublic.set(true)
}
}
}
// By default, build everything, put it somewhere convenient, and run the tests.
defaultTasks = mutableListOf("build", "test")
val compileKotlin: KotlinCompile by tasks
compileKotlin.kotlinOptions {
jvmTarget = "17"
}
val compileTestKotlin: KotlinCompile by tasks
compileTestKotlin.kotlinOptions {
jvmTarget = "17"
}
java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(17))
}
}
publishing {
publications {
create<MavenPublication>("libage") {
from(components["java"])
}
}
}