build: eliminate duplicate version string

There is now a single source of truth for river's version. It is no
longer possible for the versions in build.zig and build.zig.zon to get
out of sync as build.zig now parses the version from build.zig.zon.
This commit is contained in:
Isaac Freund 2025-03-10 08:17:17 +01:00
parent 8f4a746da0
commit 60f954c2b0
No known key found for this signature in database
GPG Key ID: 86DED400DDFD7A11
2 changed files with 33 additions and 6 deletions

View File

@ -6,12 +6,6 @@ const mem = std.mem;
const Scanner = @import("wayland").Scanner;
/// While a river release is in development, this string should contain the version in development
/// with the "-dev" suffix.
/// When a release is tagged, the "-dev" suffix should be removed for the commit that gets tagged.
/// Directly after the tagged commit, the version should be bumped and the "-dev" suffix added.
const version = "0.3.8-dev";
pub fn build(b: *Build) !void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
@ -291,3 +285,31 @@ pub fn build(b: *Build) !void {
test_step.dependOn(&run_globber_test.step);
}
}
const version = manifest.version;
/// Getting rid of this wart requires upstream zig improvements.
/// See: https://github.com/ziglang/zig/issues/22775
const manifest: struct {
name: @Type(.enum_literal),
version: []const u8,
paths: []const []const u8,
dependencies: struct {
pixman: struct {
url: []const u8,
hash: []const u8,
},
wayland: struct {
url: []const u8,
hash: []const u8,
},
wlroots: struct {
url: []const u8,
hash: []const u8,
},
xkbcommon: struct {
url: []const u8,
hash: []const u8,
},
},
fingerprint: u64,
} = @import("build.zig.zon");

View File

@ -1,5 +1,10 @@
.{
.name = .river,
// While a river release is in development, this string should contain
// the version in development with the "-dev" suffix.
// When a release is tagged, the "-dev" suffix should be removed for the
// commit that gets tagged. Directly after the tagged commit, the version
// should be bumped and the "-dev" suffix added.
.version = "0.3.9-dev",
.paths = .{""},
.dependencies = .{