Skip to content

Commit ad0e179

Browse files
authored
fix build with Zig 0.14.0-dev.3445+6c3cbb0c8 (Breaking Change) (#20)
1 parent e1f281f commit ad0e179

File tree

4 files changed

+31
-14
lines changed

4 files changed

+31
-14
lines changed

.github/workflows/main.yml

+7-9
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,10 @@ jobs:
1515
fail-fast: false
1616
matrix:
1717
zig-version: [master]
18-
os: [ubuntu-latest, macos-latest, windows-latest]
19-
include:
20-
- zig-version: "0.12.0"
21-
os: ubuntu-latest
22-
- zig-version: "0.13.0"
23-
os: ubuntu-latest
18+
os: [ubuntu-22.04, macos-latest, windows-latest]
19+
# include:
20+
# - zig-version: "0.14.0"
21+
# os: ubuntu-22.04
2422
runs-on: ${{ matrix.os }}
2523
steps:
2624
- name: Checkout
@@ -32,7 +30,7 @@ jobs:
3230
version: ${{ matrix.zig-version }}
3331

3432
- name: Setup kcov
35-
if: github.repository_owner == 'zigtools' && matrix.os == 'ubuntu-latest' && matrix.zig-version == 'master'
33+
if: github.repository_owner == 'zigtools' && matrix.os == 'ubuntu-22.04' && matrix.zig-version == 'master'
3634
run: |
3735
wget https://github.com/SimonKagstrom/kcov/releases/download/v42/kcov-amd64.tar.gz
3836
sudo tar xf kcov-amd64.tar.gz -C /
@@ -44,11 +42,11 @@ jobs:
4442
run: zig build test --summary all
4543

4644
- name: Collect Coverage
47-
if: github.repository_owner == 'zigtools' && matrix.os == 'ubuntu-latest' && matrix.zig-version == 'master'
45+
if: github.repository_owner == 'zigtools' && matrix.os == 'ubuntu-22.04' && matrix.zig-version == 'master'
4846
run: zig build coverage --summary all
4947

5048
- name: Upload coverage reports to Codecov
51-
if: github.repository_owner == 'zigtools' && matrix.os == 'ubuntu-latest' && matrix.zig-version == 'master'
49+
if: github.repository_owner == 'zigtools' && matrix.os == 'ubuntu-22.04' && matrix.zig-version == 'master'
5250
uses: codecov/codecov-action@v5
5351
with:
5452
directory: zig-out/coverage/kcov-merged

README.md

+6-3
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,20 @@ Generates `std.json` compatible Zig code based on the official [LSP MetaModel](h
99

1010
## Installation
1111

12+
> [!NOTE]
13+
> The minimum supported Zig version is `0.14.0-dev.3445+6c3cbb0c8`.
14+
1215
```bash
1316
# Initialize a `zig build` project if you haven't already
1417
zig init
15-
# Add the `lsp-codegen` package to your `build.zig.zon`
18+
# Add the `lsp_codegen` package to your `build.zig.zon`
1619
zig fetch --save git+https://github.com/zigtools/zig-lsp-codegen.git
1720
```
1821

19-
You can then import `lsp-codegen` in your `build.zig` with:
22+
You can then import `lsp_codegen` in your `build.zig` with:
2023

2124
```zig
22-
const lsp_codegen = b.dependency("lsp-codegen", .{});
25+
const lsp_codegen = b.dependency("lsp_codegen", .{});
2326
const exe = b.addExecutable(...);
2427
exe.root_module.addImport("lsp", lsp_codegen.module("lsp"));
2528
```

build.zig

+15
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,21 @@
11
const std = @import("std");
2+
const builtin = @import("builtin");
3+
4+
const minimum_zig_version = std.SemanticVersion.parse("0.14.0-dev.3445+6c3cbb0c8") catch unreachable;
25

36
pub fn build(b: *std.Build) void {
7+
comptime if (builtin.zig_version.order(minimum_zig_version) == .lt) {
8+
@compileError(std.fmt.comptimePrint(
9+
\\Your Zig version does not meet the minimum build requirement:
10+
\\ required Zig version: {[minimum_zig_version]}
11+
\\ actual Zig version: {[current_version]}
12+
\\
13+
, .{
14+
.current_version = builtin.zig_version,
15+
.minimum_zig_version = minimum_zig_version,
16+
}));
17+
};
18+
419
const target = b.standardTargetOptions(.{});
520
const optimize = b.standardOptimizeOption(.{});
621

build.zig.zon

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
.{
2-
.name = "lsp-codegen",
2+
.name = .lsp_codegen,
33
.version = "0.1.0",
4-
.minimum_zig_version = "0.12.0",
4+
.minimum_zig_version = "0.14.0-dev.3445+6c3cbb0c8",
55
.dependencies = .{},
66
.paths = .{
77
"build.zig",
@@ -11,4 +11,5 @@
1111
"LICENSE",
1212
"README.md",
1313
},
14+
.fingerprint = 0x8c3c9a64a3e3c808, // Changing this has security and trust implications.
1415
}

0 commit comments

Comments
 (0)