Skip to content

Commit

Permalink
fix build with Zig 0.12.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Techatrix committed Jun 28, 2024
1 parent b283335 commit be00db9
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -83,18 +83,23 @@ pub fn build(b: *std.Build) void {

// ----------------------------- Code Coverage -----------------------------

const addOutputDirectoryArg = comptime if (@import("builtin").zig_version.order(.{ .major = 0, .minor = 13, .patch = 0 }) == .lt)
std.Build.Step.Run.addOutputFileArg
else
std.Build.Step.Run.addOutputDirectoryArg;

const kcov_merge = std.Build.Step.Run.create(b, "kcov merge coverage");
kcov_merge.rename_step_with_output_arg = false;
kcov_merge.addArg("kcov");
kcov_merge.addArg("--merge");
const coverage_output = kcov_merge.addOutputDirectoryArg(".");
const coverage_output = addOutputDirectoryArg(kcov_merge, ".");

for ([_]*std.Build.Step.Compile{ lsp_tests, lsp_parser_tests }) |test_artifact| {
const kcov_collect = std.Build.Step.Run.create(b, "kcov collect coverage");
kcov_collect.addArg("kcov");
kcov_collect.addArg("--collect-only");
kcov_collect.addPrefixedDirectoryArg("--include-pattern=", b.path("."));
kcov_merge.addDirectoryArg(kcov_collect.addOutputDirectoryArg(test_artifact.name));
kcov_merge.addDirectoryArg(addOutputDirectoryArg(kcov_collect, test_artifact.name));
kcov_collect.addArtifactArg(test_artifact);
kcov_collect.enableTestRunnerMode();
}
Expand Down

0 comments on commit be00db9

Please sign in to comment.