From dab5197027490d4170a47ac105113c0f07d64672 Mon Sep 17 00:00:00 2001 From: Chris Boesch Date: Thu, 22 Aug 2024 18:19:21 +0200 Subject: [PATCH 1/2] Fixes changes in zig build system. --- README.md | 3 ++- build.zig | 22 ++++++++++++++++++---- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 5385cff..9216582 100644 --- a/README.md +++ b/README.md @@ -88,7 +88,8 @@ that if you update one, you may need to also update the other. ### Version Changes -Version-0.14.0-dev.839 +Version-0.14.0-dev.1248 +* *2024-08-04* zig 0.14.0-dev.1248 - several changes in build system, see [#21115](https://github.com/ziglang/zig/pull/21115) * *2024-08-04* zig 0.14.0-dev.839 - several changes in build system, see [#20580](https://github.com/ziglang/zig/pull/20580), [#20600](https://github.com/ziglang/zig/issues/20600) * *2024-06-17* zig 0.14.0-dev.42 - changes in `std.mem.split and tokenize` - see [#15579](https://github.com/ziglang/zig/pull/15579) * *2024-05-29* zig 0.13.0-dev.339 - rework std.Progress - see [#20059](https://github.com/ziglang/zig/pull/20059) diff --git a/build.zig b/build.zig index abc98b9..ceadc8b 100644 --- a/build.zig +++ b/build.zig @@ -15,7 +15,7 @@ const print = std.debug.print; // 1) Getting Started // 2) Version Changes comptime { - const required_zig = "0.14.0-dev.839"; + const required_zig = "0.14.0-dev.1248"; const current_zig = builtin.zig_version; const min_zig = std.SemanticVersion.parse(required_zig) catch unreachable; if (current_zig.order(min_zig) == .lt) { @@ -316,7 +316,7 @@ const ZiglingStep = struct { std.process.exit(2); }; - self.run(exe_path.?, options.progress_node) catch { + self.run(exe_path, options.progress_node) catch { self.printErrors(); if (self.exercise.hint) |hint| @@ -426,7 +426,7 @@ const ZiglingStep = struct { print("{s}PASSED{s}\n\n", .{ green_text, reset_text }); } - fn compile(self: *ZiglingStep, prog_node: std.Progress.Node) !?[]const u8 { + fn compile(self: *ZiglingStep, prog_node: std.Progress.Node) ![]const u8 { print("Compiling: {s}\n", .{self.exercise.main_file}); const b = self.step.owner; @@ -457,7 +457,21 @@ const ZiglingStep = struct { zig_args.append("--listen=-") catch @panic("OOM"); - return try self.step.evalZigProcess(zig_args.items, prog_node, false); + // + // NOTE: After many changes in zig build system, we need to create the cache path manually. + // See https://github.com/ziglang/zig/pull/21115 + // Maybe there is a better way (in the future). + const exe_dir = try self.step.evalZigProcess(zig_args.items, prog_node, false); + const exe_name = switch (self.exercise.kind) { + .exe => self.exercise.name(), + .@"test" => "test", + }; + const sep = std.fs.path.sep_str; + const root_path = exe_dir.?.root_dir.path.?; + const sub_path = exe_dir.?.subPathOrDot(); + const exe_path = b.fmt("{s}{s}{s}{s}{s}", .{ root_path, sep, sub_path, sep, exe_name }); + + return exe_path; } fn help(self: *ZiglingStep) void { From 8e35cf79901ffe38b3325412a605fdb6cefbeb8f Mon Sep 17 00:00:00 2001 From: Chris Boesch Date: Thu, 22 Aug 2024 18:32:36 +0200 Subject: [PATCH 2/2] Insert wrong version number into build file. --- README.md | 4 ++-- build.zig | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 9216582..417cf88 100644 --- a/README.md +++ b/README.md @@ -88,8 +88,8 @@ that if you update one, you may need to also update the other. ### Version Changes -Version-0.14.0-dev.1248 -* *2024-08-04* zig 0.14.0-dev.1248 - several changes in build system, see [#21115](https://github.com/ziglang/zig/pull/21115) +Version-0.14.0-dev.1224 +* *2024-08-04* zig 0.14.0-dev.1224 - several changes in build system, see [#21115](https://github.com/ziglang/zig/pull/21115) * *2024-08-04* zig 0.14.0-dev.839 - several changes in build system, see [#20580](https://github.com/ziglang/zig/pull/20580), [#20600](https://github.com/ziglang/zig/issues/20600) * *2024-06-17* zig 0.14.0-dev.42 - changes in `std.mem.split and tokenize` - see [#15579](https://github.com/ziglang/zig/pull/15579) * *2024-05-29* zig 0.13.0-dev.339 - rework std.Progress - see [#20059](https://github.com/ziglang/zig/pull/20059) diff --git a/build.zig b/build.zig index ceadc8b..c488608 100644 --- a/build.zig +++ b/build.zig @@ -15,7 +15,7 @@ const print = std.debug.print; // 1) Getting Started // 2) Version Changes comptime { - const required_zig = "0.14.0-dev.1248"; + const required_zig = "0.14.0-dev.1224"; const current_zig = builtin.zig_version; const min_zig = std.SemanticVersion.parse(required_zig) catch unreachable; if (current_zig.order(min_zig) == .lt) {