vergen - A suite of libraries for generating cargo instructions from a Cargo build script
vergen, vergen-git2, vergen-gitcl, vergen-gix
When used in conjunction with cargo build scripts can emit the following output:
- Will emit
cargo:rustc-env=VAR=VALUEfor each feature you have enabled. These can be referenced with theenv!oroption_env!macro in your code. - If using one of the git enabled libraries, will emit
cargo:rerun-if-changed=.git/HEAD. This is done to ensure any git instructions are regenerated when commits are made. - If using one of the git enabled libraries, will emit
cargo:rerun-if-changed=.git/<path_to_ref>. This is done to ensure any git instructions are regenerated when commits are made. - Can emit
cargo:warningoutputs if thefail_on_errorfeature is not enabled and the requested variable is defaulted through error or theidempotentflag. - Will emit
cargo:rerun-if-changed=build.rsto rerun instruction emission if thebuild.rsfile changed. - Will emit
cargo:rerun-if-env-changed=VERGEN_IDEMPOTENTto rerun instruction emission if theVERGEN_IDEMPOTENTenvironment variable has changed. - Will emit
cargo:rerun-if-env-changed=SOURCE_DATE_EPOCHto rerun instruction emission if theSOURCE_DATE_EPOCHenvironment variable has changed.
Current Releases
vergen
vergen-git2
vergen-gitcl
vergen-gix
MSRV
The current minimum supported rust version is 1.70.0
⚠️ Notes on version 9 ⚠️
- Version 9 introduces 3 new libraries,
vergen-git2,vergen-gitcl, andvergen-gixthat will be versioned independently fromvergen. - The 3 new libraries are intended to be drop in replacements for
vergenwhen you need to generate git based cargo build script instructions. - The git based features have been removed from the base
vergenlibrary. vergennow contains thebuild,cargo,rustc, andsysinfofeature implementations. These features are re-exported by the new libraries allowing you to configure the output as you have previously.- Version 9 introduces the
AddCustomEntriestrait. Implementing this trait allows you to include your own custom Cargo instructions, usingvergenas the engine to generate them. See theAddCustomEntriesdocs for more information. - The version 8 branch will be maintained for some time.
Why?
This was done to resolve issues with Cargo feature unification and mutually exclusive features. Previous versions of vergen had 3 mutually exclusive features (git2, gitcl, and gix). Feature unification could cause compilation issues if you had included a dependency that also used vergen but had configured a different git feature. Splitting the git backends into separate libraries helps alleviate this issue.
Migration from version 8
See the documentation at MIGRATING_v8_to_v9.md
Documentation
Contributing
See the documentation at CONTRIBUTING.md
License
Licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE or https://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or https://opensource.org/licenses/MIT) at your option.
Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.