diff --git a/bin/hermit.hcl b/bin/hermit.hcl index b429ec961..adce94e61 100644 --- a/bin/hermit.hcl +++ b/bin/hermit.hcl @@ -1 +1,6 @@ manage-git = true + +env = { + "CARGO_HOME": "${HOME}/.cache/berd/cargo-home", + "PATH": "${HOME}/.cache/berd/cargo-home/bin:${PATH}", +} diff --git a/scripts/release/tests/release-scripts.test.mjs b/scripts/release/tests/release-scripts.test.mjs index d50a300fa..1dbbddba8 100644 --- a/scripts/release/tests/release-scripts.test.mjs +++ b/scripts/release/tests/release-scripts.test.mjs @@ -60,6 +60,19 @@ describe("Tauri Cargo target isolation", () => { }); }); +describe("shared Cargo package cache", () => { + it("keeps Cargo dependency and binary paths stable across worktrees", async () => { + const hermitConfig = await readFile(join(repo, "bin/hermit.hcl"), "utf8"); + + expect(hermitConfig).toMatch( + /"CARGO_HOME": "\$\{HOME\}\/\.cache\/berd\/cargo-home"/, + ); + expect(hermitConfig).toMatch( + /"PATH": "\$\{HOME\}\/\.cache\/berd\/cargo-home\/bin:\$\{PATH\}"/, + ); + }); +}); + describe("managed Goose build profile", () => { it("defaults development to debug and makes release selection profile-aware", async () => { const script = await readFile(