From c0af0b0213529437ed60a9df6faa91383eaf7faa Mon Sep 17 00:00:00 2001 From: Collins Abitekaniza Date: Tue, 3 Jul 2018 21:59:32 +0300 Subject: [PATCH 1/8] clear_if_dirty in Builder::cargo with passed mode --- src/bootstrap/builder.rs | 62 ++++++++++++++++++++++++++++++++++++++++ src/bootstrap/check.rs | 10 ------- src/bootstrap/compile.rs | 7 ----- src/bootstrap/doc.rs | 10 ------- src/bootstrap/tool.rs | 27 ++--------------- 5 files changed, 64 insertions(+), 52 deletions(-) diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs index 5c287f25e26bc..8afe162c17c00 100644 --- a/src/bootstrap/builder.rs +++ b/src/bootstrap/builder.rs @@ -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); diff --git a/src/bootstrap/check.rs b/src/bootstrap/check.rs index 20cdfcb3d2981..551538083930c 100644 --- a/src/bootstrap/check.rs +++ b/src/bootstrap/check.rs @@ -40,9 +40,6 @@ impl Step for Std { let target = self.target; let compiler = builder.compiler(0, builder.config.build); - let out_dir = builder.stage_out(compiler, Mode::Std); - builder.clear_if_dirty(&out_dir, &builder.rustc(compiler)); - let mut cargo = builder.cargo(compiler, Mode::Std, target, "check"); std_cargo(builder, &compiler, target, &mut cargo); @@ -88,10 +85,6 @@ impl Step for Rustc { let compiler = builder.compiler(0, builder.config.build); let target = self.target; - let stage_out = builder.stage_out(compiler, Mode::Rustc); - builder.clear_if_dirty(&stage_out, &libstd_stamp(builder, compiler, target)); - builder.clear_if_dirty(&stage_out, &libtest_stamp(builder, compiler, target)); - let mut cargo = builder.cargo(compiler, Mode::Rustc, target, "check"); rustc_cargo(builder, &mut cargo); @@ -180,9 +173,6 @@ impl Step for Test { let compiler = builder.compiler(0, builder.config.build); let target = self.target; - let out_dir = builder.stage_out(compiler, Mode::Test); - builder.clear_if_dirty(&out_dir, &libstd_stamp(builder, compiler, target)); - let mut cargo = builder.cargo(compiler, Mode::Test, target, "check"); test_cargo(builder, &compiler, target, &mut cargo); diff --git a/src/bootstrap/compile.rs b/src/bootstrap/compile.rs index da0ccf5e1773d..c59247e1fd610 100644 --- a/src/bootstrap/compile.rs +++ b/src/bootstrap/compile.rs @@ -107,8 +107,6 @@ impl Step for Std { copy_musl_third_party_objects(builder, target, &libdir); } - let out_dir = builder.cargo_out(compiler, Mode::Std, target); - builder.clear_if_dirty(&out_dir, &builder.rustc(compiler)); let mut cargo = builder.cargo(compiler, Mode::Std, target, "build"); std_cargo(builder, &compiler, target, &mut cargo); @@ -387,8 +385,6 @@ impl Step for Test { return; } - let out_dir = builder.cargo_out(compiler, Mode::Test, target); - builder.clear_if_dirty(&out_dir, &libstd_stamp(builder, compiler, target)); let mut cargo = builder.cargo(compiler, Mode::Test, target, "build"); test_cargo(builder, &compiler, target, &mut cargo); @@ -519,9 +515,6 @@ impl Step for Rustc { compiler: builder.compiler(self.compiler.stage, builder.config.build), target: builder.config.build, }); - let cargo_out = builder.cargo_out(compiler, Mode::Rustc, target); - builder.clear_if_dirty(&cargo_out, &libstd_stamp(builder, compiler, target)); - builder.clear_if_dirty(&cargo_out, &libtest_stamp(builder, compiler, target)); let mut cargo = builder.cargo(compiler, Mode::Rustc, target, "build"); rustc_cargo(builder, &mut cargo); diff --git a/src/bootstrap/doc.rs b/src/bootstrap/doc.rs index 9a5d78e58ea3f..17ccb04a7146d 100644 --- a/src/bootstrap/doc.rs +++ b/src/bootstrap/doc.rs @@ -455,7 +455,6 @@ impl Step for Std { let out = builder.doc_out(target); t!(fs::create_dir_all(&out)); let compiler = builder.compiler(stage, builder.config.build); - let rustdoc = builder.rustdoc(compiler.host); let compiler = if builder.force_use_stage1(compiler, target) { builder.compiler(1, compiler.host) } else { @@ -480,7 +479,6 @@ impl Step for Std { // This way rustdoc generates output directly into the output, and rustdoc // will also directly handle merging. let my_out = builder.crate_doc_out(target); - builder.clear_if_dirty(&my_out, &rustdoc); t!(symlink_dir_force(&builder.config, &my_out, &out_dir)); let mut cargo = builder.cargo(compiler, Mode::Std, target, "doc"); @@ -535,7 +533,6 @@ impl Step for Test { let out = builder.doc_out(target); t!(fs::create_dir_all(&out)); let compiler = builder.compiler(stage, builder.config.build); - let rustdoc = builder.rustdoc(compiler.host); let compiler = if builder.force_use_stage1(compiler, target) { builder.compiler(1, compiler.host) } else { @@ -551,7 +548,6 @@ impl Step for Test { // See docs in std above for why we symlink let my_out = builder.crate_doc_out(target); - builder.clear_if_dirty(&my_out, &rustdoc); t!(symlink_dir_force(&builder.config, &my_out, &out_dir)); let mut cargo = builder.cargo(compiler, Mode::Test, target, "doc"); @@ -603,7 +599,6 @@ impl Step for WhitelistedRustc { let out = builder.doc_out(target); t!(fs::create_dir_all(&out)); let compiler = builder.compiler(stage, builder.config.build); - let rustdoc = builder.rustdoc(compiler.host); let compiler = if builder.force_use_stage1(compiler, target) { builder.compiler(1, compiler.host) } else { @@ -619,7 +614,6 @@ impl Step for WhitelistedRustc { // See docs in std above for why we symlink let my_out = builder.crate_doc_out(target); - builder.clear_if_dirty(&my_out, &rustdoc); t!(symlink_dir_force(&builder.config, &my_out, &out_dir)); let mut cargo = builder.cargo(compiler, Mode::Rustc, target, "doc"); @@ -678,7 +672,6 @@ impl Step for Rustc { // Get the correct compiler for this stage. let compiler = builder.compiler(stage, builder.config.build); - let rustdoc = builder.rustdoc(compiler.host); let compiler = if builder.force_use_stage1(compiler, target) { builder.compiler(1, compiler.host) } else { @@ -699,7 +692,6 @@ impl Step for Rustc { // We do not symlink to the same shared folder that already contains std library // documentation from previous steps as we do not want to include that. let out_dir = builder.stage_out(compiler, Mode::Rustc).join(target).join("doc"); - builder.clear_if_dirty(&out, &rustdoc); t!(symlink_dir_force(&builder.config, &out, &out_dir)); // Build cargo command. @@ -780,7 +772,6 @@ impl Step for Rustdoc { // Get the correct compiler for this stage. let compiler = builder.compiler(stage, builder.config.build); - let rustdoc = builder.rustdoc(compiler.host); let compiler = if builder.force_use_stage1(compiler, target) { builder.compiler(1, compiler.host) } else { @@ -803,7 +794,6 @@ impl Step for Rustdoc { .join(target) .join("doc"); t!(fs::create_dir_all(&out_dir)); - builder.clear_if_dirty(&out, &rustdoc); t!(symlink_dir_force(&builder.config, &out, &out_dir)); // Build cargo command. diff --git a/src/bootstrap/tool.rs b/src/bootstrap/tool.rs index 04aaa97065473..4cdb3080d8d5b 100644 --- a/src/bootstrap/tool.rs +++ b/src/bootstrap/tool.rs @@ -19,7 +19,7 @@ use Mode; use Compiler; use builder::{Step, RunConfig, ShouldRun, Builder}; use util::{exe, add_lib_path}; -use compile::{self, libtest_stamp, libstd_stamp, librustc_stamp}; +use compile; use native; use channel::GitInfo; use cache::Interned; @@ -39,33 +39,10 @@ impl Step for CleanTools { run.never() } - fn run(self, builder: &Builder) { - let compiler = self.compiler; - let target = self.target; + fn run(self, _builder: &Builder) { let cause = self.cause; - // 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 tools_dir = builder.stage_out(compiler, Mode::ToolRustc); - let compiler = if builder.force_use_stage1(compiler, target) { - builder.compiler(1, compiler.host) - } else { - compiler - }; - for &cur_mode in &[Mode::Std, Mode::Test, Mode::Rustc] { - let stamp = match cur_mode { - Mode::Std => libstd_stamp(builder, compiler, target), - Mode::Test => libtest_stamp(builder, compiler, target), - Mode::Rustc => librustc_stamp(builder, compiler, target), - _ => panic!(), - }; - - if builder.clear_if_dirty(&tools_dir, &stamp) { - break; - } - // If we are a rustc tool, and std changed, we also need to clear ourselves out -- our // dependencies depend on std. Therefore, we iterate up until our own mode. if cause == cur_mode { From c22c7098ca94a629ee3460daaeb338b55f54fb36 Mon Sep 17 00:00:00 2001 From: Collins Abitekaniza Date: Fri, 6 Jul 2018 22:56:13 +0300 Subject: [PATCH 2/8] use stage 1 compiler only for stamps --- src/bootstrap/builder.rs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs index 8afe162c17c00..ab0d9a0664149 100644 --- a/src/bootstrap/builder.rs +++ b/src/bootstrap/builder.rs @@ -721,29 +721,29 @@ impl<'a> Builder<'a> { // 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) { + let cmp = 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), + "check" => check::libstd_stamp(self, cmp, target), + _ => compile::libstd_stamp(self, cmp, target), }; let libtest_stamp = match cmd { - "check" => check::libtest_stamp(self, compiler, target), - _ => compile::libstd_stamp(self, compiler, target), + "check" => check::libtest_stamp(self, cmp, target), + _ => compile::libstd_stamp(self, cmp, target), }; let librustc_stamp = match cmd { - "check" => check::librustc_stamp(self, compiler, target), - _ => compile::librustc_stamp(self, compiler, target), + "check" => check::librustc_stamp(self, cmp, target), + _ => compile::librustc_stamp(self, cmp, target), }; if cmd == "doc" { - if mode == Mode::Rustc || mode == Mode::ToolRustc { + if mode == Mode::Rustc || mode == Mode::ToolRustc || mode == Mode::Codegen { // This is the intended out directory for compiler documentation. my_out = self.compiler_doc_out(target); } From 86e34cdd1b548c4a0f938fa3cb89f0db38f6b6fa Mon Sep 17 00:00:00 2001 From: Collins Abitekaniza Date: Tue, 10 Jul 2018 22:23:20 +0300 Subject: [PATCH 3/8] clear_if_dirty with self.rustc(compiler) for Mode::Rustc --- src/bootstrap/builder.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs index ab0d9a0664149..dc27fd56fb0af 100644 --- a/src/bootstrap/builder.rs +++ b/src/bootstrap/builder.rs @@ -755,6 +755,7 @@ impl<'a> Builder<'a> { self.clear_if_dirty(&my_out, &self.rustc(compiler)); }, Mode::Rustc => { + self.clear_if_dirty(&my_out, &self.rustc(compiler)); self.clear_if_dirty(&my_out, &libstd_stamp); self.clear_if_dirty(&my_out, &libtest_stamp); }, From de3ec8dd1a2c0fbc09b025e7d7276f91f72420d9 Mon Sep 17 00:00:00 2001 From: Collins Abitekaniza Date: Tue, 10 Jul 2018 22:37:30 +0300 Subject: [PATCH 4/8] nit: rearrange and make match exhaustive also indicate difference between out_dir and my_out --- src/bootstrap/builder.rs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs index dc27fd56fb0af..03608518da108 100644 --- a/src/bootstrap/builder.rs +++ b/src/bootstrap/builder.rs @@ -709,6 +709,7 @@ impl<'a> Builder<'a> { let mut cargo = Command::new(&self.initial_cargo); let out_dir = self.stage_out(compiler, mode); + // command specific path, we call clear_if_dirty with this let mut my_out = match cmd { "build" => self.cargo_out(compiler, mode, target), @@ -754,20 +755,22 @@ impl<'a> Builder<'a> { Mode::Std => { self.clear_if_dirty(&my_out, &self.rustc(compiler)); }, + Mode::Test => { + self.clear_if_dirty(&my_out, &libstd_stamp); + }, Mode::Rustc => { self.clear_if_dirty(&my_out, &self.rustc(compiler)); 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::Codegen => { }, + Mode::ToolStd => { }, + Mode::ToolTest => { }, 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); - } - _ => { } + }, } } From e792d1d96a88dbf737675de0682d82b7ddff8984 Mon Sep 17 00:00:00 2001 From: Collins Abitekaniza Date: Fri, 13 Jul 2018 16:53:29 +0300 Subject: [PATCH 5/8] remove struct CleanTools --- src/bootstrap/builder.rs | 17 ++++++++++++++--- src/bootstrap/check.rs | 9 ++------- src/bootstrap/compile.rs | 20 ++++---------------- src/bootstrap/lib.rs | 2 ++ src/bootstrap/tool.rs | 27 --------------------------- 5 files changed, 22 insertions(+), 53 deletions(-) diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs index 03608518da108..13449f0e00f97 100644 --- a/src/bootstrap/builder.rs +++ b/src/bootstrap/builder.rs @@ -754,6 +754,7 @@ impl<'a> Builder<'a> { match mode { Mode::Std => { self.clear_if_dirty(&my_out, &self.rustc(compiler)); + self.clear_if_dirty(&my_out, &libstd_stamp); }, Mode::Test => { self.clear_if_dirty(&my_out, &libstd_stamp); @@ -763,9 +764,19 @@ impl<'a> Builder<'a> { self.clear_if_dirty(&my_out, &libstd_stamp); self.clear_if_dirty(&my_out, &libtest_stamp); }, - Mode::Codegen => { }, - Mode::ToolStd => { }, - Mode::ToolTest => { }, + Mode::Codegen => { + self.clear_if_dirty(&my_out, &self.rustc(compiler)); + self.clear_if_dirty(&my_out, &libstd_stamp); + self.clear_if_dirty(&my_out, &libtest_stamp); + }, + Mode::ToolBootstrap => { }, + Mode::ToolStd => { + self.clear_if_dirty(&my_out, &libstd_stamp); + }, + Mode::ToolTest => { + self.clear_if_dirty(&my_out, &libstd_stamp); + self.clear_if_dirty(&my_out, &libtest_stamp); + }, Mode::ToolRustc => { self.clear_if_dirty(&my_out, &libstd_stamp); self.clear_if_dirty(&my_out, &libtest_stamp); diff --git a/src/bootstrap/check.rs b/src/bootstrap/check.rs index 551538083930c..04de97b531562 100644 --- a/src/bootstrap/check.rs +++ b/src/bootstrap/check.rs @@ -12,7 +12,7 @@ use compile::{run_cargo, std_cargo, test_cargo, rustc_cargo, rustc_cargo_env, add_to_sysroot}; use builder::{RunConfig, Builder, ShouldRun, Step}; -use tool::{self, prepare_tool_cargo, SourceType}; +use tool::{prepare_tool_cargo, SourceType}; use {Compiler, Mode}; use cache::{INTERNER, Interned}; use std::path::PathBuf; @@ -236,12 +236,7 @@ impl Step for Rustdoc { let libdir = builder.sysroot_libdir(compiler, target); add_to_sysroot(&builder, &libdir, &rustdoc_stamp(builder, compiler, target)); - - builder.ensure(tool::CleanTools { - compiler, - target, - cause: Mode::Rustc, - }); + builder.cargo(compiler, Mode::ToolRustc, target, "clean"); } } diff --git a/src/bootstrap/compile.rs b/src/bootstrap/compile.rs index c59247e1fd610..ff6d2b504d265 100644 --- a/src/bootstrap/compile.rs +++ b/src/bootstrap/compile.rs @@ -32,7 +32,6 @@ use serde_json; use util::{exe, libdir, is_dylib, CiEnv}; use {Compiler, Mode}; use native; -use tool; use cache::{INTERNER, Interned}; use builder::{Step, RunConfig, ShouldRun, Builder}; @@ -244,11 +243,7 @@ impl Step for StdLink { copy_apple_sanitizer_dylibs(builder, &builder.native_dir(target), "osx", &libdir); } - builder.ensure(tool::CleanTools { - compiler: target_compiler, - target, - cause: Mode::Std, - }); + builder.cargo(target_compiler, Mode::ToolStd, target, "clean"); } } @@ -444,11 +439,8 @@ impl Step for TestLink { target)); add_to_sysroot(builder, &builder.sysroot_libdir(target_compiler, target), &libtest_stamp(builder, compiler, target)); - builder.ensure(tool::CleanTools { - compiler: target_compiler, - target, - cause: Mode::Test, - }); + + builder.cargo(target_compiler, Mode::ToolTest, target, "clean"); } } @@ -606,11 +598,7 @@ impl Step for RustcLink { target)); add_to_sysroot(builder, &builder.sysroot_libdir(target_compiler, target), &librustc_stamp(builder, compiler, target)); - builder.ensure(tool::CleanTools { - compiler: target_compiler, - target, - cause: Mode::Rustc, - }); + builder.cargo(target_compiler, Mode::ToolRustc, target, "clean"); } } diff --git a/src/bootstrap/lib.rs b/src/bootstrap/lib.rs index 2725abdc3d95f..5e4c1786b0d31 100644 --- a/src/bootstrap/lib.rs +++ b/src/bootstrap/lib.rs @@ -347,6 +347,7 @@ pub enum Mode { /// Compile a tool which uses all libraries we compile (up to rustc). /// Doesn't use the stage0 compiler libraries like "other", and includes /// tools like rustdoc, cargo, rls, etc. + ToolTest, ToolStd, ToolRustc, } @@ -567,6 +568,7 @@ impl Build { Mode::Codegen => "-codegen", Mode::ToolBootstrap => "-bootstrap-tools", Mode::ToolStd => "-tools", + Mode::ToolTest => "-tools", Mode::ToolRustc => "-tools", }; self.out.join(&*compiler.host) diff --git a/src/bootstrap/tool.rs b/src/bootstrap/tool.rs index 4cdb3080d8d5b..e5299761a159f 100644 --- a/src/bootstrap/tool.rs +++ b/src/bootstrap/tool.rs @@ -25,33 +25,6 @@ use channel::GitInfo; use cache::Interned; use toolstate::ToolState; -#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] -pub struct CleanTools { - pub compiler: Compiler, - pub target: Interned, - pub cause: Mode, -} - -impl Step for CleanTools { - type Output = (); - - fn should_run(run: ShouldRun) -> ShouldRun { - run.never() - } - - fn run(self, _builder: &Builder) { - let cause = self.cause; - - for &cur_mode in &[Mode::Std, Mode::Test, Mode::Rustc] { - // If we are a rustc tool, and std changed, we also need to clear ourselves out -- our - // dependencies depend on std. Therefore, we iterate up until our own mode. - if cause == cur_mode { - break; - } - } - } -} - #[derive(Debug, Clone, Hash, PartialEq, Eq)] pub enum SourceType { InTree, From b58589352ee66cfb541cbf88eb493f2ed9a29b00 Mon Sep 17 00:00:00 2001 From: Mark Rousskov Date: Thu, 2 Aug 2018 11:59:27 -0600 Subject: [PATCH 6/8] Do not print checking messages in dry run mode --- src/bootstrap/check.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/bootstrap/check.rs b/src/bootstrap/check.rs index 04de97b531562..6984940b0a6f0 100644 --- a/src/bootstrap/check.rs +++ b/src/bootstrap/check.rs @@ -44,7 +44,7 @@ impl Step for Std { std_cargo(builder, &compiler, target, &mut cargo); let _folder = builder.fold_output(|| format!("stage{}-std", compiler.stage)); - println!("Checking std artifacts ({} -> {})", &compiler.host, target); + builder.info(&format!("Checking std artifacts ({} -> {})", &compiler.host, target)); run_cargo(builder, &mut cargo, vec![], @@ -89,7 +89,7 @@ impl Step for Rustc { rustc_cargo(builder, &mut cargo); let _folder = builder.fold_output(|| format!("stage{}-rustc", compiler.stage)); - println!("Checking compiler artifacts ({} -> {})", &compiler.host, target); + builder.info(&format!("Checking compiler artifacts ({} -> {})", &compiler.host, target)); run_cargo(builder, &mut cargo, vec![], @@ -177,7 +177,7 @@ impl Step for Test { test_cargo(builder, &compiler, target, &mut cargo); let _folder = builder.fold_output(|| format!("stage{}-test", compiler.stage)); - println!("Checking test artifacts ({} -> {})", &compiler.host, target); + builder.info(&format!("Checking test artifacts ({} -> {})", &compiler.host, target)); run_cargo(builder, &mut cargo, vec![], From 9681e13bb236025577c588fdbbadbd6b5c87c451 Mon Sep 17 00:00:00 2001 From: Mark Rousskov Date: Thu, 2 Aug 2018 12:01:04 -0600 Subject: [PATCH 7/8] Add check build dependencies --- src/bootstrap/check.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/bootstrap/check.rs b/src/bootstrap/check.rs index 6984940b0a6f0..11463c1a056ec 100644 --- a/src/bootstrap/check.rs +++ b/src/bootstrap/check.rs @@ -85,6 +85,8 @@ impl Step for Rustc { let compiler = builder.compiler(0, builder.config.build); let target = self.target; + builder.ensure(Test { target }); + let mut cargo = builder.cargo(compiler, Mode::Rustc, target, "check"); rustc_cargo(builder, &mut cargo); @@ -132,8 +134,7 @@ impl Step for CodegenBackend { let target = self.target; let backend = self.backend; - let out_dir = builder.cargo_out(compiler, Mode::Codegen, target); - builder.clear_if_dirty(&out_dir, &librustc_stamp(builder, compiler, target)); + builder.ensure(Rustc { target }); let mut cargo = builder.cargo(compiler, Mode::Codegen, target, "check"); cargo.arg("--manifest-path").arg(builder.src.join("src/librustc_codegen_llvm/Cargo.toml")); @@ -173,6 +174,8 @@ impl Step for Test { let compiler = builder.compiler(0, builder.config.build); let target = self.target; + builder.ensure(Std { target }); + let mut cargo = builder.cargo(compiler, Mode::Test, target, "check"); test_cargo(builder, &compiler, target, &mut cargo); @@ -213,10 +216,7 @@ impl Step for Rustdoc { let compiler = builder.compiler(0, builder.config.build); let target = self.target; - let stage_out = builder.stage_out(compiler, Mode::ToolRustc); - builder.clear_if_dirty(&stage_out, &libstd_stamp(builder, compiler, target)); - builder.clear_if_dirty(&stage_out, &libtest_stamp(builder, compiler, target)); - builder.clear_if_dirty(&stage_out, &librustc_stamp(builder, compiler, target)); + builder.ensure(Rustc { target }); let mut cargo = prepare_tool_cargo(builder, compiler, From 5ae40be85191c365985e9231f5c015fddbadd6c0 Mon Sep 17 00:00:00 2001 From: Collins Abitekaniza Date: Mon, 17 Sep 2018 14:19:44 +0300 Subject: [PATCH 8/8] refactor Builder::cargo, clean deps for cmd!=test --- src/bootstrap/builder.rs | 7 ++----- src/bootstrap/compile.rs | 1 - 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs index 13449f0e00f97..861f47484b96e 100644 --- a/src/bootstrap/builder.rs +++ b/src/bootstrap/builder.rs @@ -750,11 +750,10 @@ impl<'a> Builder<'a> { } let rustdoc = self.rustdoc(compiler.host); self.clear_if_dirty(&my_out, &rustdoc); - } else { + } else if cmd != "test" { match mode { Mode::Std => { self.clear_if_dirty(&my_out, &self.rustc(compiler)); - self.clear_if_dirty(&my_out, &libstd_stamp); }, Mode::Test => { self.clear_if_dirty(&my_out, &libstd_stamp); @@ -765,9 +764,7 @@ impl<'a> Builder<'a> { self.clear_if_dirty(&my_out, &libtest_stamp); }, Mode::Codegen => { - self.clear_if_dirty(&my_out, &self.rustc(compiler)); - self.clear_if_dirty(&my_out, &libstd_stamp); - self.clear_if_dirty(&my_out, &libtest_stamp); + self.clear_if_dirty(&my_out, &librustc_stamp); }, Mode::ToolBootstrap => { }, Mode::ToolStd => { diff --git a/src/bootstrap/compile.rs b/src/bootstrap/compile.rs index ff6d2b504d265..287b03f6c491d 100644 --- a/src/bootstrap/compile.rs +++ b/src/bootstrap/compile.rs @@ -655,7 +655,6 @@ impl Step for CodegenBackend { } let out_dir = builder.cargo_out(compiler, Mode::Codegen, target); - builder.clear_if_dirty(&out_dir, &librustc_stamp(builder, compiler, target)); let mut cargo = builder.cargo(compiler, Mode::Codegen, target, "rustc"); cargo.arg("--manifest-path")