Skip to content

Commit

Permalink
Auto merge of rust-lang#136942 - Kobzol:stage0-sccache, r=<try>
Browse files Browse the repository at this point in the history
Use ccache for stage0 tool builds

r? `@ghost`
  • Loading branch information
bors committed Feb 12, 2025
2 parents ced8e65 + 344800b commit f0a58be
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/bootstrap/src/core/build_steps/tool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,16 @@ pub fn prepare_tool_cargo(
}
}

// The stage0 compiler changes infrequently and does not directly depend on code
// in the current working directory. Therefore, caching it with sccache should be
// useful.
// This is only performed for non-incremental builds, as ccache cannot deal with these.
if let Some(ref ccache) = builder.config.ccache {
if matches!(mode, Mode::ToolBootstrap) && !builder.config.incremental {
cargo.env("RUSTC_WRAPPER", ccache);
}
}

// clippy tests need to know about the stage sysroot. Set them consistently while building to
// avoid rebuilding when running tests.
cargo.env("SYSROOT", builder.sysroot(compiler));
Expand Down

0 comments on commit f0a58be

Please sign in to comment.