| author | |
| committer | |
| log | 60eabc0eca5f678d0c6569a9565b1d6141459518 |
| tree | 4865a7c2ebca0b21077e4e3b329e6ff80561dd67 |
| parent | 38698f4f6aabb20639642afa58b17f31a43e162b |
These functions are problematic in light of dependencies because they
run and install, respectively, for the *owner* package rather than for
the *user* package. By removing these functions, the build script is
forced to provide the *Build object to associate the new step with,
making everything less surprising.
Unfortunately, this is a widely breaking change.
see #1507942 files changed, 57 insertions(+), 69 deletions(-)
build.zig+1-1| ... | @@ -181,7 +181,7 @@ pub fn build(b: *std.Build) !void { | ... | @@ -181,7 +181,7 @@ pub fn build(b: *std.Build) !void { |
| 181 | exe.sanitize_thread = sanitize_thread; | 181 | exe.sanitize_thread = sanitize_thread; |
| 182 | exe.build_id = b.option(bool, "build-id", "Include a build id note") orelse false; | 182 | exe.build_id = b.option(bool, "build-id", "Include a build id note") orelse false; |
| 183 | exe.entitlements = entitlements; | 183 | exe.entitlements = entitlements; |
| 184 | exe.install(); | 184 | b.installArtifact(exe); |
| 185 | 185 | ||
| 186 | const compile_step = b.step("compile", "Build the self-hosted compiler"); | 186 | const compile_step = b.step("compile", "Build the self-hosted compiler"); |
| 187 | compile_step.dependOn(&exe.step); | 187 | compile_step.dependOn(&exe.step); |
lib/std/Build/CompileStep.zig+6-10| ... | @@ -463,11 +463,6 @@ pub fn setOutputDir(self: *CompileStep, dir: []const u8) void { | ... | @@ -463,11 +463,6 @@ pub fn setOutputDir(self: *CompileStep, dir: []const u8) void { |
| 463 | self.output_dir = b.dupePath(dir); | 463 | self.output_dir = b.dupePath(dir); |
| 464 | } | 464 | } |
| 465 | 465 | ||
| 466 | pub fn install(self: *CompileStep) void { | ||
| 467 | const b = self.step.owner; | ||
| 468 | b.installArtifact(self); | ||
| 469 | } | ||
| 470 | |||
| 471 | pub fn installHeader(cs: *CompileStep, src_path: []const u8, dest_rel_path: []const u8) void { | 466 | pub fn installHeader(cs: *CompileStep, src_path: []const u8, dest_rel_path: []const u8) void { |
| 472 | const b = cs.step.owner; | 467 | const b = cs.step.owner; |
| 473 | const install_file = b.addInstallHeaderFile(src_path, dest_rel_path); | 468 | const install_file = b.addInstallHeaderFile(src_path, dest_rel_path); |
| ... | @@ -555,12 +550,13 @@ pub fn addObjCopy(cs: *CompileStep, options: ObjCopyStep.Options) *ObjCopyStep { | ... | @@ -555,12 +550,13 @@ pub fn addObjCopy(cs: *CompileStep, options: ObjCopyStep.Options) *ObjCopyStep { |
| 555 | return b.addObjCopy(cs.getOutputSource(), copy); | 550 | return b.addObjCopy(cs.getOutputSource(), copy); |
| 556 | } | 551 | } |
| 557 | 552 | ||
| 558 | /// Deprecated: use `std.Build.addRunArtifact` | 553 | /// This function would run in the context of the package that created the executable, |
| 559 | /// This function will run in the context of the package that created the executable, | ||
| 560 | /// which is undesirable when running an executable provided by a dependency package. | 554 | /// which is undesirable when running an executable provided by a dependency package. |
| 561 | pub fn run(cs: *CompileStep) *RunStep { | 555 | pub const run = @compileError("deprecated; use std.Build.addRunArtifact"); |
| 562 | return cs.step.owner.addRunArtifact(cs); | 556 | |
| 563 | } | 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. | ||
| 559 | pub const install = @compileError("deprecated; use std.Build.installArtifact"); | ||
| 564 | 560 | ||
| 565 | pub fn checkObject(self: *CompileStep) *CheckObjectStep { | 561 | pub fn checkObject(self: *CompileStep) *CheckObjectStep { |
| 566 | return CheckObjectStep.create(self.step.owner, self.getOutputSource(), self.target_info.target.ofmt); | 562 | return CheckObjectStep.create(self.step.owner, self.getOutputSource(), self.target_info.target.ofmt); |
test/link/bss/build.zig+1-1| ... | @@ -10,7 +10,7 @@ pub fn build(b: *std.Build) void { | ... | @@ -10,7 +10,7 @@ pub fn build(b: *std.Build) void { |
| 10 | .optimize = .Debug, | 10 | .optimize = .Debug, |
| 11 | }); | 11 | }); |
| 12 | 12 | ||
| 13 | const run = exe.run(); | 13 | const run = b.addRunArtifact(exe); |
| 14 | run.expectStdOutEqual("0, 1, 0\n"); | 14 | run.expectStdOutEqual("0, 1, 0\n"); |
| 15 | 15 | ||
| 16 | test_step.dependOn(&run.step); | 16 | 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 | ... | @@ -24,5 +24,5 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.Optimize |
| 24 | }); | 24 | }); |
| 25 | test_exe.linkLibrary(lib_a); | 25 | test_exe.linkLibrary(lib_a); |
| 26 | 26 | ||
| 27 | test_step.dependOn(&test_exe.run().step); | 27 | test_step.dependOn(&b.addRunArtifact(test_exe).step); |
| 28 | } | 28 | } |
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 | ... | @@ -24,5 +24,5 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.Optimize |
| 24 | }); | 24 | }); |
| 25 | test_exe.linkLibrary(lib_a); | 25 | test_exe.linkLibrary(lib_a); |
| 26 | 26 | ||
| 27 | test_step.dependOn(&test_exe.run().step); | 27 | test_step.dependOn(&b.addRunArtifact(test_exe).step); |
| 28 | } | 28 | } |
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 | ... | @@ -35,5 +35,5 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.Optimize |
| 35 | test_exe.linkLibrary(lib_b); | 35 | test_exe.linkLibrary(lib_b); |
| 36 | test_exe.addIncludePath("."); | 36 | test_exe.addIncludePath("."); |
| 37 | 37 | ||
| 38 | test_step.dependOn(&test_exe.run().step); | 38 | test_step.dependOn(&b.addRunArtifact(test_exe).step); |
| 39 | } | 39 | } |
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 | ... | @@ -31,7 +31,7 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.Optimize |
| 31 | }); | 31 | }); |
| 32 | exe.addObjectFile(std.fs.path.join(b.allocator, &.{ sdk.path, "/usr/lib/libc++.tbd" }) catch unreachable); | 32 | exe.addObjectFile(std.fs.path.join(b.allocator, &.{ sdk.path, "/usr/lib/libc++.tbd" }) catch unreachable); |
| 33 | 33 | ||
| 34 | const run_cmd = exe.run(); | 34 | const run_cmd = b.addRunArtifact(exe); |
| 35 | run_cmd.expectStdErrEqual("x: 5\n"); | 35 | run_cmd.expectStdErrEqual("x: 5\n"); |
| 36 | 36 | ||
| 37 | test_step.dependOn(&run_cmd.step); | 37 | 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 | ... | @@ -27,7 +27,7 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.Optimize |
| 27 | 27 | ||
| 28 | test_step.dependOn(&check.step); | 28 | test_step.dependOn(&check.step); |
| 29 | 29 | ||
| 30 | const run_cmd = exe.run(); | 30 | const run_cmd = b.addRunArtifact(exe); |
| 31 | test_step.dependOn(&run_cmd.step); | 31 | test_step.dependOn(&run_cmd.step); |
| 32 | } | 32 | } |
| 33 | 33 |
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 | ... | @@ -29,7 +29,7 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.Optimize |
| 29 | exe.linkLibrary(lib); | 29 | exe.linkLibrary(lib); |
| 30 | exe.linkLibC(); | 30 | exe.linkLibC(); |
| 31 | 31 | ||
| 32 | const run = exe.run(); | 32 | const run = b.addRunArtifact(exe); |
| 33 | run.skip_foreign_checks = true; | 33 | run.skip_foreign_checks = true; |
| 34 | run.expectExitCode(0); | 34 | run.expectExitCode(0); |
| 35 | test_step.dependOn(&run.step); | 35 | 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 | ... | @@ -36,7 +36,7 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.Optimize |
| 36 | 36 | ||
| 37 | test_step.dependOn(&check.step); | 37 | test_step.dependOn(&check.step); |
| 38 | 38 | ||
| 39 | const run = exe.run(); | 39 | const run = b.addRunArtifact(exe); |
| 40 | test_step.dependOn(&run.step); | 40 | test_step.dependOn(&run.step); |
| 41 | } | 41 | } |
| 42 | 42 | ||
| ... | @@ -52,7 +52,7 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.Optimize | ... | @@ -52,7 +52,7 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.Optimize |
| 52 | 52 | ||
| 53 | test_step.dependOn(&check.step); | 53 | test_step.dependOn(&check.step); |
| 54 | 54 | ||
| 55 | const run = exe.run(); | 55 | const run = b.addRunArtifact(exe); |
| 56 | test_step.dependOn(&run.step); | 56 | test_step.dependOn(&run.step); |
| 57 | } | 57 | } |
| 58 | 58 | ||
| ... | @@ -69,7 +69,7 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.Optimize | ... | @@ -69,7 +69,7 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.Optimize |
| 69 | 69 | ||
| 70 | test_step.dependOn(&check.step); | 70 | test_step.dependOn(&check.step); |
| 71 | 71 | ||
| 72 | const run = exe.run(); | 72 | const run = b.addRunArtifact(exe); |
| 73 | test_step.dependOn(&run.step); | 73 | test_step.dependOn(&run.step); |
| 74 | } | 74 | } |
| 75 | 75 | ||
| ... | @@ -95,7 +95,7 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.Optimize | ... | @@ -95,7 +95,7 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.Optimize |
| 95 | 95 | ||
| 96 | test_step.dependOn(&check.step); | 96 | test_step.dependOn(&check.step); |
| 97 | 97 | ||
| 98 | const run = exe.run(); | 98 | const run = b.addRunArtifact(exe); |
| 99 | test_step.dependOn(&run.step); | 99 | test_step.dependOn(&run.step); |
| 100 | } | 100 | } |
| 101 | } | 101 | } |
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 | ... | @@ -30,6 +30,6 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.Optimize |
| 30 | check.checkNext("name {*}Cocoa"); | 30 | check.checkNext("name {*}Cocoa"); |
| 31 | test_step.dependOn(&check.step); | 31 | test_step.dependOn(&check.step); |
| 32 | 32 | ||
| 33 | const run_cmd = exe.run(); | 33 | const run_cmd = b.addRunArtifact(exe); |
| 34 | test_step.dependOn(&run_cmd.step); | 34 | test_step.dependOn(&run_cmd.step); |
| 35 | } | 35 | } |
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 | ... | @@ -27,7 +27,7 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.Optimize |
| 27 | // populate paths to the sysroot here. | 27 | // populate paths to the sysroot here. |
| 28 | exe.linkFramework("Foundation"); | 28 | exe.linkFramework("Foundation"); |
| 29 | 29 | ||
| 30 | const run_cmd = exe.run(); | 30 | const run_cmd = b.addRunArtifact(exe); |
| 31 | run_cmd.expectStdOutEqual("Hello from C++ and Zig"); | 31 | run_cmd.expectStdOutEqual("Hello from C++ and Zig"); |
| 32 | 32 | ||
| 33 | test_step.dependOn(&run_cmd.step); | 33 | 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 | ... | @@ -32,7 +32,7 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.Optimize |
| 32 | test_exe.linkLibrary(lib); | 32 | test_exe.linkLibrary(lib); |
| 33 | test_exe.linkLibC(); | 33 | test_exe.linkLibC(); |
| 34 | 34 | ||
| 35 | const run = test_exe.run(); | 35 | const run = b.addRunArtifact(test_exe); |
| 36 | run.skip_foreign_checks = true; | 36 | run.skip_foreign_checks = true; |
| 37 | 37 | ||
| 38 | test_step.dependOn(&run.step); | 38 | 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 | ... | @@ -27,6 +27,6 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.Optimize |
| 27 | check.checkNext("name {*}Cocoa"); | 27 | check.checkNext("name {*}Cocoa"); |
| 28 | test_step.dependOn(&check.step); | 28 | test_step.dependOn(&check.step); |
| 29 | 29 | ||
| 30 | const run_cmd = exe.run(); | 30 | const run_cmd = b.addRunArtifact(exe); |
| 31 | test_step.dependOn(&run_cmd.step); | 31 | test_step.dependOn(&run_cmd.step); |
| 32 | } | 32 | } |
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 | ... | @@ -23,7 +23,7 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.Optimize |
| 23 | }); | 23 | }); |
| 24 | dylib.addCSourceFile("a.c", &.{}); | 24 | dylib.addCSourceFile("a.c", &.{}); |
| 25 | dylib.linkLibC(); | 25 | dylib.linkLibC(); |
| 26 | dylib.install(); | 26 | b.installArtifact(dylib); |
| 27 | 27 | ||
| 28 | const exe = b.addExecutable(.{ | 28 | const exe = b.addExecutable(.{ |
| 29 | .name = "test", | 29 | .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 | ... | @@ -23,7 +23,7 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.Optimize |
| 23 | lib.use_llvm = false; | 23 | lib.use_llvm = false; |
| 24 | lib.use_lld = false; | 24 | lib.use_lld = false; |
| 25 | lib.strip = false; | 25 | lib.strip = false; |
| 26 | lib.install(); | 26 | b.installArtifact(lib); |
| 27 | 27 | ||
| 28 | const version_fmt = "version " ++ builtin.zig_version_string; | 28 | const version_fmt = "version " ++ builtin.zig_version_string; |
| 29 | 29 |
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 | ... | @@ -22,7 +22,7 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.Optimize |
| 22 | lib.use_llvm = false; | 22 | lib.use_llvm = false; |
| 23 | lib.use_lld = false; | 23 | lib.use_lld = false; |
| 24 | lib.strip = false; | 24 | lib.strip = false; |
| 25 | lib.install(); | 25 | b.installArtifact(lib); |
| 26 | 26 | ||
| 27 | const check_lib = lib.checkObject(); | 27 | const check_lib = lib.checkObject(); |
| 28 | check_lib.checkStart("Section data"); | 28 | 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 | ... | @@ -23,7 +23,7 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.Optimize |
| 23 | lib.use_lld = false; | 23 | lib.use_lld = false; |
| 24 | lib.strip = false; | 24 | lib.strip = false; |
| 25 | lib.stack_size = std.wasm.page_size * 2; // set an explicit stack size | 25 | lib.stack_size = std.wasm.page_size * 2; // set an explicit stack size |
| 26 | lib.install(); | 26 | b.installArtifact(lib); |
| 27 | 27 | ||
| 28 | const check_lib = lib.checkObject(); | 28 | const check_lib = lib.checkObject(); |
| 29 | 29 |
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 | ... | @@ -22,7 +22,7 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.Optimize |
| 22 | lib.use_llvm = false; | 22 | lib.use_llvm = false; |
| 23 | lib.use_lld = false; | 23 | lib.use_lld = false; |
| 24 | lib.strip = false; | 24 | lib.strip = false; |
| 25 | lib.install(); | 25 | b.installArtifact(lib); |
| 26 | 26 | ||
| 27 | const check_lib = lib.checkObject(); | 27 | const check_lib = lib.checkObject(); |
| 28 | check_lib.checkStart("Section type"); | 28 | check_lib.checkStart("Section type"); |
test/src/CompareOutput.zig+3-3| ... | @@ -101,7 +101,7 @@ pub fn addCase(self: *CompareOutput, case: TestCase) void { | ... | @@ -101,7 +101,7 @@ pub fn addCase(self: *CompareOutput, case: TestCase) void { |
| 101 | }); | 101 | }); |
| 102 | exe.addAssemblyFileSource(write_src.getFileSource(case.sources.items[0].filename).?); | 102 | exe.addAssemblyFileSource(write_src.getFileSource(case.sources.items[0].filename).?); |
| 103 | 103 | ||
| 104 | const run = exe.run(); | 104 | const run = b.addRunArtifact(exe); |
| 105 | run.setName(annotated_case_name); | 105 | run.setName(annotated_case_name); |
| 106 | run.addArgs(case.cli_args); | 106 | run.addArgs(case.cli_args); |
| 107 | run.expectStdOutEqual(case.expected_output); | 107 | run.expectStdOutEqual(case.expected_output); |
| ... | @@ -128,7 +128,7 @@ pub fn addCase(self: *CompareOutput, case: TestCase) void { | ... | @@ -128,7 +128,7 @@ pub fn addCase(self: *CompareOutput, case: TestCase) void { |
| 128 | exe.linkSystemLibrary("c"); | 128 | exe.linkSystemLibrary("c"); |
| 129 | } | 129 | } |
| 130 | 130 | ||
| 131 | const run = exe.run(); | 131 | const run = b.addRunArtifact(exe); |
| 132 | run.setName(annotated_case_name); | 132 | run.setName(annotated_case_name); |
| 133 | run.addArgs(case.cli_args); | 133 | run.addArgs(case.cli_args); |
| 134 | run.expectStdOutEqual(case.expected_output); | 134 | run.expectStdOutEqual(case.expected_output); |
| ... | @@ -155,7 +155,7 @@ pub fn addCase(self: *CompareOutput, case: TestCase) void { | ... | @@ -155,7 +155,7 @@ pub fn addCase(self: *CompareOutput, case: TestCase) void { |
| 155 | exe.linkSystemLibrary("c"); | 155 | exe.linkSystemLibrary("c"); |
| 156 | } | 156 | } |
| 157 | 157 | ||
| 158 | const run = exe.run(); | 158 | const run = b.addRunArtifact(exe); |
| 159 | run.setName(annotated_case_name); | 159 | run.setName(annotated_case_name); |
| 160 | run.addArgs(case.cli_args); | 160 | run.addArgs(case.cli_args); |
| 161 | run.expectExitCode(126); | 161 | run.expectExitCode(126); |
test/src/run_translated_c.zig+1-1| ... | @@ -94,7 +94,7 @@ pub const RunTranslatedCContext = struct { | ... | @@ -94,7 +94,7 @@ pub const RunTranslatedCContext = struct { |
| 94 | const exe = translate_c.addExecutable(.{}); | 94 | const exe = translate_c.addExecutable(.{}); |
| 95 | exe.step.name = b.fmt("{s} build-exe", .{annotated_case_name}); | 95 | exe.step.name = b.fmt("{s} build-exe", .{annotated_case_name}); |
| 96 | exe.linkLibC(); | 96 | exe.linkLibC(); |
| 97 | const run = exe.run(); | 97 | const run = b.addRunArtifact(exe); |
| 98 | run.step.name = b.fmt("{s} run", .{annotated_case_name}); | 98 | run.step.name = b.fmt("{s} run", .{annotated_case_name}); |
| 99 | if (!case.allow_warnings) { | 99 | if (!case.allow_warnings) { |
| 100 | run.expectStdErrEqual(""); | 100 | run.expectStdErrEqual(""); |
test/standalone/dep_diamond/build.zig+1-2| ... | @@ -24,7 +24,6 @@ pub fn build(b: *std.Build) void { | ... | @@ -24,7 +24,6 @@ pub fn build(b: *std.Build) void { |
| 24 | .dependencies = &.{.{ .name = "shared", .module = shared }}, | 24 | .dependencies = &.{.{ .name = "shared", .module = shared }}, |
| 25 | }); | 25 | }); |
| 26 | 26 | ||
| 27 | const run = exe.run(); | 27 | const run = b.addRunArtifact(exe); |
| 28 | |||
| 29 | test_step.dependOn(&run.step); | 28 | test_step.dependOn(&run.step); |
| 30 | } | 29 | } |
test/standalone/dep_mutually_recursive/build.zig+1-2| ... | @@ -22,7 +22,6 @@ pub fn build(b: *std.Build) void { | ... | @@ -22,7 +22,6 @@ pub fn build(b: *std.Build) void { |
| 22 | }); | 22 | }); |
| 23 | exe.addModule("foo", foo); | 23 | exe.addModule("foo", foo); |
| 24 | 24 | ||
| 25 | const run = exe.run(); | 25 | const run = b.addRunArtifact(exe); |
| 26 | |||
| 27 | test_step.dependOn(&run.step); | 26 | test_step.dependOn(&run.step); |
| 28 | } | 27 | } |
test/standalone/dep_recursive/build.zig+1-2| ... | @@ -18,7 +18,6 @@ pub fn build(b: *std.Build) void { | ... | @@ -18,7 +18,6 @@ pub fn build(b: *std.Build) void { |
| 18 | }); | 18 | }); |
| 19 | exe.addModule("foo", foo); | 19 | exe.addModule("foo", foo); |
| 20 | 20 | ||
| 21 | const run = exe.run(); | 21 | const run = b.addRunArtifact(exe); |
| 22 | |||
| 23 | test_step.dependOn(&run.step); | 22 | test_step.dependOn(&run.step); |
| 24 | } | 23 | } |
test/standalone/dep_shared_builtin/build.zig+1-2| ... | @@ -15,7 +15,6 @@ pub fn build(b: *std.Build) void { | ... | @@ -15,7 +15,6 @@ pub fn build(b: *std.Build) void { |
| 15 | .source_file = .{ .path = "foo.zig" }, | 15 | .source_file = .{ .path = "foo.zig" }, |
| 16 | }); | 16 | }); |
| 17 | 17 | ||
| 18 | const run = exe.run(); | 18 | const run = b.addRunArtifact(exe); |
| 19 | |||
| 20 | test_step.dependOn(&run.step); | 19 | test_step.dependOn(&run.step); |
| 21 | } | 20 | } |
test/standalone/dep_triangle/build.zig+1-2| ... | @@ -21,7 +21,6 @@ pub fn build(b: *std.Build) void { | ... | @@ -21,7 +21,6 @@ pub fn build(b: *std.Build) void { |
| 21 | }); | 21 | }); |
| 22 | exe.addModule("shared", shared); | 22 | exe.addModule("shared", shared); |
| 23 | 23 | ||
| 24 | const run = exe.run(); | 24 | const run = b.addRunArtifact(exe); |
| 25 | |||
| 26 | test_step.dependOn(&run.step); | 25 | test_step.dependOn(&run.step); |
| 27 | } | 26 | } |
test/standalone/emit_asm_and_bin/build.zig+1-1| ... | @@ -11,5 +11,5 @@ pub fn build(b: *std.Build) void { | ... | @@ -11,5 +11,5 @@ pub fn build(b: *std.Build) void { |
| 11 | main.emit_asm = .{ .emit_to = b.pathFromRoot("main.s") }; | 11 | main.emit_asm = .{ .emit_to = b.pathFromRoot("main.s") }; |
| 12 | main.emit_bin = .{ .emit_to = b.pathFromRoot("main") }; | 12 | main.emit_bin = .{ .emit_to = b.pathFromRoot("main") }; |
| 13 | 13 | ||
| 14 | test_step.dependOn(&main.run().step); | 14 | test_step.dependOn(&b.addRunArtifact(main).step); |
| 15 | } | 15 | } |
test/standalone/global_linkage/build.zig+1-1| ... | @@ -28,5 +28,5 @@ pub fn build(b: *std.Build) void { | ... | @@ -28,5 +28,5 @@ pub fn build(b: *std.Build) void { |
| 28 | main.linkLibrary(obj1); | 28 | main.linkLibrary(obj1); |
| 29 | main.linkLibrary(obj2); | 29 | main.linkLibrary(obj2); |
| 30 | 30 | ||
| 31 | test_step.dependOn(&main.run().step); | 31 | test_step.dependOn(&b.addRunArtifact(main).step); |
| 32 | } | 32 | } |
test/standalone/issue_11595/build.zig+1-1| ... | @@ -19,7 +19,7 @@ pub fn build(b: *std.Build) void { | ... | @@ -19,7 +19,7 @@ pub fn build(b: *std.Build) void { |
| 19 | .target = target, | 19 | .target = target, |
| 20 | .optimize = optimize, | 20 | .optimize = optimize, |
| 21 | }); | 21 | }); |
| 22 | exe.install(); | 22 | b.installArtifact(exe); |
| 23 | 23 | ||
| 24 | const c_sources = [_][]const u8{ | 24 | const c_sources = [_][]const u8{ |
| 25 | "test.c", | 25 | "test.c", |
test/standalone/issue_13970/build.zig+3-3| ... | @@ -17,7 +17,7 @@ pub fn build(b: *std.Build) void { | ... | @@ -17,7 +17,7 @@ pub fn build(b: *std.Build) void { |
| 17 | test2.setTestRunner("src/main.zig"); | 17 | test2.setTestRunner("src/main.zig"); |
| 18 | test3.setTestRunner("src/main.zig"); | 18 | test3.setTestRunner("src/main.zig"); |
| 19 | 19 | ||
| 20 | test_step.dependOn(&test1.run().step); | 20 | test_step.dependOn(&b.addRunArtifact(test1).step); |
| 21 | test_step.dependOn(&test2.run().step); | 21 | test_step.dependOn(&b.addRunArtifact(test2).step); |
| 22 | test_step.dependOn(&test3.run().step); | 22 | test_step.dependOn(&b.addRunArtifact(test3).step); |
| 23 | } | 23 | } |
test/standalone/issue_8550/build.zig+1-1| ... | @@ -21,7 +21,7 @@ pub fn build(b: *std.Build) !void { | ... | @@ -21,7 +21,7 @@ pub fn build(b: *std.Build) !void { |
| 21 | }); | 21 | }); |
| 22 | kernel.addObjectFile("./boot.S"); | 22 | kernel.addObjectFile("./boot.S"); |
| 23 | kernel.setLinkerScriptPath(.{ .path = "./linker.ld" }); | 23 | kernel.setLinkerScriptPath(.{ .path = "./linker.ld" }); |
| 24 | kernel.install(); | 24 | b.installArtifact(kernel); |
| 25 | 25 | ||
| 26 | test_step.dependOn(&kernel.step); | 26 | test_step.dependOn(&kernel.step); |
| 27 | } | 27 | } |
test/standalone/main_pkg_path/build.zig+1-1| ... | @@ -9,5 +9,5 @@ pub fn build(b: *std.Build) void { | ... | @@ -9,5 +9,5 @@ pub fn build(b: *std.Build) void { |
| 9 | }); | 9 | }); |
| 10 | test_exe.setMainPkgPath("."); | 10 | test_exe.setMainPkgPath("."); |
| 11 | 11 | ||
| 12 | test_step.dependOn(&test_exe.run().step); | 12 | test_step.dependOn(&b.addRunArtifact(test_exe).step); |
| 13 | } | 13 | } |
test/standalone/mix_o_files/build.zig+1-2| ... | @@ -25,7 +25,6 @@ pub fn build(b: *std.Build) void { | ... | @@ -25,7 +25,6 @@ pub fn build(b: *std.Build) void { |
| 25 | 25 | ||
| 26 | b.default_step.dependOn(&exe.step); | 26 | b.default_step.dependOn(&exe.step); |
| 27 | 27 | ||
| 28 | const run_cmd = exe.run(); | 28 | const run_cmd = b.addRunArtifact(exe); |
| 29 | |||
| 30 | test_step.dependOn(&run_cmd.step); | 29 | test_step.dependOn(&run_cmd.step); |
| 31 | } | 30 | } |
test/standalone/options/build.zig+1-1| ... | @@ -17,5 +17,5 @@ pub fn build(b: *std.Build) void { | ... | @@ -17,5 +17,5 @@ pub fn build(b: *std.Build) void { |
| 17 | options.addOption([]const u8, "string", b.option([]const u8, "string", "s").?); | 17 | options.addOption([]const u8, "string", b.option([]const u8, "string", "s").?); |
| 18 | 18 | ||
| 19 | const test_step = b.step("test", "Run unit tests"); | 19 | const test_step = b.step("test", "Run unit tests"); |
| 20 | test_step.dependOn(&main.run().step); | 20 | test_step.dependOn(&b.addRunArtifact(main).step); |
| 21 | } | 21 | } |
test/standalone/pie/build.zig+1-1| ... | @@ -17,7 +17,7 @@ pub fn build(b: *std.Build) void { | ... | @@ -17,7 +17,7 @@ pub fn build(b: *std.Build) void { |
| 17 | }); | 17 | }); |
| 18 | main.pie = true; | 18 | main.pie = true; |
| 19 | 19 | ||
| 20 | const run = main.run(); | 20 | const run = b.addRunArtifact(main); |
| 21 | run.skip_foreign_checks = true; | 21 | run.skip_foreign_checks = true; |
| 22 | 22 | ||
| 23 | test_step.dependOn(&run.step); | 23 | test_step.dependOn(&run.step); |
test/standalone/pkg_import/build.zig+1-2| ... | @@ -13,7 +13,6 @@ pub fn build(b: *std.Build) void { | ... | @@ -13,7 +13,6 @@ pub fn build(b: *std.Build) void { |
| 13 | }); | 13 | }); |
| 14 | exe.addAnonymousModule("my_pkg", .{ .source_file = .{ .path = "pkg.zig" } }); | 14 | exe.addAnonymousModule("my_pkg", .{ .source_file = .{ .path = "pkg.zig" } }); |
| 15 | 15 | ||
| 16 | const run = exe.run(); | 16 | const run = b.addRunArtifact(exe); |
| 17 | |||
| 18 | test_step.dependOn(&run.step); | 17 | test_step.dependOn(&run.step); |
| 19 | } | 18 | } |
test/standalone/shared_library/build.zig+1-2| ... | @@ -23,7 +23,6 @@ pub fn build(b: *std.Build) void { | ... | @@ -23,7 +23,6 @@ pub fn build(b: *std.Build) void { |
| 23 | exe.linkLibrary(lib); | 23 | exe.linkLibrary(lib); |
| 24 | exe.linkSystemLibrary("c"); | 24 | exe.linkSystemLibrary("c"); |
| 25 | 25 | ||
| 26 | const run_cmd = exe.run(); | 26 | const run_cmd = b.addRunArtifact(exe); |
| 27 | |||
| 28 | test_step.dependOn(&run_cmd.step); | 27 | test_step.dependOn(&run_cmd.step); |
| 29 | } | 28 | } |
test/standalone/static_c_lib/build.zig+1-1| ... | @@ -21,5 +21,5 @@ pub fn build(b: *std.Build) void { | ... | @@ -21,5 +21,5 @@ pub fn build(b: *std.Build) void { |
| 21 | test_exe.linkLibrary(foo); | 21 | test_exe.linkLibrary(foo); |
| 22 | test_exe.addIncludePath("."); | 22 | test_exe.addIncludePath("."); |
| 23 | 23 | ||
| 24 | test_step.dependOn(&test_exe.run().step); | 24 | test_step.dependOn(&b.addRunArtifact(test_exe).step); |
| 25 | } | 25 | } |
test/standalone/test_runner_module_imports/build.zig+1-1| ... | @@ -15,6 +15,6 @@ pub fn build(b: *std.Build) void { | ... | @@ -15,6 +15,6 @@ pub fn build(b: *std.Build) void { |
| 15 | t.addModule("module2", module2); | 15 | t.addModule("module2", module2); |
| 16 | 16 | ||
| 17 | const test_step = b.step("test", "Run unit tests"); | 17 | const test_step = b.step("test", "Run unit tests"); |
| 18 | test_step.dependOn(&t.run().step); | 18 | test_step.dependOn(&b.addRunArtifact(t).step); |
| 19 | b.default_step = test_step; | 19 | b.default_step = test_step; |
| 20 | } | 20 | } |
test/standalone/test_runner_path/build.zig+1-2| ... | @@ -11,7 +11,6 @@ pub fn build(b: *std.Build) void { | ... | @@ -11,7 +11,6 @@ pub fn build(b: *std.Build) void { |
| 11 | }); | 11 | }); |
| 12 | test_exe.test_runner = "test_runner.zig"; | 12 | test_exe.test_runner = "test_runner.zig"; |
| 13 | 13 | ||
| 14 | const test_run = test_exe.run(); | 14 | const test_run = b.addRunArtifact(test_exe); |
| 15 | |||
| 16 | test_step.dependOn(&test_run.step); | 15 | test_step.dependOn(&test_run.step); |
| 17 | } | 16 | } |
test/standalone/use_alias/build.zig+1-1| ... | @@ -12,5 +12,5 @@ pub fn build(b: *std.Build) void { | ... | @@ -12,5 +12,5 @@ pub fn build(b: *std.Build) void { |
| 12 | }); | 12 | }); |
| 13 | main.addIncludePath("."); | 13 | main.addIncludePath("."); |
| 14 | 14 | ||
| 15 | test_step.dependOn(&main.run().step); | 15 | test_step.dependOn(&b.addRunArtifact(main).step); |
| 16 | } | 16 | } |
test/tests.zig+4-3| ... | @@ -596,7 +596,8 @@ pub fn addStandaloneTests( | ... | @@ -596,7 +596,8 @@ pub fn addStandaloneTests( |
| 596 | }); | 596 | }); |
| 597 | if (case.link_libc) exe.linkLibC(); | 597 | if (case.link_libc) exe.linkLibC(); |
| 598 | 598 | ||
| 599 | step.dependOn(&exe.run().step); | 599 | const run = b.addRunArtifact(exe); |
| 600 | step.dependOn(&run.step); | ||
| 600 | } | 601 | } |
| 601 | } | 602 | } |
| 602 | } | 603 | } |
| ... | @@ -1004,7 +1005,7 @@ pub fn addModuleTests(b: *std.Build, options: ModuleTestOptions) *Step { | ... | @@ -1004,7 +1005,7 @@ pub fn addModuleTests(b: *std.Build, options: ModuleTestOptions) *Step { |
| 1004 | }, | 1005 | }, |
| 1005 | }; | 1006 | }; |
| 1006 | 1007 | ||
| 1007 | const run = these_tests.run(); | 1008 | const run = b.addRunArtifact(these_tests); |
| 1008 | run.skip_foreign_checks = true; | 1009 | run.skip_foreign_checks = true; |
| 1009 | run.setName(b.fmt("run test {s}-{s}-{s}-{s}-{s}-{s}", .{ | 1010 | run.setName(b.fmt("run test {s}-{s}-{s}-{s}-{s}-{s}", .{ |
| 1010 | options.name, | 1011 | options.name, |
| ... | @@ -1061,7 +1062,7 @@ pub fn addCAbiTests(b: *std.Build, skip_non_native: bool, skip_release: bool) *S | ... | @@ -1061,7 +1062,7 @@ pub fn addCAbiTests(b: *std.Build, skip_non_native: bool, skip_release: bool) *S |
| 1061 | triple_prefix, @tagName(optimize_mode), | 1062 | triple_prefix, @tagName(optimize_mode), |
| 1062 | })); | 1063 | })); |
| 1063 | 1064 | ||
| 1064 | const run = test_step.run(); | 1065 | const run = b.addRunArtifact(test_step); |
| 1065 | run.skip_foreign_checks = true; | 1066 | run.skip_foreign_checks = true; |
| 1066 | step.dependOn(&run.step); | 1067 | step.dependOn(&run.step); |
| 1067 | } | 1068 | } |