Skip to content

Commit 344800b

Browse files
committed
Use ccache for stage0 tool builds
1 parent ced8e65 commit 344800b

File tree

1 file changed

+10
-0
lines changed
  • src/bootstrap/src/core/build_steps

1 file changed

+10
-0
lines changed

src/bootstrap/src/core/build_steps/tool.rs

+10
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,16 @@ pub fn prepare_tool_cargo(
164164
}
165165
}
166166

167+
// The stage0 compiler changes infrequently and does not directly depend on code
168+
// in the current working directory. Therefore, caching it with sccache should be
169+
// useful.
170+
// This is only performed for non-incremental builds, as ccache cannot deal with these.
171+
if let Some(ref ccache) = builder.config.ccache {
172+
if matches!(mode, Mode::ToolBootstrap) && !builder.config.incremental {
173+
cargo.env("RUSTC_WRAPPER", ccache);
174+
}
175+
}
176+
167177
// clippy tests need to know about the stage sysroot. Set them consistently while building to
168178
// avoid rebuilding when running tests.
169179
cargo.env("SYSROOT", builder.sysroot(compiler));

0 commit comments

Comments
 (0)