aboutsummaryrefslogtreecommitdiff
path: root/lib/std/Build/Step/Run.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2023-07-29 23:57:52 -0700
committerAndrew Kelley <andrew@ziglang.org>2023-07-30 11:19:32 -0700
commit38840e2e586d71f2b38ed825ea02529f615c5f0c (patch)
tree5c31180307056823d2fc8a5aab73f094ad4d729d /lib/std/Build/Step/Run.zig
parentf8386de7ae12fca1e50e7920964fd7c47301fc05 (diff)
downloadzig-38840e2e586d71f2b38ed825ea02529f615c5f0c.tar.gz
zig-38840e2e586d71f2b38ed825ea02529f615c5f0c.zip
build system: follow-up enhancements regarding LazyPath
* introduce LazyPath.cwd_relative variant and use it for --zig-lib-dir. closes #12685 * move overrideZigLibDir and setMainPkgPath to options fields set once and then never mutated. * avoid introducing Build/util.zig * use doc comments for deprecation notices so that they show up in generated documentation. * introduce InstallArtifact.Options, accept it as a parameter to addInstallArtifact, and move override_dest_dir into it. Instead of configuring the installation via Compile step, configure the installation via the InstallArtifact step. In retrospect this is obvious. * remove calls to pushInstalledFile in InstallArtifact. See #14943 * rewrite InstallArtifact to not incorrectly observe whether a Compile step has any generated outputs. InstallArtifact is meant to trigger output generation. * fix child process evaluation code handling of `-fno-emit-bin`. * don't store out_h_filename, out_ll_filename, etc., pointlessly. these are all just simple extensions appended to the root name. * make emit_directory optional. It's possible to have nothing outputted, for example, if you're just type-checking. * avoid passing -femit-foo/-fno-emit-foo when it is the default * rename ConfigHeader.getTemplate to getOutput * deprecate addOptionArtifact * update the random number seed of Options step caching. * avoid using `inline for` pointlessly * avoid using `override_Dest_dir` pointlessly * avoid emitting an executable pointlessly in test cases Removes forceBuild and forceEmit. Let's consider these additions separately. Nearly all of the usage sites were suspicious.
Diffstat (limited to 'lib/std/Build/Step/Run.zig')
-rw-r--r--lib/std/Build/Step/Run.zig25
1 files changed, 13 insertions, 12 deletions
diff --git a/lib/std/Build/Step/Run.zig b/lib/std/Build/Step/Run.zig
index 55278e2d5b..1721e9dbc5 100644
--- a/lib/std/Build/Step/Run.zig
+++ b/lib/std/Build/Step/Run.zig
@@ -164,12 +164,9 @@ pub fn enableTestRunnerMode(self: *Run) void {
}
pub fn addArtifactArg(self: *Run, artifact: *Step.Compile) void {
- // enforce creation of the binary file by invoking getEmittedBin
const bin_file = artifact.getEmittedBin();
bin_file.addStepDependencies(&self.step);
-
self.argv.append(Arg{ .artifact = artifact }) catch @panic("OOM");
- self.step.dependOn(&artifact.step);
}
/// This provides file path as a command line argument to the command being
@@ -201,32 +198,36 @@ pub fn addPrefixedOutputFileArg(
return .{ .generated = &output.generated_file };
}
-pub const addFileSourceArg = addFileArg; // DEPRECATED, use addFileArg
+/// deprecated: use `addFileArg`
+pub const addFileSourceArg = addFileArg;
-pub fn addFileArg(self: *Run, file_source: std.Build.LazyPath) void {
- self.addPrefixedFileArg("", file_source);
+pub fn addFileArg(self: *Run, lp: std.Build.LazyPath) void {
+ self.addPrefixedFileArg("", lp);
}
-pub const addPrefixedFileSourceArg = addPrefixedFileArg; // DEPRECATED, use addPrefixedFileArg
+// deprecated: use `addPrefixedFileArg`
+pub const addPrefixedFileSourceArg = addPrefixedFileArg;
-pub fn addPrefixedFileArg(self: *Run, prefix: []const u8, file_source: std.Build.LazyPath) void {
+pub fn addPrefixedFileArg(self: *Run, prefix: []const u8, lp: std.Build.LazyPath) void {
const b = self.step.owner;
const prefixed_file_source: PrefixedLazyPath = .{
.prefix = b.dupe(prefix),
- .file_source = file_source.dupe(b),
+ .file_source = lp.dupe(b),
};
self.argv.append(.{ .file_source = prefixed_file_source }) catch @panic("OOM");
- file_source.addStepDependencies(&self.step);
+ lp.addStepDependencies(&self.step);
}
-pub const addDirectorySourceArg = addDirectoryArg; // DEPRECATED, use addDirectoryArg
+/// deprecated: use `addDirectoryArg`
+pub const addDirectorySourceArg = addDirectoryArg;
pub fn addDirectoryArg(self: *Run, directory_source: std.Build.LazyPath) void {
self.addPrefixedDirectoryArg("", directory_source);
}
-pub const addPrefixedDirectorySourceArg = addPrefixedDirectoryArg; // DEPRECATED, use addPrefixedDirectoryArg
+// deprecated: use `addPrefixedDirectoryArg`
+pub const addPrefixedDirectorySourceArg = addPrefixedDirectoryArg;
pub fn addPrefixedDirectoryArg(self: *Run, prefix: []const u8, directory_source: std.Build.LazyPath) void {
const b = self.step.owner;