From d80f58f7bc09d6e858af0a82c6987d987ffdb407 Mon Sep 17 00:00:00 2001 From: Wez Furlong Date: Sat, 23 Mar 2019 23:45:14 -0700 Subject: [PATCH] use vergen to embed the git version info in the output --- Cargo.toml | 6 ++++++ build.rs | 10 ++++++++++ src/main.rs | 5 +---- 3 files changed, 17 insertions(+), 4 deletions(-) create mode 100644 build.rs diff --git a/Cargo.toml b/Cargo.toml index 44c25ecff..40bf946fb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,6 +3,10 @@ authors = ["Wez Furlong "] name = "wezterm" version = "0.1.0" edition = "2018" +build = "build.rs" + +[build-dependencies] +vergen = "3" [dependencies] base91 = { path = "base91" } @@ -86,6 +90,8 @@ force-fontconfig = ["fontconfig"] [patch.crates-io] # We need https://github.com/tomaka/glutin/pull/1099 glutin = { git = "https://github.com/yvt/glutin", branch="patch-macos-iscurrent" } +# This allows using the git tab in the help output +structopt-derive = { git = "https://github.com/wez/structopt", branch="vergen" } [workspace] diff --git a/build.rs b/build.rs new file mode 100644 index 000000000..2257407a8 --- /dev/null +++ b/build.rs @@ -0,0 +1,10 @@ +use vergen::{generate_cargo_keys, ConstantsFlags}; + +fn main() { + // Setup the flags, toggling off the 'SEMVER_FROM_CARGO_PKG' flag + let mut flags = ConstantsFlags::all(); + flags.toggle(ConstantsFlags::SEMVER_FROM_CARGO_PKG); + + // Generate the 'cargo:' key output + generate_cargo_keys(ConstantsFlags::all()).expect("Unable to generate the cargo keys!"); +} diff --git a/src/main.rs b/src/main.rs index 459d7b183..74e4f15c0 100644 --- a/src/main.rs +++ b/src/main.rs @@ -61,10 +61,7 @@ fn get_shell() -> Result { // != #[derive(Debug, StructOpt)] -#[structopt( - name = "wezterm", - about = "Wez's Terminal Emulator\nhttp://github.com/wez/wezterm" -)] +#[structopt(about = "Wez's Terminal Emulator\nhttp://github.com/wez/wezterm")] #[structopt(raw(setting = "structopt::clap::AppSettings::ColoredHelp"))] struct Opt { /// Skip loading ~/.wezterm.toml