diff options
| author | Jimmi Holst Christensen <jhc@liab.dk> | 2018-12-05 14:10:09 +0100 |
|---|---|---|
| committer | Jimmi Holst Christensen <jhc@liab.dk> | 2018-12-05 14:10:09 +0100 |
| commit | 518ff33e64f3970e6fc053d2cffe0751e21b0700 (patch) | |
| tree | bb080003c4f00b41863220845511f2510c1ccbb8 /std/build.zig | |
| parent | 9ac838c8e3f5c3e77533e30f72bac30487b9ae23 (diff) | |
| download | zig-518ff33e64f3970e6fc053d2cffe0751e21b0700.tar.gz zig-518ff33e64f3970e6fc053d2cffe0751e21b0700.zip | |
Allow packages in TestStep
Diffstat (limited to 'std/build.zig')
| -rw-r--r-- | std/build.zig | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/std/build.zig b/std/build.zig index 034e3ce324..90f5bec656 100644 --- a/std/build.zig +++ b/std/build.zig @@ -811,6 +811,11 @@ pub const Target = union(enum) { } }; +const Pkg = struct { + name: []const u8, + path: []const u8, +}; + pub const LibExeObjStep = struct { step: Step, builder: *Builder, @@ -853,11 +858,6 @@ pub const LibExeObjStep = struct { source_files: ArrayList([]const u8), object_src: []const u8, - const Pkg = struct { - name: []const u8, - path: []const u8, - }; - const Kind = enum { Exe, Lib, @@ -1667,6 +1667,7 @@ pub const TestStep = struct { exec_cmd_args: ?[]const ?[]const u8, include_dirs: ArrayList([]const u8), lib_paths: ArrayList([]const u8), + packages: ArrayList(Pkg), object_files: ArrayList([]const u8), no_rosegment: bool, output_path: ?[]const u8, @@ -1687,6 +1688,7 @@ pub const TestStep = struct { .exec_cmd_args = null, .include_dirs = ArrayList([]const u8).init(builder.allocator), .lib_paths = ArrayList([]const u8).init(builder.allocator), + .packages = ArrayList(Pkg).init(builder.allocator), .object_files = ArrayList([]const u8).init(builder.allocator), .no_rosegment = false, .output_path = null, @@ -1702,6 +1704,13 @@ pub const TestStep = struct { self.lib_paths.append(path) catch unreachable; } + pub fn addPackagePath(self: *TestStep, name: []const u8, pkg_index_path: []const u8) void { + self.packages.append(Pkg{ + .name = name, + .path = pkg_index_path, + }) catch unreachable; + } + pub fn setVerbose(self: *TestStep, value: bool) void { self.verbose = value; } @@ -1878,6 +1887,13 @@ pub const TestStep = struct { try zig_args.append(lib_path); } + for (self.packages.toSliceConst()) |pkg| { + zig_args.append("--pkg-begin") catch unreachable; + zig_args.append(pkg.name) catch unreachable; + zig_args.append(builder.pathFromRoot(pkg.path)) catch unreachable; + zig_args.append("--pkg-end") catch unreachable; + } + if (self.no_rosegment) { try zig_args.append("--no-rosegment"); } |
