aboutsummaryrefslogtreecommitdiff
path: root/src/util/version.rs
diff options
context:
space:
mode:
authorAlex <alex@adnab.me>2023-05-09 09:53:33 +0000
committerAlex <alex@adnab.me>2023-05-09 09:53:33 +0000
commitb925f53dc3b0bae77aa3f73e581faace2eb3b21a (patch)
treeda9eb070a78669f851c6f1072c3e996b766a7f7c /src/util/version.rs
parent2f495575d8b8206ba725a1f44d01291000ba13c9 (diff)
parent9e0a9c1c15cc8a6849de8c23bc1b0e711ab4fc8f (diff)
downloadgarage-b925f53dc3b0bae77aa3f73e581faace2eb3b21a.tar.gz
garage-b925f53dc3b0bae77aa3f73e581faace2eb3b21a.zip
Merge pull request 'move git-version dependency to main crate to reduce rebuilds' (#568) from move-git-version into main
Reviewed-on: https://git.deuxfleurs.fr/Deuxfleurs/garage/pulls/568
Diffstat (limited to 'src/util/version.rs')
-rw-r--r--src/util/version.rs12
1 files changed, 4 insertions, 8 deletions
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]) {