From 9ae739c4c95aec30e2ac4c49d0dc879ff4b5d169 Mon Sep 17 00:00:00 2001 From: Arnold Filip Date: Mon, 21 Jul 2025 15:00:15 +0200 Subject: Fix zig 0.15.0-dev.1149+4e6a04929 build errors --- build.zig | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'build.zig') diff --git a/build.zig b/build.zig index 6c76917..7522dee 100644 --- a/build.zig +++ b/build.zig @@ -126,19 +126,18 @@ pub fn build(b: *Build) !void { if (!validate_exercises()) std.process.exit(2); use_color_escapes = false; - if (std.io.getStdErr().supportsAnsiEscapeCodes()) { + if (std.fs.File.stderr().supportsAnsiEscapeCodes()) { use_color_escapes = true; } else if (builtin.os.tag == .windows) { const w32 = struct { - const WINAPI = std.os.windows.WINAPI; const DWORD = std.os.windows.DWORD; const ENABLE_VIRTUAL_TERMINAL_PROCESSING = 0x0004; const STD_ERROR_HANDLE: DWORD = @bitCast(@as(i32, -12)); - extern "kernel32" fn GetStdHandle(id: DWORD) callconv(WINAPI) ?*anyopaque; - extern "kernel32" fn GetConsoleMode(console: ?*anyopaque, out_mode: *DWORD) callconv(WINAPI) u32; - extern "kernel32" fn SetConsoleMode(console: ?*anyopaque, mode: DWORD) callconv(WINAPI) u32; + const GetStdHandle = std.os.windows.kernel32.GetStdHandle; + const GetConsoleMode = std.os.windows.kernel32.GetConsoleMode; + const SetConsoleMode = std.os.windows.kernel32.SetConsoleMode; }; - const handle = w32.GetStdHandle(w32.STD_ERROR_HANDLE); + const handle = w32.GetStdHandle(w32.STD_ERROR_HANDLE).?; var mode: w32.DWORD = 0; if (w32.GetConsoleMode(handle, &mode) != 0) { mode |= w32.ENABLE_VIRTUAL_TERMINAL_PROCESSING; -- cgit v1.2.3 From b499788606d83aac75e82da2d32b5b7ceb3d6896 Mon Sep 17 00:00:00 2001 From: Chris Boesch Date: Tue, 22 Jul 2025 00:40:06 +0200 Subject: Corrected the necessary Zig version --- build.zig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'build.zig') diff --git a/build.zig b/build.zig index 7522dee..ebe6838 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.1573"; + const required_zig = "0.15.0-dev.1092"; const current_zig = builtin.zig_version; const min_zig = std.SemanticVersion.parse(required_zig) catch unreachable; if (current_zig.order(min_zig) == .lt) { -- cgit v1.2.3 From 54f48c75c415f03acba5c3744454e7e9e45840d4 Mon Sep 17 00:00:00 2001 From: Chris Boesch Date: Tue, 22 Jul 2025 10:16:17 +0200 Subject: Fixed 82 --- build.zig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'build.zig') diff --git a/build.zig b/build.zig index ebe6838..f3dd2d2 100644 --- a/build.zig +++ b/build.zig @@ -1063,7 +1063,7 @@ const exercises = [_]Exercise{ .{ .main_file = "082_anonymous_structs3.zig", .output = - \\"0"(bool):true "1"(bool):false "2"(i32):42 "3"(f32):3.141592e0 + \\"0"(bool):true "1"(bool):false "2"(i32):42 "3"(f32):3.141592 , .hint = "This one is a challenge! But you have everything you need.", }, -- cgit v1.2.3 From 9bff77a12a4f6eedeadbd2ad6076be4fe2c4e804 Mon Sep 17 00:00:00 2001 From: DoKoB Date: Tue, 5 Aug 2025 08:11:36 +0530 Subject: fix: initial zig build caused by self.step.evalZigProcess() --- build.zig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'build.zig') diff --git a/build.zig b/build.zig index f3dd2d2..8b22a3c 100644 --- a/build.zig +++ b/build.zig @@ -519,7 +519,7 @@ const ZiglingStep = struct { // 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_dir = try self.step.evalZigProcess(zig_args.items, prog_node, false, null, b.allocator); const exe_name = switch (self.exercise.kind) { .exe => self.exercise.name(), .@"test" => "test", -- cgit v1.2.3 From fd310273a7aeecbf877057a62c3f32bc1405c926 Mon Sep 17 00:00:00 2001 From: Chris Boesch Date: Fri, 8 Aug 2025 20:34:59 +0200 Subject: Current version set --- README.md | 1 + build.zig | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) (limited to 'build.zig') diff --git a/README.md b/README.md index b497666..c3fc8a0 100644 --- a/README.md +++ b/README.md @@ -88,6 +88,7 @@ that if you update one, you may need to also update the other. ### Version Changes Version-0.15.0-dev.1092 +* *2025-08-08* zig 0.15.0-dev.1380 - changes in build system, see [#24588](https://github.com/ziglang/zig/pull/24588) * *2025-07-22* zig 0.15.0-dev.1092 - various changes due to new I/O API, see [#24488](https://github.com/ziglang/zig/pull/24488) * *2024-09-16* zig 0.14.0-dev.1573 - introduction of labeled switch, see [#21257](https://github.com/ziglang/zig/pull/21257) * *2024-09-02* zig 0.14.0-dev.1409 - several changes in std.builtin, see [#21225](https://github.com/ziglang/zig/pull/21225) diff --git a/build.zig b/build.zig index 8b22a3c..eaf4646 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.15.0-dev.1092"; + const required_zig = "0.15.0-dev.1380"; const current_zig = builtin.zig_version; const min_zig = std.SemanticVersion.parse(required_zig) catch unreachable; if (current_zig.order(min_zig) == .lt) { -- cgit v1.2.3 From aeacadb76be91619417d3d13df20b25a0ca21392 Mon Sep 17 00:00:00 2001 From: Chris Boesch Date: Fri, 15 Aug 2025 15:00:53 +0200 Subject: Fixed changes in array list --- README.md | 1 + build.zig | 12 ++++++------ 2 files changed, 7 insertions(+), 6 deletions(-) (limited to 'build.zig') diff --git a/README.md b/README.md index 7800942..ca2069a 100644 --- a/README.md +++ b/README.md @@ -88,6 +88,7 @@ that if you update one, you may need to also update the other. ### Version Changes Version-0.15.0-dev.1380 +* *2025-08-08* zig 0.15.0-dev.1519 - changes in array listr, see [#24801](https://github.com/ziglang/zig/pull/24801) * *2025-08-08* zig 0.15.0-dev.1380 - changes in build system, see [#24588](https://github.com/ziglang/zig/pull/24588) * *2025-07-22* zig 0.15.0-dev.1092 - various changes due to new I/O API, see [#24488](https://github.com/ziglang/zig/pull/24488) * *2024-09-16* zig 0.14.0-dev.1573 - introduction of labeled switch, see [#21257](https://github.com/ziglang/zig/pull/21257) diff --git a/build.zig b/build.zig index eaf4646..e72dd4d 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.15.0-dev.1380"; + const required_zig = "0.15.0-dev.1519"; const current_zig = builtin.zig_version; const min_zig = std.SemanticVersion.parse(required_zig) catch unreachable; if (current_zig.order(min_zig) == .lt) { @@ -492,7 +492,7 @@ const ZiglingStep = struct { const path = join(b.allocator, &.{ self.work_path, exercise_path }) catch @panic("OOM"); - var zig_args = std.ArrayList([]const u8).init(b.allocator); + var zig_args = std.array_list.Managed([]const u8).init(b.allocator); defer zig_args.deinit(); zig_args.append(b.graph.zig_exe) catch @panic("OOM"); @@ -581,17 +581,17 @@ fn resetLine() void { /// Removes trailing whitespace for each line in buf, also ensuring that there /// are no trailing LF characters at the end. pub fn trimLines(allocator: std.mem.Allocator, buf: []const u8) ![]const u8 { - var list = try std.ArrayList(u8).initCapacity(allocator, buf.len); + var list = try std.array_list.Aligned(u8, null).initCapacity(allocator, buf.len); var iter = std.mem.splitSequence(u8, buf, " \n"); while (iter.next()) |line| { // TODO: trimming CR characters is probably not necessary. const data = std.mem.trimRight(u8, line, " \r"); - try list.appendSlice(data); - try list.append('\n'); + try list.appendSlice(allocator, data); + try list.append(allocator, '\n'); } - const result = try list.toOwnedSlice(); // TODO: probably not necessary + const result = try list.toOwnedSlice(allocator); // TODO: probably not necessary // Remove the trailing LF character, that is always present in the exercise // output. -- cgit v1.2.3 From 02db8326778072c638b84293b30b55999f5ba585 Mon Sep 17 00:00:00 2001 From: "Simon 'Sze' L. Schlee" Date: Sun, 24 Aug 2025 03:08:17 +0200 Subject: pass -freference-trace to executed compile command Currently users executing `zig build` to run the exercises, may encounter compiler output that tells them to use `-freference-trace=[num]` to see more of the hidden reference traces, so we should pass this parameter to the zigling exercise being compiled, so that the learner can provide this parameter like they would normally, when using `zig build` directly in normal Zig programs. --- build.zig | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'build.zig') diff --git a/build.zig b/build.zig index e72dd4d..7e8bf7a 100644 --- a/build.zig +++ b/build.zig @@ -508,6 +508,10 @@ const ZiglingStep = struct { zig_args.append("-lc") catch @panic("OOM"); } + if (b.reference_trace) |rt| { + zig_args.append(b.fmt("-freference-trace={}", .{rt})) catch @panic("OOM"); + } + zig_args.append(b.pathFromRoot(path)) catch @panic("OOM"); zig_args.append("--cache-dir") catch @panic("OOM"); -- cgit v1.2.3