Skip to content

Commit 1582f60

Browse files
committed
v0.2.0: zwasm v0.2.0 hash update, comptime version string
- Update zwasm dependency hash for updated v0.2.0 release - Version string now derived from build.zig.zon via build_options
1 parent 12cc1d0 commit 1582f60

3 files changed

Lines changed: 10 additions & 4 deletions

File tree

build.zig

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,12 @@ pub fn build(b: *std.Build) void {
88
const profile_opcodes = b.option(bool, "profile-opcodes", "Enable opcode frequency profiling") orelse false;
99
const profile_alloc = b.option(bool, "profile-alloc", "Enable allocation size profiling") orelse false;
1010

11+
const build_zon = @import("build.zig.zon");
12+
1113
const options = b.addOptions();
1214
options.addOption(bool, "profile_opcodes", profile_opcodes);
1315
options.addOption(bool, "profile_alloc", profile_alloc);
16+
options.addOption([]const u8, "version", build_zon.version);
1417
const options_module = options.createModule();
1518

1619
// zwasm dependency (Wasm runtime library)

build.zig.zon

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
.dependencies = .{
55
.zwasm = .{
66
.url = "https://github.com/clojurewasm/zwasm/archive/v0.2.0.tar.gz",
7-
.hash = "zwasm-0.2.0-IBbzFwWdGQD-xHjh536a-04lal8Su_TaMzBy5hwn8bR0",
7+
.hash = "zwasm-0.2.0-IBbzF4qdGQDY2MqbDOXjG3hsd8aEGaEpsSQndxRMtCmV",
88
},
99
},
1010
.fingerprint = 0x62a7be489d633543,

src/main.zig

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,18 @@ const Form = @import("reader/form.zig").Form;
3737
const wasm_builtins = @import("wasm/builtins.zig");
3838
const deps_mod = @import("deps.zig");
3939

40+
const build_options = @import("build_options");
41+
const version_string = "ClojureWasm v" ++ build_options.version ++ "\n";
42+
4043
/// Magic trailer bytes appended to built binaries.
4144
const embed_magic = "CLJW";
4245
/// Trailer size: u64 payload_size (8) + magic (4) = 12 bytes.
4346
const embed_trailer_size = 12;
4447

4548
fn printHelp() void {
4649
const stdout: std.fs.File = .{ .handle = std.posix.STDOUT_FILENO };
50+
_ = stdout.write(version_string) catch {};
4751
_ = stdout.write(
48-
\\ClojureWasm v0.2.0
4952
\\
5053
\\Usage:
5154
\\ cljw [options] [file.clj]
@@ -202,7 +205,7 @@ pub fn main() !void {
202205
return;
203206
} else if (std.mem.eql(u8, arg, "--version")) {
204207
const stdout: std.fs.File = .{ .handle = std.posix.STDOUT_FILENO };
205-
_ = stdout.write("ClojureWasm v0.2.0\n") catch {};
208+
_ = stdout.write(version_string) catch {};
206209
return;
207210
} else if (std.mem.eql(u8, arg, "--tree-walk")) {
208211
use_vm = false;
@@ -542,7 +545,7 @@ fn runRepl(allocator: Allocator, env: *Env, gc: *gc_mod.MarkSweepGc) void {
542545
return;
543546
}
544547

545-
_ = stdout.write("ClojureWasm v0.2.0\n") catch {};
548+
_ = stdout.write(version_string) catch {};
546549

547550
var editor = line_editor.LineEditor.init(allocator, env);
548551
defer editor.deinit();

0 commit comments

Comments
 (0)