clear_if_dirty in Builder::cargo with passed mode
This commit is contained in:
committed by
Mark Rousskov
parent
6810f5286b
commit
c0af0b0213
@@ -708,6 +708,68 @@ impl<'a> Builder<'a> {
|
||||
) -> Command {
|
||||
let mut cargo = Command::new(&self.initial_cargo);
|
||||
let out_dir = self.stage_out(compiler, mode);
|
||||
|
||||
let mut my_out = match cmd {
|
||||
"build" => self.cargo_out(compiler, mode, target),
|
||||
|
||||
// This is the intended out directory for crate documentation.
|
||||
"doc" => self.crate_doc_out(target),
|
||||
|
||||
_ => self.stage_out(compiler, mode),
|
||||
};
|
||||
|
||||
// This is for the original compiler, but if we're forced to use stage 1, then
|
||||
// std/test/rustc stamps won't exist in stage 2, so we need to get those from stage 1, since
|
||||
// we copy the libs forward.
|
||||
let compiler = if self.force_use_stage1(compiler, target) {
|
||||
self.compiler(1, compiler.host)
|
||||
} else {
|
||||
compiler
|
||||
};
|
||||
|
||||
let libstd_stamp = match cmd {
|
||||
"check" => check::libstd_stamp(self, compiler, target),
|
||||
_ => compile::libstd_stamp(self, compiler, target),
|
||||
};
|
||||
|
||||
let libtest_stamp = match cmd {
|
||||
"check" => check::libtest_stamp(self, compiler, target),
|
||||
_ => compile::libstd_stamp(self, compiler, target),
|
||||
};
|
||||
|
||||
let librustc_stamp = match cmd {
|
||||
"check" => check::librustc_stamp(self, compiler, target),
|
||||
_ => compile::librustc_stamp(self, compiler, target),
|
||||
};
|
||||
|
||||
if cmd == "doc" {
|
||||
if mode == Mode::Rustc || mode == Mode::ToolRustc {
|
||||
// This is the intended out directory for compiler documentation.
|
||||
my_out = self.compiler_doc_out(target);
|
||||
}
|
||||
let rustdoc = self.rustdoc(compiler.host);
|
||||
self.clear_if_dirty(&my_out, &rustdoc);
|
||||
} else {
|
||||
match mode {
|
||||
Mode::Std => {
|
||||
self.clear_if_dirty(&my_out, &self.rustc(compiler));
|
||||
},
|
||||
Mode::Rustc => {
|
||||
self.clear_if_dirty(&my_out, &libstd_stamp);
|
||||
self.clear_if_dirty(&my_out, &libtest_stamp);
|
||||
},
|
||||
Mode::Test => {
|
||||
self.clear_if_dirty(&my_out, &libstd_stamp);
|
||||
},
|
||||
Mode::ToolRustc => {
|
||||
self.clear_if_dirty(&my_out, &libstd_stamp);
|
||||
self.clear_if_dirty(&my_out, &libtest_stamp);
|
||||
self.clear_if_dirty(&my_out, &librustc_stamp);
|
||||
}
|
||||
_ => { }
|
||||
}
|
||||
}
|
||||
|
||||
cargo
|
||||
.env("CARGO_TARGET_DIR", out_dir)
|
||||
.arg(cmd);
|
||||
|
||||
Reference in New Issue
Block a user