Skip to content

Commit dc22910

Browse files
committed
Update vergen to version 9 by using the new vergen-gitctl libary
Signed-off-by: yubiuser <[email protected]>
1 parent dcd592b commit dc22910

3 files changed

Lines changed: 161 additions & 11 deletions

File tree

Cargo.lock

Lines changed: 145 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

core/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ data-encoding = "2.5"
6262

6363
[build-dependencies]
6464
rand = "0.8"
65-
vergen = { version = "8", default-features = false, features = ["build", "git", "gitcl"] }
65+
vergen-gitcl = { version = "1.0.0", default-features = false, features = ["build"] }
6666

6767
[dev-dependencies]
6868
env_logger = "0.11.2"

core/build.rs

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,19 @@
11
use rand::{distributions::Alphanumeric, Rng};
2-
use vergen::EmitBuilder;
2+
use vergen_gitcl::{BuildBuilder, Emitter, GitclBuilder};
33

4-
fn main() {
5-
EmitBuilder::builder()
6-
.build_date() // outputs 'VERGEN_BUILD_DATE'
7-
.git_sha(true) // outputs 'VERGEN_GIT_SHA', and sets the 'short' flag true
8-
.git_commit_date() // outputs 'VERGEN_GIT_COMMIT_DATE'
4+
fn main() -> Result<(), Box<dyn std::error::Error>> {
5+
let gitcl = GitclBuilder::default()
6+
.sha(true) // outputs 'VERGEN_GIT_SHA', and sets the 'short' flag true
7+
.commit_date(true) // outputs 'VERGEN_GIT_COMMIT_DATE'
8+
.build()?;
9+
10+
let build = BuildBuilder::default()
11+
.build_date(true) // outputs 'VERGEN_BUILD_DATE'
12+
.build()?;
13+
14+
Emitter::default()
15+
.add_instructions(&build)?
16+
.add_instructions(&gitcl)?
917
.emit()
1018
.expect("Unable to generate the cargo keys!");
1119
let build_id = match std::env::var("SOURCE_DATE_EPOCH") {
@@ -18,4 +26,5 @@ fn main() {
1826
};
1927

2028
println!("cargo:rustc-env=LIBRESPOT_BUILD_ID={build_id}");
29+
Ok(())
2130
}

0 commit comments

Comments
 (0)