• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

scripts/H03-May-2022-1411

src/H03-May-2022-855478

.cargo-checksum.jsonH A D03-May-202289 11

.cargo_vcs_info.jsonH A D01-Jan-197074 65

.gitignoreH A D01-Jan-197028 54

.gitlab-ci.ymlH A D01-Jan-1970655 3530

.travis.ymlH A D01-Jan-19701.5 KiB4638

Cargo.tomlH A D01-Jan-19701.2 KiB4136

Cargo.toml.orig-cargoH A D01-Jan-1970562 2622

LICENSE-APACHEH A D01-Jan-197010.6 KiB202169

LICENSE-MITH A D01-Jan-19701 KiB2622

README.mdH A D01-Jan-19704.7 KiB12996

appveyor.ymlH A D01-Jan-19704.7 KiB135118

build.rsH A D01-Jan-1970173 108

README.md

1# vergen
2## Current Release
3[![Crates.io](https://img.shields.io/crates/v/vergen.svg)](https://crates.io/crates/vergen)
4[![Crates.io](https://img.shields.io/crates/l/vergen.svg)](https://crates.io/crates/vergen)
5[![Crates.io](https://img.shields.io/crates/d/vergen.svg)](https://crates.io/crates/vergen)
6
7## Build Status
8|              |                                                                                   |
9---------------|-----------------------------------------------------------------------------------|
10| Travis       | [![Build Status](https://travis-ci.org/rustyhorde/vergen.svg?branch=master)](https://travis-ci.org/rustyhorde/vergen)|
11| GitLab CI/CD | [![pipeline status](https://gitlab.com/rustyhorde/vergen/badges/master/pipeline.svg)](https://gitlab.com/rustyhorde/vergen/commits/master)|
12| Appveyor     | [![Build status](https://ci.appveyor.com/api/projects/status/rcdjlx0sxvk3wnww/branch/master?svg=true)](https://ci.appveyor.com/project/CraZySacX/vergen/branch/master)|
13
14## Code Coverage
15[![codecov](https://codecov.io/gh/rustyhorde/vergen/branch/master/graph/badge.svg)](https://codecov.io/gh/rustyhorde/vergen)
16
17## Version 3.x.x
18Introduces `generate_cargo_keys()` and support for rebuild when `.git/HEAD` changes.
19Internally converted to use `failure` so `Result` is no longer exported and changed to the Rust 2018
20edition.
21
22**This means the 3.x.x version will only work in the beta and nightly channels until Rust 2018
23hits stable (12/06/18)**
24
25## Version 2.1.x
26[![Build Status](https://travis-ci.org/rustyhorde/vergen.svg?branch=v2.1.1)](https://travis-ci.org/rustyhorde/vergen)
27
28Backport of the 3.x.x changes to work on stable until Rust 2018 hits stable.
29
30## Version 2.0.x
31[![Build Status](https://travis-ci.org/rustyhorde/vergen.svg?branch=v2.0.4)](https://travis-ci.org/rustyhorde/vergen)
32
33Compatible with Version 1.x.x, but introduces a completely new way to use the constants without having to
34use the `include!` macro.
35
36## Documentation
37[Documentation](https://docs.rs/vergen)
38
39## Generate Compile Time Information
40`vergen`, when used in conjunction with cargo [build scripts], will
41generate environment variables to use with the `env!` macro.  Below
42is a list of the supported variables.
43
44Key                       | Sample Value
45--------------------------|----------------------------------------
46VERGEN_BUILD_TIMESTAMP    |2018-08-09T15:15:57.282334589+00:000
47VERGEN_BUILD_DATE         |2018-08-09
48VERGEN_SHA                |75b390dc6c05a6a4aa2791cc7b3934591803bc22
49VERGEN_SHA_SHORT          |75b390d
50VERGEN_COMMIT_DATE        |2018-08-08
51VERGEN_TARGET_TRIPLE      |x86_64-unknown-linux-gnu
52VERGEN_SEMVER             |v3.0.0
53VERGEN_SEMVER_LIGHTWEIGHT |v3.0.0
54VERGEN_RUSTC_SEMVER       |1.4.3
55VERGEN_RUSTC_CHANNEL      |stable
56VERGEN_HOST_TRIPLE        |x86_64-unknown-linux-gnu
57
58The variable generation can be toggled on or off at an individual level
59via [ConstantsFlags](crate::constants::ConstantsFlags)
60
61### Note on SEMVER
62`VERGEN_SEMVER` can be generated via `git describe` or by
63`env::var("CARGO_PKG_VERSION")`.
64
65By default, `SEMVER` uses `git describe` if possible, and falls back to `CARGO_PKG_VERSION`.
66
67If you wish to force `CARGO_PKG_VERSION`, toggle off `SEMVER` and toggle
68on `SEMVER_FROM_CARGO_PKG`.
69
70## Re-build On Changed HEAD
71`vergen` can also be configured to re-run `build.rs` when either `.git/HEAD` or
72the file that `.git/HEAD` points at changes.
73
74This can behavior can be toggled on or of with the [REBUILD_ON_HEAD_CHANGE] flag.
75
76[REBUILD_ON_HEAD_CHANGE]: crate::constants::ConstantsFlags::REBUILD_ON_HEAD_CHANGE
77[build scripts]: https://doc.rust-lang.org/cargo/reference/build-scripts.html
78
79## 'cargo:' Key Build Script Output
80```toml
81[package]
82#..
83build = "build.rs"
84
85[dependencies]
86#..
87
88[build-dependencies]
89vergen = "3"
90```
91
92### Example 'build.rs'
93
94```rust
95extern crate vergen;
96
97use vergen::{ConstantsFlags, generate_cargo_keys};
98
99fn main() {
100    // Setup the flags, toggling off the 'SEMVER_FROM_CARGO_PKG' flag
101    let mut flags = ConstantsFlags::all();
102    flags.toggle(ConstantsFlags::SEMVER_FROM_CARGO_PKG);
103
104    // Generate the 'cargo:' key output
105    generate_cargo_keys(ConstantsFlags::all()).expect("Unable to generate the cargo keys!");
106}
107```
108
109### Use the constants in your code
110
111```rust
112fn my_fn() {
113    println!("Build Timestamp: {}", env!("VERGEN_BUILD_TIMESTAMP"));
114}
115```
116
117## License
118
119Licensed under either of
120 * Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)
121 * MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)
122at your option.
123
124### Contribution
125
126Unless you explicitly state otherwise, any contribution intentionally submitted
127for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any
128additional terms or conditions.
129