gradle updates

This commit is contained in:
James Ward 2020-10-06 12:05:43 -06:00
parent d6fb2825ec
commit c26727d7a7
No known key found for this signature in database
GPG Key ID: E0130A3ED5A2079E
3 changed files with 29 additions and 18 deletions

View File

@ -5,8 +5,7 @@ buildscript {
}
}
dependencies {
classpath 'me.champeau.gradle:jmh-gradle-plugin:0.3.1'
classpath 'org.junit.platform:junit-platform-gradle-plugin:1.0.0-M2'
classpath 'me.champeau.gradle:jmh-gradle-plugin:0.5.2'
}
}
@ -18,7 +17,7 @@ subprojects {
apply from: "$rootProject.projectDir/gradle/jmh.gradle"
apply from: "$rootProject.projectDir/gradle/checkstyle.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'

View File

@ -1,3 +1,4 @@
/*
apply plugin: 'findbugs'
findbugs {
@ -10,4 +11,5 @@ tasks.withType(FindBugs) {
xml.enabled = false
html.enabled = true
}
}
}
*/

View File

@ -1,19 +1,15 @@
import org.apache.tools.ant.util.TeeOutputStream
apply plugin: 'org.junit.platform.gradle.plugin'
ext {
junitJupiterVersion = '5.0.0-M2'
}
dependencies {
testCompile "org.junit.jupiter:junit-jupiter-api:${junitJupiterVersion}"
testRuntime "org.junit.jupiter:junit-jupiter-engine:${junitJupiterVersion}"
testImplementation(platform('org.junit:junit-bom:5.7.0'))
testImplementation('org.junit.jupiter:junit-jupiter')
}
junitPlatform {
platformVersion '1.0.0-M2'
includeClassNamePattern '.*'
test {
useJUnitPlatform()
testLogging {
events "passed", "skipped", "failed"
}
}
/* 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",
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")
if(testDir.exists()) {
File outFile = new File(testDir, 'report.txt')
Writer taskOutput
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 {
// 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)
outFile.delete()
else if(outFile.text.contains("0 tests found"))