Skip to content

Prepare for upgrading Gradle from 8.13 to 9.5#4140

Merged
RobertBrunel merged 1 commit into
FoundationDB:mainfrom
RobertBrunel:gradle-2b
May 15, 2026
Merged

Prepare for upgrading Gradle from 8.13 to 9.5#4140
RobertBrunel merged 1 commit into
FoundationDB:mainfrom
RobertBrunel:gradle-2b

Conversation

@RobertBrunel
Copy link
Copy Markdown
Contributor

@RobertBrunel RobertBrunel commented May 7, 2026

This change fixes further Gradle deprecation warnings.

  • In build.gradle, the archives configuration is deprecated for artifact declaration. Attach sourcesJar, javadocJar, and testJar directly to the assemble task instead, which is the behavior archives was previously providing.

  • Also in build.gradle, in updateYamsql(), capture project.version and the resolved set of yamsql files at configuration time so the doLast block no longer dereferences Project at execution time. Accessing Task.project at execution time becomes an error in Gradle 10.

  • In check.gradle, change Groovy space-assignment syntax to = assignment, as the former is deprecated in Gradle 9.

  • In sphinx.gradle (and also in build.gradle at updateYamsql), replace exec invocations with ExecOperations, injected via a script-local InjectedExecOps helper. Project#exec is deprecated in Gradle 8 and removed in Gradle 9.

  • In testing.gradle, migrate from the deprecated closure-based beforeTest, afterTest, and afterSuite methods on Test to the documented replacement, addTestListener(TestListener).

  • Also in testing.gradle, explicitly set testClassesDirs and classpath on custom Test tasks. Gradle 9 removes the convention that made these default to the value of the built-in test task. Without this fix, destructiveTest, performanceTest, quickTest, rpcTest, singleVersionTest, and mixedModeTest would silently collect no tests once the upgrade lands.

  • yaml-tests.gradle: Use single-string dependency notation in the resolveOtherServer and resolveSpecificServer helpers. Multi-string map notation is deprecated in Gradle 9 and fails with an error in Gradle 10.

  • Also in yaml-tests.gradle, eliminate Task.project accesses at execution time by capturing providers.gradleProperty and layout.buildDirectory.file into locals at configuration time, and reading them from doLast instead of dereferencing project directly.

@RobertBrunel RobertBrunel self-assigned this May 7, 2026
@RobertBrunel RobertBrunel added the build improvement Improvement to the build system label May 7, 2026
@RobertBrunel RobertBrunel requested a review from ScottDugas May 7, 2026 15:00
@RobertBrunel RobertBrunel force-pushed the gradle-2b branch 2 times, most recently from 150e725 to 6c8997f Compare May 13, 2026 18:08
@RobertBrunel RobertBrunel marked this pull request as ready for review May 13, 2026 18:08
@RobertBrunel RobertBrunel changed the title Resolve Gradle 10 deprecation warnings Prepare for upgrading Gradle from 8.13 to 9.5 May 13, 2026
@alecgrieser alecgrieser added the Run mixed-mode Label to add to Pull Requests to have it run mixed mode tests label May 14, 2026
Copy link
Copy Markdown
Collaborator

@alecgrieser alecgrieser left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. I've attached run mixed mode to the PR so that we get coverage of the changes to the mixed mode components of testing, but overall, it seems good.

@RobertBrunel
Copy link
Copy Markdown
Contributor Author

RobertBrunel commented May 14, 2026

LGTM. I've attached run mixed mode to the PR so that we get coverage of the changes to the mixed mode components of testing, but overall, it seems good.

The mixed mode actually revealed further deprecation warnings, so good call. It’s like a whack-a-mole game 😀

This change fixes further Gradle deprecation warnings.

* In `build.gradle`, the `archives` configuration is deprecated for artifact declaration. Attach `sourcesJar`, `javadocJar`, and `testJar` directly to the `assemble` task instead, which is the behavior `archives` was previously providing.

* Also in `build.gradle`, in `updateYamsql()`, capture `project.version` and the resolved set of yamsql files at configuration time so the `doLast` block no longer dereferences `Project` at execution time. Accessing `Task.project` at execution time becomes an error in Gradle 10.

* In `check.gradle`, change Groovy space-assignment syntax to `=` assignment, as the former is deprecated in Gradle 9.

* In `sphinx.gradle` (and also in `build.gradle` at `updateYamsql`), replace `exec` invocations with `ExecOperations`, injected via a script-local `InjectedExecOps` helper. `Project#exec` is deprecated in Gradle 8 and removed in Gradle 9.

* In `testing.gradle`, migrate from the deprecated closure-based `beforeTest`, `afterTest`, and `afterSuite` methods on `Test` to the documented replacement, `addTestListener(TestListener)`.

* Also in `testing.gradle`, explicitly set `testClassesDirs` and `classpath` on custom `Test` tasks. Gradle 9 removes the convention that made these default to the value of the built-in `test` task. Without this fix, `destructiveTest`, `performanceTest`, `quickTest`, `rpcTest`, `singleVersionTest`, and `mixedModeTest` would silently collect no tests once the upgrade lands.

* `yaml-tests.gradle`: Use single-string dependency notation in the `resolveOtherServer` and `resolveSpecificServer` helpers. Multi-string map notation is deprecated in Gradle 9 and fails with an error in Gradle 10.

* Also in `yaml-tests.gradle`, eliminate `Task.project` accesses at execution time by capturing `providers.gradleProperty` and `layout.buildDirectory.file` into locals at configuration time, and reading them from `doLast` instead of dereferencing `project` directly.
Comment thread gradle/sphinx.gradle
var venvDir = "${sphinxRoot}/.venv"
var sphinxBuildDir = "${sphinxRoot}/.out"

// Gives tasks access to an injected `ExecOperations` for running external processes from a `doLast` block.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noticed this tip:

This is a good time to consider extracting the ad-hoc task into a proper class.

Not part of this PR, but something I will be thinking about

@RobertBrunel RobertBrunel merged commit 932fc68 into FoundationDB:main May 15, 2026
22 checks passed
@RobertBrunel RobertBrunel deleted the gradle-2b branch May 15, 2026 08:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build improvement Improvement to the build system Run mixed-mode Label to add to Pull Requests to have it run mixed mode tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants