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

Loom persistent project-level cache does not respect --project-cache-dir #1203

Open
lukebemish opened this issue Oct 30, 2024 · 0 comments
Open

Comments

@lukebemish
Copy link
Contributor

lukebemish commented Oct 30, 2024

Gradle has a --project-cache-dir argument that allows it to use a different folder than .gradle as the root-project-level persistent-cache:

--project-cache-dir                Specify the project-specific cache directory. Defaults to .gradle in the root project directory.

This can be useful when testing stuff that writes things there and wanting to compare what it writes accross multiple runs with some differing state, for debugging reasons or otherwise. However, loom does not respect this and always uses .gradle (see the logic here). The correct approach seems to be to obtain this directory from the StartParameter via project.gradle.startParameter.projectCacheDir.

Note, however, that there is no guarantee that the cache directory in question is located in any particular way relative to the root project directory (and really, no reason to make such an assumption in general either)! So obeying this would require re-thinking loom's current approach of one-persistent-cache-folder-per-subproject, which is not something gradle does at all -- basically, the .gradle folder loom creates in subprojects is kinda random and not actually something gradle ever makes. Perhaps instead, loom could store a folder per subproject inside the persistent cache dir of the root project, and so be able to respect this option? That is, instead of

rootProject
- .gradle
  - loom-cache
    - <stuff>
- subproject
  - .gradle
    - loom-cache
      - <stuff>

It would be something like

.whatever-the-persistent-cache-is
- loom-cache
  - <stuff>
  - subproject
    - <stuff>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant