aboutsummaryrefslogtreecommitdiff
path: root/lib/std/Build/Module.zig
diff options
context:
space:
mode:
authorJacob Young <jacobly0@users.noreply.github.com>2024-05-04 14:29:17 -0400
committerJacob Young <jacobly0@users.noreply.github.com>2024-05-05 09:42:51 -0400
commite3424332d3fa1264e1f6861b76bb0d1b2996728d (patch)
tree2d786805328dd51b8d8e804ab6b655fc398d2f3f /lib/std/Build/Module.zig
parentd582575aba5264aaa02a8af0cdb7da7c4f4c6220 (diff)
downloadzig-e3424332d3fa1264e1f6861b76bb0d1b2996728d.tar.gz
zig-e3424332d3fa1264e1f6861b76bb0d1b2996728d.zip
Build: cleanup
* `doc/langref` formatting * upgrade `.{ .path = "..." }` to `b.path("...")` * avoid using arguments named `self` * make `Build.Step.Id` usage more consistent * add `Build.pathResolve` * use `pathJoin` and `pathResolve` everywhere * make sure `Build.LazyPath.getPath2` returns an absolute path
Diffstat (limited to 'lib/std/Build/Module.zig')
-rw-r--r--lib/std/Build/Module.zig31
1 files changed, 13 insertions, 18 deletions
diff --git a/lib/std/Build/Module.zig b/lib/std/Build/Module.zig
index a142bbd405..a5163b13af 100644
--- a/lib/std/Build/Module.zig
+++ b/lib/std/Build/Module.zig
@@ -89,10 +89,10 @@ pub const CSourceFile = struct {
file: LazyPath,
flags: []const []const u8 = &.{},
- pub fn dupe(self: CSourceFile, b: *std.Build) CSourceFile {
+ pub fn dupe(file: CSourceFile, b: *std.Build) CSourceFile {
return .{
- .file = self.file.dupe(b),
- .flags = b.dupeStrings(self.flags),
+ .file = file.file.dupe(b),
+ .flags = b.dupeStrings(file.flags),
};
}
};
@@ -115,12 +115,12 @@ pub const RcSourceFile = struct {
/// as `/I <resolved path>`.
include_paths: []const LazyPath = &.{},
- pub fn dupe(self: RcSourceFile, b: *std.Build) RcSourceFile {
- const include_paths = b.allocator.alloc(LazyPath, self.include_paths.len) catch @panic("OOM");
- for (include_paths, self.include_paths) |*dest, lazy_path| dest.* = lazy_path.dupe(b);
+ pub fn dupe(file: RcSourceFile, b: *std.Build) RcSourceFile {
+ const include_paths = b.allocator.alloc(LazyPath, file.include_paths.len) catch @panic("OOM");
+ for (include_paths, file.include_paths) |*dest, lazy_path| dest.* = lazy_path.dupe(b);
return .{
- .file = self.file.dupe(b),
- .flags = b.dupeStrings(self.flags),
+ .file = file.file.dupe(b),
+ .flags = b.dupeStrings(file.flags),
.include_paths = include_paths,
};
}
@@ -665,24 +665,19 @@ pub fn appendZigProcessFlags(
for (m.include_dirs.items) |include_dir| {
switch (include_dir) {
.path => |include_path| {
- try zig_args.append("-I");
- try zig_args.append(include_path.getPath(b));
+ try zig_args.appendSlice(&.{ "-I", include_path.getPath2(b, asking_step) });
},
.path_system => |include_path| {
- try zig_args.append("-isystem");
- try zig_args.append(include_path.getPath(b));
+ try zig_args.appendSlice(&.{ "-isystem", include_path.getPath2(b, asking_step) });
},
.path_after => |include_path| {
- try zig_args.append("-idirafter");
- try zig_args.append(include_path.getPath(b));
+ try zig_args.appendSlice(&.{ "-idirafter", include_path.getPath2(b, asking_step) });
},
.framework_path => |include_path| {
- try zig_args.append("-F");
- try zig_args.append(include_path.getPath2(b, asking_step));
+ try zig_args.appendSlice(&.{ "-F", include_path.getPath2(b, asking_step) });
},
.framework_path_system => |include_path| {
- try zig_args.append("-iframework");
- try zig_args.append(include_path.getPath2(b, asking_step));
+ try zig_args.appendSlice(&.{ "-iframework", include_path.getPath2(b, asking_step) });
},
.other_step => |other| {
if (other.generated_h) |header| {