aboutsummaryrefslogtreecommitdiff
path: root/src/main.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2024-02-02 20:42:18 -0700
committerAndrew Kelley <andrew@ziglang.org>2024-02-02 20:43:01 -0700
commit3dad7312b2c0f84c557b1cf01cfbbbaa04ffc79c (patch)
tree74ac15acd638c8bd9eef482fba9c3e64dc0797d9 /src/main.zig
parent18091b440676737829cb4da154f9dd595449374b (diff)
downloadzig-3dad7312b2c0f84c557b1cf01cfbbbaa04ffc79c.tar.gz
zig-3dad7312b2c0f84c557b1cf01cfbbbaa04ffc79c.zip
CLI: use dummy http client when bootstrapping
Prevents unnecessary depedency on networking when bootstrapping zig.
Diffstat (limited to 'src/main.zig')
-rw-r--r--src/main.zig12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/main.zig b/src/main.zig
index 18a29b6233..a1b4a098db 100644
--- a/src/main.zig
+++ b/src/main.zig
@@ -5379,7 +5379,16 @@ pub fn cmdBuild(gpa: Allocator, arena: Allocator, args: []const []const u8) !voi
try thread_pool.init(.{ .allocator = gpa });
defer thread_pool.deinit();
- var http_client: std.http.Client = .{ .allocator = gpa };
+ // Dummy http client that is not actually used when only_core_functionality is enabled.
+ // Prevents bootstrap from depending on a bunch of unnecessary stuff.
+ const HttpClient = if (build_options.only_core_functionality) struct {
+ allocator: Allocator,
+ fn deinit(self: *@This()) void {
+ _ = self;
+ }
+ } else std.http.Client;
+
+ var http_client: HttpClient = .{ .allocator = gpa };
defer http_client.deinit();
var unlazy_set: Package.Fetch.JobQueue.UnlazySet = .{};
@@ -5656,6 +5665,7 @@ pub fn cmdBuild(gpa: Allocator, arena: Allocator, args: []const []const u8) !voi
if (code == 2) process.exit(2);
if (code == 3) {
+ if (build_options.only_core_functionality) process.exit(3);
// Indicates the configure phase failed due to missing lazy
// dependencies and stdout contains the hashes of the ones
// that are missing.