diff --git a/rust/Cargo.lock b/rust/Cargo.lock index 7228fc3f4..6b13401d0 100644 --- a/rust/Cargo.lock +++ b/rust/Cargo.lock @@ -2054,6 +2054,7 @@ dependencies = [ "connlib-client-shared", "connlib-shared", "firezone-cli-utils", + "git-version", "hostname", "ipconfig", "keyring", @@ -2459,6 +2460,26 @@ dependencies = [ "winapi", ] +[[package]] +name = "git-version" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ad568aa3db0fcbc81f2f116137f263d7304f512a1209b35b85150d3ef88ad19" +dependencies = [ + "git-version-macro", +] + +[[package]] +name = "git-version-macro" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53010ccb100b96a67bc32c0175f0ed1426b31b655d562898e57325f81c023ac0" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.41", +] + [[package]] name = "glib" version = "0.15.12" diff --git a/rust/windows-client/src-tauri/Cargo.toml b/rust/windows-client/src-tauri/Cargo.toml index 0c96561b4..04648f5c4 100755 --- a/rust/windows-client/src-tauri/Cargo.toml +++ b/rust/windows-client/src-tauri/Cargo.toml @@ -18,6 +18,7 @@ clap = { version = "4.4", features = ["derive", "env"] } connlib-client-shared = { workspace = true } connlib-shared = { workspace = true } firezone-cli-utils = { workspace = true } +git-version = "0.3.9" # Same crate Hickory uses hostname = "0.3.1" # This is the same crate hickory uses to get system resolvers diff --git a/rust/windows-client/src-tauri/src/client.rs b/rust/windows-client/src-tauri/src/client.rs index 0fb8773c3..e823bb20f 100644 --- a/rust/windows-client/src-tauri/src/client.rs +++ b/rust/windows-client/src-tauri/src/client.rs @@ -15,6 +15,17 @@ mod resolvers; mod settings; mod wintun_install; +/// Output of `git describe` at compile time +/// e.g. `1.0.0-pre.4-20-ged5437c88-modified` where: +/// +/// * `1.0.0-pre.4` is the most recent ancestor tag +/// * `20` is the number of commits since then +/// * `g` doesn't mean anything +/// * `ed5437c88` is the Git commit hash +/// * `-modified` is present if the working dir has any changes from that commit number +const GIT_VERSION: &str = + git_version::git_version!(args = ["--always", "--dirty=-modified", "--tags"]); + /// Prevents a problem where changing the args to `gui::run` breaks static analysis on non-Windows targets, where the gui is stubbed out #[allow(dead_code)] pub(crate) struct GuiParams { diff --git a/rust/windows-client/src-tauri/src/client/gui.rs b/rust/windows-client/src-tauri/src/client/gui.rs index 5c6e8c182..83b74775e 100755 --- a/rust/windows-client/src-tauri/src/client/gui.rs +++ b/rust/windows-client/src-tauri/src/client/gui.rs @@ -123,6 +123,7 @@ pub(crate) fn run(params: client::GuiParams) -> Result<()> { // It's hard to set it up before Tauri's setup, because Tauri knows where all the config and data go in AppData and I don't want to replicate their logic. let logging_handles = client::logging::setup(&advanced_settings.log_filter)?; tracing::info!("started log"); + tracing::info!("GIT_VERSION = {}", crate::client::GIT_VERSION); // I checked this on my dev system to make sure Powershell is doing what I expect and passing the argument back to us after relaunch tracing::debug!("flag_elevated: {flag_elevated}");