Repository navigation
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3021 +/- ##
==========================================
+ Coverage 79.68% 79.70% +0.01%
==========================================
Files 75 75
Lines 46636 46899 +263
==========================================
+ Hits 37161 37379 +218
- Misses 9475 9520 +45 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
| ( | ||
| &shared, | ||
| &nested, | ||
| vec![remap(&root, up), remap(&shared, here), remap(&ws, here)], |
There was a problem hiding this comment.
here ws maps to . like the cwd, so ws/x and shared/x both become ./x
is that intended? diagnostics on generated files would point at the wrong place
There was a problem hiding this comment.
Not intended, fixed. ws is now mapped to ../ws, the same path it gets through root, so its name is also in the key. Basedirs the cwd can't reach map under /sccache/basedir instead of ..
| let weak_toolchain_key = rust_dist_toolchain_weak_key(&m, &self.sysroot); | ||
| let remap_arguments = if env_vars | ||
| .iter() | ||
| .any(|(k, v)| k == "SCCACHE_BASEDIRS_REMAP_PATHS" && v == "1") |
There was a problem hiding this comment.
only 1? SCCACHE_DIRECT accepts true/on/1 too, could be consistent, no?
There was a problem hiding this comment.
Made it consistent with SCCACHE_DIRECT: true, on, and 1 are accepted now. The name is also matched ignoring case on Windows.
| if cwd | ||
| .components() | ||
| .chain(output_dir.components()) | ||
| .any(|c| c == Component::ParentDir) |
There was a problem hiding this comment.
silently no remapping here, could you please add a debug! so it is visible?
858cd6b to
8e2a166
Compare
8e2a166 to
8c82032
Compare
| let from_cwd = in_cwd.iter().find_map(|outer| { | ||
| let rest = dir.strip_prefix(outer).ok()?; | ||
| let depth = cwd.components().count() - outer.components().count(); | ||
| Some(iter::repeat_n("..", depth).collect::<PathBuf>().join(rest)) |
There was a problem hiding this comment.
same depth + repeat_n("..") as above, could be a small helper, no?
There was a problem hiding this comment.
Moved it into an up_to closure, used in both places.
|
sorry but it needs to be rebased |
fb551a0 to
5892f69
Compare
|
Rebased on main and squashed into one commit. Also: a |
|
sorry but it needs to be rebased |
With basedirs, a cache hit can restore a crate compiled in another checkout, whose absolute paths rustc wrote into the rmeta, rlib and debug info. See mozilla#2765. With SCCACHE_BASEDIRS_REMAP_PATHS set to true, on or 1 in the environment of a compile (the name is matched ignoring case on Windows), sccache passes rustc --remap-path-prefix for the basedirs, so these outputs are the same in every checkout. Paths under the basedirs of the cwd become relative to the cwd, so diagnostics still lead to the files (crates compiled outside the workspace root are each mapped to `.`, so their file names do not tell them apart); basedirs of the output directory below them are mapped from the cwd too, so that their names are in the key. The output directory's other basedirs, such as the OUT_DIR of a crates.io dependency, have no such path in every checkout and go under /sccache/basedir, which names no local file. The mappings go before the user's own, which take precedence, and are hashed with the basedirs stripped. Such compiles are not distributed, since the mappings name local paths.
|
Rebased on main, now on top of #3020: a compile is not distributed when it is incremental or its basedirs are remapped. |
5892f69 to
3fa5250
Compare
mozilla#3065 made basedirs a Cow from the compile's environment; mozilla#3021 was written against the server's slice. Claude-Session: https://claude.ai/code/session_01LxWKLQwo8hQv5emM5dWmFy
…and why Carries mozilla#3065 (per-compile SCCACHE_BASEDIRS) so parallel worktrees share cached workspace crates. PRIME-RADIANT.md records why, the measurements, and why mozilla#3021 isn't carried (chao's rustc wrapper remaps every rustc call instead). primeradiant-release.yml publishes Linux x86_64 and Apple Silicon binaries for tags. Claude-Session: https://claude.ai/code/session_01LxWKLQwo8hQv5emM5dWmFy
With SCCACHE_BASEDIRS, a cache hit can hand a crate the outputs of another checkout, and rustc writes that checkout's absolute paths into the rmeta, rlib and debug info, so they differ from what a local compile would produce.
With SCCACHE_BASEDIRS_REMAP_PATHS set to true, on or 1 in the environment of a compile, sccache passes rustc --remap-path-prefix for the basedirs. Paths under the cwd's basedirs become relative to the cwd, so diagnostics still lead to the files, and basedirs of the output directory below them are mapped from the cwd too. The output directory's other basedirs (a dependency's OUT_DIR) have no such path in every checkout and go under /sccache/basedir. The mappings go before the user's own, which win where both match, and are hashed with the basedirs stripped. It is read from the compile's environment like SCCACHE_DIRECT, so it needs no config or protocol change and works in client-side mode. On Windows its name matches case-insensitively. Crates cargo compiles outside the workspace root are each mapped to
., so their file names do not tell them apart. Such compiles are not distributed. Without the variable, keys and commands are unchanged.Tested on Windows with unit tests in rust.rs, fmt, clippy,
cargo test --locked --liband tests/sccache_cargo.rs, which also builds a path dependency outside the checkout with a build script (system and dist were not run), and, before the review changes, by building a workspace with a build-script dependency from two checkouts on Windows: the outputs were identical with the variable and differed without. Independent of #2984; whichever lands second needs a small rebase.Refs #2765