Cache Gradle wrapper distribution separately from the dependency cache#1098
Merged
brunoborges merged 1 commit intoJul 10, 2026
Conversation
The Gradle wrapper distribution (~/.gradle/wrapper) only depends on gradle-wrapper.properties, which changes rarely, but it was previously cached in the same entry as ~/.gradle/caches, keyed on volatile **/*.gradle* files with no restoreKeys (issue #269). Every dependency change therefore re-downloaded the wrapper. Move ~/.gradle/wrapper into a dedicated `gradle-wrapper` additional cache keyed only on **/gradle-wrapper.properties, reusing the additionalCaches infrastructure introduced for the Maven wrapper fix. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
ac3a4a8
into
brunoborges-fix-maven-wrapper-caching
403 checks passed
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.
Description:
The Gradle wrapper distribution (
~/.gradle/wrapper) is downloaded bygradlewand depends only ongradle/wrapper/gradle-wrapper.properties, which changes very rarely. However, it was previously stored in the same cache entry as the Gradle dependency caches (~/.gradle/caches), whose key is computed from volatile files such as**/*.gradle*. Because there are intentionally norestoreKeys(see #269), almost every dependency change is a full cache miss, so the rarely-changing wrapper distribution was re-downloaded on every build.This is the same root cause fixed for the Maven wrapper in #1097. This PR applies the identical treatment to Gradle:
~/.gradle/wrapperout of the main Gradle cachepath(leaving~/.gradle/caches).gradle-wrapperadditional cache keyed only on**/gradle-wrapper.properties.This keeps the wrapper distribution cached across the frequent
**/*.gradle*changes that rotate the main cache key. The main Gradle cache key computation is unchanged (its pattern still lists**/gradle-wrapper.properties, among others).This is a stacked follow-up to #1097 and depends on the generic
additionalCachesinfrastructure introduced there (AdditionalCacheinterface,computeAdditionalCacheKey,restoreAdditionalCache,saveAdditionalCache, and name-scoped restore→save state keys). It reuses that infrastructure without modifying Maven or sbt.Related issue:
Related context: #1095 (the closing
Fixes #1095reference belongs to #1097).Check list:
npm run checklocally (format, lint, build, test) and all checks pass.