mirror of
https://github.com/hinto-janai/cuprate.git
synced 2024-11-16 15:58:14 +00:00
add build.rs
for COMMIT
environment variable
This commit is contained in:
parent
76549cf519
commit
7fdd1b71eb
1 changed files with 15 additions and 0 deletions
15
cuprate/build.rs
Normal file
15
cuprate/build.rs
Normal file
|
@ -0,0 +1,15 @@
|
|||
// This sets the git `COMMIT` environment variable.
|
||||
fn main() {
|
||||
println!("cargo:rerun-if-changed=../.git/refs/heads/");
|
||||
|
||||
let output = std::process::Command::new("git")
|
||||
.arg("rev-parse")
|
||||
.arg("HEAD")
|
||||
.output()
|
||||
.unwrap();
|
||||
|
||||
let commit = String::from_utf8(output.stdout).unwrap();
|
||||
assert!(commit.len() >= 40);
|
||||
|
||||
println!("cargo:rustc-env=COMMIT={commit}");
|
||||
}
|
Loading…
Reference in a new issue