@@ -47,6 +47,7 @@ use crate::core::config::{
4747} ;
4848use crate :: core:: download:: is_download_ci_available;
4949use crate :: utils:: channel;
50+ use crate :: utils:: execution_context:: ExecutionContext ;
5051use crate :: utils:: helpers:: exe;
5152use crate :: { Command , GitInfo , OnceLock , TargetSelection , check_ci_llvm, helpers, output, t} ;
5253
@@ -304,6 +305,8 @@ pub struct Config {
304305 /// This is mostly for RA as building the stage1 compiler to check the library tree
305306 /// on each code change might be too much for some computers.
306307 pub skip_std_check_if_no_download_rustc : bool ,
308+
309+ pub exec_ctx : ExecutionContext ,
307310}
308311
309312impl Config {
@@ -364,8 +367,8 @@ impl Config {
364367 feature = "tracing" ,
365368 instrument( target = "CONFIG_HANDLING" , level = "trace" , name = "Config::parse" , skip_all)
366369 ) ]
367- pub fn parse ( flags : Flags ) -> Config {
368- Self :: parse_inner ( flags, Self :: get_toml)
370+ pub fn parse ( flags : Flags , exec_ctx : ExecutionContext ) -> Config {
371+ Self :: parse_inner ( flags, Self :: get_toml, exec_ctx )
369372 }
370373
371374 #[ cfg_attr(
@@ -380,8 +383,10 @@ impl Config {
380383 pub ( crate ) fn parse_inner (
381384 mut flags : Flags ,
382385 get_toml : impl Fn ( & Path ) -> Result < TomlConfig , toml:: de:: Error > ,
386+ exec_ctx : ExecutionContext ,
383387 ) -> Config {
384388 let mut config = Config :: default_opts ( ) ;
389+ config. exec_ctx = exec_ctx;
385390
386391 // Set flags.
387392 config. paths = std:: mem:: take ( & mut flags. paths ) ;
@@ -1741,4 +1746,18 @@ impl Config {
17411746 _ => !self . is_system_llvm ( target) ,
17421747 }
17431748 }
1749+
1750+ pub fn exec_ctx ( & self ) -> & ExecutionContext {
1751+ & self . exec_ctx
1752+ }
1753+
1754+ pub fn git_info ( & self , omit_git_hash : bool , dir : & Path ) -> GitInfo {
1755+ GitInfo :: new ( omit_git_hash, dir, self )
1756+ }
1757+ }
1758+
1759+ impl AsRef < ExecutionContext > for Config {
1760+ fn as_ref ( & self ) -> & ExecutionContext {
1761+ & self . exec_ctx
1762+ }
17441763}
0 commit comments