Files
reims-vgpu/scripts/dev-env.sh
T
Anees Iqbal 6e20652eea 🐎 Build lean, and share builds between worktrees through kache
Each worktree's check compiled everything again with full debuginfo and
incremental caches no rebuild used. The dev profile keeps line tables for
the workspace and none for its dependencies, the check builds without
incremental caches, and builds go through kache where it is installed, so
a worktree's first build reuses what another tree built, build scripts
included. Tests read the tree's paths at run time, so a build is the same
in every tree.

scripts/new-worktree.sh makes a worktree from clones of the main checkout's
suite files, and AGENTS.md says a profiling run removes its traces.

Source: 53a4a8edd b568f382e 0c7a0eabc 72c24f74b 10051ba78 8f415697a 73d557f71
        bde4220b6 46c7c6b23
2026-10-26 12:24:31 +02:00

22 lines
1.4 KiB
Bash

# The environment a developer's builds run in. Source it from the worktree's root, with the
# worktree's own CARGO_TARGET_DIR, before each cargo command:
#
# . scripts/dev-env.sh && cargo nextest run -p reims-vgpu-core
#
# It sets CARGO_INCREMENTAL=0, as `cargo xtask check` builds. 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. kache stays local, whatever its configuration
# says (KACHE_LOCAL_ONLY=1), and keeps no incremental state in the target directory
# (KACHE_ADAPTIVE_INCREMENTAL=0). 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").
export CARGO_INCREMENTAL=0
if command -v kache > /dev/null 2>&1; then
export RUSTC_WRAPPER=kache KACHE_LOCAL_ONLY=1 KACHE_ADAPTIVE_INCREMENTAL=0 \
KACHE_BUILD_SCRIPT_HERMETIC=1
fi