diff --git a/build.zig b/build.zig index 04f1eed6b5c4fdb7b68bfaa66062972f5ff5f5b0..1a82a1d1057865203dbae03880f81d50d70f16c5 100644 --- a/build.zig +++ b/build.zig @@ -181,7 +181,7 @@ pub fn build(b: *std.Build) !void { exe.sanitize_thread = sanitize_thread; exe.build_id = b.option(bool, "build-id", "Include a build id note") orelse false; exe.entitlements = entitlements; - exe.install(); + b.installArtifact(exe); const compile_step = b.step("compile", "Build the self-hosted compiler"); compile_step.dependOn(&exe.step); diff --git a/lib/init-exe/build.zig b/lib/init-exe/build.zig index 2ef5b21fe94aa9431fd91bb4dd799433345f17df..abf8654f0fb78fe9357520c3f3def635de63ad1e 100644 --- a/lib/init-exe/build.zig +++ b/lib/init-exe/build.zig @@ -27,12 +27,12 @@ pub fn build(b: *std.Build) void { // This declares intent for the executable to be installed into the // standard location when the user invokes the "install" step (the default // step when running `zig build`). - exe.install(); + b.installArtifact(exe); // This *creates* a RunStep in the build graph, to be executed when another // step is evaluated that depends on it. The next line below will establish // such a dependency. - const run_cmd = exe.run(); + const run_cmd = b.addRunArtifact(exe); // By making the run step depend on the install step, it will be run from the // installation directory rather than directly from within the cache directory. @@ -52,16 +52,19 @@ pub fn build(b: *std.Build) void { const run_step = b.step("run", "Run the app"); run_step.dependOn(&run_cmd.step); - // Creates a step for unit testing. - const exe_tests = b.addTest(.{ + // Creates a step for unit testing. This only builds the test executable + // but does not run it. + const unit_tests = b.addTest(.{ .root_source_file = .{ .path = "src/main.zig" }, .target = target, .optimize = optimize, }); + const run_unit_tests = b.addRunArtifact(unit_tests); + // Similar to creating the run step earlier, this exposes a `test` step to // the `zig build --help` menu, providing a way for the user to request // running the unit tests. const test_step = b.step("test", "Run unit tests"); - test_step.dependOn(&exe_tests.step); + test_step.dependOn(&run_unit_tests.step); } diff --git a/lib/init-lib/build.zig b/lib/init-lib/build.zig index 2887c170e65b067e2638228c88d6da186d725279..70592d896d302c7ec599a18e315bb88d22a310e5 100644 --- a/lib/init-lib/build.zig +++ b/lib/init-lib/build.zig @@ -27,18 +27,21 @@ pub fn build(b: *std.Build) void { // This declares intent for the library to be installed into the standard // location when the user invokes the "install" step (the default step when // running `zig build`). - lib.install(); + b.installArtifact(lib); - // Creates a step for unit testing. + // Creates a step for unit testing. This only builds the test executable + // but does not run it. const main_tests = b.addTest(.{ .root_source_file = .{ .path = "src/main.zig" }, .target = target, .optimize = optimize, }); + const run_main_tests = b.addRunArtifact(main_tests); + // This creates a build step. It will be visible in the `zig build --help` menu, // and can be selected like this: `zig build test` // This will evaluate the `test` step rather than the default, which is "install". const test_step = b.step("test", "Run library tests"); - test_step.dependOn(&main_tests.step); + test_step.dependOn(&run_main_tests.step); } diff --git a/lib/std/Build/CompileStep.zig b/lib/std/Build/CompileStep.zig index 0ee6e32826d95e6930184b51c73bfc58327b16cb..29cdaa523b553f9773e2272298d36c5be52d8eb0 100644 --- a/lib/std/Build/CompileStep.zig +++ b/lib/std/Build/CompileStep.zig @@ -111,7 +111,6 @@ vcpkg_bin_path: ?[]const u8 = null, /// This may be set in order to override the default install directory override_dest_dir: ?InstallDir, installed_path: ?[]const u8, -install_step: ?*InstallArtifactStep, /// Base address for an executable image. image_base: ?u64 = null, @@ -390,7 +389,6 @@ pub fn create(owner: *std.Build, options: Options) *CompileStep { .output_dir = null, .override_dest_dir = null, .installed_path = null, - .install_step = null, .force_undefined_symbols = StringHashMap(void).init(owner.allocator), .output_path_source = GeneratedFile{ .step = &self.step }, @@ -465,11 +463,6 @@ pub fn setOutputDir(self: *CompileStep, dir: []const u8) void { self.output_dir = b.dupePath(dir); } -pub fn install(self: *CompileStep) void { - const b = self.step.owner; - b.installArtifact(self); -} - pub fn installHeader(cs: *CompileStep, src_path: []const u8, dest_rel_path: []const u8) void { const b = cs.step.owner; const install_file = b.addInstallHeaderFile(src_path, dest_rel_path); @@ -533,7 +526,7 @@ pub fn installLibraryHeaders(cs: *CompileStep, l: *CompileStep) void { const T = id.Type(); const ptr = b.allocator.create(T) catch @panic("OOM"); ptr.* = step.cast(T).?.*; - ptr.dest_builder = b; + ptr.step.owner = b; break :blk &ptr.step; }, else => unreachable, @@ -557,12 +550,13 @@ pub fn addObjCopy(cs: *CompileStep, options: ObjCopyStep.Options) *ObjCopyStep { return b.addObjCopy(cs.getOutputSource(), copy); } -/// Deprecated: use `std.Build.addRunArtifact` -/// This function will run in the context of the package that created the executable, +/// This function would run in the context of the package that created the executable, /// which is undesirable when running an executable provided by a dependency package. -pub fn run(cs: *CompileStep) *RunStep { - return cs.step.owner.addRunArtifact(cs); -} +pub const run = @compileError("deprecated; use std.Build.addRunArtifact"); + +/// This function would install in the context of the package that created the artifact, +/// which is undesirable when installing an artifact provided by a dependency package. +pub const install = @compileError("deprecated; use std.Build.installArtifact"); pub fn checkObject(self: *CompileStep) *CheckObjectStep { return CheckObjectStep.create(self.step.owner, self.getOutputSource(), self.target_info.target.ofmt); diff --git a/lib/std/Build/InstallArtifactStep.zig b/lib/std/Build/InstallArtifactStep.zig index 445f1e8ea8dab3ca65b991fc714ff69c18ecec10..50cf6ff323b35a9daae286b7601e042e3a9a5879 100644 --- a/lib/std/Build/InstallArtifactStep.zig +++ b/lib/std/Build/InstallArtifactStep.zig @@ -8,7 +8,6 @@ const fs = std.fs; pub const base_id = .install_artifact; step: Step, -dest_builder: *std.Build, artifact: *CompileStep, dest_dir: InstallDir, pdb_dir: ?InstallDir, @@ -18,8 +17,6 @@ h_dir: ?InstallDir, dest_sub_path: ?[]const u8, pub fn create(owner: *std.Build, artifact: *CompileStep) *InstallArtifactStep { - if (artifact.install_step) |s| return s; - const self = owner.allocator.create(InstallArtifactStep) catch @panic("OOM"); self.* = InstallArtifactStep{ .step = Step.init(.{ @@ -28,7 +25,6 @@ pub fn create(owner: *std.Build, artifact: *CompileStep) *InstallArtifactStep { .owner = owner, .makeFn = make, }), - .dest_builder = owner, .artifact = artifact, .dest_dir = artifact.override_dest_dir orelse switch (artifact.kind) { .obj => @panic("Cannot install a .obj build artifact."), @@ -46,7 +42,6 @@ pub fn create(owner: *std.Build, artifact: *CompileStep) *InstallArtifactStep { .dest_sub_path = null, }; self.step.dependOn(&artifact.step); - artifact.install_step = self; owner.pushInstalledFile(self.dest_dir, artifact.out_filename); if (self.artifact.isDynamicLibrary()) { @@ -71,9 +66,9 @@ pub fn create(owner: *std.Build, artifact: *CompileStep) *InstallArtifactStep { fn make(step: *Step, prog_node: *std.Progress.Node) !void { _ = prog_node; - const src_builder = step.owner; const self = @fieldParentPtr(InstallArtifactStep, "step", step); - const dest_builder = self.dest_builder; + const src_builder = self.artifact.step.owner; + const dest_builder = step.owner; const dest_sub_path = if (self.dest_sub_path) |sub_path| sub_path else self.artifact.out_filename; const full_dest_path = dest_builder.getInstallPath(self.dest_dir, dest_sub_path); diff --git a/lib/std/Build/RunStep.zig b/lib/std/Build/RunStep.zig index 36b409d907daa10c2d4d0278dd7cafcbe025316c..5658c5936fd9dfeed4d6eb35c8995d1c89fc626b 100644 --- a/lib/std/Build/RunStep.zig +++ b/lib/std/Build/RunStep.zig @@ -866,9 +866,9 @@ fn spawnChildAndCollect( child.request_resource_usage_statistics = true; child.stdin_behavior = switch (self.stdio) { - .infer_from_args => if (has_side_effects) .Inherit else .Close, + .infer_from_args => if (has_side_effects) .Inherit else .Ignore, .inherit => .Inherit, - .check => .Close, + .check => .Ignore, .zig_test => .Pipe, }; child.stdout_behavior = switch (self.stdio) { diff --git a/test/link/bss/build.zig b/test/link/bss/build.zig index 86600b58f51c007ca47cb7145d70804179fd14f4..3c7964fae1ef7085067dcc0f621b291a44d4a913 100644 --- a/test/link/bss/build.zig +++ b/test/link/bss/build.zig @@ -10,7 +10,7 @@ pub fn build(b: *std.Build) void { .optimize = .Debug, }); - const run = exe.run(); + const run = b.addRunArtifact(exe); run.expectStdOutEqual("0, 1, 0\n"); test_step.dependOn(&run.step); diff --git a/test/link/common_symbols/build.zig b/test/link/common_symbols/build.zig index a8c276d1f396a0b2f3305ffe4e7005697bbba878..a2104e1ac27b8cb0ef3d3ec898f59174285d3f09 100644 --- a/test/link/common_symbols/build.zig +++ b/test/link/common_symbols/build.zig @@ -24,5 +24,5 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.Optimize }); test_exe.linkLibrary(lib_a); - test_step.dependOn(&test_exe.run().step); + test_step.dependOn(&b.addRunArtifact(test_exe).step); } diff --git a/test/link/common_symbols_alignment/build.zig b/test/link/common_symbols_alignment/build.zig index 83548f2d8a42d23cd2871516f87096d1aadc84b6..4cb253dc05e0225ab3e4d64e29f4edb99bf19145 100644 --- a/test/link/common_symbols_alignment/build.zig +++ b/test/link/common_symbols_alignment/build.zig @@ -24,5 +24,5 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.Optimize }); test_exe.linkLibrary(lib_a); - test_step.dependOn(&test_exe.run().step); + test_step.dependOn(&b.addRunArtifact(test_exe).step); } diff --git a/test/link/interdependent_static_c_libs/build.zig b/test/link/interdependent_static_c_libs/build.zig index 0d06410a797b6acd80130cf3dbab633bc9517e2c..2eb8fa27b4e74e0acea7e97ecf731f4f8ec3c30f 100644 --- a/test/link/interdependent_static_c_libs/build.zig +++ b/test/link/interdependent_static_c_libs/build.zig @@ -35,5 +35,5 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.Optimize test_exe.linkLibrary(lib_b); test_exe.addIncludePath("."); - test_step.dependOn(&test_exe.run().step); + test_step.dependOn(&b.addRunArtifact(test_exe).step); } diff --git a/test/link/macho/bugs/13056/build.zig b/test/link/macho/bugs/13056/build.zig index bcee22504f2e0cdb4227b637deadf4c7094fa713..1ac50a61c62d4fe7dad24fc3e8f6e30c09f8263b 100644 --- a/test/link/macho/bugs/13056/build.zig +++ b/test/link/macho/bugs/13056/build.zig @@ -31,7 +31,7 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.Optimize }); exe.addObjectFile(std.fs.path.join(b.allocator, &.{ sdk.path, "/usr/lib/libc++.tbd" }) catch unreachable); - const run_cmd = exe.run(); + const run_cmd = b.addRunArtifact(exe); run_cmd.expectStdErrEqual("x: 5\n"); test_step.dependOn(&run_cmd.step); diff --git a/test/link/macho/dead_strip_dylibs/build.zig b/test/link/macho/dead_strip_dylibs/build.zig index b9b97949c13efd9a43bf2c59025d53da08ddf7bd..47e53f853e26535b35c319869641fbf076141f2b 100644 --- a/test/link/macho/dead_strip_dylibs/build.zig +++ b/test/link/macho/dead_strip_dylibs/build.zig @@ -27,7 +27,7 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.Optimize test_step.dependOn(&check.step); - const run_cmd = exe.run(); + const run_cmd = b.addRunArtifact(exe); test_step.dependOn(&run_cmd.step); } diff --git a/test/link/macho/entry_in_archive/build.zig b/test/link/macho/entry_in_archive/build.zig index 5d244a93fc9f40536418c08d48e9af4767b3c37b..f4b04bd162aa07b30dd568bc1dfcb7d1e7a69d77 100644 --- a/test/link/macho/entry_in_archive/build.zig +++ b/test/link/macho/entry_in_archive/build.zig @@ -29,7 +29,7 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.Optimize exe.linkLibrary(lib); exe.linkLibC(); - const run = exe.run(); + const run = b.addRunArtifact(exe); run.skip_foreign_checks = true; run.expectExitCode(0); test_step.dependOn(&run.step); diff --git a/test/link/macho/headerpad/build.zig b/test/link/macho/headerpad/build.zig index 0c9275b8d8d8130fa8bd9e7a582a9ea815d0ae99..22cfcc90eca282354725591c6673981e055629aa 100644 --- a/test/link/macho/headerpad/build.zig +++ b/test/link/macho/headerpad/build.zig @@ -36,7 +36,7 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.Optimize test_step.dependOn(&check.step); - const run = exe.run(); + const run = b.addRunArtifact(exe); test_step.dependOn(&run.step); } @@ -52,7 +52,7 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.Optimize test_step.dependOn(&check.step); - const run = exe.run(); + const run = b.addRunArtifact(exe); test_step.dependOn(&run.step); } @@ -69,7 +69,7 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.Optimize test_step.dependOn(&check.step); - const run = exe.run(); + const run = b.addRunArtifact(exe); test_step.dependOn(&run.step); } @@ -95,7 +95,7 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.Optimize test_step.dependOn(&check.step); - const run = exe.run(); + const run = b.addRunArtifact(exe); test_step.dependOn(&run.step); } } diff --git a/test/link/macho/needed_framework/build.zig b/test/link/macho/needed_framework/build.zig index 3de96efbc73ca5bfe03fb3a645506cfc5c5aa5c9..fc80a44f734bd86bf3485a6f2636055548644abf 100644 --- a/test/link/macho/needed_framework/build.zig +++ b/test/link/macho/needed_framework/build.zig @@ -30,6 +30,6 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.Optimize check.checkNext("name {*}Cocoa"); test_step.dependOn(&check.step); - const run_cmd = exe.run(); + const run_cmd = b.addRunArtifact(exe); test_step.dependOn(&run_cmd.step); } diff --git a/test/link/macho/objcpp/build.zig b/test/link/macho/objcpp/build.zig index 06876247a9e9f54e1f53ffeee3c8097bcfd2f0e0..aebf0e17fd93d0844583c0366be627ca77d012b4 100644 --- a/test/link/macho/objcpp/build.zig +++ b/test/link/macho/objcpp/build.zig @@ -27,7 +27,7 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.Optimize // populate paths to the sysroot here. exe.linkFramework("Foundation"); - const run_cmd = exe.run(); + const run_cmd = b.addRunArtifact(exe); run_cmd.expectStdOutEqual("Hello from C++ and Zig"); test_step.dependOn(&run_cmd.step); diff --git a/test/link/macho/tls/build.zig b/test/link/macho/tls/build.zig index 5981fea19401a7493fda73250ece94b20a5b069b..f155f514f881348513de00aab4ca2d5de9c53613 100644 --- a/test/link/macho/tls/build.zig +++ b/test/link/macho/tls/build.zig @@ -32,7 +32,7 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.Optimize test_exe.linkLibrary(lib); test_exe.linkLibC(); - const run = test_exe.run(); + const run = b.addRunArtifact(test_exe); run.skip_foreign_checks = true; test_step.dependOn(&run.step); diff --git a/test/link/macho/weak_framework/build.zig b/test/link/macho/weak_framework/build.zig index 7cc08f5b9d961fcd509d3f4a9e270ddb00f85205..5dfd421243ff6e0b9e2648a8ee85cbb905ce4330 100644 --- a/test/link/macho/weak_framework/build.zig +++ b/test/link/macho/weak_framework/build.zig @@ -27,6 +27,6 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.Optimize check.checkNext("name {*}Cocoa"); test_step.dependOn(&check.step); - const run_cmd = exe.run(); + const run_cmd = b.addRunArtifact(exe); test_step.dependOn(&run_cmd.step); } diff --git a/test/link/macho/weak_library/build.zig b/test/link/macho/weak_library/build.zig index b12ec087f560f987998e172711185ce12f69a6af..88d72ad48775efb873336d83f963645f2bb2f291 100644 --- a/test/link/macho/weak_library/build.zig +++ b/test/link/macho/weak_library/build.zig @@ -23,7 +23,7 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.Optimize }); dylib.addCSourceFile("a.c", &.{}); dylib.linkLibC(); - dylib.install(); + b.installArtifact(dylib); const exe = b.addExecutable(.{ .name = "test", diff --git a/test/link/wasm/producers/build.zig b/test/link/wasm/producers/build.zig index 7b7cefd7e06dc5b5a85b2c563ac39a76ffd45161..439a66cfa51ca18a2ff3307e7fcd1fb6dc2eb9a6 100644 --- a/test/link/wasm/producers/build.zig +++ b/test/link/wasm/producers/build.zig @@ -23,7 +23,7 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.Optimize lib.use_llvm = false; lib.use_lld = false; lib.strip = false; - lib.install(); + b.installArtifact(lib); const version_fmt = "version " ++ builtin.zig_version_string; diff --git a/test/link/wasm/segments/build.zig b/test/link/wasm/segments/build.zig index 281d8ae32b9dcfa055548e1b8d0108cfeaa0fa7a..59fab9bb84ca8d8077ab97ee99523931c14c460b 100644 --- a/test/link/wasm/segments/build.zig +++ b/test/link/wasm/segments/build.zig @@ -22,7 +22,7 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.Optimize lib.use_llvm = false; lib.use_lld = false; lib.strip = false; - lib.install(); + b.installArtifact(lib); const check_lib = lib.checkObject(); check_lib.checkStart("Section data"); diff --git a/test/link/wasm/stack_pointer/build.zig b/test/link/wasm/stack_pointer/build.zig index 794b7d27fbb33e42cca918809dc9b372d12a7cc5..bf643c1e3a3908cccbd3c1edc58af8c06ca1aa83 100644 --- a/test/link/wasm/stack_pointer/build.zig +++ b/test/link/wasm/stack_pointer/build.zig @@ -23,7 +23,7 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.Optimize lib.use_lld = false; lib.strip = false; lib.stack_size = std.wasm.page_size * 2; // set an explicit stack size - lib.install(); + b.installArtifact(lib); const check_lib = lib.checkObject(); diff --git a/test/link/wasm/type/build.zig b/test/link/wasm/type/build.zig index 4a8395645f39813ace50d8f108350e9c01b63637..4038a3c4b130d23a65a2e6818f26e7bf0e3a2a04 100644 --- a/test/link/wasm/type/build.zig +++ b/test/link/wasm/type/build.zig @@ -22,7 +22,7 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.Optimize lib.use_llvm = false; lib.use_lld = false; lib.strip = false; - lib.install(); + b.installArtifact(lib); const check_lib = lib.checkObject(); check_lib.checkStart("Section type"); diff --git a/test/src/CompareOutput.zig b/test/src/CompareOutput.zig index 854bd11f9cad463edd2ebcaad54d6380085361b7..fb89082defc938210358a7d5bf0c1a788fa6b7f4 100644 --- a/test/src/CompareOutput.zig +++ b/test/src/CompareOutput.zig @@ -101,7 +101,7 @@ pub fn addCase(self: *CompareOutput, case: TestCase) void { }); exe.addAssemblyFileSource(write_src.getFileSource(case.sources.items[0].filename).?); - const run = exe.run(); + const run = b.addRunArtifact(exe); run.setName(annotated_case_name); run.addArgs(case.cli_args); run.expectStdOutEqual(case.expected_output); @@ -128,7 +128,7 @@ pub fn addCase(self: *CompareOutput, case: TestCase) void { exe.linkSystemLibrary("c"); } - const run = exe.run(); + const run = b.addRunArtifact(exe); run.setName(annotated_case_name); run.addArgs(case.cli_args); run.expectStdOutEqual(case.expected_output); @@ -155,7 +155,7 @@ pub fn addCase(self: *CompareOutput, case: TestCase) void { exe.linkSystemLibrary("c"); } - const run = exe.run(); + const run = b.addRunArtifact(exe); run.setName(annotated_case_name); run.addArgs(case.cli_args); run.expectExitCode(126); diff --git a/test/src/run_translated_c.zig b/test/src/run_translated_c.zig index 2103172ed6885b2a854bfeea545d2156537300c7..946e56f5126d97987b3f24b1c443ec87cf2974c9 100644 --- a/test/src/run_translated_c.zig +++ b/test/src/run_translated_c.zig @@ -94,7 +94,7 @@ pub const RunTranslatedCContext = struct { const exe = translate_c.addExecutable(.{}); exe.step.name = b.fmt("{s} build-exe", .{annotated_case_name}); exe.linkLibC(); - const run = exe.run(); + const run = b.addRunArtifact(exe); run.step.name = b.fmt("{s} run", .{annotated_case_name}); if (!case.allow_warnings) { run.expectStdErrEqual(""); diff --git a/test/standalone/dep_diamond/build.zig b/test/standalone/dep_diamond/build.zig index 12eda4ec5d72f0c25b58e8d53f30e01518f37d2e..6c6d9b6d1a2586cd7f0526ae6e03e3e82b5267fb 100644 --- a/test/standalone/dep_diamond/build.zig +++ b/test/standalone/dep_diamond/build.zig @@ -24,7 +24,6 @@ pub fn build(b: *std.Build) void { .dependencies = &.{.{ .name = "shared", .module = shared }}, }); - const run = exe.run(); - + const run = b.addRunArtifact(exe); test_step.dependOn(&run.step); } diff --git a/test/standalone/dep_mutually_recursive/build.zig b/test/standalone/dep_mutually_recursive/build.zig index 1a6bff85010f7f5bd5849981349f33187ce3361f..e70e775401821c0f7567cc850dd793c1d5d2fbac 100644 --- a/test/standalone/dep_mutually_recursive/build.zig +++ b/test/standalone/dep_mutually_recursive/build.zig @@ -22,7 +22,6 @@ pub fn build(b: *std.Build) void { }); exe.addModule("foo", foo); - const run = exe.run(); - + const run = b.addRunArtifact(exe); test_step.dependOn(&run.step); } diff --git a/test/standalone/dep_recursive/build.zig b/test/standalone/dep_recursive/build.zig index 35b9f3cc474f2d4eff50f6d083340ffb5fb611b8..2e2cf4ea4d4feb3afa7baebb80046130424ad11e 100644 --- a/test/standalone/dep_recursive/build.zig +++ b/test/standalone/dep_recursive/build.zig @@ -18,7 +18,6 @@ pub fn build(b: *std.Build) void { }); exe.addModule("foo", foo); - const run = exe.run(); - + const run = b.addRunArtifact(exe); test_step.dependOn(&run.step); } diff --git a/test/standalone/dep_shared_builtin/build.zig b/test/standalone/dep_shared_builtin/build.zig index 776794f95e318e27afe8870f463a5bf40cd8f6f1..175118d33192cb167898f696f2dbd4d386a53c7f 100644 --- a/test/standalone/dep_shared_builtin/build.zig +++ b/test/standalone/dep_shared_builtin/build.zig @@ -15,7 +15,6 @@ pub fn build(b: *std.Build) void { .source_file = .{ .path = "foo.zig" }, }); - const run = exe.run(); - + const run = b.addRunArtifact(exe); test_step.dependOn(&run.step); } diff --git a/test/standalone/dep_triangle/build.zig b/test/standalone/dep_triangle/build.zig index 14163df84c9a8417d1ddd647ee6239cb4c2e93c7..63eed997ceb62904cbd30cdfd6fb2314a75d53a2 100644 --- a/test/standalone/dep_triangle/build.zig +++ b/test/standalone/dep_triangle/build.zig @@ -21,7 +21,6 @@ pub fn build(b: *std.Build) void { }); exe.addModule("shared", shared); - const run = exe.run(); - + const run = b.addRunArtifact(exe); test_step.dependOn(&run.step); } diff --git a/test/standalone/emit_asm_and_bin/build.zig b/test/standalone/emit_asm_and_bin/build.zig index 594bf6552e0c039b88260d1eba9e76472f2c96f3..1a608b40a925f7ee1d5fc300aabab7202e0088e4 100644 --- a/test/standalone/emit_asm_and_bin/build.zig +++ b/test/standalone/emit_asm_and_bin/build.zig @@ -11,5 +11,5 @@ pub fn build(b: *std.Build) void { main.emit_asm = .{ .emit_to = b.pathFromRoot("main.s") }; main.emit_bin = .{ .emit_to = b.pathFromRoot("main") }; - test_step.dependOn(&main.run().step); + test_step.dependOn(&b.addRunArtifact(main).step); } diff --git a/test/standalone/global_linkage/build.zig b/test/standalone/global_linkage/build.zig index ddcddd612a1395bf7e7c603fdf184ffbc0b748bc..d560027265cbcd7b5b33ada5f7c694824d11ed3f 100644 --- a/test/standalone/global_linkage/build.zig +++ b/test/standalone/global_linkage/build.zig @@ -28,5 +28,5 @@ pub fn build(b: *std.Build) void { main.linkLibrary(obj1); main.linkLibrary(obj2); - test_step.dependOn(&main.run().step); + test_step.dependOn(&b.addRunArtifact(main).step); } diff --git a/test/standalone/issue_11595/build.zig b/test/standalone/issue_11595/build.zig index 7d9530c6904d2aca8d9b20023ee9725625d70a85..b03d3c66cedc476cf9febe3e54504cf87b3ee4f8 100644 --- a/test/standalone/issue_11595/build.zig +++ b/test/standalone/issue_11595/build.zig @@ -19,7 +19,7 @@ pub fn build(b: *std.Build) void { .target = target, .optimize = optimize, }); - exe.install(); + b.installArtifact(exe); const c_sources = [_][]const u8{ "test.c", diff --git a/test/standalone/issue_13970/build.zig b/test/standalone/issue_13970/build.zig index 1eb8a5a1213fe1d3d9f4a48521428217f1b5292e..7d2799e29e9012a61d414a3ba1da8cc5a5920bf1 100644 --- a/test/standalone/issue_13970/build.zig +++ b/test/standalone/issue_13970/build.zig @@ -17,7 +17,7 @@ pub fn build(b: *std.Build) void { test2.setTestRunner("src/main.zig"); test3.setTestRunner("src/main.zig"); - test_step.dependOn(&test1.run().step); - test_step.dependOn(&test2.run().step); - test_step.dependOn(&test3.run().step); + test_step.dependOn(&b.addRunArtifact(test1).step); + test_step.dependOn(&b.addRunArtifact(test2).step); + test_step.dependOn(&b.addRunArtifact(test3).step); } diff --git a/test/standalone/issue_8550/build.zig b/test/standalone/issue_8550/build.zig index 8f7631e68f7707eb70ef3149eaf4f48e17b0b1b8..32bb3e10eb892a0844542c2e388e0b5d267550e8 100644 --- a/test/standalone/issue_8550/build.zig +++ b/test/standalone/issue_8550/build.zig @@ -21,7 +21,7 @@ pub fn build(b: *std.Build) !void { }); kernel.addObjectFile("./boot.S"); kernel.setLinkerScriptPath(.{ .path = "./linker.ld" }); - kernel.install(); + b.installArtifact(kernel); test_step.dependOn(&kernel.step); } diff --git a/test/standalone/main_pkg_path/build.zig b/test/standalone/main_pkg_path/build.zig index a4dd301c43dfa525ac77aa15212458d61b616e91..f3eacce767b8418b300b6034f60c5574ff9e0a49 100644 --- a/test/standalone/main_pkg_path/build.zig +++ b/test/standalone/main_pkg_path/build.zig @@ -9,5 +9,5 @@ pub fn build(b: *std.Build) void { }); test_exe.setMainPkgPath("."); - test_step.dependOn(&test_exe.run().step); + test_step.dependOn(&b.addRunArtifact(test_exe).step); } diff --git a/test/standalone/mix_o_files/build.zig b/test/standalone/mix_o_files/build.zig index 17ce55a8aaa10f63c27a92a4919d29cce96d2a81..2d9323ff00def954b4a50679e17b74494dac0be1 100644 --- a/test/standalone/mix_o_files/build.zig +++ b/test/standalone/mix_o_files/build.zig @@ -25,7 +25,6 @@ pub fn build(b: *std.Build) void { b.default_step.dependOn(&exe.step); - const run_cmd = exe.run(); - + const run_cmd = b.addRunArtifact(exe); test_step.dependOn(&run_cmd.step); } diff --git a/test/standalone/options/build.zig b/test/standalone/options/build.zig index 28e7e31eb70c65dcd363f07255d3c1d53e5779d5..d87610ba220a369e4e3e7a36615d512e48e353b0 100644 --- a/test/standalone/options/build.zig +++ b/test/standalone/options/build.zig @@ -17,5 +17,5 @@ pub fn build(b: *std.Build) void { options.addOption([]const u8, "string", b.option([]const u8, "string", "s").?); const test_step = b.step("test", "Run unit tests"); - test_step.dependOn(&main.run().step); + test_step.dependOn(&b.addRunArtifact(main).step); } diff --git a/test/standalone/pie/build.zig b/test/standalone/pie/build.zig index e7ef5f97cc38788e1e834775c34e99a37286077f..1efcd5c26e87b77a3a0fbef4b2003bcece91c3be 100644 --- a/test/standalone/pie/build.zig +++ b/test/standalone/pie/build.zig @@ -17,7 +17,7 @@ pub fn build(b: *std.Build) void { }); main.pie = true; - const run = main.run(); + const run = b.addRunArtifact(main); run.skip_foreign_checks = true; test_step.dependOn(&run.step); diff --git a/test/standalone/pkg_import/build.zig b/test/standalone/pkg_import/build.zig index 42799ab8963b658417309da68b5d292d00b7fd1f..30f4b2ede49bbef528ad751a84ddf41add170462 100644 --- a/test/standalone/pkg_import/build.zig +++ b/test/standalone/pkg_import/build.zig @@ -13,7 +13,6 @@ pub fn build(b: *std.Build) void { }); exe.addAnonymousModule("my_pkg", .{ .source_file = .{ .path = "pkg.zig" } }); - const run = exe.run(); - + const run = b.addRunArtifact(exe); test_step.dependOn(&run.step); } diff --git a/test/standalone/shared_library/build.zig b/test/standalone/shared_library/build.zig index 63370af0cc04698a7fae2abd1ed4dd08258cd158..377bf8186264bdd0fc6f49f65b90eb6f494927e0 100644 --- a/test/standalone/shared_library/build.zig +++ b/test/standalone/shared_library/build.zig @@ -23,7 +23,6 @@ pub fn build(b: *std.Build) void { exe.linkLibrary(lib); exe.linkSystemLibrary("c"); - const run_cmd = exe.run(); - + const run_cmd = b.addRunArtifact(exe); test_step.dependOn(&run_cmd.step); } diff --git a/test/standalone/static_c_lib/build.zig b/test/standalone/static_c_lib/build.zig index 794b813b75f397fee0cfcbfd2a76317febabfaaf..3feae705fcdba9ec0d870bef9bcc028a86ff3920 100644 --- a/test/standalone/static_c_lib/build.zig +++ b/test/standalone/static_c_lib/build.zig @@ -21,5 +21,5 @@ pub fn build(b: *std.Build) void { test_exe.linkLibrary(foo); test_exe.addIncludePath("."); - test_step.dependOn(&test_exe.run().step); + test_step.dependOn(&b.addRunArtifact(test_exe).step); } diff --git a/test/standalone/test_runner_module_imports/build.zig b/test/standalone/test_runner_module_imports/build.zig index 685a6b1e3d08b7107bb3012691e485d2780ba8c2..307957faeeac0fa2d958919263653c8820f054c1 100644 --- a/test/standalone/test_runner_module_imports/build.zig +++ b/test/standalone/test_runner_module_imports/build.zig @@ -15,6 +15,6 @@ pub fn build(b: *std.Build) void { t.addModule("module2", module2); const test_step = b.step("test", "Run unit tests"); - test_step.dependOn(&t.run().step); + test_step.dependOn(&b.addRunArtifact(t).step); b.default_step = test_step; } diff --git a/test/standalone/test_runner_path/build.zig b/test/standalone/test_runner_path/build.zig index ce5b668054801e12552b99dd11159b6d6dfae6b2..352a18efe058fc1ea8bd8ef178be49125c15ea9e 100644 --- a/test/standalone/test_runner_path/build.zig +++ b/test/standalone/test_runner_path/build.zig @@ -11,7 +11,6 @@ pub fn build(b: *std.Build) void { }); test_exe.test_runner = "test_runner.zig"; - const test_run = test_exe.run(); - + const test_run = b.addRunArtifact(test_exe); test_step.dependOn(&test_run.step); } diff --git a/test/standalone/use_alias/build.zig b/test/standalone/use_alias/build.zig index db47fe6692055cae549bc5592eacb61000ce6738..6fa0a1f3a5b649857e2a356be1d958c3f738a8bf 100644 --- a/test/standalone/use_alias/build.zig +++ b/test/standalone/use_alias/build.zig @@ -12,5 +12,5 @@ pub fn build(b: *std.Build) void { }); main.addIncludePath("."); - test_step.dependOn(&main.run().step); + test_step.dependOn(&b.addRunArtifact(main).step); } diff --git a/test/tests.zig b/test/tests.zig index 26e684cd0d63d86bff770f7d5c4362c2a72c91f8..a9bed635e2d478e7bf79bcc2f3dfdcef0b23969c 100644 --- a/test/tests.zig +++ b/test/tests.zig @@ -596,7 +596,8 @@ pub fn addStandaloneTests( }); if (case.link_libc) exe.linkLibC(); - step.dependOn(&exe.run().step); + const run = b.addRunArtifact(exe); + step.dependOn(&run.step); } } } @@ -1004,7 +1005,7 @@ pub fn addModuleTests(b: *std.Build, options: ModuleTestOptions) *Step { }, }; - const run = these_tests.run(); + const run = b.addRunArtifact(these_tests); run.skip_foreign_checks = true; run.setName(b.fmt("run test {s}-{s}-{s}-{s}-{s}-{s}", .{ options.name, @@ -1061,7 +1062,7 @@ pub fn addCAbiTests(b: *std.Build, skip_non_native: bool, skip_release: bool) *S triple_prefix, @tagName(optimize_mode), })); - const run = test_step.run(); + const run = b.addRunArtifact(test_step); run.skip_foreign_checks = true; step.dependOn(&run.step); }