mirror of
https://github.com/Xevion/smart-rgb.git
synced 2025-12-12 22:13:07 -06:00
Update source files
This commit is contained in:
21
crates/borders-core/src/build_info.rs
Normal file
21
crates/borders-core/src/build_info.rs
Normal file
@@ -0,0 +1,21 @@
|
||||
//! Build metadata injected at compile time
|
||||
|
||||
/// The version of the application from Cargo.toml
|
||||
pub const VERSION: &str = env!("CARGO_PKG_VERSION");
|
||||
|
||||
/// The git commit hash from .source-commit file or git command
|
||||
pub const GIT_COMMIT: &str = env!("BUILD_GIT_COMMIT");
|
||||
|
||||
/// The build timestamp in RFC3339 format (UTC)
|
||||
pub const BUILD_TIME: &str = env!("BUILD_TIME");
|
||||
|
||||
/// Get the git commit hash (short form, first 7 characters)
|
||||
pub fn git_commit_short() -> &'static str {
|
||||
let full = GIT_COMMIT;
|
||||
if full.len() >= 7 { &full[..7] } else { full }
|
||||
}
|
||||
|
||||
/// Full build information formatted as a string
|
||||
pub fn info() -> String {
|
||||
format!("Iron Borders v{} ({})\nBuilt: {}", VERSION, git_commit_short(), BUILD_TIME)
|
||||
}
|
||||
Reference in New Issue
Block a user