Repository navigation
Support Zig 0.17.0 - #127
Merged
Merged
Conversation
Zig 0.17 rewrote type reflection: `Fn.params` became `param_types`, and `Fn.is_var_args` / `Pointer.is_const` moved into `attrs`. It also removed `std.fmt.bufPrintZ`. Detect the available layout and API at comptime so the bindings keep building on Zig 0.16. `tuple.fnParamsToTuple` now takes plain parameter types instead of `std.builtin.Type.Fn.Param`, which no longer exists in 0.17.
The unit tests did not instantiate `binding`, so changes to its comptime type reflection were only caught by building the examples.
Add `compat.bufPrintZ` for the removed `std.fmt.bufPrintZ`, and build the event_handling separator with `@splat` instead of the removed `**` array repetition operator. Both forms also work on Zig 0.16.
Zig 0.17 caches the configure phase, so `addEmbeddedDir` kept stale file lists after assets were added, deleted, or renamed. Declare each scanned directory with `dependOnDirectoryContents`, and do the same for the examples directory. Zig 0.16 has no configure cache and is unaffected.
Pin webui to f1b28ee, which includes webui-dev/webui#719. The previous pin failed to configure on Zig 0.17 with `no field named 'Debug' in enum 'lang.Optimize'`. The C API in webui.h is unchanged.
On Zig 0.17, `Build.dupe` returns `[]const u8`, so rewriting `\` to `/` in place failed to compile. The branch only builds on Windows hosts, so other platforms did not catch it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds Zig 0.17.0 support while keeping Zig 0.16.0 working. CI now builds and tests both versions.
Dependency
f1b28ee, which includes Fix build with Zig 0.17.0 webui#719. The previous pin failed to configure on Zig 0.17 withno field named 'Debug' in enum 'lang.Optimize'. The C API inwebui.his unchanged.Library
Fn.paramswithparam_typesand movedFn.is_var_args/Pointer.is_constintoattrs.bindingnow detects which layout is available at comptime.tuple.fnParamsToTupletakes plain parameter types, becausestd.builtin.Type.Fn.Paramno longer exists.std.fmt.bufPrintZwas removed, and its replacementstd.mem.printSentineldoes not exist on 0.16. Both are wrapped behind an internal helper.addEmbeddedDirkept stale file lists after assets were added, deleted, or renamed (deleting a file made the build fail). Each scanned directory, and theexamplesdirectory, is now declared withdependOnDirectoryContents.Build.dupenow returns[]const u8, soaddEmbeddedDircopies each path before rewriting\to/in place. This branch only compiles on Windows hosts, so it was checked locally by type-checkingbuild.zigfor a Windows host and cross-compiling the examples and tests forx86_64-windows.Examples
compat.bufPrintZ, and replaced the removed**array repetition operator with@splat.Tests
bindingwith every supported callback parameter type. Before this, the reflection path was only exercised by building the examples.Verification (macOS arm64)
zig build examples(static / dynamic)zig build testzig build docspython -m unittest discover -s testszig fmt --checkNote: 0.17's
zig fmtrewrites@intFromEnum/@enumFromIntinto@backingInt/@fromBackingInt, which do not exist on 0.16. The old builtins are only deprecated on 0.17, so they are kept as is. The lint job still runs on 0.16 throughminimum_zig_version.