diff --git a/build.zig b/build.zig index f8b59a6..fb3650c 100644 --- a/build.zig +++ b/build.zig @@ -15,22 +15,13 @@ pub fn build(b: *std.Build) !void { const lib = b.addStaticLibrary(.{ .name = "jetzig", - .root_source_file = .{ .path = "src/main.zig" }, + .root_source_file = .{ .path = "src/jetzig.zig" }, .target = target, .optimize = optimize, }); b.installArtifact(lib); - const exe = b.addExecutable(.{ - .name = "jetzig", - .root_source_file = .{ .path = "src/main.zig" }, - .target = target, - .optimize = optimize, - }); - - b.installArtifact(exe); - const jetzig_module = b.addModule("jetzig", .{ .root_source_file = .{ .path = "src/jetzig.zig" } }); lib.root_module.addImport("jetzig", jetzig_module); @@ -45,21 +36,12 @@ pub fn build(b: *std.Build) !void { ); lib.root_module.addImport("zmpl", zmpl_dep.module("zmpl")); - exe.root_module.addImport("zmpl", zmpl_dep.module("zmpl")); jetzig_module.addImport("zmpl", zmpl_dep.module("zmpl")); // This is the way to make it look nice in the zig build script // If we would do it the other way around, we would have to do b.dependency("jetzig",.{}).builder.dependency("zmpl",.{}).module("zmpl"); b.modules.put("zmpl", zmpl_dep.module("zmpl")) catch @panic("Out of memory"); - const run_cmd = b.addRunArtifact(exe); - - run_cmd.step.dependOn(b.getInstallStep()); - if (b.args) |args| run_cmd.addArgs(args); - - const run_step = b.step("run", "Run the app"); - run_step.dependOn(&run_cmd.step); - const main_tests = b.addTest(.{ .root_source_file = .{ .path = "src/tests.zig" }, .target = target, diff --git a/build.zig.zon b/build.zig.zon index b4ed7dc..dd0a464 100644 --- a/build.zig.zon +++ b/build.zig.zon @@ -3,8 +3,8 @@ .version = "0.0.0", .dependencies = .{ .zmpl = .{ - .url = "https://github.com/jetzig-framework/zmpl/archive/40158f08fbde4a67d44bf0387649e324ad7ef668.tar.gz", - .hash = "12201558739a1032ba9c104d9c900055988f11e2af8014b4159c259b7d1103398f0b", + .url = "https://github.com/jetzig-framework/zmpl/archive/621fcc531cb469788b9e887b58c7e76529a81d50.tar.gz", + .hash = "12200896800328d9e3335b4e3244b84b7664fe2ab9ff2930781be90b9ae658855846", }, }, diff --git a/demo/build.zig b/demo/build.zig index 7ba2889..3f79ec3 100644 --- a/demo/build.zig +++ b/demo/build.zig @@ -26,21 +26,8 @@ pub fn build(b: *std.Build) !void { .optimize = optimize, }); - const template_path = b.option([]const u8, "zmpl_templates_path", "Path to templates") orelse "src/app/views/"; - const manifest_path: []const u8 = b.pathJoin(&.{ template_path, "zmpl.manifest.zig" }); - - const zmpl_dep = b.dependency( - "zmpl", - .{ - .target = target, - .optimize = optimize, - .zmpl_templates_path = template_path, - .zmpl_manifest_path = manifest_path, - }, - ); - const jetzig_module = jetzig_dep.module("jetzig"); - const zmpl_module = zmpl_dep.module("zmpl"); + const zmpl_module = jetzig_dep.module("zmpl"); exe.root_module.addImport("jetzig", jetzig_module); lib.root_module.addImport("jetzig", jetzig_module); diff --git a/demo/build.zig.zon b/demo/build.zig.zon index b7b6b5d..e73a90a 100644 --- a/demo/build.zig.zon +++ b/demo/build.zig.zon @@ -18,10 +18,6 @@ .jetzig = .{ .path = "../", }, - .zmpl = .{ - .url = "https://github.com/jetzig-framework/zmpl/archive/40158f08fbde4a67d44bf0387649e324ad7ef668.tar.gz", - .hash = "12201558739a1032ba9c104d9c900055988f11e2af8014b4159c259b7d1103398f0b", - }, }, .paths = .{ // This makes *all* files, recursively, included in this package. It is generally diff --git a/src/main.zig b/src/main.zig index ad91166..228e1dd 100644 --- a/src/main.zig +++ b/src/main.zig @@ -2,7 +2,7 @@ const std = @import("std"); pub const jetzig = @import("jetzig.zig"); pub const templates = @import("app/views/zmpl.manifest.zig").templates; -pub const routes = @import("app/views/routes.zig").routes; +pub const routes = @import("routes").routes; pub const jetzig_options = struct { pub const middleware: []const type = &.{ TestMiddleware, IncompleteMiddleware, IncompleteMiddleware2 };