summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Boesch <chrboesch@noreply.codeberg.org>2024-08-22 18:19:21 +0200
committerChris Boesch <chrboesch@noreply.codeberg.org>2024-08-22 18:19:21 +0200
commitdab5197027490d4170a47ac105113c0f07d64672 (patch)
tree0219ed58c456cb7d7781377631d72de6b916330c
parented88236fa729f12e98fafc6fd39a3c7913f10511 (diff)
Fixes changes in zig build system.
-rw-r--r--README.md3
-rw-r--r--build.zig22
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 {