This changes the `test` build script so that it does not use the default fingerprinting mechanism in cargo which causes a full scan of the package every time it runs. This build script does not depend on any of the files in the package. This is the recommended approach for writing build scripts.
12 lines
482 B
Rust
12 lines
482 B
Rust
fn main() {
|
|
println!("cargo:rerun-if-changed=build.rs");
|
|
println!("cargo:rustc-check-cfg=cfg(enable_unstable_features)");
|
|
|
|
let rustc = std::env::var("RUSTC").unwrap_or_else(|_| "rustc".into());
|
|
let version = std::process::Command::new(rustc).arg("-vV").output().unwrap();
|
|
let stdout = String::from_utf8(version.stdout).unwrap();
|
|
|
|
if stdout.contains("nightly") || stdout.contains("dev") {
|
|
println!("cargo:rustc-cfg=enable_unstable_features");
|
|
}
|
|
}
|