update dry_run value in exec_ctx and start forwarding exec_ctx verbose methods via config

This commit is contained in:
bit-aloo 2025-06-08 11:00:42 +05:30
parent 50725f325b
commit f3e1eb1dca
No known key found for this signature in database
4 changed files with 5 additions and 13 deletions

View file

@ -1025,10 +1025,7 @@ impl Config {
}
pub fn dry_run(&self) -> bool {
match self.dry_run {
DryRun::Disabled => false,
DryRun::SelfCheck | DryRun::UserSelected => true,
}
self.exec_ctx.dry_run()
}
pub fn is_explicit_stage(&self) -> bool {
@ -1256,9 +1253,7 @@ impl Config {
/// Runs a function if verbosity is greater than 0
pub fn verbose(&self, f: impl Fn()) {
if self.is_verbose() {
f()
}
self.exec_ctx.verbose(f);
}
pub fn any_sanitizers_to_build(&self) -> bool {

View file

@ -38,7 +38,7 @@ fn curl_version(config: &Config) -> semver::Version {
/// Generic helpers that are useful anywhere in bootstrap.
impl Config {
pub fn is_verbose(&self) -> bool {
self.verbose > 0
self.exec_ctx.is_verbose()
}
pub(crate) fn create<P: AsRef<Path>>(&self, path: P, s: &str) {

View file

@ -673,6 +673,7 @@ impl Build {
let _sanity_check_span =
span!(tracing::Level::DEBUG, "(1) executing dry-run sanity-check").entered();
self.config.dry_run = DryRun::SelfCheck;
self.config.exec_ctx.set_dry_run(DryRun::SelfCheck);
let builder = builder::Builder::new(self);
builder.execute_cli();
}
@ -683,6 +684,7 @@ impl Build {
let _actual_run_span =
span!(tracing::Level::DEBUG, "(2) executing actual run").entered();
self.config.dry_run = DryRun::Disabled;
self.config.exec_ctx.set_dry_run(DryRun::Disabled);
let builder = builder::Builder::new(self);
builder.execute_cli();
}

View file

@ -51,11 +51,6 @@ impl GitInfo {
if output.is_failure() {
return GitInfo::Absent;
}
// Make sure git commands work
// match helpers::git(Some(dir)).arg("rev-parse").as_command_mut().output() {
// Ok(ref out) if out.status.success() => {}
// _ => return GitInfo::Absent,
// }
// If we're ignoring the git info, we don't actually need to collect it, just make sure this
// was a git repo in the first place.