diff --git a/.gitignore b/.gitignore index 1cbb7e3..49d1053 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ +/zig-out/ +/zig-cache/ **/.zig-cache/ **/.zig-out/ .idea/ @@ -8,4 +10,3 @@ src/deps/zig-datetime/.zig-out/ src/deps/zig-network/.zig-cache/ src/deps/zig-network/.zig-out/ - diff --git a/build.zig b/build.zig index f212ee9..a859ca3 100644 --- a/build.zig +++ b/build.zig @@ -15,6 +15,12 @@ pub fn build(b: *std.Build) void { // set a preferred release mode, allowing the user to decide how to optimize. const optimize = b.standardOptimizeOption(.{}); + const mailbox = b.dependency("mailbox", .{ + .target = target, + .optimize = optimize, + }); + + const lib = b.addStaticLibrary(.{ .name = "syslog", // In this case the main source file is merely a path, however, in more @@ -37,6 +43,8 @@ pub fn build(b: *std.Build) void { .optimize = optimize, }); + lib_unit_tests.root_module.addImport("mailbox", mailbox.module("mailbox")); + const run_lib_unit_tests = b.addRunArtifact(lib_unit_tests); // Similar to creating the run step earlier, this exposes a `test` step to diff --git a/build.zig.zon b/build.zig.zon index a5f5826..db12946 100644 --- a/build.zig.zon +++ b/build.zig.zon @@ -23,44 +23,11 @@ // Once all dependencies are fetched, `zig build` no longer requires // internet connectivity. .dependencies = .{ - // See `zig fetch --save ` for a command-line interface for adding dependencies. - //.example = .{ - // // When updating this field to a new URL, be sure to delete the corresponding - // // `hash`, otherwise you are communicating that you expect to find the old hash at - // // the new URL. - // .url = "https://example.com/foo.tar.gz", - // - // // This is computed from the file contents of the directory of files that is - // // obtained after fetching `url` and applying the inclusion rules given by - // // `paths`. - // // - // // This field is the source of truth; packages do not come from a `url`; they - // // come from a `hash`. `url` is just one of many possible mirrors for how to - // // obtain a package matching this `hash`. - // // - // // Uses the [multihash](https://multiformats.io/multihash/) format. - // .hash = "...", - // - // // When this is provided, the package is found in a directory relative to the - // // build root. In this case the package's hash is irrelevant and therefore not - // // computed. This field and `url` are mutually exclusive. - // .path = "foo", - - // // When this is set to `true`, a package is declared to be lazily - // // fetched. This makes the dependency only get fetched if it is - // // actually used. - // .lazy = false, - //}, + .mailbox = .{ + .url = "https://github.com/g41797/mailbox/archive/master.tar.gz", + .hash = "12208d8777b69f62cccf70b4372d8c31a22bb022881279713d424689d6555532d389", + }, }, - - // Specifies the set of files and directories that are included in this package. - // Only files and directories listed here are included in the `hash` that - // is computed for this package. Only files listed here will remain on disk - // when using the zig package manager. As a rule of thumb, one should list - // files required for compilation plus any license(s). - // Paths are relative to the build root. Use the empty string (`""`) to refer to - // the build root itself. - // A directory listed here means that all files within, recursively, are included. .paths = .{ "build.zig", "build.zig.zon", diff --git a/src/deps/mailbox b/src/deps/mailbox deleted file mode 160000 index 008a64f..0000000 --- a/src/deps/mailbox +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 008a64f061e8b14dd5ea5109f1eddb4b03bc2bfa diff --git a/src/syslog_tests.zig b/src/syslog_tests.zig index 387c298..0e77b68 100644 --- a/src/syslog_tests.zig +++ b/src/syslog_tests.zig @@ -1,7 +1,7 @@ //--------------------------------- const std = @import("std"); const testing = std.testing; -const mailbox = @import("deps/mailbox/src/mailbox.zig"); +const mailbox = @import("mailbox"); const syslog = @import("syslog.zig"); const transport = @import("transport.zig"); const rfc = @import("rfc5424.zig");