Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix build with Zig 0.14.0-dev.3445+6c3cbb0c8 #20

Merged
merged 1 commit into from
Mar 1, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 7 additions & 9 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,10 @@ jobs:
fail-fast: false
matrix:
zig-version: [master]
os: [ubuntu-latest, macos-latest, windows-latest]
include:
- zig-version: "0.12.0"
os: ubuntu-latest
- zig-version: "0.13.0"
os: ubuntu-latest
os: [ubuntu-22.04, macos-latest, windows-latest]
# include:
# - zig-version: "0.14.0"
# os: ubuntu-22.04
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
Expand All @@ -32,7 +30,7 @@ jobs:
version: ${{ matrix.zig-version }}

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

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

- name: Upload coverage reports to Codecov
if: github.repository_owner == 'zigtools' && matrix.os == 'ubuntu-latest' && matrix.zig-version == 'master'
if: github.repository_owner == 'zigtools' && matrix.os == 'ubuntu-22.04' && matrix.zig-version == 'master'
uses: codecov/codecov-action@v5
with:
directory: zig-out/coverage/kcov-merged
Expand Down
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,20 @@ Generates `std.json` compatible Zig code based on the official [LSP MetaModel](h

## Installation

> [!NOTE]
> The minimum supported Zig version is `0.14.0-dev.3445+6c3cbb0c8`.

```bash
# Initialize a `zig build` project if you haven't already
zig init
# Add the `lsp-codegen` package to your `build.zig.zon`
# Add the `lsp_codegen` package to your `build.zig.zon`
zig fetch --save git+https://github.com/zigtools/zig-lsp-codegen.git
```

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

```zig
const lsp_codegen = b.dependency("lsp-codegen", .{});
const lsp_codegen = b.dependency("lsp_codegen", .{});
const exe = b.addExecutable(...);
exe.root_module.addImport("lsp", lsp_codegen.module("lsp"));
```
15 changes: 15 additions & 0 deletions build.zig
Original file line number Diff line number Diff line change
@@ -1,6 +1,21 @@
const std = @import("std");
const builtin = @import("builtin");

const minimum_zig_version = std.SemanticVersion.parse("0.14.0-dev.3445+6c3cbb0c8") catch unreachable;

pub fn build(b: *std.Build) void {
comptime if (builtin.zig_version.order(minimum_zig_version) == .lt) {
@compileError(std.fmt.comptimePrint(
\\Your Zig version does not meet the minimum build requirement:
\\ required Zig version: {[minimum_zig_version]}
\\ actual Zig version: {[current_version]}
\\
, .{
.current_version = builtin.zig_version,
.minimum_zig_version = minimum_zig_version,
}));
};

const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});

Expand Down
5 changes: 3 additions & 2 deletions build.zig.zon
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.{
.name = "lsp-codegen",
.name = .lsp_codegen,
.version = "0.1.0",
.minimum_zig_version = "0.12.0",
.minimum_zig_version = "0.14.0-dev.3445+6c3cbb0c8",
.dependencies = .{},
.paths = .{
"build.zig",
Expand All @@ -11,4 +11,5 @@
"LICENSE",
"README.md",
},
.fingerprint = 0x8c3c9a64a3e3c808, // Changing this has security and trust implications.
}