authorgravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2024-08-13 23:38:02+02:00
committergravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2024-08-14 07:03:23+02:00
log4a2b23c2beb043c1e5368d3737893494d61d4060
treeb4e9363580ed02e5675ecccf95383ccd986b2465
parent019c0fc1845bb97298a23372f1fa8b4315dc114c
signaturebadge-check Signed by SSH key SHA256:7B/LJ7bpR1eX8aCXSr4mtd5M45VMPKcx9zY8e95b5QM

build: Use the new b.addFail() for the update-mingw step.

This is precisely the kind of use case it was added for.

1 files changed, 10 insertions(+), 11 deletions(-)

build.zig+10-11
......@@ -537,21 +537,20 @@ pub fn build(b: *std.Build) !void {
537537
538538 const update_mingw_step = b.step("update-mingw", "Update zig's bundled mingw");
539539 const opt_mingw_src_path = b.option([]const u8, "mingw-src", "path to mingw-w64 source directory");
540 const update_mingw_exe = b.addExecutable(.{
541 .name = "update_mingw",
542 .target = b.graph.host,
543 .root_source_file = b.path("tools/update_mingw.zig"),
544 });
545 const update_mingw_run = b.addRunArtifact(update_mingw_exe);
546 update_mingw_run.addDirectoryArg(b.path("lib"));
547540 if (opt_mingw_src_path) |mingw_src_path| {
541 const update_mingw_exe = b.addExecutable(.{
542 .name = "update_mingw",
543 .target = b.graph.host,
544 .root_source_file = b.path("tools/update_mingw.zig"),
545 });
546 const update_mingw_run = b.addRunArtifact(update_mingw_exe);
547 update_mingw_run.addDirectoryArg(b.path("lib"));
548548 update_mingw_run.addDirectoryArg(.{ .cwd_relative = mingw_src_path });
549
550 update_mingw_step.dependOn(&update_mingw_run.step);
549551 } else {
550 // Intentionally cause an error if this build step is requested.
551 update_mingw_run.addArg("--missing-mingw-source-directory");
552 update_mingw_step.dependOn(&b.addFail("The -Dmingw-src=... option is required for this step").step);
552553 }
553
554 update_mingw_step.dependOn(&update_mingw_run.step);
555554}
556555
557556fn addWasiUpdateStep(b: *std.Build, version: [:0]const u8) !void {