From 460ca7a420f2601fd42e9ac59dc9626a2c7589f5 Mon Sep 17 00:00:00 2001 From: kcbanner Date: Tue, 28 May 2024 23:56:02 -0400 Subject: [PATCH 1/5] Fixup stderr locking --- src/main.zig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main.zig b/src/main.zig index 458f6c410..02ecae580 100644 --- a/src/main.zig +++ b/src/main.zig @@ -25,8 +25,8 @@ fn logFn( const scope_txt = comptime @tagName(scope); const stderr = std.io.getStdErr().writer(); - std.debug.getStderrMutex().lock(); - defer std.debug.getStderrMutex().unlock(); + std.debug.lockStdErr(); + defer std.debug.unlockStdErr(); stderr.print("{s:<5}: ({s:^6}): ", .{ level_txt, if (comptime std.mem.startsWith(u8, scope_txt, "zls_")) scope_txt[4..] else scope_txt }) catch return; stderr.print(format, args) catch return; From 4f65754aabf7cc17ea2eaf302158794721158e77 Mon Sep 17 00:00:00 2001 From: Techatrix <19954306+Techatrix@users.noreply.github.com> Date: Wed, 29 May 2024 22:19:00 +0200 Subject: [PATCH 2/5] Fixup stderr locking in tests --- tests/lsp_features/completion.zig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/lsp_features/completion.zig b/tests/lsp_features/completion.zig index 306b979e6..b8c9e9be6 100644 --- a/tests/lsp_features/completion.zig +++ b/tests/lsp_features/completion.zig @@ -3585,8 +3585,8 @@ fn searchCompletionItemWithLabel(completion_list: types.CompletionList, label: [ if (std.mem.eql(u8, item.label, label)) return item; } - std.debug.getStderrMutex().lock(); - defer std.debug.getStderrMutex().unlock(); + std.debug.lockStdErr(); + defer std.debug.unlockStdErr(); const stderr = std.io.getStdErr().writer(); From 6a571021573aa5ac554066915d7e6373419ba66f Mon Sep 17 00:00:00 2001 From: Techatrix <19954306+Techatrix@users.noreply.github.com> Date: Wed, 29 May 2024 21:51:58 +0200 Subject: [PATCH 3/5] fix build runner compatibility with Zig `0.13.0-dev.336+963ffe9d5` --- src/build_runner/0.12.0.zig | 48 ++++++++++++++++++++++++------------- 1 file changed, 31 insertions(+), 17 deletions(-) diff --git a/src/build_runner/0.12.0.zig b/src/build_runner/0.12.0.zig index a48ad0c74..307c8fca4 100644 --- a/src/build_runner/0.12.0.zig +++ b/src/build_runner/0.12.0.zig @@ -19,6 +19,16 @@ const Step = std.Build.Step; pub const dependencies = @import("@dependencies"); +const writeFile2_removed_version = + std.SemanticVersion.parse("0.13.0-dev.68+b86c4bde6") catch unreachable; +const std_progress_rework_version = + std.SemanticVersion.parse("0.13.0-dev.336+963ffe9d5") catch unreachable; + +const ProgressNode = if (builtin.zig_version.order(std_progress_rework_version) == .lt) + *std.Progress.Node +else + std.Progress.Node; + ///! This is a modified build runner to extract information out of build.zig ///! Modified version of lib/build_runner.zig pub fn main() !void { @@ -276,13 +286,21 @@ pub fn main() !void { } } - var progress: std.Progress = .{ .terminal = null }; - const main_progress_node = progress.start("", 0); + var progress = if (comptime builtin.zig_version.order(std_progress_rework_version) == .lt) + std.Progress{ .terminal = null } + else {}; + + const main_progress_node = if (comptime builtin.zig_version.order(std_progress_rework_version) == .lt) + progress.start("", 0) + else + std.Progress.start(.{ + .disable_printing = true, + }); builder.debug_log_scopes = debug_log_scopes.items; builder.resolveInstallPrefix(install_prefix, dir_list); { - var prog_node = main_progress_node.start("user build.zig logic", 0); + var prog_node = main_progress_node.start("Configure", 0); defer prog_node.end(); try builder.runBuild(root); } @@ -296,14 +314,10 @@ pub fn main() !void { const s = std.fs.path.sep_str; const tmp_sub_path = "tmp" ++ s ++ (output_tmp_nonce orelse fatal("missing -Z arg", .{})); - const writeFileFn = comptime blk: { - const writeFile2_removed_version = - std.SemanticVersion.parse("0.13.0-dev.68+b86c4bde6") catch unreachable; - break :blk if (builtin.zig_version.order(writeFile2_removed_version) == .lt) - std.fs.Dir.writeFile2 - else - std.fs.Dir.writeFile; - }; + const writeFileFn = if (comptime builtin.zig_version.order(writeFile2_removed_version) == .lt) + std.fs.Dir.writeFile2 + else + std.fs.Dir.writeFile; writeFileFn(local_cache_directory.handle, .{ .sub_path = tmp_sub_path, @@ -363,7 +377,7 @@ fn runSteps( arena: std.mem.Allocator, b: *std.Build, steps: []const *Step, - parent_prog_node: *std.Progress.Node, + parent_prog_node: ProgressNode, thread_pool_options: std.Thread.Pool.Options, run: *Run, seed: u32, @@ -426,7 +440,7 @@ fn runSteps( wait_group.start(); thread_pool.spawn(workerMakeOneStep, .{ - &wait_group, &thread_pool, b, step, &step_prog, run, + &wait_group, &thread_pool, b, step, if (comptime builtin.zig_version.order(std_progress_rework_version) == .lt) &step_prog else step_prog, run, }) catch @panic("OOM"); } } @@ -541,7 +555,7 @@ fn workerMakeOneStep( thread_pool: *std.Thread.Pool, b: *std.Build, s: *Step, - prog_node: *std.Progress.Node, + prog_node: ProgressNode, run: *Run, ) void { defer wg.finish(); @@ -594,10 +608,10 @@ fn workerMakeOneStep( } var sub_prog_node = prog_node.start(s.name, 0); - sub_prog_node.activate(); + if (comptime builtin.zig_version.order(std_progress_rework_version) == .lt) sub_prog_node.activate(); defer sub_prog_node.end(); - const make_result = s.make(&sub_prog_node); + const make_result = s.make(if (comptime builtin.zig_version.order(std_progress_rework_version) == .lt) &sub_prog_node else sub_prog_node); handle_result: { if (make_result) |_| { @@ -745,7 +759,7 @@ const Packages = struct { fn extractBuildInformation( b: *std.Build, arena: std.mem.Allocator, - main_progress_node: *std.Progress.Node, + main_progress_node: ProgressNode, thread_pool_options: std.Thread.Pool.Options, run: *Run, seed: u32, From 80e5ea9f756cc93e86f595a939480c4f37a03dcf Mon Sep 17 00:00:00 2001 From: Techatrix <19954306+Techatrix@users.noreply.github.com> Date: Wed, 29 May 2024 21:52:08 +0200 Subject: [PATCH 4/5] set minimum build version to `0.13.0-dev.336+963ffe9d5` --- build.zig | 4 ++-- build.zig.zon | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/build.zig b/build.zig index c84d6ef23..a9a0556d9 100644 --- a/build.zig +++ b/build.zig @@ -7,10 +7,10 @@ const zls_version = std.SemanticVersion{ .major = 0, .minor = 13, .patch = 0 }; const zls_version_is_tagged: bool = false; /// Specify the minimum Zig version that is required to compile and test ZLS: -/// Run: add output directory arguments +/// rework std.Progress /// /// Must match the `minimum_zig_version` in `build.zig.zon`. -const minimum_zig_version = "0.13.0-dev.79+6bc0cef60"; +const minimum_zig_version = "0.13.0-dev.336+963ffe9d5"; /// Specify the minimum Zig version that is required to run ZLS: /// Release 0.12.0 diff --git a/build.zig.zon b/build.zig.zon index 7f9f0b8ce..4ee4c900e 100644 --- a/build.zig.zon +++ b/build.zig.zon @@ -3,7 +3,7 @@ // Must match the `zls_version` in `build.zig` .version = "0.13.0-dev", // Must match the `minimum_zig_version` in `build.zig` - .minimum_zig_version = "0.13.0-dev.79+6bc0cef60", + .minimum_zig_version = "0.13.0-dev.336+963ffe9d5", // whenever the dependencies are updated, run `nix run github:acristoffers/zon2nix > deps.nix` .dependencies = .{ .known_folders = .{ From 23c59a50243ee1ba7c6cdd301559fc1e48d85596 Mon Sep 17 00:00:00 2001 From: Techatrix <19954306+Techatrix@users.noreply.github.com> Date: Thu, 30 May 2024 21:57:41 +0200 Subject: [PATCH 5/5] flake.lock: Update MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Flake lock file updates: • Updated input 'nixpkgs': 'github:NixOS/nixpkgs/9ddcaffecdf098822d944d4147dd8da30b4e6843' (2024-05-14) → 'github:NixOS/nixpkgs/9d29cd266cebf80234c98dd0b87256b6be0af44e' (2024-05-25) • Updated input 'zig-overlay': 'github:mitchellh/zig-overlay/03303bf01701b04ec87c55ce5d8d6f5ecf86d0a7' (2024-05-15) → 'github:mitchellh/zig-overlay/75299222cdd0680737fe8e556a259833386c42b9' (2024-05-30) • Updated input 'zig-overlay/flake-compat': 'github:edolstra/flake-compat/35bb57c0c8d8b62bbfd284272c928ceb64ddbde9' (2023-01-17) → 'github:edolstra/flake-compat/0f9255e01c2351cc7d116c072cb317785dd33b33' (2023-10-04) • Updated input 'zig-overlay/flake-utils': 'github:numtide/flake-utils/c0e246b9b83f637f4681389ecabcb2681b4f3af0' (2022-08-07) → 'github:numtide/flake-utils/1ef2e671c3b0c19053962c07dbda38332dcebf26' (2024-01-15) • Added input 'zig-overlay/flake-utils/systems': 'github:nix-systems/default/da67096a3b9bf56a91d16901293e51ba5b49a27e' (2023-04-09) --- flake.lock | 42 ++++++++++++++++++++++++++++++------------ 1 file changed, 30 insertions(+), 12 deletions(-) diff --git a/flake.lock b/flake.lock index fce01f690..e6501c48a 100644 --- a/flake.lock +++ b/flake.lock @@ -3,11 +3,11 @@ "flake-compat": { "flake": false, "locked": { - "lastModified": 1673956053, - "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", + "lastModified": 1696426674, + "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", "owner": "edolstra", "repo": "flake-compat", - "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", + "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", "type": "github" }, "original": { @@ -35,12 +35,15 @@ } }, "flake-utils_2": { + "inputs": { + "systems": "systems_2" + }, "locked": { - "lastModified": 1659877975, - "narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=", + "lastModified": 1705309234, + "narHash": "sha256-uNRRNRKmJyCRC/8y1RqBkqWBLM034y4qN7EprSdmgyA=", "owner": "numtide", "repo": "flake-utils", - "rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0", + "rev": "1ef2e671c3b0c19053962c07dbda38332dcebf26", "type": "github" }, "original": { @@ -83,11 +86,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1715668745, - "narHash": "sha256-xp62OkRkbUDNUc6VSqH02jB0FbOS+MsfMb7wL1RJOfA=", + "lastModified": 1716633019, + "narHash": "sha256-xim1b5/HZYbWaZKyI7cn9TJCM6ewNVZnesRr00mXeS4=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "9ddcaffecdf098822d944d4147dd8da30b4e6843", + "rev": "9d29cd266cebf80234c98dd0b87256b6be0af44e", "type": "github" }, "original": { @@ -121,6 +124,21 @@ "type": "github" } }, + "systems_2": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, "zig-overlay": { "inputs": { "flake-compat": "flake-compat", @@ -130,11 +148,11 @@ ] }, "locked": { - "lastModified": 1715775020, - "narHash": "sha256-CCqc3c3yvXgRaTW18epSHlF2HeikwNXqxnlrRs2sl3Y=", + "lastModified": 1717070964, + "narHash": "sha256-lfaVbVY1Ckn/696ovjhDAIxE5U8evp0J/rMFnxnQpNE=", "owner": "mitchellh", "repo": "zig-overlay", - "rev": "03303bf01701b04ec87c55ce5d8d6f5ecf86d0a7", + "rev": "75299222cdd0680737fe8e556a259833386c42b9", "type": "github" }, "original": {