authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2026-05-07 22:43:20-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2026-05-25 18:54:35-07:00
logf4ae918684975c191749edec26223b7dba7cd9ed
tree3dedf701d11a321bda422d31437470537fe7e7b2
parentecba6324bf47a68edf9c8d380f528088be68b5d7

configurer: implement serializing InstallDir


2 files changed, 27 insertions(+), 4 deletions(-)

lib/compiler/configurer.zig+22-1
...@@ -859,7 +859,28 @@ fn serialize(b: *std.Build, wc: *Configuration.Wip, writer: *Io.Writer) !void {...@@ -859,7 +859,28 @@ fn serialize(b: *std.Build, wc: *Configuration.Wip, writer: *Io.Writer) !void {
859 .dest_sub_path = try wc.addString(sif.dest_rel_path),859 .dest_sub_path = try wc.addString(sif.dest_rel_path),
860 })));860 })));
861 },861 },
862 .install_dir => @panic("TODO"),862 .install_dir => e: {
863 const sid: *Step.InstallDir = @fieldParentPtr("step", step);
864 const dest_sub_path: ?[]const u8 = if (sid.options.install_subdir.len != 0)
865 sid.options.install_subdir
866 else
867 null;
868 const include_extensions = sid.options.include_extensions orelse &.{};
869 break :e @enumFromInt(try wc.addExtra(@as(Configuration.Step.InstallDir, .{
870 .flags = .{
871 .dest_sub_path = dest_sub_path != null,
872 .exclude_extensions = sid.options.exclude_extensions.len != 0,
873 .include_extensions = include_extensions.len != 0,
874 .blank_extensions = sid.options.blank_extensions.len != 0,
875 },
876 .source_dir = try s.addLazyPath(sid.options.source_dir),
877 .dest_dir = try addInstallDir(wc, sid.options.install_dir),
878 .dest_sub_path = .{ .value = try s.addOptionalString(dest_sub_path) },
879 .exclude_extensions = .{ .slice = try s.initStringList(sid.options.exclude_extensions) },
880 .include_extensions = .{ .slice = try s.initStringList(include_extensions) },
881 .blank_extensions = .{ .slice = try s.initStringList(sid.options.blank_extensions) },
882 })));
883 },
863 .remove_dir => @panic("TODO"),884 .remove_dir => @panic("TODO"),
864 .fail => e: {885 .fail => e: {
865 const sf: *Step.Fail = @fieldParentPtr("step", step);886 const sf: *Step.Fail = @fieldParentPtr("step", step);
lib/std/Build/Configuration.zig+5-3
...@@ -210,9 +210,11 @@ pub const Wip = struct {...@@ -210,9 +210,11 @@ pub const Wip = struct {
210 }210 }
211211
212 pub fn addBytes(wip: *Wip, bytes: []const u8) Allocator.Error!Bytes {212 pub fn addBytes(wip: *Wip, bytes: []const u8) Allocator.Error!Bytes {
213 _ = wip;213 try wip.string_bytes.appendSlice(wip.gpa, bytes);
214 _ = bytes;214 return .{
215 @panic("TODO");215 .index = @intCast(wip.string_bytes.items.len - bytes.len),
216 .len = @intCast(bytes.len),
217 };
216 }218 }
217219
218 pub fn addSemVer(wip: *Wip, sv: std.SemanticVersion) Allocator.Error!String {220 pub fn addSemVer(wip: *Wip, sv: std.SemanticVersion) Allocator.Error!String {