Skip to content

Commit 577ea53

Browse files
Only build clang_rt when RUSTBUILD_FORCE_CLANG_BASED_TESTS is set.
1 parent 48b9896 commit 577ea53

File tree

3 files changed

+34
-19
lines changed

3 files changed

+34
-19
lines changed

src/bootstrap/native.rs

+15-1
Original file line numberDiff line numberDiff line change
@@ -203,8 +203,16 @@ impl Step for Llvm {
203203
cfg.define("LLVM_BUILD_32_BITS", "ON");
204204
}
205205

206+
let mut enabled_llvm_projects = Vec::new();
207+
208+
if util::forcing_clang_based_tests() {
209+
enabled_llvm_projects.push("clang");
210+
enabled_llvm_projects.push("compiler-rt");
211+
}
212+
206213
if want_lldb {
207-
cfg.define("LLVM_ENABLE_PROJECTS", "clang;lldb;compiler-rt");
214+
enabled_llvm_projects.push("clang");
215+
enabled_llvm_projects.push("lldb");
208216
// For the time being, disable code signing.
209217
cfg.define("LLDB_CODESIGN_IDENTITY", "");
210218
cfg.define("LLDB_NO_DEBUGSERVER", "ON");
@@ -214,6 +222,12 @@ impl Step for Llvm {
214222
cfg.define("LLVM_ENABLE_LIBXML2", "OFF");
215223
}
216224

225+
if enabled_llvm_projects.len() > 0 {
226+
enabled_llvm_projects.sort();
227+
enabled_llvm_projects.dedup();
228+
cfg.define("LLVM_ENABLE_PROJECTS", enabled_llvm_projects.join(";"));
229+
}
230+
217231
if let Some(num_linkers) = builder.config.llvm_link_jobs {
218232
if num_linkers > 0 {
219233
cfg.define("LLVM_PARALLEL_LINK_JOBS", num_linkers.to_string());

src/bootstrap/test.rs

+3-18
Original file line numberDiff line numberDiff line change
@@ -1143,24 +1143,9 @@ impl Step for Compiletest {
11431143
}
11441144
}
11451145

1146-
if let Some(var) = env::var_os("RUSTBUILD_FORCE_CLANG_BASED_TESTS") {
1147-
match &var.to_string_lossy().to_lowercase()[..] {
1148-
"1" | "yes" | "on" => {
1149-
assert!(builder.config.lldb_enabled,
1150-
"RUSTBUILD_FORCE_CLANG_BASED_TESTS needs Clang/LLDB to \
1151-
be built.");
1152-
let clang_exe = builder.llvm_out(target).join("bin").join("clang");
1153-
cmd.arg("--run-clang-based-tests-with").arg(clang_exe);
1154-
}
1155-
"0" | "no" | "off" => {
1156-
// Nothing to do.
1157-
}
1158-
other => {
1159-
// Let's make sure typos don't get unnoticed
1160-
panic!("Unrecognized option '{}' set in \
1161-
RUSTBUILD_FORCE_CLANG_BASED_TESTS", other);
1162-
}
1163-
}
1146+
if util::forcing_clang_based_tests() {
1147+
let clang_exe = builder.llvm_out(target).join("bin").join("clang");
1148+
cmd.arg("--run-clang-based-tests-with").arg(clang_exe);
11641149
}
11651150

11661151
// Get paths from cmd args

src/bootstrap/util.rs

+16
Original file line numberDiff line numberDiff line change
@@ -356,3 +356,19 @@ impl CiEnv {
356356
}
357357
}
358358
}
359+
360+
pub fn forcing_clang_based_tests() -> bool {
361+
if let Some(var) = env::var_os("RUSTBUILD_FORCE_CLANG_BASED_TESTS") {
362+
match &var.to_string_lossy().to_lowercase()[..] {
363+
"1" | "yes" | "on" => true,
364+
"0" | "no" | "off" => false,
365+
other => {
366+
// Let's make sure typos don't go unnoticed
367+
panic!("Unrecognized option '{}' set in \
368+
RUSTBUILD_FORCE_CLANG_BASED_TESTS", other)
369+
}
370+
}
371+
} else {
372+
false
373+
}
374+
}

0 commit comments

Comments
 (0)