gradle updates
This commit is contained in:
parent
d6fb2825ec
commit
c26727d7a7
@ -5,8 +5,7 @@ buildscript {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'me.champeau.gradle:jmh-gradle-plugin:0.3.1'
|
classpath 'me.champeau.gradle:jmh-gradle-plugin:0.5.2'
|
||||||
classpath 'org.junit.platform:junit-platform-gradle-plugin:1.0.0-M2'
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -18,7 +17,7 @@ subprojects {
|
|||||||
apply from: "$rootProject.projectDir/gradle/jmh.gradle"
|
apply from: "$rootProject.projectDir/gradle/jmh.gradle"
|
||||||
apply from: "$rootProject.projectDir/gradle/checkstyle.gradle"
|
apply from: "$rootProject.projectDir/gradle/checkstyle.gradle"
|
||||||
apply from: "$rootProject.projectDir/gradle/findbugs.gradle"
|
apply from: "$rootProject.projectDir/gradle/findbugs.gradle"
|
||||||
apply plugin: 'com.mindviewinc.tagging'
|
//apply plugin: 'com.mindviewinc.tagging'
|
||||||
}
|
}
|
||||||
|
|
||||||
apply from: 'gradle/subprojects.gradle'
|
apply from: 'gradle/subprojects.gradle'
|
@ -1,3 +1,4 @@
|
|||||||
|
/*
|
||||||
apply plugin: 'findbugs'
|
apply plugin: 'findbugs'
|
||||||
|
|
||||||
findbugs {
|
findbugs {
|
||||||
@ -11,3 +12,4 @@ tasks.withType(FindBugs) {
|
|||||||
html.enabled = true
|
html.enabled = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
@ -1,19 +1,15 @@
|
|||||||
import org.apache.tools.ant.util.TeeOutputStream
|
import org.apache.tools.ant.util.TeeOutputStream
|
||||||
|
|
||||||
apply plugin: 'org.junit.platform.gradle.plugin'
|
|
||||||
|
|
||||||
ext {
|
|
||||||
junitJupiterVersion = '5.0.0-M2'
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
testCompile "org.junit.jupiter:junit-jupiter-api:${junitJupiterVersion}"
|
testImplementation(platform('org.junit:junit-bom:5.7.0'))
|
||||||
testRuntime "org.junit.jupiter:junit-jupiter-engine:${junitJupiterVersion}"
|
testImplementation('org.junit.jupiter:junit-jupiter')
|
||||||
}
|
}
|
||||||
|
|
||||||
junitPlatform {
|
test {
|
||||||
platformVersion '1.0.0-M2'
|
useJUnitPlatform()
|
||||||
includeClassNamePattern '.*'
|
testLogging {
|
||||||
|
events "passed", "skipped", "failed"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* NEW: (REQUIRES CODE REWRITES IN BOOK AND TEST CODE)
|
/* NEW: (REQUIRES CODE REWRITES IN BOOK AND TEST CODE)
|
||||||
@ -45,14 +41,28 @@ junitPlatform {
|
|||||||
JUnit 5's junitPlatformTest runs as a "javaExec" rather than a "test",
|
JUnit 5's junitPlatformTest runs as a "javaExec" rather than a "test",
|
||||||
so we can't hook into the before/after test behavior.
|
so we can't hook into the before/after test behavior.
|
||||||
*/
|
*/
|
||||||
tasks.findByPath(":$name:junitPlatformTest").configure {
|
tasks.findByPath(":$name:test").configure {
|
||||||
File testDir = file("tests")
|
File testDir = file("tests")
|
||||||
if(testDir.exists()) {
|
if(testDir.exists()) {
|
||||||
File outFile = new File(testDir, 'report.txt')
|
File outFile = new File(testDir, 'report.txt')
|
||||||
|
|
||||||
|
Writer taskOutput
|
||||||
|
|
||||||
doFirst {
|
doFirst {
|
||||||
standardOutput = new TeeOutputStream(new FileOutputStream(outFile, true), System.out)
|
taskOutput = project.file(outFile).newWriter()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
testLogging.showStandardStreams = true
|
||||||
|
|
||||||
|
onOutput { descriptor, event ->
|
||||||
|
taskOutput.append(event.message)
|
||||||
|
}
|
||||||
|
|
||||||
doLast {
|
doLast {
|
||||||
|
// WARNING: if the task fails, this won't be executed and the file remains open.
|
||||||
|
// The memory cache version doesn't have this problem.
|
||||||
|
taskOutput.close()
|
||||||
|
|
||||||
if(outFile.size() == 0)
|
if(outFile.size() == 0)
|
||||||
outFile.delete()
|
outFile.delete()
|
||||||
else if(outFile.text.contains("0 tests found"))
|
else if(outFile.text.contains("0 tests found"))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user