mirror of
https://github.com/deuxfleurs-org/garage.git
synced 2026-08-08 13:53:13 +00:00
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
This commit is contained in:
@@ -41,6 +41,7 @@ tracing-subscriber = { version = "0.3", features = ["env-filter"] }
|
||||
rand = "0.8"
|
||||
async-trait = "0.1.7"
|
||||
sodiumoxide = { version = "0.2.5-0", package = "kuska-sodiumoxide" }
|
||||
git-version = "0.3.4"
|
||||
|
||||
serde = { version = "1.0", default-features = false, features = ["derive", "rc"] }
|
||||
serde_bytes = "0.11"
|
||||
|
||||
@@ -108,6 +108,12 @@ async fn main() {
|
||||
][..];
|
||||
if let Some(git_version) = option_env!("GIT_VERSION") {
|
||||
garage_util::version::init_version(git_version);
|
||||
} else {
|
||||
garage_util::version::init_version(git_version::git_version!(
|
||||
prefix = "git:",
|
||||
cargo_prefix = "cargo:",
|
||||
fallback = "unknown"
|
||||
));
|
||||
}
|
||||
garage_util::version::init_features(features);
|
||||
|
||||
|
||||
@@ -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"
|
||||
|
||||
+4
-8
@@ -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]) {
|
||||
|
||||
Reference in New Issue
Block a user