Skip to content

Commit

Permalink
Use imported zig-datetime instead of submodule
Browse files Browse the repository at this point in the history
  • Loading branch information
g41797 committed Oct 8, 2024
1 parent e21ae9c commit 7541892
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 12 deletions.
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
**/.zig-cache/
**/.zig-out/
.idea/
src/deps/mailbox/.zig-cache/
src/deps/mailbox/.zig-out/
src/deps/zig-datetime/.zig-cache/
src/deps/zig-datetime/.zig-out/
src/deps/zig-network/.zig-cache/
Expand Down
6 changes: 0 additions & 6 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
[submodule "src/deps/mailbox"]
path = src/deps/mailbox
url = https://github.com/g41797/mailbox
[submodule "src/deps/zig-datetime"]
path = src/deps/zig-datetime
url = https://github.com/frmdstryr/zig-datetime
[submodule "src/deps/zig-network"]
path = src/deps/zig-network
url = https://github.com/ikskuh/zig-network
11 changes: 10 additions & 1 deletion _notes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -381,4 +381,13 @@ Zig loops
https://gencmurat.com/en/posts/zig-loops/

Listening ports
sudo netstat --tcp --udp --listening --programs --numeric
sudo netstat --tcp --udp --listening --programs --numeric

Import
zig fetch --save-exact https://github.com/g41797/mailbox/archive/master.tar.gz

zig fetch --save=zig-datetime git+https://github.com/frmdstryr/zig-datetime




7 changes: 7 additions & 0 deletions build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ pub fn build(b: *std.Build) void {
.optimize = optimize,
});

const zig_datetime = b.dependency("zig-datetime", .{
.target = target,
.optimize = optimize,
});

const lib = b.addStaticLibrary(.{
.name = "syslog",
Expand All @@ -30,6 +34,8 @@ pub fn build(b: *std.Build) void {
.optimize = optimize,
});

lib.root_module.addImport("zig-datetime", zig_datetime.module("zig-datetime"));

// This declares intent for the library to be installed into the standard
// location when the user invokes the "install" step (the default step when
// running `zig build`).
Expand All @@ -43,6 +49,7 @@ pub fn build(b: *std.Build) void {
.optimize = optimize,
});

lib_unit_tests.root_module.addImport("zig-datetime", zig_datetime.module("zig-datetime"));
lib_unit_tests.root_module.addImport("mailbox", mailbox.module("mailbox"));

const run_lib_unit_tests = b.addRunArtifact(lib_unit_tests);
Expand Down
4 changes: 4 additions & 0 deletions build.zig.zon
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@
.url = "https://github.com/g41797/mailbox/archive/master.tar.gz",
.hash = "12208d8777b69f62cccf70b4372d8c31a22bb022881279713d424689d6555532d389",
},
.@"zig-datetime" = .{
.url = "git+https://github.com/frmdstryr/zig-datetime#70aebf28fb3e137cd84123a9349d157a74708721",
.hash = "122077215ce36e125a490e59ec1748ffd4f6ba00d4d14f7308978e5360711d72d77f",
},
},
.paths = .{
"build.zig",
Expand Down
1 change: 0 additions & 1 deletion src/deps/zig-datetime
Submodule zig-datetime deleted from 70aebf
5 changes: 3 additions & 2 deletions src/timestamp.zig
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
const std = @import("std");
const string = @import("shortstring.zig");
const ShortString = string.ShortString;
pub const datetime = @import("deps/zig-datetime/src/datetime.zig");
pub const timezones = @import("deps/zig-datetime/src/timezones.zig");
pub const zig_dt = @import("zig-datetime");
pub const datetime = zig_dt.datetime;
pub const timezones = zig_dt.timezones;
//---------------------------------

// TIMESTAMP = NILVALUE / FULL-DATE "T" FULL-TIME
Expand Down

0 comments on commit 7541892

Please sign in to comment.