Show the exact build in About, Copy Info, REPORT and --version

Builds from main reported only the release version (2026.36) even when
HEAD was hundreds of commits past the tag. build.rs now also emits
OCS_TAG_DISTANCE, OCS_COMMIT_DATE, OCS_BUILD_METADATA and
OCS_FULL_VERSION: a clean checkout of the release tag stays "2026.36",
anything else becomes "2026.36+194.gef189d77", with ".dirty" appended
for uncommitted changes and only the hash when no tag can be counted
from (shallow clone, tarball). OCS_APP_VERSION is unchanged so the
update check, donation gate, User-Agents and window title keep working.

The About dialog gains Build / Commit date / Profile cards, Copy Info,
the REPORT issue template and recovery reports carry the full version,
and `-V`/`--version` print it instead of Cargo's 2026.36.0. Release
workflows check out full history so release binaries see the tag.

Also fixes the build being marked dirty when there is no repository:
diff-index exits 128 there, not 1.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
PanosandClaude Opus 5 committed 2026-09-12 16:19:40 +03:00
1 parent 58c9fcb748
commit 5f161bb037
31 files changed
+204 -18

No files matched your search

+24 -2
View File
@@ -73,10 +73,23 @@ pub(crate) fn architecture_name() -> &'static str {
}
}
/// Build card text: the metadata suffix without its leading `+`
/// (`194.gef189d77`, `gef189d77.dirty`), or "Release" for a clean build on
/// the release tag.
fn build_label() -> std::borrow::Cow<'static, str> {
match env!("OCS_BUILD_METADATA").strip_prefix('+') {
Some(suffix) => std::borrow::Cow::Borrowed(suffix),
None => t!("Release"),
}
}
pub fn view_window(
sizing: crate::ui::modal::ModalSizing,
) -> Element<'static, Message> {
let version = format!("v{}", env!("OCS_APP_VERSION"));
// The hero carries the full build identity (`2026.36+194.gef189d77`);
// the cards split it into the release version and the build details.
let version = format!("v{}", env!("OCS_FULL_VERSION"));
let build = build_label();
let content_width = if matches!(sizing.width, Length::Fill) {
Fill
} else {
@@ -113,13 +126,21 @@ pub fn view_window(
.style(surface_style);
let metadata = row![
info_card(t!("Version"), version, card_width),
info_card(t!("Version"), env!("OCS_APP_VERSION"), card_width),
info_card(t!("Platform"), platform_name(), card_width),
info_card(t!("Arch"), architecture_name(), card_width),
]
.spacing(8)
.width(content_width);
let build_info = row![
info_card(t!("Build"), build, card_width),
info_card(t!("Commit date"), env!("OCS_COMMIT_DATE"), card_width),
info_card(t!("Profile"), env!("OCS_BUILD_PROFILE"), card_width),
]
.spacing(8)
.width(content_width);
let copy = button(text(t!("Copy Info")).size(11))
.on_press(Message::AboutCopyInfo)
.style(button::primary)
@@ -129,6 +150,7 @@ pub fn view_window(
column![
hero,
metadata,
build_info,
row![Space::new().width(content_width), copy]
.width(sizing.width)
.align_y(iced::Center),