build-info-build 0.0.44

Provides the data consumed by the build-info crate. Use as a build-dependency.
Documentation
use build_info_common::VersionControl;

#[cfg(feature = "git")]
mod git;

#[cfg(feature = "git")]
fn get_git_info() -> anyhow::Result<VersionControl> {
	git::get_info().map(VersionControl::Git)
}

#[cfg(not(feature = "git"))]
fn get_git_info() -> anyhow::Result<VersionControl> {
	Err(anyhow::anyhow!("Git support is disabled"))
}

pub(crate) fn get_info() -> Option<VersionControl> {
	if cfg!(feature = "git") {
		get_git_info().ok()
	} else {
		None
	}
}