diff options
author | Alex Auvolat <alex@adnab.me> | 2023-05-03 16:43:08 +0200 |
---|---|---|
committer | Alex Auvolat <alex@adnab.me> | 2023-05-09 11:35:32 +0200 |
commit | 9e0a9c1c15cc8a6849de8c23bc1b0e711ab4fc8f (patch) | |
tree | 42264283c2c7838d6915973e913dc2150a7e6a2e /src/util | |
parent | 5684e1990cce84fbeb41b7886fb10fca94f76581 (diff) | |
download | garage-9e0a9c1c15cc8a6849de8c23bc1b0e711ab4fc8f.tar.gz garage-9e0a9c1c15cc8a6849de8c23bc1b0e711ab4fc8f.zip |
move git-version dependency to main crate to reduce rebuilds
Diffstat (limited to 'src/util')
-rw-r--r-- | src/util/Cargo.toml | 1 | ||||
-rw-r--r-- | src/util/version.rs | 12 |
2 files changed, 4 insertions, 9 deletions
diff --git a/src/util/Cargo.toml b/src/util/Cargo.toml index 08fb5553..f72051b9 100644 --- a/src/util/Cargo.toml +++ b/src/util/Cargo.toml @@ -22,7 +22,6 @@ blake2 = "0.10" bytes = "1.0" digest = "0.10" err-derive = "0.3" -git-version = "0.3.4" hexdump = "0.1" xxhash-rust = { version = "0.8", default-features = false, features = ["xxh3"] } hex = "0.4" diff --git a/src/util/version.rs b/src/util/version.rs index 2b2ea271..19907ed1 100644 --- a/src/util/version.rs +++ b/src/util/version.rs @@ -1,18 +1,14 @@ use std::sync::Arc; -use arc_swap::{ArcSwap, ArcSwapOption}; +use arc_swap::ArcSwapOption; lazy_static::lazy_static! { - static ref VERSION: ArcSwap<&'static str> = ArcSwap::new(Arc::new(git_version::git_version!( - prefix = "git:", - cargo_prefix = "cargo:", - fallback = "unknown" - ))); + static ref VERSION: ArcSwapOption<&'static str> = ArcSwapOption::new(None); static ref FEATURES: ArcSwapOption<&'static [&'static str]> = ArcSwapOption::new(None); } pub fn garage_version() -> &'static str { - &VERSION.load() + VERSION.load().as_ref().unwrap() } pub fn garage_features() -> Option<&'static [&'static str]> { @@ -20,7 +16,7 @@ pub fn garage_features() -> Option<&'static [&'static str]> { } pub fn init_version(version: &'static str) { - VERSION.store(Arc::new(version)); + VERSION.store(Some(Arc::new(version))); } pub fn init_features(features: &'static [&'static str]) { |