Skip to content

Commit

Permalink
Use git describe version (fix #191)
Browse files Browse the repository at this point in the history
  • Loading branch information
daa84 committed Apr 23, 2019
1 parent e9655f0 commit 6a7804c
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 2 deletions.
10 changes: 10 additions & 0 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ winres = "0.1"

[build-dependencies]
phf_codegen = "0.7"
build-version = "0.1.1"

[dependencies.pango]
features = ["v1_38"]
Expand Down
3 changes: 3 additions & 0 deletions build.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
extern crate phf_codegen;
extern crate build_version;

#[cfg(windows)]
extern crate winres;
Expand All @@ -9,6 +10,8 @@ use std::io::{BufWriter, Write};
use std::path::Path;

fn main() {
build_version::write_version_file().expect("Failed to write version.rs file");

if cfg!(target_os = "windows") {
println!("cargo:rustc-link-search=native=C:\\msys64\\mingw64\\lib");

Expand Down
4 changes: 3 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,13 @@ use ui::Ui;
use clap::{App, Arg, ArgMatches};
use shell::ShellOptions;

include!(concat!(env!("OUT_DIR"), "/version.rs"));

fn main() {
env_logger::init();

let matches = App::new("NeovimGtk")
.version(env!("CARGO_PKG_VERSION"))
.version(GIT_BUILD_VERSION.unwrap_or(env!("CARGO_PKG_VERSION")))
.author(env!("CARGO_PKG_AUTHORS"))
.about(misc::about_comments().as_str())
.arg(Arg::with_name("no-fork")
Expand Down
2 changes: 1 addition & 1 deletion src/ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ fn on_help_about(window: &gtk::ApplicationWindow) {
let about = AboutDialog::new();
about.set_transient_for(window);
about.set_program_name("NeovimGtk");
about.set_version(env!("CARGO_PKG_VERSION"));
about.set_version(::GIT_BUILD_VERSION.unwrap_or(env!("CARGO_PKG_VERSION")));
about.set_logo_icon_name("org.daa.NeovimGtk");
about.set_authors(&[env!("CARGO_PKG_AUTHORS")]);
about.set_comments(misc::about_comments().as_str());
Expand Down

0 comments on commit 6a7804c

Please sign in to comment.