diff --git a/GitRepoStep.zig b/GitRepoStep.zig index f2a777d..0dd1871 100644 --- a/GitRepoStep.zig +++ b/GitRepoStep.zig @@ -59,7 +59,7 @@ pub fn create(b: *std.build.Builder, opt: struct { .path = if (opt.path) |p| (b.allocator.dupe(u8, p) catch @panic("memory")) else ( std.fs.path.resolve(b.allocator, &[_][]const u8{ b.build_root, - "dep", + "dep", name, }) ) catch @panic("memory"), @@ -174,6 +174,9 @@ fn run(builder: *std.build.Builder, argv: []const []const u8) !void { std.log.info("[RUN] {s}", .{msg.items}); } + const stdout = std.io.getStdOut().writer(); + try stdout.print("GitRepoStep.zig: Hello0!\n", .{}); + const child = try std.ChildProcess.init(argv, builder.allocator); defer child.deinit(); @@ -184,7 +187,12 @@ fn run(builder: *std.build.Builder, argv: []const []const u8) !void { child.cwd = builder.build_root; child.env_map = builder.env_map; + try stdout.print("GitRepoStep.zig: Hello1!\n", .{}); + try child.spawn(); + + try stdout.print("GitRepoStep.zig: Hello2!\n", .{}); + const result = try child.wait(); switch (result) { .Exited => |code| if (code != 0) { @@ -196,6 +204,8 @@ fn run(builder: *std.build.Builder, argv: []const []const u8) !void { std.os.exit(0xff); }, } + + try stdout.print("GitRepoStep.zig: Hello3!\n", .{}); } // Get's the repository path and also verifies that the step requesting the path diff --git a/build.zig b/build.zig index 3952197..04bca38 100644 --- a/build.zig +++ b/build.zig @@ -26,7 +26,10 @@ fn buildOrFail(b: *Builder) anyerror { }); const build2 = addBuild(b, .{ .path = "build2.zig" }, .{}); build2.addArgs(try getBuildArgs(b)); + const stdout = std.io.getStdOut().writer(); + try stdout.print("build.zig: Hello1!\n", .{}); ziget_repo.step.make() catch |e| return e; + try stdout.print("build.zig: Hello2!\n", .{}); build2.step.make() catch |err| switch (err) { error.UnexpectedExitCode => std.os.exit(0xff), // error already printed by subprocess else => |e| return e,