Add more build info. This fixes #44

This commit is contained in:
Magnus Hoff 2017-11-20 10:19:49 +01:00
parent 88b3df21c2
commit 83b011b9c9

View file

@ -5,10 +5,25 @@ pub const PROJECT_NAME: &str = env!("CARGO_PKG_NAME");
lazy_static! { lazy_static! {
pub static ref VERSION: String = || -> String { pub static ref VERSION: String = || -> String {
#[allow(unused_mut)] #[allow(unused_mut)]
let mut components = Vec::<&'static str>::new(); let mut components = Vec::<String>::new();
#[cfg(debug_assertions)] #[cfg(debug_assertions)]
components.push("debug"); components.push("debug".into());
#[cfg(test)]
components.push("test".into());
if let None = option_env!("CONTINUOUS_INTEGRATION") {
components.push("local-build".into());
}
if let Some(branch) = option_env!("TRAVIS_BRANCH") {
components.push(format!("branch:{}", branch));
}
if let Some(commit) = option_env!("TRAVIS_COMMIT") {
components.push(format!("commit:{}", commit));
}
if components.len() > 0 { if components.len() > 0 {
format!("{} ({})", env!("CARGO_PKG_VERSION"), components.join(" ")) format!("{} ({})", env!("CARGO_PKG_VERSION"), components.join(" "))