Skip to content

Commit

Permalink
Update live build runner and dependencies to Zig `0.14.0-dev.3018+c0d…
Browse files Browse the repository at this point in the history
…85cda5`

Signed-off-by: Eric Joldasov <[email protected]>
  • Loading branch information
BratishkaErik committed Jan 30, 2025
1 parent 5192a15 commit 3ece246
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 16 deletions.
4 changes: 2 additions & 2 deletions build.zig.zon
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

.dependencies = .{
.mustache = .{
.url = "git+https://github.com/batiati/mustache-zig?ref=master#822933184fb0cbc8e692e9c73618deb2b0b8108c",
.hash = "122008747b05328191a1b3c2a83520b82f11e87ae12e2cc8f92305792203802a0b02",
.url = "git+https://github.com/batiati/mustache-zig?ref=master#7046270199f68eae32a9e79f3933088621f27d24",
.hash = "12201f5bda90b5de1915dc60da9cf1cd846d79a36c2e1313aa467462fa985f117bcc",
},
},
.paths = .{
Expand Down
26 changes: 12 additions & 14 deletions share/build_runners/live.zig
Original file line number Diff line number Diff line change
Expand Up @@ -563,7 +563,7 @@ fn prepare(
}

// Just to make diff'ing easier.
// Synced with Zig build runner, version 0.14.0-dev.2052+6a364b4a5 .
// Synced with Zig build runner, version 0.14.0-dev.3018+c0d85cda5 .
if (true) return zig_ebuilder_section: {
const Report = @import("Report.zig");

Expand Down Expand Up @@ -856,7 +856,7 @@ fn runStepNames(
if (run.prominent_compile_errors and total_compile_errors > 0) {
for (step_stack.keys()) |s| {
if (s.result_error_bundle.errorMessageCount() > 0) {
s.result_error_bundle.renderToStdErr(renderOptions(ttyconf));
s.result_error_bundle.renderToStdErr(.{ .ttyconf = ttyconf, .include_reference_trace = (b.reference_trace orelse 0) > 0 });
}
}

Expand Down Expand Up @@ -1235,7 +1235,11 @@ fn workerMakeOneStep(
defer std.debug.unlockStdErr();

const gpa = b.allocator;
printErrorMessages(gpa, s, run.ttyconf, run.stderr, run.prominent_compile_errors) catch {};
const options: std.zig.ErrorBundle.RenderOptions = .{
.ttyconf = run.ttyconf,
.include_reference_trace = (b.reference_trace orelse 0) > 0,
};
printErrorMessages(gpa, s, options, run.stderr, run.prominent_compile_errors) catch {};
}

handle_result: {
Expand Down Expand Up @@ -1291,7 +1295,7 @@ fn workerMakeOneStep(
pub fn printErrorMessages(
gpa: Allocator,
failing_step: *Step,
ttyconf: std.io.tty.Config,
options: std.zig.ErrorBundle.RenderOptions,
stderr: File,
prominent_compile_errors: bool,
) !void {
Expand All @@ -1306,6 +1310,7 @@ pub fn printErrorMessages(
}

// Now, `step_stack` has the subtree that we want to print, in reverse order.
const ttyconf = options.ttyconf;
try ttyconf.setColor(stderr, .dim);
var indent: usize = 0;
while (step_stack.popOrNull()) |s| : (indent += 1) {
Expand All @@ -1331,8 +1336,9 @@ pub fn printErrorMessages(
}
}

if (!prominent_compile_errors and failing_step.result_error_bundle.errorMessageCount() > 0)
try failing_step.result_error_bundle.renderToWriter(renderOptions(ttyconf), stderr.writer());
if (!prominent_compile_errors and failing_step.result_error_bundle.errorMessageCount() > 0) {
try failing_step.result_error_bundle.renderToWriter(options, stderr.writer());
}

for (failing_step.result_error_msgs.items) |msg| {
try ttyconf.setColor(stderr, .red);
Expand Down Expand Up @@ -1533,14 +1539,6 @@ fn get_tty_conf(color: Color, stderr: File) std.io.tty.Config {
};
}

fn renderOptions(ttyconf: std.io.tty.Config) std.zig.ErrorBundle.RenderOptions {
return .{
.ttyconf = ttyconf,
.include_source_line = ttyconf != .no_color,
.include_reference_trace = ttyconf != .no_color,
};
}

fn fatalWithHint(comptime f: []const u8, args: anytype) noreturn {
std.debug.print(f ++ "\n access the help menu with 'zig build -h'\n", args);
process.exit(1);
Expand Down

0 comments on commit 3ece246

Please sign in to comment.