Files
reims-vgpu/scripts/internal/dev-env.sh
T
Anees Iqbal ed685ef8fb 📝 Build each worktree in its own target/, for kache's seeds [ci skip]
kache 2 seeds a worktree's incremental state from another worktree's only
when both targets sit inside their worktrees: it maps the compiler's working
directory to one path, and a target elsewhere puts a path of its own in the
compiler's arguments. Measured on the M3 Max: with targets inside the
worktrees, a second worktree's first edit of core compiled in 4.3 s from the
first's state, against 7.0 s with no donor; with each target in its own
directory under ~/.cache, the seed identities differed and it took 5.7 s.
So a worktree, which lives under ~/.cache, now builds in its own target/
with no CARGO_TARGET_DIR. Also rewraps a line of the previous commit.
2026-11-03 23:47:28 -08:00

23 lines
1.6 KiB
Bash

# The environment a developer's builds run in. Source it from the worktree's root, which builds in
# its own target/ (no CARGO_TARGET_DIR), before each cargo command:
#
# . scripts/internal/dev-env.sh && cargo nextest run -p reims-vgpu-core
#
# Builds are incremental, as cargo's dev and test profiles are. Where kache is on the PATH, rustc
# runs through it (RUSTC_WRAPPER=kache): a compiler cache that stores each unit's outputs on this
# machine, keyed by the unit's inputs, and restores them as clones of the stored files, so a
# worktree builds only the units no tree on the machine built before. A unit being edited compiles
# incrementally instead, with kache's private incremental state, which a new worktree seeds from a
# compatible one's (the host's configuration turns both on: docs/development.md). kache stays local,
# whatever its configuration says (KACHE_LOCAL_ONLY=1). It runs each build script with its OUT_DIR
# in a directory of its store named by the script's inputs, which the target directory's OUT_DIR
# links to (KACHE_BUILD_SCRIPT_HERMETIC=1), so a script's run is shared between worktrees even where
# what it writes names its OUT_DIR, as SDL3's library does. Without kache the build is cargo's own:
# nothing in the repository needs kache, and it is never Cargo's configured wrapper
# (docs/development.md, "Building through kache").
# A shell that sourced an earlier version keeps no incremental switch of its own.
unset CARGO_INCREMENTAL KACHE_ADAPTIVE_INCREMENTAL
if command -v kache > /dev/null 2>&1; then
export RUSTC_WRAPPER=kache KACHE_LOCAL_ONLY=1 KACHE_BUILD_SCRIPT_HERMETIC=1
fi