Skip to content

Commit 67177e3

Browse files
AndrewKraevskiileecannon
authored andcommitted
Use build.zig.zon as source of truth
1 parent 46b811c commit 67177e3

File tree

2 files changed

+5
-19
lines changed

2 files changed

+5
-19
lines changed

build.zig

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,7 @@
11
const std = @import("std");
22
const builtin = @import("builtin");
33

4-
/// Must match the `version` in `build.zig.zon`.
5-
/// Remove `.pre` when tagging a new ZLS release and add it back on the next development cycle.
6-
const zls_version: std.SemanticVersion = .{ .major = 0, .minor = 16, .patch = 0, .pre = "dev" };
7-
8-
comptime {
9-
const version_in_build_zig_zon = std.SemanticVersion.parse(@import("build.zig.zon").version) catch unreachable;
10-
std.debug.assert(zls_version.order(version_in_build_zig_zon) == .eq);
11-
}
4+
const zls_version = std.SemanticVersion.parse(@import("build.zig.zon").version) catch unreachable;
125

136
/// Specify the minimum Zig version that is required to compile and test ZLS:
147
/// Add error bundle support to `translate-c`, unify `cmdTranslateC` and `cImport`
@@ -18,15 +11,7 @@ comptime {
1811
/// ```bash
1912
/// nix flake update --commit-lock-file
2013
/// ```
21-
///
22-
/// Also update the `minimum_zig_version` in `build.zig.zon`.
23-
const minimum_build_zig_version = "0.16.0-dev.728+87c18945c";
24-
25-
comptime {
26-
const parsed_minimum_build_zig_version = std.SemanticVersion.parse(minimum_build_zig_version) catch unreachable;
27-
const version_in_build_zig_zon = std.SemanticVersion.parse(@import("build.zig.zon").minimum_zig_version) catch unreachable;
28-
std.debug.assert(parsed_minimum_build_zig_version.order(version_in_build_zig_zon) == .eq);
29-
}
14+
const minimum_build_zig_version = @import("build.zig.zon").minimum_zig_version;
3015

3116
/// Specify the minimum Zig version that is usable with ZLS:
3217
/// Release 0.15.1

build.zig.zon

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
.{
22
.name = .zls,
3-
// Must match the `zls_version` in `build.zig`
3+
// Used by build.zig.
4+
// Remove `-dev` when tagging a new ZLS release and add it back on the next development cycle.
45
.version = "0.16.0-dev",
5-
// Must be kept in line with the `minimum_build_zig_version` in `build.zig`.
6+
// Used by build.zig.
67
// Should be a Zig version that is downloadable from https://ziglang.org/download/ or a mirror.
78
.minimum_zig_version = "0.16.0-dev.728+87c18945c",
89
// If you do not use Nix, a ZLS maintainer can take care of this.

0 commit comments

Comments
 (0)