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