| ... | ... | @@ -4,6 +4,7 @@ const build = std.build; |
| 4 | 4 | const Step = build.Step; |
| 5 | 5 | const Builder = build.Builder; |
| 6 | 6 | const LibExeObjStep = build.LibExeObjStep; |
| 7 | const WriteFileStep = build.WriteFileStep; |
| 7 | 8 | const fs = std.fs; |
| 8 | 9 | const mem = std.mem; |
| 9 | 10 | const process = std.process; |
| ... | ... | @@ -42,6 +43,10 @@ pub const RunStep = struct { |
| 42 | 43 | |
| 43 | 44 | pub const Arg = union(enum) { |
| 44 | 45 | Artifact: *LibExeObjStep, |
| 46 | WriteFile: struct { |
| 47 | step: *WriteFileStep, |
| 48 | file_name: []const u8, |
| 49 | }, |
| 45 | 50 | Bytes: []u8, |
| 46 | 51 | }; |
| 47 | 52 | |
| ... | ... | @@ -62,6 +67,16 @@ pub const RunStep = struct { |
| 62 | 67 | self.step.dependOn(&artifact.step); |
| 63 | 68 | } |
| 64 | 69 | |
| 70 | pub fn addWriteFileArg(self: *RunStep, write_file: *WriteFileStep, file_name: []const u8) void { |
| 71 | self.argv.append(Arg{ |
| 72 | .WriteFile = .{ |
| 73 | .step = write_file, |
| 74 | .file_name = file_name, |
| 75 | }, |
| 76 | }) catch unreachable; |
| 77 | self.step.dependOn(&write_file.step); |
| 78 | } |
| 79 | |
| 65 | 80 | pub fn addArg(self: *RunStep, arg: []const u8) void { |
| 66 | 81 | self.argv.append(Arg{ .Bytes = self.builder.dupe(arg) }) catch unreachable; |
| 67 | 82 | } |
| ... | ... | @@ -142,6 +157,9 @@ pub const RunStep = struct { |
| 142 | 157 | for (self.argv.span()) |arg| { |
| 143 | 158 | switch (arg) { |
| 144 | 159 | Arg.Bytes => |bytes| try argv_list.append(bytes), |
| 160 | Arg.WriteFile => |file| { |
| 161 | try argv_list.append(file.step.getOutputPath(file.file_name)); |
| 162 | }, |
| 145 | 163 | Arg.Artifact => |artifact| { |
| 146 | 164 | if (artifact.target.isWindows()) { |
| 147 | 165 | // On Windows we don't have rpaths so we have to add .dll search paths to PATH |