build.rs: Add GITHUB_SHA detection

This commit is contained in:
George Hilliard authored and GitHub committed 2020-12-15 16:19:43 +00:00
1 parent 5ccfd6a0d8
commit bdd270d3ca
1 file changed
+13
+13
View File
@@ -18,6 +18,10 @@ fn build_ver() {
}
fn git_ver() -> Option<String> {
github_ver().or_else(git_cmd_ver)
}
fn git_cmd_ver() -> Option<String> {
let mut git_cmd = Command::new("git");
git_cmd.args(&["describe", "--tags"]);
@@ -32,6 +36,15 @@ fn git_ver() -> Option<String> {
}
}
fn github_ver() -> Option<String> {
if let Ok(sha1) = env::var("GITHUB_SHA") {
println!("cargo:rerun-if-env-changed=GITHUB_SHA");
Some(sha1)
} else {
None
}
}
#[cfg(windows)]
fn platform_cfg() {
let gstreamer_dir = env::var_os("GSTREAMER_1_0_ROOT_X86_64")