Skip to content

Improved: Remove gradle-wrapper.jar from the repository and enhance the init-gradle-wrapper scripts to download and verify the version specified in gradle-wrapper.properties#1055

Merged
jacopoc merged 3 commits into
apache:trunkfrom
jacopoc:improve-init-gradle-wrapper
Apr 4, 2026

Conversation

@jacopoc

@jacopoc jacopoc commented Apr 3, 2026

Copy link
Copy Markdown
Contributor

This change simplifies gradlew upgrades (no longer requiring updates to the scripts or recomputation of file hashes) and improves repository quality by removing the binary file (gradle-wrapper.jar). The behavior of init-gradle-wrapper.sh and init-gradle-wrapper.ps1 is now consistent.

The init-gradle-wrapper.sh and init-gradle-wrapper.ps1 scripts now:

  • download only gradle-wrapper.jar
  • parse the version from gradle-wrapper.properties (no hardcoded version in the scripts)
  • fetch the SHA-256 from services.gradle.org and verify it
  • correctly detect when the JAR already exists and fetch SHA, warn-and-continue if unreachable, exit if match, re-download if mismatch
  • accept arguments:
    ** --help: prints usage + full upgrade workflow, then exits
    ** --upgrade: sets a flag that triggers "./gradlew wrapper" at both success exit points (jar-already-valid and freshly-downloaded-and-verified)
    ** unknown arguments produce an error with a pointer to --help

jacopoc added 3 commits April 3, 2026 12:39
…he init-gradle-wrapper scripts to download and verify the version specified in gradle-wrapper.properties

This change simplifies gradlew upgrades (no longer requiring updates to the scripts or recomputation of file hashes) and improves repository quality by removing the binary file (gradle-wrapper.jar). The behavior of init-gradle-wrapper.sh and init-gradle-wrapper.ps1 is now consistent.

The init-gradle-wrapper.sh and init-gradle-wrapper.ps1 scripts now:

* download only gradle-wrapper.jar
* parse the version from gradle-wrapper.properties (no hardcoded version in the scripts)
* fetch the SHA-256 from services.gradle.org and verify it
* correctly detect when the JAR already exists and fetch SHA, warn-and-continue if unreachable, exit if match, re-download if mismatch
* accept arguments:
** --help: prints usage + full upgrade workflow, then exits
** --upgrade: sets a flag that triggers "./gradlew wrapper" at both success exit points (jar-already-valid and freshly-downloaded-and-verified)
** unknown arguments produce an error with a pointer to --help
@jacopoc jacopoc self-assigned this Apr 3, 2026
@JacquesLeRoux

JacquesLeRoux commented Apr 3, 2026

Copy link
Copy Markdown
Contributor

I'll review and especially test, maybe today, else tmrw.
I'm currently blocked (Win7) and I'll maybe be blocked when testing, let's see...

@JacquesLeRoux

Copy link
Copy Markdown
Contributor

OK, as I supposed, I'm definitely blocked. Windows 7 supports only Gradle 8.11 and npm 13.14.0.
As it's my choice, I'll bypass the issue with a script (several actually), like I did for npm years ago.
It's great that you handled the init-gradle-wrapper.ps1 scripts!

BTW, I got another issue on Ubuntu 20.04 related to node in example. Cloning both repos fixed it.

@JacquesLeRoux

Copy link
Copy Markdown
Contributor

I let you handling #1052 ?

@jacopoc jacopoc merged commit b109e9c into apache:trunk Apr 4, 2026
5 checks passed
@jacopoc jacopoc deleted the improve-init-gradle-wrapper branch April 4, 2026 06:30
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