Skip to content

Commit

Permalink
speed up x clean
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
onur-ozkan committed Nov 8, 2023
1 parent 750c2ec commit 90e5346
Showing 1 changed file with 1 addition and 16 deletions.
17 changes: 1 addition & 16 deletions src/bootstrap/src/core/build_steps/clean.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit 90e5346

Please sign in to comment.