addPrefixedFileArg
Appends an input file to the command line arguments prepended with a string.
For example, a prefix of "-F" will result in the child process seeing something like this: "-Fexample.txt"
The child process will see a single argument, even if the prefix has spaces. Modifications to this file will be detected as a cache miss in subsequent builds, causing the child process to be re-executed.
Related:
addFileArg- same thing but without the prefixaddOutputFileArg- for files generated by the child process
Function parameters
Parameters
- run:*Run
- prefix:[]const u8
- lp:std.Build.LazyPath
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 addPrefixedFileArg(run: *Run, prefix: []const u8, lp: std.Build.LazyPath) void {
const b = run.step.owner;
const prefixed_file_source: PrefixedLazyPath = .{
.prefix = b.dupe(prefix),
.lazy_path = lp.dupe(b),
};
run.argv.append(b.allocator, .{ .lazy_path = prefixed_file_source }) catch @panic("OOM");
lp.addStepDependencies(&run.step);
}