| ... | @@ -99,6 +99,7 @@ pub fn main() !void { | ... | @@ -99,6 +99,7 @@ pub fn main() !void { |
| 99 | var skip_oom_steps: bool = false; | 99 | var skip_oom_steps: bool = false; |
| 100 | var color: Color = .auto; | 100 | var color: Color = .auto; |
| 101 | var seed: u32 = 0; | 101 | var seed: u32 = 0; |
| | 102 | var prominent_compile_errors: bool = false; |
| 102 | | 103 | |
| 103 | const stderr_stream = io.getStdErr().writer(); | 104 | const stderr_stream = io.getStdErr().writer(); |
| 104 | const stdout_stream = io.getStdOut().writer(); | 105 | const stdout_stream = io.getStdOut().writer(); |
| ... | @@ -242,6 +243,8 @@ pub fn main() !void { | ... | @@ -242,6 +243,8 @@ pub fn main() !void { |
| 242 | builder.verbose_cc = true; | 243 | builder.verbose_cc = true; |
| 243 | } else if (mem.eql(u8, arg, "--verbose-llvm-cpu-features")) { | 244 | } else if (mem.eql(u8, arg, "--verbose-llvm-cpu-features")) { |
| 244 | builder.verbose_llvm_cpu_features = true; | 245 | builder.verbose_llvm_cpu_features = true; |
| | 246 | } else if (mem.eql(u8, arg, "--prominent-compile-errors")) { |
| | 247 | prominent_compile_errors = true; |
| 245 | } else if (mem.eql(u8, arg, "-fwine")) { | 248 | } else if (mem.eql(u8, arg, "-fwine")) { |
| 246 | builder.enable_wine = true; | 249 | builder.enable_wine = true; |
| 247 | } else if (mem.eql(u8, arg, "-fno-wine")) { | 250 | } else if (mem.eql(u8, arg, "-fno-wine")) { |
| ... | @@ -325,6 +328,7 @@ pub fn main() !void { | ... | @@ -325,6 +328,7 @@ pub fn main() !void { |
| 325 | .max_rss_mutex = .{}, | 328 | .max_rss_mutex = .{}, |
| 326 | .skip_oom_steps = skip_oom_steps, | 329 | .skip_oom_steps = skip_oom_steps, |
| 327 | .memory_blocked_steps = std.ArrayList(*Step).init(arena), | 330 | .memory_blocked_steps = std.ArrayList(*Step).init(arena), |
| | 331 | .prominent_compile_errors = prominent_compile_errors, |
| 328 | | 332 | |
| 329 | .claimed_rss = 0, | 333 | .claimed_rss = 0, |
| 330 | .summary = summary, | 334 | .summary = summary, |
| ... | @@ -357,6 +361,7 @@ const Run = struct { | ... | @@ -357,6 +361,7 @@ const Run = struct { |
| 357 | max_rss_mutex: std.Thread.Mutex, | 361 | max_rss_mutex: std.Thread.Mutex, |
| 358 | skip_oom_steps: bool, | 362 | skip_oom_steps: bool, |
| 359 | memory_blocked_steps: std.ArrayList(*Step), | 363 | memory_blocked_steps: std.ArrayList(*Step), |
| | 364 | prominent_compile_errors: bool, |
| 360 | | 365 | |
| 361 | claimed_rss: usize, | 366 | claimed_rss: usize, |
| 362 | summary: ?Summary, | 367 | summary: ?Summary, |
| ... | @@ -561,7 +566,7 @@ fn runStepNames( | ... | @@ -561,7 +566,7 @@ fn runStepNames( |
| 561 | // Finally, render compile errors at the bottom of the terminal. | 566 | // Finally, render compile errors at the bottom of the terminal. |
| 562 | // We use a separate compile_error_steps array list because step_stack is destructively | 567 | // We use a separate compile_error_steps array list because step_stack is destructively |
| 563 | // mutated in printTreeStep above. | 568 | // mutated in printTreeStep above. |
| 564 | if (total_compile_errors > 0) { | 569 | if (run.prominent_compile_errors and total_compile_errors > 0) { |
| 565 | for (compile_error_steps.items) |s| { | 570 | for (compile_error_steps.items) |s| { |
| 566 | if (s.result_error_bundle.errorMessageCount() > 0) { | 571 | if (s.result_error_bundle.errorMessageCount() > 0) { |
| 567 | s.result_error_bundle.renderToStdErr(renderOptions(ttyconf)); | 572 | s.result_error_bundle.renderToStdErr(renderOptions(ttyconf)); |
| ... | @@ -910,7 +915,11 @@ fn workerMakeOneStep( | ... | @@ -910,7 +915,11 @@ fn workerMakeOneStep( |
| 910 | const make_result = s.make(&sub_prog_node); | 915 | const make_result = s.make(&sub_prog_node); |
| 911 | | 916 | |
| 912 | // No matter the result, we want to display error/warning messages. | 917 | // No matter the result, we want to display error/warning messages. |
| 913 | if (s.result_error_msgs.items.len > 0) { | 918 | const show_compile_errors = !run.prominent_compile_errors and |
| | 919 | s.result_error_bundle.errorMessageCount() > 0; |
| | 920 | const show_error_msgs = s.result_error_msgs.items.len > 0; |
| | 921 | |
| | 922 | if (show_error_msgs or show_compile_errors) { |
| 914 | sub_prog_node.context.lock_stderr(); | 923 | sub_prog_node.context.lock_stderr(); |
| 915 | defer sub_prog_node.context.unlock_stderr(); | 924 | defer sub_prog_node.context.unlock_stderr(); |
| 916 | | 925 | |
| ... | @@ -1003,7 +1012,11 @@ fn printErrorMessages(b: *std.Build, failing_step: *Step, run: *const Run) !void | ... | @@ -1003,7 +1012,11 @@ fn printErrorMessages(b: *std.Build, failing_step: *Step, run: *const Run) !void |
| 1003 | } | 1012 | } |
| 1004 | try ttyconf.setColor(stderr, .reset); | 1013 | try ttyconf.setColor(stderr, .reset); |
| 1005 | | 1014 | |
| 1006 | // Finally, the actual error messages. | 1015 | // Penultimately, the compilation errors. |
| | 1016 | if (!run.prominent_compile_errors and failing_step.result_error_bundle.errorMessageCount() > 0) |
| | 1017 | try failing_step.result_error_bundle.renderToWriter(renderOptions(ttyconf), stderr.writer()); |
| | 1018 | |
| | 1019 | // Finally, generic error messages. |
| 1007 | for (failing_step.result_error_msgs.items) |msg| { | 1020 | for (failing_step.result_error_msgs.items) |msg| { |
| 1008 | try ttyconf.setColor(stderr, .red); | 1021 | try ttyconf.setColor(stderr, .red); |
| 1009 | try stderr.writeAll("error: "); | 1022 | try stderr.writeAll("error: "); |
| ... | @@ -1078,6 +1091,7 @@ fn usage(builder: *std.Build, already_ran_build: bool, out_stream: anytype) !voi | ... | @@ -1078,6 +1091,7 @@ fn usage(builder: *std.Build, already_ran_build: bool, out_stream: anytype) !voi |
| 1078 | \\ -l, --list-steps Print available steps | 1091 | \\ -l, --list-steps Print available steps |
| 1079 | \\ --verbose Print commands before executing them | 1092 | \\ --verbose Print commands before executing them |
| 1080 | \\ --color [auto|off|on] Enable or disable colored error messages | 1093 | \\ --color [auto|off|on] Enable or disable colored error messages |
| | 1094 | \\ --prominent-compile-errors Buffer compile errors and display at end |
| 1081 | \\ --summary [mode] Control the printing of the build summary | 1095 | \\ --summary [mode] Control the printing of the build summary |
| 1082 | \\ all Print the build summary in its entirety | 1096 | \\ all Print the build summary in its entirety |
| 1083 | \\ failures (Default) Only print failed steps | 1097 | \\ failures (Default) Only print failed steps |