From c51331dc79298ba3a2cdf6356ddcb405dfd65ef1 Mon Sep 17 00:00:00 2001 From: Ned Twigg Date: Mon, 16 Jan 2023 22:47:38 -0800 Subject: [PATCH] Centralize test configuration into `special-tests` and make sure it doesn't get overwritten. --- lib-extra/build.gradle | 4 ++-- lib/build.gradle | 5 +---- plugin-gradle/build.gradle | 6 ++---- plugin-maven/build.gradle | 2 -- testlib/build.gradle | 16 ---------------- 5 files changed, 5 insertions(+), 28 deletions(-) diff --git a/lib-extra/build.gradle b/lib-extra/build.gradle index d94992f8d3..08bf286d8d 100644 --- a/lib-extra/build.gradle +++ b/lib-extra/build.gradle @@ -25,8 +25,8 @@ dependencies { // we'll hold the core lib to a high standard spotbugs { reportLevel = 'low' } // low|medium|high (low = sensitive to even minor mistakes) -test { - useJUnitPlatform() +apply from: rootProject.file('gradle/special-tests.gradle') +tasks.named('test') { if (JavaVersion.current().isCompatibleWith(JavaVersion.VERSION_16)) { // needed for EclipseCdtFormatterStepTest jvmArgs '--add-opens=java.base/java.lang=ALL-UNNAMED' diff --git a/lib/build.gradle b/lib/build.gradle index 3ef2064765..e7b0298132 100644 --- a/lib/build.gradle +++ b/lib/build.gradle @@ -112,10 +112,7 @@ dependencies { // we'll hold the core lib to a high standard spotbugs { reportLevel = 'low' } // low|medium|high (low = sensitive to even minor mistakes) -tasks.withType(Test).configureEach { - useJUnitPlatform() -} - +apply from: rootProject.file('gradle/special-tests.gradle') jar { for (glue in NEEDS_GLUE) { from sourceSets.getByName(glue).output.classesDirs diff --git a/plugin-gradle/build.gradle b/plugin-gradle/build.gradle index 8a3260d943..11258db0e6 100644 --- a/plugin-gradle/build.gradle +++ b/plugin-gradle/build.gradle @@ -27,13 +27,11 @@ dependencies { testImplementation "com.diffplug.durian:durian-testlib:${VER_DURIAN}" } -test { - useJUnitPlatform() +apply from: rootProject.file('gradle/special-tests.gradle') +tasks.named('test') { testLogging.showStandardStreams = true } -apply from: rootProject.file('gradle/special-tests.gradle') - ////////////////////////// // GRADLE PLUGIN PORTAL // ////////////////////////// diff --git a/plugin-maven/build.gradle b/plugin-maven/build.gradle index e06fce9ace..b46cdda708 100644 --- a/plugin-maven/build.gradle +++ b/plugin-maven/build.gradle @@ -67,9 +67,7 @@ dependencies { } apply from: rootProject.file('gradle/special-tests.gradle') - tasks.withType(Test).configureEach { - useJUnitPlatform() systemProperty 'spotlessMavenPluginVersion', project.version dependsOn 'publishToMavenLocal' dependsOn ':lib:publishToMavenLocal' diff --git a/testlib/build.gradle b/testlib/build.gradle index 30c44ece23..4b16572a8c 100644 --- a/testlib/build.gradle +++ b/testlib/build.gradle @@ -21,22 +21,6 @@ dependencies { // we'll hold the testlib to a low standard (prize brevity) spotbugs { reportLevel = 'high' } // low|medium|high (low = sensitive to even minor mistakes) -test { - useJUnitPlatform() - if (JavaVersion.current().isCompatibleWith(JavaVersion.VERSION_16)) { - // for GJF https://github.com/diffplug/spotless/issues/834 - def args = [ - '--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED', - '--add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED', - '--add-exports=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED', - '--add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED', - '--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED', - '--add-opens=java.base/java.lang=ALL-UNNAMED' - ] - jvmArgs args - } -} - apply from: rootProject.file('gradle/special-tests.gradle') javadoc {