Skip to content

Commit 90e5346

Browse files
committed
speed up x clean
Since `x clean` runs with bootstrap, we can speed up this process by avoiding the cleaning of bootstrap artifacts, as they are not necessarily needed to be cleaned. Signed-off-by: onur-ozkan <work@onurozkan.dev>
1 parent 750c2ec commit 90e5346

File tree

1 file changed

+1
-16
lines changed
  • src/bootstrap/src/core/build_steps

1 file changed

+1
-16
lines changed

src/bootstrap/src/core/build_steps/clean.rs

+1-16
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,6 @@ fn clean_specific_stage(build: &Build, stage: u32) {
139139
fn clean_default(build: &Build) {
140140
rm_rf(&build.out.join("tmp"));
141141
rm_rf(&build.out.join("dist"));
142-
rm_rf(&build.out.join("bootstrap"));
143142
rm_rf(&build.out.join("rustfmt.stamp"));
144143

145144
for host in &build.hosts {
@@ -169,21 +168,7 @@ fn rm_rf(path: &Path) {
169168
}
170169
Ok(metadata) => {
171170
if metadata.file_type().is_file() || metadata.file_type().is_symlink() {
172-
do_op(path, "remove file", |p| {
173-
fs::remove_file(p).or_else(|e| {
174-
// Work around the fact that we cannot
175-
// delete an executable while it runs on Windows.
176-
#[cfg(windows)]
177-
if e.kind() == std::io::ErrorKind::PermissionDenied
178-
&& p.file_name().and_then(std::ffi::OsStr::to_str)
179-
== Some("bootstrap.exe")
180-
{
181-
eprintln!("warning: failed to delete '{}'.", p.display());
182-
return Ok(());
183-
}
184-
Err(e)
185-
})
186-
});
171+
do_op(path, "remove file", |p| fs::remove_file(p));
187172
return;
188173
}
189174

0 commit comments

Comments
 (0)