2019-11-24 17:23:02 -08:00
|
|
|
use std::process::{Command, ExitStatus, Stdio};
|
2019-11-03 20:31:08 +08:00
|
|
|
|
|
|
|
#[cfg(not(windows))]
|
2019-11-24 17:23:02 -08:00
|
|
|
const CARGO_EXPAND: &str = "cargo-expand";
|
2019-11-03 20:31:08 +08:00
|
|
|
|
|
|
|
#[cfg(windows)]
|
2019-11-24 17:23:02 -08:00
|
|
|
const CARGO_EXPAND: &str = "cargo-expand.exe";
|
2019-11-03 20:31:08 +08:00
|
|
|
|
2019-11-24 17:23:02 -08:00
|
|
|
fn main() {
|
|
|
|
if Command::new(CARGO_EXPAND)
|
|
|
|
.arg("--version")
|
|
|
|
.stdin(Stdio::null())
|
|
|
|
.stdout(Stdio::null())
|
|
|
|
.stderr(Stdio::null())
|
|
|
|
.status()
|
|
|
|
.as_ref()
|
|
|
|
.map(ExitStatus::success)
|
|
|
|
.unwrap_or(false)
|
|
|
|
{
|
2019-11-03 20:31:08 +08:00
|
|
|
println!("cargo:rustc-cfg=cargo_expand");
|
|
|
|
}
|
|
|
|
}
|