Skip to content

Commit 27f776f

Browse files
committed
Auto merge of #136942 - Kobzol:stage0-sccache, r=<try>
Use ccache for stage0 tool builds r? `@ghost`
2 parents cfe9ffc + 52d0743 commit 27f776f

File tree

1 file changed

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

1 file changed

+14
-0
lines changed

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

+14
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,20 @@ 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+
eprintln!(
173+
"TOOL SCCACHE CONFIGURED at {}, mode: {:?}, incremental: {}",
174+
ccache, mode, builder.config.incremental
175+
);
176+
if matches!(mode, Mode::ToolBootstrap) && !builder.config.incremental {
177+
cargo.env("RUSTC_WRAPPER", ccache);
178+
}
179+
}
180+
167181
// clippy tests need to know about the stage sysroot. Set them consistently while building to
168182
// avoid rebuilding when running tests.
169183
cargo.env("SYSROOT", builder.sysroot(compiler));

0 commit comments

Comments
 (0)