Fix vergen for release again (#394)

This commit is contained in:
redzic 2021-10-31 15:51:10 -05:00 committed by GitHub
parent 5c8a99879f
commit c16f6a2730
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -28,9 +28,22 @@ fn version() -> &'static str {
INSTANCE.get_or_init(|| { INSTANCE.get_or_init(|| {
match ( match (
option_env!("VERGEN_GIT_SHA_SHORT"), option_env!("VERGEN_GIT_SHA_SHORT"),
option_env!("VERGEN_CARGO_PROFILE"),
option_env!("VERGEN_RUSTC_SEMVER"),
option_env!("VERGEN_RUSTC_LLVM_VERSION"),
option_env!("VERGEN_CARGO_TARGET_TRIPLE"),
option_env!("VERGEN_BUILD_DATE"),
option_env!("VERGEN_GIT_COMMIT_DATE"), option_env!("VERGEN_GIT_COMMIT_DATE"),
) { ) {
(Some(git_hash), Some(commit_date)) => { (
Some(git_hash),
Some(cargo_profile),
Some(rustc_ver),
Some(llvm_ver),
Some(target_triple),
Some(build_date),
Some(commit_date),
) => {
format!( format!(
"{} (rev {}) ({}) "{} (rev {}) ({})
@ -43,18 +56,18 @@ fn version() -> &'static str {
* Date Info * Date Info
Build Date: {} Build Date: {}
Commit Date: {}", Commit Date: {}",
env!("VERGEN_BUILD_SEMVER"), env!("CARGO_PKG_VERSION"),
git_hash, git_hash,
env!("VERGEN_CARGO_PROFILE"), cargo_profile,
env!("VERGEN_RUSTC_SEMVER"), rustc_ver,
env!("VERGEN_RUSTC_LLVM_VERSION"), llvm_ver,
env!("VERGEN_CARGO_TARGET_TRIPLE"), target_triple,
env!("VERGEN_BUILD_DATE"), build_date,
commit_date commit_date
) )
} }
// only include the semver on a release (when git information isn't available) // only include the semver on a release (when git information isn't available)
_ => env!("VERGEN_BUILD_SEMVER").into(), _ => env!("CARGO_PKG_VERSION").into(),
} }
}) })
} }