From 748710f369eef55d265b2973a41ca37d50ca6fb2 Mon Sep 17 00:00:00 2001 From: Bob Farrell Date: Fri, 27 Sep 2024 22:45:24 +0100 Subject: [PATCH] WIP Actions: + Motivation: + --- build.zig | 7 +++++++ build.zig.zon | 3 +++ src/jetzig.zig | 5 +++++ 3 files changed, 15 insertions(+) diff --git a/build.zig b/build.zig index 43924bc..e2683f7 100644 --- a/build.zig +++ b/build.zig @@ -54,6 +54,7 @@ pub fn build(b: *std.Build) !void { .jetquery_migrations_path = @as([]const u8, "src/app/database/migrations"), .jetquery_config_path = @as([]const u8, "config/database.zig"), }); + const jetcommon_dep = b.dependency("jetcommon", .{ .target = target, .optimize = optimize }); const zmd_dep = b.dependency("zmd", .{ .target = target, .optimize = optimize }); const httpz_dep = b.dependency("httpz", .{ .target = target, .optimize = optimize }); const pg_dep = b.dependency("pg", .{ .target = target, .optimize = optimize }); @@ -65,6 +66,7 @@ pub fn build(b: *std.Build) !void { b.modules.put("zmd", zmd_dep.module("zmd")) catch @panic("Out of memory"); b.modules.put("pg", pg_dep.module("pg")) catch @panic("Out of memory"); b.modules.put("jetquery", jetquery_dep.module("jetquery")) catch @panic("Out of memory"); + b.modules.put("jetcommon", jetcommon_dep.module("jetcommon")) catch @panic("Out of memory"); b.modules.put("jetquery_migrate", jetquery_dep.module("jetquery_migrate")) catch @panic("Out of memory"); jetquery_dep.module("jetquery").addImport("pg", pg_dep.module("pg")); @@ -79,6 +81,7 @@ pub fn build(b: *std.Build) !void { jetzig_module.addImport("zmd", zmd_dep.module("zmd")); jetzig_module.addImport("jetkv", jetkv_dep.module("jetkv")); jetzig_module.addImport("jetquery", jetquery_dep.module("jetquery")); + jetzig_module.addImport("jetcommon", jetcommon_dep.module("jetcommon")); jetzig_module.addImport("smtp", smtp_client_dep.module("smtp_client")); jetzig_module.addImport("httpz", httpz_dep.module("httpz")); @@ -99,6 +102,8 @@ pub fn build(b: *std.Build) !void { main_tests.root_module.addImport("zmpl", zmpl_dep.module("zmpl")); main_tests.root_module.addImport("jetkv", jetkv_dep.module("jetkv")); + main_tests.root_module.addImport("jetquery", jetquery_dep.module("jetquery")); + main_tests.root_module.addImport("jetcommon", jetcommon_dep.module("jetcommon")); main_tests.root_module.addImport("httpz", httpz_dep.module("httpz")); main_tests.root_module.addImport("smtp", smtp_client_dep.module("smtp_client")); const run_main_tests = b.addRunArtifact(main_tests); @@ -132,6 +137,7 @@ pub fn jetzigInit(b: *std.Build, exe: *std.Build.Step.Compile, options: JetzigIn const zmd_module = jetzig_dep.module("zmd"); const pg_module = jetzig_dep.module("pg"); const jetquery_module = jetzig_dep.module("jetquery"); + const jetcommon_module = jetzig_dep.module("jetcommon"); const jetquery_migrate_module = jetzig_dep.module("jetquery_migrate"); exe.root_module.addImport("jetzig", jetzig_module); @@ -290,6 +296,7 @@ pub fn jetzigInit(b: *std.Build, exe: *std.Build.Step.Compile, options: JetzigIn .optimize = optimize, }); exe_migrate.root_module.addImport("jetquery", jetquery_module); + exe_migrate.root_module.addImport("jetcommon", jetcommon_module); exe_migrate.root_module.addImport("jetquery_migrate", jetquery_migrate_module); const run_migrate_cmd = b.addRunArtifact(exe_migrate); migrate_step.dependOn(&run_migrate_cmd.step); diff --git a/build.zig.zon b/build.zig.zon index 5380ac9..b6fd635 100644 --- a/build.zig.zon +++ b/build.zig.zon @@ -16,6 +16,9 @@ .jetquery = .{ .path = "../jetquery", }, + .jetcommon = .{ + .path = "../jetcommon", + }, .args = .{ .url = "https://github.com/ikskuh/zig-args/archive/0abdd6947a70e6d8cc83b66228cea614aa856206.tar.gz", .hash = "1220411a8c46d95bbf3b6e2059854bcb3c5159d428814099df5294232b9980517e9c", diff --git a/src/jetzig.zig b/src/jetzig.zig index ba55346..77f743d 100644 --- a/src/jetzig.zig +++ b/src/jetzig.zig @@ -4,6 +4,7 @@ pub const zmpl = @import("zmpl").zmpl; pub const zmd = @import("zmd").zmd; pub const jetkv = @import("jetkv").jetkv; pub const jetquery = @import("jetquery"); +pub const jetcommon = @import("jetcommon"); pub const http = @import("jetzig/http.zig"); pub const loggers = @import("jetzig/loggers.zig"); @@ -21,6 +22,10 @@ pub const database = @import("jetzig/database.zig"); pub const testing = @import("jetzig/testing.zig"); pub const config = @import("jetzig/config.zig"); +pub const DateTime = jetcommon.types.DateTime; +pub const Time = jetcommon.types.Time; +pub const Date = jetcommon.types.Date; + /// The primary interface for a Jetzig application. Create an `App` in your application's /// `src/main.zig` and call `start` to launch the application. pub const App = @import("jetzig/App.zig");