-
-
Notifications
You must be signed in to change notification settings - Fork 14.1k
Add central execution context to bootstrap #141909
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
Add central execution context to bootstrap #141909
Conversation
|
This PR modifies If appropriate, please update This PR changes how GCC is built. Consider updating src/bootstrap/download-ci-gcc-stamp. This PR changes how LLVM is built. Consider updating src/bootstrap/download-ci-llvm-stamp. |
Kobzol
left a comment
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.
This is awesome ❤️ I wanted to do this for a long time, and probably have like 3 unfinished branches with something like this locally 😆 Left some comments.
| use crate::{BehaviorOnFailure, BootstrapCommand, CommandOutput, OutputMode, RefCell, exit}; | ||
|
|
||
| #[derive(Clone)] | ||
| pub struct ExecutionContext { |
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.
Could you please add some doc comment on top of this that would explain what is it for? :)
| /// Cache for determining path modifications | ||
| pub path_modification_cache: Arc<Mutex<HashMap<Vec<&'static str>, PathFreshness>>>, | ||
|
|
||
| pub execution_context: ExecutionContext, |
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.
Just noting to myself: the execution context shouldn't be stored inside Config; I would rather put it into the Builder.
For the migration, storing it inside Config is of course the easiest. I wonder how hard it would be to put it inside the builder already in this PR?
|
Btw you probably know this, but looking for usages of |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
8f7b375 to
8aed926
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
a4b29b5 to
8b9bd93
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
Looks like the command invocation from the error is swallowing errors. Not sure what/where fails. |
|
☔ The latest upstream changes (presumably #142070) made this pull request unmergeable. Please resolve the merge conflicts. |
576f422 to
587c691
Compare
Kobzol
left a comment
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.
Left a few additional comments. I think that if Config::parse created the execuion context from the passed flags, rather than receiving it as a parameter, the diff of the PR could be reduced quite a lot, because the tests wouldn't need to change.
…e methods via config
…ocation according to suggestions
…from the execution context, add getters and setters in the config, and update the tests and other relevant areas accordingly.
587c691 to
51fbd14
Compare
|
Thank you! I agree, let's land like this and we can make further refactorings in follow-up PRs. @bors r+ |
| let current_branch = output_result( | ||
| helpers::git(Some(&self.src)) | ||
| .allow_failure() | ||
| .run_always() | ||
| .args(["symbolic-ref", "--short", "HEAD"]) | ||
| .as_command_mut(), | ||
| ) | ||
| .map(|b| b.trim().to_owned()); | ||
| let current_branch = helpers::git(Some(&self.src)) | ||
| .allow_failure() | ||
| .run_always() | ||
| .args(["symbolic-ref", "--short", "HEAD"]) | ||
| .run_capture(self); |
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.
When running ./x.py -vv build, I see following commands being executed, and then errors similar to those reported in #142350:
env -u GIT_ALTERNATE_OBJECT_DIRECTORIES -u GIT_DIR -u GIT_INDEX_FILE -u GIT_OBJECT_DIRECTORY -u GIT_WORK_TREE "git" "symbolic-ref" "--short" "HEAD" (failure_mode=Ignore) (created at src/bootstrap/src/core/config/config.rs:1393:34, executed at src/bootstrap/src/core/config/config.rs:1397:18)
env -u GIT_ALTERNATE_OBJECT_DIRECTORIES -u GIT_DIR -u GIT_INDEX_FILE -u GIT_OBJECT_DIRECTORY -u GIT_WORK_TREE "git" "-c" "branch.master\n.remote=origin" "submodule" "update" "--init" "--recursive" "--depth=1" "--progress" "library/stdarch" (failure_mode=Ignore)
error: invalid key (newline): branch.master
It looks like the new implementation no longer trims the trailing newline.
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.
Oh, I missed that, sorry. #142374 should fix this.
This PR continues the effort toward command centralization as outlined in #126819. It introduces a centralized execution context through which all commands will be executed. Previously, centralization was limited to build methods; this PR extends it to the
configmodule and updates the remaining methods accordingly.Best reviewed commit by commit.
r? @Kobzol