-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Clean artifacts with new layout #16330
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
Conversation
|
r? @weihanglo rustbot has assigned @weihanglo. Use |
tests/testsuite/clean_new_layout.rs
Outdated
| // Ensures that all files for the package have been deleted. | ||
| #[track_caller] | ||
| fn assert_all_clean(build_dir: &Path) { |
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.
Please put this where it matches with clean.rs
src/cargo/ops/cargo_clean.rs
Outdated
| // Clean incremental compilation files. | ||
| for target in pkg.targets() { | ||
| if target.is_custom_build() { | ||
| continue; | ||
| } | ||
| let crate_name = target.crate_name(); | ||
| for (_, layout) in &layouts { | ||
| let incremental_dir = escape_glob_path(layout.build_dir().incremental())?; | ||
| let pattern = Path::new(&incremental_dir).join(format!("{crate_name}-*")); | ||
| clean_ctx.rm_rf_glob(&pattern)?; | ||
| } |
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.
Why is this in a new loop body rather than the existing one like for the old layout?
src/cargo/ops/cargo_clean.rs
Outdated
| // Clean hashed example files and depinfo/debug files from examples directory. | ||
| // These files have hashes in their names (e.g., foo-abc123, foo-abc123.d) and | ||
| // are not covered by the uplifted file cleanup above. |
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.
What I'm looking for is an answer to #16302 (comment) before moving forward. Something is missing to this puzzle
This test demonstrates that `cargo clean -p` with the new build layout (`-Zbuild-dir-new-layout`) does not clean all example artifacts, specifically hashed depinfo files and incremental compilation outputs. The test is marked `#[should_panic]` as it currently fails without the corresponding fix. Signed-off-by: Charalampos Mitrodimas <[email protected]>
Add cleanup for hashed example files, depinfo, debug files, and incremental compilation outputs when using `cargo clean -p` with `-Zbuild-dir-new-layout`. The new layout was missing glob-based cleanup for: - Hashed example artifacts in build_dir().examples() - Rustc-generated depinfo (.d) and debug files (.o, .dwo, .dwp) - Incremental compilation files in build_dir().incremental() Signed-off-by: Charalampos Mitrodimas <[email protected]>
cc928fc to
7293210
Compare
|
Closing in favor of #16302 |
Add cleanup for hashed example files, depinfo, debug files, and
incremental compilation outputs when using
cargo clean -pwith-Zbuild-dir-new-layout.The new layout was missing glob-based cleanup for:
Closes #16302
@epage had this in my stash, so let me know if I'm doing something you're already in progress of doing.