forked from StellarFlow-Network/stellarflow-contracts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.rs
More file actions
19 lines (16 loc) · 619 Bytes
/
Copy pathbuild.rs
File metadata and controls
19 lines (16 loc) · 619 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
use std::process::Command;
use std::time::SystemTime;
fn main() {
let git_sha = Command::new("git")
.args(["rev-parse", "HEAD"])
.output()
.map(|o| String::from_utf8_lossy(&o.stdout).trim().to_string())
.unwrap_or_else(|_| "unknown".to_string());
println!("cargo:rustc-env=GIT_SHA={git_sha}");
let build_time = SystemTime::now()
.duration_since(SystemTime::UNIX_EPOCH)
.map(|d| d.as_secs().to_string())
.unwrap_or_else(|_| "0".to_string());
println!("cargo:rustc-env=BUILD_TIME={build_time}");
println!("cargo:rerun-if-changed=build.rs");
}