Skip to content

Commit

Permalink
version in build.rs
Browse files Browse the repository at this point in the history
  • Loading branch information
BrettMayson committed Nov 2, 2023
1 parent 1b646cb commit e43c154
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 13 deletions.
12 changes: 12 additions & 0 deletions bin/build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
pub fn main() {
let mut base = env!("CARGO_PKG_VERSION").to_string();
if option_env!("CI").is_none() {
base.push_str("-local");
} else if option_env!("RELEASE").is_none() {
base.push_str("-dev");
}
if cfg!(debug_assertions) {
base.push_str("-debug");
}
println!("cargo:rustc-env=HEMTT_VERSION={}", base);
}
15 changes: 2 additions & 13 deletions bin/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,7 @@ pub fn cli() -> Command {
#[allow(unused_mut)]
let mut global = Command::new(env!("CARGO_PKG_NAME"))
.about(env!("CARGO_PKG_DESCRIPTION"))
.version({
let mut base = env!("CARGO_PKG_VERSION").to_string();
if option_env!("CI").is_none() {
base.push_str("-local");
} else if option_env!("RELEASE").is_none() {
base.push_str("-dev");
}
if cfg!(debug_assertions) {
base.push_str("-debug");
}
Box::leak(Box::new(base)).as_str()
})
.version(env!("HEMTT_VERSION"))
.subcommand_required(false)
.arg_required_else_help(true)
.subcommand(commands::new::cli())
Expand Down Expand Up @@ -111,7 +100,7 @@ pub fn execute(matches: &ArgMatches) -> Result<(), Error> {
}
}

trace!("version: {}", env!("CARGO_PKG_VERSION"));
trace!("version: {}", env!("HEMTT_VERSION"));
trace!("platform: {}", std::env::consts::OS);

if let Some(threads) = matches.get_one::<String>("threads") {
Expand Down

0 comments on commit e43c154

Please sign in to comment.