diff --git a/build.zig b/build.zig index 26e40e4..ac7ff07 100644 --- a/build.zig +++ b/build.zig @@ -17,6 +17,11 @@ pub fn build(b: *std.Build) void { .optimize = optimize, .imports = imports, }); + // The version of dockyard, from build.zig.zon: the crash reports and + // the MCP server give it. + const opts = b.addOptions(); + opts.addOption([]const u8, "version", @import("build.zig.zon").version); + root.addOptions("build_options", opts); // LLVM and LLD link the system start files, as in the build of ztk. const exe = b.addExecutable(.{ .name = "dockyard", .root_module = root, .use_llvm = true, .use_lld = use_lld }); b.installArtifact(exe); @@ -102,6 +107,7 @@ pub fn build(b: *std.Build) void { }) }); test_opts.addOptionPath("guest_helper", host_guest.getEmittedBin()); test_module.addOptions("test_options", test_opts); + test_module.addOptions("build_options", opts); const tests = b.addTest(.{ .root_module = test_module, .use_llvm = true, .use_lld = use_lld }); const run_tests = b.addRunArtifact(tests); run_tests.step.dependOn(b.getInstallStep()); diff --git a/build.zig.zon b/build.zig.zon index 8eb1236..15bcb48 100644 --- a/build.zig.zon +++ b/build.zig.zon @@ -1,7 +1,7 @@ .{ .name = .dockyard, .fingerprint = 0x240b86b880fe647b, - .version = "0.1.0", + .version = "1.0.0-beta.1", .minimum_zig_version = "0.17.0", .dependencies = .{ .ztk = .{ diff --git a/src/app/crash.zig b/src/app/crash.zig index dd2acc9..68d50a9 100644 --- a/src/app/crash.zig +++ b/src/app/crash.zig @@ -21,7 +21,7 @@ const builtin = @import("builtin"); const ztcl = @import("ztcl"); const Io = std.Io; -pub const version = "0.1.0"; +pub const version: []const u8 = @import("build_options").version; const keep = 20; const on_posix = builtin.os.tag != .windows; diff --git a/src/app/mcp.zig b/src/app/mcp.zig index 143b537..ee6315d 100644 --- a/src/app/mcp.zig +++ b/src/app/mcp.zig @@ -86,7 +86,7 @@ pub fn handle(a: std.mem.Allocator, socket_path: [:0]const u8, line: []const u8) return success(a, id, .{ .protocolVersion = version, .capabilities = .{ .tools = .{ .listChanged = false } }, - .serverInfo = .{ .name = server_name, .version = "0.1.0" }, + .serverInfo = .{ .name = server_name, .version = @import("build_options").version }, .instructions = instructions, }); }