forked from RedisJSON/RedisJSON
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.rs
26 lines (24 loc) · 811 Bytes
/
build.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
/*
* Copyright Redis Ltd. 2016 - present
* Licensed under your choice of the Redis Source Available License 2.0 (RSALv2) or
* the Server Side Public License v1 (SSPLv1).
*/
use std::process::Command;
fn main() {
// Expose GIT_SHA env var
let git_sha = Command::new("git")
.args(["rev-parse", "--short", "HEAD"])
.output();
if let Ok(sha) = git_sha {
let sha = String::from_utf8(sha.stdout).unwrap();
println!("cargo:rustc-env=GIT_SHA={sha}");
}
// Expose GIT_BRANCH env var
let git_branch = Command::new("git")
.args(["rev-parse", "--abbrev-ref", "HEAD"])
.output();
if let Ok(branch) = git_branch {
let branch = String::from_utf8(branch.stdout).unwrap();
println!("cargo:rustc-env=GIT_BRANCH={branch}");
}
}