Run: add output directory arguments

This allows running commands that take an output directory argument. The
main thing that was needed for this feature was generated file subpaths,
to allow access to the files in a generated directory. Additionally, a
minor change was required to so that the correct directory is created
for output directory args.
This commit is contained in:
Jacob Young
2024-05-04 15:12:24 -04:00
parent e3424332d3
commit dee9f82f69
12 changed files with 272 additions and 119 deletions

View File

@@ -31,7 +31,7 @@ pub const File = struct {
contents: Contents,
pub fn getPath(file: *File) std.Build.LazyPath {
return .{ .generated = &file.generated_file };
return .{ .generated = .{ .file = &file.generated_file } };
}
};
@@ -58,7 +58,7 @@ pub const Directory = struct {
};
pub fn getPath(dir: *Directory) std.Build.LazyPath {
return .{ .generated = &dir.generated_dir };
return .{ .generated = .{ .file = &dir.generated_dir } };
}
};
@@ -181,7 +181,7 @@ pub fn addBytesToSource(write_file: *WriteFile, bytes: []const u8, sub_path: []c
/// Returns a `LazyPath` representing the base directory that contains all the
/// files from this `WriteFile`.
pub fn getDirectory(write_file: *WriteFile) std.Build.LazyPath {
return .{ .generated = &write_file.generated_directory };
return .{ .generated = .{ .file = &write_file.generated_directory } };
}
fn maybeUpdateName(write_file: *WriteFile) void {