-
Notifications
You must be signed in to change notification settings - Fork 31
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
Suggestion: Add a flag to clean all currently unused build artifacts #2
Comments
Unfortunately that requires either
In either case, it means that a full build is necessary. This could be avoided by instead using Cargo's build plan output, which includes all compiler invocations and doesn't require actually building the crate. Unfortunately that Cargo feature is still unstable.
|
I think the best approach is the one suggested in #5 instead, i.e do two separate steps in which one outputs a timestamp file before the build step, and then passing that timestamp as cleaning parameter after building. |
Yeah, but that'd still be a somewhat imprecise solution relying on atime. Really, the simplest way to implement this reliably would probably be using the build plan (however, there might be some difficulty if you want to eg. run |
Yes, that is true. I am not familiar with the build-plan so I am not sure if it may fail due to nightly compiler not being compatible with some dependency and if its output is different from the stable. Furthermore this would require having the nightly compiler installed which may or may not be a problem. |
Hmm, AFAIK enabling features can only add dependencies to the graph, so specifying
Another issue that might be harder to solve is the use of The build plan being unstable is the biggest problem here. While it's possible to just invoke |
Ah ok. As long as build-plan is only useable for unstable I will be very unlikely to implement it as the primary/only solution although I agree it is probably the most reliable. As for now I think I will move on with the suggestion in #5 |
Some features are mutually exclusive though. For example some crates let you choose the type of hashmap used. |
If we make assumptions on the We could also accept The issue is if no
I hope we'll at least keep this around, tracking to the build plan becoming stable? |
That's true, but AFAIK this is not done on a Cargo.toml level but rather by intentionally failing the build of your lib.rs, so as far as Cargo is concerned this is fine. |
Yes, I will keep this issue open until the build-plan is stabilized |
I have an idea, and really want to know if you think it will work. If every Cargo command added a |
Then you can just as well integrate the |
Indeed, one day I would love to have "cargo clean --outdated" in cargo proper. I think creating an RFC to add it at this point will just lead to a large amount of bikeshedding about exactly which definition of outdated should be used. I think, but can't guarantee, that the cargo team would be willing to add a simple file to the folders maintained by cargo. The contents of those folders are in implementation detail, and don't require an RFC to be changed. |
Adding a file.timestamp file would work very well, since currently sweep can only look at access times as an approximate measure. That said, I do not see any use for this timestamp files for any other projects than sweep really, and making such a change just to improve sweep seems like too little incentive for the cargo team (it has to be implemented and maintained). Then I think it is better just to integrate sweeps functionality into cargo as @jonas-schievink said. If you want to make a PR/issue @Eh2406 to cargo then go ahead, I will back you up since I think it would be nice for my project. But if they do not find it to be useful for a wider context then atleast we can have a discussion about an |
I just submitted a PR at cargo rust-lang/cargo#6477. All feedback is welcome! |
I am confused how this is related to the original issue. I see that you've implemented that in cargo and the fingerprint directories have an |
|
Add a lastest flag to the CLI to enable cleaning of all build artifacts current not in use by making use of
cargo check --message-format=json
The text was updated successfully, but these errors were encountered: