Rename Builder::try_run to run_delaying_failure

This commit is contained in:
jyn 2023-07-13 02:19:39 -05:00
parent 63d7992353
commit 78f51a4be0
3 changed files with 16 additions and 16 deletions

View File

@ -981,7 +981,7 @@ fn try_run_quiet(&self, cmd: &mut Command) -> bool {
} }
/// Runs a command, printing out contextual info if it fails, and delaying errors until the build finishes. /// Runs a command, printing out contextual info if it fails, and delaying errors until the build finishes.
pub(crate) fn try_run(&self, cmd: &mut Command) -> bool { pub(crate) fn run_delaying_failure(&self, cmd: &mut Command) -> bool {
if !self.fail_fast { if !self.fail_fast {
#[allow(deprecated)] // can't use Build::try_run, that's us #[allow(deprecated)] // can't use Build::try_run, that's us
if self.config.try_run(cmd).is_err() { if self.config.try_run(cmd).is_err() {

View File

@ -24,7 +24,7 @@ impl Step for ExpandYamlAnchors {
/// anchors in them, since GitHub Actions doesn't support them. /// anchors in them, since GitHub Actions doesn't support them.
fn run(self, builder: &Builder<'_>) { fn run(self, builder: &Builder<'_>) {
builder.info("Expanding YAML anchors in the GitHub Actions configuration"); builder.info("Expanding YAML anchors in the GitHub Actions configuration");
builder.try_run( builder.run_delaying_failure(
&mut builder.tool_cmd(Tool::ExpandYamlAnchors).arg("generate").arg(&builder.src), &mut builder.tool_cmd(Tool::ExpandYamlAnchors).arg("generate").arg(&builder.src),
); );
} }

View File

@ -180,9 +180,7 @@ fn run(self, builder: &Builder<'_>) {
let _guard = let _guard =
builder.msg(Kind::Test, compiler.stage, "Linkcheck", bootstrap_host, bootstrap_host); builder.msg(Kind::Test, compiler.stage, "Linkcheck", bootstrap_host, bootstrap_host);
let _time = util::timeit(&builder); let _time = util::timeit(&builder);
builder.try_run( builder.run_delaying_failure(linkchecker.arg(builder.out.join(host.triple).join("doc")));
linkchecker.arg(builder.out.join(host.triple).join("doc")),
);
} }
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> { fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
@ -235,7 +233,9 @@ fn run(self, builder: &Builder<'_>) {
builder.default_doc(&[]); builder.default_doc(&[]);
builder.ensure(crate::doc::Rustc::new(builder.top_stage, self.target, builder)); builder.ensure(crate::doc::Rustc::new(builder.top_stage, self.target, builder));
builder.try_run(builder.tool_cmd(Tool::HtmlChecker).arg(builder.doc_out(self.target))); builder.run_delaying_failure(
builder.tool_cmd(Tool::HtmlChecker).arg(builder.doc_out(self.target)),
);
} }
} }
@ -274,7 +274,7 @@ fn run(self, builder: &Builder<'_>) {
let _time = util::timeit(&builder); let _time = util::timeit(&builder);
let mut cmd = builder.tool_cmd(Tool::CargoTest); let mut cmd = builder.tool_cmd(Tool::CargoTest);
builder.try_run( builder.run_delaying_failure(
cmd.arg(&cargo) cmd.arg(&cargo)
.arg(&out_dir) .arg(&out_dir)
.args(builder.config.test_args()) .args(builder.config.test_args())
@ -876,7 +876,7 @@ fn run(self, builder: &Builder<'_>) {
util::lld_flag_no_threads(self.compiler.host.contains("windows")), util::lld_flag_no_threads(self.compiler.host.contains("windows")),
); );
} }
builder.try_run(&mut cmd); builder.run_delaying_failure(&mut cmd);
} }
} }
@ -1136,7 +1136,7 @@ fn run(self, builder: &Builder<'_>) {
} }
builder.info("tidy check"); builder.info("tidy check");
builder.try_run(&mut cmd); builder.run_delaying_failure(&mut cmd);
builder.ensure(ExpandYamlAnchors); builder.ensure(ExpandYamlAnchors);
@ -1181,7 +1181,7 @@ impl Step for ExpandYamlAnchors {
/// by the user before committing CI changes. /// by the user before committing CI changes.
fn run(self, builder: &Builder<'_>) { fn run(self, builder: &Builder<'_>) {
builder.info("Ensuring the YAML anchors in the GitHub Actions config were expanded"); builder.info("Ensuring the YAML anchors in the GitHub Actions config were expanded");
builder.try_run( builder.run_delaying_failure(
&mut builder.tool_cmd(Tool::ExpandYamlAnchors).arg("check").arg(&builder.src), &mut builder.tool_cmd(Tool::ExpandYamlAnchors).arg("check").arg(&builder.src),
); );
} }
@ -1970,7 +1970,7 @@ fn run_ext_doc(self, builder: &Builder<'_>) {
compiler.host, compiler.host,
); );
let _time = util::timeit(&builder); let _time = util::timeit(&builder);
let toolstate = if builder.try_run(&mut rustbook_cmd) { let toolstate = if builder.run_delaying_failure(&mut rustbook_cmd) {
ToolState::TestPass ToolState::TestPass
} else { } else {
ToolState::TestFail ToolState::TestFail
@ -2132,7 +2132,7 @@ fn markdown_test(builder: &Builder<'_>, compiler: Compiler, markdown: &Path) ->
cmd.arg("--test-args").arg(test_args); cmd.arg("--test-args").arg(test_args);
if builder.config.verbose_tests { if builder.config.verbose_tests {
builder.try_run(&mut cmd) builder.run_delaying_failure(&mut cmd)
} else { } else {
try_run_quiet(builder, &mut cmd) try_run_quiet(builder, &mut cmd)
} }
@ -2160,7 +2160,7 @@ fn run(self, builder: &Builder<'_>) {
let src = builder.src.join(relative_path); let src = builder.src.join(relative_path);
let mut rustbook_cmd = builder.tool_cmd(Tool::Rustbook); let mut rustbook_cmd = builder.tool_cmd(Tool::Rustbook);
let toolstate = if builder.try_run(rustbook_cmd.arg("linkcheck").arg(&src)) { let toolstate = if builder.run_delaying_failure(rustbook_cmd.arg("linkcheck").arg(&src)) {
ToolState::TestPass ToolState::TestPass
} else { } else {
ToolState::TestFail ToolState::TestFail
@ -2713,7 +2713,7 @@ fn run(self, builder: &Builder<'_>) {
.current_dir(builder.src.join("src/bootstrap/")); .current_dir(builder.src.join("src/bootstrap/"));
// NOTE: we intentionally don't pass test_args here because the args for unittest and cargo test are mutually incompatible. // NOTE: we intentionally don't pass test_args here because the args for unittest and cargo test are mutually incompatible.
// Use `python -m unittest` manually if you want to pass arguments. // Use `python -m unittest` manually if you want to pass arguments.
builder.try_run(&mut check_bootstrap); builder.run_delaying_failure(&mut check_bootstrap);
let mut cmd = Command::new(&builder.initial_cargo); let mut cmd = Command::new(&builder.initial_cargo);
cmd.arg("test") cmd.arg("test")
@ -2789,7 +2789,7 @@ fn run(self, builder: &Builder<'_>) {
self.compiler.host, self.compiler.host,
self.compiler.host, self.compiler.host,
); );
builder.try_run(&mut cargo.into()); builder.run_delaying_failure(&mut cargo.into());
} }
} }
@ -2875,7 +2875,7 @@ fn run(self, builder: &Builder<'_>) {
cmd.env("CARGO", &builder.initial_cargo); cmd.env("CARGO", &builder.initial_cargo);
cmd.env("RUSTC", &builder.initial_rustc); cmd.env("RUSTC", &builder.initial_rustc);
cmd.env("TMP_DIR", &tmpdir); cmd.env("TMP_DIR", &tmpdir);
builder.try_run(&mut cmd); builder.run_delaying_failure(&mut cmd);
} }
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> { fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {