From e792d1d96a88dbf737675de0682d82b7ddff8984 Mon Sep 17 00:00:00 2001 From: Collins Abitekaniza Date: Fri, 13 Jul 2018 16:53:29 +0300 Subject: [PATCH] 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 03608518da10..13449f0e00f9 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 551538083930..04de97b53156 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 c59247e1fd61..ff6d2b504d26 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 2725abdc3d95..5e4c1786b0d3 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 4cdb3080d8d5..e5299761a159 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,