perf(dev): share Cargo package cache across worktrees - #199
Draft
johnmatthewtennant wants to merge 2 commits into
Draft
perf(dev): share Cargo package cache across worktrees#199johnmatthewtennant wants to merge 2 commits into
johnmatthewtennant wants to merge 2 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Category: infrastructure
User Impact: Rust dependency builds can now be reused across Berd worktrees instead of being invalidated by checkout-specific package paths.
Problem: Hermit gives each Berd worktree its own
CARGO_HOME. That changes the absolute paths of downloaded Rust dependency sources, so Cargo invalidates otherwise reusable compiler artifacts copied or cached from another worktree.Solution: Berd now uses a stable user-level Cargo home for registry, Git, and package caches while keeping each worktree’s Cargo target directory isolated. Cargo’s package-cache locking supports concurrent access, so dependency downloads are shared without reintroducing build-directory lock contention. The shared Cargo home’s
bindirectory remains first onPATH, preservingcargo installbehavior.File changes
bin/hermit.hcl
Overrides the Hermit rustup package’s checkout-local Cargo home with
${HOME}/.cache/berd/cargo-homeand prepends that Cargo home’sbindirectory toPATH.scripts/release/tests/release-scripts.test.mjs
Pins the shared Cargo-home and binary-path contracts so future Hermit package changes cannot silently restore worktree-specific dependency paths.
Related issue
None found.
Testing
cargo test -p berdctl --no-runconsumer reported 59 Fresh crates, 0 Dirty, 0 Compiling, and 0 downloads, finishing in 0.15 seconds.cargo checkreported 59 Fresh crates and finished in 0.15 seconds. Clippy reused all 58 dependencies and rechecked only the path-sensitive workspace crate.just checkalso passed on Linux Blox.