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
Gradle has a
--project-cache-dir
argument that allows it to use a different folder than.gradle
as the root-project-level persistent-cache: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 theStartParameter
viaproject.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 ofIt would be something like