mirror of
https://github.com/jetzig-framework/jetzig.git
synced 2025-05-14 14:06:08 +00:00
Update to latest Zmpl version
Fix a few bits of breakage with build - Jetzig does not have an executable, use `demo/` which links to local Jetzig to test features.
This commit is contained in:
parent
8c5ffcb9f6
commit
280f1eaadd
20
build.zig
20
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,
|
||||
|
@ -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",
|
||||
},
|
||||
},
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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
|
||||
|
@ -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 };
|
||||
|
Loading…
x
Reference in New Issue
Block a user