From 90e5346cc0057f792a4233851e6d65f57439eb0b Mon Sep 17 00:00:00 2001 From: onur-ozkan Date: Wed, 8 Nov 2023 23:11:13 +0300 Subject: [PATCH] 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 --- src/bootstrap/src/core/build_steps/clean.rs | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/src/bootstrap/src/core/build_steps/clean.rs b/src/bootstrap/src/core/build_steps/clean.rs index 679770ce0ec78..26ccfe8fe6bf5 100644 --- a/src/bootstrap/src/core/build_steps/clean.rs +++ b/src/bootstrap/src/core/build_steps/clean.rs @@ -139,7 +139,6 @@ fn clean_specific_stage(build: &Build, stage: u32) { fn clean_default(build: &Build) { rm_rf(&build.out.join("tmp")); rm_rf(&build.out.join("dist")); - rm_rf(&build.out.join("bootstrap")); rm_rf(&build.out.join("rustfmt.stamp")); for host in &build.hosts { @@ -169,21 +168,7 @@ fn rm_rf(path: &Path) { } Ok(metadata) => { if metadata.file_type().is_file() || metadata.file_type().is_symlink() { - do_op(path, "remove file", |p| { - fs::remove_file(p).or_else(|e| { - // Work around the fact that we cannot - // delete an executable while it runs on Windows. - #[cfg(windows)] - if e.kind() == std::io::ErrorKind::PermissionDenied - && p.file_name().and_then(std::ffi::OsStr::to_str) - == Some("bootstrap.exe") - { - eprintln!("warning: failed to delete '{}'.", p.display()); - return Ok(()); - } - Err(e) - }) - }); + do_op(path, "remove file", |p| fs::remove_file(p)); return; }