Skip to content

Commit c26727d

Browse files
committed
gradle updates
1 parent d6fb282 commit c26727d

File tree

3 files changed

+29
-18
lines changed

3 files changed

+29
-18
lines changed

build.gradle

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ buildscript {
55
}
66
}
77
dependencies {
8-
classpath 'me.champeau.gradle:jmh-gradle-plugin:0.3.1'
9-
classpath 'org.junit.platform:junit-platform-gradle-plugin:1.0.0-M2'
8+
classpath 'me.champeau.gradle:jmh-gradle-plugin:0.5.2'
109
}
1110
}
1211

@@ -18,7 +17,7 @@ subprojects {
1817
apply from: "$rootProject.projectDir/gradle/jmh.gradle"
1918
apply from: "$rootProject.projectDir/gradle/checkstyle.gradle"
2019
apply from: "$rootProject.projectDir/gradle/findbugs.gradle"
21-
apply plugin: 'com.mindviewinc.tagging'
20+
//apply plugin: 'com.mindviewinc.tagging'
2221
}
2322

24-
apply from: 'gradle/subprojects.gradle'
23+
apply from: 'gradle/subprojects.gradle'

gradle/findbugs.gradle

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/*
12
apply plugin: 'findbugs'
23
34
findbugs {
@@ -10,4 +11,5 @@ tasks.withType(FindBugs) {
1011
xml.enabled = false
1112
html.enabled = true
1213
}
13-
}
14+
}
15+
*/

gradle/junit-jupiter.gradle

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,15 @@
11
import org.apache.tools.ant.util.TeeOutputStream
22

3-
apply plugin: 'org.junit.platform.gradle.plugin'
4-
5-
ext {
6-
junitJupiterVersion = '5.0.0-M2'
7-
}
8-
93
dependencies {
10-
testCompile "org.junit.jupiter:junit-jupiter-api:${junitJupiterVersion}"
11-
testRuntime "org.junit.jupiter:junit-jupiter-engine:${junitJupiterVersion}"
4+
testImplementation(platform('org.junit:junit-bom:5.7.0'))
5+
testImplementation('org.junit.jupiter:junit-jupiter')
126
}
137

14-
junitPlatform {
15-
platformVersion '1.0.0-M2'
16-
includeClassNamePattern '.*'
8+
test {
9+
useJUnitPlatform()
10+
testLogging {
11+
events "passed", "skipped", "failed"
12+
}
1713
}
1814

1915
/* NEW: (REQUIRES CODE REWRITES IN BOOK AND TEST CODE)
@@ -45,14 +41,28 @@ junitPlatform {
4541
JUnit 5's junitPlatformTest runs as a "javaExec" rather than a "test",
4642
so we can't hook into the before/after test behavior.
4743
*/
48-
tasks.findByPath(":$name:junitPlatformTest").configure {
44+
tasks.findByPath(":$name:test").configure {
4945
File testDir = file("tests")
5046
if(testDir.exists()) {
5147
File outFile = new File(testDir, 'report.txt')
48+
49+
Writer taskOutput
50+
5251
doFirst {
53-
standardOutput = new TeeOutputStream(new FileOutputStream(outFile, true), System.out)
52+
taskOutput = project.file(outFile).newWriter()
5453
}
54+
55+
testLogging.showStandardStreams = true
56+
57+
onOutput { descriptor, event ->
58+
taskOutput.append(event.message)
59+
}
60+
5561
doLast {
62+
// WARNING: if the task fails, this won't be executed and the file remains open.
63+
// The memory cache version doesn't have this problem.
64+
taskOutput.close()
65+
5666
if(outFile.size() == 0)
5767
outFile.delete()
5868
else if(outFile.text.contains("0 tests found"))

0 commit comments

Comments
 (0)