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.
This commit is contained in:
parent
facf5a91c4
commit
cec68167fd
@ -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,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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));
|
||||
|
Loading…
x
Reference in New Issue
Block a user