authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2026-08-14 01:24:55-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2026-08-14 12:40:19+02:00
log5d7cf3f34d13f70de35c2f76db2e44073e6de64e
treed8ad73215c06b09644c20ed7ecadf9431c850040
parente61d80414204d8b3d41c0a4c48b7935e269eadd8

zig build: revert package related changes to Configuration

partial revert of 8e48a5c524f970c4630725e2efe69243d8d79fde partial revert of 8380531aecf20405bad6e008712a39795f224cb3 fixes regression in the build system causing crash when trying to build ffmpeg project from the ecosystem. upon closer inspection, I don't think this is the right direction for adding this data to Configuration. Let's try again and be a little more careful about it.

4 files changed, 37 insertions(+), 325 deletions(-)

lib/compiler/Maker.zig+5-6
......@@ -2293,7 +2293,7 @@ fn prepare(
22932293 }
22942294 } else {
22952295 log.err("{s}{s}: this step declares an upper bound of {d} bytes of memory, exceeding the available {d} bytes of memory", .{
2296 conf_step.owner.package(c).depPrefixSlice(c),
2296 conf_step.owner.depPrefixSlice(c),
22972297 conf_step.name.slice(c),
22982298 max_rss,
22992299 maker.available_rss,
......@@ -3388,13 +3388,12 @@ pub fn generatedPath(maker: *const Maker, index: Configuration.GeneratedFileInde
33883388pub fn packagePath(
33893389 maker: *const Maker,
33903390 arena: Allocator,
3391 inst_index: Configuration.Package.Instance.Index,
3391 package_index: Configuration.Package.Index,
33923392 sub_path: []const u8,
33933393) Allocator.Error!Path {
33943394 const c = &maker.scanned_config.configuration;
33953395 const graph = maker.graph;
3396
3397 if (inst_index == .root) return .{
3396 const package = package_index.get(c) orelse return .{
33983397 .root_dir = graph.build_root_directory,
33993398 .sub_path = sub_path,
34003399 };
......@@ -3405,7 +3404,7 @@ pub fn packagePath(
34053404 // construct a cwd relative path here.
34063405 return .{
34073406 .root_dir = .cwd(),
3408 .sub_path = try Dir.path.join(arena, &.{ inst_index.package(c).ptr(c).root_path.slice(c), sub_path }),
3407 .sub_path = try Dir.path.join(arena, &.{ package.root_path.slice(c), sub_path }),
34093408 };
34103409}
34113410
......@@ -4035,7 +4034,7 @@ fn confPathDepToCachePath(
40354034 .root_dir = graph.build_root_directory,
40364035 .sub_path = switch (path_dep.pkg.unwrap().?) {
40374036 .root => sub_path,
4038 else => |index| try Dir.path.join(arena, &.{ index.package(c).ptr(c).root_path.slice(c), sub_path }),
4037 else => |index| try Dir.path.join(arena, &.{ index.get(c).?.root_path.slice(c), sub_path }),
40394038 },
40404039 },
40414040 .zig_lib => .{
lib/compiler/Maker/ScannedConfig.zig-45
......@@ -83,51 +83,6 @@ pub fn print(sc: *const ScannedConfig, w: *Writer) Writer.Error!void {
8383 try tf.end();
8484 }
8585
86 {
87 var tf = try s.beginTupleField("packages", .{});
88 for (c.packages) |package| {
89 var sf = try tf.beginStructField(.{});
90 try sf.field("dep_prefix", package.dep_prefix.slice(c), .{});
91 try sf.field("hash", package.hash.slice(c), .{});
92 try sf.field("root_path", package.root_path.slice(c), .{});
93
94 var dtf = try sf.beginTupleField("deps", .{});
95 for (package.deps.slice(c)) |dep| {
96 var dsf = try dtf.beginStructField(.{});
97 try sc.printStruct(&dsf, Configuration.Package.Dep, dep);
98 try dsf.end();
99 }
100 try dtf.end();
101
102 try sf.end();
103 }
104 try tf.end();
105 }
106
107 {
108 var tf = try s.beginTupleField("package_instances", .{});
109 for (c.package_instances) |inst| {
110 var sf = try tf.beginStructField(.{});
111
112 try sf.fieldPrefix("package");
113 if (std.enums.tagName(Configuration.Package.Index, inst.package)) |name| {
114 try sf.container.serializer.ident(name);
115 } else {
116 try sf.container.serializer.int(@backingInt(inst.package));
117 }
118
119 var msf = try sf.beginStructField("modules", .{});
120 for (inst.modules.keys.slice(c), inst.modules.values.slice(c)) |key, value| {
121 var msf2 = try msf.beginStructField(key.slice(c), .{});
122 try sc.printStruct(&msf2, Configuration.Module, value.get(c));
123 try msf2.end();
124 }
125 try msf.end();
126
127 try sf.end();
128 }
129 }
130
13186 try s.end();
13287}
13388
lib/std/Build/Configuration.zig+14-115
......@@ -15,14 +15,6 @@ unlazy_deps: []String,
1515system_integrations: []SystemIntegration,
1616available_options: []AvailableOption,
1717search_prefixes: []String,
18/// Index 0 always exists and is the root package.
19packages: []Package,
20/// Index 0 always exists and is the root package instance.
21///
22/// Unlike `packages`, each item corresponds to a `std.Build`, which is a
23/// package that was instantiated by running its build script with specific
24/// input options.
25package_instances: []Package.Instance,
2618extra: []u32,
2719default_step: Step.Index,
2820generated_files_len: u32,
......@@ -38,8 +30,6 @@ pub const Header = extern struct {
3830 system_integrations_len: u32,
3931 available_options_len: u32,
4032 search_prefixes_len: u32,
41 packages_len: u32,
42 package_instances_len: u32,
4333 extra_len: u32,
4434
4535 default_step: Step.Index,
......@@ -68,8 +58,6 @@ pub const Wip = struct {
6858 steps: std.ArrayList(Step) = .empty,
6959 path_deps: std.ArrayList(PathDep) = .empty,
7060 search_prefixes: std.ArrayList(String) = .empty,
71 packages: std.ArrayList(Package) = .empty,
72 package_instances: std.ArrayList(Package.Instance) = .empty,
7361 extra: std.ArrayList(u32) = .empty,
7462 next_generated_file_index: u32 = 0,
7563 cache_poison: bool = false,
......@@ -151,8 +139,6 @@ pub const Wip = struct {
151139 wip.steps.deinit(gpa);
152140 wip.path_deps.deinit(gpa);
153141 wip.search_prefixes.deinit(gpa);
154 wip.packages.deinit(gpa);
155 wip.package_instances.deinit(gpa);
156142 wip.extra.deinit(gpa);
157143 wip.* = undefined;
158144 }
......@@ -172,8 +158,6 @@ pub const Wip = struct {
172158 .system_integrations_len = @intCast(wip.system_integrations.items.len),
173159 .available_options_len = @intCast(wip.available_options.items.len),
174160 .search_prefixes_len = @intCast(wip.search_prefixes.items.len),
175 .packages_len = @intCast(wip.packages.items.len),
176 .package_instances_len = @intCast(wip.package_instances.items.len),
177161 .extra_len = @intCast(wip.extra.items.len),
178162
179163 .default_step = static.default_step,
......@@ -191,8 +175,6 @@ pub const Wip = struct {
191175 @ptrCast(wip.system_integrations.items),
192176 @ptrCast(wip.available_options.items),
193177 @ptrCast(wip.search_prefixes.items),
194 @ptrCast(wip.packages.items),
195 @ptrCast(wip.package_instances.items),
196178 @ptrCast(wip.extra.items),
197179 };
198180 try w.writeVecAll(&buffers);
......@@ -494,7 +476,7 @@ pub const AvailableOption = extern struct {
494476
495477pub const Step = extern struct {
496478 name: String,
497 owner: Package.Instance.Index,
479 owner: Package.Index,
498480 deps: Deps.Index,
499481 max_rss: MaxRss,
500482 extended: Storage.Extended(Flags, union(Tag) {
......@@ -1543,7 +1525,7 @@ pub const LazyPath = union(@This().Tag) {
15431525
15441526 pub const SourcePath = struct {
15451527 flags: @This().Flags = .{},
1546 owner: Package.Instance.Index,
1528 owner: Package.Index,
15471529 sub_path: String,
15481530
15491531 pub const Flags = packed struct(u32) {
......@@ -1614,28 +1596,30 @@ pub const OptionalGeneratedFileIndex = enum(u32) {
16141596 }
16151597};
16161598
1617pub const Package = extern struct {
1599pub const Package = struct {
16181600 dep_prefix: String,
16191601 hash: String,
16201602 root_path: String,
1621 deps: Dep.List.Index,
16221603
16231604 pub const Index = enum(u32) {
1624 root,
1605 root = max_u32,
16251606 _,
16261607
1627 pub fn ptr(i: @This(), c: *const Configuration) *const Package {
1628 return &c.packages[@backingInt(i)];
1608 /// Returns `null` for root package.
1609 pub fn get(i: @This(), c: *const Configuration) ?Package {
1610 if (i == .root) return null;
1611 return extraData(c, Package, @backingInt(i));
16291612 }
16301613
16311614 pub fn depPrefixSlice(i: @This(), c: *const Configuration) [:0]const u8 {
1632 return ptr(i, c).dep_prefix.slice(c);
1615 const package = get(i, c) orelse return "";
1616 return package.dep_prefix.slice(c);
16331617 }
16341618 };
16351619
16361620 pub const OptionalIndex = enum(u32) {
1637 root,
1638 none = max_u32,
1621 none = max_u32 - 1,
1622 root = max_u32,
16391623 _,
16401624
16411625 pub fn init(i: Index) OptionalIndex {
......@@ -1652,78 +1636,13 @@ pub const Package = extern struct {
16521636 };
16531637 }
16541638 };
1655
1656 pub const Dep = extern struct {
1657 name: String,
1658 /// Must not be `.root`.
1659 package: Package.Index,
1660
1661 pub const List = struct {
1662 deps: Storage.LengthPrefixedList(Dep),
1663
1664 pub const Index = enum(u32) {
1665 _,
1666
1667 pub fn get(this: @This(), c: *const Configuration) List {
1668 return extraData(c, List, @backingInt(this));
1669 }
1670
1671 pub fn slice(this: @This(), c: *const Configuration) []const Dep {
1672 return get(this, c).deps.slice;
1673 }
1674 };
1675 };
1676 };
1677
1678 pub const Instance = extern struct {
1679 package: Package.Index,
1680 modules: PublicModules,
1681
1682 pub const PublicModules = extern struct {
1683 keys: StringList,
1684 values: Module.List.Index,
1685 };
1686
1687 pub const Index = enum(u32) {
1688 root,
1689 _,
1690
1691 pub fn ptr(this: @This(), c: *const Configuration) *const Package.Instance {
1692 return &c.package_instances[@backingInt(this)];
1693 }
1694
1695 pub fn package(this: @This(), c: *const Configuration) Package.Index {
1696 return this.ptr(c).package;
1697 }
1698 };
1699
1700 pub const OptionalIndex = enum(u32) {
1701 root,
1702 none = max_u32,
1703 _,
1704
1705 pub fn init(i: Instance.Index) Instance.OptionalIndex {
1706 const result: Instance.OptionalIndex = @fromBackingInt(@intCast(@backingInt(i)));
1707 assert(result != .none);
1708 return result;
1709 }
1710
1711 pub fn unwrap(this: @This()) ?Instance.Index {
1712 return switch (this) {
1713 .none => null,
1714 .root => .root,
1715 _ => @fromBackingInt(@intCast(@backingInt(this))),
1716 };
1717 }
1718 };
1719 };
17201639};
17211640
17221641pub const Module = struct {
17231642 flags: Flags,
17241643 flags2: Flags2,
17251644 import_table: ImportTable.Index,
1726 owner: Package.Instance.Index,
1645 owner: Package.Index,
17271646 root_source_file: LazyPath.OptionalIndex,
17281647 resolved_target: ResolvedTarget.OptionalIndex,
17291648 c_macros: Storage.FlagLengthPrefixedList(.flags, .c_macros, String),
......@@ -1866,22 +1785,6 @@ pub const Module = struct {
18661785 };
18671786
18681787 pub const Index = IndexType(@This());
1869
1870 pub const List = struct {
1871 modules: Storage.LengthPrefixedList(Module.Index),
1872
1873 pub const Index = enum(u32) {
1874 _,
1875
1876 pub fn get(this: @This(), c: *const Configuration) List {
1877 return extraData(c, List, @backingInt(this));
1878 }
1879
1880 pub fn slice(this: @This(), c: *const Configuration) []const Module.Index {
1881 return this.get(c).modules.slice;
1882 }
1883 };
1884 };
18851788};
18861789
18871790pub const ImportTable = struct {
......@@ -1966,7 +1869,7 @@ pub const OptionalStringList = enum(u32) {
19661869pub const PathDep = extern struct {
19671870 flags: Flags,
19681871 sub: String,
1969 pkg: Package.Instance.OptionalIndex,
1872 pkg: Package.OptionalIndex,
19701873
19711874 pub const Flags = packed struct(u32) {
19721875 mode: Mode,
......@@ -3231,8 +3134,6 @@ pub fn load(arena: Allocator, reader: *Io.Reader) LoadError!Configuration {
32313134 .system_integrations = try arena.alloc(SystemIntegration, header.system_integrations_len),
32323135 .available_options = try arena.alloc(AvailableOption, header.available_options_len),
32333136 .search_prefixes = try arena.alloc(String, header.search_prefixes_len),
3234 .packages = try arena.alloc(Package, header.packages_len),
3235 .package_instances = try arena.alloc(Package.Instance, header.package_instances_len),
32363137 .extra = try arena.alloc(u32, header.extra_len),
32373138 .default_step = header.default_step,
32383139 .generated_files_len = header.generated_files_len,
......@@ -3246,8 +3147,6 @@ pub fn load(arena: Allocator, reader: *Io.Reader) LoadError!Configuration {
32463147 @ptrCast(result.system_integrations),
32473148 @ptrCast(result.available_options),
32483149 @ptrCast(result.search_prefixes),
3249 @ptrCast(result.packages),
3250 @ptrCast(result.package_instances),
32513150 @ptrCast(result.extra),
32523151 };
32533152 try reader.readVecAll(&vecs);
lib/std/Build/Serialize.zig+18-159
......@@ -10,10 +10,7 @@ const log = std.log;
1010arena: Allocator,
1111wc: *Configuration.Wip,
1212module_map: std.array_hash_map.Auto(*std.Build.Module, Configuration.Module.Index) = .empty,
13/// Keyed by package hash. Index + 1 corresponds to `Configuration.packages` index.
14package_map: std.array_hash_map.String(void) = .empty,
15/// Index corresponds to `Configuration.package_instances` index.
16package_instance_map: std.array_hash_map.Auto(*std.Build, void) = .empty,
13package_map: std.array_hash_map.Auto(*std.Build, Configuration.Package.Index) = .empty,
1714/// Index corresponds to `Configuration.steps` index.
1815step_map: std.array_hash_map.Auto(*Step, void) = .empty,
1916
......@@ -24,31 +21,6 @@ pub fn write(b: *std.Build, wc: *Configuration.Wip, writer: *std.Io.Writer) !voi
2421
2522 var s: Serialize = .{ .wc = wc, .arena = arena };
2623
27 // Seed the package_map, which is later used when serializing package
28 // instances.
29 try s.traversePackages(b);
30
31 // Next, seed the package_instance_map, which is later used in calls to
32 // packageInstanceFromBuilder.
33
34 _ = try wc.package_instances.addManyAsSlice(gpa, 1 + b.graph.dependency_cache.count());
35 try s.package_instance_map.ensureTotalCapacity(arena, 1 + b.graph.dependency_cache.count());
36
37 // As serializing package instances also requires serializing the public
38 // modules of each one, we must first allocate an index for each package
39 // instance. Otherwise, addModule may access a package instance that hasn't
40 // been created yet with packageInstanceFromBuilder.
41
42 s.package_instance_map.putAssumeCapacityNoClobber(b, {});
43 for (b.graph.dependency_cache.values()) |dep| {
44 s.package_instance_map.putAssumeCapacityNoClobber(dep.builder, {});
45 }
46
47 try s.addPackageInstance(b);
48 for (b.graph.dependency_cache.values()) |dep| {
49 try s.addPackageInstance(dep.builder);
50 }
51
5224 try wc.path_deps.ensureTotalCapacityPrecise(gpa, graph.configure_dependencies.items.len);
5325 for (
5426 graph.configure_dependencies.items,
......@@ -72,10 +44,10 @@ pub fn write(b: *std.Build, wc: *Configuration.Wip, writer: *std.Io.Writer) !voi
7244 .relative => |r| try wc.addString(r.sub_path),
7345 },
7446 .pkg = switch (src.lazy_path) {
75 .src_path => |sp| .init(s.packageInstanceFromBuilder(sp.owner)),
47 .src_path => |sp| .init(try s.builderToPackage(sp.owner)),
7648 .generated => unreachable,
7749 .cwd_relative, .relative => .none,
78 .dependency => |d| .init(s.packageInstanceFromBuilder(d.dependency.builder)),
50 .dependency => |d| .init(try s.builderToPackage(d.dependency.builder)),
7951 },
8052 };
8153 }
......@@ -112,7 +84,7 @@ pub fn write(b: *std.Build, wc: *Configuration.Wip, writer: *std.Io.Writer) !voi
11284 try wc.steps.ensureTotalCapacity(gpa, s.step_map.entries.capacity);
11385 wc.steps.appendAssumeCapacity(.{
11486 .name = try wc.addString(step.name),
115 .owner = s.packageInstanceFromBuilder(step.owner),
87 .owner = try s.builderToPackage(step.owner),
11688 .deps = deps,
11789 .max_rss = .fromBytes(step.max_rss),
11890 .extended = @fromBackingInt(@intCast(switch (step.tag) {
......@@ -750,132 +722,19 @@ pub fn packageOptions(b: *std.Build, wc: *Configuration.Wip) Allocator.Error!voi
750722 }
751723}
752724
753fn traversePackages(s: *Serialize, b: *std.Build) Allocator.Error!void {
754 const arena = s.arena;
755 const wc = s.wc;
756
757 try wc.packages.append(wc.gpa, .{
758 .dep_prefix = .empty,
759 .hash = .empty,
760 .root_path = try wc.addString(try b.root.toString(arena)),
761 .deps = undefined,
762 });
763
764 const deps = try arena.alloc(Configuration.Package.Dep, b.available_deps.len);
765 for (deps, b.available_deps) |*dest, src| dest.* = try s.makePackageDep("", src[0], src[1]);
766
767 wc.packages.items[0].deps = try wc.addDeduped(Configuration.Package.Dep.List, .{
768 .deps = .{ .slice = deps },
769 });
770}
771
772fn makePackageDep(s: *Serialize, parent_dep_prefix: []const u8, name: []const u8, hash: []const u8) Allocator.Error!Configuration.Package.Dep {
773 const arena = s.arena;
774 const wc = s.wc;
775
776 if (s.package_map.getIndex(hash)) |index| return .{
777 .name = try wc.addString(name),
778 .package = @fromBackingInt(@intCast(index + 1)),
779 };
780
781 const index: Configuration.Package.Index = @fromBackingInt(@intCast(wc.packages.items.len));
782 try s.package_map.put(arena, hash, {});
783
784 const entry = std.Build.package_map.get(hash) orelse unreachable;
785
786 const dep_prefix = try arena.print("{s}{s}.", .{ parent_dep_prefix, name });
787
788 try wc.packages.append(wc.gpa, .{
789 .dep_prefix = try wc.addString(dep_prefix),
790 .hash = try wc.addString(hash),
791 .root_path = try wc.addString(entry.build_root),
792 .deps = undefined,
793 });
794
795 const deps = try arena.alloc(Configuration.Package.Dep, entry.deps.len);
796 for (deps, entry.deps) |*dest, src| dest.* = try s.makePackageDep(dep_prefix, src[0], src[1]);
797
798 wc.packages.items[@backingInt(index)].deps = try wc.addDeduped(Configuration.Package.Dep.List, .{
799 .deps = .{ .slice = deps },
800 });
801
802 return .{
803 .name = try wc.addString(name),
804 .package = index,
805 };
806}
807
808fn packageFromHash(s: *Serialize, pkg_hash: []const u8) Configuration.Package.Index {
809 if (pkg_hash.len == 0) return .root;
810 return @fromBackingInt(@intCast(s.package_map.getIndex(pkg_hash).? + 1));
811}
812
813fn addPackageInstance(s: *Serialize, b: *std.Build) Allocator.Error!void {
725fn builderToPackage(s: *Serialize, b: *std.Build) !Configuration.Package.Index {
726 if (b.pkg_hash.len == 0) return .root;
814727 const arena = s.arena;
815728 const wc = s.wc;
816
817 const index = s.package_instance_map.getIndex(b).?;
818
819 const modules_values = try arena.alloc(Configuration.Module.Index, b.modules.count());
820 for (modules_values, b.modules.values()) |*dest_value, value| {
821 dest_value.* = try s.addModule(value);
729 const gop = try s.package_map.getOrPut(arena, b);
730 if (!gop.found_existing) {
731 gop.value_ptr.* = try wc.addExtra(Configuration.Package, .{
732 .hash = try wc.addString(b.pkg_hash),
733 .dep_prefix = try wc.addString(b.dep_prefix),
734 .root_path = try wc.addString(try b.root.toString(arena)),
735 });
822736 }
823
824 wc.package_instances.items[index] = .{
825 .package = s.packageFromHash(b.pkg_hash),
826 .modules = .{
827 .keys = try wc.addStringList(b.modules.keys()),
828 .values = try wc.addDeduped(Configuration.Module.List, .{
829 .modules = .{ .slice = modules_values },
830 }),
831 },
832 };
833}
834
835fn makeUserValue(s: *Serialize, user_value: *const std.Build.UserValue) Allocator.Error!Configuration.Package.Instance.UserValue {
836 const arena = s.arena;
837 const wc = s.wc;
838
839 return switch (user_value.*) {
840 .flag => .flag,
841 .scalar => |str| .{ .scalar = try wc.addString(str) },
842 .list => |list| .{ .list = try wc.addStringList(list.items) },
843 .map => |map| add: {
844 const keys = try arena.alloc([]const u8, map.count());
845 const values = try arena.alloc(Configuration.Package.Instance.UserValue.Standalone.Index, map.count());
846
847 var i: usize = 0;
848 var iter = map.iterator();
849 while (iter.next()) |entry| : (i += 1) {
850 const value = try s.makeUserValue(entry.value_ptr.*);
851
852 keys[i] = entry.key_ptr.*;
853 values[i] = try wc.addDeduped(
854 Configuration.Package.Instance.UserValue.Standalone,
855 .{ .flags = .{ .tag = value }, .value = .{ .u = value } },
856 );
857 }
858
859 break :add .{ .map = try wc.addDeduped(
860 Configuration.Package.Instance.UserValue.Map,
861 .{
862 .keys = try wc.addStringList(keys),
863 .values = .{ .slice = values },
864 },
865 ) };
866 },
867 .lazy_path => |lp| .{ .lazy_path = try s.addLazyPath(lp) },
868 .lazy_path_list => |lp_list| add: {
869 const paths = try arena.alloc(Configuration.LazyPath.Index, lp_list.items.len);
870 for (paths, lp_list.items) |*dest, src| dest.* = try s.addLazyPath(src);
871 break :add .{ .lazy_path_list = .{ .slice = paths } };
872 },
873 };
874}
875
876fn packageInstanceFromBuilder(s: *Serialize, b: *std.Build) Configuration.Package.Instance.Index {
877 if (b.pkg_hash.len == 0) return .root;
878 return @fromBackingInt(@intCast(s.package_instance_map.getIndex(b).?));
737 return gop.value_ptr.*;
879738}
880739
881740fn addOptionalLazyPathEnum(s: *Serialize, lp: ?std.Build.LazyPath) !Configuration.LazyPath.OptionalIndex {
......@@ -884,7 +743,7 @@ fn addOptionalLazyPathEnum(s: *Serialize, lp: ?std.Build.LazyPath) !Configuratio
884743 .src_path => |src_path| i: {
885744 const sub_path = try wc.addString(src_path.sub_path);
886745 break :i try wc.addExtraErased(Configuration.LazyPath.SourcePath, .{
887 .owner = s.packageInstanceFromBuilder(src_path.owner),
746 .owner = try s.builderToPackage(src_path.owner),
888747 .sub_path = sub_path,
889748 });
890749 },
......@@ -912,7 +771,7 @@ fn addOptionalLazyPathEnum(s: *Serialize, lp: ?std.Build.LazyPath) !Configuratio
912771 .dependency => |dependency| i: {
913772 const sub_path = try wc.addString(dependency.sub_path);
914773 break :i try wc.addExtraErased(Configuration.LazyPath.SourcePath, .{
915 .owner = s.packageInstanceFromBuilder(dependency.dependency.builder),
774 .owner = try s.builderToPackage(dependency.dependency.builder),
916775 .sub_path = sub_path,
917776 });
918777 },
......@@ -1341,7 +1200,7 @@ fn addModule(s: *Serialize, m: *std.Build.Module) !Configuration.Module.Index {
13411200 const c_macros = try initStringList(s, m.c_macros.items);
13421201 const export_symbol_names = try initStringList(s, m.export_symbol_names);
13431202
1344 const module_index: Configuration.Module.Index = try wc.addDeduped(Configuration.Module, .{
1203 const module_index: Configuration.Module.Index = try wc.addExtra(Configuration.Module, .{
13451204 .flags = .{
13461205 .optimize = .init(m.optimize),
13471206 .strip = .init(m.strip),
......@@ -1372,7 +1231,7 @@ fn addModule(s: *Serialize, m: *std.Build.Module) !Configuration.Module.Index {
13721231 .link_libcpp = .init(m.link_libcpp),
13731232 .no_builtin = .init(m.no_builtin),
13741233 },
1375 .owner = s.packageInstanceFromBuilder(m.owner),
1234 .owner = try s.builderToPackage(m.owner),
13761235 .root_source_file = try s.addOptionalLazyPathEnum(m.root_source_file),
13771236 .import_table = .invalid,
13781237 .resolved_target = try addOptionalResolvedTarget(wc, m.resolved_target),