File tree Expand file tree Collapse file tree
build-logic/src/main/groovy Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -182,18 +182,18 @@ Closure buildExcludeFilter(boolean legacyTestSuite) {
182182}
183183
184184// Warn (rather than silently NO-SOURCE) when the groovy/grape exclusion
185- // swallows the entirety of a project's test source set. A plain
186- // `:groovy-grape-test:test` invocation otherwise reports BUILD SUCCESSFUL
187- // with zero tests executed — easy to mistake for a passing run.
188- afterEvaluate {
189- if (! providers . systemProperty( ' junit.network ' ) . getOrNull()) {
190- boolean hasGrapeTests = sourceSets . test . allSource . srcDirs . any {
191- new File (it, ' groovy/grape ' ) . isDirectory()
192- }
193- if (hasGrapeTests) {
194- String testPath = ( project. path == ' : ' ? ' ' : project . path) + ' :test '
195- logger . warn( " WARNING: ${ testPath } will skip groovy/grape/* tests; set -Djunit.network=true to include them " )
196- }
185+ // swallows the entirety of a project's test source set.
186+ gradle . taskGraph . whenReady { graph ->
187+ def testTask = tasks . named( ' test ' ) . get()
188+ logger . lifecycle( " DEBUG[grape-warn] project= ${ project.path } hasTest= ${ graph.hasTask(testTask) } " )
189+ if (! graph . hasTask(testTask)) return
190+ if (providers . systemProperty( ' junit.network ' ) . getOrNull()) return
191+ boolean hasGrapeTests = sourceSets . test . allSource . srcDirs . any {
192+ new File (it, ' groovy/grape ' ) . isDirectory()
193+ }
194+ logger . lifecycle( " DEBUG[grape-warn] project= ${ project.path} hasGrapeTests= ${ hasGrapeTests } " )
195+ if (hasGrapeTests) {
196+ logger . warn( " WARNING: ${ testTask.path } will skip groovy/grape/* tests; set -Djunit.network=true to include them " )
197197 }
198198}
199199
You can’t perform that action at this time.
0 commit comments