-
Notifications
You must be signed in to change notification settings - Fork 13.9k
bootstrap: Extract parts of bootstrap::core::builder into a cli_paths module
#148317
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
Conversation
|
I also want to clean up What I would like to work towards is being able to extract the parts of |
|
(The error check arguably doesn't belong in |
8bf985b to
28e6c7a
Compare
28e6c7a to
250ee47
Compare
Do you think we could already test the current path matching with the snapshot tests? We have code that creates a Unit tests are nice and all, but in the grand scheme of bootstrap, things can still break, so I'd like to also have tests that check the path handling logic end-to-end. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for cleaning this up! This code really deserves a proper refactoring. Left some comments, but that's not really related to this PR, so if you're happy with this, you can r=me.
|
|
||
| // FIXME(Zalathar): This particular check isn't related to path-to-step | ||
| // matching, and should probably be hoisted to somewhere much earlier. | ||
| if builder.download_rustc() && (builder.kind == Kind::Dist || builder.kind == Kind::Install) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, in particular, I think that this should be moved to the part of config parsing that checks if we can run build with stage 0 etc.
| // Handle all PathSets. | ||
| for (_index, desc, pathsets) in steps_to_run { | ||
| if !pathsets.is_empty() { | ||
| desc.maybe_run(builder, pathsets); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(for a later PR): this innocent line actually runs bootstrap's CLI steps, which is not obvious. It would be nice if we could just return a set of paths to run from this function/module, and then actually run them in the builder code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, that's more or less the plan, and I hope to make the resulting helper function snapshot-testable.
I was playing around with changes to StepDescription::run, and found that I kept wanting to pull everything out into a separate file first, which became this PR.
In general I'm a big fan of “the code that does the important thing should be obvious and easy to find”, and the current code certainly doesn't live up to that principle. 😅
|
@bors r=Kobzol rollup |
For the purposes of testing path-to-step handling, I would like to have some kind of snapshot-test suite that takes a command-line as input, and produces a list of non-transitive steps only. So basically just the immediate result of translating command-line paths into top-level steps. The existing snapshot-test harness is not set up to do that (since from what I can tell it includes transitive steps, and omits all but some specially-marked steps), but if you have an idea of how to pull that off before making any functional changes to |
|
So the current snapshot tests work by having a test-only code in Or, as a perhaps simpler alternative, we could use the current step recording machinery, but filter only steps that were executed when the "step stack" was empty, which should be the top-level, non-transitive steps executed from |
Rollup of 3 pull requests Successful merges: - #148165 (Use `mut` less in dataflow analysis) - #148287 (Fix deferred cast checks using the wrong body for determining constness) - #148317 (bootstrap: Extract parts of `bootstrap::core::builder` into a `cli_paths` module) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of #148317 - Zalathar:cli-paths-mod, r=Kobzol bootstrap: Extract parts of `bootstrap::core::builder` into a `cli_paths` module One of the things that makes bootstrap's CLI path handling hard to work with is the fact that it's in the middle of a ~2000 line file full of all sorts of other things. And the primary code sequence is in an unhelpfully-named `StepDescription::run` function. This PR therefore pulls some key chunks of code out into a `cli_paths` submodule. This should be a purely non-functional change.
One of the things that makes bootstrap's CLI path handling hard to work with is the fact that it's in the middle of a ~2000 line file full of all sorts of other things. And the primary code sequence is in an unhelpfully-named
StepDescription::runfunction.This PR therefore pulls some key chunks of code out into a
cli_pathssubmodule.This should be a purely non-functional change.