Repository navigation
[improve][build] Upgrade Gradle to 9.7.0 - #26332
Merged
Merged
Conversation
Gradle 9.6 deprecated the Kotlin DSL property-delegate syntax, so the `by tasks.registering` / `by configurations.creating` declarations are rewritten to the explicit `register`/`create` calls. Also fixes `./gradlew test` and `./gradlew check` at the root, which failed under the build's default configuration cache because the GraalVM native-build-tools plugin is not configuration-cache compatible.
nodece
approved these changes
Aug 14, 2026
2 of 11 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
Keep the build on the current Gradle release. This upgrades the wrapper from 9.5.1 to
9.7.0 and addresses what the
9.x upgrade guide flags for the
9.5.1 → 9.7.0 range.
Two things need work beyond bumping the wrapper:
Gradle 9.6 deprecated the Kotlin DSL property-delegate syntax (
val x by tasks.registering(T::class),val x by configurations.creating). It is scheduled for removal in Gradle 10 and there are 44occurrences across the build, so the upgrade would otherwise flood every build with deprecation
warnings.
./gradlew testand./gradlew checkat the root fail. The build enables the configurationcache by default (
org.gradle.configuration-cache=trueingradle.properties), and the GraalVMnative-build-tools plugin used by
:tests:pulsar-client-native-imageis not configuration-cachecompatible: its
nativeCompileandgenerateResourcesConfigFiletasks serializeProject,SourceSetContainerandTaskContainerthroughBaseNativeImageOptions.namedLayers(8 problems →
Configuration cache entry discarded, build fails). This is pre-existing rather thancaused by the upgrade, and CI does not hit it —
test_group_otherexcludes the module and theNATIVE_IMAGEintegration group passes--no-configuration-cache— but any developer running./gradlew testor./gradlew checkdoes. The root cause is in the plugin(graalvm/native-build-tools#477, open),
so it cannot be fixed in this repository.
Modifications
gradle-wrapper.properties,gradlew,gradlew.batandgradle-wrapper.jarregenerated with
./gradlew wrapper(run twice, as recommended). The wrapper jar matches thepublished
gradle-9.7.0-wrapper.jarSHA-256 (7a9ce74c…) anddistributionSha256Summatches thepublished
gradle-9.7.0-bin.zipSHA-256 (84fbba45…). Thewrappertask rewritesretriesandretryBackOffMsto its own defaults, so those are restored to the values this repository uses(
3/1000). The one-word comment changes ingradlew/gradlew.batare what Gradle 9.7.0generates.
val x by tasks.registering(T::class) { }→val x = tasks.register<T>("x") { }andval x by configurations.creating { }→val x = configurations.create("x") { }. The delegatederives the task/configuration name from the property name, so each rewrite repeats the same name;
no task or configuration is renamed.
notCompatibleWithConfigurationCache()for the GraalVM plugin tasks intests/pulsar-client-native-image/build.gradle.kts. Builds that pull those tasks in now run withoutthe configuration cache (Gradle discards the entry and reports the plugin's problems as warnings)
instead of failing. Matching on the
org.graalvm.buildtools.package rather than on task nameskeeps it correct if the plugin adds tasks.
graalvm-buildtools1.1.1 → 1.1.9, which replaces the deprecateddependencies.create(project)withdependencies.project(…)and so removes theUsing a Project object as a dependency notationdeprecation (an error in Gradle 10). It does notfix the configuration-cache problems above.
ARCHITECTURE.md: documentsnotCompatibleWithConfigurationCache()as the escape hatch for anincompatible third-party plugin, next to the existing configuration-cache rules.
Checked, no change needed
Reviewed the rest of the 9.6.0 and 9.7.0 breaking changes against this build: no
org.gradle.internal.impldep.*imports, no artifact transforms, no custom collection subtypes, noorg.gradle.unsafe.isolated-projectsusage, and--project-cache-diris not used. Dropping checksumfiles for
.asc/.sigonly affects Maven publication — the release distributions are signed bysrc/sign-release.sh— and ASF Nexus does not require checksums for signature files. TheBuildServiceParameters.Nonechange does not affectMavenPublishLock: running the sameregisterIfAbsent(…) { maxParallelUsages = 1 }script under 9.5.1 and 9.7.0 executes the spec actionin both.
Known remaining deprecations (not addressed here)
ReportingExtension.file(String)fromorg.nosphere.apache.rat0.8.1 (called inRatTask.<init>).0.8.1 is the latest release, the call is in the constructor so it cannot be configured away, and
there is no official
org.apache.ratGradle plugin on the plugin portal. This is the only Gradledeprecation left in the full CI build command.
Declaring a dependency on an unpublished projectfor:jclouds-shadedand:pulsar-functions:pulsar-functions-api-examples, surfaced bypublishAllPublicationsToLocalDeployRepository. Deprecated since Gradle 9.3 and thereforepre-existing; fixing it means changing how those projects are consumed, which is out of scope here.
Both become errors in Gradle 10 and need a follow-up before that upgrade.
Verifying this change
This change is a build-tooling change without production code impact; it is verified by the build
itself.
Each of the commands below was run with the configuration cache forced on and its problems demoted to
warnings, after deleting the cache entry so that configuration actually re-ran:
Clean, and with the entry reused on an immediate second run:
assemble; the CIassemble rat spotlessCheck checkstyleMain checkstyleTeststep;checkBinaryLicense;publishAllPublicationsToLocalDeployRepository;quickCheck;sanityCheck; theOTHERunit-testgroup's task selection from
run_unit_group_gradle.sh; the shade-test group; theintegrationTest,javadoc,publishToMavenLocal,spotlessApply,dockerBuildandcleantask graphs; a real:pulsar-common:testrun;-Pcoverage,-PtestJavaVersion=25,-PdockerJavaVersion=25,-PprotobufVersion=3.25.5,-PtestFailFast=true;tasks --all;:pulsar-broker:dependencies;verifyTestGroups;rat;shadowJar;nar../gradlew test,./gradlew checkand:tests:pulsar-client-native-image:testfail onmasterwiththe default settings and succeed after this change (the configuration cache is disabled for those
invocations, as intended).
With
--warning-mode all, the full CI build command reports exactly one Gradle deprecation, thethird-party
ReportingExtension.file(String)from the RAT plugin described above; all 44 Kotlin DSLdelegate warnings and the GraalVM
Project-as-dependency-notation warning are gone.Final gate was
./gradlew cleanfollowed by the exact commandspulsar-ci.yamlruns — all green —plus a check that
serverDistTar,exportClasspath,prepareBuildContextanddockerBuildstillresolve after the delegate rewrite.
Does this pull request potentially affect one of the following parts:
If the box was checked, please highlight the changes
Build-tooling dependencies only: the Gradle wrapper (9.5.1 → 9.7.0) and the
graalvm-buildtoolsGradle plugin (1.1.1 → 1.1.9). No change to any shipped artifact's dependencies.