Files
openidea/fixtures/zig-app/build.zig
T
Akbar Husain 6449b68bb0 feat(debug): debug Zig under CodeLLDB (#3392)
Zig programs now debug under CodeLLDB with sourceLanguages: [] so expressions aren't evaluated as Rust; the context menu of a closed .zig file reads its content; rerunning failed tests of a zig build test step derives a standalone zig test from the module root detect/zig.rs records per step (zig build forwards no args to the test binary). Adds the zig-app fixture's failing test step and run/debug smoke cases. The Language smoke CI job for zig is left for a separate change.

Part of #3260

Co-authored-by: akbar1214 <43771058+akbar1214@users.noreply.github.com>
2026-11-15 17:13:12 +08:00

39 lines
1.3 KiB
Zig

const std = @import("std");
pub fn build(b: *std.Build) void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
const tally = b.addModule("tally", .{
.root_source_file = b.path("src/tally.zig"),
.target = target,
});
const exe = b.addExecutable(.{
.name = "zig-app",
.root_module = b.createModule(.{
.root_source_file = b.path("src/main.zig"),
.target = target,
.optimize = optimize,
.imports = &.{.{ .name = "tally", .module = tally }},
}),
});
b.installArtifact(exe);
const run_cmd = b.addRunArtifact(exe);
run_cmd.step.dependOn(b.getInstallStep());
const run_step = b.step("run", "Run the app");
run_step.dependOn(&run_cmd.step);
const tests = b.addTest(.{ .root_module = tally });
const test_step = b.step("test", "Run the tests");
test_step.dependOn(&b.addRunArtifact(tests).step);
const failing_tests = b.addTest(.{ .root_module = b.createModule(.{
.root_source_file = b.path("src/failing.zig"),
.target = target,
}) });
const test_failing_step = b.step("test-failing", "Run the tests that fail on purpose");
test_failing_step.dependOn(&b.addRunArtifact(failing_tests).step);
}