question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unify cache directory across all OSes

See original GitHub issue

Ref https://github.com/coursier/coursier/issues/1438 / https://github.com/sbt/sbt/issues/5206 Ref https://github.com/sbt/sbt/issues/5120

steps

Where’s Coursier’s cache?

problem

“It depends…”

expectation

Let’s change the default Coursier cache once and for all to a single location: $HOME/.cache/coursier/v1. For all operating systems.

(In my original description I had $HOME/.coursier/cache/. I meant the new $HOME/.cache/coursier/)

notes

In theory, using something like directories-jvm and following the directory standard is a good idea, but it’s messy in practice. If we really want, I’d say only respect $XDG_CACHE_HOME nothing else.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:3
  • Comments:18 (17 by maintainers)

github_iconTop GitHub Comments

4reactions
soccommented, Jan 4, 2020

@eed3si9n I think any app ignoring operating system rules is being a really poor citizen and people are rightfully annoyed. (Just search for “XDG” on GitHub and read the hundreds of issues of users being annoyed that some application ignores the XDG spec; now add to that the people annoyed by ignoring macOS conventions and the people annoyed by ignoring Windows conventions).

All that said, dumping dotfiles in users’ home folders on Windows is not nice, but doable (I actually only know of applications that stopped doing this. SBT would be the first that actively made things worse).

I would be more concerned about not following Apple’s rules to be honest: I wouldn’t take it for granted that applications can still indiscriminately dump their files all over the place in a few years.

To be honest, I don’t really see the point in the change: the paths will still differ across operating systems even after this, and it just makes coursier a worse citizen on 2 of the 3 main platforms it runs on.

2reactions
eed3si9ncommented, Jan 6, 2020

@soc @dwijnand I think it’s a nature of writing an app on JVM. Supposedly the program is written against the Virtual Machine that abstracts all things OS, but we will also make various deals with the devil to get native things like putting color on the terminal or making IPC calls for the sake of improvements. In general respecting directory standards etc I think is a good thing.

For Coursier cache, though, I personally find it inconvenient that the location is not only OS-dependent it is “have you ran an older version” dependent because it will use $HOME/.coursier/cache/. As I do go back and forth between macOS, Linux, and Windows fairly frequently, I personally wish that the Coursier cache was in a single spot across all machines.

I would be more concerned about not following Apple’s rules to be honest: I wouldn’t take it for granted that applications can still indiscriminately dump their files all over the place in a few years.

Coursier currently uses $HOME/.cache anyway. If we followed Apple’s rules it should use $HOME/Library/Caches (or $HOME/Library/Application Support maybe?), but I can’t imagine anyone wanting that.

Edit: looks like I was wrong on the above?

Maybe the difference in the expectations comes from the word “cache.” It is a cached data from the repositories, but unlike browser cache etc you actually don’t want that to be cleared automatically (Debian says cache can live in tmpfs), and from the build’s point of view they are part of the classpath. In terms of XDG, XDG_DOWNLOAD_DIR or XDG_DATA_HOME might have been a better fit.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Configuring the JVM, Java, and Database Cache Options for ...
Sets the JVM that will be used for the directory server and all of its command-line utilities, unless a different JVM is specified...
Read more >
UniFi Video - Using a RAMDisk as a UniFi Video Temporary ...
This article provides instructions on how to install and configure a RAMDisk to be used as a video cache temporary directory for a...
Read more >
3 Ways to Clear System Data Storage on Mac - JumpCloud
Click on the Finder and, in the menu bar, choose Go menu > Go to Folder. Type ~/Library/Caches and press Enter (Figure 5)....
Read more >
Caching packages on the local cache folder
You can use the CentOS Download Cacher R2 to cache packages on an internet-enabled BigFix server. You can configure the BigFix Server to...
Read more >
Caching in GitLab CI/CD
Both artifacts and caches define their paths relative to the project directory, and can't link to files outside it. Cache. Define cache per...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found