Repository navigation
Conversation
|
@sylvestre please let me know if you need me to do anything to improve this, thanks! |
f3ef77c to
ed338fc
Compare
|
I didn't spot any human-written text in this PR including for documentation changes(!) |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2981 +/- ##
==========================================
- Coverage 76.27% 75.57% -0.70%
==========================================
Files 74 74
Lines 45805 45029 -776
==========================================
- Hits 34937 34032 -905
- Misses 10868 10997 +129 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
82c5276 to
b2c81a4
Compare
|
Sorry about the lack of clarity there @ahartmetz. I was a bit too in the weeds focused on updating a PR that I was worried was going to be closed, and I focused too much on the code and not enough on the documentation, that won't happen again from me. I've taken a manual pass at authoring the documentation changes in more plain and understandable language. This is my first time contributing here, so I appreciate your feedback. |
|
(I'm working on the codecov report now) |
|
I believe I improved the code-coverage, but main is red, and #2982 has a fix, so I'll rebase after that lands. |
b7632c8 to
407b17e
Compare
`generate_hash_key` and `get_cached_or_compile` take the basedirs next to the storage, so a request's `SCCACHE_BASEDIRS` reaches the C and Rust hashers without a `Storage` wrapper that forwards every method.
A relative path in a compile's `SCCACHE_BASEDIRS` failed the whole request, so the build saw an error rather than a compile. The server now answers `UnhandledCompile`, the client runs the real compiler, and the stats count the compile as not cacheable under `SCCACHE_BASEDIRS`.
The server and `--show-stats` take their basedirs from the config file and each compile request carries its own, so `config_from_env` has no reader for `SCCACHE_BASEDIRS`. Dropping it removes the hardcoded command list in `run_command` and the second, `to_string_lossy` parse that mangled non-UTF-8 paths; `parse_basedirs_env` is the one parser.
`config_from_env` no longer reads `SCCACHE_BASEDIRS`, so the test feeds the value through `parse_basedirs_env`.
Check that the request's SCCACHE_BASEDIRS and the config file fallback reach the hasher through the server, that the last request value wins, and that equal basedirs collapse to one.
407b17e to
e21d2b3
Compare
|
#2984 does (almost) the same thing but it's a cleaner PR |
|
I'm still interested in this feature, but I'm comfortable if #2984 successfully merges. Let me know what I can do to help. Happy to keep rebasing this PR if a maintainer is interested in this solution. |
|
it has been conflicting for more than 7 days, sorry! please rebase it |
|
Actually, my PR is superseded by #3065, which merged earlier, so I think I'm all set here, Thanks @sylvestre! |
Why
Working with git-worktrees (as I've heavily leaned into this year), I realized that my configuration of sccache wasn't giving me the wall-clock speed savings I expected. Tracing the setup, I realized that I needed basedirs to be updated every time I created a new worktree (if I wanted the worktrees to share a cache for shared dependencies & unchanged crates) and I couldn't use globs or some other patterns.
I found #2814 by @tcashel, and didn't want it to be closed due to inactivity. (If that PR gets merged first, then I imagine this one can be closed)
What changes
SCCACHE_BASEDIRSonce, at startup, so each new worktree needs a server restart.SCCACHE_BASEDIRS. The config file'sbasedirsis the default, andSCCACHE_BASEDIRS=""turns it off.SCCACHE_BASEDIRSset when starting the server is ignored; use the config file.Related PRs
mainalready covers rust: normalize cache keys with SCCACHE_BASEDIRS #2813 (cfb169c).SCCACHE_BASEDIRS+ Preporcessor cache mode hands out another checkout's object file #2863 easier to hit.Review feedback from #2814
Storagewrapper;basedirsgoes straight to hashing.SCCACHE_BASEDIRS, working on bytes.Testing
tests/sccache_cargo.rstests, including concurrent builds with different roots.test_hash_env_dep_equal_to_basedir_is_not_unset, which also fails onmain.Fixes #2595.