4 releases

new 0.1.4 Apr 29, 2025
0.1.3 Aug 30, 2024
0.1.2 Aug 13, 2024
0.1.1 Jul 10, 2024
0.1.0 Jul 9, 2024

#200 in Build Utils

Download history 2/week @ 2025-02-05

255 downloads per month

MIT license

9KB
188 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.6–1.5MB
~33K SLoC