addPrefixedOutputDirectoryArg
Provides a directory path as a command line argument to the command being run.
Asserts basename is not empty.
For example, a prefix of "-o" and basename of "output_dir" will result in the child process seeing something like this: "-ozig-cache/.../output_dir"
The child process will see a single argument, regardless of whether the prefix or basename have spaces.
The returned std.Build.LazyPath can be used as inputs to other APIs
throughout the build system.
Related:
addOutputDirectoryArg- same thing but without the prefixaddDirectoryArg- for input directories given to the child process
Function parameters
Parameters
- run:*Run
- prefix:[]const u8
- basename:[]const u8
Type definitions in this namespace
Types
Functions in this namespace
Functions
- addOutputFileArg
- Provides a file path as a command line argument to the command being run.
- addPrefixedOutputFileArg
- Provides a file path as a command line argument to the command being run.
- addFileArg
- Appends an input file to the command line arguments.
- addPrefixedFileArg
- Appends an input file to the command line arguments prepended with a string.
- addOutputDirectoryArg
- Provides a directory path as a command line argument to the command being run.
- addPrefixedOutputDirectoryArg
- Provides a directory path as a command line argument to the command being run.
- addDepFileOutputArg
- Add a path argument to a dep file (.d) for the child process to write its
- addPrefixedDepFileOutputArg
- Add a prefixed path argument to a dep file (.d) for the child process to
- expectStdErrEqual
- Adds a check for exact stderr match.
- expectStdOutEqual
- Adds a check for exact stdout match as well as a check for exit code 0, if
- addFileInput
- Adds an additional input files that, when modified, indicates that this Run
= .run
Values
- base_id
- = .run
Source
Implementation
pub fn addPrefixedOutputDirectoryArg(
run: *Run,
prefix: []const u8,
basename: []const u8,
) std.Build.LazyPath {
if (basename.len == 0) @panic("basename must not be empty");
const b = run.step.owner;
const output = b.allocator.create(Output) catch @panic("OOM");
output.* = .{
.prefix = b.dupe(prefix),
.basename = b.dupe(basename),
.generated_file = .{ .step = &run.step },
};
run.argv.append(b.allocator, .{ .output_directory = output }) catch @panic("OOM");
if (run.rename_step_with_output_arg) {
run.setName(b.fmt("{s} ({s})", .{ run.step.name, basename }));
}
return .{ .generated = .{ .file = &output.generated_file } };
}