Skip to content

Commit 8f6f1b3

Browse files
Consolidate test logging
Move test logging to consolidated block. Change all 'rootProject' to 'project'.
1 parent 177256e commit 8f6f1b3

File tree

1 file changed

+27
-42
lines changed

1 file changed

+27
-42
lines changed

build.gradle

Lines changed: 27 additions & 42 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,36 @@ jmh {
120120
}
121121

122122
test {
123-
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"
128-
129-
debug.events = ["skipped", "failed"]
130-
debug.exceptionFormat="full"
131-
132-
info.events = ["failed", "skipped"]
133-
info.exceptionFormat="full"
134-
135-
warn.events = ["failed", "skipped"]
136-
warn.exceptionFormat="full"
137-
}
138-
139123
maxHeapSize = "1200m"
140-
141-
if (System.getenv("CI") == null) {
142-
maxParallelForks = Runtime.runtime.availableProcessors().intdiv(2) ?: 1
143-
}
144124
}
145125

146-
task testng(type: Test) {
126+
task testNG(type: Test) {
147127
useTestNG()
148-
testLogging {
149-
events=["skipped", "failed"]
150-
exceptionFormat="full"
128+
}
129+
130+
check.dependsOn testNG
131+
132+
tasks.withType(Test) {
133+
testLogging {
134+
events = ["skipped", "failed"]
135+
exceptionFormat = "full"
151136

152137
debug.events = ["skipped", "failed"]
153-
debug.exceptionFormat="full"
138+
debug.exceptionFormat = "full"
154139

155140
info.events = ["failed", "skipped"]
156-
info.exceptionFormat="full"
157-
141+
info.exceptionFormat = "full"
142+
158143
warn.events = ["failed", "skipped"]
159-
warn.exceptionFormat="full"
160-
}
161-
}
144+
warn.exceptionFormat = "full"
145+
}
162146

163-
check.dependsOn testng
147+
maxParallelForks = Runtime.runtime.availableProcessors().intdiv(2) ?: 1
148+
}
164149

165150
jacocoTestReport {
166151
dependsOn test
167-
dependsOn testng
152+
dependsOn testNG
168153

169154
reports {
170155
xml.enabled = true
@@ -175,18 +160,18 @@ jacocoTestReport {
175160
check.dependsOn jacocoTestReport
176161

177162
checkstyle {
178-
configFile = rootProject.file("config/checkstyle/checkstyle.xml")
163+
configFile = project.file("config/checkstyle/checkstyle.xml")
179164
configProperties = [
180-
"checkstyle.suppressions.file": rootProject.file("config/checkstyle/suppressions.xml"),
181-
"checkstyle.header.file": rootProject.file("config/license/HEADER_JAVA")
165+
"checkstyle.suppressions.file": project.file("config/checkstyle/suppressions.xml"),
166+
"checkstyle.header.file": project.file("config/license/HEADER_JAVA")
182167
]
183168
}
184169

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

188-
if ("branch".equals(rootProject.releaseMode)) {
189-
190175
if (version.endsWith("-SNAPSHOT")) {
191176
publishing {
192177
repositories {
@@ -204,7 +189,7 @@ if (rootProject.hasProperty("releaseMode")) {
204189
}
205190
}
206191

207-
if ("full".equals(rootProject.releaseMode)) {
192+
if ("full" == project.releaseMode) {
208193
signing {
209194
if (project.hasProperty("SIGNING_PRIVATE_KEY") && project.hasProperty("SIGNING_PASSWORD")) {
210195
useInMemoryPgpKeys(project.getProperty("SIGNING_PRIVATE_KEY"), project.getProperty("SIGNING_PASSWORD"))

0 commit comments

Comments
 (0)