mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
add git commit hash to debug window
This commit is contained in:
parent
42c5e671a1
commit
eb28ba94f6
14
voxygen/build.rs
Normal file
14
voxygen/build.rs
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
use std::process::Command;
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
match Command::new("git")
|
||||||
|
.args(&["rev-parse", "--short", "HEAD"])
|
||||||
|
.output()
|
||||||
|
{
|
||||||
|
Ok(output) => match String::from_utf8(output.stdout) {
|
||||||
|
Ok(hash) => println!("cargo:rustc-env=GIT_HASH={}", hash),
|
||||||
|
Err(e) => println!("failed to convert git output to UTF-8: {}", e),
|
||||||
|
},
|
||||||
|
Err(e) => println!("failed to retrieve current git commit hash: {}", e),
|
||||||
|
}
|
||||||
|
}
|
@ -305,7 +305,11 @@ impl Hud {
|
|||||||
) -> Vec<Event> {
|
) -> Vec<Event> {
|
||||||
let mut events = Vec::new();
|
let mut events = Vec::new();
|
||||||
let ref mut ui_widgets = self.ui.set_widgets();
|
let ref mut ui_widgets = self.ui.set_widgets();
|
||||||
let version = env!("CARGO_PKG_VERSION");
|
|
||||||
|
let version = match std::env::var("GIT_HASH") {
|
||||||
|
Ok(hash) => format!("{}-{}", env!("CARGO_PKG_VERSION"), hash),
|
||||||
|
Err(_) => env!("CARGO_PKG_VERSION").to_owned(),
|
||||||
|
};
|
||||||
|
|
||||||
// Don't show anything if the UI is toggled off.
|
// Don't show anything if the UI is toggled off.
|
||||||
if !self.show.ui {
|
if !self.show.ui {
|
||||||
@ -421,7 +425,7 @@ impl Hud {
|
|||||||
// Display debug window.
|
// Display debug window.
|
||||||
if self.show.debug {
|
if self.show.debug {
|
||||||
// Alpha Version
|
// Alpha Version
|
||||||
Text::new(version)
|
Text::new(&version)
|
||||||
.top_left_with_margins_on(ui_widgets.window, 5.0, 5.0)
|
.top_left_with_margins_on(ui_widgets.window, 5.0, 5.0)
|
||||||
.font_size(14)
|
.font_size(14)
|
||||||
.font_id(self.fonts.opensans)
|
.font_id(self.fonts.opensans)
|
||||||
|
Loading…
Reference in New Issue
Block a user