Add build metadata to engine in VERSION file + debug view

main
Elijah Voigt 4 months ago
parent 866155a230
commit d4eedab39c

3
.gitignore vendored

@ -8,3 +8,6 @@ result
# Web output # Web output
dist/* dist/*
# Generated VERSION file for builds
VERSION

45
Cargo.lock generated

@ -160,6 +160,12 @@ version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fc7eb209b1518d6bb87b283c20095f5228ecda460da70b44f0802523dea6da04" checksum = "fc7eb209b1518d6bb87b283c20095f5228ecda460da70b44f0802523dea6da04"
[[package]]
name = "android-tzdata"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0"
[[package]] [[package]]
name = "android_log-sys" name = "android_log-sys"
version = "0.3.2" version = "0.3.2"
@ -1586,6 +1592,20 @@ version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724"
[[package]]
name = "chrono"
version = "0.4.41"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c469d952047f47f91b68d1cba3f10d63c11d73e4636f24f08daf0278abf01c4d"
dependencies = [
"android-tzdata",
"iana-time-zone",
"js-sys",
"num-traits",
"wasm-bindgen",
"windows-link",
]
[[package]] [[package]]
name = "clang-sys" name = "clang-sys"
version = "1.8.1" version = "1.8.1"
@ -2205,6 +2225,7 @@ version = "0.1.0"
dependencies = [ dependencies = [
"bevy", "bevy",
"bevy_rapier3d", "bevy_rapier3d",
"chrono",
"serde", "serde",
"thiserror 2.0.12", "thiserror 2.0.12",
] ]
@ -2502,6 +2523,30 @@ version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dfa686283ad6dd069f105e5ab091b04c62850d3e4cf5d67debad1933f55023df" checksum = "dfa686283ad6dd069f105e5ab091b04c62850d3e4cf5d67debad1933f55023df"
[[package]]
name = "iana-time-zone"
version = "0.1.63"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b0c919e5debc312ad217002b8048a17b7d83f80703865bbfcfebb0458b0b27d8"
dependencies = [
"android_system_properties",
"core-foundation-sys",
"iana-time-zone-haiku",
"js-sys",
"log",
"wasm-bindgen",
"windows-core 0.61.2",
]
[[package]]
name = "iana-time-zone-haiku"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f"
dependencies = [
"cc",
]
[[package]] [[package]]
name = "image" name = "image"
version = "0.25.6" version = "0.25.6"

@ -16,3 +16,6 @@ version = "0.30.0"
[dependencies.bevy] [dependencies.bevy]
version = "0.16.1" version = "0.16.1"
features = ["wayland", "dynamic_linking"] features = ["wayland", "dynamic_linking"]
[build-dependencies]
chrono = "*"

@ -0,0 +1,38 @@
fn main() {
{
use std::process::Command;
use chrono::prelude::*;
use std::fs::File;
use std::io::Write;
// Date of build
let now = Utc::now().format("%Y%m%d%H%M%S");
// Latest commit ID
let git_sha = String::from_utf8(
Command::new("git")
.arg("rev-parse")
.arg("--short")
.arg("HEAD")
.output()
.expect("Failed to get git sha")
.stdout
).expect("Read stdout from git sha command");
// If the workspace is dirty or clean
let clean = Command::new("git")
.arg("diff")
.arg("--quiet")
.status()
.expect("Failed to run git diff")
.success();
let mut file = File::create("VERSION").expect("Create VERSION file");
if clean {
write!(file, "0.0.0-{now}+{}", git_sha.trim()).expect("Write version to VERSION file");
} else {
write!(file, "0.0.0-{now}+{}-dirty", git_sha.trim()).expect("Write version to VERSION file");
}
}
}

@ -182,7 +182,6 @@ fn init_debug_ui(mut commands: Commands) {
height: Val::Percent(90.0), height: Val::Percent(90.0),
align_self: AlignSelf::Center, align_self: AlignSelf::Center,
justify_self: JustifySelf::Start, justify_self: JustifySelf::Start,
width: Val::Percent(60.0),
..default() ..default()
}, },
MonologuesContainer, MonologuesContainer,

@ -1,5 +1,5 @@
use bevy::{ use bevy::{
color::palettes::css::MAGENTA, color::palettes::css::{GREY, MAGENTA},
pbr::wireframe::{WireframeConfig, WireframePlugin}, pbr::wireframe::{WireframeConfig, WireframePlugin},
platform::collections::HashMap, platform::collections::HashMap,
}; };
@ -61,8 +61,10 @@ pub enum DebuggingState {
/// Create the Debugging UI /// Create the Debugging UI
fn init_debug_ui(mut commands: Commands) { fn init_debug_ui(mut commands: Commands) {
// "Debugging On" Indicator
commands.spawn(( commands.spawn((
DebuggingState::On, DebuggingState::On,
Name::new("Debug Indicator"),
Text(" Debug: ON ".into()), Text(" Debug: ON ".into()),
TextColor(WHITE.into()), TextColor(WHITE.into()),
BackgroundColor(RED.into()), BackgroundColor(RED.into()),
@ -74,6 +76,22 @@ fn init_debug_ui(mut commands: Commands) {
}, },
)); ));
// Version string for troubleshooting
commands.spawn((
DebuggingState::On,
Name::new("Version #"),
Text::new(VERSION),
TextColor(WHITE.into()),
BackgroundColor(BLACK.into()),
Node {
width: Val::Auto,
align_self: AlignSelf::End,
justify_self: JustifySelf::End,
..default()
}
));
// Tooltip
commands.spawn(( commands.spawn((
DebuggingState::On, DebuggingState::On,
Text("Tooltip Placeholder".into()), Text("Tooltip Placeholder".into()),

@ -6,6 +6,7 @@ mod debug;
mod loading; mod loading;
mod scheduling; mod scheduling;
mod ui; mod ui;
mod version;
pub use std::fmt::Display; pub use std::fmt::Display;
@ -28,3 +29,4 @@ pub use debug::*;
pub use loading::*; pub use loading::*;
pub use scheduling::*; pub use scheduling::*;
pub use ui::*; pub use ui::*;
pub use version::*;

@ -0,0 +1,2 @@
/// Include the version of this build from an auto-generated version file
pub const VERSION: &str = include_str!("../VERSION");
Loading…
Cancel
Save