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

Clean up dependency tracking in Rustbuild #50509

Closed
Mark-Simulacrum opened this issue May 7, 2018 · 5 comments
Closed

Clean up dependency tracking in Rustbuild #50509

Mark-Simulacrum opened this issue May 7, 2018 · 5 comments
Labels
E-mentor Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)

Comments

@Mark-Simulacrum
Copy link
Member

The primary idea here is that throughout compile, check, tool, and test.rs we call builder.cargo, with a series of clear_if_dirty calls before it depending on the implicit dependencies of the given crate.

I'd like for us to instead utilize the Mode argument 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 Mode enum into something like the below; then we'd have to change the uses of it throughout the codebase to apply this strategy:

  • Only compilations of std, test, rustc, and the codegen libraries should use Mode::{Std, Test, Rustc, Codegen} respectively. Primarily the changes here are in tool.rs.
  • Tool compilations that today use Mode::Librustc would become Mode::RustcTool, and same for the other combinations. There isn't a Mode::CodegenTool as 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::cargo to 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 for Mode::Rustc we need to call clear_if_dirty on std, test stamps, whereas Mode::RustcTool needs to call clear_if_dirty for std, test, and rustc stamps. This is mostly just inlining code.

enum Mode {
    Std,
    Test,
    Rustc,
    Codegen,
    ToolStd,
    ToolTest,
    ToolRustc,
}

cc @collin5 -- if you're interested please let me know

@Mark-Simulacrum Mark-Simulacrum added E-mentor Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) labels May 7, 2018
@collin5
Copy link
Contributor

collin5 commented May 7, 2018

@Mark-Simulacrum Yeah, I would like to take this up. Thanks!

bors added a commit that referenced this issue Jun 3, 2018
Clean up dependency tracking in Rustbuild [1/2]

Initial refactor of the `Mode` enum. Still a WIP
Ref  #50509

r? @Mark-Simulacrum
@Mark-Simulacrum
Copy link
Member Author

@collin5 Haven't heard from you in a while -- are you interested in implementing the second step here? No worries if not -- just wanted to check in.

@collin5
Copy link
Contributor

collin5 commented Jul 2, 2018

Oops! Sorry got caught up with some stuff lately. Will have something for you to look at as soon as possible. Thanks for the remainder 👍 .

bors added a commit that referenced this issue Jul 23, 2018
Clean up dependency tracking in Rustbuild [2/2]

Make `clear_if_dirty` calls in `Builder::cargo` with stamp dependencies for the given Mode.

Continuation of #50904
Ref issue #50509
r? @Mark-Simulacrum
bors added a commit that referenced this issue Sep 10, 2018
Clean up dependency tracking in Rustbuild [2/2]

Make `clear_if_dirty` calls in `Builder::cargo` with stamp dependencies for the given Mode.

Continuation of #50904
Ref issue #50509
r? @Mark-Simulacrum
bors added a commit that referenced this issue Sep 17, 2018
Clean up dependency tracking in Rustbuild [2/2]

Make `clear_if_dirty` calls in `Builder::cargo` with stamp dependencies for the given Mode.

Continuation of #50904
Ref issue #50509
r? @Mark-Simulacrum
@XAMPPRocky
Copy link
Member

Triage; @Mark-Simulacrum Can this issue now be closed? If not what work is left to be done?

@Mark-Simulacrum
Copy link
Member Author

Yes, I believe this issue is mostly done (and keeping it open is not helping, anyway).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
E-mentor Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)
Projects
None yet
Development

No branches or pull requests

3 participants