Skip to content

Commit 587c691

Browse files
committed
update dry_run value in exec_ctx and start forwarding exec_ctx verbose methods via config
1 parent 346641f commit 587c691

File tree

5 files changed

+7
-14
lines changed

5 files changed

+7
-14
lines changed

src/bootstrap/src/core/builder/tests.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ fn configure(cmd: &str, host: &[&str], target: &[&str]) -> Config {
1919
}
2020

2121
fn configure_with_args(cmd: &[String], host: &[&str], target: &[&str]) -> Config {
22-
let (flags, exec_ctx) = Flags::parse(cmd);
22+
let (flags, mut exec_ctx) = Flags::parse(cmd);
23+
exec_ctx.set_dry_run(DryRun::SelfCheck);
2324
let mut config = Config::parse(flags, exec_ctx);
2425
// don't save toolstates
2526
config.save_toolstates = None;

src/bootstrap/src/core/config/config.rs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1025,10 +1025,7 @@ impl Config {
10251025
}
10261026

10271027
pub fn dry_run(&self) -> bool {
1028-
match self.dry_run {
1029-
DryRun::Disabled => false,
1030-
DryRun::SelfCheck | DryRun::UserSelected => true,
1031-
}
1028+
self.exec_ctx.dry_run()
10321029
}
10331030

10341031
pub fn is_explicit_stage(&self) -> bool {
@@ -1256,9 +1253,7 @@ impl Config {
12561253

12571254
/// Runs a function if verbosity is greater than 0
12581255
pub fn verbose(&self, f: impl Fn()) {
1259-
if self.is_verbose() {
1260-
f()
1261-
}
1256+
self.exec_ctx.verbose(f);
12621257
}
12631258

12641259
pub fn any_sanitizers_to_build(&self) -> bool {

src/bootstrap/src/core/download.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ fn curl_version(config: &Config) -> semver::Version {
3838
/// Generic helpers that are useful anywhere in bootstrap.
3939
impl Config {
4040
pub fn is_verbose(&self) -> bool {
41-
self.verbose > 0
41+
self.exec_ctx.is_verbose()
4242
}
4343

4444
pub(crate) fn create<P: AsRef<Path>>(&self, path: P, s: &str) {

src/bootstrap/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -671,6 +671,7 @@ impl Build {
671671
let _sanity_check_span =
672672
span!(tracing::Level::DEBUG, "(1) executing dry-run sanity-check").entered();
673673
self.config.dry_run = DryRun::SelfCheck;
674+
self.config.exec_ctx.set_dry_run(DryRun::SelfCheck);
674675
let builder = builder::Builder::new(self);
675676
builder.execute_cli();
676677
}
@@ -681,6 +682,7 @@ impl Build {
681682
let _actual_run_span =
682683
span!(tracing::Level::DEBUG, "(2) executing actual run").entered();
683684
self.config.dry_run = DryRun::Disabled;
685+
self.config.exec_ctx.set_dry_run(DryRun::Disabled);
684686
let builder = builder::Builder::new(self);
685687
builder.execute_cli();
686688
}

src/bootstrap/src/utils/channel.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,6 @@ impl GitInfo {
5151
if output.is_failure() {
5252
return GitInfo::Absent;
5353
}
54-
// Make sure git commands work
55-
// match helpers::git(Some(dir)).arg("rev-parse").as_command_mut().output() {
56-
// Ok(ref out) if out.status.success() => {}
57-
// _ => return GitInfo::Absent,
58-
// }
5954

6055
// If we're ignoring the git info, we don't actually need to collect it, just make sure this
6156
// was a git repo in the first place.

0 commit comments

Comments
 (0)