summaryrefslogtreecommitdiff
path: root/build.zig
diff options
context:
space:
mode:
Diffstat (limited to 'build.zig')
-rw-r--r--build.zig27
1 files changed, 11 insertions, 16 deletions
diff --git a/build.zig b/build.zig
index 20ac769..d19e91e 100644
--- a/build.zig
+++ b/build.zig
@@ -20,14 +20,18 @@ pub fn build(b: *Build) void {
20 const exe = b.addExecutable(.{ 20 const exe = b.addExecutable(.{
21 .name = "zup", 21 .name = "zup",
22 .version = version, 22 .version = version,
23 .root_source_file = b.path("src/main.zig"), 23 .root_module = b.createModule(.{
24 .target = target, 24 .root_source_file = b.path("src/main.zig"),
25 .optimize = optimize, 25 .target = target,
26 .optimize = optimize,
27 .imports = &.{
28 .{ .name = "clap", .module = clap.module("clap") },
29 .{ .name = "libarchive", .module = libarchive.module("libarchive") },
30 .{ .name = "xdg", .module = xdg.module("xdg") },
31 },
32 }),
26 }); 33 });
27 exe.root_module.addOptions("zup-config", config); 34 exe.root_module.addOptions("zup-config", config);
28 exe.root_module.addImport("clap", clap.module("clap"));
29 exe.root_module.addImport("libarchive", libarchive.module("libarchive"));
30 exe.root_module.addImport("xdg", xdg.module("xdg"));
31 b.installArtifact(exe); 35 b.installArtifact(exe);
32 36
33 const run_cmd = b.addRunArtifact(exe); 37 const run_cmd = b.addRunArtifact(exe);
@@ -38,18 +42,9 @@ pub fn build(b: *Build) void {
38 42
39 const run_step = b.step("run", "Run the app"); 43 const run_step = b.step("run", "Run the app");
40 run_step.dependOn(&run_cmd.step); 44 run_step.dependOn(&run_cmd.step);
41
42 const exe_tests = b.addTest(.{
43 .root_source_file = b.path("src/main.zig"),
44 .target = target,
45 .optimize = optimize,
46 });
47
48 const test_step = b.step("test", "Run unit tests");
49 test_step.dependOn(&exe_tests.step);
50} 45}
51 46
52const default_version = SemanticVersion.parse("0.5.0") catch unreachable; 47const default_version = SemanticVersion.parse("0.7.0-indev") catch unreachable;
53 48
54fn getVersion(b: *Build) SemanticVersion { 49fn getVersion(b: *Build) SemanticVersion {
55 var out_code: u8 = undefined; 50 var out_code: u8 = undefined;