aboutsummaryrefslogtreecommitdiff
path: root/lib/std/Build/Step/WriteFile.zig
diff options
context:
space:
mode:
authorFelix (xq) Queißner <git@random-projects.net>2023-07-19 10:49:34 +0200
committerAndrew Kelley <andrew@ziglang.org>2023-07-30 11:18:50 -0700
commitce95a3b153e9f3e83232e641c26a41e7dbd01165 (patch)
treed2bd5a15abfb77cbb8d79539767cdccbde1e79d3 /lib/std/Build/Step/WriteFile.zig
parent235e6ac05df95e5dc2656cfb1a33d7b18c45a603 (diff)
downloadzig-ce95a3b153e9f3e83232e641c26a41e7dbd01165.tar.gz
zig-ce95a3b153e9f3e83232e641c26a41e7dbd01165.zip
Build.zig rename orgy (aka: #16353). Renames FileSource to LazyPath and removes functions that take literal paths instead of LazyPath.
Diffstat (limited to 'lib/std/Build/Step/WriteFile.zig')
-rw-r--r--lib/std/Build/Step/WriteFile.zig24
1 files changed, 14 insertions, 10 deletions
diff --git a/lib/std/Build/Step/WriteFile.zig b/lib/std/Build/Step/WriteFile.zig
index 0448aa8d2a..f8fc606216 100644
--- a/lib/std/Build/Step/WriteFile.zig
+++ b/lib/std/Build/Step/WriteFile.zig
@@ -28,7 +28,9 @@ pub const File = struct {
sub_path: []const u8,
contents: Contents,
- pub fn getFileSource(self: *File) std.Build.FileSource {
+ pub const getFileSource = getPath; // DEPRECATED, use getPath
+
+ pub fn getPath(self: *File) std.Build.LazyPath {
return .{ .generated = &self.generated_file };
}
};
@@ -40,7 +42,7 @@ pub const OutputSourceFile = struct {
pub const Contents = union(enum) {
bytes: []const u8,
- copy: std.Build.FileSource,
+ copy: std.Build.LazyPath,
};
pub fn create(owner: *std.Build) *WriteFile {
@@ -59,7 +61,7 @@ pub fn create(owner: *std.Build) *WriteFile {
return wf;
}
-pub fn add(wf: *WriteFile, sub_path: []const u8, bytes: []const u8) std.Build.FileSource {
+pub fn add(wf: *WriteFile, sub_path: []const u8, bytes: []const u8) std.Build.LazyPath {
const b = wf.step.owner;
const gpa = b.allocator;
const file = gpa.create(File) catch @panic("OOM");
@@ -70,7 +72,7 @@ pub fn add(wf: *WriteFile, sub_path: []const u8, bytes: []const u8) std.Build.Fi
};
wf.files.append(gpa, file) catch @panic("OOM");
wf.maybeUpdateName();
- return file.getFileSource();
+ return file.getPath();
}
/// Place the file into the generated directory within the local cache,
@@ -80,7 +82,7 @@ pub fn add(wf: *WriteFile, sub_path: []const u8, bytes: []const u8) std.Build.Fi
/// include sub-directories, in which case this step will ensure the
/// required sub-path exists.
/// This is the option expected to be used most commonly with `addCopyFile`.
-pub fn addCopyFile(wf: *WriteFile, source: std.Build.FileSource, sub_path: []const u8) std.Build.FileSource {
+pub fn addCopyFile(wf: *WriteFile, source: std.Build.LazyPath, sub_path: []const u8) std.Build.LazyPath {
const b = wf.step.owner;
const gpa = b.allocator;
const file = gpa.create(File) catch @panic("OOM");
@@ -93,7 +95,7 @@ pub fn addCopyFile(wf: *WriteFile, source: std.Build.FileSource, sub_path: []con
wf.maybeUpdateName();
source.addStepDependencies(&wf.step);
- return file.getFileSource();
+ return file.getLazyPath();
}
/// A path relative to the package root.
@@ -101,7 +103,7 @@ pub fn addCopyFile(wf: *WriteFile, source: std.Build.FileSource, sub_path: []con
/// used as part of the normal build process, but as a utility occasionally
/// run by a developer with intent to modify source files and then commit
/// those changes to version control.
-pub fn addCopyFileToSource(wf: *WriteFile, source: std.Build.FileSource, sub_path: []const u8) void {
+pub fn addCopyFileToSource(wf: *WriteFile, source: std.Build.LazyPath, sub_path: []const u8) void {
const b = wf.step.owner;
wf.output_source_files.append(b.allocator, .{
.contents = .{ .copy = source },
@@ -123,11 +125,13 @@ pub fn addBytesToSource(wf: *WriteFile, bytes: []const u8, sub_path: []const u8)
}) catch @panic("OOM");
}
-pub const getFileSource = @compileError("Deprecated; use the return value from add()/addCopyFile(), or use files[i].getFileSource()");
+pub const getFileSource = @compileError("Deprecated; use the return value from add()/addCopyFile(), or use files[i].getPath()");
+
+pub const getDirectorySource = getDirectory;
-/// Returns a `FileSource` representing the base directory that contains all the
+/// Returns a `LazyPath` representing the base directory that contains all the
/// files from this `WriteFile`.
-pub fn getDirectorySource(wf: *WriteFile) std.Build.FileSource {
+pub fn getDirectory(wf: *WriteFile) std.Build.LazyPath {
return .{ .generated = &wf.generated_directory };
}