2022-07-21 11:37:41 +00:00
|
|
|
//! Determine rustc version `proc-macro-srv` (and thus the sysroot ABI) is
|
|
|
|
//! build with and make it accessible at runtime for ABI selection.
|
|
|
|
|
2024-06-30 13:37:00 +00:00
|
|
|
use std::{env, process::Command};
|
2022-07-21 11:13:24 +00:00
|
|
|
|
|
|
|
fn main() {
|
2024-06-30 13:28:31 +00:00
|
|
|
println!("cargo::rustc-check-cfg=cfg(rust_analyzer)");
|
2022-07-21 11:13:24 +00:00
|
|
|
|
|
|
|
let rustc = env::var("RUSTC").expect("proc-macro-srv's build script expects RUSTC to be set");
|
|
|
|
let output = Command::new(rustc).arg("--version").output().expect("rustc --version must run");
|
|
|
|
let version_string = std::str::from_utf8(&output.stdout[..])
|
|
|
|
.expect("rustc --version output must be UTF-8")
|
|
|
|
.trim();
|
2024-06-30 13:28:31 +00:00
|
|
|
println!("cargo::rustc-env=RUSTC_VERSION={}", version_string);
|
2022-07-21 11:13:24 +00:00
|
|
|
}
|