diff --git a/bin/.sccache@0.17.pkg b/bin/.sccache@0.17.pkg new file mode 120000 index 000000000..383f4511d --- /dev/null +++ b/bin/.sccache@0.17.pkg @@ -0,0 +1 @@ +hermit \ No newline at end of file diff --git a/bin/hermit.hcl b/bin/hermit.hcl index b429ec961..0a9484ef0 100644 --- a/bin/hermit.hcl +++ b/bin/hermit.hcl @@ -1 +1,5 @@ manage-git = true + +env = { + "RUSTC_WRAPPER": "sccache", +} diff --git a/bin/sccache b/bin/sccache new file mode 120000 index 000000000..3b82392a7 --- /dev/null +++ b/bin/sccache @@ -0,0 +1 @@ +.sccache@0.17.pkg \ No newline at end of file diff --git a/scripts/release/tests/release-scripts.test.mjs b/scripts/release/tests/release-scripts.test.mjs index d50a300fa..9b4de8d4e 100644 --- a/scripts/release/tests/release-scripts.test.mjs +++ b/scripts/release/tests/release-scripts.test.mjs @@ -5,6 +5,7 @@ import { mkdir, chmod, readFile, + readlink, rm, writeFile, } from "node:fs/promises"; @@ -60,6 +61,20 @@ describe("Tauri Cargo target isolation", () => { }); }); +describe("shared Rust compiler cache", () => { + it("provides sccache through Hermit and configures Cargo to use it", async () => { + const [hermitConfig, packageLink, executableLink] = await Promise.all([ + readFile(join(repo, "bin/hermit.hcl"), "utf8"), + readlink(join(repo, "bin/.sccache@0.17.pkg")), + readlink(join(repo, "bin/sccache")), + ]); + + expect(hermitConfig).toContain('"RUSTC_WRAPPER": "sccache"'); + expect(packageLink).toBe("hermit"); + expect(executableLink).toBe(".sccache@0.17.pkg"); + }); +}); + describe("managed Goose build profile", () => { it("defaults development to debug and makes release selection profile-aware", async () => { const script = await readFile(