2019-11-24 19:23:02 -06:00
|
|
|
use std::process::{Command, ExitStatus, Stdio};
|
2019-11-03 06:31:08 -06:00
|
|
|
|
2020-05-05 23:49:21 -05:00
|
|
|
fn has_cargo_expand() -> bool {
|
|
|
|
let cargo_expand = if cfg!(windows) {
|
|
|
|
"cargo-expand.exe"
|
|
|
|
} else {
|
|
|
|
"cargo-expand"
|
|
|
|
};
|
2019-11-03 06:31:08 -06:00
|
|
|
|
2020-05-05 23:49:21 -05:00
|
|
|
Command::new(cargo_expand)
|
2019-11-24 19:23:02 -06:00
|
|
|
.arg("--version")
|
|
|
|
.stdin(Stdio::null())
|
|
|
|
.stdout(Stdio::null())
|
|
|
|
.stderr(Stdio::null())
|
|
|
|
.status()
|
|
|
|
.as_ref()
|
|
|
|
.map(ExitStatus::success)
|
|
|
|
.unwrap_or(false)
|
2020-05-05 23:49:21 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
2022-12-12 16:37:41 -06:00
|
|
|
println!("cargo:rerun-if-changed=build.rs");
|
|
|
|
|
2022-06-20 04:54:50 -05:00
|
|
|
if cfg!(feature = "expandtest") && has_cargo_expand() {
|
2020-05-05 23:49:21 -05:00
|
|
|
println!("cargo:rustc-cfg=expandtest");
|
2019-11-03 06:31:08 -06:00
|
|
|
}
|
|
|
|
}
|