-
-
Notifications
You must be signed in to change notification settings - Fork 14.7k
Clean up dependency tracking in Rustbuild #50509
Copy link
Copy link
Closed
Labels
E-mentorCall for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.T-bootstrapRelevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)
Metadata
Metadata
Assignees
Labels
E-mentorCall for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.T-bootstrapRelevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)
Type
Fields
Give feedbackNo fields configured for issues without a type.
The primary idea here is that throughout compile, check, tool, and test.rs we call
builder.cargo, with a series ofclear_if_dirtycalls before it depending on the implicit dependencies of the given crate.I'd like for us to instead utilize the
Modeargument passed. That should ensure that we appropriately do this without having to think about it when adding new tools and tests.I believe the appropriate first step here is to refactor the existing
Modeenum into something like the below; then we'd have to change the uses of it throughout the codebase to apply this strategy:Mode::{Std, Test, Rustc, Codegen}respectively. Primarily the changes here are in tool.rs.Mode::Librustcwould becomeMode::RustcTool, and same for the other combinations. There isn't aMode::CodegenToolas those don't currently exist to my knowledge, but we can add it if necessary.Once this initial refactor is done, I think that's a good point to file a PR as it's an incremental change that can be reviewed on its own. The second change (which will close this issue) is to change
Builder::cargoto have a match on the passed mode which will call clear_if_dirty with the stamp dependencies of the given Mode. Note that this means forMode::Rustcwe need to call clear_if_dirty on std, test stamps, whereasMode::RustcToolneeds to call clear_if_dirty for std, test, and rustc stamps. This is mostly just inlining code.cc @collin5 -- if you're interested please let me know