Skip to content
New issue

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

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

Already on GitHub? # to your account

Include version catalog file in filehash in the Gradle cache key #237

Closed
3flex opened this issue Oct 1, 2021 · 5 comments · Fixed by #394
Closed

Include version catalog file in filehash in the Gradle cache key #237

3flex opened this issue Oct 1, 2021 · 5 comments · Fixed by #394
Labels
feature request New feature or request to improve the current logic

Comments

@3flex
Copy link

3flex commented Oct 1, 2021

Description:
Add libs.versions.toml or *.versions.toml to the cache key for Gradle dependency caching.

Justification:
Central declaration of dependencies is an incubating Gradle feature that supports centralisation of configuration of dependencies & versions. By convention this is done in a file named libs.versions.toml: https://docs.gradle.org/7.2/userguide/platforms.html#sub:conventional-dependencies-toml

Projects that start using this feature can't practically use the Gradle caching feature in setup-java because the cache key will not change in most cases when dependencies are updated in the TOML file.

Are you willing to submit a PR?
Yes - if this change is acceptable. Edit: no, as I will be using gradle/gradle-build-action@v2 instead which I discovered after raising this issue.

@3flex 3flex added feature request New feature or request to improve the current logic needs triage labels Oct 1, 2021
@3flex 3flex changed the title Include default version catalog file name in cache key Include default version catalog file name in Gradle cache key Oct 1, 2021
@3flex 3flex changed the title Include default version catalog file name in Gradle cache key Include version catalog file in filehash in the Gradle cache key Oct 1, 2021
@3flex
Copy link
Author

3flex commented Oct 14, 2021

Just as an FYI there's less need for this for me personally as I will use gradle/gradle-build-action@v2 which has more robust support for caching dependencies as well as other build outputs like Gradle's build & configuration caches.

@dmitry-shibanov
Copy link
Contributor

Hello @3flex. Sorry for the late response. You can publish a pull request with adding new file caching. If you do not want we will add this caching by our own.
We have a minor question, because we're not experts in gradle, could you please advice us the best pattern for caching: **/libs.versions.toml or **/*.versions.toml.

@3flex
Copy link
Author

3flex commented Oct 14, 2021

Sorry, I won't be working on a PR.

On the best pattern, I'm not sure - **/libs.versions.toml would capture the conventional, default filename. If someone isn't using the default filename then the file could be named anything as far as I know, so **/*.versions.toml is probably not that useful. I'd suggest **/libs.versions.toml to start with.

@dmitry-shibanov
Copy link
Contributor

We'll prepare a pull request later. We keep the issue opened until the pull request is merged.
Thank you for the response and suggestion @3flex.

KengoTODA added a commit to KengoTODA/setup-java that referenced this issue Oct 17, 2022
close actions#237

Signed-off-by: Kengo TODA <skypencil+github@gmail.com>
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
feature request New feature or request to improve the current logic
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants
@3flex @dmitry-shibanov and others