Allow specifying cachedir from cmdline
After a brief mention on Discord (sadly can't link to those)
currently can only enable derived-file caching with a call to CacheDir(path) in an sconscript. It seems like a command-line option to enable caching globally, and set the path - in other words, equivalent to calling the global CacheDir (but not to calling env.CacheDir), would be useful. This would make the feature more equivalent to Repository / --repository=path
While on the subject of the cachedir, should there be an option to prune the cache (flush old entries)?
@mwichmann - Yes, pruning functionality for the cache is definitely needed. Otherwise you inevitably fill your storage with dead cached objects.
@bdbaddog let's make a call on this one - implement or reject, no point in just leaving it sitting here. Use of a cachedir I'd expect to be a relatively permanent feature which you occasionally might want to bypass, so the existing combination of CacheDir in the build files and temporary overrides (--cache-disable and --cache-readonly) seems pretty natural. A --cache-dir or similarly-named option is conventient for testing - you don't have enable inside the test program - but maybe does not have as much real-world value?
Should be pretty easy to implement a --cache-dir?
If so then let's add it.
I can see command line or shell env SCONSFLAGS setting this where it could be different per user instead of same path for every user.
It shouldn't be hard. I just looked and the other cachedir cli args modify module-globals in CacheDir.py. There's one for cachedir enabled, which is implied, but there isn't one for path. A little bit of thinking whether to instantiate it right away or wait.