diff --git a/src/bootstrap/native.rs b/src/bootstrap/native.rs index b89cd4981a721..bf3601cb312fd 100644 --- a/src/bootstrap/native.rs +++ b/src/bootstrap/native.rs @@ -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"); @@ -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()); diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs index 05b3ce6bc8964..9d0aa09f15cfb 100644 --- a/src/bootstrap/test.rs +++ b/src/bootstrap/test.rs @@ -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 diff --git a/src/bootstrap/util.rs b/src/bootstrap/util.rs index f22f0559265b1..9f684678bb060 100644 --- a/src/bootstrap/util.rs +++ b/src/bootstrap/util.rs @@ -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 + } +}