-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Build: Store multiple Gradle CC entries #4824
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
base: main
Are you sure you want to change the base?
Conversation
WalkthroughA new configuration property, Changes
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
gradle.properties (1)
48-48
: Document rationale and trade-offs for 100 entries.Caching up to 100 entries per key can speed up switching between tasks but may increase disk usage and cleanup overhead. Consider adding an inline comment here or updating the project’s documentation to explain why
100
was chosen and any expected impact.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
gradle.properties
(1 hunks)
🔇 Additional comments (1)
gradle.properties (1)
48-48
:❌ Incorrect review comment
Ensure compatibility with supported Gradle versions.
The
org.gradle.configuration-cache.entries-per-key
property was introduced in recent Gradle releases. Please confirm that your Gradle wrapper (gradle/wrapper/gradle-wrapper.properties
) points to a version that supports this setting, and bump it if necessary to prevent unknown-property errors or warnings.
🏁 Script executed:
#!/bin/bash # Extract the Gradle wrapper distribution version grep '^distributionUrl' gradle/wrapper/gradle-wrapper.properties | sed -E 's|.*/gradle-(.*)-all\.zip|\1|'Length of output: 186
🌐 Web query:
site:docs.gradle.org "entries-per-key"
💡 Result:
Here are relevant details from the Gradle documentation regarding the
"entries-per-key"
property:
entries-per-key
in GradleThe phrase
"entries-per-key"
typically appears in the context of Gradle's Build Cache or Configuration Cache, particularly with the file-system build cache backend.File System Build Cache Settings
Within the configuration options for the file system build cache, you can find the setting:
entries-per-key
- Property:
entries-per-key
- Scope: build cache (file system backend)
- Type: Integer
- Description:
Specifies the maximum number of cache entries per cache key that will be stored in the directory. If more entries are created for a key, the oldest entries are deleted. This helps limit the size and disk usage of the local build cache.- Default value:
1
(Only the most recent entry per key is kept)Example Configuration in
settings.gradle
:buildCache { local { directory = "${rootDir}/.gradle/build-cache" removeUnusedEntriesAfterDays = 30 entriesPerKey = 2 // Keep up to two entries per key } }Documentation Reference
For more details, see:
In summary:
Theentries-per-key
property is used to control how many build cache entries are stored per key when using the file system build cache backend in Gradle. It helps manage cache size and ensures old cache data is cleaned up efficiently.
🌐 Web query:
site:docs.gradle.org "org.gradle.configuration-cache.entries-per-key"
💡 Result:
Based on the provided search results from
docs.gradle.org
, the propertyorg.gradle.configuration-cache.entries-per-key
is not mentioned in the available documentation. However, here's a summary of relevant configuration cache settings from the Gradle User Manual:
Configuration Cache Settings
org.gradle.configuration-cache
:
Enables/disables the feature entirely (true
/false
)1.- Key Configuration Inputs:
Build scripts, environment variables, system properties, files read during configuration, and JVM parameters2.- Serialization:
Uses optimized serialization for task graphs and avoids Java serialization for performance2.- Parallelization:
Parallel task execution and cache entry loading (enabled by default from Gradle 8.11)3.For advanced cache tuning, Gradle's documentation21 does not currently describe a property for limiting cache entries per key. Such a setting might relate to internal implementation details or future updates not covered here. Check the latest Gradle release notes or issue tracker for additions beyond the provided documents.
Citations:
- 1: https://docs.gradle.org/current/userguide/configuration_cache.html
- 2: https://docs.gradle.org/current/userguide/build_cache.html
- 3: https://blog.gradle.org/road-to-configuration-cache
- 4: https://docs.gradle.com/build-cache-node
- 5: https://blog.gradle.org/introducing-configuration-caching
- 6: https://docs.gradle.org/current/userguide/build_environment.html
- 7: https://github.com/gradle/actions/blob/main/docs/setup-gradle.md
- 8: https://github.com/gradle/configuration-cache-report
- 9: https://developer.squareup.com/blog/5-400-hours-a-year-saving-developers-time-and-sanity-with-gradles/
- 10: https://cookbook.gradle.org/plugin-development/configuration-cache/
Remove invalid Gradle property
The
org.gradle.configuration-cache.entries-per-key
setting is not recognized in any current Gradle release (it’s not documented in Gradle’s Configuration Cache or Build Cache guides). It appears to be an invalid property. If your goal is to cap build‐cache entries per key, use the Gradle DSL insettings.gradle
:buildCache { local { entriesPerKey = 2 // … } }Please remove or correct this line in
gradle.properties
:
- gradle.properties:
org.gradle.configuration-cache.entries-per-key=100
Likely an incorrect or invalid review comment.
Footnotes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the PR! Nice undocumented option :)
It's the first time I’ve seen this option, so I have some questions.
Could you explain why you chose 100 entries? I haven't found any documentation, but noticed that Gradle itself uses only 2 entries per key. Won't 100 entries per key affect the size of the stored Configuration Cache? Am I understood it correctly that the use-case when this property should help is when we switch from one branch to another?
@osipxd Good question. It is still undocumented because the impact is not fully tested: gradle/gradle#28022 (comment) (gradle/gradle#31086). I use |
Thank you for the additional context! Let's start with |
Subsystem
Build, Gradle
Motivation
Gradle only stores the last CC entry by default. It should store multiple entries to faster switch between tasks, like
test
andapiDump
.