Skip to content

Commit

Permalink
Fix setting build rev in version when cross compiling.
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonish committed Sep 23, 2020
1 parent d7605b0 commit f244e90
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,20 @@ fn main() {
std::env::var("TARGET").unwrap()
);

if env::var_os("BUILD_REV").is_none() {
match get_git_rev() {
match env::var_os("BUILD_REV") {
None => match get_git_rev() {
Err(err) => {
eprintln!("Failed to get git revision: {}", err);
}
Ok(rev) => {
println!("cargo:rustc-env=BUILD_REV={}", rev);
}
},
Some(_) => {
println!(
"cargo:rustc-env=BUILD_REV={}",
std::env::var("BUILD_REV").unwrap()
);
}
}
}
Expand Down

0 comments on commit f244e90

Please sign in to comment.