Repository navigation
Conversation
4c17d63 to
1c0c868
Compare
1c0c868 to
5c4eba7
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3051 +/- ##
==========================================
+ Coverage 72.74% 72.78% +0.03%
==========================================
Files 77 77
Lines 44680 44732 +52
==========================================
+ Hits 32504 32556 +52
Misses 12176 12176 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
6b6ba89 to
02dfeb6
Compare
02dfeb6 to
5ac8047
Compare
This comment was marked as outdated.
This comment was marked as outdated.
5ac8047 to
aa881ed
Compare
A build script's OUT_DIR points into Cargo's build dir. With a shared build-dir outside the checkout, its path differs per workspace and no basedir covers it.
Without env-deps there is nothing to strip, so the parents of --out-dir need no stat calls. Keys are unchanged.
A crate served from another workspace's entry keeps that workspace's OUT_DIR, so a file it opens there at run time may be gone (a cleaned shared build dir, another machine). Compile-time include! reads are unaffected.
aa881ed to
de6a763
Compare
|
Rebased onto main to fix the conflict with #3065, with two commits on top: efc6932 for the review point, and de6a763, which adds a README note. A crate that reads a file from its My earlier comment said the fixes were in a separate commit. They aren't any more: they're squashed into the first commit. |
|
The unix CI failures aren't from this PR: #3071 strips the same env-dep values. I tested both with a crate that |
Problem: with basedirs set and a shared
build.build-dirsuch as~/.cache/cargo-build/{workspace-path-hash}, two checkouts of a project still miss on crates that use build-script output, e.g.serde. Their dep-info listsOUT_DIR, and sccache hashes its value, a path inside the build dir. That dir is outside the checkouts, so basedirs don't strip it, and the workspace hash in its path makes it different per checkout, so it can't be added as a basedir either.Change: with basedirs set, also strip the Cargo build dir from env-dep values. Below it, paths are the same in every workspace.
The build dir is the nearest parent of
--out-dirthat has.rustc_info.jsonorCACHEDIR.TAG; Cargo writes these at the top of a build dir. Either can be missing (CACHEDIR.TAGif the dir existed before Cargo ran,.rustc_info.jsonwithCARGO_CACHE_RUSTC_INFO=0), so both are checked. The markers are used instead of a fixed path shape because the layout below the build dir differs between Cargo versions. If neither is found, nothing changes.Without basedirs, keys stay the same and nothing is read from disk. Vars in
SCCACHE_BASEDIRS_VERBATIM_ENV_DEPSstay verbatim. With basedirs and at least one env-dep, the search costs up to twostatcalls per parent of--out-dir, up to the build dir. A crate that reads a file from itsOUT_DIRat run time can now get another checkout'sOUT_DIRfrom the cache, and that file may be gone.SCCACHE_BASEDIRS_VERBATIM_ENV_DEPS=OUT_DIRavoids this.New test
test_equal_hashes_out_dir_in_cargo_build_rootfails without this change.Tests:
cargo nextest run --locked --lib --bins --tests.tests/sccache_args.rsdoes not compile onmain(#3077 dropped the imports for#[serial]andSCCACHE_BIN), so it was not run.