Skip to content

Commit

Permalink
Add some more build-time diagnostics to the about window
Browse files Browse the repository at this point in the history
  • Loading branch information
melody-rs committed Aug 16, 2024
1 parent 1140aa2 commit fc886ae
Show file tree
Hide file tree
Showing 7 changed files with 212 additions and 9 deletions.
161 changes: 159 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ async-std.workspace = true
futures-lite.workspace = true

git-version = "0.3.9"
shadow-rs = "0.32.0"

# Native
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
Expand Down Expand Up @@ -264,6 +265,9 @@ features = ["webgpu", "webgl"]
[features]
steamworks = ["dep:steamworks"]

[build-dependencies]
shadow-rs = "0.32.0"

[target.'cfg(windows)'.build-dependencies]
winres = "0.1"

Expand Down
2 changes: 2 additions & 0 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,6 @@ fn main() {

let _ = res.compile();
}

shadow_rs::new().unwrap();
}
13 changes: 11 additions & 2 deletions crates/core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,16 @@ pub struct UpdateState<'res> {
pub modified_during_prev_frame: &'res mut bool,
pub project_manager: &'res mut ProjectManager,

pub build_diagnostics: &'static BuildDiagnostics,
}

pub struct BuildDiagnostics {
pub build_time: &'static str,
pub git_revision: &'static str,
pub rustc_version: &'static str,
pub cargo_version: &'static str,
pub build_os: &'static str,
pub is_debug: bool,
}

/// This stores whether or not there are unsaved changes in any file in the current project and is
Expand Down Expand Up @@ -206,7 +215,7 @@ impl<'res> UpdateState<'res> {
modified: self.modified.clone(),
modified_during_prev_frame: self.modified_during_prev_frame,
project_manager: self.project_manager,
git_revision: self.git_revision,
build_diagnostics: self.build_diagnostics,
}
}

Expand All @@ -230,7 +239,7 @@ impl<'res> UpdateState<'res> {
modified: self.modified.clone(),
modified_during_prev_frame: self.modified_during_prev_frame,
project_manager: self.project_manager,
git_revision: self.git_revision,
build_diagnostics: self.build_diagnostics,
}
}

Expand Down
23 changes: 22 additions & 1 deletion crates/ui/src/windows/about.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,28 @@ impl luminol_core::Window for Window {

ui.separator();
ui.label(format!("Luminol version {}", env!("CARGO_PKG_VERSION")));
ui.label(format!("git-rev {}", update_state.git_revision));
if update_state.build_diagnostics.is_debug {
ui.label("Debug build");
} else {
ui.label("Release build");
}
ui.label(format!(
"git-rev {}",
update_state.build_diagnostics.git_revision
));
ui.label(format!(
"built on {}",
update_state.build_diagnostics.build_time
));
ui.label(format!(
"built with {} {}",
update_state.build_diagnostics.rustc_version,
update_state.build_diagnostics.cargo_version
));
ui.label(format!(
"build OS: {}",
update_state.build_diagnostics.build_os
));
ui.separator();

ui.label("Luminol is a FOSS version of the RPG Maker XP editor.");
Expand Down
4 changes: 2 additions & 2 deletions src/app/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@

use std::sync::Arc;

use crate::lumi::Lumi;
#[cfg(feature = "steamworks")]
use crate::steam::Steamworks;
use crate::{lumi::Lumi, BUILD_DIAGNOSTIC};

#[cfg(not(target_arch = "wasm32"))]
mod log_window;
Expand Down Expand Up @@ -344,7 +344,7 @@ impl luminol_eframe::App for App {
modified: self.modified.clone(),
modified_during_prev_frame: &mut self.modified_during_prev_frame,
project_manager: &mut self.project_manager,
git_revision: crate::git_revision(),
build_diagnostics: &BUILD_DIAGNOSTIC,
};

// If a file/folder picker is open, prevent the user from interacting with the application
Expand Down
Loading

0 comments on commit fc886ae

Please sign in to comment.