Skip to content

Commit

Permalink
Migrate more Command usages to BootstrapCmd
Browse files Browse the repository at this point in the history
  • Loading branch information
Kobzol committed Jun 22, 2024
1 parent b906027 commit bee136f
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 19 deletions.
18 changes: 9 additions & 9 deletions src/bootstrap/src/core/build_steps/dist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1701,7 +1701,7 @@ impl Step for Extended {

let heat_flags = ["-nologo", "-gg", "-sfrag", "-srd", "-sreg"];
builder.run(
Command::new(&heat)
BootstrapCommand::new(&heat)
.current_dir(&exe)
.arg("dir")
.arg("rustc")
Expand All @@ -1717,7 +1717,7 @@ impl Step for Extended {
);
if built_tools.contains("rust-docs") {
builder.run(
Command::new(&heat)
BootstrapCommand::new(&heat)
.current_dir(&exe)
.arg("dir")
.arg("rust-docs")
Expand All @@ -1735,7 +1735,7 @@ impl Step for Extended {
);
}
builder.run(
Command::new(&heat)
BootstrapCommand::new(&heat)
.current_dir(&exe)
.arg("dir")
.arg("cargo")
Expand All @@ -1752,7 +1752,7 @@ impl Step for Extended {
.arg(etc.join("msi/remove-duplicates.xsl")),
);
builder.run(
Command::new(&heat)
BootstrapCommand::new(&heat)
.current_dir(&exe)
.arg("dir")
.arg("rust-std")
Expand All @@ -1768,7 +1768,7 @@ impl Step for Extended {
);
if built_tools.contains("rust-analyzer") {
builder.run(
Command::new(&heat)
BootstrapCommand::new(&heat)
.current_dir(&exe)
.arg("dir")
.arg("rust-analyzer")
Expand All @@ -1787,7 +1787,7 @@ impl Step for Extended {
}
if built_tools.contains("clippy") {
builder.run(
Command::new(&heat)
BootstrapCommand::new(&heat)
.current_dir(&exe)
.arg("dir")
.arg("clippy")
Expand All @@ -1806,7 +1806,7 @@ impl Step for Extended {
}
if built_tools.contains("miri") {
builder.run(
Command::new(&heat)
BootstrapCommand::new(&heat)
.current_dir(&exe)
.arg("dir")
.arg("miri")
Expand All @@ -1824,7 +1824,7 @@ impl Step for Extended {
);
}
builder.run(
Command::new(&heat)
BootstrapCommand::new(&heat)
.current_dir(&exe)
.arg("dir")
.arg("rust-analysis")
Expand All @@ -1842,7 +1842,7 @@ impl Step for Extended {
);
if target.ends_with("windows-gnu") {
builder.run(
Command::new(&heat)
BootstrapCommand::new(&heat)
.current_dir(&exe)
.arg("dir")
.arg("rust-mingw")
Expand Down
11 changes: 4 additions & 7 deletions src/bootstrap/src/core/build_steps/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3141,8 +3141,7 @@ impl Step for RustInstaller {
return;
}

let mut cmd =
std::process::Command::new(builder.src.join("src/tools/rust-installer/test.sh"));
let mut cmd = BootstrapCommand::new(builder.src.join("src/tools/rust-installer/test.sh"));
let tmpdir = testdir(builder, compiler.host).join("rust-installer");
let _ = std::fs::remove_dir_all(&tmpdir);
let _ = std::fs::create_dir_all(&tmpdir);
Expand All @@ -3151,7 +3150,7 @@ impl Step for RustInstaller {
cmd.env("CARGO", &builder.initial_cargo);
cmd.env("RUSTC", &builder.initial_rustc);
cmd.env("TMP_DIR", &tmpdir);
builder.run(BootstrapCommand::from(&mut cmd).delay_failure());
builder.run(cmd.delay_failure());
}

fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
Expand Down Expand Up @@ -3345,8 +3344,7 @@ impl Step for CodegenCranelift {
.arg("testsuite.extended_sysroot");
cargo.args(builder.config.test_args());

let mut cmd: Command = cargo.into();
builder.run(BootstrapCommand::from(&mut cmd));
builder.run(cargo);
}
}

Expand Down Expand Up @@ -3471,7 +3469,6 @@ impl Step for CodegenGCC {
.arg("--std-tests");
cargo.args(builder.config.test_args());

let mut cmd: Command = cargo.into();
builder.run(BootstrapCommand::from(&mut cmd));
builder.run(cargo);
}
}
4 changes: 2 additions & 2 deletions src/bootstrap/src/core/build_steps/tool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -836,13 +836,13 @@ impl Step for LibcxxVersionTool {
}

let compiler = builder.cxx(self.target).unwrap();
let mut cmd = Command::new(compiler);
let mut cmd = BootstrapCommand::new(compiler);

cmd.arg("-o")
.arg(&executable)
.arg(builder.src.join("src/tools/libcxx-version/main.cpp"));

builder.run(BootstrapCommand::from(&mut cmd));
builder.run(cmd);

if !executable.exists() {
panic!("Something went wrong. {} is not present", executable.display());
Expand Down
2 changes: 1 addition & 1 deletion src/bootstrap/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -576,7 +576,7 @@ impl Build {
};
// NOTE: doesn't use `try_run` because this shouldn't print an error if it fails.
if !update(true).status().map_or(false, |status| status.success()) {
self.run(&mut update(false));
self.run(update(false));
}

// Save any local changes, but avoid running `git stash pop` if there are none (since it will exit with an error).
Expand Down

0 comments on commit bee136f

Please sign in to comment.