| ... | @@ -733,7 +733,7 @@ fn runStepNames( | ... | @@ -733,7 +733,7 @@ fn runStepNames( |
| 733 | if (run.prominent_compile_errors and total_compile_errors > 0) { | 733 | if (run.prominent_compile_errors and total_compile_errors > 0) { |
| 734 | for (step_stack.keys()) |s| { | 734 | for (step_stack.keys()) |s| { |
| 735 | if (s.result_error_bundle.errorMessageCount() > 0) { | 735 | if (s.result_error_bundle.errorMessageCount() > 0) { |
| 736 | s.result_error_bundle.renderToStdErr(renderOptions(ttyconf)); | 736 | s.result_error_bundle.renderToStdErr(.{ .ttyconf = ttyconf, .include_reference_trace = (b.reference_trace orelse 0) > 0 }); |
| 737 | } | 737 | } |
| 738 | } | 738 | } |
| 739 | | 739 | |
| ... | @@ -1112,7 +1112,11 @@ fn workerMakeOneStep( | ... | @@ -1112,7 +1112,11 @@ fn workerMakeOneStep( |
| 1112 | defer std.debug.unlockStdErr(); | 1112 | defer std.debug.unlockStdErr(); |
| 1113 | | 1113 | |
| 1114 | const gpa = b.allocator; | 1114 | const gpa = b.allocator; |
| 1115 | printErrorMessages(gpa, s, run.ttyconf, run.stderr, run.prominent_compile_errors) catch {}; | 1115 | const options: std.zig.ErrorBundle.RenderOptions = .{ |
| | 1116 | .ttyconf = run.ttyconf, |
| | 1117 | .include_reference_trace = (b.reference_trace orelse 0) > 0, |
| | 1118 | }; |
| | 1119 | printErrorMessages(gpa, s, options, run.stderr, run.prominent_compile_errors) catch {}; |
| 1116 | } | 1120 | } |
| 1117 | | 1121 | |
| 1118 | handle_result: { | 1122 | handle_result: { |
| ... | @@ -1168,7 +1172,7 @@ fn workerMakeOneStep( | ... | @@ -1168,7 +1172,7 @@ fn workerMakeOneStep( |
| 1168 | pub fn printErrorMessages( | 1172 | pub fn printErrorMessages( |
| 1169 | gpa: Allocator, | 1173 | gpa: Allocator, |
| 1170 | failing_step: *Step, | 1174 | failing_step: *Step, |
| 1171 | ttyconf: std.io.tty.Config, | 1175 | options: std.zig.ErrorBundle.RenderOptions, |
| 1172 | stderr: File, | 1176 | stderr: File, |
| 1173 | prominent_compile_errors: bool, | 1177 | prominent_compile_errors: bool, |
| 1174 | ) !void { | 1178 | ) !void { |
| ... | @@ -1183,6 +1187,7 @@ pub fn printErrorMessages( | ... | @@ -1183,6 +1187,7 @@ pub fn printErrorMessages( |
| 1183 | } | 1187 | } |
| 1184 | | 1188 | |
| 1185 | // Now, `step_stack` has the subtree that we want to print, in reverse order. | 1189 | // Now, `step_stack` has the subtree that we want to print, in reverse order. |
| | 1190 | const ttyconf = options.ttyconf; |
| 1186 | try ttyconf.setColor(stderr, .dim); | 1191 | try ttyconf.setColor(stderr, .dim); |
| 1187 | var indent: usize = 0; | 1192 | var indent: usize = 0; |
| 1188 | while (step_stack.popOrNull()) |s| : (indent += 1) { | 1193 | while (step_stack.popOrNull()) |s| : (indent += 1) { |
| ... | @@ -1208,8 +1213,9 @@ pub fn printErrorMessages( | ... | @@ -1208,8 +1213,9 @@ pub fn printErrorMessages( |
| 1208 | } | 1213 | } |
| 1209 | } | 1214 | } |
| 1210 | | 1215 | |
| 1211 | if (!prominent_compile_errors and failing_step.result_error_bundle.errorMessageCount() > 0) | 1216 | if (!prominent_compile_errors and failing_step.result_error_bundle.errorMessageCount() > 0) { |
| 1212 | try failing_step.result_error_bundle.renderToWriter(renderOptions(ttyconf), stderr.writer()); | 1217 | try failing_step.result_error_bundle.renderToWriter(options, stderr.writer()); |
| | 1218 | } |
| 1213 | | 1219 | |
| 1214 | for (failing_step.result_error_msgs.items) |msg| { | 1220 | for (failing_step.result_error_msgs.items) |msg| { |
| 1215 | try ttyconf.setColor(stderr, .red); | 1221 | try ttyconf.setColor(stderr, .red); |
| ... | @@ -1410,14 +1416,6 @@ fn get_tty_conf(color: Color, stderr: File) std.io.tty.Config { | ... | @@ -1410,14 +1416,6 @@ fn get_tty_conf(color: Color, stderr: File) std.io.tty.Config { |
| 1410 | }; | 1416 | }; |
| 1411 | } | 1417 | } |
| 1412 | | 1418 | |
| 1413 | fn renderOptions(ttyconf: std.io.tty.Config) std.zig.ErrorBundle.RenderOptions { | | |
| 1414 | return .{ | | |
| 1415 | .ttyconf = ttyconf, | | |
| 1416 | .include_source_line = ttyconf != .no_color, | | |
| 1417 | .include_reference_trace = ttyconf != .no_color, | | |
| 1418 | }; | | |
| 1419 | } | | |
| 1420 | | | |
| 1421 | fn fatalWithHint(comptime f: []const u8, args: anytype) noreturn { | 1419 | fn fatalWithHint(comptime f: []const u8, args: anytype) noreturn { |
| 1422 | std.debug.print(f ++ "\n access the help menu with 'zig build -h'\n", args); | 1420 | std.debug.print(f ++ "\n access the help menu with 'zig build -h'\n", args); |
| 1423 | process.exit(1); | 1421 | process.exit(1); |