Skip to content

Commit faba2c4

Browse files
committed
refactor(build): format code and reorder build steps
- Consolidate multi-line if statements to single lines - Remove extra whitespace in module imports structure - Move generateDocs call to end of build sequence
1 parent 6982287 commit faba2c4

File tree

1 file changed

+8
-12
lines changed

1 file changed

+8
-12
lines changed

build.zig

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,7 @@ pub fn build(b: *Build) !void {
3030
const enableTLS = b.option(bool, "enable_tls", "whether lib enable tls") orelse default_enableTLS;
3131
const enableWebUILog = b.option(bool, "enable_webui_log", "whether lib enable webui log") orelse default_enableWebUILog;
3232

33-
if (enableTLS) {
34-
log.info("enable TLS support", .{});
35-
}
33+
if (enableTLS) log.info("enable TLS support", .{});
3634

3735
// TLS does not support cross compilation
3836
if (enableTLS and !target.query.isNative()) {
@@ -55,25 +53,23 @@ pub fn build(b: *Build) !void {
5553
});
5654
const webui_module = b.addModule("webui", .{
5755
.root_source_file = b.path(b.pathJoin(&.{ "src", "webui.zig" })),
58-
.imports = &.{ .{
56+
.imports = &.{.{
5957
.name = "flags",
6058
.module = flags_module,
61-
} },
59+
}},
6260
});
6361
webui_module.linkLibrary(webui.artifact("webui"));
64-
if (!isStatic) {
65-
b.installArtifact(webui.artifact("webui"));
66-
}
6762

68-
generateDocs(b, optimize, target, flags_module);
63+
if (!isStatic) b.installArtifact(webui.artifact("webui"));
64+
65+
const compat_module = b.addModule("compat", .{ .root_source_file = b.path(b.pathJoin(&.{ "examples", "compat.zig" })) });
6966

70-
const compat_module = b.addModule("compat", .{
71-
.root_source_file = b.path(b.pathJoin(&.{ "examples", "compat.zig" })),
72-
});
7367
buildExamples(b, optimize, target, webui_module, compat_module, webui.artifact("webui")) catch |err| {
7468
log.err("failed to build examples: {}", .{err});
7569
std.process.exit(1);
7670
};
71+
72+
generateDocs(b, optimize, target, flags_module);
7773
}
7874

7975
fn generateDocs(b: *Build, optimize: OptimizeMode, target: Build.ResolvedTarget, flags_module: *Module) void {

0 commit comments

Comments
 (0)