Refactor source of Git commit build info (closes #661)

This commit is contained in:
Keavon Chambers
2022-05-24 14:33:58 -07:00
parent b624405b0c
commit 8b94c62697
17 changed files with 126 additions and 118 deletions
+31
View File
@@ -0,0 +1,31 @@
/// Provides metadata about the build environment.
///
/// This data is viewable in the editor via the [`crate::dialog::AboutGraphite`] dialog.
pub fn release_series() -> String {
format!("Release Series: {}", env!("GRAPHITE_RELEASE_SERIES"))
}
pub fn commit_info() -> String {
format!("{}\n{}\n{}", commit_timestamp(), commit_hash(), commit_branch())
}
pub fn commit_info_localized(localized_commit_date: &str) -> String {
format!("{}\n{}\n{}", commit_timestamp_localized(localized_commit_date), commit_hash(), commit_branch())
}
pub fn commit_timestamp() -> String {
format!("Date: {}", env!("GRAPHITE_GIT_COMMIT_DATE"))
}
pub fn commit_timestamp_localized(localized_commit_date: &str) -> String {
format!("Date: {}", localized_commit_date)
}
pub fn commit_hash() -> String {
format!("Hash: {}", &env!("GRAPHITE_GIT_COMMIT_HASH")[..8])
}
pub fn commit_branch() -> String {
format!("Branch: {}", env!("GRAPHITE_GIT_COMMIT_BRANCH"))
}
+4 -3
View File
@@ -1,11 +1,12 @@
#[macro_use]
pub mod macros;
pub mod build_metadata;
pub mod derivable_custom_traits;
pub mod hints;
pub mod test_utils;
mod error;
pub use error::EditorError;
pub use hints::*;
pub use macros::*;
mod error;