| ... | @@ -16,6 +16,7 @@ const process = std.process; | ... | @@ -16,6 +16,7 @@ const process = std.process; |
| 16 | const File = std.Io.File; | 16 | const File = std.Io.File; |
| 17 | const Sha256 = std.crypto.hash.sha2.Sha256; | 17 | const Sha256 = std.crypto.hash.sha2.Sha256; |
| 18 | const ArrayList = std.ArrayList; | 18 | const ArrayList = std.ArrayList; |
| | 19 | const fatal = std.process.fatal; |
| 19 | | 20 | |
| 20 | pub const Cache = @import("Build/Cache.zig"); | 21 | pub const Cache = @import("Build/Cache.zig"); |
| 21 | pub const Step = @import("Build/Step.zig"); | 22 | pub const Step = @import("Build/Step.zig"); |
| ... | @@ -1989,13 +1990,13 @@ pub fn run(b: *Build, argv: []const []const u8) []u8 { | ... | @@ -1989,13 +1990,13 @@ pub fn run(b: *Build, argv: []const []const u8) []u8 { |
| 1989 | .stderr_behavior = .inherit, | 1990 | .stderr_behavior = .inherit, |
| 1990 | })) { | 1991 | })) { |
| 1991 | .success => |stdout| return stdout, | 1992 | .success => |stdout| return stdout, |
| 1992 | .spawn_failed => |err| process.fatal("the following command failed with {t}:\n{s}", .{ | 1993 | .spawn_failed => |err| fatal("the following command failed with {t}:\n{s}", .{ |
| 1993 | err, std.zig.allocPrintCmd(arena, argv, .{}) catch @panic("OOM"), | 1994 | err, std.zig.allocPrintCmd(arena, argv, .{}) catch @panic("OOM"), |
| 1994 | }), | 1995 | }), |
| 1995 | .bad_exit_code => |code| process.fatal("the following command exited with code {d}:\n{s}", .{ | 1996 | .bad_exit_code => |code| fatal("the following command exited with code {d}:\n{s}", .{ |
| 1996 | code, std.zig.allocPrintCmd(arena, argv, .{}) catch @panic("OOM"), | 1997 | code, std.zig.allocPrintCmd(arena, argv, .{}) catch @panic("OOM"), |
| 1997 | }), | 1998 | }), |
| 1998 | .crashed => process.fatal("the following command crashed:\n{s}", .{ | 1999 | .crashed => fatal("the following command crashed:\n{s}", .{ |
| 1999 | std.zig.allocPrintCmd(arena, argv, .{}) catch @panic("OOM"), | 2000 | std.zig.allocPrintCmd(arena, argv, .{}) catch @panic("OOM"), |
| 2000 | }), | 2001 | }), |
| 2001 | } | 2002 | } |
| ... | @@ -2341,7 +2342,7 @@ fn dependencyInner( | ... | @@ -2341,7 +2342,7 @@ fn dependencyInner( |
| 2341 | .root_dir = .{ | 2342 | .root_dir = .{ |
| 2342 | .path = build_root_string, | 2343 | .path = build_root_string, |
| 2343 | .handle = Io.Dir.cwd().openDir(io, build_root_string, .{}) catch |err| | 2344 | .handle = Io.Dir.cwd().openDir(io, build_root_string, .{}) catch |err| |
| 2344 | process.fatal("failed to open {q}: {t}", .{ build_root_string, err }), | 2345 | fatal("failed to open {q}: {t}", .{ build_root_string, err }), |
| 2345 | }, | 2346 | }, |
| 2346 | }; | 2347 | }; |
| 2347 | | 2348 | |
| ... | @@ -2838,6 +2839,26 @@ fn validateConfigureDependency(lazy_path: LazyPath) void { | ... | @@ -2838,6 +2839,26 @@ fn validateConfigureDependency(lazy_path: LazyPath) void { |
| 2838 | } | 2839 | } |
| 2839 | } | 2840 | } |
| 2840 | | 2841 | |
| | 2842 | /// Build system implementation detail. |
| | 2843 | pub fn serializeConfigurationExiting(b: *Build) void { |
| | 2844 | const graph = b.graph; |
| | 2845 | const io = graph.io; |
| | 2846 | |
| | 2847 | var stdout_buffer: [1024]u8 = undefined; |
| | 2848 | var file_writer = Io.File.stdout().writerStreaming(io, &stdout_buffer); |
| | 2849 | Serialize.write(b, &graph.wip_configuration, &file_writer.interface) catch |err| switch (err) { |
| | 2850 | error.WriteFailed => fatal("failed to write configuration output: {t}", .{file_writer.err.?}), |
| | 2851 | error.OutOfMemory => @panic("OOM"), |
| | 2852 | }; |
| | 2853 | file_writer.flush() catch |err| fatal("failed to write configuration output: {t}", .{err}); |
| | 2854 | |
| | 2855 | // This executable is short-lived and run in Debug mode, so we'd rather |
| | 2856 | // have `zig build` run faster than catch resource leaks in the user's |
| | 2857 | // build.zig script (or, frankly, this configure runner), therefore we call |
| | 2858 | // exit directly here rather than cleanExit. |
| | 2859 | process.exit(0); |
| | 2860 | } |
| | 2861 | |
| 2841 | test { | 2862 | test { |
| 2842 | _ = Cache; | 2863 | _ = Cache; |
| 2843 | _ = Configuration; | 2864 | _ = Configuration; |