From db61f41030678c5756c844c8aa41a210c658769e Mon Sep 17 00:00:00 2001 From: Alex Auvolat Date: Wed, 7 Sep 2022 11:59:56 +0200 Subject: Move GIT_VERSION injection later in build chain to reduce build times --- src/model/Cargo.toml | 1 + src/model/lib.rs | 1 + src/model/version.rs | 7 +++++++ 3 files changed, 9 insertions(+) create mode 100644 src/model/version.rs (limited to 'src/model') diff --git a/src/model/Cargo.toml b/src/model/Cargo.toml index bbcfe89c..c41d3f16 100644 --- a/src/model/Cargo.toml +++ b/src/model/Cargo.toml @@ -24,6 +24,7 @@ async-trait = "0.1.7" arc-swap = "1.0" blake2 = "0.9" err-derive = "0.3" +git-version = "0.3.4" hex = "0.4" base64 = "0.13" tracing = "0.1.30" diff --git a/src/model/lib.rs b/src/model/lib.rs index 4f20ea46..43db01c5 100644 --- a/src/model/lib.rs +++ b/src/model/lib.rs @@ -19,3 +19,4 @@ pub mod s3; pub mod garage; pub mod helper; pub mod migrate; +pub mod version; diff --git a/src/model/version.rs b/src/model/version.rs new file mode 100644 index 00000000..cdb3ea62 --- /dev/null +++ b/src/model/version.rs @@ -0,0 +1,7 @@ +pub fn garage_version() -> &'static str { + option_env!("GIT_VERSION").unwrap_or(git_version::git_version!( + prefix = "git:", + cargo_prefix = "cargo:", + fallback = "unknown" + )) +} -- cgit v1.2.3