-
-
Notifications
You must be signed in to change notification settings - Fork 14.1k
bootstrap: Replace Step::DEFAULT and default_condition with is_default_step
#148987
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
|
Ignoring the new snapshot tests, the actual |
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.
Great cleanup! To go further, I think that we could eventually rethink/rename all the important Step functions (not in this PR).
Something like:
should_run => `define_cli_paths`
is_default_step => `should_run_by_default`, `should_run_with_no_path` or just `is_default`
make_run => `run_from_cli`
I would suggest making fn is_default_step { true } the default implementation. IMO everything should be enabled by default, so that we don't miss steps by accident, and only specific steps should return false. This reduces then need to think about the right default impl for the is_default_step function. Most/more of the impls in this PR return true anyway.
| fn check_if_tidy_is_installed(builder: &Builder<'_>) -> bool { | ||
| command("tidy").allow_failure().arg("--version").run_capture_stdout(builder).is_success() | ||
| *builder.html_tidy_is_available_memo.get_or_init(|| { | ||
| command("tidy").allow_failure().arg("--version").run_capture_stdout(builder).is_success() |
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.
Rather than caching this in the builder, you can just make the command cached (.cached()). That's IMO much simpler.
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.
Caching the command output is a bit less powerful, since it doesn't cache the subsequent processing steps.
But if running the command repeatedly is the thing we're worried about, then that's fine.
Ideally I would want to not perform these probes here at all, and instead require opt-in config for these tools. But that's well beyond the scope of this PR.
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.
Tbh I think that even without any caching it would be fine. But if anything, I'd expect the command invocation to take more time than the processing.
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.
Ideally I would want to not perform these probes here at all, and instead require opt-in config for these tools. But that's well beyond the scope of this PR.
This is also my preference (if I were to redesign this setup from scratch), but I can appreciate it being annoying for existing usages.
I've written some of my thoughts about this on Zulip, since it's a bit of a pain to have an actual discussion on GitHub. |
|
Holding off on reviewing this to wait for the discussion to settle down first. |
|
☔ The latest upstream changes (presumably #148763) made this pull request unmergeable. Please resolve the merge conflicts. |
This comment has been minimized.
This comment has been minimized.
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.
Looks good to me, handing review back to Jakub in case they had more feedback
|
r? @Kobzol |
|
|
|
Right. r? me In that case, I think let's merge this as-is. If we wanted to make run-by-default the default (hah), we can still do that in a follow-up. @bors r+ rollup=never |
This comment has been minimized.
This comment has been minimized.
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
|
Rebased to fix a trivial soft-conflict with the new step added by #149071. |
|
r=me once PR CI is green enough |
|
Fine by me to this as-is 👍 |
|
@bors r=jieyouxu |
bootstrap: Replace `Step::DEFAULT` and `default_condition` with `is_default_step` - Revised and expanded version of #148965 --- One of the confusing things about bootstrap's `Step::should_run` is that it combines two loosely-related but non-overlapping responsibilities: - Registering paths/aliases to decide whether a step should be run in response to paths/aliases passed as explicit command-line arguments - When the user invokes `./x test compiler`, this allows bootstrap to know what steps “compiler” should translate into - Deciding whether a step marked `DEFAULT = true` should actually run or not, when no paths/aliases are explicitly specified - When the user invokes `./x test`, this allows bootstrap to know which steps to run by default This PR therefore splits out the latter of those responsibilities into a dedicated `is_default_step` associated function, which also replaces the existing `DEFAULT` associated constant. A small number of steps were using `ShouldRun::lazy_default_condition` to specify a condition that should not be run repeatedly if possible, e.g. because it queries external tools. Those steps now perform memoization via fields in `Builder` instead. r? jieyouxu
|
💔 Test failed - checks-actions |
Tragic. @bors retry |
|
☀️ Test successful - checks-actions |
What is this?This is an experimental post-merge analysis report that shows differences in test outcomes between the merged PR and its parent PR.Comparing 7b9905e (parent) -> cf8a955 (this PR) Test differencesShow 13 test diffsStage 0
Additionally, 2 doctest diffs were found. These are ignored, as they are noisy. Job group index Test dashboardRun cargo run --manifest-path src/ci/citool/Cargo.toml -- \
test-dashboard cf8a95590a1b768b7711f2631d5b5e3ead464de7 --output-dir test-dashboardAnd then open Job duration changes
How to interpret the job duration changes?Job durations can vary a lot, based on the actual runner instance |
|
Finished benchmarking commit (cf8a955): comparison URL. Overall result: no relevant changes - no action needed@rustbot label: -perf-regression Instruction countThis benchmark run did not return any relevant results for this metric. Max RSS (memory usage)Results (secondary 4.2%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesResults (primary 0.3%, secondary 0.9%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 470.06s -> 470.335s (0.06%) |
bootstrap: Replace `Step::DEFAULT` and `default_condition` with `is_default_step` - Revised and expanded version of rust-lang#148965 --- One of the confusing things about bootstrap's `Step::should_run` is that it combines two loosely-related but non-overlapping responsibilities: - Registering paths/aliases to decide whether a step should be run in response to paths/aliases passed as explicit command-line arguments - When the user invokes `./x test compiler`, this allows bootstrap to know what steps “compiler” should translate into - Deciding whether a step marked `DEFAULT = true` should actually run or not, when no paths/aliases are explicitly specified - When the user invokes `./x test`, this allows bootstrap to know which steps to run by default This PR therefore splits out the latter of those responsibilities into a dedicated `is_default_step` associated function, which also replaces the existing `DEFAULT` associated constant. A small number of steps were using `ShouldRun::lazy_default_condition` to specify a condition that should not be run repeatedly if possible, e.g. because it queries external tools. Those steps now perform memoization via fields in `Builder` instead. r? jieyouxu
Step::is_really_defaultfromStep::should_run#148965One of the confusing things about bootstrap's
Step::should_runis that it combines two loosely-related but non-overlapping responsibilities:./x test compiler, this allows bootstrap to know what steps “compiler” should translate intoDEFAULT = trueshould actually run or not, when no paths/aliases are explicitly specified./x test, this allows bootstrap to know which steps to run by defaultThis PR therefore splits out the latter of those responsibilities into a dedicated
is_default_stepassociated function, which also replaces the existingDEFAULTassociated constant.A small number of steps were using
ShouldRun::lazy_default_conditionto specify a condition that should not be run repeatedly if possible, e.g. because it queries external tools. Those steps now perform memoization via fields inBuilderinstead.r? jieyouxu