Fix vergen for release (#393)
This commit is contained in:
parent
782f74982b
commit
eb1047aa30
5
Cargo.lock
generated
5
Cargo.lock
generated
|
@ -181,6 +181,7 @@ dependencies = [
|
|||
"av1an-core",
|
||||
"ctrlc",
|
||||
"ffmpeg-next",
|
||||
"once_cell",
|
||||
"path_abs",
|
||||
"shlex 1.1.0",
|
||||
"structopt",
|
||||
|
@ -750,9 +751,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "libc"
|
||||
version = "0.2.105"
|
||||
version = "0.2.106"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "869d572136620d55835903746bcb5cdc54cb2851fd0aeec53220b4bb65ef3013"
|
||||
checksum = "a60553f9a9e039a333b4e9b20573b9e9b9c0bb3a11e201ccc48ef4283456d673"
|
||||
|
||||
[[package]]
|
||||
name = "libfuzzer-sys"
|
||||
|
|
|
@ -19,6 +19,7 @@ path_abs = "0.5.1"
|
|||
anyhow = "1.0.42"
|
||||
av1an-core = { path = "../av1an-core", version = "0.2.0" }
|
||||
thiserror = "1.0.30"
|
||||
once_cell = "1.8.0"
|
||||
|
||||
[build-dependencies]
|
||||
vergen = { version = "5", default-features = false, features = [
|
||||
|
|
|
@ -7,5 +7,6 @@ fn main() {
|
|||
*config.git_mut().commit_timestamp_kind_mut() = TimestampKind::All;
|
||||
*config.build_mut().kind_mut() = TimestampKind::All;
|
||||
|
||||
vergen(config).unwrap();
|
||||
// ignore error if we can't get the git commit hash
|
||||
let _ = vergen(config);
|
||||
}
|
||||
|
|
|
@ -19,28 +19,44 @@ use av1an_core::{
|
|||
{concat::ConcatMethod, ChunkMethod, SplitMethod},
|
||||
};
|
||||
|
||||
pub fn version() -> &'static str {
|
||||
// This string has to be constructed at compile-time,
|
||||
// since structopt requires a &'static str
|
||||
concat!(
|
||||
env!("VERGEN_BUILD_SEMVER"),
|
||||
" (rev ",
|
||||
env!("VERGEN_GIT_SHA_SHORT"),
|
||||
") (",
|
||||
env!("VERGEN_CARGO_PROFILE"),
|
||||
")",
|
||||
"\n\n* Compiler\n rustc ",
|
||||
env!("VERGEN_RUSTC_SEMVER"),
|
||||
" (LLVM ",
|
||||
env!("VERGEN_RUSTC_LLVM_VERSION"),
|
||||
")\n\n* Target Triple\n ",
|
||||
env!("VERGEN_CARGO_TARGET_TRIPLE"),
|
||||
"\n\n* Date Info",
|
||||
"\n Build Date: ",
|
||||
env!("VERGEN_BUILD_DATE"),
|
||||
"\n Commit Date: ",
|
||||
env!("VERGEN_GIT_COMMIT_DATE"),
|
||||
)
|
||||
use once_cell::sync::OnceCell;
|
||||
|
||||
// needs to be static, runtime allocated string to avoid evil hacks to
|
||||
// concatenate non-trivial strings at compile-time
|
||||
fn version() -> &'static str {
|
||||
static INSTANCE: OnceCell<String> = OnceCell::new();
|
||||
INSTANCE.get_or_init(|| {
|
||||
match (
|
||||
option_env!("VERGEN_GIT_SHA_SHORT"),
|
||||
option_env!("VERGEN_GIT_COMMIT_DATE"),
|
||||
) {
|
||||
(Some(git_hash), Some(commit_date)) => {
|
||||
format!(
|
||||
"{} (rev {}) ({})
|
||||
|
||||
* Compiler
|
||||
rustc {} (LLVM {})
|
||||
|
||||
* Target Triple
|
||||
{}
|
||||
|
||||
* Date Info
|
||||
Build Date: {}
|
||||
Commit Date: {}",
|
||||
env!("VERGEN_BUILD_SEMVER"),
|
||||
git_hash,
|
||||
env!("VERGEN_CARGO_PROFILE"),
|
||||
env!("VERGEN_RUSTC_SEMVER"),
|
||||
env!("VERGEN_RUSTC_LLVM_VERSION"),
|
||||
env!("VERGEN_CARGO_TARGET_TRIPLE"),
|
||||
env!("VERGEN_BUILD_DATE"),
|
||||
commit_date
|
||||
)
|
||||
}
|
||||
// only include the semver on a release (when git information isn't available)
|
||||
_ => env!("VERGEN_BUILD_SEMVER").into(),
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/// Cross-platform command-line AV1 / VP9 / HEVC / H264 encoding framework with per-scene quality encoding
|
||||
|
|
Loading…
Reference in a new issue