const std = @import("std"); pub fn build(b: *std.Build) void { const target = b.standardTargetOptions(.{}); const optimize = b.standardOptimizeOption(.{}); const test_filters = b.option([]const []const u8, "test-filter", "Run only the tests whose names contain this text") orelse &.{}; const vaxis = b.dependency("vaxis", .{ .target = target, .optimize = optimize }); const root_module = b.createModule(.{ .root_source_file = b.path("src/main.zig"), .target = target, .optimize = optimize, .imports = &.{.{ .name = "vaxis", .module = vaxis.module("vaxis") }}, }); const exe = b.addExecutable(.{ .name = "jig", .root_module = root_module }); b.installArtifact(exe); const run = b.addRunArtifact(exe); run.step.dependOn(b.getInstallStep()); run.addPassthruArgs(); b.step("run", "Run jig").dependOn(&run.step); const tests = b.addTest(.{ .root_module = root_module, .filters = test_filters }); const test_step = b.step("test", "Run tests"); const run_tests = b.addRunArtifact(tests); // Some tests start the installed jig as a child process. run_tests.step.dependOn(b.getInstallStep()); run_tests.setCwd(b.path(".")); run_tests.setEnvironmentVariable("JIG_EXE", "zig-out/bin/jig"); test_step.dependOn(&run_tests.step); }