git-build-version

Crates.iogit-build-version
lib.rsgit-build-version
version0.1.2
sourcesrc
created_at2015-12-10 11:48:20.037309
updated_at2016-06-25 13:27:09.450496
descriptionAllows easy inclusion of the git repository version in your project
homepage
repositoryhttps://github.com/cstorey/git-build-version/
max_upload_size
id3606
size3,750
Ceri Storey (cstorey)

documentation

README

git-build-version

Makes it easy to include a version (as provided by git describe) in your crate. For example:

In Cargo.toml:

[package]
name = "my-lovely-package"
# ...
build = "build.rs"

[build-dependencies]
git-build-version = "*"

In build.rs:

extern crate git_build_version;

const PACKAGE_TOP_DIR : &'static str = ".";

fn main() {
    git_version::write_version(PACKAGE_TOP_DIR).expect("Saving git version");
}

This will write out a file named version.rs that can be included into your source as follows. Eg: in your src/main.rs:

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

fn main() {
    println!("Version: {}", VERSION);
}
Commit count: 16

cargo fmt