Skip to content
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

Honor custom distributionPath for caching downloaded wrapper distributions #29

Open
cloudshiftchris opened this issue Oct 31, 2022 · 3 comments
Labels
enhancement New feature or request

Comments

@cloudshiftchris
Copy link

The distributionPath property in gradle/wrapper/gradle-wrapper.properties is not used when caching distributions. It appears that caching is only supported for the default wrapper/dists location.

@bigdaz
Copy link
Member

bigdaz commented Nov 5, 2022

Thanks for the report: you're assessment is correct. Currently the gradle-build-action can only save/restore wrapper downloads that are located in the default location. Are you setting only distributionPath or are you also specifying distributionBase in gradle-wrapper.properties?

You can configure the action to save/restore more directories inside the Gradle User Home directory, but there's no way to tell the action to save/restore directories outside of the Gradle User Home.

As a workaround:

  • If your wrapper dists are located in a different location in Gradle User Home, you could configure gradle-home-cache-includes with the extra location.
  • If your wrapper dists are located outside of Gradle User Home, then you could setup caching of this directory with actions/cache

@cloudshiftchris
Copy link
Author

Thanks for the info.

Use case is separating our custom Gradle distributions from standard distributions to aid in install / maintenance.

e.g.
distributionPath=wrapper/my-dists

...within the GRADLE_USER_HOME distributionBase.

Is there specific cache logic for wrapper/dists that wouldn't be applied using a generic gradle-home-cache-includes?

@bigdaz
Copy link
Member

bigdaz commented Nov 21, 2022

Is there specific cache logic for wrapper/dists that wouldn't be applied using a generic gradle-home-cache-includes?

Yes, the Gradle wrapper distributions are saved and restored independently of the rest of the Gradle User Home, with the aim to increase sharing between different projects/builds using the same Gradle version.

Another option you have to workaround this limitation is to fork the action and add your custom distribution base here: https://github.com/gradle/gradle-build-action/blob/main/src/cache-extract-entries.ts#LL341C32-L341C32. Note that you'll need to run npm run build to regenerate the transpiled sources.

@bigdaz bigdaz added the enhancement New feature or request label Feb 18, 2023
@bigdaz bigdaz changed the title distributionPath property not honored when caching distributions Honor custom distributionPath for caching downloaded wrapper distributions Feb 18, 2023
@bigdaz bigdaz transferred this issue from gradle/gradle-build-action Feb 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants