From cb93e69eaca6096328548f0f50896684c36053e4 Mon Sep 17 00:00:00 2001 From: Benoit Giannangeli Date: Tue, 14 May 2024 09:13:26 +0200 Subject: [PATCH] fix: BuildOptions.version is hardcoded std.SemanticVersion --- build.zig | 21 ++------------------- src/main.zig | 4 ++-- src/repl.zig | 4 ++-- 3 files changed, 6 insertions(+), 23 deletions(-) diff --git a/build.zig b/build.zig index 813c7ad9..f24273a7 100644 --- a/build.zig +++ b/build.zig @@ -59,7 +59,7 @@ const BuzzGCOptions = struct { }; const BuzzBuildOptions = struct { - version: []const u8, + version: std.SemanticVersion, sha: []const u8, mimalloc: bool, debug: BuzzDebugOptions, @@ -111,24 +111,7 @@ pub fn build(b: *Build) !void { var build_options = BuzzBuildOptions{ .target = target, // Version is latest tag or empty string - .version = std.mem.trim( - u8, - (std.ChildProcess.run(.{ - .allocator = b.allocator, - .argv = &.{ - "git", - "describe", - "--tags", - "--abbrev=0", - }, - .cwd = b.pathFromRoot("."), - .expand_arg0 = .expand, - }) catch { - std.debug.print("Warning: failed to get git HEAD", .{}); - unreachable; - }).stdout, - "\n \t", - ), + .version = std.SemanticVersion{ .major = 0, .minor = 4, .patch = 0 }, // Current commit sha .sha = std.posix.getenv("GIT_SHA") orelse std.posix.getenv("GITHUB_SHA") orelse std.mem.trim( diff --git a/src/main.zig b/src/main.zig index 0cfe50ee..267c2cca 100644 --- a/src/main.zig +++ b/src/main.zig @@ -30,9 +30,9 @@ else fn printBanner(out: std.fs.File.Writer, full: bool) void { out.print( - "\nšŸ‘Øā€šŸš€ buzz {s}-{s} Copyright (C) 2021-present Benoit Giannangeli\n", + "\nšŸ‘Øā€šŸš€ buzz {}-{s} Copyright (C) 2021-present Benoit Giannangeli\n", .{ - if (BuildOptions.version.len > 0) BuildOptions.version else "unreleased", + BuildOptions.version, BuildOptions.sha, }, ) catch unreachable; diff --git a/src/repl.zig b/src/repl.zig index 827423dc..91c3aee5 100644 --- a/src/repl.zig +++ b/src/repl.zig @@ -41,9 +41,9 @@ const Scanner = @import("Scanner.zig"); pub fn printBanner(out: std.fs.File.Writer, full: bool) void { out.print( - "\nšŸ‘Øā€šŸš€ buzz {s}-{s} Copyright (C) 2021-present Benoit Giannangeli\n", + "\nšŸ‘Øā€šŸš€ buzz {}-{s} Copyright (C) 2021-present Benoit Giannangeli\n", .{ - if (BuildOptions.version.len > 0) BuildOptions.version else "unreleased", + BuildOptions.version, BuildOptions.sha, }, ) catch unreachable;