aboutsummaryrefslogtreecommitdiff
path: root/src/main.zig
diff options
context:
space:
mode:
authorantlilja <liljaanton2001@gmail.com>2023-03-09 20:39:15 +0100
committerAndrew Kelley <andrew@ziglang.org>2023-03-09 22:38:14 -0500
commitb445bbfea205702770e4e9de4e456c3e8750f8ed (patch)
treedbb29397a922be4c1f6337f0e17fb3e0f40d7746 /src/main.zig
parent7c9ed45ac2fd580bbbb4b950ac350dd49fc7600e (diff)
downloadzig-b445bbfea205702770e4e9de4e456c3e8750f8ed.tar.gz
zig-b445bbfea205702770e4e9de4e456c3e8750f8ed.zip
Add ability to import dependencies from build.zig
Diffstat (limited to 'src/main.zig')
-rw-r--r--src/main.zig12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/main.zig b/src/main.zig
index b134b7183e..95cfca1463 100644
--- a/src/main.zig
+++ b/src/main.zig
@@ -4228,6 +4228,10 @@ pub fn cmdBuild(gpa: Allocator, arena: Allocator, args: []const []const u8) !voi
.root_src_path = "build_runner.zig",
};
+ var build_pkg: Package = .{
+ .root_src_directory = build_directory,
+ .root_src_path = build_zig_basename,
+ };
if (!build_options.omit_pkg_fetching_code) {
var http_client: std.http.Client = .{ .allocator = gpa };
defer http_client.deinit();
@@ -4249,7 +4253,8 @@ pub fn cmdBuild(gpa: Allocator, arena: Allocator, args: []const []const u8) !voi
// Here we borrow main package's table and will replace it with a fresh
// one after this process completes.
- main_pkg.fetchAndAddDependencies(
+ build_pkg.fetchAndAddDependencies(
+ &main_pkg,
arena,
&thread_pool,
&http_client,
@@ -4280,11 +4285,6 @@ pub fn cmdBuild(gpa: Allocator, arena: Allocator, args: []const []const u8) !voi
mem.swap(Package.Table, &main_pkg.table, &deps_pkg.table);
try main_pkg.add(gpa, "@dependencies", deps_pkg);
}
-
- var build_pkg: Package = .{
- .root_src_directory = build_directory,
- .root_src_path = build_zig_basename,
- };
try main_pkg.add(gpa, "@build", &build_pkg);
const comp = Compilation.create(gpa, .{