• Stars
    star
    392
  • Rank 109,735 (Top 3 %)
  • Language
    Rust
  • License
    Apache License 2.0
  • Created almost 10 years ago
  • Updated about 1 month ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Generate cargo instructions at compile time in build scripts for use with the env! or option_env! macros

vergen - Emit cargo instructions from a build script

vergen, when used in conjunction with cargo build scripts can emit the following:

Current Release

docs.rs Crates.io Crates.io Crates.io codecov CI sponsor

Sponsors

Special thanks to the sponsors of this project

⚠️ This documention is for version 8 ⚠️

If you wish to refer to version 7 you can find that branch here

MSRV

The current minimum supported rust version is 1.65.0

Example Usage

See the documentation at docs.rs for example usage

Notes about the optional git2 dependency

This update to git2 picked up some security related features. In docker environments especially, this requires a safe.directory configuration. There are a couple methods for achieving this.

  1. If you control the build, you can add git config --global --add safe.directory /workspace to the build file.
  2. If you do not control the docker build, you can add git config --global --add safe.directory /workspace && before the actual command you are running when using docker run.
  3. If you do not control the docker build, you can mount a .gitconfig file at /root that includes the safe.directory configuration. I use this method myself when building static binaries with clux/muslrust.

docker run -v cargo-cache:/root/.cargo/registry -v (pwd):/volume -v ~/.gitconfig:/root/.gitconfig:ro --rm -t clux/muslrust:stable cargo build --release

See #126 for more discussion on the topic. If the solutions above do not work for your usecase, you can pin your vergen version to 7.4.3, with the caveat you will be exposed to the issues described at the link above.

Contributing

See the documentation at CONTRIBUTING.md

License

Licensed under either of

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.