authorgravatar for 2179872-misanthrop@users.noreply.gitlab.comSashko <2179872-misanthrop@users.noreply.gitlab.com> 2024-03-12 09:08:03+01:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2024-07-01 16:36:13-07:00
log604a332e21f9aaff13c7b13331d9c6926c6c9d52
tree8d5b8515871329a287015b017a02f4abb27b5248
parentcb308ba3ac2d7e3735d1cb42ef085edb1e6db723

Extract getZigArgs function in std.Build.Step.Compile


1 files changed, 13 insertions(+), 3 deletions(-)

lib/std/Build/Step/Compile.zig+13-3
......@@ -989,10 +989,10 @@ fn getGeneratedFilePath(compile: *Compile, comptime tag_name: []const u8, asking
989989 return path;
990990}
991991
992fn make(step: *Step, prog_node: std.Progress.Node) !void {
992fn getZigArgs(compile: *Compile) ![][]const u8 {
993 const step = &compile.step;
993994 const b = step.owner;
994995 const arena = b.allocator;
995 const compile: *Compile = @fieldParentPtr("step", step);
996996
997997 var zig_args = ArrayList([]const u8).init(arena);
998998 defer zig_args.deinit();
......@@ -1298,6 +1298,7 @@ fn make(step: *Step, prog_node: std.Progress.Node) !void {
12981298 // We need to emit the --mod argument here so that the above link objects
12991299 // have the correct parent module, but only if the module is part of
13001300 // this compilation.
1301 if (!my_responsibility) continue;
13011302 if (cli_named_modules.modules.getIndex(dep.module)) |module_cli_index| {
13021303 const module_cli_name = cli_named_modules.names.keys()[module_cli_index];
13031304 try dep.module.appendZigProcessFlags(&zig_args, step);
......@@ -1724,7 +1725,16 @@ fn make(step: *Step, prog_node: std.Progress.Node) !void {
17241725 try zig_args.append(resolved_args_file);
17251726 }
17261727
1727 const maybe_output_bin_path = step.evalZigProcess(zig_args.items, prog_node) catch |err| switch (err) {
1728 return try zig_args.toOwnedSlice();
1729}
1730
1731fn make(step: *Step, prog_node: std.Progress.Node) !void {
1732 const b = step.owner;
1733 const compile: *Compile = @fieldParentPtr("step", step);
1734
1735 const zig_args = try getZigArgs(compile);
1736
1737 const maybe_output_bin_path = step.evalZigProcess(zig_args, prog_node) catch |err| switch (err) {
17281738 error.NeedCompileErrorCheck => {
17291739 assert(compile.expect_errors != null);
17301740 try checkCompileErrors(compile);