diff --git a/src/build_config.rs b/src/build_config.rs index 8afc1dd..dd0f9ac 100644 --- a/src/build_config.rs +++ b/src/build_config.rs @@ -5,10 +5,25 @@ pub const PROJECT_NAME: &str = env!("CARGO_PKG_NAME"); lazy_static! { pub static ref VERSION: String = || -> String { #[allow(unused_mut)] - let mut components = Vec::<&'static str>::new(); + let mut components = Vec::::new(); #[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 { format!("{} ({})", env!("CARGO_PKG_VERSION"), components.join(" "))