This is an automated email from the ASF dual-hosted git repository.
paulk-asert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/groovy.git
The following commit(s) were added to refs/heads/master by this push:
new 08cb139004 minor refactor: warning for junit.network only when we test
08cb139004 is described below
commit 08cb139004a85be8feb97ccbbdfdd062ed4371e4
Author: Paul King <[email protected]>
AuthorDate: Fri May 8 22:28:30 2026 +1000
minor refactor: warning for junit.network only when we test
---
.../main/groovy/org.apache.groovy-tested.gradle | 24 +++++++++++-----------
1 file changed, 12 insertions(+), 12 deletions(-)
diff --git a/build-logic/src/main/groovy/org.apache.groovy-tested.gradle
b/build-logic/src/main/groovy/org.apache.groovy-tested.gradle
index 518f879ad5..9e84287960 100644
--- a/build-logic/src/main/groovy/org.apache.groovy-tested.gradle
+++ b/build-logic/src/main/groovy/org.apache.groovy-tested.gradle
@@ -182,18 +182,18 @@ Closure buildExcludeFilter(boolean legacyTestSuite) {
}
// Warn (rather than silently NO-SOURCE) when the groovy/grape exclusion
-// swallows the entirety of a project's test source set. A plain
-// `:groovy-grape-test:test` invocation otherwise reports BUILD SUCCESSFUL
-// with zero tests executed — easy to mistake for a passing run.
-afterEvaluate {
- if (!providers.systemProperty('junit.network').getOrNull()) {
- boolean hasGrapeTests = sourceSets.test.allSource.srcDirs.any {
- new File(it, 'groovy/grape').isDirectory()
- }
- if (hasGrapeTests) {
- String testPath = (project.path == ':' ? '' : project.path) +
':test'
- logger.warn("WARNING: ${testPath} will skip groovy/grape/* tests;
set -Djunit.network=true to include them")
- }
+// swallows the entirety of a project's test source set.
+gradle.taskGraph.whenReady { graph ->
+ def testTask = tasks.named('test').get()
+ logger.lifecycle("DEBUG[grape-warn] project=${project.path}
hasTest=${graph.hasTask(testTask)}")
+ if (!graph.hasTask(testTask)) return
+ if (providers.systemProperty('junit.network').getOrNull()) return
+ boolean hasGrapeTests = sourceSets.test.allSource.srcDirs.any {
+ new File(it, 'groovy/grape').isDirectory()
+ }
+ logger.lifecycle("DEBUG[grape-warn] project=${project.path}
hasGrapeTests=${hasGrapeTests}")
+ if (hasGrapeTests) {
+ logger.warn("WARNING: ${testTask.path} will skip groovy/grape/* tests;
set -Djunit.network=true to include them")
}
}