Skip to content

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

Closed

Description

@3flex

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.

Activity

  1. changed the title [-]Include default version catalog file name in cache key[/-] [+]Include default version catalog file name in Gradle cache key[/+] on Oct 1, 2021
  2. changed the title [-]Include default version catalog file name in Gradle cache key[/-] [+]Include version catalog file in filehash in the Gradle cache key[/+] on Oct 1, 2021
  3. 3flex commented on Oct 14, 2021

    @3flex
    Author

    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.

  4. dmitry-shibanov commented on Oct 14, 2021

    @dmitry-shibanov
    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.

  5. 3flex commented on Oct 14, 2021

    @3flex
    Author

    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.

  6. dmitry-shibanov commented on Oct 14, 2021

    @dmitry-shibanov
    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.

  7. added a commit that references this issue on Oct 17, 2022
    02d1498
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature requestNew feature or request to improve the current logic

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions