Skip to content

Commit 4764aa1

Browse files
authored
Make the project build with Zig 0.17.0 (#14)
1 parent e5ceff2 commit 4764aa1

12 files changed

Lines changed: 48 additions & 51 deletions

File tree

‎.github/workflows/docs.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
- name: Install Zig
2828
uses: mlugg/setup-zig@v2
2929
with:
30-
version: '0.16.0'
30+
version: '0.17.0'
3131

3232
- name: Install system dependencies
3333
run: |

‎.github/workflows/tests.yml‎

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,26 +25,26 @@ jobs:
2525
matrix:
2626
include:
2727
- os: ubuntu-latest
28-
zig-url: https://ziglang.org/download/0.16.0/zig-x86_64-linux-0.16.0.tar.xz
29-
zig-dir: zig-x86_64-linux-0.16.0
28+
zig-url: https://ziglang.org/download/0.17.0/zig-x86_64-linux-0.17.0.tar.xz
29+
zig-dir: zig-x86_64-linux-0.17.0
3030
- os: macos-latest
31-
zig-url: https://ziglang.org/download/0.16.0/zig-aarch64-macos-0.16.0.tar.xz
32-
zig-dir: zig-aarch64-macos-0.16.0
31+
zig-url: https://ziglang.org/download/0.17.0/zig-aarch64-macos-0.17.0.tar.xz
32+
zig-dir: zig-aarch64-macos-0.17.0
3333
- os: windows-latest
34-
zig-url: https://ziglang.org/download/0.16.0/zig-x86_64-windows-0.16.0.zip
35-
zig-dir: zig-x86_64-windows-0.16.0
34+
zig-url: https://ziglang.org/download/0.17.0/zig-x86_64-windows-0.17.0.zip
35+
zig-dir: zig-x86_64-windows-0.17.0
3636

3737
steps:
3838
- name: Checkout repository
3939
uses: actions/checkout@v4
4040

41-
- name: Install Zig 0.16.0 (Unix)
41+
- name: Install Zig 0.17.0 (Unix)
4242
if: runner.os != 'Windows'
4343
run: |
4444
curl -sSfL ${{ matrix.zig-url }} | tar -xJ
4545
echo "$PWD/${{ matrix.zig-dir }}" >> "$GITHUB_PATH"
4646
47-
- name: Install Zig 0.16.0 (Windows)
47+
- name: Install Zig 0.17.0 (Windows)
4848
if: runner.os == 'Windows'
4949
shell: pwsh
5050
run: |
@@ -68,10 +68,10 @@ jobs:
6868
- name: Checkout repository
6969
uses: actions/checkout@v4
7070

71-
- name: Install Zig 0.16.0
71+
- name: Install Zig 0.17.0
7272
run: |
73-
curl -sSfL https://ziglang.org/download/0.16.0/zig-x86_64-linux-0.16.0.tar.xz | tar -xJ
74-
echo "$PWD/zig-x86_64-linux-0.16.0" >> "$GITHUB_PATH"
73+
curl -sSfL https://ziglang.org/download/0.17.0/zig-x86_64-linux-0.17.0.tar.xz | tar -xJ
74+
echo "$PWD/zig-x86_64-linux-0.17.0" >> "$GITHUB_PATH"
7575
7676
- name: Set up uv
7777
uses: astral-sh/setup-uv@v5

‎AGENTS.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ Please do not add further dependencies without prior discussion.
9999

100100
## Zig Conventions
101101

102-
- Zig version: 0.16.0 (as declared in `build.zig.zon` and the Makefile's `ZIG_LOCAL` path). CI pins the version declared in `build.zig.zon`.
102+
- Zig version: 0.17.0 (as declared in `build.zig.zon` and the Makefile's `ZIG_LOCAL` path). CI pins the version declared in `build.zig.zon`.
103103
- Formatting is enforced by `zig fmt`. Run `make format` before committing.
104104
- Naming follows Zig standard-library conventions: `camelCase` for functions (e.g. `joinInto`, `extendInto`, `fromSlice`), `snake_case` for local
105105
variables and struct fields, `PascalCase` for types and structs (e.g. `Relation`, `Variable`, `Database`), and `SCREAMING_SNAKE_CASE` for

‎Dockerfile‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
99
&& rm -rf /var/lib/apt/lists/*
1010

1111
# Install Zig, pinned to the version declared in build.zig.zon.
12-
ARG ZIG_VERSION=0.16.0
12+
ARG ZIG_VERSION=0.17.0
1313
RUN curl -sSfL "https://ziglang.org/download/${ZIG_VERSION}/zig-x86_64-linux-${ZIG_VERSION}.tar.xz" \
1414
| tar -xJ -C /opt \
1515
&& ln -s "/opt/zig-x86_64-linux-${ZIG_VERSION}/zig" /usr/local/bin/zig

‎Makefile‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
################################################################################
22
# Configuration and Variables
33
################################################################################
4-
ZIG_LOCAL := $(HOME)/.local/share/zig/0.16.0/zig
4+
ZIG_LOCAL := $(HOME)/.local/share/zig/0.17.0/zig
55
ZIG ?= $(shell test -x $(ZIG_LOCAL) && echo $(ZIG_LOCAL) || which zig)
66
ZIG_VERSION := $(shell $(ZIG) version)
77
BUILD_TYPE ?= Debug

‎README.md‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
[![Examples](https://img.shields.io/badge/examples-view-green?style=flat&labelColor=282c34&logo=zig)](https://github.com/CogitatorTech/zodd/tree/main/examples)
1212
[![API Docs](https://img.shields.io/badge/docs-read-blue?style=flat&labelColor=282c34&logo=read-the-docs)](https://cogitatortech.github.io/zodd/api/#zodd.lib)
1313
[![Web Frontend](https://img.shields.io/badge/web_frontend-try-orange?style=flat&labelColor=282c34&logo=webassembly)](https://CogitatorTech.github.io/zodd/)
14-
[![Zig](https://img.shields.io/badge/zig-0.16.0-F7A41D?style=flat&labelColor=282c34&logo=zig)](https://ziglang.org/download/)
14+
[![Zig](https://img.shields.io/badge/zig-0.17.0-F7A41D?style=flat&labelColor=282c34&logo=zig)](https://ziglang.org/download/)
1515
[![Release](https://img.shields.io/github/release/CogitatorTech/zodd.svg?label=release&style=flat&labelColor=282c34&logo=github)](https://github.com/CogitatorTech/zodd/releases/latest)
1616

1717
A small embeddable Datalog engine in Zig
@@ -103,7 +103,7 @@ zig fetch --save=zodd "https://github.com/CogitatorTech/zodd/archive/<branch_or_
103103
Replace `<branch_or_tag>` with the branch or tag you want to use, such as `main` or `v0.1.0`.
104104

105105
> [!NOTE]
106-
> Zodd is developed and tested with Zig version 0.16.0.
106+
> Zodd is developed and tested with Zig version 0.17.0.
107107
108108
#### Build Configuration
109109

@@ -194,7 +194,6 @@ Zodd is licensed under the MIT License (see [LICENSE](LICENSE)).
194194
### Acknowledgements
195195

196196
* The logo shows a directed graph whose edges form a Z, with a dashed arc for the derived fact `path(a, d)`.
197-
* This project uses [Minish](https://github.com/CogitatorTech/minish) for property-based testing and
198-
[Ordered](https://github.com/CogitatorTech/ordered) for B-tree indices.
197+
* This project uses [Minish](https://github.com/CogitatorTech/minish) for property-based testing, [Chilli](https://github.com/CogitatorTech/chilli) for CLI, and [Ordered](https://github.com/CogitatorTech/ordered) for B-tree indices.
199198
* Zodd is inspired by and modeled after the [Datafrog](https://github.com/frankmcsherry/blog/blob/master/posts/2018-05-19.md) Datalog engine for Rust.
200199

‎build.zig‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,14 +77,15 @@ pub fn build(b: *std.Build) void {
7777

7878
// Discover and add tests from tests/ directory
7979
// (only available when developing zodd, not when used as a dependency)
80-
if (b.build_root.handle.openDir(io, "tests", .{ .iterate = true })) |tests_dir| {
80+
if (b.root.openDir(io, "tests", .{ .iterate = true })) |tests_dir| {
8181
// Lazy-load Minish dependency (only needed for property tests)
8282
const minish_dep = b.dependency("minish", .{
8383
.target = target,
8484
.optimize = optimize,
8585
});
8686

8787
var dir = tests_dir;
88+
defer dir.close(io);
8889
var it = dir.iterate();
8990
while (it.next(io) catch null) |entry| {
9091
if (entry.kind != .file) continue;
@@ -115,8 +116,9 @@ pub fn build(b: *std.Build) void {
115116
} else |_| {}
116117

117118
// Discover and add examples from examples/ directory
118-
if (b.build_root.handle.openDir(io, "examples", .{ .iterate = true })) |examples_dir| {
119+
if (b.root.openDir(io, "examples", .{ .iterate = true })) |examples_dir| {
119120
var dir = examples_dir;
121+
defer dir.close(io);
120122
const run_all_step = b.step("run-all", "Run all examples");
121123

122124
var it = dir.iterate();
@@ -207,7 +209,7 @@ pub fn build(b: *std.Build) void {
207209
}
208210

209211
fn getVersion(b: *std.Build) []const u8 {
210-
const zon_content = b.build_root.handle.readFileAlloc(b.graph.io, "build.zig.zon", b.allocator, .unlimited) catch return "unknown";
212+
const zon_content = b.root.root_dir.handle.readFileAlloc(b.graph.io, "build.zig.zon", b.allocator, .unlimited) catch return "unknown";
211213
if (std.mem.indexOf(u8, zon_content, ".version = \"")) |index| {
212214
const start = index + ".version = \"".len;
213215
if (std.mem.indexOfScalarPos(u8, zon_content, start, '"')) |end| {

‎build.zig.zon‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
.{
22
.name = .zodd,
3-
.version = "0.1.0-alpha.6",
3+
.version = "0.1.0-alpha.7",
44
.fingerprint = 0x2d03181bdd24914c, // Changing this has security and trust implications.
5-
.minimum_zig_version = "0.16.0",
5+
.minimum_zig_version = "0.17.0",
66
.dependencies = .{
77
.minish = .{
8-
.url = "https://github.com/CogitatorTech/minish/archive/refs/tags/v0.3.0.tar.gz",
9-
.hash = "minish-0.3.0-SQtSTYI3AgCxWdWbKxS_lvmfbp0wJk29ZW5C9CozJaxm",
8+
.url = "https://github.com/CogitatorTech/minish/archive/refs/tags/v0.5.0.tar.gz",
9+
.hash = "minish-0.5.0-SQtSTXUkAwA1iUHhQRCfM-092BYRlYDLTFCSodBi_EFq",
1010
},
1111
.ordered = .{
12-
.url = "https://github.com/CogitatorTech/ordered/archive/refs/tags/v0.2.1.tar.gz",
13-
.hash = "ordered-0.2.1-Gy41sDCgAgA_QUoMf8Upew_Yx8sAPe7Fw_A2v5qP8GMK",
12+
.url = "https://github.com/CogitatorTech/ordered/archive/refs/tags/v0.3.1.tar.gz",
13+
.hash = "ordered-0.3.1-Gy41sLuaAgAXViYYrL307WTMx5Jg3iukiVAOlQvATkZe",
1414
},
1515
.chilli = .{
16-
.url = "https://github.com/CogitatorTech/chilli/archive/refs/tags/v0.3.2.tar.gz",
17-
.hash = "chilli-0.3.2-c19PrireAQAXEfA7xrmJW2lrSiNiuuG8wtJI-MJVZgFU",
16+
.url = "https://github.com/CogitatorTech/chilli/archive/refs/tags/v0.4.0.tar.gz",
17+
.hash = "chilli-0.4.0-c19PrpzYAQAByfO0ayR5w2mpw8ncare-Lk6Uu0E8tjwf",
1818
},
1919
},
2020
.paths = .{ "build.zig", "build.zig.zon", "src", "LICENSE", "README.md" },

‎src/zodd/frontend/dyntuple.zig‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ pub const MAX_ARITY = 16;
2525
/// The single tuple type used by all frontend relations: a tuple struct of
2626
/// `MAX_ARITY` `u64` fields. Columns at or past a predicate's arity are
2727
/// always zero, so sorting and deduplication in `Relation` stay correct.
28-
pub const DynTuple = @Tuple(&[_]type{Atom} ** MAX_ARITY);
28+
const tuple_types: [MAX_ARITY]type = @splat(Atom);
29+
pub const DynTuple = @Tuple(&tuple_types);
2930

3031
/// A `DynTuple` with every column set to zero.
3132
pub const zero_tuple: DynTuple = std.mem.zeroes(DynTuple);

‎src/zodd/frontend/parser.zig‎

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -240,12 +240,7 @@ const Parser = struct {
240240
}
241241

242242
fn aggFunc(name: []const u8) ?ast.AggFunc {
243-
inline for (@typeInfo(ast.AggFunc).@"enum".fields) |field| {
244-
if (std.mem.eql(u8, name, field.name)) {
245-
return @field(ast.AggFunc, field.name);
246-
}
247-
}
248-
return null;
243+
return std.meta.stringToEnum(ast.AggFunc, name);
249244
}
250245

251246
fn fact(self: *Parser, name_token: Token, args: []const Arg) ParseError!void {

0 commit comments

Comments
 (0)