-
-
Notifications
You must be signed in to change notification settings - Fork 305
/
build.gradle
139 lines (134 loc) · 4.43 KB
/
build.gradle
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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
/*
* Master Gradle build script
*/
import aQute.bnd.osgi.About
import aQute.lib.io.IO
if (JavaVersion.current().isCompatibleWith(JavaVersion.VERSION_1_9)) {
ext.jpmsOptions = [
"--add-opens=java.base/java.lang=ALL-UNNAMED",
"--add-opens=java.base/java.lang.invoke=ALL-UNNAMED",
"--add-opens=java.base/java.lang.reflect=ALL-UNNAMED",
"--add-opens=java.base/java.io=ALL-UNNAMED",
"--add-opens=java.base/java.net=ALL-UNNAMED",
"--add-opens=java.base/java.nio=ALL-UNNAMED",
"--add-opens=java.base/java.util=ALL-UNNAMED",
"--add-opens=java.base/java.util.jar=ALL-UNNAMED",
"--add-opens=java.base/java.util.regex=ALL-UNNAMED",
"--add-opens=java.base/java.util.zip=ALL-UNNAMED",
"--add-opens=java.base/sun.nio.ch=ALL-UNNAMED",
"--add-opens=java.base/sun.net.www.protocol.file=ALL-UNNAMED",
"--add-opens=java.base/sun.net.www.protocol.ftp=ALL-UNNAMED",
"--add-opens=java.base/sun.net.www.protocol.http=ALL-UNNAMED",
"--add-opens=java.base/sun.net.www.protocol.https=ALL-UNNAMED",
"--add-opens=java.base/sun.net.www.protocol.jar=ALL-UNNAMED",
"--add-opens=java.base/sun.net.www.protocol.jrt=ALL-UNNAMED"
]
}
boolean isCI = Boolean.parseBoolean(System.getenv("CI"))
/* Configure the subprojects */
subprojects {
if (pluginManager.hasPlugin("biz.aQute.bnd")) {
group = bnd.get("-groupid")
version = bnd.get("base.version")
tasks.withType(JavaCompile).configureEach {
options.compilerArgs.add("-Xlint:unchecked")
}
tasks.named("javadoc") {
options.tags = [
"Immutable:t:",
"ThreadSafe:t:",
"NotThreadSafe:t:",
"GuardedBy:mf:\"Guarded By:\""
]
options.noTimestamp = true
}
tasks.named("test") {
useJUnitPlatform()
if (isCI) {
retry {
maxRetries = 2
maxFailures = 20
}
}
reports {
junitXml {
outputPerTestCase = true
mergeReruns = true
}
}
testLogging {
exceptionFormat = "full"
info {
events("STANDARD_OUT", "STANDARD_ERROR", "STARTED", "FAILED", "PASSED", "SKIPPED")
}
}
if (!logger.isInfoEnabled()) {
var stdOut = [:]
var stdErr = [:]
onOutput { descriptor, event ->
if (event.destination == TestOutputEvent.Destination.StdErr) {
stdErr.get(descriptor, []).add(event)
} else {
stdOut.get(descriptor, []).add(event)
}
}
afterTest { descriptor, result ->
var stdErrEvents = stdErr.remove(descriptor)
var stdOutEvents = stdOut.remove(descriptor)
if (result.resultType == TestResult.ResultType.FAILURE) {
if (stdErrEvents && !stdErrEvents.empty) {
logger.lifecycle("\n{} > {} STANDARD_ERROR", descriptor.className, descriptor.name)
stdErrEvents.each { event ->
logger.lifecycle(" {}", event.message.trim())
}
}
if (stdOutEvents && !stdOutEvents.empty) {
logger.lifecycle("\n{} > {} STANDARD_OUT", descriptor.className, descriptor.name)
stdOutEvents.each { event ->
logger.lifecycle(" {}", event.message.trim())
}
}
}
}
}
if (JavaVersion.current().isCompatibleWith(JavaVersion.VERSION_1_9)) {
jvmArgs(jpmsOptions)
environment("JAVA_OPTS": jpmsOptions.join(" "))
}
if (JavaVersion.current().isCompatibleWith(JavaVersion.VERSION_14)) {
jvmArgs("-XX:+ShowCodeDetailsInExceptionMessages")
}
inputs.files(fileTree(layout.getProjectDirectory()) {
include("testresources/", "testdata/")
exclude {
var f = it.getFile()
if (f.isDirectory() && f.list().length == 0) {
return true
}
try {
return "git check-ignore ${f}".execute().waitFor() == 0
} catch (Exception e) {
return false
}
}
}).withPathSensitivity(PathSensitivity.RELATIVE).withPropertyName("testFolders")
systemProperty("org.slf4j.simpleLogger.defaultLogLevel", gradle.getStartParameter().getLogLevel().name())
if (System.getProperty("maven.repo.local")) {
systemProperty("maven.repo.local", IO.getFile(gradle.getStartParameter().getCurrentDir(), System.getProperty("maven.repo.local")))
}
if (JavaVersion.current().isCompatibleWith(JavaVersion.VERSION_17)) {
systemProperty("java.security.manager", "allow")
}
}
}
}
tasks.register("buildscriptDependencies") {
doLast {
println "Java version: ${JavaVersion.current()}"
println "Bnd version: ${About.getBndVersion()}"
println "bnd_version: ${bnd_version}"
println "bnd_snapshots: ${bnd_snapshots}"
println "bnd_releases: ${bnd_releases}"
println buildscript.configurations.classpath.asPath
}
}