-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Support cargo clean --workspace
#14720
Comments
For what to name the flag, we generally call it With the However, I'm not too clear on the use case. Why do you need to clear things out? I'm assuming running the next build will cause these files to just come back, meaning there isn't a significant savings but the next build will be slower (because of the lack of incremental build cache). Also, I wonder if there is a way for the incremental cache to be smaller. I didn't see any existing open issues for the size |
I don't either, though might be worth considering the interaction with per-user caches #5931 together.
Just note that |
I remember the space can keep going up to like 100 or 200G. After the clean, the space can go down a lot. I can come back later to show what takes up the space when it bloats again. |
cargo clean --workspace-members
cargo clean --workspace
Update about the motivation:
After the delete, it goes down to
|
What I really want is sth like "clean all earlier builds, but keep recent builds". It seems to be the goal of Therefore, I came up with |
We've talked about GC for the target directory which might be able to be tuned for "all but latest". The current layout of the target directory is a bit messy and I'd prefer we don't try to track individual files. We have talked about re-organizing the target directory for #5931 which would also give us GC for the shared intermediate artifavts but we could also consider non-shared ones. |
Problem
We have a large workspace (~500k loc).
target
dir bloats quickly, butcargo clean
will let us recompile all dependencies (We have >1000 dependencies, and some dependencies take minutes to compile).Recompiling dependencies is unnecessary, and it wastes time and energy.
We only want to clean build artifacts of "our own code". Actually it also takes up most of the space:
Current workarounds
Crates in my workspace have a common prefix, like
risingwave-xxx
. So I could just find & delete:A more cargo native solution (mentioned by @weihanglo):
But this turns out to be much slower than the brute force way above. @weihanglo says: we should make
-p
in cargo-clean also aware of glob syntax. Then it might be faster. But I'm thinking sth like--workspace-members
is more straightforward, and I'm not sure whether there's other cases we want a regexp clean.Proposed Solution
Add a flag
--workspace-members
forcargo clean
, which is essentially(but more efficient)
Notes
Original posted at https://x.com/yayale_umi/status/1848921059011268944
The text was updated successfully, but these errors were encountered: