Skip to content

Commit

Permalink
remove struct CleanTools
Browse files Browse the repository at this point in the history
  • Loading branch information
collin5 authored and Mark-Simulacrum committed Sep 12, 2018
1 parent de3ec8d commit e792d1d
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 53 deletions.
17 changes: 14 additions & 3 deletions src/bootstrap/builder.rs
Expand Up @@ -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);
Expand All @@ -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);
Expand Down
9 changes: 2 additions & 7 deletions src/bootstrap/check.rs
Expand Up @@ -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;
Expand Down Expand Up @@ -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");
}
}

Expand Down
20 changes: 4 additions & 16 deletions src/bootstrap/compile.rs
Expand Up @@ -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};
Expand Down Expand Up @@ -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");
}
}

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

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

Expand Down
2 changes: 2 additions & 0 deletions src/bootstrap/lib.rs
Expand Up @@ -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,
}
Expand Down Expand Up @@ -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)
Expand Down
27 changes: 0 additions & 27 deletions src/bootstrap/tool.rs
Expand Up @@ -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,
Expand Down

0 comments on commit e792d1d

Please sign in to comment.