fix: improve error messages and formatting in build script

This commit is contained in:
Ya-wen, Jeng 2025-08-14 10:54:36 +08:00
parent 55b04c95fa
commit 50d71afbd0

View File

@ -22,11 +22,11 @@ fn main() {
.arg(rapidsnark_script_path.to_str().unwrap())
.spawn();
if let Err(e) = child_process {
panic!("Failed to spawn rapidsnark download: {}", e);
panic!("Failed to spawn rapidsnark download: {e}");
}
let status = child_process.unwrap().wait();
if let Err(e) = status {
panic!("Failed to wait for rapidsnark download: {}", e);
panic!("Failed to wait for rapidsnark download: {e}");
} else if !status.unwrap().success() {
panic!("Failed to wait for rapidsnark download");
}
@ -49,7 +49,7 @@ fn main() {
);
println!("cargo:rustc-link-lib=static=rapidsnark");
println!("cargo:rustc-link-lib={}", cpp_stdlib);
println!("cargo:rustc-link-lib={cpp_stdlib}");
if target.contains("android") {
// pthread is included in libc in android
println!("cargo:rustc-link-lib=c");
@ -83,11 +83,10 @@ fn android() {
let lib_path = sysroot_libs_path.join("libc++_shared.so");
assert!(
lib_path.exists(),
"Error: Source file {:?} does not exist",
lib_path
"Error: Source file {lib_path:?} does not exist"
);
let dest_dir = Path::new(&output_path).join(env::var("CARGO_NDK_ANDROID_TARGET").unwrap());
println!("cargo:rerun-if-changed={}", dest_dir.display());
println!("cargo:rerun-if-changed={dest_dir:?}");
if !dest_dir.exists() {
fs::create_dir_all(&dest_dir).unwrap();
}