2023-04-18 08:16:06 -06:00
|
|
|
use std::error::Error;
|
|
|
|
use vergen::EmitBuilder;
|
|
|
|
|
|
|
|
fn main() -> Result<(), Box<dyn Error>> {
|
2023-04-19 13:36:59 -06:00
|
|
|
// Try to get the git sha from the local git repository
|
|
|
|
if EmitBuilder::builder()
|
|
|
|
.fail_on_error()
|
|
|
|
.git_sha(false)
|
|
|
|
.emit()
|
|
|
|
.is_err()
|
|
|
|
{
|
|
|
|
// Unable to get the git sha
|
|
|
|
if let Ok(sha) = std::env::var("GIT_SHA") {
|
|
|
|
// Set it from an env var
|
|
|
|
println!("cargo:rustc-env=VERGEN_GIT_SHA={sha}");
|
|
|
|
}
|
|
|
|
}
|
2023-04-18 08:16:06 -06:00
|
|
|
Ok(())
|
|
|
|
}
|