Skip to content

Commit

Permalink
fix build with Zig 0.14.0-dev.3445+6c3cbb0c8 (Breaking Change) (#57)
Browse files Browse the repository at this point in the history
  • Loading branch information
Techatrix authored Mar 1, 2025
1 parent 1cceeb7 commit aa24df4
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 18 deletions.
11 changes: 3 additions & 8 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,9 @@ jobs:
matrix:
zig-version: [master]
os: [ubuntu-latest, macos-latest, windows-latest]
include:
- zig-version: "0.12.1"
os: ubuntu-latest
- zig-version: "0.13.0"
os: ubuntu-latest
# include:
# - zig-version: "0.14.0"
# os: ubuntu-latest
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
Expand All @@ -35,8 +33,6 @@ jobs:
- name: Setup `wasmtime`
if: matrix.os == 'ubuntu-latest'
uses: bytecodealliance/actions/wasmtime/setup@v1
with:
version: "21.0.1" # Wasmtime v22.0.0 has removed support for the "Wasmtime 13-and-prior CLI"

- name: Print wasmtime version
if: matrix.os == 'ubuntu-latest'
Expand All @@ -46,5 +42,4 @@ jobs:
if: matrix.os == 'ubuntu-latest'
run: zig build test -Dtarget=wasm32-wasi -fwasmtime --summary all
env:
WASMTIME_NEW_CLI: 0
WASMTIME_BACKTRACE_DETAILS: 1
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,16 @@ pub fn getPath(allocator: std.mem.Allocator, folder: KnownFolder) Error!?[]const

## Installation

> [!NOTE]
> The minimum supported Zig version is `0.14.0-dev.3445+6c3cbb0c8`.
Initialize a `zig build` project if you haven't already.

```bash
zig init
```

Add the `known-folders` package to your `build.zig.zon`.
Add the `known_folders` package to your `build.zig.zon`.

```bash
zig fetch --save git+https://github.com/ziglibs/known-folders.git
Expand All @@ -60,7 +63,7 @@ zig fetch --save git+https://github.com/ziglibs/known-folders.git
You can then import `known-folders` in your `build.zig` with:

```zig
const known_folders = b.dependency("known-folders", .{}).module("known-folders");
const known_folders = b.dependency("known_folders", .{}).module("known-folders");
const exe = b.addExecutable(...);
// This adds the known-folders module to the executable which can then be imported with `@import("known-folders")`
exe.root_module.addImport("known-folders", known_folders);
Expand Down
9 changes: 3 additions & 6 deletions build.zig
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const std = @import("std");
const builtin = @import("builtin");

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

pub fn build(b: *std.Build) void {
if (comptime (builtin.zig_version.order(minimum_zig_version) == .lt)) {
Expand All @@ -22,18 +22,15 @@ pub fn build(b: *std.Build) void {
const strip = b.option(bool, "strip", "Omit debug information");
const test_filters = b.option([]const []const u8, "test-filter", "Skip tests that do not match any filter") orelse &[0][]const u8{};

_ = b.addModule("known-folders", .{
const mod = b.addModule("known-folders", .{
.root_source_file = b.path("known-folders.zig"),
.target = target,
.optimize = optimize,
.strip = strip,
});

const unit_tests = b.addTest(.{
.root_source_file = b.path("known-folders.zig"),
.target = target,
.optimize = optimize,
.strip = strip,
.root_module = mod,
.filters = test_filters,
});

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 = "known-folders",
.name = .known_folders,
.version = "0.0.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 @@
"README.md",
"RESOURCES.md",
},
.fingerprint = 0x8b68d75b268f2f17, // Changing this has security and trust implications.
}

0 comments on commit aa24df4

Please sign in to comment.