| Crates.io | gitversion_build |
| lib.rs | gitversion_build |
| version | 0.1.4 |
| created_at | 2024-07-09 15:38:38.976312+00 |
| updated_at | 2025-04-29 08:24:45.662319+00 |
| description | Build crate with versions by gitversion |
| homepage | https://github.com/zhangchaoza/gitversion_build_rs |
| repository | https://github.com/zhangchaoza/gitversion_build_rs |
| max_upload_size | |
| id | 1297210 |
| size | 21,727 |
Build crate with versions by gitversion
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 .