Skip to content

Commit

Permalink
Add git compile-time information
Browse files Browse the repository at this point in the history
  • Loading branch information
XAMPPRocky committed May 17, 2022
1 parent 00f127e commit 0b331ed
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ tracing-test = "0.2"
tonic-build = { version = "0.6.0", default_features = false, features = ["transport", "prost"] }
# Locked to 0.8 to match `tonic-build`'s `prost-build`.
prost-build = "=0.9.0"
built = { version = "0.5.1", features = ["git2"] }

[features]
instrument = []
2 changes: 2 additions & 0 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,5 +81,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
println!("cargo:rerun-if-changed={}", path.to_str().unwrap());
}

built::write_built_file().expect("Failed to acquire build-time information");

Ok(())
}
2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ async fn main() -> quilkin::Result<()> {
tracing_subscriber::fmt().json().with_target(false).init();
}

info!(version = &*version, "Starting Quilkin");
info!(version = &*version, commit = quilkin::metadata::build::GIT_COMMIT_HASH, "Starting Quilkin");
match cli.command {
Commands::Run => {
let config = std::fs::File::open(cli.config)
Expand Down
5 changes: 5 additions & 0 deletions src/metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ use std::{collections::HashMap, convert::TryFrom, sync::Arc};

use crate::xds::config::core::v3::Metadata as ProtoMetadata;

#[doc(hidden)]
pub mod build {
include!(concat!(env!("OUT_DIR"), "/built.rs"));
}

/// Shared state between [`Filter`][crate::filters::Filter]s during processing for a single packet.
pub type DynamicMetadata = HashMap<Arc<String>, Value>;

Expand Down

0 comments on commit 0b331ed

Please sign in to comment.