3 releases
Uses old Rust 2015
| 0.1.2 | Jun 25, 2016 |
|---|---|
| 0.1.1 | Jan 15, 2016 |
| 0.1.0 | Dec 10, 2015 |
#9 in #inclusion
Used in 2 crates
3KB
51 lines
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);
}
Dependencies
~10MB
~269K SLoC