From be00db95e7ed3c0349fee1d7f82f94b9e97e5f57 Mon Sep 17 00:00:00 2001 From: Techatrix Date: Fri, 28 Jun 2024 18:49:42 +0200 Subject: [PATCH] fix build with Zig 0.12.0 --- build.zig | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/build.zig b/build.zig index d95c0bb..47ccd69 100644 --- a/build.zig +++ b/build.zig @@ -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(); }