Add server and client build versions
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
use notmuch::SearchSummary;
|
||||
use build_info::{VersionControl,BuildInfo};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug)]
|
||||
@@ -33,3 +34,22 @@ pub mod urls {
|
||||
}
|
||||
}
|
||||
}
|
||||
pub fn build_version(bi:fn()->&'static BuildInfo) -> String {
|
||||
fn commit(git: &Option<VersionControl>) -> String {
|
||||
let Some(VersionControl::Git(git)) = git else {
|
||||
return String::new();
|
||||
};
|
||||
let mut s = vec![git.commit_short_id.clone()];
|
||||
if git.dirty {
|
||||
s.push(".+".to_string());
|
||||
}
|
||||
|
||||
if let Some(branch) = &git.branch {
|
||||
s.push(format!(" ({branch})"));
|
||||
}
|
||||
s.join("")
|
||||
}
|
||||
let bi = bi();
|
||||
|
||||
format!("{}-{}", bi.crate_info.version, commit(&bi.version_control)).to_string()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user