Skip to content
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

Error out if cargo clean --doc is mixed with -p. #12637

Merged
merged 1 commit into from
Sep 7, 2023

Conversation

ehuss
Copy link
Contributor

@ehuss ehuss commented Sep 7, 2023

This changes cargo clean --doc -p foo to generate an error instead of ignoring the -p flag. There is still an outstanding issue #8790 tracking this. It should support -p, but until it is supported, I think cargo should tell you that the flag is ignored. This is also in preparation for some code changes in #12634 which needs to handle any combination of various different clean flags.

Currently the `-p` is ignored. This should help with any confusion
about the interaction of different flags.
rust-lang#8790 is tracking to fix this.
@rustbot
Copy link
Collaborator

rustbot commented Sep 7, 2023

r? @epage

(rustbot has picked a reviewer for you, use r? to override)

@rustbot rustbot added Command-clean S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Sep 7, 2023
Copy link
Member

@weihanglo weihanglo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This may break somebody's script, but I believe that's rare and easy to fix.

@weihanglo
Copy link
Member

@bors r+

@bors
Copy link
Collaborator

bors commented Sep 7, 2023

📌 Commit f49b038 has been approved by weihanglo

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Sep 7, 2023
@bors
Copy link
Collaborator

bors commented Sep 7, 2023

⌛ Testing commit f49b038 with merge 8230b46...

@bors
Copy link
Collaborator

bors commented Sep 7, 2023

☀️ Test successful - checks-actions
Approved by: weihanglo
Pushing 8230b46 to master...

@bors bors merged commit 8230b46 into rust-lang:master Sep 7, 2023
20 checks passed
Comment on lines +36 to +37
if !opts.spec.is_empty() {
// FIXME: https://github.com/rust-lang/cargo/issues/8790
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This culd be done with clap but sicne this is just a fixme, it likely doesn't matter

bors added a commit to rust-lang-ci/rust that referenced this pull request Sep 9, 2023
Update cargo

14 commits in d14c85f4e6e7671673b1a1bc87231ff7164761e1..2fc85d15a542bfb610aff7682073412cf635352f
2023-09-05 22:28:10 +0000 to 2023-09-09 01:49:46 +0000
- feat: Stabilize lints (rust-lang/cargo#12648)
- Ues strip_prefix for cleaner code (rust-lang/cargo#12631)
- fix: don't print _TOKEN suggestion when not applicable (rust-lang/cargo#12644)
- Bump cargo-credential-1password to v0.4.0 (rust-lang/cargo#12641)
- refactor: put `Source` trait under `cargo::sources` (rust-lang/cargo#12527)
- Error out if `cargo clean --doc` is mixed with `-p`. (rust-lang/cargo#12637)
- Add wrappers around std::fs::metadata (rust-lang/cargo#12636)
- Add with_stdout_unordered. (rust-lang/cargo#12635)
- Fix example for creating a git project test. (rust-lang/cargo#12632)
- Read/write the encoded `cargo update --precise` in the same place (rust-lang/cargo#12629)
- docs(guide): Apply feedback on CI (rust-lang/cargo#12630)
- fix: improve warning for both token & credential-provider (rust-lang/cargo#12626)
- Skip clean up `profile.release.package."*"` (rust-lang/cargo#12624)
- Add MSRV validation GitHub Action for cargo-credential (rust-lang/cargo#12623)
bors added a commit that referenced this pull request Sep 20, 2023
Add some enhancements to `cargo clean`

### What does this PR try to resolve?

This adds some enhancements to `cargo clean` that fell out as a result of some refactorings in #12634 for supporting an interface for cleaning from other places in cargo, and these were relatively easy to add and assist with testing in #12634.

The changes are:
- Introduce some refactoring to offer a cleaning interface that can be used elsewhere in cargo.
- Adds a `--dry-run` CLI option which will print what `cargo clean` will delete without deleting it. **NOTE** This PR makes the flag insta-stable. I don't figure there is too much that can be learned about it keeping it unstable, though we could change that. #12634 has this flag gated with `-Zgc`.
- Adds a summary line at the end of the `cargo clean` operation that indicates how much was deleted.

### How should we test and review this PR?

Note that this PR also includes the changes from #12635 and #12637. Those commits can be dropped if those PRs are merged.

For the most part, this involves wrapping the cleaning operations in a `CleanContext` which provides an interface for performing cleaning operations. The dry run is just a flag that is checked at the deletion points. The summary data is also collected at those same points.
@ehuss ehuss added this to the 1.74.0 milestone Sep 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Command-clean S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants