summaryrefslogtreecommitdiff
path: root/crates/gipfel-app/src/main.rs
diff options
context:
space:
mode:
authorJohannes Hofmann <Johannes.Hofmann@gmx.de>2026-10-27 07:55:43 +0100
committerJohannes Hofmann <Johannes.Hofmann@gmx.de>2026-10-27 07:55:47 +0100
commitb899c72b79d2e909abf6230239d3c9377fc58899 (patch)
tree3c84d6eb69a5366d95fc85f04fa92d1ac7345b4d /crates/gipfel-app/src/main.rs
parent7d31997bd9118351e8a849d2101c5aacc0aae78b (diff)
build: single source of truth for the version
Version now lives only in [workspace.package] in the root Cargo.toml; all three crates inherit it via version.workspace = true (this also fixes gipfel-core, which had drifted to 0.1.0 while the others were 0.5.4). edition/license are inherited the same way. The About dialog now reads env!("CARGO_PKG_VERSION") instead of a hardcoded string. A new test (changelog_top_matches_version) asserts the top gipfel-X.Y.Z entry in ChangeLog equals the crate version, so the manifest, the About dialog and the ChangeLog cannot drift apart. AGENTS.md gains a "Releasing a new version" section documenting the flow (bump workspace version, add ChangeLog entry, tag, git archive source tarball).
Diffstat (limited to 'crates/gipfel-app/src/main.rs')
-rw-r--r--crates/gipfel-app/src/main.rs24
1 files changed, 23 insertions, 1 deletions
diff --git a/crates/gipfel-app/src/main.rs b/crates/gipfel-app/src/main.rs
index 967e68d..12e2845 100644
--- a/crates/gipfel-app/src/main.rs
+++ b/crates/gipfel-app/src/main.rs
@@ -1526,7 +1526,7 @@ impl Gipfel {
fn view_about<'a>(&self) -> Element<'a, Message> {
widget::dialog()
.title("About gipfel")
- .body("gipfel 0.5.4")
+ .body(format!("gipfel {}", env!("CARGO_PKG_VERSION")))
.control(widget::text("Annotate mountain panoramas."))
.control(widget::text("by Johannes Hofmann")) .primary_action(widget::button::suggested("Close").on_press(Message::About(false)))
.is_overlay(false)
@@ -1802,4 +1802,26 @@ mod tests {
let (_, y_back) = pan.project_point(0.0, top).unwrap();
assert!((y_back + 100.0).abs() < 0.01);
}
+
+ /// Release drift guard: the top `gipfel-X.Y.Z` entry in the ChangeLog must
+ /// match the crate version (inherited from `[workspace.package]`). This
+ /// catches a bump of one but not the other. The About dialog reads the same
+ /// `CARGO_PKG_VERSION`, so all three stay in lockstep.
+ #[test]
+ fn changelog_top_matches_version() {
+ let path = concat!(env!("CARGO_MANIFEST_DIR"), "/../../ChangeLog");
+ let text = std::fs::read_to_string(path)
+ .expect("ChangeLog not found at the workspace root");
+ let top = text
+ .lines()
+ .map(str::trim)
+ .find_map(|l| l.strip_prefix("gipfel-"))
+ .expect("ChangeLog has no `gipfel-X.Y.Z` entry");
+ assert_eq!(
+ top,
+ env!("CARGO_PKG_VERSION"),
+ "ChangeLog top entry is `gipfel-{top}` but crate version is {}",
+ env!("CARGO_PKG_VERSION")
+ );
+ }
}