aboutsummaryrefslogtreecommitdiff
path: root/build.zig
diff options
context:
space:
mode:
Diffstat (limited to 'build.zig')
-rw-r--r--build.zig44
1 files changed, 35 insertions, 9 deletions
diff --git a/build.zig b/build.zig
index db5a525..989f6c4 100644
--- a/build.zig
+++ b/build.zig
@@ -22,11 +22,17 @@ pub fn build(b: *std.Build) void {
.target = target,
});
- const frontend_mod = b.addModule("frontend", .{
- .root_source_file = b.path("src/frontend/root.zig"),
+ const html_mod = b.addModule("html", .{
+ .root_source_file = b.path("src/html/root.zig"),
.target = target,
});
+ const z_mod = b.addModule("z", .{
+ .root_source_file = b.path("src/z/root.zig"),
+ .target = target,
+ });
+ z_mod.addImport("html", html_mod);
+
const http_mod = b.addModule("http", .{
.root_source_file = b.path("src/http/root.zig"),
.target = target,
@@ -43,7 +49,8 @@ pub fn build(b: *std.Build) void {
.imports = &.{
.{ .name = "db", .module = db_mod },
.{ .name = "api", .module = api_mod },
- .{ .name = "frontend", .module = frontend_mod },
+ .{ .name = "z", .module = z_mod },
+ .{ .name = "html", .module = html_mod },
.{ .name = "http", .module = http_mod },
}
}),
@@ -78,12 +85,19 @@ pub fn build(b: *std.Build) void {
api_test_step.dependOn(&run_api_tests.step);
- const frontend_tests = b.addTest(.{
- .root_module = frontend_mod,
+ const z_tests = b.addTest(.{
+ .root_module = z_mod,
+ });
+ const run_z_tests = b.addRunArtifact(z_tests);
+ const z_test_step = b.step("test-z", "Run z tests");
+ z_test_step.dependOn(&run_z_tests.step);
+
+ const html_tests = b.addTest(.{
+ .root_module = html_mod,
});
- const run_frontend_tests = b.addRunArtifact(frontend_tests);
- const frontend_test_step = b.step("test-frontend", "Run frontend tests");
- frontend_test_step.dependOn(&run_frontend_tests.step);
+ const run_html_tests = b.addRunArtifact(html_tests);
+ const html_test_step = b.step("test-html", "Run html tests");
+ html_test_step.dependOn(&run_html_tests.step);
const http_tests = b.addTest(.{
@@ -103,7 +117,8 @@ pub fn build(b: *std.Build) void {
const test_step = b.step("test", "Run all tests");
test_step.dependOn(&run_db_tests.step);
test_step.dependOn(&run_api_tests.step);
- test_step.dependOn(&run_frontend_tests.step);
+ test_step.dependOn(&run_z_tests.step);
+ test_step.dependOn(&run_html_tests.step);
test_step.dependOn(&run_http_tests.step);
test_step.dependOn(&run_exe_tests.step);
@@ -130,4 +145,15 @@ pub fn build(b: *std.Build) void {
.source_dir = exe.getEmittedDocs(),
});
docs_step.dependOn(&docs_install.step);
+
+
+ const hot_cmd = b.addSystemCommand(&.{
+ "sh",
+ "-c",
+ "clear; echo 'building in hot mode'; find src -type f | entr -r zig build run",
+ });
+
+ const hot_step = b.step("hot", "Run server in hot reload mode");
+ hot_step.dependOn(&hot_cmd.step);
+ run_cmd.step.dependOn(b.getInstallStep());
}