mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 06:44:35 +00:00
rustbuild: Add option for enabling partial LLVM rebuilds
This commit is contained in:
parent
f84a517483
commit
9b8b3b2b03
@ -144,10 +144,10 @@ on_failure:
|
||||
- cat %CD%/sccache.log
|
||||
|
||||
cache:
|
||||
- "build/i686-pc-windows-msvc/llvm -> src/rustllvm/llvm-auto-clean-trigger"
|
||||
- "build/x86_64-pc-windows-msvc/llvm -> src/rustllvm/llvm-auto-clean-trigger"
|
||||
- "i686-pc-windows-msvc/llvm -> src/rustllvm/llvm-auto-clean-trigger"
|
||||
- "x86_64-pc-windows-msvc/llvm -> src/rustllvm/llvm-auto-clean-trigger"
|
||||
- "build/i686-pc-windows-msvc/llvm -> src/rustllvm/llvm-rebuild-trigger"
|
||||
- "build/x86_64-pc-windows-msvc/llvm -> src/rustllvm/llvm-rebuild-trigger"
|
||||
- "i686-pc-windows-msvc/llvm -> src/rustllvm/llvm-rebuild-trigger"
|
||||
- "x86_64-pc-windows-msvc/llvm -> src/rustllvm/llvm-rebuild-trigger"
|
||||
|
||||
branches:
|
||||
only:
|
||||
|
@ -60,6 +60,7 @@ pub struct Config {
|
||||
pub llvm_link_shared: bool,
|
||||
pub llvm_targets: Option<String>,
|
||||
pub llvm_link_jobs: Option<u32>,
|
||||
pub llvm_clean_rebuild: bool,
|
||||
|
||||
// rust codegen options
|
||||
pub rust_optimize: bool,
|
||||
@ -181,6 +182,7 @@ struct Llvm {
|
||||
static_libstdcpp: Option<bool>,
|
||||
targets: Option<String>,
|
||||
link_jobs: Option<u32>,
|
||||
clean_rebuild: Option<bool>,
|
||||
}
|
||||
|
||||
#[derive(RustcDecodable, Default, Clone)]
|
||||
@ -241,6 +243,7 @@ impl Config {
|
||||
pub fn parse(build: &str, file: Option<PathBuf>) -> Config {
|
||||
let mut config = Config::default();
|
||||
config.llvm_optimize = true;
|
||||
config.llvm_clean_rebuild = true;
|
||||
config.use_jemalloc = true;
|
||||
config.backtrace = true;
|
||||
config.rust_optimize = true;
|
||||
@ -334,6 +337,7 @@ impl Config {
|
||||
set(&mut config.llvm_release_debuginfo, llvm.release_debuginfo);
|
||||
set(&mut config.llvm_version_check, llvm.version_check);
|
||||
set(&mut config.llvm_static_stdcpp, llvm.static_libstdcpp);
|
||||
set(&mut config.llvm_clean_rebuild, llvm.clean_rebuild);
|
||||
config.llvm_targets = llvm.targets.clone();
|
||||
config.llvm_link_jobs = llvm.link_jobs;
|
||||
}
|
||||
|
@ -61,6 +61,13 @@
|
||||
# controlled by rustbuild's -j parameter.
|
||||
#link-jobs = 0
|
||||
|
||||
# Delete LLVM build directory on LLVM rebuild.
|
||||
# This option's default (`true`) is optimized for CI needs, and CI wants to
|
||||
# perform clean full builds only (possibly accelerated by (s)ccache).
|
||||
# You may want to override this option for local builds to enable partial LLVM
|
||||
# rebuilds.
|
||||
#clean-rebuild = true
|
||||
|
||||
# =============================================================================
|
||||
# General build configuration options
|
||||
# =============================================================================
|
||||
|
@ -41,9 +41,9 @@ pub fn llvm(build: &Build, target: &str) {
|
||||
}
|
||||
}
|
||||
|
||||
let clean_trigger = build.src.join("src/rustllvm/llvm-auto-clean-trigger");
|
||||
let mut clean_trigger_contents = String::new();
|
||||
t!(t!(File::open(&clean_trigger)).read_to_string(&mut clean_trigger_contents));
|
||||
let rebuild_trigger = build.src.join("src/rustllvm/llvm-rebuild-trigger");
|
||||
let mut rebuild_trigger_contents = String::new();
|
||||
t!(t!(File::open(&rebuild_trigger)).read_to_string(&mut rebuild_trigger_contents));
|
||||
|
||||
let out_dir = build.llvm_out(target);
|
||||
let done_stamp = out_dir.join("llvm-finished-building");
|
||||
@ -51,18 +51,15 @@ pub fn llvm(build: &Build, target: &str) {
|
||||
let mut done_contents = String::new();
|
||||
t!(t!(File::open(&done_stamp)).read_to_string(&mut done_contents));
|
||||
|
||||
// LLVM was already built previously.
|
||||
// We don't track changes in LLVM sources, so we need to choose between reusing
|
||||
// what was built previously, or cleaning the directory and doing a fresh build.
|
||||
// The choice depends on contents of the clean-trigger file.
|
||||
// If the contents are the same as during the previous build, then no action is required.
|
||||
// If the contents differ from the previous build, then cleaning is triggered.
|
||||
if done_contents == clean_trigger_contents {
|
||||
// If LLVM was already built previously and contents of the rebuild-trigger file
|
||||
// didn't change from the previous build, then no action is required.
|
||||
if done_contents == rebuild_trigger_contents {
|
||||
return
|
||||
} else {
|
||||
t!(fs::remove_dir_all(&out_dir));
|
||||
}
|
||||
}
|
||||
if build.config.llvm_clean_rebuild {
|
||||
t!(fs::remove_dir_all(&out_dir));
|
||||
}
|
||||
|
||||
println!("Building LLVM for {}", target);
|
||||
let _time = util::timeit();
|
||||
@ -154,7 +151,7 @@ pub fn llvm(build: &Build, target: &str) {
|
||||
// tools and libs on all platforms.
|
||||
cfg.build();
|
||||
|
||||
t!(t!(File::create(&done_stamp)).write_all(clean_trigger_contents.as_bytes()));
|
||||
t!(t!(File::create(&done_stamp)).write_all(rebuild_trigger_contents.as_bytes()));
|
||||
}
|
||||
|
||||
fn check_llvm_version(build: &Build, llvm_config: &Path) {
|
||||
|
@ -1,4 +1,4 @@
|
||||
# If this file is modified, then llvm will be forcibly cleaned and then rebuilt.
|
||||
# If this file is modified, then llvm will be (optionally) cleaned and then rebuilt.
|
||||
# The actual contents of this file do not matter, but to trigger a change on the
|
||||
# build bots then the contents should be changed so git updates the mtime.
|
||||
2017-03-04
|
Loading…
Reference in New Issue
Block a user