Skip to content

[improve][build] Upgrade Gradle to 9.7.0 - #26332

Merged
lhotari merged 1 commit into
apache:masterfrom
lhotari:lh-improve-upgrade-gradle-970
Aug 14, 2026
Merged

lhotari merged 1 commit into
apache:masterfrom
lhotari:lh-improve-upgrade-gradle-970

Conversation

@lhotari

@lhotari lhotari commented Aug 14, 2026

Copy link
Copy Markdown
Member

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:

  1. 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 44
    occurrences across the build, so the upgrade would otherwise flood every build with deprecation
    warnings.

  2. ./gradlew test and ./gradlew check at the root fail. The build enables the configuration
    cache by default (org.gradle.configuration-cache=true in gradle.properties), and the GraalVM
    native-build-tools plugin used by :tests:pulsar-client-native-image is not configuration-cache
    compatible: its nativeCompile and generateResourcesConfigFile tasks serialize Project,
    SourceSetContainer and TaskContainer through BaseNativeImageOptions.namedLayers
    (8 problems → Configuration cache entry discarded, build fails). This is pre-existing rather than
    caused by the upgrade, and CI does not hit it — test_group_other excludes the module and the
    NATIVE_IMAGE integration group passes --no-configuration-cache — but any developer running
    ./gradlew test or ./gradlew check does. The root cause is in the plugin
    (graalvm/native-build-tools#477, open),
    so it cannot be fixed in this repository.

Modifications

  • Wrapper → 9.7.0. gradle-wrapper.properties, gradlew, gradlew.bat and gradle-wrapper.jar
    regenerated with ./gradlew wrapper (run twice, as recommended). The wrapper jar matches the
    published gradle-9.7.0-wrapper.jar SHA-256 (7a9ce74c…) and distributionSha256Sum matches the
    published gradle-9.7.0-bin.zip SHA-256 (84fbba45…). The wrapper task rewrites retries and
    retryBackOffMs to its own defaults, so those are restored to the values this repository uses
    (3 / 1000). The one-word comment changes in gradlew/gradlew.bat are what Gradle 9.7.0
    generates.
  • Kotlin DSL delegates rewritten (44 sites, 16 build scripts):
    val x by tasks.registering(T::class) { } → val x = tasks.register<T>("x") { } and
    val x by configurations.creating { } → val x = configurations.create("x") { }. The delegate
    derives 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 in
    tests/pulsar-client-native-image/build.gradle.kts. Builds that pull those tasks in now run without
    the 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 names
    keeps it correct if the plugin adds tasks.
  • graalvm-buildtools 1.1.1 → 1.1.9, which replaces the deprecated
    dependencies.create(project) with dependencies.project(…) and so removes the
    Using a Project object as a dependency notation deprecation (an error in Gradle 10). It does not
    fix the configuration-cache problems above.
  • ARCHITECTURE.md: documents notCompatibleWithConfigurationCache() as the escape hatch for an
    incompatible 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, no
org.gradle.unsafe.isolated-projects usage, and --project-cache-dir is not used. Dropping checksum
files for .asc/.sig only affects Maven publication — the release distributions are signed by
src/sign-release.sh — and ASF Nexus does not require checksums for signature files. The
BuildServiceParameters.None change does not affect MavenPublishLock: running the same
registerIfAbsent(…) { maxParallelUsages = 1 } script under 9.5.1 and 9.7.0 executes the spec action
in both.

Known remaining deprecations (not addressed here)

  • ReportingExtension.file(String) from org.nosphere.apache.rat 0.8.1 (called in RatTask.<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.rat Gradle plugin on the plugin portal. This is the only Gradle
    deprecation left in the full CI build command.
  • Declaring a dependency on an unpublished project for :jclouds-shaded and
    :pulsar-functions:pulsar-functions-api-examples, surfaced by
    publishAllPublicationsToLocalDeployRepository. Deprecated since Gradle 9.3 and therefore
    pre-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

  • Make sure that the change passes the CI checks.

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:

./gradlew <task…> --configuration-cache -Dorg.gradle.configuration-cache.problems=warn \
    -Dorg.gradle.configuration-cache.max-problems=10000 --warning-mode all

Clean, and with the entry reused on an immediate second run: assemble; the CI
assemble rat spotlessCheck checkstyleMain checkstyleTest step; checkBinaryLicense;
publishAllPublicationsToLocalDeployRepository; quickCheck; sanityCheck; the OTHER unit-test
group's task selection from run_unit_group_gradle.sh; the shade-test group; the integrationTest,
javadoc, publishToMavenLocal, spotlessApply, dockerBuild and clean task graphs; a real
:pulsar-common:test run; -Pcoverage, -PtestJavaVersion=25, -PdockerJavaVersion=25,
-PprotobufVersion=3.25.5, -PtestFailFast=true; tasks --all; :pulsar-broker:dependencies;
verifyTestGroups; rat; shadowJar; nar.

./gradlew test, ./gradlew check and :tests:pulsar-client-native-image:test fail on master with
the 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, the
third-party ReportingExtension.file(String) from the RAT plugin described above; all 44 Kotlin DSL
delegate warnings and the GraalVM Project-as-dependency-notation warning are gone.

Final gate was ./gradlew clean followed by the exact commands pulsar-ci.yaml runs — all green —
plus a check that serverDistTar, exportClasspath, prepareBuildContext and dockerBuild still
resolve after the delegate rewrite.

Does this pull request potentially affect one of the following parts:

If the box was checked, please highlight the changes

  • Dependencies (add or upgrade a dependency)
  • The public API
  • The schema
  • The default values of configurations
  • The threading model
  • The binary protocol
  • The REST endpoints
  • The admin CLI options
  • The metrics
  • Anything that affects deployment

Build-tooling dependencies only: the Gradle wrapper (9.5.1 → 9.7.0) and the graalvm-buildtools
Gradle plugin (1.1.1 → 1.1.9). No change to any shipped artifact's dependencies.

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.
@lhotari
lhotari merged commit ab60681 into apache:master Aug 14, 2026
43 checks passed
@lhotari lhotari mentioned this pull request Aug 31, 2026
2 of 11 tasks
@lhotari lhotari added this to the 5.0.0-M2 milestone Sep 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants