Skip to content

Commit e962014

Browse files
committed
rust: Output warning so that it is visible without -vv
Using `-vv` with cargo (cargo build -vv) does output the stderr/stdout of build scripts. But printing "cargo::warning" will emit the message without the flags. Since rust 1.77, the syntax `cargo::` is preferred over the old `cargo:`.
1 parent dc77cda commit e962014

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

src/rust/bitbox02/build.rs

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,28 @@ fn main() {
22
#[cfg(feature = "testing")]
33
{
44
if let Ok(cmake_dir) = std::env::var("CMAKE_CURRENT_BINARY_DIR") {
5-
println!("cargo:rustc-link-search={}/../lib", cmake_dir);
5+
println!("cargo::rustc-link-search={}/../lib", cmake_dir);
66
// c and rust code merged :O
7-
println!("cargo:rustc-link-lib=bitbox_merged");
7+
println!("cargo::rustc-link-lib=bitbox_merged");
88
println!(
9-
"cargo:rerun-if-changed={}/../lib/libbitbox_merged.a",
9+
"cargo::rerun-if-changed={}/../lib/libbitbox_merged.a",
1010
cmake_dir
1111
);
12+
println!("cargo::rerun-if-changed=build.rs");
1213

1314
// external libs
14-
println!("cargo:rustc-link-lib=wallycore");
15-
println!("cargo:rustc-link-lib=secp256k1");
16-
println!("cargo:rustc-link-lib=ctaes");
17-
println!("cargo:rustc-link-lib=fatfs");
18-
println!("cargo:rustc-link-lib=sd-mock");
15+
println!("cargo::rustc-link-lib=wallycore");
16+
println!("cargo::rustc-link-lib=secp256k1");
17+
println!("cargo::rustc-link-lib=ctaes");
18+
println!("cargo::rustc-link-lib=fatfs");
19+
println!("cargo::rustc-link-lib=sd-mock");
1920

2021
// system libs
21-
println!("cargo:rustc-link-lib=cmocka");
22+
println!("cargo::rustc-link-lib=cmocka");
2223
} else {
2324
// This is useful in case project is built by tool that doesn't need to link the final
2425
// target, like rust-analyzer and clippy.
25-
eprintln!("Missing env variable CMAKE_CURRENT_BINARY_DIR, linking will fail");
26+
println!("cargo::warning=Missing env variable CMAKE_CURRENT_BINARY_DIR, linking will fail");
2627
}
2728
}
2829
}

0 commit comments

Comments
 (0)