Migrate a few command usages to BootstrapCommand

This commit is contained in:
Jakub Beránek 2024-06-22 11:27:15 +02:00
parent 8a890cb6cb
commit 83d33c2cf5
No known key found for this signature in database
GPG Key ID: 909CD0D26483516B
6 changed files with 19 additions and 20 deletions

View File

@ -85,7 +85,7 @@ macro_rules! clean_crate_tree {
// NOTE: doesn't use `run_cargo` because we don't want to save a stamp file,
// and doesn't use `stream_cargo` to avoid passing `--message-format` which `clean` doesn't accept.
builder.run(&mut cargo);
builder.run(cargo);
}
}
)+ }

View File

@ -1080,7 +1080,7 @@ impl Step for ErrorIndex {
index.arg(out);
index.arg(&builder.version);
builder.run(&mut index);
builder.run(index);
}
}

View File

@ -465,7 +465,7 @@ impl Miri {
// Tell it where to put the sysroot.
cargo.env("MIRI_SYSROOT", &miri_sysroot);
let mut cargo = Command::from(cargo);
let mut cargo = BootstrapCommand::from(cargo);
let _guard =
builder.msg(Kind::Build, compiler.stage, "miri sysroot", compiler.host, target);
builder.run(&mut cargo);
@ -596,7 +596,7 @@ impl Step for Miri {
target,
);
let _time = helpers::timeit(builder);
builder.run(&mut cargo);
builder.run(cargo);
}
}
}
@ -661,11 +661,11 @@ impl Step for CargoMiri {
// Finally, pass test-args and run everything.
cargo.arg("--").args(builder.config.test_args());
let mut cargo = Command::from(cargo);
let cargo = BootstrapCommand::from(cargo);
{
let _guard = builder.msg_sysroot_tool(Kind::Test, stage, "cargo-miri", host, target);
let _time = helpers::timeit(builder);
builder.run(&mut cargo);
builder.run(cargo);
}
}
}
@ -845,7 +845,7 @@ impl Step for RustdocJSStd {
fn run(self, builder: &Builder<'_>) {
let nodejs =
builder.config.nodejs.as_ref().expect("need nodejs to run rustdoc-js-std tests");
let mut command = Command::new(nodejs);
let mut command = BootstrapCommand::new(nodejs);
command
.arg(builder.src.join("src/tools/rustdoc-js/tester.js"))
.arg("--crate-name")
@ -879,7 +879,7 @@ impl Step for RustdocJSStd {
builder.config.build,
self.target,
);
builder.run(&mut command);
builder.run(command);
}
}
@ -1304,8 +1304,7 @@ impl Step for RunMakeSupport {
&[],
);
let mut cargo = Command::from(cargo);
builder.run(&mut cargo);
builder.run(cargo);
let lib_name = "librun_make_support.rlib";
let lib = builder.tools_dir(self.compiler).join(lib_name);

View File

@ -11,6 +11,7 @@ use std::{
use build_helper::ci::CiEnv;
use xz2::bufread::XzDecoder;
use crate::utils::exec::BootstrapCommand;
use crate::utils::helpers::hex_encode;
use crate::utils::helpers::{check_run, exe, move_file, program_out_of_date};
use crate::{t, Config};
@ -56,7 +57,7 @@ impl Config {
/// Runs a command, printing out nice contextual information if it fails.
/// Returns false if do not execute at all, otherwise returns its
/// `status.success()`.
pub(crate) fn check_run(&self, cmd: &mut Command) -> bool {
pub(crate) fn check_run(&self, cmd: &mut BootstrapCommand) -> bool {
if self.dry_run() {
return true;
}
@ -211,7 +212,7 @@ impl Config {
fn download_http_with_retries(&self, tempfile: &Path, url: &str, help_on_error: &str) {
println!("downloading {url}");
// Try curl. If that fails and we are on windows, fallback to PowerShell.
let mut curl = Command::new("curl");
let mut curl = BootstrapCommand::new("curl");
curl.args([
"-y",
"30",

View File

@ -242,8 +242,9 @@ pub fn is_valid_test_suite_arg<'a, P: AsRef<Path>>(
}
}
pub fn check_run(cmd: &mut Command, print_cmd_on_fail: bool) -> bool {
let status = match cmd.status() {
// FIXME: get rid of this function
pub fn check_run(cmd: &mut BootstrapCommand, print_cmd_on_fail: bool) -> bool {
let status = match cmd.command.status() {
Ok(status) => status,
Err(e) => {
println!("failed to execute command: {cmd:?}\nERROR: {e}");

View File

@ -5,14 +5,12 @@
//! In uplifting, a tarball from Stage N captures essential components
//! to assemble Stage N + 1 compiler.
use std::{
path::{Path, PathBuf},
process::Command,
};
use std::path::{Path, PathBuf};
use crate::core::builder::Builder;
use crate::core::{build_steps::dist::distdir, builder::Kind};
use crate::utils::channel;
use crate::utils::exec::BootstrapCommand;
use crate::utils::helpers::{move_file, t};
#[derive(Copy, Clone)]
@ -300,7 +298,7 @@ impl<'a> Tarball<'a> {
}
}
fn non_bare_args(&self, cmd: &mut Command) {
fn non_bare_args(&self, cmd: &mut BootstrapCommand) {
cmd.arg("--rel-manifest-dir=rustlib")
.arg("--legacy-manifest-dirs=rustlib,cargo")
.arg(format!("--product-name={}", self.product_name))
@ -312,7 +310,7 @@ impl<'a> Tarball<'a> {
.arg(distdir(self.builder));
}
fn run(self, build_cli: impl FnOnce(&Tarball<'a>, &mut Command)) -> GeneratedTarball {
fn run(self, build_cli: impl FnOnce(&Tarball<'a>, &mut BootstrapCommand)) -> GeneratedTarball {
t!(std::fs::create_dir_all(&self.overlay_dir));
self.builder.create(&self.overlay_dir.join("version"), &self.overlay.version(self.builder));
if let Some(info) = self.builder.rust_info().info() {