include build type in version string

main
Elijah Voigt 3 months ago
parent 0df33ee4a6
commit c72ed47caa

@ -25,6 +25,13 @@ fn write_version_file() {
.stdout, .stdout,
) )
.expect("Read stdout from git sha command"); .expect("Read stdout from git sha command");
let git_sha = git_sha.trim();
// Determine the build type based on cfg flags
#[cfg(debug_assertions)]
let build_type = "debug";
#[cfg(not(debug_assertions))]
let build_type = "release";
// If the workspace is dirty or clean // If the workspace is dirty or clean
let clean = Command::new("git") let clean = Command::new("git")
@ -37,9 +44,9 @@ fn write_version_file() {
let mut file = File::create("VERSION").expect("Create VERSION file"); let mut file = File::create("VERSION").expect("Create VERSION file");
if clean { if clean {
write!(file, "0.0.0-{now}+{}", git_sha.trim()).expect("Write version to VERSION file"); write!(file, "0.0.0-{now}+{git_sha}-{build_type}").expect("Write version to VERSION file");
} else { } else {
write!(file, "0.0.0-{now}+{}-dirty", git_sha.trim()) write!(file, "0.0.0-{now}+{git_sha}-{build_type}-dirty")
.expect("Write version to VERSION file"); .expect("Write version to VERSION file");
} }
} }

@ -48,7 +48,9 @@ fn main() {
.run_if(on_event::<Pointer<Click>>), .run_if(on_event::<Pointer<Click>>),
spawn_debug_buttons.run_if(on_event::<AssetEvent<Monologue>>), spawn_debug_buttons.run_if(on_event::<AssetEvent<Monologue>>),
handle_plant_tree.run_if(on_event::<PlantTree>), handle_plant_tree.run_if(on_event::<PlantTree>),
assign_monologue_to_tree.run_if(on_event::<AssignMonologue>).after(handle_plant_tree), assign_monologue_to_tree
.run_if(on_event::<AssignMonologue>)
.after(handle_plant_tree),
dialog_engine.run_if(on_event::<DialogEvent>), dialog_engine.run_if(on_event::<DialogEvent>),
auto_scroll.run_if(any_component_added::<DialogOption>), auto_scroll.run_if(any_component_added::<DialogOption>),
dialog_box_visibility.run_if(state_changed::<DialogState>), dialog_box_visibility.run_if(state_changed::<DialogState>),
@ -707,12 +709,9 @@ fn handle_plant_tree(
.observe(delete_tree) .observe(delete_tree)
.observe(drag_tree); .observe(drag_tree);
match assignment { if let Some(handle) = assignment {
Some(handle) => {
assignments.write(AssignMonologue(handle.clone())); assignments.write(AssignMonologue(handle.clone()));
} }
None => ()
}
}); });
} }
@ -862,10 +861,7 @@ fn assign_monologue_event(
} }
/// On startup, plant a forest (add a few trees to the game) /// On startup, plant a forest (add a few trees to the game)
fn plant_forest( fn plant_forest(monos: Res<Assets<Monologue>>, mut e_trees: EventWriter<PlantTree>) {
monos: Res<Assets<Monologue>>,
mut e_trees: EventWriter<PlantTree>,
) {
let mut i = 10; let mut i = 10;
for id in monos.ids() { for id in monos.ids() {
debug!("Planting tree with monologue {:?}", id); debug!("Planting tree with monologue {:?}", id);
@ -874,7 +870,7 @@ fn plant_forest(
} else if i > 0 { } else if i > 0 {
e_trees.write(PlantTree(None)); e_trees.write(PlantTree(None));
} else { } else {
break break;
} }
i -= 1; i -= 1;
} }

@ -83,13 +83,11 @@ fn init_debug_ui(mut commands: Commands) {
}, },
)); ));
commands.spawn(( commands
.spawn((
DebuggingState::On, DebuggingState::On,
Name::new("Notice"), Name::new("Notice"),
children![( children![(Text::new(""), SyncResource::<Notice>::default(),)],
Text::new(""),
SyncResource::<Notice>::default(),
)],
GlobalZIndex(i32::MAX - 1), GlobalZIndex(i32::MAX - 1),
Node { Node {
max_width: Val::Percent(50.0), max_width: Val::Percent(50.0),
@ -97,7 +95,8 @@ fn init_debug_ui(mut commands: Commands) {
justify_self: JustifySelf::Start, justify_self: JustifySelf::Start,
..default() ..default()
}, },
)).observe(close_on_click); ))
.observe(close_on_click);
// "Turn on Debugging" button // "Turn on Debugging" button
commands commands
@ -391,10 +390,7 @@ fn toggle_debug(
}); });
} }
fn close_on_click( fn close_on_click(trigger: Trigger<Pointer<Click>>, mut query: Query<&mut Visibility>) {
trigger: Trigger<Pointer<Click>>,
mut query: Query<&mut Visibility>,
) {
if let Ok(mut v) = query.get_mut(trigger.target()) { if let Ok(mut v) = query.get_mut(trigger.target()) {
*v = Visibility::Hidden; *v = Visibility::Hidden;
} }

Loading…
Cancel
Save