mirror of
https://github.com/ziglang/zig.git
synced 2025-12-06 14:23:09 +00:00
parent
4f639ff880
commit
e304a478c0
@ -340,9 +340,10 @@ pub fn main() !void {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (webui_listen != null and watch) fatal(
|
if (webui_listen != null) {
|
||||||
\\the build system does not yet support combining '--webui' and '--watch'; consider omitting '--watch' in favour of the web UI "Rebuild" button
|
if (watch) fatal("using '--webui' and '--watch' together is not yet supported; consider omitting '--watch' in favour of the web UI \"Rebuild\" button", .{});
|
||||||
, .{});
|
if (builtin.single_threaded) fatal("'--webui' is not yet supported on single-threaded hosts", .{});
|
||||||
|
}
|
||||||
|
|
||||||
const stderr: std.fs.File = .stderr();
|
const stderr: std.fs.File = .stderr();
|
||||||
const ttyconf = get_tty_conf(color, stderr);
|
const ttyconf = get_tty_conf(color, stderr);
|
||||||
@ -449,7 +450,9 @@ pub fn main() !void {
|
|||||||
try run.thread_pool.init(thread_pool_options);
|
try run.thread_pool.init(thread_pool_options);
|
||||||
defer run.thread_pool.deinit();
|
defer run.thread_pool.deinit();
|
||||||
|
|
||||||
run.web_server = if (webui_listen) |listen_address| .init(.{
|
run.web_server = if (webui_listen) |listen_address| ws: {
|
||||||
|
if (builtin.single_threaded) unreachable; // `fatal` above
|
||||||
|
break :ws .init(.{
|
||||||
.gpa = gpa,
|
.gpa = gpa,
|
||||||
.thread_pool = &run.thread_pool,
|
.thread_pool = &run.thread_pool,
|
||||||
.graph = &graph,
|
.graph = &graph,
|
||||||
@ -458,7 +461,8 @@ pub fn main() !void {
|
|||||||
.root_prog_node = main_progress_node,
|
.root_prog_node = main_progress_node,
|
||||||
.watch = watch,
|
.watch = watch,
|
||||||
.listen_address = listen_address,
|
.listen_address = listen_address,
|
||||||
}) else null;
|
});
|
||||||
|
} else null;
|
||||||
|
|
||||||
if (run.web_server) |*ws| {
|
if (run.web_server) |*ws| {
|
||||||
ws.start() catch |err| fatal("failed to start web server: {s}", .{@errorName(err)});
|
ws.start() catch |err| fatal("failed to start web server: {s}", .{@errorName(err)});
|
||||||
@ -562,7 +566,7 @@ const Run = struct {
|
|||||||
max_rss_mutex: std.Thread.Mutex,
|
max_rss_mutex: std.Thread.Mutex,
|
||||||
skip_oom_steps: bool,
|
skip_oom_steps: bool,
|
||||||
watch: bool,
|
watch: bool,
|
||||||
web_server: ?WebServer,
|
web_server: if (!builtin.single_threaded) ?WebServer else ?noreturn,
|
||||||
/// Allocated into `gpa`.
|
/// Allocated into `gpa`.
|
||||||
memory_blocked_steps: std.ArrayListUnmanaged(*Step),
|
memory_blocked_steps: std.ArrayListUnmanaged(*Step),
|
||||||
/// Allocated into `gpa`.
|
/// Allocated into `gpa`.
|
||||||
|
|||||||
@ -59,11 +59,9 @@ pub const Options = struct {
|
|||||||
listen_address: std.net.Address,
|
listen_address: std.net.Address,
|
||||||
};
|
};
|
||||||
pub fn init(opts: Options) WebServer {
|
pub fn init(opts: Options) WebServer {
|
||||||
if (builtin.single_threaded) {
|
|
||||||
// The upcoming `std.Io` interface should allow us to use `Io.async` and `Io.concurrent`
|
// The upcoming `std.Io` interface should allow us to use `Io.async` and `Io.concurrent`
|
||||||
// instead of threads, so that the web server can function in single-threaded builds.
|
// instead of threads, so that the web server can function in single-threaded builds.
|
||||||
std.process.fatal("--webui not yet implemented for single-threaded builds", .{});
|
comptime assert(!builtin.single_threaded);
|
||||||
}
|
|
||||||
|
|
||||||
const all_steps = opts.all_steps;
|
const all_steps = opts.all_steps;
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user