build.rs 433 B

123456789101112
  1. use std::process::Command;
  2. fn main() {
  3. if let Ok(git_output) = Command::new("git").args(["rev-parse", "HEAD"]).output() {
  4. if git_output.status.success() {
  5. if let Ok(git_commit_hash) = String::from_utf8(git_output.stdout) {
  6. let trimmed_hash = git_commit_hash.trim().to_string();
  7. println!("cargo:rustc-env=AGAVE_GIT_COMMIT_HASH={trimmed_hash}");
  8. }
  9. }
  10. }
  11. }