microsoft/qdk
Publicmirrored fromhttps://github.com/microsoft/qdkAvailable
compiler/qsc/build.rs
17lines · modecode
| 1 | // Copyright (c) Microsoft Corporation. |
| 2 | // Licensed under the MIT License. |
| 3 | |
| 4 | #![warn(clippy::mod_module_files, clippy::pedantic, clippy::unwrap_used)] |
| 5 | |
| 6 | use std::process::Command; |
| 7 | |
| 8 | fn main() { |
| 9 | let git_hash = Command::new("git") |
| 10 | .args(["rev-parse", "--short=8", "HEAD"]) |
| 11 | .output() |
| 12 | .map_or_else( |
| 13 | |_| "unknown".to_string(), |
| 14 | |o| String::from_utf8(o.stdout).expect("output should be parsable string"), |
| 15 | ); |
| 16 | println!("cargo:rustc-env=QSHARP_GIT_HASH={git_hash}"); |
| 17 | } |