From 2482e000965db15c14dbc667ee48d4a376946401 Mon Sep 17 00:00:00 2001 From: Steve Ramage Date: Sat, 20 Jun 2026 07:17:01 -0700 Subject: [PATCH 1/3] fix: repair build scan config via Develocity plugin (opt-in) Build scans stopped working because the configuration in build.gradle.kts used the legacy Gradle Enterprise API at the project level: if (hasProperty("buildScan")) { extensions.findByName("buildScan")?.withGroovyBuilder { setProperty("termsOfServiceUrl", ...) setProperty("termsOfServiceAgree", "yes") } } On Gradle 9 the `--scan` flag auto-applies the Develocity plugin, which (a) is a settings plugin, so there is no project-level `buildScan` extension to find, and (b) renamed the properties to `termsOfUseUrl` / `termsOfUseAgree`. The `?.` therefore silently no-ops and the terms are never accepted, so scan publishing fails. Because the plugin was only ever auto-applied by `--scan`, its API also shifted on every Gradle wrapper bump - hence the intermittent breakage. Apply `com.gradle.develocity` 4.4.3 explicitly in settings.gradle.kts (deterministic across wrapper bumps) and configure it with the current API. Keep it strictly opt-in: the terms are accepted and a scan is published only when `-PbuildScan` is passed (e.g. from CI). Local and contributor builds neither accept Gradle's terms of use nor upload any environment data. Remove the dead legacy block from build.gradle.kts. Co-Authored-By: Claude Opus 4.8 (1M context) --- build.gradle.kts | 8 -------- settings.gradle.kts | 18 ++++++++++++++++++ 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index faa22c5b..ede7420d 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -392,14 +392,6 @@ tasks { } -if (hasProperty("buildScan")) { - extensions.findByName("buildScan")?.withGroovyBuilder { - setProperty("termsOfServiceUrl", "https://gradle.com/terms-of-service") - setProperty("termsOfServiceAgree", "yes") - } -} - - tasks.register("publishPluginStandalone") { token.set(System.getenv("PUBLISH_TOKEN")) // pluginVersion is based on the SemVer (https://semver.org) and supports pre-release labels, like 2.1.7-alpha.3 diff --git a/settings.gradle.kts b/settings.gradle.kts index 3ac145b1..d92e74a3 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -1 +1,19 @@ +plugins { + id("com.gradle.develocity") version "4.4.3" +} + rootProject.name = "systemdUnitFilePlugin" + +// Build scans upload build + environment data to Gradle's public service and are +// governed by https://gradle.com/help/legal-terms-of-use . We therefore only +// accept the terms and publish a scan when explicitly opted in via -PbuildScan +// (e.g. from CI). Local and contributor builds neither accept the terms nor upload. +val buildScanOptIn = providers.gradleProperty("buildScan").isPresent + +develocity { + buildScan { + termsOfUseUrl = "https://gradle.com/help/legal-terms-of-use" + termsOfUseAgree = if (buildScanOptIn) "yes" else "no" + publishing.onlyIf { buildScanOptIn } + } +} \ No newline at end of file From d9930e3163d78617b5bde5645184e3d168aa5fb7 Mon Sep 17 00:00:00 2001 From: Steve Ramage Date: Sat, 20 Jun 2026 07:21:55 -0700 Subject: [PATCH 2/3] ci: enable build scans via -PbuildScan instead of --scan The Develocity plugin is now applied explicitly and gates scan publishing on the `-PbuildScan` opt-in (publishing.onlyIf). Pass that property from CI so release builds keep publishing scans. `--scan` is dropped: it would force publishing even without the opt-in, which now fails because the terms of use are only accepted when `-PbuildScan` is set. Co-Authored-By: Claude Opus 4.8 (1M context) --- ci/release.Jenkinsfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ci/release.Jenkinsfile b/ci/release.Jenkinsfile index 4c58a045..64f1f32f 100644 --- a/ci/release.Jenkinsfile +++ b/ci/release.Jenkinsfile @@ -355,7 +355,7 @@ pipeline { sh(""" mkdir -p ./build ./generate-changelog > build/CHANGELOG - ./gradlew --no-daemon -I ./build-cache-init.gradle.kts -I ./repo-cache-init.gradle.kts --build-cache build buildPlugin --scan + ./gradlew --no-daemon -I ./build-cache-init.gradle.kts -I ./repo-cache-init.gradle.kts --build-cache build buildPlugin -PbuildScan """) script { if (env.BRANCH_NAME ==~ /^([0-9][0-9][0-9]\.x)$/) { @@ -378,7 +378,7 @@ pipeline { """ ) sh(""" - ./gradlew --no-daemon -I ./build-cache-init.gradle.kts --build-cache publishPluginStandalone --scan + ./gradlew --no-daemon -I ./build-cache-init.gradle.kts --build-cache publishPluginStandalone -PbuildScan """) } else { From 8a20262aa1febf559d022955e38d09f3f3d43912 Mon Sep 17 00:00:00 2001 From: Steve Ramage Date: Sat, 20 Jun 2026 07:46:49 -0700 Subject: [PATCH 3/3] fix: only set termsOfUseAgree when opted in The Develocity plugin rejects any value other than "yes" for buildScan.termsOfUseAgree - setting "no" produces a hard error: The buildScan extension 'termsOfUseAgree' value must be exactly the string 'yes' (without quotes). The value given was 'no'. This surfaced on a release build that still passed --scan (which forces a publish attempt) without -PbuildScan. Set termsOfUseAgree only when opted in; otherwise leave it unset so a stray --scan degrades to a soft "terms not agreed" notice instead of failing configuration. Co-Authored-By: Claude Opus 4.8 (1M context) --- settings.gradle.kts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/settings.gradle.kts b/settings.gradle.kts index d92e74a3..5862968a 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -13,7 +13,12 @@ val buildScanOptIn = providers.gradleProperty("buildScan").isPresent develocity { buildScan { termsOfUseUrl = "https://gradle.com/help/legal-terms-of-use" - termsOfUseAgree = if (buildScanOptIn) "yes" else "no" + // 'termsOfUseAgree' must be exactly "yes" or left unset - the plugin rejects "no". + // Only agree (and publish) when opted in; otherwise leave it unset so a stray + // --scan degrades to a soft "terms not agreed" notice rather than a hard error. + if (buildScanOptIn) { + termsOfUseAgree = "yes" + } publishing.onlyIf { buildScanOptIn } } } \ No newline at end of file