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 d77adc27a7 minor refactor: reduce build/CI log noise
d77adc27a7 is described below
commit d77adc27a75d9b466b9a219b5838264279bf27bf
Author: Paul King <[email protected]>
AuthorDate: Tue May 12 05:53:17 2026 +1000
minor refactor: reduce build/CI log noise
---
.../main/groovy/org.apache.groovy-tested.gradle | 2 +-
.../groovy/gradle/TargetJavaHomeSupport.groovy | 29 ++++++++++++++++++++++
2 files changed, 30 insertions(+), 1 deletion(-)
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 cfce5c234d..b0e908caa8 100644
--- a/build-logic/src/main/groovy/org.apache.groovy-tested.gradle
+++ b/build-logic/src/main/groovy/org.apache.groovy-tested.gradle
@@ -125,7 +125,7 @@ tasks.withType(Test).configureEach {
String targetJavaHome = TargetJavaHomeSupport.targetJavaHome(project)
if (targetJavaHome) {
executable = TargetJavaHomeSupport.javaExecutable(targetJavaHome)
- println "Using ${executable} to run tests"
+ TargetJavaHomeSupport.announceTestExecutableOnce(project,
executable.toString())
}
forkEvery = 40
diff --git
a/build-logic/src/main/groovy/org/apache/groovy/gradle/TargetJavaHomeSupport.groovy
b/build-logic/src/main/groovy/org/apache/groovy/gradle/TargetJavaHomeSupport.groovy
index 0156d46f5b..b861d4fb62 100644
---
a/build-logic/src/main/groovy/org/apache/groovy/gradle/TargetJavaHomeSupport.groovy
+++
b/build-logic/src/main/groovy/org/apache/groovy/gradle/TargetJavaHomeSupport.groovy
@@ -20,12 +20,41 @@ package org.apache.groovy.gradle
import groovy.transform.CompileStatic
import org.gradle.api.Project
+import org.gradle.api.plugins.ExtraPropertiesExtension
+
+import java.util.concurrent.ConcurrentHashMap
@CompileStatic
final class TargetJavaHomeSupport {
+ private static final String ANNOUNCED_KEY =
'apacheGroovyAnnouncedTestExecutables'
+
private TargetJavaHomeSupport() {}
+ /**
+ * Prints the "Using <java> to run tests" line only the first time a given
+ * executable path is seen in this Gradle invocation. State is held on the
+ * root project's extra properties so it resets per invocation (important
+ * under the Gradle daemon, where a build-logic static field would persist
+ * across builds).
+ */
+ static void announceTestExecutableOnce(Project project, String executable)
{
+ if (!executable) return
+ ExtraPropertiesExtension ext =
project.rootProject.extensions.extraProperties
+ Set<String> announced
+ synchronized (ext) {
+ if (ext.has(ANNOUNCED_KEY)) {
+ announced = (Set<String>) ext.get(ANNOUNCED_KEY)
+ } else {
+ announced = ConcurrentHashMap.newKeySet()
+ ext.set(ANNOUNCED_KEY, announced)
+ }
+ }
+ if (announced.add(executable)) {
+ println "Using ${executable} to run tests"
+ }
+ }
+
/** Returns the trimmed value of the {@code target.java.home} Gradle
property, or {@code null} if absent/blank. */
static String targetJavaHome(Project project) {
if (!project.rootProject.hasProperty('target.java.home')) return null