diff options
| author | Mark Simulacrum <mark.simulacrum@gmail.com> | 2017-08-10 10:12:35 +0500 |
|---|---|---|
| committer | Mark Simulacrum <mark.simulacrum@gmail.com> | 2017-08-13 05:15:43 +0500 |
| commit | cec68167fd3787500194f261e2fcbb14381cd317 (patch) | |
| tree | d4cf4fb467870d1e0917b5cadc92ba7e8a06c602 /src/bootstrap | |
| parent | facf5a91c458958de1c11cb9c28e14671af9b6fd (diff) | |
| download | rust-cec68167fd3787500194f261e2fcbb14381cd317.tar.gz rust-cec68167fd3787500194f261e2fcbb14381cd317.zip | |
Clean tools after building libstd/libtest/librustc.
This fixes the bug we previously had where we'd build a libtest tool
after building a libstd tool and clear out the libstd tool. Since we
clear out all tools for a given stage on invocations of CleanTools after
lib{std, test, rustc} change, we need to make sure that all tools built
with that stage will be built after the clearing is done.
The fix contained here technically isn't perfect; there is still an edge
case of compiling a libstd tool, then compiling libtest, which will
clear out the libstd tool and it won't ever get rebuilt within that
session of rustbuild. This is where the caching system used today shows
it's problems -- in effect, all tools depend on a global counter of the
stage being cleared out. We can implement such a counter in a future
patch to ensure that tools are rebuilt as needed, but it is deemed
unlikely that it will be required in practice, since most if not all
tools are built after the relevant stage's std/test/rustc are built,
though this is only an opinion and hasn't been verified.
Diffstat (limited to 'src/bootstrap')
| -rw-r--r-- | src/bootstrap/compile.rs | 17 | ||||
| -rw-r--r-- | src/bootstrap/tool.rs | 10 |
2 files changed, 21 insertions, 6 deletions
diff --git a/src/bootstrap/compile.rs b/src/bootstrap/compile.rs index a6702300c81..33c3638a894 100644 --- a/src/bootstrap/compile.rs +++ b/src/bootstrap/compile.rs @@ -32,6 +32,7 @@ use serde_json; use util::{exe, libdir, is_dylib, copy}; use {Build, Compiler, Mode}; use native; +use tool; use cache::{INTERNER, Interned}; use builder::{Step, RunConfig, ShouldRun, Builder}; @@ -198,6 +199,12 @@ impl Step for StdLink { // for reason why the sanitizers are not built in stage0. copy_apple_sanitizer_dylibs(&build.native_dir(target), "osx", &libdir); } + + builder.ensure(tool::CleanTools { + compiler: target_compiler, + target: target, + mode: Mode::Libstd, + }); } } @@ -389,6 +396,11 @@ impl Step for TestLink { target); add_to_sysroot(&builder.sysroot_libdir(target_compiler, target), &libtest_stamp(build, compiler, target)); + builder.ensure(tool::CleanTools { + compiler: target_compiler, + target: target, + mode: Mode::Libtest, + }); } } @@ -567,6 +579,11 @@ impl Step for RustcLink { target); add_to_sysroot(&builder.sysroot_libdir(target_compiler, target), &librustc_stamp(build, compiler, target)); + builder.ensure(tool::CleanTools { + compiler: target_compiler, + target: target, + mode: Mode::Librustc, + }); } } diff --git a/src/bootstrap/tool.rs b/src/bootstrap/tool.rs index 89b1b113797..7ccd527b338 100644 --- a/src/bootstrap/tool.rs +++ b/src/bootstrap/tool.rs @@ -23,10 +23,10 @@ use channel::GitInfo; use cache::Interned; #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] -struct CleanTools { - compiler: Compiler, - target: Interned<String>, - mode: Mode, +pub struct CleanTools { + pub compiler: Compiler, + pub target: Interned<String>, + pub mode: Mode, } impl Step for CleanTools { @@ -82,7 +82,6 @@ impl Step for ToolBuild { let target = self.target; let tool = self.tool; - builder.ensure(CleanTools { compiler, target, mode: self.mode }); match self.mode { Mode::Libstd => builder.ensure(compile::Std { compiler, target }), Mode::Libtest => builder.ensure(compile::Test { compiler, target }), @@ -271,7 +270,6 @@ impl Step for Rustdoc { builder.compiler(target_compiler.stage - 1, builder.build.build) }; - builder.ensure(CleanTools { compiler: build_compiler, target, mode: Mode::Librustc }); builder.ensure(compile::Rustc { compiler: build_compiler, target }); let _folder = build.fold_output(|| format!("stage{}-rustdoc", target_compiler.stage)); |
