diff options
| author | Ēriks Remess <eriks@remess.lv> | 2025-10-09 16:02:40 +0300 |
|---|---|---|
| committer | Ēriks Remess <eriks@remess.lv> | 2025-10-09 16:02:40 +0300 |
| commit | f4b051a84c225a1aadc2fe16fcebd3fce24f2eb2 (patch) | |
| tree | 9edd7e147f379c09138cb77f0973b33ec20f482f | |
| parent | 3b2ef4c216c2f720330aeb50c51f942fccac5156 (diff) | |
use app_version from build.zig.zon
| -rw-r--r-- | build.zig | 4 | ||||
| -rw-r--r-- | src/build/Config.zig | 10 |
2 files changed, 5 insertions, 9 deletions
@@ -2,6 +2,7 @@ const std = @import("std"); const assert = std.debug.assert; const builtin = @import("builtin"); const buildpkg = @import("src/build/main.zig"); +const appVersion = @import("build.zig.zon").version; comptime { buildpkg.requireZig("0.15.1"); @@ -15,7 +16,8 @@ pub fn build(b: *std.Build) !void { // This defines all the available build options (e.g. `-D`). If you // want to know what options are available, you can run `--help` or // you can read `src/build/Config.zig`. - const config = try buildpkg.Config.init(b); + + const config = try buildpkg.Config.init(b, appVersion); const test_filters = b.option( [][]const u8, "test-filter", diff --git a/src/build/Config.zig b/src/build/Config.zig index 643dfe928..745fc926f 100644 --- a/src/build/Config.zig +++ b/src/build/Config.zig @@ -16,13 +16,6 @@ const expandPath = @import("../os/path.zig").expand; const gtk = @import("gtk.zig"); const GitVersion = @import("GitVersion.zig"); -/// The version of the next release. -/// -/// TODO: When Zig 0.14 is released, derive this from build.zig.zon directly. -/// Until then this MUST match build.zig.zon and should always be the -/// _next_ version to release. -const app_version: std.SemanticVersion = .{ .major = 1, .minor = 2, .patch = 1 }; - /// Standard build configuration options. optimize: std.builtin.OptimizeMode, target: std.Build.ResolvedTarget, @@ -69,7 +62,7 @@ emit_unicode_table_gen: bool = false, /// Environmental properties env: std.process.EnvMap, -pub fn init(b: *std.Build) !Config { +pub fn init(b: *std.Build, appVersion: []const u8) !Config { // Setup our standard Zig target and optimize options, i.e. // `-Doptimize` and `-Dtarget`. const optimize = b.standardOptimizeOption(.{}); @@ -217,6 +210,7 @@ pub fn init(b: *std.Build) !Config { // If an explicit version is given, we always use it. try std.SemanticVersion.parse(v) else version: { + const app_version = try std.SemanticVersion.parse(appVersion); // If no explicit version is given, we try to detect it from git. const vsn = GitVersion.detect(b) catch |err| switch (err) { // If Git isn't available we just make an unknown dev version. |
