Support for vergen information when vendoring

This commit is contained in:
Jeremy Soller 2024-02-28 10:28:50 -07:00
parent ff1d216207
commit d1a6144926
No known key found for this signature in database
GPG key ID: D02FD439211AF56F
3 changed files with 18 additions and 14 deletions

View file

@ -2,10 +2,14 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
// Rebuild if i18n files change
println!("cargo:rerun-if-changed=i18n");
vergen::EmitBuilder::builder()
.fail_on_error()
.git_commit_date()
.git_sha(true)
.emit()?;
// Emit version information (if not cached by just vendor)
let mut vergen = vergen::EmitBuilder::builder();
if std::env::var_os("VERGEN_GIT_COMMIT_DATE").is_none() {
vergen.git_commit_date();
}
if std::env::var_os("VERGEN_GIT_SHA").is_none() {
vergen.git_sha(true);
}
vergen.fail_on_error().emit()?;
Ok(())
}