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,
)
.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
let clean = Command::new("git")
@ -37,9 +44,9 @@ fn write_version_file() {
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");
write!(file, "0.0.0-{now}+{git_sha}-{build_type}").expect("Write version to VERSION file");
} 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");
}
}

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

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

Loading…
Cancel
Save