docs(dev): recommend sccache as cargo's wrapper, one compile cache for every checkout and workspace #2575

Merged
HumanBean merged 1 commit from HumanBean/Longshot:build/sccache-dev into main 2026-11-26 02:30:29 +00:00
Owner

Summary

Every new checkout or jj workspace builds all of its crates.io dependencies cold, which takes many minutes and tens of
GB on a PC where several workspaces build at once. docs/dev/setup.md gets a "The compile cache" section recommending
sccache as cargo's wrapper for anyone who builds in more than one tree: installed
once per user (mise use -g aqua:mozilla/[email protected]) and turned on in the shell's profile (RUSTC_WRAPPER=sccache,
a 40 GB cache). It is deliberately not in mise.toml, so CI, the tests that run mise in a copy of the tree, and
checkouts without sccache are unchanged (a first version that made it mise's default failed CI's run_all part 1).

The section also says why two trees must never share one CARGO_TARGET_DIR: cargo names a path crate relative to its
workspace, so one tree's build can pass for another's (an agent's check once passed on code it never read).

Read: docs/dev/setup.md, "The compile cache".

Testing

Tested: Linux, this PC: the recommended settings (sccache 0.19.0, RUSTC_WRAPPER=sccache) have been used for the
#2434 helpers' cargo builds, where crates.io dependencies hit across workspaces and the repository's own crates compile
per workspace. A docs-only change: no game, build or check behaviour changes.

Still to test:

  • None.

Measurements

Nothing to measure: documentation only.

Risks

None for players or CI: a recommendation in the setup guide, nothing in the build.

Checklist

Ready for review

  • One topic, on current main; the title is a Conventional Commit.
  • Tested on my own PC, in the game for a change the game runs, as Testing says.
  • mise run test passes (any failure that also fails on main is named). (CI runs it on this head.)
  • Measured against main, or Measurements says why there is nothing to measure.
  • No game files, build output or hand-edited generated files; third_party/ untouched; nothing GPL-incompatible.

When it applies

  • Docs updated.
  • AI assistance recorded with Assisted-by: / Co-Authored-By: trailers.

Ready to merge

  • Everything in Still to test has run, its results in Tested.
  • Approved in review, every comment answered.
  • CI passes on the head; on current main, measured again or a comment says why the numbers still hold.

🤖 Generated with Claude Code

https://claude.ai/code/session_017vw8dyKi9X9AgqbaPS28uY

## Summary Every new checkout or jj workspace builds all of its crates.io dependencies cold, which takes many minutes and tens of GB on a PC where several workspaces build at once. `docs/dev/setup.md` gets a "The compile cache" section recommending [sccache](https://github.com/mozilla/sccache) as cargo's wrapper for anyone who builds in more than one tree: installed once per user (`mise use -g aqua:mozilla/[email protected]`) and turned on in the shell's profile (`RUSTC_WRAPPER=sccache`, a 40 GB cache). It is deliberately not in `mise.toml`, so CI, the tests that run mise in a copy of the tree, and checkouts without sccache are unchanged (a first version that made it mise's default failed CI's run_all part 1). The section also says why two trees must never share one `CARGO_TARGET_DIR`: cargo names a path crate relative to its workspace, so one tree's build can pass for another's (an agent's check once passed on code it never read). Read: `docs/dev/setup.md`, "The compile cache". ## Testing **Tested:** Linux, this PC: the recommended settings (sccache 0.19.0, `RUSTC_WRAPPER=sccache`) have been used for the #2434 helpers' cargo builds, where crates.io dependencies hit across workspaces and the repository's own crates compile per workspace. A docs-only change: no game, build or check behaviour changes. **Still to test:** - None. ## Measurements Nothing to measure: documentation only. ## Risks None for players or CI: a recommendation in the setup guide, nothing in the build. ## Checklist ### Ready for review - [x] One topic, on current `main`; the title is a Conventional Commit. - [x] Tested on my own PC, in the game for a change the game runs, as Testing says. - [ ] `mise run test` passes (any failure that also fails on `main` is named). *(CI runs it on this head.)* - [x] Measured against `main`, or Measurements says why there is nothing to measure. - [x] No game files, build output or hand-edited generated files; `third_party/` untouched; nothing GPL-incompatible. ### When it applies - [x] Docs updated. - [x] AI assistance recorded with `Assisted-by:` / `Co-Authored-By:` trailers. ### Ready to merge - [ ] Everything in Still to test has run, its results in Tested. - [ ] Approved in review, every comment answered. - [ ] CI passes on the head; on current `main`, measured again or a comment says why the numbers still hold. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_017vw8dyKi9X9AgqbaPS28uY
build(dev): cargo shares one sccache across checkouts and workspaces
Some checks failed
Website / Website on Cloudflare (pull_request_target) Has been skipped
Website / Website preview, built by CI (pull_request_target) Has been skipped
Website / Website preview, upload (pull_request_target) Has been skipped
PR description / Title and description (pull_request_target) Successful in 8s
CI / What the change needs (pull_request) Successful in 11s
CI / Third-party parts and guide screenshots (pull_request) Successful in 18s
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Successful in 1m35s
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Successful in 2m54s
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Successful in 4m24s
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Successful in 4m47s
CI / Website build and checks (pull_request) Successful in 2m17s
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Failing after 20m17s
00a61f476b
mise installs sccache and makes it cargo's RUSTC_WRAPPER (40 GB, both overridable), so a new checkout or jj
workspace takes its crates.io dependencies from the cache instead of a cold build. setup.md explains it, and why two
trees must never share one CARGO_TARGET_DIR (cargo would take one tree's build for another's).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8dyKi9X9AgqbaPS28uY
Member

Possibly related, for context:

  • PR #893 perf(tests): cache the checks' compiles by what they compile — Open PR adds a separate cross-worktree compile cache for game-free checks.
  • PR #2538 ci: faster Forgejo CI: toolchain, apt and crate-cache fallbacks, docs-only skips, cancelled superseded runs — Merged CI work discusses crate caches and explicitly leaves sccache/workspace outputs out.
Possibly related, for context: - PR #893 perf(tests): cache the checks' compiles by what they compile — Open PR adds a separate cross-worktree compile cache for game-free checks. - PR #2538 ci: faster Forgejo CI: toolchain, apt and crate-cache fallbacks, docs-only skips, cancelled superseded runs — Merged CI work discusses crate caches and explicitly leaves sccache/workspace outputs out.
HumanBean force-pushed build/sccache-dev from 00a61f476b
Some checks failed
Website / Website on Cloudflare (pull_request_target) Has been skipped
Website / Website preview, built by CI (pull_request_target) Has been skipped
Website / Website preview, upload (pull_request_target) Has been skipped
PR description / Title and description (pull_request_target) Successful in 8s
CI / What the change needs (pull_request) Successful in 11s
CI / Third-party parts and guide screenshots (pull_request) Successful in 18s
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Successful in 1m35s
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Successful in 2m54s
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Successful in 4m24s
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Successful in 4m47s
CI / Website build and checks (pull_request) Successful in 2m17s
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Failing after 20m17s
to 86e18a9079
Some checks failed
Website / Website on Cloudflare (pull_request_target) Has been skipped
Website / Website preview, built by CI (pull_request_target) Has been skipped
Website / Website preview, upload (pull_request_target) Has been skipped
CI / What the change needs (pull_request) Successful in 8s
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Has been skipped
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Has been skipped
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Failing after 1s
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Failing after 1s
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Failing after 1s
CI / Third-party parts and guide screenshots (pull_request) Successful in 13s
CI / Website build and checks (pull_request) Failing after 1s
PR description / Title and description (pull_request_target) Successful in 8s
2026-11-26 00:06:05 +00:00
Compare
Author
Owner

Reworked after CI's run_all part 1 failed: sccache is now a recommendation in setup.md, not mise's default, so CI and mise-in-a-copy tests are unchanged. Docs only; head 86e18a90.

Reworked after CI's run_all part 1 failed: sccache is now a recommendation in setup.md, not mise's default, so CI and mise-in-a-copy tests are unchanged. Docs only; head 86e18a90.
HumanBean changed title from WIP: build(dev): cargo shares one sccache across checkouts and workspaces to WIP: docs(dev): recommend sccache as cargo's wrapper, one compile cache for every checkout and workspace 2026-11-26 00:07:30 +00:00
Author
Owner

Rebased onto main 8bd104aa (the CI rework, #2568; it touches no file of this PR) to rerun CI: the last run's 4 failures each stopped after 1 s, before any step ran.

Rebased onto main 8bd104aa (the CI rework, #2568; it touches no file of this PR) to rerun CI: the last run's 4 failures each stopped after 1 s, before any step ran.
HumanBean force-pushed build/sccache-dev from 86e18a9079
Some checks failed
Website / Website on Cloudflare (pull_request_target) Has been skipped
Website / Website preview, built by CI (pull_request_target) Has been skipped
Website / Website preview, upload (pull_request_target) Has been skipped
CI / What the change needs (pull_request) Successful in 8s
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Has been skipped
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Has been skipped
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Failing after 1s
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Failing after 1s
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Failing after 1s
CI / Third-party parts and guide screenshots (pull_request) Successful in 13s
CI / Website build and checks (pull_request) Failing after 1s
PR description / Title and description (pull_request_target) Successful in 8s
to 3101ef5938
Some checks failed
Website / Website on Cloudflare (pull_request_target) Has been skipped
Website / Website preview, built by CI (pull_request_target) Has been skipped
Website / Website preview, upload (pull_request_target) Has been skipped
CI / What the change needs (pull_request) Successful in 11s
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Has been skipped
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Has been skipped
CI / Third-party parts and guide screenshots (pull_request) Successful in 11s
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Successful in 1m32s
PR description / Title and description (pull_request_target) Failing after 13s
CI / Website build and checks (pull_request) Failing after 2m51s
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Successful in 8m25s
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Failing after 16m45s
2026-11-26 02:23:49 +00:00
Compare
HumanBean changed title from WIP: docs(dev): recommend sccache as cargo's wrapper, one compile cache for every checkout and workspace to docs(dev): recommend sccache as cargo's wrapper, one compile cache for every checkout and workspace 2026-11-26 02:30:11 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
MagicBeanDev/Longshot!2575
No description provided.