use std::env;
use std::fs::File;
use std::path::Path;
fn main() {
let commit_file_path = Path::new(&env::var("OUT_DIR").unwrap()).join("commit_hash");
#[allow(unused_variables, unused_mut)]
let mut f = File::create(&commit_file_path).unwrap();
#[cfg(not(debug_assertions))]
{
use std::io::Write;
use std::process::Command;
let last_commit_hash = Command::new("git")
.args(&["log", "-n", "1", "--pretty=format:%H"])
.output()
.ok();
if let Some(last_commit_hash) = last_commit_hash {
f.write_all(&last_commit_hash.stdout).unwrap();
}
}
}