Crates.io | vergen-git2 |
lib.rs | vergen-git2 |
version | 1.0.1 |
source | src |
created_at | 2024-01-30 00:20:09.723811 |
updated_at | 2024-09-17 15:00:45.858318 |
description | Generate 'cargo:rustc-env' instructions via 'build.rs' for use in your code via the 'env!' macro |
homepage | https://github.com/rustyhorde/vergen |
repository | https://github.com/rustyhorde/vergen |
max_upload_size | |
id | 1119550 |
size | 107,944 |
vergen
, vergen-git2
, vergen-gitcl
, vergen-gix
, vergen-pretty
The vergen
suite of tools allow you to embed environment variables generated at build time into your code. For example,
I may care about the last git commit number and need to reference it in my code. You can configure one of the vergen
git tools in cargo build scripts and can emit a VERGEN_GIT_SHA
environment variable for use in your code.
The vergen
suite of tools can emit the following output:
cargo:rustc-env=VAR=VALUE
for each feature you have enabled. These can be referenced with the env!
or option_env!
macro in your code.cargo:rerun-if-changed=.git/HEAD
. This is done to ensure any git instructions are regenerated when commits are made.cargo:rerun-if-changed=.git/<path_to_ref>
. This is done to ensure any git instructions are regenerated when commits are made.cargo:warning
outputs if the
fail_on_error
feature is not enabled and the requested variable is defaulted through error or
the idempotent
flag.cargo:rerun-if-changed=build.rs
to rerun instruction emission if the build.rs
file changed.cargo:rerun-if-env-changed=VERGEN_IDEMPOTENT
to rerun instruction emission if the VERGEN_IDEMPOTENT
environment variable has changed.cargo:rerun-if-env-changed=SOURCE_DATE_EPOCH
to rerun instruction emission if the SOURCE_DATE_EPOCH
environment variable has changed.vergen-pretty
is a macro and pretty printer for vergen
based cargo instruction output.
The current minimum supported rust version is 1.74.0
vergen-git2
, vergen-gitcl
, and vergen-gix
that will be versioned independently from vergen
.vergen
when you need to generate git based cargo build script instructions.vergen
library.vergen
now contains the build
, cargo
, rustc
, and sysinfo
feature implementations. These features are re-exported by the new libraries allowing you to configure the output as you have previously.AddCustomEntries
trait. Implementing this trait allows you to include your own custom Cargo instructions, using vergen
as the engine to generate them. See the AddCustomEntries
docs for more information.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.
See the documentation at MIGRATING_v8_to_v9.md
See the documentation at CONTRIBUTING.md
Licensed under either of
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.