diff options
-rw-r--r-- | .gitignore | 9 | ||||
-rw-r--r-- | README.md | 2 | ||||
-rw-r--r-- | build.zig | 33 | ||||
-rw-r--r-- | gyro.zzz | 14 | ||||
-rw-r--r-- | src/lib.zig (renamed from src/nkeys.zig) | 0 | ||||
-rw-r--r-- | zig.mod | 5 |
6 files changed, 35 insertions, 28 deletions
@@ -1,3 +1,6 @@ | |||
1 | /zig-cache/ | 1 | zig-cache/ |
2 | /zig-out/ | 2 | zig-out/ |
3 | .DS_Store | 3 | deps.zig |
4 | .zigmod/ | ||
5 | .gyro/ | ||
6 | gyro.lock | ||
@@ -11,9 +11,7 @@ Contains a tool called `znk` which is a clone of the [`nk` tool](https://github. | |||
11 | 11 | ||
12 | Zig master works at the time of writing. | 12 | Zig master works at the time of writing. |
13 | 13 | ||
14 | Use `zig build` to build the library. | ||
15 | Use `zig build znk` to build the `znk` tool. | 14 | Use `zig build znk` to build the `znk` tool. |
16 | |||
17 | The `znk` tool can be run by using `zig build run-znk`. | 15 | The `znk` tool can be run by using `zig build run-znk`. |
18 | 16 | ||
19 | Tests for the library can be run by using `zig build test`. | 17 | Tests for the library can be run by using `zig build test`. |
@@ -1,47 +1,34 @@ | |||
1 | const std = @import("std"); | 1 | const std = @import("std"); |
2 | 2 | ||
3 | pub fn build(b: *std.build.Builder) !void { | 3 | pub fn build(b: *std.build.Builder) !void { |
4 | // Standard target options allows the person running `zig build` to choose | ||
5 | // what target to build for. Here we do not override the defaults, which | ||
6 | // means any target is allowed, and the default is native. Other options | ||
7 | // for restricting supported target set are available. | ||
8 | const target = b.standardTargetOptions(.{}); | ||
9 | |||
10 | // Standard release options allow the person running `zig build` to select | ||
11 | // between Debug, ReleaseSafe, ReleaseFast, and ReleaseSmall. | ||
12 | const mode = b.standardReleaseOptions(); | 4 | const mode = b.standardReleaseOptions(); |
5 | const target = b.standardTargetOptions(.{}); | ||
13 | 6 | ||
14 | const version = "0.1.0-dev"; | 7 | var lib_tests = b.addTest("src/lib.zig"); |
15 | |||
16 | const lib = b.addStaticLibrary("nkeys", "src/nkeys.zig"); | ||
17 | lib.setBuildMode(mode); | ||
18 | lib.addBuildOption([:0]const u8, "version", try b.allocator.dupeZ(u8, version)); | ||
19 | lib.install(); | ||
20 | |||
21 | var lib_tests = b.addTest("src/nkeys.zig"); | ||
22 | lib_tests.setBuildMode(mode); | 8 | lib_tests.setBuildMode(mode); |
23 | lib_tests.addBuildOption([:0]const u8, "version", try b.allocator.dupeZ(u8, version)); | ||
24 | 9 | ||
25 | const test_step = b.step("test", "Run library tests"); | 10 | const test_step = b.step("test", "Run library tests"); |
26 | test_step.dependOn(&lib_tests.step); | 11 | test_step.dependOn(&lib_tests.step); |
27 | 12 | ||
13 | const znk_version = "0.1.0"; | ||
14 | |||
28 | var znk_tests = b.addTest("tool/znk.zig"); | 15 | var znk_tests = b.addTest("tool/znk.zig"); |
29 | znk_tests.setBuildMode(mode); | 16 | znk_tests.setBuildMode(mode); |
30 | znk_tests.addPackagePath("nkeys", "src/nkeys.zig"); | 17 | znk_tests.addPackagePath("nkeys", "src/lib.zig"); |
31 | znk_tests.addBuildOption([:0]const u8, "version", try b.allocator.dupeZ(u8, version)); | 18 | znk_tests.addBuildOption([:0]const u8, "version", try b.allocator.dupeZ(u8, znk_version)); |
32 | 19 | ||
33 | const znk_test_step = b.step("test-znk", "Run znk tests"); | 20 | const znk_test_step = b.step("test-znk", "Run znk tests"); |
34 | znk_test_step.dependOn(&znk_tests.step); | 21 | znk_test_step.dependOn(&znk_tests.step); |
35 | 22 | ||
36 | const znk = b.addExecutable("znk", "tool/znk.zig"); | 23 | const znk = b.addExecutable("znk", "tool/znk.zig"); |
37 | znk.setTarget(target); | ||
38 | znk.setBuildMode(mode); | 24 | znk.setBuildMode(mode); |
39 | znk.addPackagePath("nkeys", "src/nkeys.zig"); | 25 | znk.setTarget(target); |
40 | znk.addBuildOption([:0]const u8, "version", try b.allocator.dupeZ(u8, version)); | 26 | znk.addPackagePath("nkeys", "src/lib.zig"); |
27 | znk.addBuildOption([:0]const u8, "version", try b.allocator.dupeZ(u8, znk_version)); | ||
41 | 28 | ||
42 | const znk_install = b.addInstallArtifact(znk); | 29 | const znk_install = b.addInstallArtifact(znk); |
43 | 30 | ||
44 | const znk_step = b.step("znk", "Build only znk"); | 31 | const znk_step = b.step("znk", "Build znk"); |
45 | znk_step.dependOn(&znk_install.step); | 32 | znk_step.dependOn(&znk_install.step); |
46 | 33 | ||
47 | const znk_run_cmd = znk.run(); | 34 | const znk_run_cmd = znk.run(); |
diff --git a/gyro.zzz b/gyro.zzz new file mode 100644 index 0000000..595c89c --- /dev/null +++ b/gyro.zzz | |||
@@ -0,0 +1,14 @@ | |||
1 | pkgs: | ||
2 | nkeys: | ||
3 | version: 0.1.0 | ||
4 | description: "NKeys support for Zig" | ||
5 | license: Apache-2.0 | ||
6 | source_url: "https://github.com/rutgerbrf/zig-nkeys" | ||
7 | tags: | ||
8 | nats | ||
9 | |||
10 | root: src/lib.zig | ||
11 | files: | ||
12 | README.md | ||
13 | LICENSE | ||
14 | src/*.zig | ||
diff --git a/src/nkeys.zig b/src/lib.zig index 05922bd..05922bd 100644 --- a/src/nkeys.zig +++ b/src/lib.zig | |||
@@ -0,0 +1,5 @@ | |||
1 | id: vuocvcwmrmaabg3x916i1wnir9c6vuwqv6uwbm7rn5ks9vab | ||
2 | name: nkeys | ||
3 | main: src/lib.zig | ||
4 | license: Apache-2.0 | ||
5 | dependencies: | ||