-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Closed
Labels
breakingImplementing this issue could cause existing code to no longer compile or have different behavior.Implementing this issue could cause existing code to no longer compile or have different behavior.contributor friendlyThis issue is limited in scope and/or knowledge of Zig internals.This issue is limited in scope and/or knowledge of Zig internals.zig build systemstd.Build, the build runner, `zig build` subcommand, package managementstd.Build, the build runner, `zig build` subcommand, package management
Milestone
Description
Extracted from #14647.
zig/lib/std/Build/CheckObjectStep.zig
Lines 45 to 59 in 68c7261
/// Runs and (optionally) compares the output of a binary. | |
/// Asserts `self` was generated from an executable step. | |
/// TODO this doesn't actually compare, and there's no apparent reason for it | |
/// to depend on the check object step. I don't see why this function should exist, | |
/// the caller could just add the run step directly. | |
pub fn runAndCompare(self: *CheckObjectStep) *std.Build.RunStep { | |
const dependencies_len = self.step.dependencies.items.len; | |
assert(dependencies_len > 0); | |
const exe_step = self.step.dependencies.items[dependencies_len - 1]; | |
const exe = exe_step.cast(std.Build.CompileStep).?; | |
const run = self.step.owner.addRunArtifact(exe); | |
run.skip_foreign_checks = true; | |
run.step.dependOn(&self.step); | |
return run; | |
} |
[nix-shell:~/dev/zig/build-release]$ grep -RI runAndCompare ../test/
../test/link/macho/weak_library/build.zig: const run_cmd = check.runAndCompare();
../test/link/macho/entry/build.zig: const run = check_exe.runAndCompare();
../test/link/macho/dylib/build.zig: const run = check_exe.runAndCompare();
../test/link/macho/strict_validation/build.zig: const run = check_exe.runAndCompare();
../test/link/macho/unwind_info/build.zig: const run_cmd = check.runAndCompare();
../test/link/macho/stack_size/build.zig: const run = check_exe.runAndCompare();
../test/link/macho/needed_library/build.zig: const run_cmd = check.runAndCompare();
../test/link/macho/search_strategy/build.zig: const run = check.runAndCompare();
../test/link/macho/dead_strip/build.zig: const run_cmd = check.runAndCompare();
../test/link/macho/dead_strip/build.zig: const run_cmd = check.runAndCompare();
Metadata
Metadata
Assignees
Labels
breakingImplementing this issue could cause existing code to no longer compile or have different behavior.Implementing this issue could cause existing code to no longer compile or have different behavior.contributor friendlyThis issue is limited in scope and/or knowledge of Zig internals.This issue is limited in scope and/or knowledge of Zig internals.zig build systemstd.Build, the build runner, `zig build` subcommand, package managementstd.Build, the build runner, `zig build` subcommand, package management