diff options
| author | bors <bors@rust-lang.org> | 2023-12-18 22:42:16 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2023-12-18 22:42:16 +0000 |
| commit | e719b6fc40c358529c85c2c4d1b30dd9f05a6c8c (patch) | |
| tree | f0c16c2abfbeb8e225566650f09ef645a907e994 | |
| parent | 3f28fe133475ec5faf3413b556bf3cfb0d51336c (diff) | |
| parent | bf0de6c6791cf9cb1ddedaabf140566cc2216f50 (diff) | |
| download | rust-e719b6fc40c358529c85c2c4d1b30dd9f05a6c8c.tar.gz rust-e719b6fc40c358529c85c2c4d1b30dd9f05a6c8c.zip | |
Auto merge of #118946 - onur-ozkan:fix-clean, r=clubby789
fix `x clean` for cross-compiled artifacts ```toml build = "x86_64-unknown-linux-gnu" host = ["arm-unknown-linux-gnueabihf"] target = ["arm-unknown-linux-gnueabihf"] ``` On `x86_64-unknown-linux-gnu`, after cross-compiling with the sample configuration above, artifacts under `build/x86_64-unknown-linux-gnu` never gets cleaned with `x clean`. This PR fixes that.
| -rw-r--r-- | src/bootstrap/src/core/build_steps/clean.rs | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/bootstrap/src/core/build_steps/clean.rs b/src/bootstrap/src/core/build_steps/clean.rs index 6372db96afb..4b993945f19 100644 --- a/src/bootstrap/src/core/build_steps/clean.rs +++ b/src/bootstrap/src/core/build_steps/clean.rs @@ -149,8 +149,14 @@ fn clean_default(build: &Build) { rm_rf(&build.out.join("bootstrap-shims-dump")); rm_rf(&build.out.join("rustfmt.stamp")); - for host in &build.hosts { - let entries = match build.out.join(host.triple).read_dir() { + let mut hosts: Vec<_> = build.hosts.iter().map(|t| build.out.join(t.triple)).collect(); + // After cross-compilation, artifacts of the host architecture (which may differ from build.host) + // might not get removed. + // Adding its path (linked one for easier accessibility) will solve this problem. + hosts.push(build.out.join("host")); + + for host in hosts { + let entries = match host.read_dir() { Ok(iter) => iter, Err(_) => continue, }; |
