Update vergen to version 9 by using the new vergen-gitctl libary

Signed-off-by: yubiuser <github@yubiuser.dev>
This commit is contained in:
yubiuser 2024-08-28 13:13:29 +02:00
parent dcd592bafb
commit dc22910673
No known key found for this signature in database
3 changed files with 161 additions and 11 deletions

149
Cargo.lock generated
View file

@ -419,6 +419,41 @@ dependencies = [
"cipher", "cipher",
] ]
[[package]]
name = "darling"
version = "0.20.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6f63b86c8a8826a49b8c21f08a2d07338eec8d900540f8630dc76284be802989"
dependencies = [
"darling_core",
"darling_macro",
]
[[package]]
name = "darling_core"
version = "0.20.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "95133861a8032aaea082871032f5815eb9e98cef03fa916ab4500513994df9e5"
dependencies = [
"fnv",
"ident_case",
"proc-macro2",
"quote",
"strsim",
"syn 2.0.66",
]
[[package]]
name = "darling_macro"
version = "0.20.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806"
dependencies = [
"darling_core",
"quote",
"syn 2.0.66",
]
[[package]] [[package]]
name = "dasp_sample" name = "dasp_sample"
version = "0.11.0" version = "0.11.0"
@ -451,6 +486,37 @@ dependencies = [
"powerfmt", "powerfmt",
] ]
[[package]]
name = "derive_builder"
version = "0.20.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0350b5cb0331628a5916d6c5c0b72e97393b8b6b03b47a9284f4e7f5a405ffd7"
dependencies = [
"derive_builder_macro",
]
[[package]]
name = "derive_builder_core"
version = "0.20.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d48cda787f839151732d396ac69e3473923d54312c070ee21e9effcaa8ca0b1d"
dependencies = [
"darling",
"proc-macro2",
"quote",
"syn 2.0.66",
]
[[package]]
name = "derive_builder_macro"
version = "0.20.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "206868b8242f27cecce124c19fd88157fbd0dd334df2587f36417bafbc85097b"
dependencies = [
"derive_builder_core",
"syn 2.0.66",
]
[[package]] [[package]]
name = "digest" name = "digest"
version = "0.10.7" version = "0.10.7"
@ -690,6 +756,18 @@ dependencies = [
"wasi", "wasi",
] ]
[[package]]
name = "getset"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e45727250e75cc04ff2846a66397da8ef2b3db8e40e0cef4df67950a07621eb9"
dependencies = [
"proc-macro-error",
"proc-macro2",
"quote",
"syn 1.0.109",
]
[[package]] [[package]]
name = "gimli" name = "gimli"
version = "0.29.0" version = "0.29.0"
@ -1264,6 +1342,12 @@ dependencies = [
"syn 2.0.66", "syn 2.0.66",
] ]
[[package]]
name = "ident_case"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39"
[[package]] [[package]]
name = "idna" name = "idna"
version = "1.0.0" version = "1.0.0"
@ -1641,7 +1725,7 @@ dependencies = [
"tokio-util", "tokio-util",
"url", "url",
"uuid", "uuid",
"vergen", "vergen-gitcl",
] ]
[[package]] [[package]]
@ -2264,6 +2348,30 @@ dependencies = [
"toml_edit 0.21.1", "toml_edit 0.21.1",
] ]
[[package]]
name = "proc-macro-error"
version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c"
dependencies = [
"proc-macro-error-attr",
"proc-macro2",
"quote",
"syn 1.0.109",
"version_check",
]
[[package]]
name = "proc-macro-error-attr"
version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869"
dependencies = [
"proc-macro2",
"quote",
"version_check",
]
[[package]] [[package]]
name = "proc-macro2" name = "proc-macro2"
version = "1.0.85" version = "1.0.85"
@ -2814,6 +2922,12 @@ version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3"
[[package]]
name = "strsim"
version = "0.11.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f"
[[package]] [[package]]
name = "subtle" name = "subtle"
version = "2.5.0" version = "2.5.0"
@ -3334,14 +3448,41 @@ dependencies = [
[[package]] [[package]]
name = "vergen" name = "vergen"
version = "8.3.1" version = "9.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e27d6bdd219887a9eadd19e1c34f32e47fa332301184935c6d9bca26f3cca525" checksum = "c32e7318e93a9ac53693b6caccfb05ff22e04a44c7cf8a279051f24c09da286f"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"cfg-if", "derive_builder",
"rustversion", "rustversion",
"time", "time",
"vergen-lib",
]
[[package]]
name = "vergen-gitcl"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3bbdc9746577cb4767f218d320ee0b623d415e8130332f8f562b910b61cc2c4e"
dependencies = [
"anyhow",
"derive_builder",
"rustversion",
"time",
"vergen",
"vergen-lib",
]
[[package]]
name = "vergen-lib"
version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e06bee42361e43b60f363bad49d63798d0f42fb1768091812270eca00c784720"
dependencies = [
"anyhow",
"derive_builder",
"getset",
"rustversion",
] ]
[[package]] [[package]]

View file

@ -62,7 +62,7 @@ data-encoding = "2.5"
[build-dependencies] [build-dependencies]
rand = "0.8" rand = "0.8"
vergen = { version = "8", default-features = false, features = ["build", "git", "gitcl"] } vergen-gitcl = { version = "1.0.0", default-features = false, features = ["build"] }
[dev-dependencies] [dev-dependencies]
env_logger = "0.11.2" env_logger = "0.11.2"

View file

@ -1,11 +1,19 @@
use rand::{distributions::Alphanumeric, Rng}; use rand::{distributions::Alphanumeric, Rng};
use vergen::EmitBuilder; use vergen_gitcl::{BuildBuilder, Emitter, GitclBuilder};
fn main() { fn main() -> Result<(), Box<dyn std::error::Error>> {
EmitBuilder::builder() let gitcl = GitclBuilder::default()
.build_date() // outputs 'VERGEN_BUILD_DATE' .sha(true) // outputs 'VERGEN_GIT_SHA', and sets the 'short' flag true
.git_sha(true) // outputs 'VERGEN_GIT_SHA', and sets the 'short' flag true .commit_date(true) // outputs 'VERGEN_GIT_COMMIT_DATE'
.git_commit_date() // outputs 'VERGEN_GIT_COMMIT_DATE' .build()?;
let build = BuildBuilder::default()
.build_date(true) // outputs 'VERGEN_BUILD_DATE'
.build()?;
Emitter::default()
.add_instructions(&build)?
.add_instructions(&gitcl)?
.emit() .emit()
.expect("Unable to generate the cargo keys!"); .expect("Unable to generate the cargo keys!");
let build_id = match std::env::var("SOURCE_DATE_EPOCH") { let build_id = match std::env::var("SOURCE_DATE_EPOCH") {
@ -18,4 +26,5 @@ fn main() {
}; };
println!("cargo:rustc-env=LIBRESPOT_BUILD_ID={build_id}"); println!("cargo:rustc-env=LIBRESPOT_BUILD_ID={build_id}");
Ok(())
} }