#build #version #gitversion

build gitversion_build

Build crate with versions by gitversion

3 releases

0.1.3 Aug 30, 2024
0.1.2 Aug 13, 2024
0.1.1 Jul 10, 2024
0.1.0 Jul 9, 2024

#248 in Build Utils

41 downloads per month

MIT license

6KB
78 lines

gitversion_build_rs

Build crate with versions by gitversion

usage

Install gitversion cli first.

Add gitversion_build as build-dependencies

cargo add gitversion_build --build

Add the code to your build.rs

gitversion_build::inject_version().unwrap();

Then you can get CARGO_PKG_VERSION CARGO_PKG_VERSION_MAJOR CARGO_PKG_VERSION_MINOR CARGO_PKG_VERSION_PATCH CARGO_PKG_VERSION_PRE by using env! in your code.

A example at example/demo .

Dependencies

~0.7–1.6MB
~35K SLoC