Files
mdrs-client-rust/build.rs
T
2026-04-17 16:52:04 +09:00

18 lines
558 B
Rust

fn main() {
let output = std::process::Command::new("rustc")
.arg("--version")
.output()
.expect("Failed to run rustc --version");
let full = String::from_utf8(output.stdout).unwrap();
// "rustc 1.79.0 (129f3b996 2024-06-10)" → "1.79.0"
let version = full
.trim()
.trim_start_matches("rustc ")
.split_whitespace()
.next()
.unwrap_or("unknown")
.to_string();
println!("cargo:rustc-env=RUSTC_VERSION={}", version);
println!("cargo:rerun-if-changed=build.rs");
}