From f79b8287f5bd43117e64ab6c04537b1c9d16755c Mon Sep 17 00:00:00 2001 From: Tamo Date: Mon, 26 Jul 2021 15:25:30 +0200 Subject: [PATCH] update vergen --- Cargo.lock | 109 ++++++++++++++++++++++++----- meilisearch-http/Cargo.toml | 2 +- meilisearch-http/build.rs | 9 +-- meilisearch-http/src/main.rs | 6 +- meilisearch-http/src/routes/mod.rs | 4 +- 5 files changed, 98 insertions(+), 32 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 0cc33b2e9..edb937d85 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -831,6 +831,26 @@ dependencies = [ "cfg-if 1.0.0", ] +[[package]] +name = "enum-iterator" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4eeac5c5edb79e4e39fe8439ef35207780a11f69c52cbe424ce3dfad4cb78de6" +dependencies = [ + "enum-iterator-derive", +] + +[[package]] +name = "enum-iterator-derive" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c134c37760b27a871ba422106eedbb8247da973a09e82558bf26d619c882b159" +dependencies = [ + "proc-macro2 1.0.27", + "quote 1.0.9", + "syn 1.0.73", +] + [[package]] name = "env_logger" version = "0.8.4" @@ -1067,12 +1087,37 @@ dependencies = [ "wasi 0.10.0+wasi-snapshot-preview1", ] +[[package]] +name = "getset" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24b328c01a4d71d2d8173daa93562a73ab0fe85616876f02500f53d82948c504" +dependencies = [ + "proc-macro-error", + "proc-macro2 1.0.27", + "quote 1.0.9", + "syn 1.0.73", +] + [[package]] name = "gimli" version = "0.24.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0e4075386626662786ddb0ec9081e7c7eeb1ba31951f447ca780ef9f5d568189" +[[package]] +name = "git2" +version = "0.13.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9831e983241f8c5591ed53f17d874833e2fa82cac2625f3888c50cbfe136cba" +dependencies = [ + "bitflags", + "libc", + "libgit2-sys", + "log", + "url", +] + [[package]] name = "glob" version = "0.3.0" @@ -1437,6 +1482,30 @@ version = "0.2.97" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "12b8adadd720df158f4d70dfe7ccc6adb0472d7c55ca83445f6a5ab3e36f8fb6" +[[package]] +name = "libgit2-sys" +version = "0.12.21+1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "86271bacd72b2b9e854c3dcfb82efd538f15f870e4c11af66900effb462f6825" +dependencies = [ + "cc", + "libc", + "libz-sys", + "pkg-config", +] + +[[package]] +name = "libz-sys" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de5435b8549c16d423ed0c03dbaafe57cf6c3344744f1242520d59c9d8ecec66" +dependencies = [ + "cc", + "libc", + "pkg-config", + "vcpkg", +] + [[package]] name = "linked-hash-map" version = "0.5.4" @@ -2460,15 +2529,6 @@ dependencies = [ "semver 0.11.0", ] -[[package]] -name = "rustc_version" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" -dependencies = [ - "semver 1.0.3", -] - [[package]] name = "rustls" version = "0.19.1" @@ -2482,6 +2542,12 @@ dependencies = [ "webpki", ] +[[package]] +name = "rustversion" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61b3909d758bb75c79f23d4736fac9433868679d3ad2ea7a61e3c25cfda9a088" + [[package]] name = "ryu" version = "1.0.5" @@ -2531,12 +2597,6 @@ dependencies = [ "semver-parser 0.10.2", ] -[[package]] -name = "semver" -version = "1.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f3aac57ee7f3272d8395c6e4f502f434f0e289fcd62876f70daa008c20dcabe" - [[package]] name = "semver-parser" version = "0.7.0" @@ -3299,6 +3359,12 @@ dependencies = [ "serde", ] +[[package]] +name = "vcpkg" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" + [[package]] name = "vec_map" version = "0.8.2" @@ -3307,13 +3373,18 @@ checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" [[package]] name = "vergen" -version = "3.2.0" +version = "5.1.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7141e445af09c8919f1d5f8a20dae0b20c3b57a45dee0d5823c6ed5d237f15a" +checksum = "542f37b4798c879409865dde7908e746d836f77839c3a6bea5c8b4e4dcf6620b" dependencies = [ - "bitflags", + "anyhow", + "cfg-if 1.0.0", "chrono", - "rustc_version 0.4.0", + "enum-iterator", + "getset", + "git2", + "rustversion", + "thiserror", ] [[package]] diff --git a/meilisearch-http/Cargo.toml b/meilisearch-http/Cargo.toml index 5931d8d06..3b1f5ff57 100644 --- a/meilisearch-http/Cargo.toml +++ b/meilisearch-http/Cargo.toml @@ -18,7 +18,7 @@ hex = { version = "0.4.3", optional = true } reqwest = { version = "0.11.3", features = ["blocking", "rustls-tls"], default-features = false, optional = true } sha-1 = { version = "0.9.4", optional = true } tempfile = { version = "3.1.0", optional = true } -vergen = "3.1.0" +vergen = { version = "5.1.13", default-features = false, features = ["build", "git"] } zip = { version = "0.5.12", optional = true } [dependencies] diff --git a/meilisearch-http/build.rs b/meilisearch-http/build.rs index 557e04fe7..e33acc892 100644 --- a/meilisearch-http/build.rs +++ b/meilisearch-http/build.rs @@ -1,12 +1,7 @@ -use vergen::{generate_cargo_keys, ConstantsFlags}; +use vergen::{vergen, Config}; fn main() { - // Setup the flags, toggling off the 'SEMVER_FROM_CARGO_PKG' flag - let mut flags = ConstantsFlags::all(); - flags.toggle(ConstantsFlags::SEMVER_FROM_CARGO_PKG); - - // Generate the 'cargo:' key output - generate_cargo_keys(ConstantsFlags::all()).expect("Unable to generate the cargo keys!"); + vergen(Config::default()).unwrap(); #[cfg(feature = "mini-dashboard")] mini_dashboard::setup_mini_dashboard().expect("Could not load the mini-dashboard assets"); diff --git a/meilisearch-http/src/main.rs b/meilisearch-http/src/main.rs index dedb6cc26..033c79408 100644 --- a/meilisearch-http/src/main.rs +++ b/meilisearch-http/src/main.rs @@ -105,11 +105,11 @@ async fn run_http(data: Data, opt: Opt) -> Result<(), Box pub fn print_launch_resume(opt: &Opt, data: &Data) { let commit_sha = match option_env!("COMMIT_SHA") { - Some("") | None => env!("VERGEN_SHA"), + Some("") | None => env!("VERGEN_GIT_SHA"), Some(commit_sha) => commit_sha, }; - let commit_date = match option_env!("COMMIT_DATE") { - Some("") | None => env!("VERGEN_COMMIT_DATE"), + let commit_date = match dbg!(option_env!("COMMIT_DATE")) { + Some("") | None => dbg!(env!("VERGEN_GIT_COMMIT_TIMESTAMP")), Some(commit_date) => commit_date, }; diff --git a/meilisearch-http/src/routes/mod.rs b/meilisearch-http/src/routes/mod.rs index fd30cd519..184616892 100644 --- a/meilisearch-http/src/routes/mod.rs +++ b/meilisearch-http/src/routes/mod.rs @@ -246,11 +246,11 @@ struct VersionResponse { async fn get_version(_data: GuardedData) -> HttpResponse { let commit_sha = match option_env!("COMMIT_SHA") { - Some("") | None => env!("VERGEN_SHA"), + Some("") | None => env!("VERGEN_GIT_SHA"), Some(commit_sha) => commit_sha, }; let commit_date = match option_env!("COMMIT_DATE") { - Some("") | None => env!("VERGEN_COMMIT_DATE"), + Some("") | None => env!("VERGEN_GIT_COMMIT_TIMESTAMP"), Some(commit_date) => commit_date, };