| ... | @@ -22,7 +22,7 @@ packages: []Package, | ... | @@ -22,7 +22,7 @@ packages: []Package, |
| 22 | /// Unlike `packages`, each item corresponds to a `std.Build`, which is a | 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 | 23 | /// package that was instantiated by running its build script with specific |
| 24 | /// input options. | 24 | /// input options. |
| 25 | package_instances: []PackageInstance, | 25 | package_instances: []Package.Instance, |
| 26 | extra: []u32, | 26 | extra: []u32, |
| 27 | default_step: Step.Index, | 27 | default_step: Step.Index, |
| 28 | generated_files_len: u32, | 28 | generated_files_len: u32, |
| ... | @@ -69,7 +69,7 @@ pub const Wip = struct { | ... | @@ -69,7 +69,7 @@ pub const Wip = struct { |
| 69 | path_deps: std.ArrayList(PathDep) = .empty, | 69 | path_deps: std.ArrayList(PathDep) = .empty, |
| 70 | search_prefixes: std.ArrayList(String) = .empty, | 70 | search_prefixes: std.ArrayList(String) = .empty, |
| 71 | packages: std.ArrayList(Package) = .empty, | 71 | packages: std.ArrayList(Package) = .empty, |
| 72 | package_instances: std.ArrayList(PackageInstance) = .empty, | 72 | package_instances: std.ArrayList(Package.Instance) = .empty, |
| 73 | extra: std.ArrayList(u32) = .empty, | 73 | extra: std.ArrayList(u32) = .empty, |
| 74 | next_generated_file_index: u32 = 0, | 74 | next_generated_file_index: u32 = 0, |
| 75 | cache_poison: bool = false, | 75 | cache_poison: bool = false, |
| ... | @@ -494,7 +494,7 @@ pub const AvailableOption = extern struct { | ... | @@ -494,7 +494,7 @@ pub const AvailableOption = extern struct { |
| 494 | | 494 | |
| 495 | pub const Step = extern struct { | 495 | pub const Step = extern struct { |
| 496 | name: String, | 496 | name: String, |
| 497 | owner: PackageInstance.Index, | 497 | owner: Package.Instance.Index, |
| 498 | deps: Deps.Index, | 498 | deps: Deps.Index, |
| 499 | max_rss: MaxRss, | 499 | max_rss: MaxRss, |
| 500 | extended: Storage.Extended(Flags, union(Tag) { | 500 | extended: Storage.Extended(Flags, union(Tag) { |
| ... | @@ -1543,7 +1543,7 @@ pub const LazyPath = union(@This().Tag) { | ... | @@ -1543,7 +1543,7 @@ pub const LazyPath = union(@This().Tag) { |
| 1543 | | 1543 | |
| 1544 | pub const SourcePath = struct { | 1544 | pub const SourcePath = struct { |
| 1545 | flags: @This().Flags = .{}, | 1545 | flags: @This().Flags = .{}, |
| 1546 | owner: PackageInstance.Index, | 1546 | owner: Package.Instance.Index, |
| 1547 | sub_path: String, | 1547 | sub_path: String, |
| 1548 | | 1548 | |
| 1549 | pub const Flags = packed struct(u32) { | 1549 | pub const Flags = packed struct(u32) { |
| ... | @@ -1674,122 +1674,122 @@ pub const Package = extern struct { | ... | @@ -1674,122 +1674,122 @@ pub const Package = extern struct { |
| 1674 | }; | 1674 | }; |
| 1675 | }; | 1675 | }; |
| 1676 | }; | 1676 | }; |
| 1677 | }; | | |
| 1678 | | 1677 | |
| 1679 | pub const PackageInstance = extern struct { | 1678 | pub const Instance = extern struct { |
| 1680 | package: Package.Index, | 1679 | package: Package.Index, |
| 1681 | user_input_options: UserInputOption.List.Index, | 1680 | user_input_options: UserInputOption.List.Index, |
| 1682 | modules: PublicModules, | 1681 | modules: PublicModules, |
| 1683 | | 1682 | |
| 1684 | pub const UserInputOption = struct { | 1683 | pub const UserInputOption = struct { |
| 1685 | flags: Flags, | 1684 | flags: Flags, |
| 1686 | name: String, | 1685 | name: String, |
| 1687 | value: Storage.FlagUnion(.flags, .tag, UserValue), | 1686 | value: Storage.FlagUnion(.flags, .tag, UserValue), |
| 1688 | | 1687 | |
| 1689 | pub const Flags = packed struct(u32) { | 1688 | pub const Flags = packed struct(u32) { |
| 1690 | tag: UserValue.Tag, | 1689 | tag: UserValue.Tag, |
| 1691 | used: bool, | 1690 | used: bool, |
| 1692 | _: u28 = 0, | 1691 | _: u28 = 0, |
| 1693 | }; | 1692 | }; |
| 1694 | | 1693 | |
| 1695 | pub const List = struct { | 1694 | pub const List = struct { |
| 1696 | options: Storage.LengthPrefixedList(UserInputOption.Index), | 1695 | options: Storage.LengthPrefixedList(UserInputOption.Index), |
| 1697 | | 1696 | |
| 1698 | pub const Index = enum(u32) { | 1697 | pub const Index = enum(u32) { |
| 1699 | _, | 1698 | _, |
| 1700 | | 1699 | |
| 1701 | pub fn get(this: @This(), c: *const Configuration) List { | 1700 | pub fn get(this: @This(), c: *const Configuration) List { |
| 1702 | return extraData(c, List, @backingInt(this)); | 1701 | return extraData(c, List, @backingInt(this)); |
| 1703 | } | 1702 | } |
| 1704 | | 1703 | |
| 1705 | pub fn slice(this: @This(), c: *const Configuration) []const UserInputOption.Index { | 1704 | pub fn slice(this: @This(), c: *const Configuration) []const UserInputOption.Index { |
| 1706 | return this.get(c).options.slice; | 1705 | return this.get(c).options.slice; |
| 1707 | } | 1706 | } |
| | 1707 | }; |
| 1708 | }; | 1708 | }; |
| | 1709 | |
| | 1710 | pub const Index = IndexType(@This()); |
| 1709 | }; | 1711 | }; |
| 1710 | | 1712 | |
| 1711 | pub const Index = IndexType(@This()); | 1713 | pub const UserValue = union(Tag) { |
| 1712 | }; | 1714 | flag, |
| | 1715 | scalar: String, |
| | 1716 | list: StringList, |
| | 1717 | map: Map.Index, |
| | 1718 | lazy_path: LazyPath.Index, |
| | 1719 | lazy_path_list: Storage.LengthPrefixedList(LazyPath.Index), |
| 1713 | | 1720 | |
| 1714 | pub const UserValue = union(Tag) { | 1721 | pub const Standalone = struct { |
| 1715 | flag, | 1722 | flags: Flags, |
| 1716 | scalar: String, | 1723 | value: Storage.FlagUnion(.flags, .tag, UserValue), |
| 1717 | list: StringList, | | |
| 1718 | map: Map.Index, | | |
| 1719 | lazy_path: LazyPath.Index, | | |
| 1720 | lazy_path_list: Storage.LengthPrefixedList(LazyPath.Index), | | |
| 1721 | | 1724 | |
| 1722 | pub const Standalone = struct { | 1725 | pub const Flags = packed struct(u32) { |
| 1723 | flags: Flags, | 1726 | tag: UserValue.Tag, |
| 1724 | value: Storage.FlagUnion(.flags, .tag, UserValue), | 1727 | _: u29 = 0, |
| | 1728 | }; |
| 1725 | | 1729 | |
| 1726 | pub const Flags = packed struct(u32) { | 1730 | pub const Index = IndexType(@This()); |
| 1727 | tag: UserValue.Tag, | | |
| 1728 | _: u29 = 0, | | |
| 1729 | }; | 1731 | }; |
| 1730 | | 1732 | |
| 1731 | pub const Index = IndexType(@This()); | 1733 | pub const Tag = enum(u3) { |
| 1732 | }; | 1734 | flag, |
| | 1735 | scalar, |
| | 1736 | list, |
| | 1737 | map, |
| | 1738 | lazy_path, |
| | 1739 | lazy_path_list, |
| | 1740 | |
| | 1741 | pub fn init(uv: @typeInfo(std.Build.UserValue).@"union".tag_type.?) @This() { |
| | 1742 | return switch (uv) { |
| | 1743 | inline else => |tag| @field(@This(), @tagName(tag)), |
| | 1744 | }; |
| | 1745 | } |
| | 1746 | }; |
| 1733 | | 1747 | |
| 1734 | pub const Tag = enum(u3) { | 1748 | pub const Map = struct { |
| 1735 | flag, | 1749 | keys: StringList, |
| 1736 | scalar, | 1750 | values: Storage.LengthPrefixedList(UserValue.Standalone.Index), |
| 1737 | list, | 1751 | |
| 1738 | map, | 1752 | pub const Index = IndexType(@This()); |
| 1739 | lazy_path, | 1753 | }; |
| 1740 | lazy_path_list, | | |
| 1741 | | | |
| 1742 | pub fn init(uv: @typeInfo(std.Build.UserValue).@"union".tag_type.?) @This() { | | |
| 1743 | return switch (uv) { | | |
| 1744 | inline else => |tag| @field(@This(), @tagName(tag)), | | |
| 1745 | }; | | |
| 1746 | } | | |
| 1747 | }; | 1754 | }; |
| 1748 | | 1755 | |
| 1749 | pub const Map = struct { | 1756 | pub const PublicModules = extern struct { |
| 1750 | keys: StringList, | 1757 | keys: StringList, |
| 1751 | values: Storage.LengthPrefixedList(UserValue.Standalone.Index), | 1758 | values: Module.List.Index, |
| 1752 | | | |
| 1753 | pub const Index = IndexType(@This()); | | |
| 1754 | }; | 1759 | }; |
| 1755 | }; | | |
| 1756 | | | |
| 1757 | pub const PublicModules = extern struct { | | |
| 1758 | keys: StringList, | | |
| 1759 | values: Module.List.Index, | | |
| 1760 | }; | | |
| 1761 | | 1760 | |
| 1762 | pub const Index = enum(u32) { | 1761 | pub const Index = enum(u32) { |
| 1763 | root, | 1762 | root, |
| 1764 | _, | 1763 | _, |
| 1765 | | 1764 | |
| 1766 | pub fn ptr(this: @This(), c: *const Configuration) *const PackageInstance { | 1765 | pub fn ptr(this: @This(), c: *const Configuration) *const Package.Instance { |
| 1767 | return &c.package_instances[@backingInt(this)]; | 1766 | return &c.package_instances[@backingInt(this)]; |
| 1768 | } | 1767 | } |
| 1769 | | 1768 | |
| 1770 | pub fn package(this: @This(), c: *const Configuration) Package.Index { | 1769 | pub fn package(this: @This(), c: *const Configuration) Package.Index { |
| 1771 | return this.ptr(c).package; | 1770 | return this.ptr(c).package; |
| 1772 | } | 1771 | } |
| 1773 | }; | 1772 | }; |
| 1774 | | 1773 | |
| 1775 | pub const OptionalIndex = enum(u32) { | 1774 | pub const OptionalIndex = enum(u32) { |
| 1776 | root, | 1775 | root, |
| 1777 | none = max_u32, | 1776 | none = max_u32, |
| 1778 | _, | 1777 | _, |
| 1779 | | 1778 | |
| 1780 | pub fn init(i: Index) OptionalIndex { | 1779 | pub fn init(i: Instance.Index) Instance.OptionalIndex { |
| 1781 | const result: OptionalIndex = @fromBackingInt(@intCast(@backingInt(i))); | 1780 | const result: Instance.OptionalIndex = @fromBackingInt(@intCast(@backingInt(i))); |
| 1782 | assert(result != .none); | 1781 | assert(result != .none); |
| 1783 | return result; | 1782 | return result; |
| 1784 | } | 1783 | } |
| 1785 | | 1784 | |
| 1786 | pub fn unwrap(this: @This()) ?Index { | 1785 | pub fn unwrap(this: @This()) ?Instance.Index { |
| 1787 | return switch (this) { | 1786 | return switch (this) { |
| 1788 | .none => null, | 1787 | .none => null, |
| 1789 | .root => .root, | 1788 | .root => .root, |
| 1790 | _ => @fromBackingInt(@intCast(@backingInt(this))), | 1789 | _ => @fromBackingInt(@intCast(@backingInt(this))), |
| 1791 | }; | 1790 | }; |
| 1792 | } | 1791 | } |
| | 1792 | }; |
| 1793 | }; | 1793 | }; |
| 1794 | }; | 1794 | }; |
| 1795 | | 1795 | |
| ... | @@ -1797,7 +1797,7 @@ pub const Module = struct { | ... | @@ -1797,7 +1797,7 @@ pub const Module = struct { |
| 1797 | flags: Flags, | 1797 | flags: Flags, |
| 1798 | flags2: Flags2, | 1798 | flags2: Flags2, |
| 1799 | import_table: ImportTable.Index, | 1799 | import_table: ImportTable.Index, |
| 1800 | owner: PackageInstance.Index, | 1800 | owner: Package.Instance.Index, |
| 1801 | root_source_file: LazyPath.OptionalIndex, | 1801 | root_source_file: LazyPath.OptionalIndex, |
| 1802 | resolved_target: ResolvedTarget.OptionalIndex, | 1802 | resolved_target: ResolvedTarget.OptionalIndex, |
| 1803 | c_macros: Storage.FlagLengthPrefixedList(.flags, .c_macros, String), | 1803 | c_macros: Storage.FlagLengthPrefixedList(.flags, .c_macros, String), |
| ... | @@ -2040,7 +2040,7 @@ pub const OptionalStringList = enum(u32) { | ... | @@ -2040,7 +2040,7 @@ pub const OptionalStringList = enum(u32) { |
| 2040 | pub const PathDep = extern struct { | 2040 | pub const PathDep = extern struct { |
| 2041 | flags: Flags, | 2041 | flags: Flags, |
| 2042 | sub: String, | 2042 | sub: String, |
| 2043 | pkg: PackageInstance.OptionalIndex, | 2043 | pkg: Package.Instance.OptionalIndex, |
| 2044 | | 2044 | |
| 2045 | pub const Flags = packed struct(u32) { | 2045 | pub const Flags = packed struct(u32) { |
| 2046 | mode: Mode, | 2046 | mode: Mode, |
| ... | @@ -3306,7 +3306,7 @@ pub fn load(arena: Allocator, reader: *Io.Reader) LoadError!Configuration { | ... | @@ -3306,7 +3306,7 @@ pub fn load(arena: Allocator, reader: *Io.Reader) LoadError!Configuration { |
| 3306 | .available_options = try arena.alloc(AvailableOption, header.available_options_len), | 3306 | .available_options = try arena.alloc(AvailableOption, header.available_options_len), |
| 3307 | .search_prefixes = try arena.alloc(String, header.search_prefixes_len), | 3307 | .search_prefixes = try arena.alloc(String, header.search_prefixes_len), |
| 3308 | .packages = try arena.alloc(Package, header.packages_len), | 3308 | .packages = try arena.alloc(Package, header.packages_len), |
| 3309 | .package_instances = try arena.alloc(PackageInstance, header.package_instances_len), | 3309 | .package_instances = try arena.alloc(Package.Instance, header.package_instances_len), |
| 3310 | .extra = try arena.alloc(u32, header.extra_len), | 3310 | .extra = try arena.alloc(u32, header.extra_len), |
| 3311 | .default_step = header.default_step, | 3311 | .default_step = header.default_step, |
| 3312 | .generated_files_len = header.generated_files_len, | 3312 | .generated_files_len = header.generated_files_len, |