Skip to content

Commit

Permalink
Only build clang_rt when RUSTBUILD_FORCE_CLANG_BASED_TESTS is set.
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelwoerister committed May 27, 2019
1 parent 48b9896 commit 577ea53
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 19 deletions.
16 changes: 15 additions & 1 deletion src/bootstrap/native.rs
Expand Up @@ -203,8 +203,16 @@ impl Step for Llvm {
cfg.define("LLVM_BUILD_32_BITS", "ON");
}

let mut enabled_llvm_projects = Vec::new();

if util::forcing_clang_based_tests() {
enabled_llvm_projects.push("clang");
enabled_llvm_projects.push("compiler-rt");
}

if want_lldb {
cfg.define("LLVM_ENABLE_PROJECTS", "clang;lldb;compiler-rt");
enabled_llvm_projects.push("clang");
enabled_llvm_projects.push("lldb");
// For the time being, disable code signing.
cfg.define("LLDB_CODESIGN_IDENTITY", "");
cfg.define("LLDB_NO_DEBUGSERVER", "ON");
Expand All @@ -214,6 +222,12 @@ impl Step for Llvm {
cfg.define("LLVM_ENABLE_LIBXML2", "OFF");
}

if enabled_llvm_projects.len() > 0 {
enabled_llvm_projects.sort();
enabled_llvm_projects.dedup();
cfg.define("LLVM_ENABLE_PROJECTS", enabled_llvm_projects.join(";"));
}

if let Some(num_linkers) = builder.config.llvm_link_jobs {
if num_linkers > 0 {
cfg.define("LLVM_PARALLEL_LINK_JOBS", num_linkers.to_string());
Expand Down
21 changes: 3 additions & 18 deletions src/bootstrap/test.rs
Expand Up @@ -1143,24 +1143,9 @@ impl Step for Compiletest {
}
}

if let Some(var) = env::var_os("RUSTBUILD_FORCE_CLANG_BASED_TESTS") {
match &var.to_string_lossy().to_lowercase()[..] {
"1" | "yes" | "on" => {
assert!(builder.config.lldb_enabled,
"RUSTBUILD_FORCE_CLANG_BASED_TESTS needs Clang/LLDB to \
be built.");
let clang_exe = builder.llvm_out(target).join("bin").join("clang");
cmd.arg("--run-clang-based-tests-with").arg(clang_exe);
}
"0" | "no" | "off" => {
// Nothing to do.
}
other => {
// Let's make sure typos don't get unnoticed
panic!("Unrecognized option '{}' set in \
RUSTBUILD_FORCE_CLANG_BASED_TESTS", other);
}
}
if util::forcing_clang_based_tests() {
let clang_exe = builder.llvm_out(target).join("bin").join("clang");
cmd.arg("--run-clang-based-tests-with").arg(clang_exe);
}

// Get paths from cmd args
Expand Down
16 changes: 16 additions & 0 deletions src/bootstrap/util.rs
Expand Up @@ -356,3 +356,19 @@ impl CiEnv {
}
}
}

pub fn forcing_clang_based_tests() -> bool {
if let Some(var) = env::var_os("RUSTBUILD_FORCE_CLANG_BASED_TESTS") {
match &var.to_string_lossy().to_lowercase()[..] {
"1" | "yes" | "on" => true,
"0" | "no" | "off" => false,
other => {
// Let's make sure typos don't go unnoticed
panic!("Unrecognized option '{}' set in \
RUSTBUILD_FORCE_CLANG_BASED_TESTS", other)
}
}
} else {
false
}
}

0 comments on commit 577ea53

Please sign in to comment.