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