-
Notifications
You must be signed in to change notification settings - Fork 2.7k
fix(clean): Clean hosts builds with new layout #16300
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
277ac50
65d2b38
bc58393
ed47fd2
aa04395
0c3ed63
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -200,6 +200,54 @@ fn clean_specs( | |
| let pkg_dir = format!("{}-*", pkg.name()); | ||
| clean_ctx.progress.on_cleaning_package(&pkg.name())?; | ||
|
|
||
| if clean_ctx.gctx.cli_unstable().build_dir_new_layout { | ||
| for (_compile_kind, layout) in &layouts_with_host { | ||
| let dir = layout.build_dir().build_unit(&pkg.name()); | ||
| clean_ctx.rm_rf(&dir)?; | ||
| } | ||
|
|
||
| for target in pkg.targets() { | ||
| if target.is_custom_build() { | ||
| continue; | ||
| } | ||
| for &mode in &[ | ||
| CompileMode::Build, | ||
| CompileMode::Test, | ||
| CompileMode::Check { test: false }, | ||
| ] { | ||
| for (compile_kind, layout) in &layouts { | ||
| let triple = target_data.short_name(compile_kind); | ||
| let (file_types, _unsupported) = target_data | ||
| .info(*compile_kind) | ||
| .rustc_outputs(mode, target.kind(), triple, clean_ctx.gctx)?; | ||
| let artifact_dir = layout | ||
| .artifact_dir() | ||
| .expect("artifact-dir was not locked during clean"); | ||
|
Comment on lines
+223
to
+225
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we can't merge this until we un-revert #16299
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How come? Without that,
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Err nvm, I forgot we split that into 2 PRs |
||
| let uplift_dir = match target.kind() { | ||
| TargetKind::ExampleBin | TargetKind::ExampleLib(..) => { | ||
| Some(artifact_dir.examples()) | ||
| } | ||
| // Tests/benchmarks are never uplifted. | ||
| TargetKind::Test | TargetKind::Bench => None, | ||
| _ => Some(artifact_dir.dest()), | ||
| }; | ||
| // Remove the uplifted copy. | ||
| if let Some(uplift_dir) = uplift_dir { | ||
| for file_type in file_types { | ||
| let uplifted_path = | ||
| uplift_dir.join(file_type.uplift_filename(target)); | ||
| clean_ctx.rm_rf(&uplifted_path)?; | ||
| // Dep-info generated by Cargo itself. | ||
| let dep_info = uplifted_path.with_extension("d"); | ||
| clean_ctx.rm_rf(&dep_info)?; | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
| continue; | ||
| } | ||
|
|
||
| // Clean fingerprints. | ||
| for (_, layout) in &layouts_with_host { | ||
| let dir = escape_glob_path(layout.build_dir().legacy_fingerprint())?; | ||
|
|
@@ -228,12 +276,6 @@ fn clean_specs( | |
| CompileMode::Check { test: false }, | ||
| ] { | ||
| for (compile_kind, layout) in &layouts { | ||
| if clean_ctx.gctx.cli_unstable().build_dir_new_layout { | ||
| let dir = layout.build_dir().build_unit(&pkg.name()); | ||
| clean_ctx.rm_rf_glob(&dir)?; | ||
| continue; | ||
| } | ||
|
|
||
| let triple = target_data.short_name(compile_kind); | ||
| let (file_types, _unsupported) = target_data | ||
| .info(*compile_kind) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we have tests for it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I duplicated
clean.rstests to verify-Zbuild-dir-new-layout. This uncovered several issues. I fixed most. There remains one which has test overlap with this so no test results changed. I decided to go ahead and get this update up rather than wait on all of them since this last one may be a bit nasty.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Opened #16302 for this