remove struct CleanTools

This commit is contained in:
Collins Abitekaniza 2018-07-13 16:53:29 +03:00 committed by Mark Rousskov
parent de3ec8dd1a
commit e792d1d96a
5 changed files with 22 additions and 53 deletions

View file

@ -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);

View file

@ -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");
}
}

View file

@ -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");
}
}

View file

@ -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)

View file

@ -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<String>,
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,