diff options
author | Skyler Hawthorne | 2023-12-05 01:54:18 +0000 |
---|---|---|
committer | GitHub | 2023-12-05 01:54:18 +0000 |
commit | bf7c4e165946f7a5be48c9d7e8abb8e68f066882 (patch) | |
tree | 2e5660f2562e0b6f424af4792348e7c3546e86ab /helix-loader | |
parent | 44c3d48a941c5e2d6484c808c9066b91cfbcf0ec (diff) |
use workspace inheritance for common version (#8925)
Diffstat (limited to 'helix-loader')
-rw-r--r-- | helix-loader/Cargo.toml | 12 | ||||
-rw-r--r-- | helix-loader/build.rs | 18 |
2 files changed, 20 insertions, 10 deletions
diff --git a/helix-loader/Cargo.toml b/helix-loader/Cargo.toml index b32318d0..1a98e94b 100644 --- a/helix-loader/Cargo.toml +++ b/helix-loader/Cargo.toml @@ -1,14 +1,14 @@ [package] name = "helix-loader" -version = "0.6.0" -description = "A post-modern text editor." -authors = ["Blaž Hrastnik <blaz@mxxn.io>"] +description = "Build bootstrapping for Helix crates" +version.workspace = true +authors.workspace = true edition.workspace = true license.workspace = true rust-version.workspace = true -categories = ["editor"] -repository = "https://github.com/helix-editor/helix" -homepage = "https://helix-editor.com" +categories.workspace = true +repository.workspace = true +homepage.workspace = true [[bin]] name = "hx-loader" diff --git a/helix-loader/build.rs b/helix-loader/build.rs index 74ba2a2b..a4562c00 100644 --- a/helix-loader/build.rs +++ b/helix-loader/build.rs @@ -2,7 +2,17 @@ use std::borrow::Cow; use std::path::Path; use std::process::Command; -const VERSION: &str = include_str!("../VERSION"); +const MAJOR: &str = env!("CARGO_PKG_VERSION_MAJOR"); +const MINOR: &str = env!("CARGO_PKG_VERSION_MINOR"); +const PATCH: &str = env!("CARGO_PKG_VERSION_PATCH"); + +fn get_calver() -> String { + if PATCH == "0" { + format!("{MAJOR}.{MINOR}") + } else { + format!("{MAJOR}.{MINOR}.{PATCH}") + } +} fn main() { let git_hash = Command::new("git") @@ -12,9 +22,10 @@ fn main() { .filter(|output| output.status.success()) .and_then(|x| String::from_utf8(x.stdout).ok()); + let calver = get_calver(); let version: Cow<_> = match &git_hash { - Some(git_hash) => format!("{} ({})", VERSION, &git_hash[..8]).into(), - None => VERSION.into(), + Some(git_hash) => format!("{} ({})", calver, &git_hash[..8]).into(), + None => calver.into(), }; println!( @@ -22,7 +33,6 @@ fn main() { std::env::var("TARGET").unwrap() ); - println!("cargo:rerun-if-changed=../VERSION"); println!("cargo:rustc-env=VERSION_AND_GIT_HASH={}", version); if git_hash.is_none() { |