Migrate more Command usages to BootstrapCmd

This commit is contained in:
Jakub Beránek 2024-06-22 11:35:03 +02:00
parent bed2cbd2ce
commit 2ebfccecd0
No known key found for this signature in database
GPG Key ID: 909CD0D26483516B
5 changed files with 17 additions and 20 deletions

View File

@ -1705,7 +1705,7 @@ fn filter(contents: &str, marker: &str) -> String {
let heat_flags = ["-nologo", "-gg", "-sfrag", "-srd", "-sreg"]; let heat_flags = ["-nologo", "-gg", "-sfrag", "-srd", "-sreg"];
builder.run( builder.run(
Command::new(&heat) BootstrapCommand::new(&heat)
.current_dir(&exe) .current_dir(&exe)
.arg("dir") .arg("dir")
.arg("rustc") .arg("rustc")
@ -1721,7 +1721,7 @@ fn filter(contents: &str, marker: &str) -> String {
); );
if built_tools.contains("rust-docs") { if built_tools.contains("rust-docs") {
builder.run( builder.run(
Command::new(&heat) BootstrapCommand::new(&heat)
.current_dir(&exe) .current_dir(&exe)
.arg("dir") .arg("dir")
.arg("rust-docs") .arg("rust-docs")
@ -1739,7 +1739,7 @@ fn filter(contents: &str, marker: &str) -> String {
); );
} }
builder.run( builder.run(
Command::new(&heat) BootstrapCommand::new(&heat)
.current_dir(&exe) .current_dir(&exe)
.arg("dir") .arg("dir")
.arg("cargo") .arg("cargo")
@ -1756,7 +1756,7 @@ fn filter(contents: &str, marker: &str) -> String {
.arg(etc.join("msi/remove-duplicates.xsl")), .arg(etc.join("msi/remove-duplicates.xsl")),
); );
builder.run( builder.run(
Command::new(&heat) BootstrapCommand::new(&heat)
.current_dir(&exe) .current_dir(&exe)
.arg("dir") .arg("dir")
.arg("rust-std") .arg("rust-std")
@ -1772,7 +1772,7 @@ fn filter(contents: &str, marker: &str) -> String {
); );
if built_tools.contains("rust-analyzer") { if built_tools.contains("rust-analyzer") {
builder.run( builder.run(
Command::new(&heat) BootstrapCommand::new(&heat)
.current_dir(&exe) .current_dir(&exe)
.arg("dir") .arg("dir")
.arg("rust-analyzer") .arg("rust-analyzer")
@ -1791,7 +1791,7 @@ fn filter(contents: &str, marker: &str) -> String {
} }
if built_tools.contains("clippy") { if built_tools.contains("clippy") {
builder.run( builder.run(
Command::new(&heat) BootstrapCommand::new(&heat)
.current_dir(&exe) .current_dir(&exe)
.arg("dir") .arg("dir")
.arg("clippy") .arg("clippy")
@ -1810,7 +1810,7 @@ fn filter(contents: &str, marker: &str) -> String {
} }
if built_tools.contains("miri") { if built_tools.contains("miri") {
builder.run( builder.run(
Command::new(&heat) BootstrapCommand::new(&heat)
.current_dir(&exe) .current_dir(&exe)
.arg("dir") .arg("dir")
.arg("miri") .arg("miri")
@ -1828,7 +1828,7 @@ fn filter(contents: &str, marker: &str) -> String {
); );
} }
builder.run( builder.run(
Command::new(&heat) BootstrapCommand::new(&heat)
.current_dir(&exe) .current_dir(&exe)
.arg("dir") .arg("dir")
.arg("rust-analysis") .arg("rust-analysis")
@ -1846,7 +1846,7 @@ fn filter(contents: &str, marker: &str) -> String {
); );
if target.ends_with("windows-gnu") { if target.ends_with("windows-gnu") {
builder.run( builder.run(
Command::new(&heat) BootstrapCommand::new(&heat)
.current_dir(&exe) .current_dir(&exe)
.arg("dir") .arg("dir")
.arg("rust-mingw") .arg("rust-mingw")

View File

@ -3142,8 +3142,7 @@ fn run(self, builder: &Builder<'_>) {
return; return;
} }
let mut cmd = let mut cmd = BootstrapCommand::new(builder.src.join("src/tools/rust-installer/test.sh"));
std::process::Command::new(builder.src.join("src/tools/rust-installer/test.sh"));
let tmpdir = testdir(builder, compiler.host).join("rust-installer"); let tmpdir = testdir(builder, compiler.host).join("rust-installer");
let _ = std::fs::remove_dir_all(&tmpdir); let _ = std::fs::remove_dir_all(&tmpdir);
let _ = std::fs::create_dir_all(&tmpdir); let _ = std::fs::create_dir_all(&tmpdir);
@ -3152,7 +3151,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.run(BootstrapCommand::from(&mut cmd).delay_failure()); builder.run(cmd.delay_failure());
} }
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> { fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
@ -3346,8 +3345,7 @@ fn run(self, builder: &Builder<'_>) {
.arg("testsuite.extended_sysroot"); .arg("testsuite.extended_sysroot");
cargo.args(builder.config.test_args()); cargo.args(builder.config.test_args());
let mut cmd: Command = cargo.into(); builder.run(cargo);
builder.run(BootstrapCommand::from(&mut cmd));
} }
} }
@ -3472,7 +3470,6 @@ fn run(self, builder: &Builder<'_>) {
.arg("--std-tests"); .arg("--std-tests");
cargo.args(builder.config.test_args()); cargo.args(builder.config.test_args());
let mut cmd: Command = cargo.into(); builder.run(cargo);
builder.run(BootstrapCommand::from(&mut cmd));
} }
} }

View File

@ -912,13 +912,13 @@ fn run(self, builder: &Builder<'_>) -> LibcxxVersion {
} }
let compiler = builder.cxx(self.target).unwrap(); let compiler = builder.cxx(self.target).unwrap();
let mut cmd = Command::new(compiler); let mut cmd = BootstrapCommand::new(compiler);
cmd.arg("-o") cmd.arg("-o")
.arg(&executable) .arg(&executable)
.arg(builder.src.join("src/tools/libcxx-version/main.cpp")); .arg(builder.src.join("src/tools/libcxx-version/main.cpp"));
builder.run(BootstrapCommand::from(&mut cmd)); builder.run(cmd);
if !executable.exists() { if !executable.exists() {
panic!("Something went wrong. {} is not present", executable.display()); panic!("Something went wrong. {} is not present", executable.display());

View File

@ -1,6 +1,6 @@
use crate::core::builder::{Builder, RunConfig, ShouldRun, Step}; use crate::core::builder::{Builder, RunConfig, ShouldRun, Step};
use std::path::{Path, PathBuf};
use crate::utils::exec::BootstrapCommand; use crate::utils::exec::BootstrapCommand;
use std::path::{Path, PathBuf};
#[derive(Debug, Clone, Hash, PartialEq, Eq)] #[derive(Debug, Clone, Hash, PartialEq, Eq)]
pub(crate) struct Vendor { pub(crate) struct Vendor {

View File

@ -575,7 +575,7 @@ pub(crate) fn update_submodule(&self, relative_path: &Path) {
}; };
// NOTE: doesn't use `try_run` because this shouldn't print an error if it fails. // 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()) { 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). // Save any local changes, but avoid running `git stash pop` if there are none (since it will exit with an error).