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
Introduce support for OS-specific standard cache directories #676
Conversation
This cleans up the home directories of users and helps making sure that Coursier's cache is not accidentically backed up by applications or OS functionality. The precedence is as follows: - existing $COURSIER_CACHE environment variable - existing coursier.cache Java property - existing ~/.coursier/ - existing operating system specific standards: - Linux: $XDG_CACHE_HOME/coursier, with fallback to ~/.cache/coursier - Windows: {SpecialFolder.LocalApplicationData}/cache/Coursier - macOS: $HOME/Library/Caches/Coursier
This is required for the bootstrap module, whose JAR is launched as is by the launchers (scripts/generate-launcher.sh).
@soc Shouldn't I mean the coursier cache would be in a sub-directory of |
About the precedence, I think the last two points should be permuted, like
That way, running a previous version of coursier (which would create a |
No, not in this case. There is no platform-independent way to avoid moving GBs of cached files across the network if you put them into the data dir (only Windows supports the distinction with roaming vs. local application data). Cache is the right folder, because it perfectly fits the distinction of "the only thing users see after deleting the cache is that some things take more time". On the other hand, packages that are published locally should go into the dataDir, as they are likely not recoverable from the online repositories. This way, users have the huge benefit of being able to delete their caches without losing their locally published artifacts, and have their locally published artifacts synced across machines without dragging GBs of cached artifacts along with them.
Makes sense, I can change that.
Ooops, sorry I ported directories to Java 6 in dirs-dev/directories-jvm@ed193b4 already. I didn't see your PR. :-/ Please let me know if there are any required changes remaining. |
if (coursierCacheDirectory.getName().equals("v1")) | ||
coursierCacheDirectory = coursierCacheDirectory.getParentFile(); | ||
|
||
return coursierCacheDirectory.getAbsoluteFile(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I made these changes to separate figuring out the various directories in CoursierPaths
from the way they are used CachePath
.
This way dealing with "v1" makes it easy for Coursier to potentially upgrade to a "v2" layout later, without breaking everyone's environment settings pointing to the "v1" dir.
The idea is that you only need to adapt defaultCacheDirectory
to use "v2" and be done without having to write migration code and documenting how users need to change their environment variables.
Ok, let's go for And, yep, I'm going to revert my commit about |
This reverts commit 49d2c90.
See discussion in coursier#676 (comment)
@soc Merging, thanks for having pushed for that! |
Up to coursier 1.0.0-RC12, setting COURSIER_CACHE=foo makes files land in e.g. foo/https/repo1.maven.org/…. #676 changed that to foo/v1/https/…. This commit reverts things back to what they were before that. In the long term, it would be better to keep the v1 component there, but I'd prefer not to change that behavior right now.
@alexarchambault It has been a pleasure! Did you have any chance yet to verify that the paths chosen by |
Up to coursier 1.0.0-RC12, setting COURSIER_CACHE=foo makes files land in e.g. foo/https/repo1.maven.org/…. #676 changed that to foo/v1/https/…. This commit reverts things back to what they were before that. In the long term, it would be better to keep the v1 component there, but I'd prefer not to change that behavior right now.
@soc The Windows CI didn't complain, I'm guessing things work fine there. |
Up to coursier 1.0.0-RC12, setting COURSIER_CACHE=foo makes files land in e.g. foo/https/repo1.maven.org/…. #676 changed that to foo/v1/https/…. This commit reverts things back to what they were before that. In the long term, it would be better to keep the v1 component there, but I'd prefer not to change that behavior right now.
@alexarchambault This agrees with http://doc.qt.io/qt-5/qstandardpaths.html, but I would love to know how they came up with this path in the first place. Can't find anything in the Microsoft documentation. |
This cleans up the home directories of users and helps making sure that
Coursier's cache is not accidentically backed up by applications or OS
functionality.
The precedence is as follows: