gradle: Fix wrapper updater to update all 4 wrapper files#13578
Closed
kbukum1 wants to merge 1 commit into
Closed
Conversation
5 tasks
…r handling - Consolidate wrapper update logic into dedicated methods for clarity. - Ensure both wrapper update commands are executed in sequence. - Add error handling for wrapper task failures, raising DependencyFileNotResolvable. - Update specs to verify command execution and handle wrapper updates correctly.
93c109f to
fbb6910
Compare
Contributor
Author
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.
What are you trying to accomplish?
This PR fixes the Gradle wrapper updater to update all 4 wrapper files (gradlew, gradlew.bat, gradle-wrapper.jar, and gradle-wrapper.properties) instead of only updating the gradle-wrapper.properties file.
Why: The current implementation only updates the properties file, leaving the wrapper scripts and JAR at the old version. This causes build inconsistencies and defeats the purpose of updating the wrapper.
Related Issue: #13501
Anything you want to highlight for special attention from reviewers?
Key implementation decisions:
Two-step wrapper execution: Following Gradle's official documentation, the wrapper task must be run twice:
Use ./gradlew instead of gradle: The project's wrapper should be used, not the system Gradle installation, to ensure consistency.
Binary file handling: Added proper support for binary files (gradle-wrapper.jar) using Base64 encoding/decoding and binread/binwrite.
Error handling: Changed from silent failure (puts) to raising DependencyFileNotResolvable following Dependabot standards (matches bundler, npm, python ecosystems).
File permissions: Ensured gradlew scripts are executable (chmod 0o755).
Return pattern: Returns all dependency_files with wrapper files replaced (matches the LockfileUpdater pattern in the same codebase).
How will you know you've accomplished your goal?
Tests added:
Test results: