redsunlib/build.rs
gmnsii e3b1c5b587 Use a bullet instead of empty margin when score is hidden
This is prettier and keeps consistency across the app.
2023-03-23 11:29:28 -07:00

25 lines
595 B
Rust

use std::process::{Command, ExitStatus, Output};
#[cfg(not(target_os = "windows"))]
use std::os::unix::process::ExitStatusExt;
#[cfg(target_os = "windows")]
use std::os::windows::process::ExitStatusExt;
fn main() {
let output = String::from_utf8(
Command::new("git")
.args(["rev-parse", "HEAD"])
.output()
.unwrap_or(Output {
stdout: vec![],
stderr: vec![],
status: ExitStatus::from_raw(0),
})
.stdout,
)
.unwrap_or_default();
let git_hash = if output == String::default() { "dev".into() } else { output };
println!("cargo:rustc-env=GIT_HASH={git_hash}");
}