Merge pull request #341 from leecannon/patch-1

Update to new std.build changes
This commit is contained in:
Alexandros Naskos 2021-06-13 11:53:55 +03:00 committed by GitHub
commit 66d629f3f2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 3 deletions

View File

@ -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", 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.setTarget(target);
exe.setBuildMode(mode); exe.setBuildMode(mode);
@ -31,7 +31,7 @@ pub fn build(b: *std.build.Builder) !void {
test_step.dependOn(&unit_tests.step); test_step.dependOn(&unit_tests.step);
var session_tests = b.addTest("tests/sessions.zig"); 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); session_tests.setBuildMode(.Debug);
test_step.dependOn(&session_tests.step); test_step.dependOn(&session_tests.step);
} }

View File

@ -52,7 +52,11 @@ fn processStep(stdout_stream: anytype, step: *std.build.Step) anyerror!void {
} }
fn processPackage(out_stream: anytype, pkg: Pkg) 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| { if (pkg.dependencies) |dependencies| {
for (dependencies) |dep| { for (dependencies) |dep| {
try processPackage(out_stream, dep); try processPackage(out_stream, dep);