forked from RedisJSON/RedisJSON
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.rs
More file actions
29 lines (27 loc) · 911 Bytes
/
build.rs
File metadata and controls
29 lines (27 loc) · 911 Bytes
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
27
28
29
/*
* Copyright (c) 2006-Present, Redis Ltd.
* All rights reserved.
*
* Licensed under your choice of (a) the Redis Source Available License 2.0
* (RSALv2); or (b) the Server Side Public License v1 (SSPLv1); or (c) the
* GNU Affero General Public License v3 (AGPLv3).
*/
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}");
}
}