Skip to content

Updates Gradle Wrapper binaries #12908

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

gmazzo
Copy link

@gmazzo gmazzo commented Aug 22, 2025

What are you trying to accomplish?

Extends Gradle Wrapper support introduced by #12891 to also update gradlew and gradle-wrapper.jar by running the native wrapper task.

Note

This PR is based on #12891, the real diff is here

Anything you want to highlight for special attention from reviewers?

Leverages the existing LockfileUpdater, extracting most of its code into a new GradleUpdaterBase class, which has two abstract methods:

  • target_file? to tell the given file is meant to be updated by it
  • command_args to collaborate with the final gradle command run

Now both LockfileUpdater and the new WrapperUpdater inherit from GradleUpdaterBase.

Same as LockfileUpdater is under gradle_lockfile_updater feature flag, a new gradle_wrapper_updater was introduced for WrapperUpdater.

The update will not attempt to use any configuration for the wrapper task in the main build script; many of the repos will be broken because they rely on other files or included builds that will take a long time to complete. We limit to copying the wrapper-related files and running a clean, empty build.

How will you know you've accomplished your goal?

Running against a sample repo:

DEBUG_HELPERS=true bin/dry-run.rb gradle ReactiveX/RxJava --updater-options gradle_lockfile_updater,gradle_wrapper_updater --dep="gradle-wrapper"

produces the desired diff:


=== gradle-wrapper (8.14)
 => checking for updates 1/1
🌍 --> GET https://services.gradle.org/versions/all
🌍 <-- 200 https://services.gradle.org/versions/all
I, [2025-08-22T12:38:02.535120 #13831]  INFO -- : Initializing cooldown filter
I, [2025-08-22T12:38:02.554660 #13831]  INFO -- : Release date not available for version 9.0.0
I, [2025-08-22T12:38:02.554733 #13831]  INFO -- : Filtered out 0 version(s) due to cooldown
 => latest available version is 9.0.0
 => latest allowed version is 9.0.0
 => requirements to unlock: own
 => requirements update strategy: 
gradle --no-daemon wrapper --gradle-version 9.0.0
 => bump gradle-wrapper from 8.14 to 9.0.0

    ± gradlew
    ~~~
    <Script file content truncated>
    ~~~
    23 insertions (+), 16 deletions (-)

    ± gradlew.bat
    ~~~
    <Script file content truncated>
    ~~~
    95 insertions (+), 93 deletions (-)

    ± gradle/wrapper/gradle-wrapper.jar
    ~~~
    Binary files /tmp/original20250822-13831-1i27f6 and /tmp/updated20250822-13831-rbx4cg differ
    ~~~
    0 insertions (+), 0 deletions (-)

    ± gradle/wrapper/gradle-wrapper.properties
    ~~~
    --- /tmp/original20250822-13831-x20t9e      2025-08-22 12:38:09.174914071 +0000
    +++ /tmp/updated20250822-13831-3bg825       2025-08-22 12:38:09.174914071 +0000
    @@ -1,6 +1,7 @@
     distributionBase=GRADLE_USER_HOME
     distributionPath=wrapper/dists
    -distributionUrl=https\://services.gradle.org/distributions/gradle-8.14-bin.zip
    +distributionUrl=https\://services.gradle.org/distributions/gradle-9.0.0-bin.zip
     networkTimeout=10000
    +validateDistributionUrl=true
     zipStoreBase=GRADLE_USER_HOME
     zipStorePath=wrapper/dists
    ~~~
    3 insertions (+), 2 deletions (-)
🌍 Total requests made: '1'
Dry-run completed successfully.

Checklist

  • I have run the complete test suite to ensure all tests and linters pass.
  • I have thoroughly tested my code changes to ensure they work as expected, including adding additional tests for new functionality.
  • I have written clear and descriptive commit messages.
  • I have provided a detailed description of the changes in the pull request, including the problem it addresses, how it fixes the problem, and any relevant details about the implementation.
  • I have ensured that the code is well-documented and easy to understand.

@github-actions github-actions bot added the L: java:gradle Maven packages via Gradle label Aug 22, 2025
@gmazzo gmazzo mentioned this pull request Aug 22, 2025
5 tasks
@gmazzo gmazzo force-pushed the gradle-wrapper-support-binaries branch 5 times, most recently from 9c9bb51 to 9968faa Compare August 23, 2025 08:12
@gmazzo gmazzo force-pushed the gradle-wrapper-support-binaries branch from 9968faa to bd0920a Compare August 23, 2025 08:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
L: java:gradle Maven packages via Gradle
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant