mod raw {
include!(concat!(env!("OUT_DIR"), "/built.rs"));
}
pub const MMTK_PKG_VERSION: &str = raw::PKG_VERSION;
pub const MMTK_FEATURES: &str = raw::FEATURES_STR;
lazy_static! {
pub static ref MMTK_GIT_VERSION: &'static str = &MMTK_GIT_VERSION_STRING;
static ref MMTK_GIT_VERSION_STRING: String = match (raw::GIT_COMMIT_HASH, raw::GIT_DIRTY) {
(Some(hash), Some(dirty)) => format!("{}{}", hash.split_at(7).0, if dirty { "-dirty" } else { "" }),
(Some(hash), None) => format!("{}{}", hash.split_at(7).0, "-?"),
_ => "unknown-git-version".to_string(),
};
pub static ref MMTK_FULL_BUILD_INFO: &'static str = &MMTK_FULL_BUILD_INFO_STRING;
static ref MMTK_FULL_BUILD_INFO_STRING: String = format!("MMTk {} ({}, {})", MMTK_PKG_VERSION, *MMTK_GIT_VERSION, MMTK_FEATURES);
}
#[cfg(test)]
mod tests {
#[test]
fn test_git_version() {
println!("Git version: {}", *crate::build_info::MMTK_GIT_VERSION);
}
#[test]
fn test_full_build_version() {
println!(
"Full build version: {}",
*crate::build_info::MMTK_FULL_BUILD_INFO
);
}
#[test]
fn test_pkg_version() {
println!("Package version: {}", crate::build_info::MMTK_PKG_VERSION);
}
#[test]
fn test_features() {
println!("Features: {}", crate::build_info::MMTK_FEATURES);
}
}