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

Cargo clean: Provide an option to only clean debug artifacts #7021

Closed
heidezomp opened this issue Jun 7, 2019 · 3 comments
Closed

Cargo clean: Provide an option to only clean debug artifacts #7021

heidezomp opened this issue Jun 7, 2019 · 3 comments
Labels
C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`

Comments

@heidezomp
Copy link

Describe the problem you are trying to solve

Using cargo clean it is currently impossible to only clean the debug artifacts, while keeping the release and documentation artifacts intact. A use case for this is the cargo subcommand cargo-bloat's use of cargo clean for removing artifacts before timing a build, as described in RazrFalcon/cargo-bloat#33.

Describe the solution you'd like

I propose a flag cargo clean --debug to only clean debug artifacts, similar to how cargo clean --release only cleans release artifacts. This doesn't seem too hard to implement for me, so if this is accepted, I'd like to try and implement this myself if that is okay 😄

Notes

The phrasing for the --release flag in the help output is confusing to me. It says "Whether or not to clean release artifacts". To me this suggests that if you don't supply the --release flag, the release artifacts are not cleaned, which is not the case. I had to test out the behavior to see that not providing --release in fact removes the entire target directory. To me the phrasing "Clean only release artifacts" would be much clearer. The same goes for the --doc help output.

@heidezomp heidezomp added the C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` label Jun 7, 2019
@ehuss
Copy link
Contributor

ehuss commented Jun 8, 2019

As part of named profiles (#6989), cargo clean will gain a --profile flag to clean just a specific profile. --release will be an alias for --profile=release, and you can specify any profile.

The documentation for the clean command could definitely use some improvement. It's a little tricky since there are a number of problems with how clean works.

@heidezomp
Copy link
Author

Oh, that looks super useful! 😄

Should I close this report in favor of #6988 then, or wait until it has been merged or stabilized?

@ehuss
Copy link
Contributor

ehuss commented Jun 14, 2019

I'll close this now. You can subscribe to #6988 to get notified of any changes, or when it gets stabilized.

@ehuss ehuss closed this as completed Jun 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`
Projects
None yet
Development

No branches or pull requests

2 participants