| ... | @@ -811,6 +811,11 @@ pub const Target = union(enum) { | ... | @@ -811,6 +811,11 @@ pub const Target = union(enum) { |
| 811 | } | 811 | } |
| 812 | }; | 812 | }; |
| 813 | | 813 | |
| | 814 | const Pkg = struct { |
| | 815 | name: []const u8, |
| | 816 | path: []const u8, |
| | 817 | }; |
| | 818 | |
| 814 | pub const LibExeObjStep = struct { | 819 | pub const LibExeObjStep = struct { |
| 815 | step: Step, | 820 | step: Step, |
| 816 | builder: *Builder, | 821 | builder: *Builder, |
| ... | @@ -853,11 +858,6 @@ pub const LibExeObjStep = struct { | ... | @@ -853,11 +858,6 @@ pub const LibExeObjStep = struct { |
| 853 | source_files: ArrayList([]const u8), | 858 | source_files: ArrayList([]const u8), |
| 854 | object_src: []const u8, | 859 | object_src: []const u8, |
| 855 | | 860 | |
| 856 | const Pkg = struct { | | |
| 857 | name: []const u8, | | |
| 858 | path: []const u8, | | |
| 859 | }; | | |
| 860 | | | |
| 861 | const Kind = enum { | 861 | const Kind = enum { |
| 862 | Exe, | 862 | Exe, |
| 863 | Lib, | 863 | Lib, |
| ... | @@ -1667,6 +1667,7 @@ pub const TestStep = struct { | ... | @@ -1667,6 +1667,7 @@ pub const TestStep = struct { |
| 1667 | exec_cmd_args: ?[]const ?[]const u8, | 1667 | exec_cmd_args: ?[]const ?[]const u8, |
| 1668 | include_dirs: ArrayList([]const u8), | 1668 | include_dirs: ArrayList([]const u8), |
| 1669 | lib_paths: ArrayList([]const u8), | 1669 | lib_paths: ArrayList([]const u8), |
| | 1670 | packages: ArrayList(Pkg), |
| 1670 | object_files: ArrayList([]const u8), | 1671 | object_files: ArrayList([]const u8), |
| 1671 | no_rosegment: bool, | 1672 | no_rosegment: bool, |
| 1672 | output_path: ?[]const u8, | 1673 | output_path: ?[]const u8, |
| ... | @@ -1687,6 +1688,7 @@ pub const TestStep = struct { | ... | @@ -1687,6 +1688,7 @@ pub const TestStep = struct { |
| 1687 | .exec_cmd_args = null, | 1688 | .exec_cmd_args = null, |
| 1688 | .include_dirs = ArrayList([]const u8).init(builder.allocator), | 1689 | .include_dirs = ArrayList([]const u8).init(builder.allocator), |
| 1689 | .lib_paths = ArrayList([]const u8).init(builder.allocator), | 1690 | .lib_paths = ArrayList([]const u8).init(builder.allocator), |
| | 1691 | .packages = ArrayList(Pkg).init(builder.allocator), |
| 1690 | .object_files = ArrayList([]const u8).init(builder.allocator), | 1692 | .object_files = ArrayList([]const u8).init(builder.allocator), |
| 1691 | .no_rosegment = false, | 1693 | .no_rosegment = false, |
| 1692 | .output_path = null, | 1694 | .output_path = null, |
| ... | @@ -1702,6 +1704,13 @@ pub const TestStep = struct { | ... | @@ -1702,6 +1704,13 @@ pub const TestStep = struct { |
| 1702 | self.lib_paths.append(path) catch unreachable; | 1704 | self.lib_paths.append(path) catch unreachable; |
| 1703 | } | 1705 | } |
| 1704 | | 1706 | |
| | 1707 | pub fn addPackagePath(self: *TestStep, name: []const u8, pkg_index_path: []const u8) void { |
| | 1708 | self.packages.append(Pkg{ |
| | 1709 | .name = name, |
| | 1710 | .path = pkg_index_path, |
| | 1711 | }) catch unreachable; |
| | 1712 | } |
| | 1713 | |
| 1705 | pub fn setVerbose(self: *TestStep, value: bool) void { | 1714 | pub fn setVerbose(self: *TestStep, value: bool) void { |
| 1706 | self.verbose = value; | 1715 | self.verbose = value; |
| 1707 | } | 1716 | } |
| ... | @@ -1878,6 +1887,13 @@ pub const TestStep = struct { | ... | @@ -1878,6 +1887,13 @@ pub const TestStep = struct { |
| 1878 | try zig_args.append(lib_path); | 1887 | try zig_args.append(lib_path); |
| 1879 | } | 1888 | } |
| 1880 | | 1889 | |
| | 1890 | for (self.packages.toSliceConst()) |pkg| { |
| | 1891 | zig_args.append("--pkg-begin") catch unreachable; |
| | 1892 | zig_args.append(pkg.name) catch unreachable; |
| | 1893 | zig_args.append(builder.pathFromRoot(pkg.path)) catch unreachable; |
| | 1894 | zig_args.append("--pkg-end") catch unreachable; |
| | 1895 | } |
| | 1896 | |
| 1881 | if (self.no_rosegment) { | 1897 | if (self.no_rosegment) { |
| 1882 | try zig_args.append("--no-rosegment"); | 1898 | try zig_args.append("--no-rosegment"); |
| 1883 | } | 1899 | } |