aboutsummaryrefslogtreecommitdiff
path: root/helix-loader
diff options
context:
space:
mode:
Diffstat (limited to 'helix-loader')
-rw-r--r--helix-loader/Cargo.toml12
-rw-r--r--helix-loader/build.rs18
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() {