From 1ce9918574c8f1713814fae429b6d2e42c095f61 Mon Sep 17 00:00:00 2001 From: Mirko von Leipzig Date: Thu, 12 Sep 2024 12:06:20 +0200 Subject: [PATCH 1/3] Embed build metadata into node and faucet --- CHANGELOG.md | 1 + Cargo.lock | 196 ++++++++++++++++++++++++++++++++ bin/faucet/Cargo.toml | 4 +- bin/faucet/build.rs | 13 ++- bin/faucet/src/main.rs | 21 +++- bin/node/Cargo.toml | 6 +- bin/node/build.rs | 9 ++ bin/node/src/main.rs | 20 +++- crates/utils/Cargo.toml | 9 ++ crates/utils/src/lib.rs | 1 + crates/utils/src/version/mod.rs | 185 ++++++++++++++++++++++++++++++ 11 files changed, 457 insertions(+), 8 deletions(-) create mode 100644 bin/node/build.rs create mode 100644 crates/utils/src/version/mod.rs diff --git a/CHANGELOG.md b/CHANGELOG.md index 42ece710b..2bbb3df8f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ - [BREAKING] Renamed `off-chain` and `on-chain` to `private` and `public` respectively for the account storage modes (#489). - Optimized state synchronizations by removing unnecessary fetching and parsing of note details (#462). - [BREAKING] Changed `GetAccountDetailsResponse` field to `details` (#481). +- Improve `--version` by adding build metadata (#495). ## 0.5.1 (2024-09-12) diff --git a/Cargo.lock b/Cargo.lock index 089948783..9a42d2ea9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -618,6 +618,38 @@ dependencies = [ "bytes", ] +[[package]] +name = "camino" +version = "1.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b96ec4966b5813e2c0507c1f86115c8c5abaadc3980879c3424042a02fd1ad3" +dependencies = [ + "serde", +] + +[[package]] +name = "cargo-platform" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24b1f0365a6c6bb4020cd05806fd0d33c44d38046b8bd7f0e40814b9763cabfc" +dependencies = [ + "serde", +] + +[[package]] +name = "cargo_metadata" +version = "0.18.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d886547e41f740c616ae73108f6eb70afe6d940c7bc697cb30f13daec073037" +dependencies = [ + "camino", + "cargo-platform", + "semver 1.0.23", + "serde", + "serde_json", + "thiserror", +] + [[package]] name = "cc" version = "1.1.20" @@ -813,6 +845,41 @@ dependencies = [ "typenum", ] +[[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", +] + +[[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", +] + [[package]] name = "deadpool" version = "0.12.1" @@ -862,6 +929,37 @@ dependencies = [ "powerfmt", ] +[[package]] +name = "derive_builder" +version = "0.20.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd33f37ee6a119146a1781d3356a7c26028f83d779b2e04ecd45fdc75c76877b" +dependencies = [ + "derive_builder_macro", +] + +[[package]] +name = "derive_builder_core" +version = "0.20.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7431fa049613920234f22c47fdc33e6cf3ee83067091ea4277a3f8c4587aae38" +dependencies = [ + "darling", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "derive_builder_macro" +version = "0.20.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4abae7035bf79b9877b779505d8cf3749285b80c43941eda66604841889451dc" +dependencies = [ + "derive_builder_core", + "syn", +] + [[package]] name = "derive_more" version = "0.99.18" @@ -1140,6 +1238,18 @@ dependencies = [ "wasi", ] +[[package]] +name = "getset" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f636605b743120a8d32ed92fc27b6cde1a769f8f936c065151eb66f88ded513c" +dependencies = [ + "proc-macro-error2", + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "gimli" version = "0.31.0" @@ -1366,6 +1476,12 @@ dependencies = [ "cc", ] +[[package]] +name = "ident_case" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" + [[package]] name = "idna" version = "0.5.0" @@ -1974,6 +2090,8 @@ dependencies = [ "tracing", "tracing-forest", "tracing-subscriber", + "vergen", + "vergen-gitcl", ] [[package]] @@ -2282,6 +2400,15 @@ dependencies = [ "libc", ] +[[package]] +name = "num_threads" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c7398b9c8b70908f6371f47ed36737907c87c52af34c268fed0bf0ceb92ead9" +dependencies = [ + "libc", +] + [[package]] name = "object" version = "0.36.4" @@ -2476,6 +2603,28 @@ dependencies = [ "syn", ] +[[package]] +name = "proc-macro-error-attr2" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96de42df36bb9bba5542fe9f1a054b8cc87e172759a1868aa05c1f3acc89dfc5" +dependencies = [ + "proc-macro2", + "quote", +] + +[[package]] +name = "proc-macro-error2" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11ec05c52be0a07b08061f7dd003e7d7092e0472bc731b4af7bb1ef876109802" +dependencies = [ + "proc-macro-error-attr2", + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "proc-macro2" version = "1.0.86" @@ -2881,6 +3030,9 @@ name = "semver" version = "1.0.23" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" +dependencies = [ + "serde", +] [[package]] name = "semver-parser" @@ -3204,7 +3356,9 @@ checksum = "5dfd88e563464686c916c7e46e623e520ddc6d79fa6641390f2e3fa86e83e885" dependencies = [ "deranged", "itoa", + "libc", "num-conv", + "num_threads", "powerfmt", "serde", "time-core", @@ -3656,6 +3810,48 @@ version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" +[[package]] +name = "vergen" +version = "9.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c32e7318e93a9ac53693b6caccfb05ff22e04a44c7cf8a279051f24c09da286f" +dependencies = [ + "anyhow", + "cargo_metadata", + "derive_builder", + "getset", + "regex", + "rustc_version 0.4.1", + "rustversion", + "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]] name = "version_check" version = "0.9.5" diff --git a/bin/faucet/Cargo.toml b/bin/faucet/Cargo.toml index fc3f39978..f08e37729 100644 --- a/bin/faucet/Cargo.toml +++ b/bin/faucet/Cargo.toml @@ -21,7 +21,7 @@ actix-cors = "0.7" actix-web = "4.8" actix-web-static-files = "4.0" async-mutex = "1.4" -clap = { version = "4.5", features = ["derive"] } +clap = { version = "4.5", features = ["derive", "string"] } derive_more = "0.99" figment = { version = "0.10", features = ["toml", "env"] } miden-lib = { workspace = true, features = ["concurrent"] } @@ -39,4 +39,6 @@ tonic = { workspace = true } tracing = { workspace = true } [build-dependencies] +# Required to inject build metadata. +miden-node-utils = { workspace = true, features = ["vergen"] } static-files = "0.2" diff --git a/bin/faucet/build.rs b/bin/faucet/build.rs index c73a75b49..712bc2199 100644 --- a/bin/faucet/build.rs +++ b/bin/faucet/build.rs @@ -1,6 +1,7 @@ use std::str::FromStr; -fn main() -> std::io::Result<()> { +/// Embeds static faucet website files and generates build metadata for --version. +fn main() { // The location of our static faucet website files. let static_dir = std::path::PathBuf::from_str(std::env!("CARGO_MANIFEST_DIR")) .unwrap() @@ -8,5 +9,13 @@ fn main() -> std::io::Result<()> { .join("static"); println!("cargo::rerun-if-changed={}", static_dir.to_str().expect("Valid utf-8")); // This makes the static files available as an embedded resource. - static_files::resource_dir(static_dir).build() + static_files::resource_dir(static_dir).build().expect("Resources should build"); + + // Configures environment variables for build metadata intended for extended version + // information. + if let Err(e) = miden_node_utils::version::vergen() { + // Don't let an error here bring down the build. Build metadata will be empty which isn't a + // critical failure. + println!("cargo:warning=Failed to embed build metadata: {e:?}"); + } } diff --git a/bin/faucet/src/main.rs b/bin/faucet/src/main.rs index b29297e13..3247a4f31 100644 --- a/bin/faucet/src/main.rs +++ b/bin/faucet/src/main.rs @@ -13,7 +13,7 @@ use actix_web::{ }; use clap::{Parser, Subcommand}; use errors::FaucetError; -use miden_node_utils::config::load_config; +use miden_node_utils::{config::load_config, version::LongVersion}; use state::FaucetState; use tracing::info; @@ -32,7 +32,7 @@ const FAUCET_CONFIG_FILE_PATH: &str = "miden-faucet.toml"; // ================================================================================================ #[derive(Parser)] -#[command(version, about, long_about = None)] +#[command(version, about, long_about = None, long_version = long_version().to_string())] pub struct Cli { #[command(subcommand)] pub command: Command, @@ -129,3 +129,20 @@ async fn main() -> Result<(), FaucetError> { mod static_resources { include!(concat!(env!("OUT_DIR"), "/generated.rs")); } + +/// Generates [LongVersion] using the metadata generated by build.rs. +fn long_version() -> LongVersion { + // Use optional to allow for build script embedding failure. + LongVersion { + version: env!("CARGO_PKG_VERSION"), + sha: option_env!("VERGEN_GIT_SHA").unwrap_or_default(), + branch: option_env!("VERGEN_GIT_BRANCH").unwrap_or_default(), + dirty: option_env!("VERGEN_GIT_DIRTY").unwrap_or_default(), + features: option_env!("VERGEN_CARGO_FEATURES").unwrap_or_default(), + rust_version: option_env!("VERGEN_RUSTC_SEMVER").unwrap_or_default(), + host: option_env!("VERGEN_RUSTC_HOST_TRIPLE").unwrap_or_default(), + target: option_env!("VERGEN_CARGO_TARGET_TRIPLE").unwrap_or_default(), + opt_level: option_env!("VERGEN_CARGO_OPT_LEVEL").unwrap_or_default(), + debug: option_env!("VERGEN_CARGO_DEBUG").unwrap_or_default(), + } +} diff --git a/bin/node/Cargo.toml b/bin/node/Cargo.toml index 902f54f5b..d544f285f 100644 --- a/bin/node/Cargo.toml +++ b/bin/node/Cargo.toml @@ -19,7 +19,7 @@ tracing-forest = ["miden-node-block-producer/tracing-forest"] [dependencies] anyhow = { version = "1.0" } -clap = { version = "4.5", features = ["derive"] } +clap = { version = "4.5", features = ["derive", "string"] } miden-lib = { workspace = true, features = ["concurrent"] } miden-node-block-producer = { workspace = true } miden-node-rpc = { workspace = true } @@ -36,3 +36,7 @@ tracing-subscriber = { workspace = true } [dev-dependencies] figment = { version = "0.10", features = ["toml", "env", "test"] } miden-node-utils = { workspace = true, features = ["tracing-forest"] } + +[build-dependencies] +# Required to inject build metadata. +miden-node-utils = { workspace = true, features = ["vergen"] } diff --git a/bin/node/build.rs b/bin/node/build.rs new file mode 100644 index 000000000..ae41be148 --- /dev/null +++ b/bin/node/build.rs @@ -0,0 +1,9 @@ +fn main() { + // Configures environment variables for build metadata intended for extended version + // information. + if let Err(e) = miden_node_utils::version::vergen() { + // Don't let an error here bring down the build. Build metadata will be empty which isn't a + // critical failure. + println!("cargo:warning=Failed to embed build metadata: {e:?}"); + } +} diff --git a/bin/node/src/main.rs b/bin/node/src/main.rs index 1e04356c0..1ce93c60b 100644 --- a/bin/node/src/main.rs +++ b/bin/node/src/main.rs @@ -6,7 +6,7 @@ use commands::{init::init_config_files, start::start_node}; use miden_node_block_producer::server::BlockProducer; use miden_node_rpc::server::Rpc; use miden_node_store::server::Store; -use miden_node_utils::config::load_config; +use miden_node_utils::{config::load_config, version::LongVersion}; mod commands; mod config; @@ -22,7 +22,7 @@ const DEFAULT_GENESIS_INPUTS_PATH: &str = "genesis.toml"; // ================================================================================================ #[derive(Parser)] -#[command(version, about, long_about = None)] +#[command(version, about, long_about = None, long_version = long_version().to_string())] pub struct Cli { #[command(subcommand)] pub command: Command, @@ -137,3 +137,19 @@ async fn main() -> anyhow::Result<()> { }, } } + +/// Generates [LongVersion] using the metadata generated by build.rs. +fn long_version() -> LongVersion { + LongVersion { + version: env!("CARGO_PKG_VERSION"), + sha: option_env!("VERGEN_GIT_SHA").unwrap_or_default(), + branch: option_env!("VERGEN_GIT_BRANCH").unwrap_or_default(), + dirty: option_env!("VERGEN_GIT_DIRTY").unwrap_or_default(), + features: option_env!("VERGEN_CARGO_FEATURES").unwrap_or_default(), + rust_version: option_env!("VERGEN_RUSTC_SEMVER").unwrap_or_default(), + host: option_env!("VERGEN_RUSTC_HOST_TRIPLE").unwrap_or_default(), + target: option_env!("VERGEN_CARGO_TARGET_TRIPLE").unwrap_or_default(), + opt_level: option_env!("VERGEN_CARGO_OPT_LEVEL").unwrap_or_default(), + debug: option_env!("VERGEN_CARGO_DEBUG").unwrap_or_default(), + } +} diff --git a/crates/utils/Cargo.toml b/crates/utils/Cargo.toml index 9f6a8fe6e..ec002e30e 100644 --- a/crates/utils/Cargo.toml +++ b/crates/utils/Cargo.toml @@ -22,3 +22,12 @@ tonic = { workspace = true } tracing = { workspace = true } tracing-forest = { version = "0.1", optional = true, features = ["chrono"] } tracing-subscriber = { workspace = true } + +# Optional dependencies enabled by `vergen` feature. +# This must match the version expected by `vergen-gitcl`. +vergen = { "version" = "9.0", optional = true } +vergen-gitcl = { version = "1.0", features = ["cargo", "rustc"], optional = true } + +[features] +# Enables depedencies intended for build script generation of version metadata. +vergen = ["dep:vergen", "dep:vergen-gitcl"] diff --git a/crates/utils/src/lib.rs b/crates/utils/src/lib.rs index 0e5191d74..b098bf2d8 100644 --- a/crates/utils/src/lib.rs +++ b/crates/utils/src/lib.rs @@ -2,3 +2,4 @@ pub mod config; pub mod errors; pub mod formatting; pub mod logging; +pub mod version; diff --git a/crates/utils/src/version/mod.rs b/crates/utils/src/version/mod.rs new file mode 100644 index 000000000..4eb4f0943 --- /dev/null +++ b/crates/utils/src/version/mod.rs @@ -0,0 +1,185 @@ +#[cfg(feature = "vergen")] +pub use vergen::vergen; + +/// Contains build metadata which can be formatted into a pretty --version +/// output using its Display implementation. +/// +/// The build metadata can be embedded at compile time using the `vergen` function +/// available from the `vergen` feature. See that functions description for a list +/// of the environment variables emitted which map nicely to [LongVersion]. +/// +/// Unfortunately these values must be transferred manually by the end user since the +/// env variables are only available once the caller's build script has run - which is +/// after this crate is compiled. +pub struct LongVersion { + pub version: &'static str, + pub sha: &'static str, + pub branch: &'static str, + pub dirty: &'static str, + pub features: &'static str, + pub rust_version: &'static str, + pub host: &'static str, + pub target: &'static str, + pub opt_level: &'static str, + pub debug: &'static str, +} + +impl std::fmt::Display for LongVersion { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + let Self { + version, + sha, + mut branch, + dirty, + features, + rust_version, + host, + target, + opt_level, + debug, + } = self; + + let mut sha = if dirty == &"true" { + format!("{sha}-dirty") + } else { + sha.to_string() + }; + + // This is the default value set by `vergen` when these values are missing. + // The git values can be missing for a published crate, and while we do attempt + // to set default values in the build.rs, its still possible for these to be skipped + // e.g. when cargo publish --allow-dirty is used. + if branch == "VERGEN_IDEMPOTENT_OUTPUT" { + branch = ""; + } + if sha == "VERGEN_IDEMPOTENT_OUTPUT" { + sha.clear(); + } + + f.write_fmt(format_args!( + "{version} + +SHA: {sha} +branch: {branch} +features: {features} +rust version: {rust_version} +target arch: {target} +host arch: {host} +opt-level: {opt_level} +debug: {debug} +" + )) + } +} + +#[cfg(feature = "vergen")] +mod vergen { + use std::path::PathBuf; + + use anyhow::{Context, Result}; + + /// Emits environment variables for build metadata intended for extended version information. + /// + /// The following environment variables are emitted: + /// + /// - `VERGEN_GIT_BRANCH` + /// - `VERGEN_GIT_SHA` + /// - `VERGEN_GIT_DIRTY` + /// - `VERGEN_RUSTC_SEMVER` + /// - `VERGEN_RUSTC_HOST_TRIPLE` + /// - `VERGEN_CARGO_TARGET_TRIPLE` + /// - `VERGEN_CARGO_FEATURES` + /// - `VERGEN_CARGO_OPT_LEVEL` + /// - `VERGEN_CARGO_DEBUG` + pub fn vergen() -> Result<()> { + if let Some(sha) = published_git_sha().context("Checking for published vcs info")? { + // git data is not available if in a published state, so we set them manually. + println!("cargo::rustc-env=VERGEN_GIT_SHA={sha}"); + println!("cargo::rustc-env=VERGEN_GIT_BRANCH=NA (published)"); + println!("cargo::rustc-env=VERGEN_GIT_DIRTY="); + + vergen_gitcl::Emitter::new() + } else { + // In a non-published state so we can expect git instructions to work. + let mut emitter = vergen_gitcl::Emitter::new(); + emitter + .add_instructions(&git_instructions()?) + .context("Adding git instructions")?; + + emitter + } + .add_instructions(&cargo_instructions()?) + .context("Adding cargo instructions")? + .add_instructions(&rustc_instructions()?) + .context("Adding rustc instructions")? + .emit() + } + + /// Normal git info is lost on `cargo publish`, which instead adds a file containing the SHA1 + /// hash. + /// + /// This function returns the short SHA value. If present, this indicates this we're in a + /// published state. + fn published_git_sha() -> Result> { + let cargo_vcs_info = PathBuf::from(env!("CARGO_MANIFEST_DIR")).join(".cargo_vcs_info.json"); + if cargo_vcs_info.exists() { + // The file is small so reading to string is acceptable. + let contents = std::fs::read_to_string(cargo_vcs_info).context("Reading vcs info")?; + + // File format: + // { + // "git": { + // "sha1": "9d48046e9654d93a86212e77d6c92f14c95de44b" + // }, + // "path_in_vcs": "bin/node" + // } + let offset = contents.find(r#""sha1""#).context("Searching for sha1 property")? + + r#""sha1""#.len(); + + let sha1 = contents[offset + 1..] + .chars() + // Find and skip opening quote. + .skip_while(|&c| c != '"') + .skip(1) + // Take until closing quote. + .take_while(|&c| c != '"') + // Short SHA format is 7 digits. + .take(7) + .collect(); + + Ok(Some(sha1)) + } else { + Ok(None) + } + } + + fn git_instructions() -> Result { + const INCLUDE_UNTRACKED: bool = true; + const SHORT_SHA: bool = true; + + vergen_gitcl::GitclBuilder::default() + .branch(true) + .dirty(INCLUDE_UNTRACKED) + .sha(SHORT_SHA) + .build() + .context("Building git instructions") + } + + fn cargo_instructions() -> Result { + vergen_gitcl::CargoBuilder::default() + .debug(true) + .features(true) + .target_triple(true) + .opt_level(true) + .build() + .context("Building git instructions") + } + + fn rustc_instructions() -> Result { + vergen_gitcl::RustcBuilder::default() + .semver(true) + .host_triple(true) + .build() + .context("Building rustc instructions") + } +} From 8d60fb914487a5d145cc5399c0d0707aeb27feeb Mon Sep 17 00:00:00 2001 From: Mirko von Leipzig Date: Wed, 18 Sep 2024 12:22:48 +0200 Subject: [PATCH 2/3] Simplify -dirty logic --- crates/utils/src/version/mod.rs | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/crates/utils/src/version/mod.rs b/crates/utils/src/version/mod.rs index 4eb4f0943..18f2c5036 100644 --- a/crates/utils/src/version/mod.rs +++ b/crates/utils/src/version/mod.rs @@ -28,7 +28,7 @@ impl std::fmt::Display for LongVersion { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { let Self { version, - sha, + mut sha, mut branch, dirty, features, @@ -39,10 +39,9 @@ impl std::fmt::Display for LongVersion { debug, } = self; - let mut sha = if dirty == &"true" { - format!("{sha}-dirty") - } else { - sha.to_string() + let dirty = match *dirty { + "true" => "-dirty", + _ => "", }; // This is the default value set by `vergen` when these values are missing. @@ -53,13 +52,13 @@ impl std::fmt::Display for LongVersion { branch = ""; } if sha == "VERGEN_IDEMPOTENT_OUTPUT" { - sha.clear(); + sha = ""; } f.write_fmt(format_args!( "{version} -SHA: {sha} +SHA: {sha}{dirty} branch: {branch} features: {features} rust version: {rust_version} From 73cc4268ee083e7a8b276110c8ba3fc1e7f75443 Mon Sep 17 00:00:00 2001 From: Mirko von Leipzig Date: Thu, 19 Sep 2024 09:28:39 +0200 Subject: [PATCH 3/3] Nit: toml ordering --- crates/utils/Cargo.toml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/crates/utils/Cargo.toml b/crates/utils/Cargo.toml index ec002e30e..e3b4494d5 100644 --- a/crates/utils/Cargo.toml +++ b/crates/utils/Cargo.toml @@ -11,6 +11,10 @@ authors.workspace = true homepage.workspace = true repository.workspace = true +[features] +# Enables depedencies intended for build script generation of version metadata. +vergen = ["dep:vergen", "dep:vergen-gitcl"] + [dependencies] anyhow = { version = "1.0" } figment = { version = "0.10", features = ["toml", "env"] } @@ -22,12 +26,7 @@ tonic = { workspace = true } tracing = { workspace = true } tracing-forest = { version = "0.1", optional = true, features = ["chrono"] } tracing-subscriber = { workspace = true } - # Optional dependencies enabled by `vergen` feature. # This must match the version expected by `vergen-gitcl`. vergen = { "version" = "9.0", optional = true } vergen-gitcl = { version = "1.0", features = ["cargo", "rustc"], optional = true } - -[features] -# Enables depedencies intended for build script generation of version metadata. -vergen = ["dep:vergen", "dep:vergen-gitcl"]