Skip to main content

holodeck_lib/
version.rs

1#![allow(clippy::doc_markdown)] // Generated file contains OPT_LEVEL without backticks
2
3use std::sync::LazyLock;
4
5include!(concat!(env!("OUT_DIR"), "/built.rs"));
6
7/// Version of the software including:
8/// - Cargo package version
9/// - Short git commit hash (if available)
10/// - Git dirty flag (if the repo had uncommitted changes at build time)
11pub static VERSION: LazyLock<String> = LazyLock::new(|| {
12    let prefix = if let Some(hash) = GIT_COMMIT_HASH {
13        let short = &hash[..hash.len().min(8)];
14        format!("{PKG_VERSION}-{short}")
15    } else {
16        PKG_VERSION.to_string()
17    };
18    let suffix = match GIT_DIRTY {
19        Some(true) => "-dirty",
20        _ => "",
21    };
22    format!("{prefix}{suffix}")
23});