From 0eee9dcd9f10b64d7339937650ecbcf00dd14d7a Mon Sep 17 00:00:00 2001 From: Lee Cannon Date: Sat, 12 Jun 2021 22:52:51 +0100 Subject: [PATCH 1/2] Update to new std.build changes A few functions now take `std.build.FileSource` --- build.zig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.zig b/build.zig index f763798..a44c249 100644 --- a/build.zig +++ b/build.zig @@ -15,7 +15,7 @@ pub fn build(b: *std.build.Builder) !void { b.option([]const u8, "data_version", "The data version - 0.7.0, 0.7.1 or master.") orelse "master", ); - exe.addPackage(.{ .name = "known-folders", .path = "src/known-folders/known-folders.zig" }); + exe.addPackage(.{ .name = "known-folders", .path = .{ .path = "src/known-folders/known-folders.zig" } }); exe.setTarget(target); exe.setBuildMode(mode); @@ -31,7 +31,7 @@ pub fn build(b: *std.build.Builder) !void { test_step.dependOn(&unit_tests.step); var session_tests = b.addTest("tests/sessions.zig"); - session_tests.addPackage(.{ .name = "header", .path = "src/header.zig" }); + session_tests.addPackage(.{ .name = "header", .path = .{ .path = "src/header.zig" } }); session_tests.setBuildMode(.Debug); test_step.dependOn(&session_tests.step); } From a077cf901d465c40073fdc7788dcc3c6f661619d Mon Sep 17 00:00:00 2001 From: Lee Cannon Date: Sat, 12 Jun 2021 23:06:48 +0100 Subject: [PATCH 2/2] Update build_runner.zig I'm not 100% sure if the `GeneratedFile`'s path will have been resolved when this code runs or if this will hit the panic inside `getPath()` as I havent had a chance to actually mess about with the new functionality. --- src/special/build_runner.zig | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/special/build_runner.zig b/src/special/build_runner.zig index 7567443..5c5be3a 100644 --- a/src/special/build_runner.zig +++ b/src/special/build_runner.zig @@ -52,7 +52,11 @@ fn processStep(stdout_stream: anytype, step: *std.build.Step) anyerror!void { } fn processPackage(out_stream: anytype, pkg: Pkg) anyerror!void { - try out_stream.print("{s}\x00{s}\n", .{ pkg.name, pkg.path }); + switch (pkg.path) { + .path => |path| try out_stream.print("{s}\x00{s}\n", .{ pkg.name, path }), + .generated => |generated| try out_stream.print("{s}\x00{s}\n", .{ pkg.name, generated.getPath() }), + } + if (pkg.dependencies) |dependencies| { for (dependencies) |dep| { try processPackage(out_stream, dep);