Skip to content

Commit 1372e1a

Browse files
committed
Use cargo:warning for warnings
1 parent ac461ae commit 1372e1a

File tree

1 file changed

+16
-11
lines changed

1 file changed

+16
-11
lines changed

boring-sys/build/main.rs

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -318,8 +318,8 @@ fn get_boringssl_cmake_config(config: &Config) -> cmake::Config {
318318
);
319319
}
320320
_ => {
321-
eprintln!(
322-
"warning: no toolchain file configured by boring-sys for {}",
321+
println!(
322+
"cargo:warning=no toolchain file configured by boring-sys for {}",
323323
config.target
324324
);
325325
}
@@ -339,7 +339,7 @@ fn verify_fips_clang_version() -> (&'static str, &'static str) {
339339
let output = match Command::new(tool).arg("--version").output() {
340340
Ok(o) => o,
341341
Err(e) => {
342-
eprintln!("warning: missing {tool}, trying other compilers: {e}");
342+
println!("cargo:warning=missing {tool}, trying other compilers: {e}");
343343
// NOTE: hard-codes that the loop below checks the version
344344
return None;
345345
}
@@ -372,8 +372,8 @@ fn verify_fips_clang_version() -> (&'static str, &'static str) {
372372
"unsupported clang version \"{cc_version}\": FIPS requires clang {REQUIRED_CLANG_VERSION}"
373373
);
374374
} else if !cc_version.is_empty() {
375-
eprintln!(
376-
"warning: FIPS requires clang version {REQUIRED_CLANG_VERSION}, skipping incompatible version \"{cc_version}\""
375+
println!(
376+
"cargo:warning=FIPS requires clang version {REQUIRED_CLANG_VERSION}, skipping incompatible version \"{cc_version}\""
377377
);
378378
}
379379
}
@@ -423,9 +423,9 @@ fn get_extra_clang_args_for_bindgen(config: &Config) -> Vec<String> {
423423
.unwrap();
424424
if !output.status.success() {
425425
if let Some(exit_code) = output.status.code() {
426-
eprintln!("xcrun failed: exit code {exit_code}");
426+
println!("cargo:warning=xcrun failed: exit code {exit_code}");
427427
} else {
428-
eprintln!("xcrun failed: killed");
428+
println!("cargo:warning=xcrun failed: killed");
429429
}
430430
std::io::stderr().write_all(&output.stderr).unwrap();
431431
// Uh... let's try anyway, I guess?
@@ -449,8 +449,8 @@ fn get_extra_clang_args_for_bindgen(config: &Config) -> Vec<String> {
449449
let toolchain = match pick_best_android_ndk_toolchain(&android_sysroot) {
450450
Ok(toolchain) => toolchain,
451451
Err(e) => {
452-
eprintln!(
453-
"warning: failed to find prebuilt Android NDK toolchain for bindgen: {e}"
452+
println!(
453+
"cargo:warning=failed to find prebuilt Android NDK toolchain for bindgen: {e}"
454454
);
455455
// Uh... let's try anyway, I guess?
456456
return params;
@@ -573,8 +573,13 @@ fn built_boring_source_path(config: &Config) -> &PathBuf {
573573

574574
let mut cfg = get_boringssl_cmake_config(config);
575575

576-
if let Ok(threads) = std::thread::available_parallelism() {
577-
cfg.env("CMAKE_BUILD_PARALLEL_LEVEL", threads.to_string());
576+
let num_jobs = std::env::var("NUM_JOBS").ok().or_else(|| {
577+
std::thread::available_parallelism()
578+
.ok()
579+
.map(|t| t.to_string())
580+
});
581+
if let Some(num_jobs) = num_jobs {
582+
cfg.env("CMAKE_BUILD_PARALLEL_LEVEL", num_jobs);
578583
}
579584

580585
if config.features.fips {

0 commit comments

Comments
 (0)