Migrate cargo_clippy_cmd and cargo_miri_cmd to BootstrapCommand
This commit is contained in:
parent
86b2191460
commit
f7d9543338
3 changed files with 15 additions and 17 deletions
|
|
@ -2077,7 +2077,7 @@ pub fn stream_cargo(
|
|||
tail_args: Vec<String>,
|
||||
cb: &mut dyn FnMut(CargoMessage<'_>),
|
||||
) -> bool {
|
||||
let mut cargo = Command::from(cargo);
|
||||
let mut cargo = BootstrapCommand::from(cargo).command;
|
||||
// Instruct Cargo to give us json messages on stdout, critically leaving
|
||||
// stderr as piped so we can get those pretty colors.
|
||||
let mut message_format = if builder.config.json_output {
|
||||
|
|
|
|||
|
|
@ -158,8 +158,7 @@ impl Step for Miri {
|
|||
// after another --, so this must be at the end.
|
||||
miri.args(builder.config.args());
|
||||
|
||||
let mut miri = Command::from(miri);
|
||||
builder.run(&mut miri);
|
||||
builder.run(miri);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1251,11 +1251,11 @@ impl<'a> Builder<'a> {
|
|||
self.ensure(tool::Rustdoc { compiler })
|
||||
}
|
||||
|
||||
pub fn cargo_clippy_cmd(&self, run_compiler: Compiler) -> Command {
|
||||
pub fn cargo_clippy_cmd(&self, run_compiler: Compiler) -> BootstrapCommand {
|
||||
if run_compiler.stage == 0 {
|
||||
// `ensure(Clippy { stage: 0 })` *builds* clippy with stage0, it doesn't use the beta clippy.
|
||||
let cargo_clippy = self.build.config.download_clippy();
|
||||
let mut cmd = Command::new(cargo_clippy);
|
||||
let mut cmd = BootstrapCommand::new(cargo_clippy);
|
||||
cmd.env("CARGO", &self.initial_cargo);
|
||||
return cmd;
|
||||
}
|
||||
|
|
@ -1274,13 +1274,13 @@ impl<'a> Builder<'a> {
|
|||
let mut dylib_path = helpers::dylib_path();
|
||||
dylib_path.insert(0, self.sysroot(run_compiler).join("lib"));
|
||||
|
||||
let mut cmd = Command::new(cargo_clippy);
|
||||
let mut cmd = BootstrapCommand::new(cargo_clippy);
|
||||
cmd.env(helpers::dylib_path_var(), env::join_paths(&dylib_path).unwrap());
|
||||
cmd.env("CARGO", &self.initial_cargo);
|
||||
cmd
|
||||
}
|
||||
|
||||
pub fn cargo_miri_cmd(&self, run_compiler: Compiler) -> Command {
|
||||
pub fn cargo_miri_cmd(&self, run_compiler: Compiler) -> BootstrapCommand {
|
||||
assert!(run_compiler.stage > 0, "miri can not be invoked at stage 0");
|
||||
let build_compiler = self.compiler(run_compiler.stage - 1, self.build.build);
|
||||
|
||||
|
|
@ -1296,7 +1296,7 @@ impl<'a> Builder<'a> {
|
|||
extra_features: Vec::new(),
|
||||
});
|
||||
// Invoke cargo-miri, make sure it can find miri and cargo.
|
||||
let mut cmd = Command::new(cargo_miri);
|
||||
let mut cmd = BootstrapCommand::new(cargo_miri);
|
||||
cmd.env("MIRI", &miri);
|
||||
cmd.env("CARGO", &self.initial_cargo);
|
||||
// Need to add the `run_compiler` libs. Those are the libs produces *by* `build_compiler`,
|
||||
|
|
@ -1353,7 +1353,7 @@ impl<'a> Builder<'a> {
|
|||
mode: Mode,
|
||||
target: TargetSelection,
|
||||
cmd: &str, // FIXME make this properly typed
|
||||
) -> Command {
|
||||
) -> BootstrapCommand {
|
||||
let mut cargo;
|
||||
if cmd == "clippy" {
|
||||
cargo = self.cargo_clippy_cmd(compiler);
|
||||
|
|
@ -1366,7 +1366,7 @@ impl<'a> Builder<'a> {
|
|||
cargo = self.cargo_miri_cmd(compiler);
|
||||
cargo.arg("miri").arg(subcmd);
|
||||
} else {
|
||||
cargo = Command::new(&self.initial_cargo);
|
||||
cargo = BootstrapCommand::new(&self.initial_cargo);
|
||||
cargo.arg(cmd);
|
||||
}
|
||||
|
||||
|
|
@ -2374,7 +2374,7 @@ impl HostFlags {
|
|||
|
||||
#[derive(Debug)]
|
||||
pub struct Cargo {
|
||||
command: Command,
|
||||
command: BootstrapCommand,
|
||||
compiler: Compiler,
|
||||
target: TargetSelection,
|
||||
rustflags: Rustflags,
|
||||
|
|
@ -2599,8 +2599,8 @@ impl Cargo {
|
|||
}
|
||||
}
|
||||
|
||||
impl From<Cargo> for Command {
|
||||
fn from(mut cargo: Cargo) -> Command {
|
||||
impl From<Cargo> for BootstrapCommand {
|
||||
fn from(mut cargo: Cargo) -> BootstrapCommand {
|
||||
let rustflags = &cargo.rustflags.0;
|
||||
if !rustflags.is_empty() {
|
||||
cargo.command.env("RUSTFLAGS", rustflags);
|
||||
|
|
@ -2619,13 +2619,12 @@ impl From<Cargo> for Command {
|
|||
if !cargo.allow_features.is_empty() {
|
||||
cargo.command.env("RUSTC_ALLOW_FEATURES", cargo.allow_features);
|
||||
}
|
||||
|
||||
cargo.command
|
||||
}
|
||||
}
|
||||
|
||||
impl From<Cargo> for BootstrapCommand {
|
||||
fn from(cargo: Cargo) -> BootstrapCommand {
|
||||
Command::from(cargo).into()
|
||||
impl From<Cargo> for Command {
|
||||
fn from(cargo: Cargo) -> Command {
|
||||
BootstrapCommand::from(cargo).command
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue