Skip to content

Commit 9c27090

Browse files
committed
Add build.zig.zon, update build.zig, .gitignore
This adds a test running step and a zig.zon manifest. Also adds to the .gitignore the new location of caches, .zig-out.
1 parent ef45c00 commit 9c27090

3 files changed

Lines changed: 39 additions & 1 deletion

File tree

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
zig-cache
1+
zig-*
2+
.zig-*

build.zig

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,33 @@
11
const std = @import("std");
22

33
pub fn build(b: *std.Build) void {
4+
const target = b.standardTargetOptions(.{});
5+
const optimize = b.standardOptimizeOption(.{});
6+
47
_ = b.addModule("diffz", .{
58
.root_source_file = b.path("DiffMatchPatch.zig"),
69
});
10+
11+
const lib = b.addStaticLibrary(.{
12+
.name = "diffz",
13+
.root_source_file = b.path("DiffMatchPatch.zig"),
14+
.target = target,
15+
.optimize = optimize,
16+
});
17+
18+
// This declares intent for the library to be installed into the standard
19+
// location when the user invokes the "install" step (the default step when
20+
// running `zig build`).
21+
b.installArtifact(lib);
22+
23+
// Run tests
24+
const tests = b.addTest(.{
25+
.name = "tests",
26+
.root_source_file = b.path("DiffMatchPatch.zig"),
27+
.target = target,
28+
.optimize = optimize,
29+
});
30+
const step_tests = b.addRunArtifact(tests);
31+
32+
b.step("test", "Run diffz tests").dependOn(&step_tests.step);
733
}

build.zig.zon

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
.{
2+
.name = "DiffMatchPatch",
3+
.version = "0.0.1",
4+
.paths = .{
5+
"DiffMatchPatch.zig",
6+
"LICENSE",
7+
"README.md",
8+
"build.zig.zon",
9+
"build.zig",
10+
},
11+
}

0 commit comments

Comments
 (0)