Update Gradle to 9.7.0 - #22719
Conversation
The build has been on 9.4.1 since April (opensearch-project#21153). 9.5.x, 9.6.x and 9.7.0 have shipped since; Gradle 9.7.0 was released 2026-08-06. The wrapper bump alone is two lines, but this repository sets systemProp.org.gradle.warning.mode=fail so every deprecated Gradle API in the build logic becomes a hard error before the build will run. Measured on main: zero deprecations on 9.4.1, 22 on 9.6/9.7. The rest of this change resolves them; all of them also become errors in Gradle 10. Changes by class: - Project.exec / javaexec removed: inject ExecOperations (distribution/docker, plugins/repository-hdfs, qa/os/windows-*) - Task convention/extension access replaced with the current API (PluginBuildPlugin, StandaloneRestTestPlugin, RestTestUtil, Jar/Logger/ThirdPartyAudit precommit plugins) - RepositoriesSetupPlugin: the per-artifactUrl assertRepositoryURIIsSecure loop is dropped because getArtifactUrls() is gone in Gradle 9.6+. The reason is now a comment in the file. Repository-level URL checks are unaffected; only the extra per-artifact-URL pass is lost. - buildSrc/build.gradle, build.gradle, distribution/build.gradle: remaining API migrations Wrapper artifacts, all three aligned to 9.7.0 and independently verifiable: - gradle-wrapper.properties -> gradle-9.7.0-all.zip, distributionSha256Sum a9ecb5ac5c2ca40691e6527724d11d0b43b8c0a52825b77c09899f2a72d2d2bf (published at https://gradle.org/release-checksums/) - gradle/wrapper/gradle-wrapper.jar -> sha256 7a9ce74cff467ca1bf60a4fcd9f05185acceda4d0f382434d393e17864262c5d, the published 9.7.0 wrapper JAR checksum - buildSrc/src/main/resources/minimumGradleVersion -> 9.7.0 Note on the committed wrapper JAR: on main it is the official 9.2.0 wrapper JAR while main pins the 9.4.1 distribution, so the two have been out of step for several releases. This change sets it to the official 9.7.0 JAR so its checksum matches the pinned distribution. Signed-off-by: serhiy-bzhezytskyy <me@serhiy-bzhezytskyy.com>
PR Code Analyzer ❗AI-powered 'Code-Diff-Analyzer' found issues on commit d1e07ad. ⛔ Hard block: Issues at Medium severity or above will block this PR from merging.
The table above displays the top 10 most important findings. Pull Requests Author(s): Please update your Pull Request according to the report above. Repository Maintainer(s): You can Thanks. |
|
@reta @andrross — tagging you as the two who have carried the Gradle upgrades here (#21153, #20833), because this one is bigger than the usual bump and there is one thing only a maintainer can unblock. Why this is 20 files and not 2. What needs a maintainer.
If those check out, this needs the One thing worth fixing while we are here. The committed wrapper JAR on The first run rewrites On the red checks. Verified locally with Gradle 9.7.0 on JDK 21: |
| @@ -1 +1 @@ | |||
| 9.4.1 | |||
| 9.7.0 | |||
There was a problem hiding this comment.
Please revert that to 9.4.1 - otherwise it will break every single plugin build (until they move to 9.7.0 as well)
| libsHeapProfCli project(path: ':distribution:tools:heap-prof-cli') | ||
|
|
||
| bcFips libs.bundles.bouncycastle | ||
| // A bare `libs` here is an implicit lookup of the parent project's version-catalog accessor, |
There was a problem hiding this comment.
Ah ... this is unfortunate, may be we could keep libs (at catalog reference) but rename libs configuration? (fe libsOther)
There was a problem hiding this comment.
I tried exactly that first, and it doesn't help — the deprecation isn't a name clash. With the configuration renamed and bcFips libs.bundles.bouncycastle restored, the build still fails:
Property 'libs' was not declared in project ':distribution:archives' and was resolved from project ':distribution'.
at distribution/build.gradle:345
So it is the catalog accessor itself being resolved by implicit lookup in the parent: the configure(subprojects.findAll { ... }) block runs against :distribution:archives and :distribution:packages, where libs is not declared.
Kept the configuration name and captured the bundle where the accessor is in scope instead (18b7d3e):
def bouncycastleBundle = libs.bundles.bouncycastle
configure(subprojects.findAll { ['archives', 'packages'].contains(it.name) }) {
...
bcFips bouncycastleBundleThat also drops the VersionCatalogsExtension boilerplate I had, so the diff is smaller than before.
PR Reviewer Guide 🔍(Review updated until commit 18b7d3e)Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Explore these optional code suggestions:
|
|
❌ Gradle check result for d1e07ad: FAILURE Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change? |
- buildSrc/src/main/resources/minimumGradleVersion: back to 9.4.1. It
declares the minimum Gradle for consumers of build-tools, so raising it
would force every plugin build to move to 9.7.0 as well.
- distribution/build.gradle: capture the version-catalog bundle where the
`libs` accessor is in scope, instead of resolving VersionCatalogsExtension
by hand. Referencing `libs` inside the configure {} block resolves it by
implicit lookup in the parent project, which is deprecated in 9.6 and an
error in Gradle 10. Renaming the `libs` configuration does not help: the
deprecation is about the accessor not being declared in
:distribution:archives / :distribution:packages, not about a name clash.
- buildSrc/src/testKit/thirdPartyAudit/build.gradle: Project.getProperties()
is deprecated in 9.7.0, and ThirdPartyAuditTaskIT asserts the nested build
emits no deprecation warnings, so all five of its tests failed in
gradle-check. Use findProperty(), which keeps the null-for-absent
behaviour the tests rely on.
Signed-off-by: serhiy-bzhezytskyy <me@serhiy-bzhezytskyy.com>
|
Persistent review updated to latest commit 18b7d3e |
|
Mine —
Pre-existing — The class has an open flaky report, #19808, which records it failing during post-merge and timer-triggered runs on |
|
❌ Gradle check result for 18b7d3e: null Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change? |
|
The
It was not specific to this PR — another run in the same window ended identically with Could someone re-trigger |
|
❌ Gradle check result for 18b7d3e: FAILURE Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change? |
Description
Updates Gradle from 9.4.1 to 9.7.0.
The wrapper bump alone is two lines, but this repository sets
systemProp.org.gradle.warning.mode=fail, so every deprecated Gradle API in the build logic is a hard error before the build will run. Measured onmain: zero Gradle deprecations on 9.4.1, 22 on 9.6/9.7. The rest of the change resolves them; all 22 also become errors in Gradle 10.Changes by class:
Project.exec/javaexecremoved — injectExecOperations(distribution/docker,distribution/docker/docker-build-context,plugins/repository-hdfs,qa/os/windows-2012r2,qa/os/windows-2016).PluginBuildPlugin,StandaloneRestTestPlugin,RestTestUtil,JarHellPrecommitPlugin,LoggerUsagePrecommitPlugin,ThirdPartyAuditPrecommitPlugin).RepositoriesSetupPlugin—getArtifactUrls()is gone in Gradle 9.6+, so the per-artifact-URLassertRepositoryURIIsSecureloop cannot be kept. The reason is now a comment in the file. Repository-level URL checks are unaffected; only the extra per-artifact-URL pass is lost.build.gradle,buildSrc/build.gradle,distribution/build.gradle.Wrapper artifacts, all three aligned to 9.7.0 and independently verifiable against https://gradle.org/release-checksums/:
gradle/wrapper/gradle-wrapper.propertiesgradle-9.7.0-all.zip,distributionSha256Sum=a9ecb5ac5c2ca40691e6527724d11d0b43b8c0a52825b77c09899f2a72d2d2bfgradle/wrapper/gradle-wrapper.jar7a9ce74cff467ca1bf60a4fcd9f05185acceda4d0f382434d393e17864262c5dbuildSrc/src/main/resources/minimumGradleVersion9.7.0mainit is the official 9.2.0 wrapper JAR whilemainpins the 9.4.1 distribution — the two have been out of step for several releases. This PR sets it to the official 9.7.0 JAR so it matches the pinned distribution and its checksum can be verified against the published value above. Flagging this explicitly becauseCode-Diff-Analyzercorrectly raises the replacement of a build-tool binary as a supply-chain concern; the checksums above are exactly what it asks a maintainer to confirm.Related Issues
Resolves #22718
Supersedes #22638 and #22639, which proposed the same work targeting 9.6.1. Retargeted because 9.7.0 shipped on 2026-08-06 and needs no additional changes over 9.6.1 — verified locally: identical file set, and both the configuration phase and a full compile pass with no Gradle deprecations. Both are being closed in favour of this PR, which is also rebuilt on current
main(the 9.6.1 branch was 30 commits behind).Check List
gradle-checkexercises the full suite under the new Gradle.)Verified locally with Gradle 9.7.0 on JDK 21:
./gradlew --versionreports Gradle 9.7.0./gradlew precommit --dry-run— configuration phase clean, which is wherewarning.mode=failbites./gradlew :server:compileJava :buildSrc:build -x :buildSrc:testDeprecated Gradle features were used in this buildnotice in either runI did not run the full test suite locally; leaving that to
gradle-check.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.