authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-04-11 11:40:53-04:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2023-04-11 11:40:53-04:00
log1728d92f60d4e9aa10d878e3235fc63764d3909b
treebe15ce4abc4ffe78efd0b5aaa522124741923ad1
parent23d7921758524f76f2157e6f8a5823da2511396a
parent406706fe6b5e969028a7c70247ebd1cb2b93102d
signaturebadge-question-mark Signed by PGP key 4AEE18F83AFDEB23

Merge pull request #15245 from ziglang/zig-build-install-artifact

fix broken and confusing artifact installation logic

46 files changed, 76 insertions(+), 89 deletions(-)

build.zig+1-1
......@@ -181,7 +181,7 @@ pub fn build(b: *std.Build) !void {
181181 exe.sanitize_thread = sanitize_thread;
182182 exe.build_id = b.option(bool, "build-id", "Include a build id note") orelse false;
183183 exe.entitlements = entitlements;
184 exe.install();
184 b.installArtifact(exe);
185185
186186 const compile_step = b.step("compile", "Build the self-hosted compiler");
187187 compile_step.dependOn(&exe.step);
lib/init-exe/build.zig+8-5
......@@ -27,12 +27,12 @@ pub fn build(b: *std.Build) void {
2727 // This declares intent for the executable to be installed into the
2828 // standard location when the user invokes the "install" step (the default
2929 // step when running `zig build`).
30 exe.install();
30 b.installArtifact(exe);
3131
3232 // This *creates* a RunStep in the build graph, to be executed when another
3333 // step is evaluated that depends on it. The next line below will establish
3434 // such a dependency.
35 const run_cmd = exe.run();
35 const run_cmd = b.addRunArtifact(exe);
3636
3737 // By making the run step depend on the install step, it will be run from the
3838 // installation directory rather than directly from within the cache directory.
......@@ -52,16 +52,19 @@ pub fn build(b: *std.Build) void {
5252 const run_step = b.step("run", "Run the app");
5353 run_step.dependOn(&run_cmd.step);
5454
55 // Creates a step for unit testing.
56 const exe_tests = b.addTest(.{
55 // Creates a step for unit testing. This only builds the test executable
56 // but does not run it.
57 const unit_tests = b.addTest(.{
5758 .root_source_file = .{ .path = "src/main.zig" },
5859 .target = target,
5960 .optimize = optimize,
6061 });
6162
63 const run_unit_tests = b.addRunArtifact(unit_tests);
64
6265 // Similar to creating the run step earlier, this exposes a `test` step to
6366 // the `zig build --help` menu, providing a way for the user to request
6467 // running the unit tests.
6568 const test_step = b.step("test", "Run unit tests");
66 test_step.dependOn(&exe_tests.step);
69 test_step.dependOn(&run_unit_tests.step);
6770}
lib/init-lib/build.zig+6-3
......@@ -27,18 +27,21 @@ pub fn build(b: *std.Build) void {
2727 // This declares intent for the library to be installed into the standard
2828 // location when the user invokes the "install" step (the default step when
2929 // running `zig build`).
30 lib.install();
30 b.installArtifact(lib);
3131
32 // Creates a step for unit testing.
32 // Creates a step for unit testing. This only builds the test executable
33 // but does not run it.
3334 const main_tests = b.addTest(.{
3435 .root_source_file = .{ .path = "src/main.zig" },
3536 .target = target,
3637 .optimize = optimize,
3738 });
3839
40 const run_main_tests = b.addRunArtifact(main_tests);
41
3942 // This creates a build step. It will be visible in the `zig build --help` menu,
4043 // and can be selected like this: `zig build test`
4144 // This will evaluate the `test` step rather than the default, which is "install".
4245 const test_step = b.step("test", "Run library tests");
43 test_step.dependOn(&main_tests.step);
46 test_step.dependOn(&run_main_tests.step);
4447}
lib/std/Build/CompileStep.zig+7-13
......@@ -111,7 +111,6 @@ vcpkg_bin_path: ?[]const u8 = null,
111111/// This may be set in order to override the default install directory
112112override_dest_dir: ?InstallDir,
113113installed_path: ?[]const u8,
114install_step: ?*InstallArtifactStep,
115114
116115/// Base address for an executable image.
117116image_base: ?u64 = null,
......@@ -390,7 +389,6 @@ pub fn create(owner: *std.Build, options: Options) *CompileStep {
390389 .output_dir = null,
391390 .override_dest_dir = null,
392391 .installed_path = null,
393 .install_step = null,
394392 .force_undefined_symbols = StringHashMap(void).init(owner.allocator),
395393
396394 .output_path_source = GeneratedFile{ .step = &self.step },
......@@ -465,11 +463,6 @@ pub fn setOutputDir(self: *CompileStep, dir: []const u8) void {
465463 self.output_dir = b.dupePath(dir);
466464}
467465
468pub fn install(self: *CompileStep) void {
469 const b = self.step.owner;
470 b.installArtifact(self);
471}
472
473466pub fn installHeader(cs: *CompileStep, src_path: []const u8, dest_rel_path: []const u8) void {
474467 const b = cs.step.owner;
475468 const install_file = b.addInstallHeaderFile(src_path, dest_rel_path);
......@@ -533,7 +526,7 @@ pub fn installLibraryHeaders(cs: *CompileStep, l: *CompileStep) void {
533526 const T = id.Type();
534527 const ptr = b.allocator.create(T) catch @panic("OOM");
535528 ptr.* = step.cast(T).?.*;
536 ptr.dest_builder = b;
529 ptr.step.owner = b;
537530 break :blk &ptr.step;
538531 },
539532 else => unreachable,
......@@ -557,12 +550,13 @@ pub fn addObjCopy(cs: *CompileStep, options: ObjCopyStep.Options) *ObjCopyStep {
557550 return b.addObjCopy(cs.getOutputSource(), copy);
558551}
559552
560/// Deprecated: use `std.Build.addRunArtifact`
561/// This function will run in the context of the package that created the executable,
553/// This function would run in the context of the package that created the executable,
562554/// which is undesirable when running an executable provided by a dependency package.
563pub fn run(cs: *CompileStep) *RunStep {
564 return cs.step.owner.addRunArtifact(cs);
565}
555pub const run = @compileError("deprecated; use std.Build.addRunArtifact");
556
557/// This function would install in the context of the package that created the artifact,
558/// which is undesirable when installing an artifact provided by a dependency package.
559pub const install = @compileError("deprecated; use std.Build.installArtifact");
566560
567561pub fn checkObject(self: *CompileStep) *CheckObjectStep {
568562 return CheckObjectStep.create(self.step.owner, self.getOutputSource(), self.target_info.target.ofmt);
lib/std/Build/InstallArtifactStep.zig+2-7
......@@ -8,7 +8,6 @@ const fs = std.fs;
88pub const base_id = .install_artifact;
99
1010step: Step,
11dest_builder: *std.Build,
1211artifact: *CompileStep,
1312dest_dir: InstallDir,
1413pdb_dir: ?InstallDir,
......@@ -18,8 +17,6 @@ h_dir: ?InstallDir,
1817dest_sub_path: ?[]const u8,
1918
2019pub fn create(owner: *std.Build, artifact: *CompileStep) *InstallArtifactStep {
21 if (artifact.install_step) |s| return s;
22
2320 const self = owner.allocator.create(InstallArtifactStep) catch @panic("OOM");
2421 self.* = InstallArtifactStep{
2522 .step = Step.init(.{
......@@ -28,7 +25,6 @@ pub fn create(owner: *std.Build, artifact: *CompileStep) *InstallArtifactStep {
2825 .owner = owner,
2926 .makeFn = make,
3027 }),
31 .dest_builder = owner,
3228 .artifact = artifact,
3329 .dest_dir = artifact.override_dest_dir orelse switch (artifact.kind) {
3430 .obj => @panic("Cannot install a .obj build artifact."),
......@@ -46,7 +42,6 @@ pub fn create(owner: *std.Build, artifact: *CompileStep) *InstallArtifactStep {
4642 .dest_sub_path = null,
4743 };
4844 self.step.dependOn(&artifact.step);
49 artifact.install_step = self;
5045
5146 owner.pushInstalledFile(self.dest_dir, artifact.out_filename);
5247 if (self.artifact.isDynamicLibrary()) {
......@@ -71,9 +66,9 @@ pub fn create(owner: *std.Build, artifact: *CompileStep) *InstallArtifactStep {
7166
7267fn make(step: *Step, prog_node: *std.Progress.Node) !void {
7368 _ = prog_node;
74 const src_builder = step.owner;
7569 const self = @fieldParentPtr(InstallArtifactStep, "step", step);
76 const dest_builder = self.dest_builder;
70 const src_builder = self.artifact.step.owner;
71 const dest_builder = step.owner;
7772
7873 const dest_sub_path = if (self.dest_sub_path) |sub_path| sub_path else self.artifact.out_filename;
7974 const full_dest_path = dest_builder.getInstallPath(self.dest_dir, dest_sub_path);
lib/std/Build/RunStep.zig+2-2
......@@ -866,9 +866,9 @@ fn spawnChildAndCollect(
866866 child.request_resource_usage_statistics = true;
867867
868868 child.stdin_behavior = switch (self.stdio) {
869 .infer_from_args => if (has_side_effects) .Inherit else .Close,
869 .infer_from_args => if (has_side_effects) .Inherit else .Ignore,
870870 .inherit => .Inherit,
871 .check => .Close,
871 .check => .Ignore,
872872 .zig_test => .Pipe,
873873 };
874874 child.stdout_behavior = switch (self.stdio) {
test/link/bss/build.zig+1-1
......@@ -10,7 +10,7 @@ pub fn build(b: *std.Build) void {
1010 .optimize = .Debug,
1111 });
1212
13 const run = exe.run();
13 const run = b.addRunArtifact(exe);
1414 run.expectStdOutEqual("0, 1, 0\n");
1515
1616 test_step.dependOn(&run.step);
test/link/common_symbols/build.zig+1-1
......@@ -24,5 +24,5 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.Optimize
2424 });
2525 test_exe.linkLibrary(lib_a);
2626
27 test_step.dependOn(&test_exe.run().step);
27 test_step.dependOn(&b.addRunArtifact(test_exe).step);
2828}
test/link/common_symbols_alignment/build.zig+1-1
......@@ -24,5 +24,5 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.Optimize
2424 });
2525 test_exe.linkLibrary(lib_a);
2626
27 test_step.dependOn(&test_exe.run().step);
27 test_step.dependOn(&b.addRunArtifact(test_exe).step);
2828}
test/link/interdependent_static_c_libs/build.zig+1-1
......@@ -35,5 +35,5 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.Optimize
3535 test_exe.linkLibrary(lib_b);
3636 test_exe.addIncludePath(".");
3737
38 test_step.dependOn(&test_exe.run().step);
38 test_step.dependOn(&b.addRunArtifact(test_exe).step);
3939}
test/link/macho/bugs/13056/build.zig+1-1
......@@ -31,7 +31,7 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.Optimize
3131 });
3232 exe.addObjectFile(std.fs.path.join(b.allocator, &.{ sdk.path, "/usr/lib/libc++.tbd" }) catch unreachable);
3333
34 const run_cmd = exe.run();
34 const run_cmd = b.addRunArtifact(exe);
3535 run_cmd.expectStdErrEqual("x: 5\n");
3636
3737 test_step.dependOn(&run_cmd.step);
test/link/macho/dead_strip_dylibs/build.zig+1-1
......@@ -27,7 +27,7 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.Optimize
2727
2828 test_step.dependOn(&check.step);
2929
30 const run_cmd = exe.run();
30 const run_cmd = b.addRunArtifact(exe);
3131 test_step.dependOn(&run_cmd.step);
3232 }
3333
test/link/macho/entry_in_archive/build.zig+1-1
......@@ -29,7 +29,7 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.Optimize
2929 exe.linkLibrary(lib);
3030 exe.linkLibC();
3131
32 const run = exe.run();
32 const run = b.addRunArtifact(exe);
3333 run.skip_foreign_checks = true;
3434 run.expectExitCode(0);
3535 test_step.dependOn(&run.step);
test/link/macho/headerpad/build.zig+4-4
......@@ -36,7 +36,7 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.Optimize
3636
3737 test_step.dependOn(&check.step);
3838
39 const run = exe.run();
39 const run = b.addRunArtifact(exe);
4040 test_step.dependOn(&run.step);
4141 }
4242
......@@ -52,7 +52,7 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.Optimize
5252
5353 test_step.dependOn(&check.step);
5454
55 const run = exe.run();
55 const run = b.addRunArtifact(exe);
5656 test_step.dependOn(&run.step);
5757 }
5858
......@@ -69,7 +69,7 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.Optimize
6969
7070 test_step.dependOn(&check.step);
7171
72 const run = exe.run();
72 const run = b.addRunArtifact(exe);
7373 test_step.dependOn(&run.step);
7474 }
7575
......@@ -95,7 +95,7 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.Optimize
9595
9696 test_step.dependOn(&check.step);
9797
98 const run = exe.run();
98 const run = b.addRunArtifact(exe);
9999 test_step.dependOn(&run.step);
100100 }
101101}
test/link/macho/needed_framework/build.zig+1-1
......@@ -30,6 +30,6 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.Optimize
3030 check.checkNext("name {*}Cocoa");
3131 test_step.dependOn(&check.step);
3232
33 const run_cmd = exe.run();
33 const run_cmd = b.addRunArtifact(exe);
3434 test_step.dependOn(&run_cmd.step);
3535}
test/link/macho/objcpp/build.zig+1-1
......@@ -27,7 +27,7 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.Optimize
2727 // populate paths to the sysroot here.
2828 exe.linkFramework("Foundation");
2929
30 const run_cmd = exe.run();
30 const run_cmd = b.addRunArtifact(exe);
3131 run_cmd.expectStdOutEqual("Hello from C++ and Zig");
3232
3333 test_step.dependOn(&run_cmd.step);
test/link/macho/tls/build.zig+1-1
......@@ -32,7 +32,7 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.Optimize
3232 test_exe.linkLibrary(lib);
3333 test_exe.linkLibC();
3434
35 const run = test_exe.run();
35 const run = b.addRunArtifact(test_exe);
3636 run.skip_foreign_checks = true;
3737
3838 test_step.dependOn(&run.step);
test/link/macho/weak_framework/build.zig+1-1
......@@ -27,6 +27,6 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.Optimize
2727 check.checkNext("name {*}Cocoa");
2828 test_step.dependOn(&check.step);
2929
30 const run_cmd = exe.run();
30 const run_cmd = b.addRunArtifact(exe);
3131 test_step.dependOn(&run_cmd.step);
3232}
test/link/macho/weak_library/build.zig+1-1
......@@ -23,7 +23,7 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.Optimize
2323 });
2424 dylib.addCSourceFile("a.c", &.{});
2525 dylib.linkLibC();
26 dylib.install();
26 b.installArtifact(dylib);
2727
2828 const exe = b.addExecutable(.{
2929 .name = "test",
test/link/wasm/producers/build.zig+1-1
......@@ -23,7 +23,7 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.Optimize
2323 lib.use_llvm = false;
2424 lib.use_lld = false;
2525 lib.strip = false;
26 lib.install();
26 b.installArtifact(lib);
2727
2828 const version_fmt = "version " ++ builtin.zig_version_string;
2929
test/link/wasm/segments/build.zig+1-1
......@@ -22,7 +22,7 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.Optimize
2222 lib.use_llvm = false;
2323 lib.use_lld = false;
2424 lib.strip = false;
25 lib.install();
25 b.installArtifact(lib);
2626
2727 const check_lib = lib.checkObject();
2828 check_lib.checkStart("Section data");
test/link/wasm/stack_pointer/build.zig+1-1
......@@ -23,7 +23,7 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.Optimize
2323 lib.use_lld = false;
2424 lib.strip = false;
2525 lib.stack_size = std.wasm.page_size * 2; // set an explicit stack size
26 lib.install();
26 b.installArtifact(lib);
2727
2828 const check_lib = lib.checkObject();
2929
test/link/wasm/type/build.zig+1-1
......@@ -22,7 +22,7 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.Optimize
2222 lib.use_llvm = false;
2323 lib.use_lld = false;
2424 lib.strip = false;
25 lib.install();
25 b.installArtifact(lib);
2626
2727 const check_lib = lib.checkObject();
2828 check_lib.checkStart("Section type");
test/src/CompareOutput.zig+3-3
......@@ -101,7 +101,7 @@ pub fn addCase(self: *CompareOutput, case: TestCase) void {
101101 });
102102 exe.addAssemblyFileSource(write_src.getFileSource(case.sources.items[0].filename).?);
103103
104 const run = exe.run();
104 const run = b.addRunArtifact(exe);
105105 run.setName(annotated_case_name);
106106 run.addArgs(case.cli_args);
107107 run.expectStdOutEqual(case.expected_output);
......@@ -128,7 +128,7 @@ pub fn addCase(self: *CompareOutput, case: TestCase) void {
128128 exe.linkSystemLibrary("c");
129129 }
130130
131 const run = exe.run();
131 const run = b.addRunArtifact(exe);
132132 run.setName(annotated_case_name);
133133 run.addArgs(case.cli_args);
134134 run.expectStdOutEqual(case.expected_output);
......@@ -155,7 +155,7 @@ pub fn addCase(self: *CompareOutput, case: TestCase) void {
155155 exe.linkSystemLibrary("c");
156156 }
157157
158 const run = exe.run();
158 const run = b.addRunArtifact(exe);
159159 run.setName(annotated_case_name);
160160 run.addArgs(case.cli_args);
161161 run.expectExitCode(126);
test/src/run_translated_c.zig+1-1
......@@ -94,7 +94,7 @@ pub const RunTranslatedCContext = struct {
9494 const exe = translate_c.addExecutable(.{});
9595 exe.step.name = b.fmt("{s} build-exe", .{annotated_case_name});
9696 exe.linkLibC();
97 const run = exe.run();
97 const run = b.addRunArtifact(exe);
9898 run.step.name = b.fmt("{s} run", .{annotated_case_name});
9999 if (!case.allow_warnings) {
100100 run.expectStdErrEqual("");
test/standalone/dep_diamond/build.zig+1-2
......@@ -24,7 +24,6 @@ pub fn build(b: *std.Build) void {
2424 .dependencies = &.{.{ .name = "shared", .module = shared }},
2525 });
2626
27 const run = exe.run();
28
27 const run = b.addRunArtifact(exe);
2928 test_step.dependOn(&run.step);
3029}
test/standalone/dep_mutually_recursive/build.zig+1-2
......@@ -22,7 +22,6 @@ pub fn build(b: *std.Build) void {
2222 });
2323 exe.addModule("foo", foo);
2424
25 const run = exe.run();
26
25 const run = b.addRunArtifact(exe);
2726 test_step.dependOn(&run.step);
2827}
test/standalone/dep_recursive/build.zig+1-2
......@@ -18,7 +18,6 @@ pub fn build(b: *std.Build) void {
1818 });
1919 exe.addModule("foo", foo);
2020
21 const run = exe.run();
22
21 const run = b.addRunArtifact(exe);
2322 test_step.dependOn(&run.step);
2423}
test/standalone/dep_shared_builtin/build.zig+1-2
......@@ -15,7 +15,6 @@ pub fn build(b: *std.Build) void {
1515 .source_file = .{ .path = "foo.zig" },
1616 });
1717
18 const run = exe.run();
19
18 const run = b.addRunArtifact(exe);
2019 test_step.dependOn(&run.step);
2120}
test/standalone/dep_triangle/build.zig+1-2
......@@ -21,7 +21,6 @@ pub fn build(b: *std.Build) void {
2121 });
2222 exe.addModule("shared", shared);
2323
24 const run = exe.run();
25
24 const run = b.addRunArtifact(exe);
2625 test_step.dependOn(&run.step);
2726}
test/standalone/emit_asm_and_bin/build.zig+1-1
......@@ -11,5 +11,5 @@ pub fn build(b: *std.Build) void {
1111 main.emit_asm = .{ .emit_to = b.pathFromRoot("main.s") };
1212 main.emit_bin = .{ .emit_to = b.pathFromRoot("main") };
1313
14 test_step.dependOn(&main.run().step);
14 test_step.dependOn(&b.addRunArtifact(main).step);
1515}
test/standalone/global_linkage/build.zig+1-1
......@@ -28,5 +28,5 @@ pub fn build(b: *std.Build) void {
2828 main.linkLibrary(obj1);
2929 main.linkLibrary(obj2);
3030
31 test_step.dependOn(&main.run().step);
31 test_step.dependOn(&b.addRunArtifact(main).step);
3232}
test/standalone/issue_11595/build.zig+1-1
......@@ -19,7 +19,7 @@ pub fn build(b: *std.Build) void {
1919 .target = target,
2020 .optimize = optimize,
2121 });
22 exe.install();
22 b.installArtifact(exe);
2323
2424 const c_sources = [_][]const u8{
2525 "test.c",
test/standalone/issue_13970/build.zig+3-3
......@@ -17,7 +17,7 @@ pub fn build(b: *std.Build) void {
1717 test2.setTestRunner("src/main.zig");
1818 test3.setTestRunner("src/main.zig");
1919
20 test_step.dependOn(&test1.run().step);
21 test_step.dependOn(&test2.run().step);
22 test_step.dependOn(&test3.run().step);
20 test_step.dependOn(&b.addRunArtifact(test1).step);
21 test_step.dependOn(&b.addRunArtifact(test2).step);
22 test_step.dependOn(&b.addRunArtifact(test3).step);
2323}
test/standalone/issue_8550/build.zig+1-1
......@@ -21,7 +21,7 @@ pub fn build(b: *std.Build) !void {
2121 });
2222 kernel.addObjectFile("./boot.S");
2323 kernel.setLinkerScriptPath(.{ .path = "./linker.ld" });
24 kernel.install();
24 b.installArtifact(kernel);
2525
2626 test_step.dependOn(&kernel.step);
2727}
test/standalone/main_pkg_path/build.zig+1-1
......@@ -9,5 +9,5 @@ pub fn build(b: *std.Build) void {
99 });
1010 test_exe.setMainPkgPath(".");
1111
12 test_step.dependOn(&test_exe.run().step);
12 test_step.dependOn(&b.addRunArtifact(test_exe).step);
1313}
test/standalone/mix_o_files/build.zig+1-2
......@@ -25,7 +25,6 @@ pub fn build(b: *std.Build) void {
2525
2626 b.default_step.dependOn(&exe.step);
2727
28 const run_cmd = exe.run();
29
28 const run_cmd = b.addRunArtifact(exe);
3029 test_step.dependOn(&run_cmd.step);
3130}
test/standalone/options/build.zig+1-1
......@@ -17,5 +17,5 @@ pub fn build(b: *std.Build) void {
1717 options.addOption([]const u8, "string", b.option([]const u8, "string", "s").?);
1818
1919 const test_step = b.step("test", "Run unit tests");
20 test_step.dependOn(&main.run().step);
20 test_step.dependOn(&b.addRunArtifact(main).step);
2121}
test/standalone/pie/build.zig+1-1
......@@ -17,7 +17,7 @@ pub fn build(b: *std.Build) void {
1717 });
1818 main.pie = true;
1919
20 const run = main.run();
20 const run = b.addRunArtifact(main);
2121 run.skip_foreign_checks = true;
2222
2323 test_step.dependOn(&run.step);
test/standalone/pkg_import/build.zig+1-2
......@@ -13,7 +13,6 @@ pub fn build(b: *std.Build) void {
1313 });
1414 exe.addAnonymousModule("my_pkg", .{ .source_file = .{ .path = "pkg.zig" } });
1515
16 const run = exe.run();
17
16 const run = b.addRunArtifact(exe);
1817 test_step.dependOn(&run.step);
1918}
test/standalone/shared_library/build.zig+1-2
......@@ -23,7 +23,6 @@ pub fn build(b: *std.Build) void {
2323 exe.linkLibrary(lib);
2424 exe.linkSystemLibrary("c");
2525
26 const run_cmd = exe.run();
27
26 const run_cmd = b.addRunArtifact(exe);
2827 test_step.dependOn(&run_cmd.step);
2928}
test/standalone/static_c_lib/build.zig+1-1
......@@ -21,5 +21,5 @@ pub fn build(b: *std.Build) void {
2121 test_exe.linkLibrary(foo);
2222 test_exe.addIncludePath(".");
2323
24 test_step.dependOn(&test_exe.run().step);
24 test_step.dependOn(&b.addRunArtifact(test_exe).step);
2525}
test/standalone/test_runner_module_imports/build.zig+1-1
......@@ -15,6 +15,6 @@ pub fn build(b: *std.Build) void {
1515 t.addModule("module2", module2);
1616
1717 const test_step = b.step("test", "Run unit tests");
18 test_step.dependOn(&t.run().step);
18 test_step.dependOn(&b.addRunArtifact(t).step);
1919 b.default_step = test_step;
2020}
test/standalone/test_runner_path/build.zig+1-2
......@@ -11,7 +11,6 @@ pub fn build(b: *std.Build) void {
1111 });
1212 test_exe.test_runner = "test_runner.zig";
1313
14 const test_run = test_exe.run();
15
14 const test_run = b.addRunArtifact(test_exe);
1615 test_step.dependOn(&test_run.step);
1716}
test/standalone/use_alias/build.zig+1-1
......@@ -12,5 +12,5 @@ pub fn build(b: *std.Build) void {
1212 });
1313 main.addIncludePath(".");
1414
15 test_step.dependOn(&main.run().step);
15 test_step.dependOn(&b.addRunArtifact(main).step);
1616}
test/tests.zig+4-3
......@@ -596,7 +596,8 @@ pub fn addStandaloneTests(
596596 });
597597 if (case.link_libc) exe.linkLibC();
598598
599 step.dependOn(&exe.run().step);
599 const run = b.addRunArtifact(exe);
600 step.dependOn(&run.step);
600601 }
601602 }
602603 }
......@@ -1004,7 +1005,7 @@ pub fn addModuleTests(b: *std.Build, options: ModuleTestOptions) *Step {
10041005 },
10051006 };
10061007
1007 const run = these_tests.run();
1008 const run = b.addRunArtifact(these_tests);
10081009 run.skip_foreign_checks = true;
10091010 run.setName(b.fmt("run test {s}-{s}-{s}-{s}-{s}-{s}", .{
10101011 options.name,
......@@ -1061,7 +1062,7 @@ pub fn addCAbiTests(b: *std.Build, skip_non_native: bool, skip_release: bool) *S
10611062 triple_prefix, @tagName(optimize_mode),
10621063 }));
10631064
1064 const run = test_step.run();
1065 const run = b.addRunArtifact(test_step);
10651066 run.skip_foreign_checks = true;
10661067 step.dependOn(&run.step);
10671068 }