Skip to content

Commit a5dad0c

Browse files
3.x: Consolidate test logging (#7263)
* Consolidate test logging Move test logging to consolidated block. Change all 'rootProject' to 'project'. * Only do parallel testing on non-CI machines
1 parent 63fcf83 commit a5dad0c

File tree

1 file changed

+27
-40
lines changed

1 file changed

+27
-40
lines changed

build.gradle

Lines changed: 27 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ javadoc {
7171
options.addStringOption("top").value = ""
7272
options.addStringOption("doctitle").value = ""
7373
options.addStringOption("header").value = ""
74-
options.stylesheetFile = rootProject.file("gradle/stylesheet.css")
74+
options.stylesheetFile = project.file("gradle/stylesheet.css")
7575

7676
options.links(
7777
"https://docs.oracle.com/javase/8/docs/api/",
@@ -99,7 +99,7 @@ jar {
9999
}
100100

101101
license {
102-
header rootProject.file("config/license/HEADER")
102+
header project.file("config/license/HEADER")
103103
ext.year = Calendar.getInstance().get(Calendar.YEAR)
104104
skipExistingHeaders true
105105
ignoreFailures true
@@ -120,51 +120,38 @@ jmh {
120120
}
121121

122122
test {
123+
maxHeapSize = "1200m"
124+
}
125+
126+
task testNG(type: Test) {
127+
useTestNG()
128+
}
129+
130+
check.dependsOn testNG
131+
132+
tasks.withType(Test) {
123133
testLogging {
124-
// showing skipped occasionally should prevent CI timeout due to lack of standard output
125-
events=["skipped", "failed"] // "started", "passed"
126-
// showStandardStreams = true
127-
exceptionFormat="full"
134+
events = ["skipped", "failed"]
135+
exceptionFormat = "full"
128136

129137
debug.events = ["skipped", "failed"]
130-
debug.exceptionFormat="full"
138+
debug.exceptionFormat = "full"
131139

132140
info.events = ["failed", "skipped"]
133-
info.exceptionFormat="full"
134-
141+
info.exceptionFormat = "full"
142+
135143
warn.events = ["failed", "skipped"]
136-
warn.exceptionFormat="full"
144+
warn.exceptionFormat = "full"
137145
}
138146

139-
maxHeapSize = "1200m"
140-
141147
if (System.getenv("CI") == null) {
142148
maxParallelForks = Runtime.runtime.availableProcessors().intdiv(2) ?: 1
143149
}
144150
}
145151

146-
task testng(type: Test) {
147-
useTestNG()
148-
testLogging {
149-
events=["skipped", "failed"]
150-
exceptionFormat="full"
151-
152-
debug.events = ["skipped", "failed"]
153-
debug.exceptionFormat="full"
154-
155-
info.events = ["failed", "skipped"]
156-
info.exceptionFormat="full"
157-
158-
warn.events = ["failed", "skipped"]
159-
warn.exceptionFormat="full"
160-
}
161-
}
162-
163-
check.dependsOn testng
164-
165152
jacocoTestReport {
166153
dependsOn test
167-
dependsOn testng
154+
dependsOn testNG
168155

169156
reports {
170157
xml.enabled = true
@@ -175,18 +162,18 @@ jacocoTestReport {
175162
check.dependsOn jacocoTestReport
176163

177164
checkstyle {
178-
configFile = rootProject.file("config/checkstyle/checkstyle.xml")
165+
configFile = project.file("config/checkstyle/checkstyle.xml")
179166
configProperties = [
180-
"checkstyle.suppressions.file": rootProject.file("config/checkstyle/suppressions.xml"),
181-
"checkstyle.header.file": rootProject.file("config/license/HEADER_JAVA")
167+
"checkstyle.suppressions.file": project.file("config/checkstyle/suppressions.xml"),
168+
"checkstyle.header.file": project.file("config/license/HEADER_JAVA")
182169
]
183170
}
184171

185-
if (rootProject.hasProperty("releaseMode")) {
186-
logger.lifecycle("ReleaseMode: {}", rootProject.releaseMode)
172+
if (project.hasProperty("releaseMode")) {
173+
logger.lifecycle("ReleaseMode: {}", project.releaseMode)
174+
175+
if ("branch" == project.releaseMode) {
187176

188-
if ("branch".equals(rootProject.releaseMode)) {
189-
190177
if (version.endsWith("-SNAPSHOT")) {
191178
publishing {
192179
repositories {
@@ -204,7 +191,7 @@ if (rootProject.hasProperty("releaseMode")) {
204191
}
205192
}
206193

207-
if ("full".equals(rootProject.releaseMode)) {
194+
if ("full" == project.releaseMode) {
208195
signing {
209196
if (project.hasProperty("SIGNING_PRIVATE_KEY") && project.hasProperty("SIGNING_PASSWORD")) {
210197
useInMemoryPgpKeys(project.getProperty("SIGNING_PRIVATE_KEY"), project.getProperty("SIGNING_PASSWORD"))

0 commit comments

Comments
 (0)