Skip to content
This repository was archived by the owner on May 11, 2023. It is now read-only.

Commit

Permalink
Adds build metadata to version output
Browse files Browse the repository at this point in the history
Signed-off-by: Erik Kundt <[email protected]>
  • Loading branch information
erak committed Sep 1, 2022
1 parent 5d39dd0 commit 5d68666
Show file tree
Hide file tree
Showing 4 changed files with 85 additions and 8 deletions.
76 changes: 69 additions & 7 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ version = "0.6.2"
authors = ["The Radicle Team <[email protected]>"]
edition = "2018"
rust-version = "1.63"
build = "build.rs"

[package.metadata.deb]
assets = [
Expand All @@ -30,6 +31,10 @@ link-identities = { version = "0" }
librad = { version = "0" }
url = { version = "*" }

[build-dependencies]
anyhow = "1.0"
vergen = { version = "7", default-features = false, features = ["build", "git"] }

# Ethereum functionality

ethers = { version = "0.6.2", optional = true }
Expand Down
8 changes: 8 additions & 0 deletions cli/build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
use anyhow::Result;
use vergen::{vergen, Config, ShaKind};

fn main() -> Result<()> {
let mut config = Config::default();
*config.git_mut().sha_kind_mut() = ShaKind::Short;
vergen(config)
}
4 changes: 3 additions & 1 deletion cli/src/rad.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ use radicle_terminal as term;
pub const NAME: &str = "rad";
pub const VERSION: &str = env!("CARGO_PKG_VERSION");
pub const DESCRIPTION: &str = env!("CARGO_PKG_DESCRIPTION");
pub const GIT_BRANCH: &str = env!("VERGEN_GIT_BRANCH");
pub const GIT_COMMIT: &str = env!("VERGEN_GIT_SHA_SHORT");

#[derive(Debug)]
enum Command {
Expand Down Expand Up @@ -62,7 +64,7 @@ fn parse_args() -> anyhow::Result<Command> {
}

fn print_version() {
println!("{} {}", NAME, VERSION);
println!("{} {}-{}+sha.{}", NAME, VERSION, GIT_BRANCH, GIT_COMMIT);
}

fn print_help() -> anyhow::Result<()> {
Expand Down

0 comments on commit 5d68666

Please sign in to comment.