From 791aff18acaf8fec4fd41964a1e05beed9346c06 Mon Sep 17 00:00:00 2001 From: Matthew Knight Date: Sat, 30 May 2026 10:03:27 -0700 Subject: [PATCH 1/4] Update build args and find program for API changes This does change the usage of hello client subcommand. Before we had an assumption that if only one arg was passedd in, you'd default to the hello server. If you passed more than one in, the second argument is expected to be a path to the server binary. With the changes to Zig master, we can only pass through the args on the commandline, not inspect them. I've worked around this behavior by passing in the server binary explicitly using a named option over an arg positional. --- build.zig | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/build.zig b/build.zig index 5d5d112..0c2a4b4 100644 --- a/build.zig +++ b/build.zig @@ -118,11 +118,13 @@ pub fn build(b: *std.Build) void { b.installArtifact(hello_client_exe); const run_hello_client = b.addRunArtifact(hello_client_exe); - if (b.args) |args| { - run_hello_client.addArgs(args); - if (args.len == 1) { - run_hello_client.addArtifactArg(hello_server_exe); - } + run_hello_client.addPassthruArgs(); + + const server_path_opt = b.option([]const u8, "server_path", "Set server path for run-hello-client"); + if (server_path_opt) |server_path| { + run_hello_client.addArg(server_path); + } else { + run_hello_client.addArtifactArg(hello_server_exe); } const run_hello_client_step = b.step("run-hello-client", "Run the hello-client example"); @@ -166,7 +168,9 @@ pub fn build(b: *std.Build) void { // ----------------------------- Code Coverage ----------------------------- - const kcov_bin = b.findProgram(&.{"kcov"}, &.{}) catch "kcov"; + const kcov_bin = b.findProgram(.{ + .names = &.{"kcov"}, + }) orelse "kcov"; const kcov_merge = std.Build.Step.Run.create(b, "kcov merge coverage"); kcov_merge.rename_step_with_output_arg = false; From 1e6edd28b68278e7f3a4ef35dda74b638ca7aa8b Mon Sep 17 00:00:00 2001 From: Matthew Knight Date: Sat, 30 May 2026 10:10:34 -0700 Subject: [PATCH 2/4] point CI at master --- .github/workflows/gh-pages.yml | 2 +- .github/workflows/main.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/gh-pages.yml b/.github/workflows/gh-pages.yml index 3379b4e..6bd5281 100644 --- a/.github/workflows/gh-pages.yml +++ b/.github/workflows/gh-pages.yml @@ -32,7 +32,7 @@ jobs: - name: Setup Zig uses: mlugg/setup-zig@v2 with: - version: 0.16.0 + version: master - name: Generate Documentation run: zig build docs --summary all diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index d952da8..23b2d1d 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -23,7 +23,7 @@ jobs: - name: Setup Zig uses: mlugg/setup-zig@v2 with: - version: 0.16.0 + version: master - name: Setup kcov if: github.repository_owner == 'zigtools' && matrix.os == 'ubuntu-22.04' From fa21291a8177ef6a4e34ec601301eb0db7284284 Mon Sep 17 00:00:00 2001 From: Matthew Knight Date: Sat, 30 May 2026 10:40:13 -0700 Subject: [PATCH 3/4] Address code review feedback --- README.md | 2 +- build.zig | 8 ++++---- build.zig.zon | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 0f3f249..b3110dd 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ Provides the necessary building blocks to develop Language Server Protocol imple # Installation > [!NOTE] -> The default branch requires Zig `0.16.0` or later. +> The default branch requires Zig `0.17.0-dev.607+456b2ec07` or later. ```bash # Initialize a `zig build` project if you haven't already diff --git a/build.zig b/build.zig index 0c2a4b4..94d4722 100644 --- a/build.zig +++ b/build.zig @@ -168,19 +168,19 @@ pub fn build(b: *std.Build) void { // ----------------------------- Code Coverage ----------------------------- - const kcov_bin = b.findProgram(.{ + const kcov_bin = b.findProgramLazy(.{ .names = &.{"kcov"}, - }) orelse "kcov"; + }) orelse @panic("Failed to find kcov"); const kcov_merge = std.Build.Step.Run.create(b, "kcov merge coverage"); kcov_merge.rename_step_with_output_arg = false; - kcov_merge.addArg(kcov_bin); + kcov_merge.addFileArg(kcov_bin); kcov_merge.addArg("--merge"); const coverage_output = kcov_merge.addOutputDirectoryArg("."); 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_bin); + kcov_collect.addFileArg(kcov_bin); kcov_collect.addArg("--collect-only"); kcov_collect.addPrefixedDirectoryArg("--include-path=", b.path(".")); kcov_merge.addDirectoryArg(kcov_collect.addOutputDirectoryArg(test_artifact.name)); diff --git a/build.zig.zon b/build.zig.zon index c4e1424..3b9ca90 100644 --- a/build.zig.zon +++ b/build.zig.zon @@ -1,7 +1,7 @@ .{ .name = .lsp_kit, .version = "0.1.0", - .minimum_zig_version = "0.16.0", + .minimum_zig_version = "0.17.0-dev.607+456b2ec07", .dependencies = .{}, .paths = .{ "build.zig", From b868680c4bea5bf1c2f438d7508ea43958ef1b7a Mon Sep 17 00:00:00 2001 From: Matthew Knight Date: Sat, 30 May 2026 10:49:34 -0700 Subject: [PATCH 4/4] don't panic --- build.zig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.zig b/build.zig index 94d4722..fd49055 100644 --- a/build.zig +++ b/build.zig @@ -170,7 +170,7 @@ pub fn build(b: *std.Build) void { const kcov_bin = b.findProgramLazy(.{ .names = &.{"kcov"}, - }) orelse @panic("Failed to find kcov"); + }); const kcov_merge = std.Build.Step.Run.create(b, "kcov merge coverage"); kcov_merge.rename_step_with_output_arg = false;