summaryrefslogtreecommitdiff
path: root/build.zig
diff options
context:
space:
mode:
Diffstat (limited to 'build.zig')
-rw-r--r--build.zig10
1 files changed, 8 insertions, 2 deletions
diff --git a/build.zig b/build.zig
index 85cc29cc..620eb19b 100644
--- a/build.zig
+++ b/build.zig
@@ -6,6 +6,12 @@ const grammar_manifest = @import("src/grammar_manifest.zig");
/// The package manifest, imported UNTYPED on purpose — see the `version`
/// option in `shellOptions` for why that word is load-bearing.
const zon = @import("build.zig.zon");
+/// Releases are numbered 0.N; the zon holds "0.N.0" because it must be semver,
+/// and what a user sees drops that ".0".
+const display_version = if (std.mem.endsWith(u8, zon.version, ".0") and std.mem.count(u8, zon.version, ".") == 2)
+ zon.version[0 .. zon.version.len - 2]
+else
+ zon.version;
pub const Platform = enum { tty, gui, web, macos, esp32p4 };
@@ -1150,7 +1156,7 @@ pub fn build(b: *std.Build) void {
plist.addFileArg(b.path("src/macos/Info.plist"));
const version_plist = b.addSystemCommand(&.{
- "plutil", "-replace", "CFBundleShortVersionString", "-string", zon.version, "-o",
+ "plutil", "-replace", "CFBundleShortVersionString", "-string", display_version, "-o",
});
const version_plist_out = version_plist.addOutputFileArg("Info.plist");
version_plist.addFileArg(plist_out);
@@ -1877,7 +1883,7 @@ fn shellOptions(b: *std.Build, cfg: ShellConfig, platform: Platform) *std.Build.
o.addOption(bool, "workspace_tag", cfg.workspace_tag orelse (platform != .macos));
o.addOption(bool, "theme_animation", cfg.theme_animation orelse (platform != .esp32p4));
o.addOption(bool, "embed_sources", cfg.embed_sources);
- o.addOption([]const u8, "version", zon.version);
+ o.addOption([]const u8, "version", display_version);
// ...and the commit it was built from, when there is one and the build
// is stamped at all (see `stamp_commit`). Read at configure time.
o.addOption(?[]const u8, "commit", cfg.commit);