Install sccache from prebuilt binary instead of compiling from source

Downloading the release tarball is significantly faster than
cargo install, which must compile sccache and all its dependencies.
This commit is contained in:
Chris Wanstrath 2026-03-30 18:42:51 -07:00
parent 0ff6fd5bf1
commit bbf12b8c56

View File

@ -183,8 +183,11 @@ async function installPersistentTooling(log?: (msg: string) => void): Promise<vo
const hasSccache = await $`container exec --user ${USER} ${CONTAINER_NAME} test -x /sandlot/.cargo/bin/sccache`.nothrow().quiet()
if (hasSccache.exitCode !== 0) {
log?.("Installing sccache")
const sccacheVersion = "v0.14.0"
const sccacheArchive = `sccache-${sccacheVersion}-aarch64-unknown-linux-musl.tar.gz`
const sccacheUrl = `https://github.com/mozilla/sccache/releases/download/${sccacheVersion}/${sccacheArchive}`
await run(
$`container exec --user ${USER} ${CONTAINER_NAME} env ${`RUSTUP_HOME=${CONTAINER_ENV.RUSTUP_HOME}`} ${`CARGO_HOME=${CONTAINER_ENV.CARGO_HOME}`} ${`PATH=${CONTAINER_ENV.CARGO_HOME}/bin:$PATH`} cargo install sccache --locked`,
$`container exec --user ${USER} ${CONTAINER_NAME} bash -c ${`curl -fsSL ${sccacheUrl} | tar xz -C /tmp && cp /tmp/sccache-${sccacheVersion}-aarch64-unknown-linux-musl/sccache /sandlot/.cargo/bin/sccache && chmod +x /sandlot/.cargo/bin/sccache && rm -rf /tmp/sccache-${sccacheVersion}-aarch64-unknown-linux-musl`}`,
"sccache installation")
await $`container exec --user ${USER} ${CONTAINER_NAME} bash -c ${"mkdir -p /sandlot/.sccache"}`.nothrow().quiet()
}