fix x clean for cross-compiled artifacts

Signed-off-by: onur-ozkan <work@onurozkan.dev>
This commit is contained in:
onur-ozkan 2023-12-14 20:25:09 +03:00
parent 9d49eb76c4
commit bf0de6c679

View File

@ -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,
};