| ... | @@ -48,6 +48,11 @@ condition: enum { output_outdated, always } = .output_outdated, | ... | @@ -48,6 +48,11 @@ condition: enum { output_outdated, always } = .output_outdated, |
| 48 | /// that the RunStep should be re-executed. | 48 | /// that the RunStep should be re-executed. |
| 49 | extra_file_dependencies: []const []const u8 = &.{}, | 49 | extra_file_dependencies: []const []const u8 = &.{}, |
| 50 | | 50 | |
| | 51 | /// After adding an output argument, this step will by default rename itself |
| | 52 | /// for a better display name in the build summary. |
| | 53 | /// This can be disabled by setting this to false. |
| | 54 | rename_step_with_output_arg: bool, |
| | 55 | |
| 51 | pub const StdIoAction = union(enum) { | 56 | pub const StdIoAction = union(enum) { |
| 52 | inherit, | 57 | inherit, |
| 53 | ignore, | 58 | ignore, |
| ... | @@ -80,6 +85,7 @@ pub fn create(builder: *std.Build, name: []const u8) *RunStep { | ... | @@ -80,6 +85,7 @@ pub fn create(builder: *std.Build, name: []const u8) *RunStep { |
| 80 | .cwd = null, | 85 | .cwd = null, |
| 81 | .env_map = null, | 86 | .env_map = null, |
| 82 | .print = builder.verbose, | 87 | .print = builder.verbose, |
| | 88 | .rename_step_with_output_arg = true, |
| 83 | }; | 89 | }; |
| 84 | return self; | 90 | return self; |
| 85 | } | 91 | } |
| ... | @@ -100,6 +106,11 @@ pub fn addOutputFileArg(rs: *RunStep, basename: []const u8) std.Build.FileSource | ... | @@ -100,6 +106,11 @@ pub fn addOutputFileArg(rs: *RunStep, basename: []const u8) std.Build.FileSource |
| 100 | .basename = rs.builder.dupe(basename), | 106 | .basename = rs.builder.dupe(basename), |
| 101 | } }) catch @panic("OOM"); | 107 | } }) catch @panic("OOM"); |
| 102 | | 108 | |
| | 109 | if (rs.rename_step_with_output_arg) { |
| | 110 | rs.rename_step_with_output_arg = false; |
| | 111 | rs.step.name = rs.builder.fmt("{s} ({s})", .{ rs.step.name, basename }); |
| | 112 | } |
| | 113 | |
| 103 | return .{ .generated = generated_file }; | 114 | return .{ .generated = generated_file }; |
| 104 | } | 115 | } |
| 105 | | 116 | |
| ... | @@ -207,7 +218,11 @@ fn needOutputCheck(self: RunStep) bool { | ... | @@ -207,7 +218,11 @@ fn needOutputCheck(self: RunStep) bool { |
| 207 | } | 218 | } |
| 208 | | 219 | |
| 209 | fn make(step: *Step, prog_node: *std.Progress.Node) !void { | 220 | fn make(step: *Step, prog_node: *std.Progress.Node) !void { |
| | 221 | // Unfortunately we have no way to collect progress from arbitrary programs. |
| | 222 | // Perhaps in the future Zig could offer some kind of opt-in IPC mechanism that |
| | 223 | // processes could use to supply progress updates. |
| 210 | _ = prog_node; | 224 | _ = prog_node; |
| | 225 | |
| 211 | const self = @fieldParentPtr(RunStep, "step", step); | 226 | const self = @fieldParentPtr(RunStep, "step", step); |
| 212 | const need_output_check = self.needOutputCheck(); | 227 | const need_output_check = self.needOutputCheck(); |
| 213 | | 228 | |