forked from 1b-agent/opencadstudio-upstream
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 <[email protected]>
This commit is contained in:
1 parent
58c9fcb748
commit
5f161bb037
31 files changed
+204
-18
No files matched your search
@@ -262,8 +262,11 @@ impl OpenCADStudio {
|
||||
// reports arrive with the basics already filled in.
|
||||
let body = format!(
|
||||
"<!-- Describe the issue and the steps to reproduce it. -->\n\n\n\
|
||||
---\n- Open CAD Studio: v{}\n- Platform: {}\n",
|
||||
env!("OCS_APP_VERSION"),
|
||||
---\n- Open CAD Studio: v{}\n- Revision: {} ({}, {})\n- Platform: {}\n",
|
||||
env!("OCS_FULL_VERSION"),
|
||||
env!("OCS_GIT_REV"),
|
||||
env!("OCS_COMMIT_DATE"),
|
||||
env!("OCS_BUILD_PROFILE"),
|
||||
crate::sys::platform_info(),
|
||||
);
|
||||
let url = format!(
|
||||
|
||||
@@ -6949,8 +6949,12 @@ impl OpenCADStudio {
|
||||
|
||||
Message::AboutCopyInfo => {
|
||||
let info = format!(
|
||||
"Open CAD Studio v{}\nOS: {}\nArch: {}",
|
||||
env!("OCS_APP_VERSION"),
|
||||
"Open CAD Studio v{}\nRevision: {}\nCommit date: {}\nProfile: {}\nFeatures: {}\nOS: {}\nArch: {}",
|
||||
env!("OCS_FULL_VERSION"),
|
||||
env!("OCS_GIT_REV"),
|
||||
env!("OCS_COMMIT_DATE"),
|
||||
env!("OCS_BUILD_PROFILE"),
|
||||
env!("OCS_BUILD_FEATURES"),
|
||||
crate::ui::window::about::platform_name(),
|
||||
crate::ui::window::about::architecture_name(),
|
||||
);
|
||||
@@ -7168,7 +7172,7 @@ impl OpenCADStudio {
|
||||
if let Some(error) = &self.plugin_registry_error {
|
||||
return iced::clipboard::write(format!(
|
||||
"Open CAD Studio v{}\nOS: {}\nArchitecture: {}\nRegistry: {}\nError: {}",
|
||||
env!("OCS_APP_VERSION"),
|
||||
env!("OCS_FULL_VERSION"),
|
||||
std::env::consts::OS,
|
||||
std::env::consts::ARCH,
|
||||
crate::plugin::marketplace::REGISTRY_URL,
|
||||
|
||||
+8
-1
@@ -20,7 +20,14 @@ use clap::Parser;
|
||||
#[derive(Parser, Debug, Default)]
|
||||
#[command(
|
||||
name = "OpenCADStudio",
|
||||
version,
|
||||
version = env!("OCS_FULL_VERSION"),
|
||||
long_version = concat!(
|
||||
env!("OCS_FULL_VERSION"),
|
||||
"\nrevision: ", env!("OCS_GIT_REV"),
|
||||
"\ncommit date: ", env!("OCS_COMMIT_DATE"),
|
||||
"\nprofile: ", env!("OCS_BUILD_PROFILE"),
|
||||
"\nfeatures: ", env!("OCS_BUILD_FEATURES"),
|
||||
),
|
||||
about = crate::t!("Open CAD Studio — 2D/3D CAD editor").into_owned(),
|
||||
long_about = None,
|
||||
)]
|
||||
|
||||
@@ -255,6 +255,7 @@ impl RecoveryReport {
|
||||
lines.push(format!("Report schema: {}", REPORT_SCHEMA_VERSION));
|
||||
lines.push(format!("Report ID: {}", self.report_id));
|
||||
lines.push(format!("Application version: {}", env!("OCS_APP_VERSION")));
|
||||
lines.push(format!("Application build: {}", env!("OCS_FULL_VERSION")));
|
||||
lines.push(format!("Application revision: {}", env!("OCS_GIT_REV")));
|
||||
lines.push(format!("Build profile: {}", env!("OCS_BUILD_PROFILE")));
|
||||
lines.push(format!("Build features: {}", env!("OCS_BUILD_FEATURES")));
|
||||
|
||||
@@ -481,6 +481,7 @@ pub(super) fn message_attribute(source: &str) -> Option<(&'static str, &'static
|
||||
"Bring to Front" => Some(("ui", "bring-to-front")),
|
||||
"Browse, install, and manage add-ons. Select one to view its README." => Some(("plugins", "browse-install-and-manage-add-ons-select-one-t")),
|
||||
"Browser storage" => Some(("options", "browser-storage")),
|
||||
"Build" => Some(("ui", "build")),
|
||||
"Building scene caches…" => Some(("ui", "building-scene-caches")),
|
||||
"Bump Map" => Some(("properties", "bump-map")),
|
||||
"By annotation scale" => Some(("styles", "by-annotation-scale")),
|
||||
@@ -645,6 +646,7 @@ pub(super) fn message_attribute(source: &str) -> Option<(&'static str, &'static
|
||||
"Command Aliases" => Some(("command", "command-aliases")),
|
||||
"Command cancelled because the active drawing space changed." => Some(("common", "command-cancelled-because-the-active-drawing-s")),
|
||||
"Command history navigation" => Some(("common", "command-history-navigation")),
|
||||
"Commit date" => Some(("ui", "commit-date")),
|
||||
"Command:" => Some(("common", "command-label-title-case")),
|
||||
"Commands: %{cmds}" => Some(("plugins", "commands-cmds")),
|
||||
"Compact" => Some(("ui", "compact")),
|
||||
@@ -2234,6 +2236,7 @@ pub(super) fn message_attribute(source: &str) -> Option<(&'static str, &'static
|
||||
"Refraction Map" => Some(("properties", "refraction-map")),
|
||||
"Region" => Some(("properties", "region")),
|
||||
"Registered Class Entity" => Some(("properties", "registered-class-entity")),
|
||||
"Release" => Some(("ui", "release")),
|
||||
"Reload failed: {error}" => Some(("file", "reload-failed-error")),
|
||||
"Reload from Disk" => Some(("modal", "reload-from-disk")),
|
||||
"Remote Text" => Some(("properties", "remote-text")),
|
||||
|
||||
+24
-2
@@ -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),
|
||||
|
||||
Reference in new issue
Block a user