Some checks failed
Build Zenyx ⚡ / 🧪 Run Cargo Tests (pull_request) Failing after 6m9s
Build Zenyx ⚡ / 🏗️ Build aarch64-apple-darwin (pull_request) Has been skipped
Build Zenyx ⚡ / 🏗️ Build aarch64-pc-windows-msvc (pull_request) Has been skipped
Build Zenyx ⚡ / 🏗️ Build aarch64-unknown-linux-gnu (pull_request) Has been skipped
Build Zenyx ⚡ / 🏗️ Build x86_64-apple-darwin (pull_request) Has been skipped
Build Zenyx ⚡ / 🏗️ Build x86_64-pc-windows-msvc (pull_request) Has been skipped
Build Zenyx ⚡ / 🏗️ Build x86_64-unknown-linux-gnu (pull_request) Has been skipped
lib.rs is separated into src/modules now for cleaner code optimized error handling to -> (storage.rs, uptime.rs, meta.rs, memory.rs, os.rs, network.rs) optimized struct types to -> (storage.rs, uptime.rs, meta.rs, memory.rs, os.rs, network.rs)
21 lines
580 B
Rust
21 lines
580 B
Rust
use std::{env, fs::File, io::Write, process::Command};
|
|
|
|
fn main() {
|
|
let out_dir = env::var("OUT_DIR").unwrap();
|
|
let mut f = File::create(format!("{}/built.rs", out_dir)).unwrap();
|
|
|
|
let commit_hash = Command::new("git")
|
|
.args(["rev-parse", "HEAD"])
|
|
.output()
|
|
.ok()
|
|
.and_then(|o| String::from_utf8(o.stdout).ok())
|
|
.unwrap_or_else(|| "unknown".into());
|
|
|
|
writeln!(f, "#[allow(dead_code)]").unwrap();
|
|
writeln!(
|
|
f,
|
|
"pub const GIT_COMMIT_HASH: &str = \"{}\";",
|
|
commit_hash.trim()
|
|
)
|
|
.unwrap();
|
|
}
|