-
Notifications
You must be signed in to change notification settings - Fork 3
chore!: upgrade to Zig 0.16.0 #9
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
Merged
Merged
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
f69fb19
chore: upgrade to Zig 0.16.0-dev (master)
lodekeeper-z a236788
chore: merge upstream main (type-tag-aware unwrap, safer integer conv…
lodekeeper-z 650da13
Merge remote-tracking branch 'upstream/main' into chore/zig-master
lodekeeper-z 880afd6
chore: merge upstream main (Ref refactor, raw variant functions, safe…
lodekeeper-z 0f6d617
chore: merge upstream main (napi→zapi rename, CI, hello_world example)
lodekeeper-z a5e62b7
fix: restore hello_world example with Zig 0.16 Timer migration
GrapeBaBa a5f5711
refactor(examples): use std.Io instead of libc for timer and sleep
GrapeBaBa 24bb6d5
refactor(examples): use Io.Threaded.global_single_threaded
GrapeBaBa 3272eb2
refactor(examples): use explicit Io.Threaded init instead of global
GrapeBaBa 6face6a
refactor(examples): remove Timer wrapper, use Io.Timestamp directly
GrapeBaBa b614ae2
fix(build): exclude example tests from global test step
GrapeBaBa 91fca03
fix: address PR review comments
GrapeBaBa 05b18eb
fix: use threadlocal for Io.Threaded to avoid cross-thread sharing
GrapeBaBa f18aab2
fix: restore zbuild generated-file headers
GrapeBaBa ef82c4c
fix: remove unnecessary link_libc from zapi module
GrapeBaBa 6d86a6a
example: use stdlib global_single_threaded Io in hello_world
a0312a4
Merge remote-tracking branch 'upstream/main' into chore/zig-master
76dae72
chore: port main's newly-merged code to Zig 0.16
014aed6
chore: migrate to zbuild library mode
GrapeBaBa 4a372c6
chore: declare test linker_allow_shlib_undefined in manifest
GrapeBaBa 0c62a9f
fix: remove obsolete zbuild manifest
GrapeBaBa 064f283
Merge remote-tracking branch 'origin/main' into chore/zig-master
GrapeBaBa File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,5 +7,6 @@ test/spec/static_tests.zig | |
| .yarn | ||
| node_modules/ | ||
| lib/ | ||
| zig-pkg/ | ||
| docs/superpowers/ | ||
| .claude/settings.local.json | ||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,181 +1,7 @@ | ||
| // This file is generated by zbuild. Do not edit manually. | ||
|
|
||
| const std = @import("std"); | ||
| const zbuild = @import("zbuild"); | ||
|
|
||
| pub fn build(b: *std.Build) void { | ||
| const target = b.standardTargetOptions(.{}); | ||
| const optimize = b.standardOptimizeOption(.{}); | ||
|
|
||
| const options_build_options = b.addOptions(); | ||
| const option_napi_version = b.option([]const u8, "napi_version", "") orelse "10"; | ||
| options_build_options.addOption([]const u8, "napi_version", option_napi_version); | ||
| const options_module_build_options = options_build_options.createModule(); | ||
|
|
||
| const module_napi = b.createModule(.{ | ||
| .root_source_file = b.path("src/root.zig"), | ||
| .target = target, | ||
| .optimize = optimize, | ||
| }); | ||
| module_napi.addIncludePath(b.path("include")); | ||
| b.modules.put(b.dupe("napi"), module_napi) catch @panic("OOM"); | ||
|
|
||
| const module_zapi = b.createModule(.{ | ||
| .root_source_file = b.path("src/root.zig"), | ||
| .target = target, | ||
| .optimize = optimize, | ||
| .link_libc = true, | ||
| }); | ||
| module_zapi.addIncludePath(b.path("include")); | ||
| b.modules.put(b.dupe("zapi"), module_zapi) catch @panic("OOM"); | ||
|
|
||
| const module_example_hello_world = b.createModule(.{ | ||
| .root_source_file = b.path("examples/hello_world/mod.zig"), | ||
| .target = target, | ||
| .optimize = optimize, | ||
| .link_libc = true, | ||
| }); | ||
| b.modules.put(b.dupe("example_hello_world"), module_example_hello_world) catch @panic("OOM"); | ||
|
|
||
| const lib_example_hello_world = b.addLibrary(.{ | ||
| .name = "example_hello_world", | ||
| .root_module = module_example_hello_world, | ||
| .linkage = .dynamic, | ||
| }); | ||
|
|
||
| lib_example_hello_world.linker_allow_shlib_undefined = true; | ||
| const install_lib_example_hello_world = b.addInstallArtifact(lib_example_hello_world, .{ | ||
| .dest_sub_path = "example_hello_world.node", | ||
| }); | ||
|
|
||
| const tls_install_lib_example_hello_world = b.step("build-lib:example_hello_world", "Install the example_hello_world library"); | ||
| tls_install_lib_example_hello_world.dependOn(&install_lib_example_hello_world.step); | ||
| b.getInstallStep().dependOn(&install_lib_example_hello_world.step); | ||
|
|
||
| const module_example_type_tag = b.createModule(.{ | ||
| .root_source_file = b.path("examples/type_tag/mod.zig"), | ||
| .target = target, | ||
| .optimize = optimize, | ||
| .link_libc = true, | ||
| }); | ||
| b.modules.put(b.dupe("example_type_tag"), module_example_type_tag) catch @panic("OOM"); | ||
|
|
||
| const lib_example_type_tag = b.addLibrary(.{ | ||
| .name = "example_type_tag", | ||
| .root_module = module_example_type_tag, | ||
| .linkage = .dynamic, | ||
| }); | ||
|
|
||
| lib_example_type_tag.linker_allow_shlib_undefined = true; | ||
| const install_lib_example_type_tag = b.addInstallArtifact(lib_example_type_tag, .{ | ||
| .dest_sub_path = "example_type_tag.node", | ||
| }); | ||
|
|
||
| const tls_install_lib_example_type_tag = b.step("build-lib:example_type_tag", "Install the example_type_tag library"); | ||
| tls_install_lib_example_type_tag.dependOn(&install_lib_example_type_tag.step); | ||
| b.getInstallStep().dependOn(&install_lib_example_type_tag.step); | ||
|
|
||
| const module_example_js_dsl = b.createModule(.{ | ||
| .root_source_file = b.path("examples/js_dsl/mod.zig"), | ||
| .target = target, | ||
| .optimize = optimize, | ||
| .link_libc = true, | ||
| }); | ||
| b.modules.put(b.dupe("example_js_dsl"), module_example_js_dsl) catch @panic("OOM"); | ||
|
|
||
| const lib_example_js_dsl = b.addLibrary(.{ | ||
| .name = "example_js_dsl", | ||
| .root_module = module_example_js_dsl, | ||
| .linkage = .dynamic, | ||
| }); | ||
|
|
||
| lib_example_js_dsl.linker_allow_shlib_undefined = true; | ||
| const install_lib_example_js_dsl = b.addInstallArtifact(lib_example_js_dsl, .{ | ||
| .dest_sub_path = "example_js_dsl.node", | ||
| }); | ||
|
|
||
| const tls_install_lib_example_js_dsl = b.step("build-lib:example_js_dsl", "Install the example_js_dsl library"); | ||
| tls_install_lib_example_js_dsl.dependOn(&install_lib_example_js_dsl.step); | ||
| b.getInstallStep().dependOn(&install_lib_example_js_dsl.step); | ||
|
|
||
| const tls_run_test = b.step("test", "Run all tests"); | ||
|
|
||
| const test_napi = b.addTest(.{ | ||
| .name = "napi", | ||
| .root_module = module_napi, | ||
| .filters = b.option([][]const u8, "napi.filters", "napi test filters") orelse &[_][]const u8{}, | ||
| }); | ||
| const install_test_napi = b.addInstallArtifact(test_napi, .{}); | ||
| const tls_install_test_napi = b.step("build-test:napi", "Install the napi test"); | ||
| tls_install_test_napi.dependOn(&install_test_napi.step); | ||
|
|
||
| const run_test_napi = b.addRunArtifact(test_napi); | ||
| const tls_run_test_napi = b.step("test:napi", "Run the napi test"); | ||
| tls_run_test_napi.dependOn(&run_test_napi.step); | ||
| tls_run_test.dependOn(&run_test_napi.step); | ||
|
|
||
| const test_zapi = b.addTest(.{ | ||
| .name = "zapi", | ||
| .root_module = module_zapi, | ||
| .filters = b.option([][]const u8, "zapi.filters", "zapi test filters") orelse &[_][]const u8{}, | ||
| }); | ||
| const install_test_zapi = b.addInstallArtifact(test_zapi, .{}); | ||
| const tls_install_test_zapi = b.step("build-test:zapi", "Install the zapi test"); | ||
| tls_install_test_zapi.dependOn(&install_test_zapi.step); | ||
|
|
||
| const run_test_zapi = b.addRunArtifact(test_zapi); | ||
| const tls_run_test_zapi = b.step("test:zapi", "Run the zapi test"); | ||
| tls_run_test_zapi.dependOn(&run_test_zapi.step); | ||
| tls_run_test.dependOn(&run_test_zapi.step); | ||
|
|
||
| const test_example_hello_world = b.addTest(.{ | ||
| .name = "example_hello_world", | ||
| .root_module = module_example_hello_world, | ||
| .filters = b.option([][]const u8, "example_hello_world.filters", "example_hello_world test filters") orelse &[_][]const u8{}, | ||
| }); | ||
| const install_test_example_hello_world = b.addInstallArtifact(test_example_hello_world, .{}); | ||
| const tls_install_test_example_hello_world = b.step("build-test:example_hello_world", "Install the example_hello_world test"); | ||
| tls_install_test_example_hello_world.dependOn(&install_test_example_hello_world.step); | ||
|
|
||
| const run_test_example_hello_world = b.addRunArtifact(test_example_hello_world); | ||
| const tls_run_test_example_hello_world = b.step("test:example_hello_world", "Run the example_hello_world test"); | ||
| tls_run_test_example_hello_world.dependOn(&run_test_example_hello_world.step); | ||
| tls_run_test.dependOn(&run_test_example_hello_world.step); | ||
|
|
||
| const test_example_type_tag = b.addTest(.{ | ||
| .name = "example_type_tag", | ||
| .root_module = module_example_type_tag, | ||
| .filters = b.option([][]const u8, "example_type_tag.filters", "example_type_tag test filters") orelse &[_][]const u8{}, | ||
| }); | ||
| const install_test_example_type_tag = b.addInstallArtifact(test_example_type_tag, .{}); | ||
| const tls_install_test_example_type_tag = b.step("build-test:example_type_tag", "Install the example_type_tag test"); | ||
| tls_install_test_example_type_tag.dependOn(&install_test_example_type_tag.step); | ||
|
|
||
| const run_test_example_type_tag = b.addRunArtifact(test_example_type_tag); | ||
| const tls_run_test_example_type_tag = b.step("test:example_type_tag", "Run the example_type_tag test"); | ||
| tls_run_test_example_type_tag.dependOn(&run_test_example_type_tag.step); | ||
| tls_run_test.dependOn(&run_test_example_type_tag.step); | ||
|
|
||
| const test_example_js_dsl = b.addTest(.{ | ||
| .name = "example_js_dsl", | ||
| .root_module = module_example_js_dsl, | ||
| .filters = b.option([][]const u8, "example_js_dsl.filters", "example_js_dsl test filters") orelse &[_][]const u8{}, | ||
| }); | ||
| const install_test_example_js_dsl = b.addInstallArtifact(test_example_js_dsl, .{}); | ||
| const tls_install_test_example_js_dsl = b.step("build-test:example_js_dsl", "Install the example_js_dsl test"); | ||
| tls_install_test_example_js_dsl.dependOn(&install_test_example_js_dsl.step); | ||
|
|
||
| const run_test_example_js_dsl = b.addRunArtifact(test_example_js_dsl); | ||
| const tls_run_test_example_js_dsl = b.step("test:example_js_dsl", "Run the example_js_dsl test"); | ||
| tls_run_test_example_js_dsl.dependOn(&run_test_example_js_dsl.step); | ||
| tls_run_test.dependOn(&run_test_example_js_dsl.step); | ||
|
|
||
| module_napi.addImport("build_options", options_module_build_options); | ||
|
|
||
| module_zapi.addImport("build_options", options_module_build_options); | ||
|
|
||
| module_example_hello_world.addImport("zapi", module_zapi); | ||
|
|
||
| module_example_type_tag.addImport("zapi", module_zapi); | ||
|
|
||
| module_example_js_dsl.addImport("zapi", module_zapi); | ||
| pub fn build(b: *std.Build) !void { | ||
| @setEvalBranchQuota(200_000); | ||
| _ = try zbuild.configureBuild(b, @import("build.zig.zon"), .{}); | ||
| } |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,10 +1,92 @@ | ||
| // This file is generated by zbuild. Do not edit manually. | ||
|
|
||
| .{ | ||
| .name = .zapi, | ||
| .version = "1.0.1", // x-release-please-version | ||
| .fingerprint = 0x77829ef951b38aac, | ||
| .minimum_zig_version = "0.14.1", | ||
| .dependencies = .{}, | ||
| .minimum_zig_version = "0.16.0", | ||
|
GrapeBaBa marked this conversation as resolved.
|
||
| .paths = .{ "build.zig", "build.zig.zon", "src", "include" }, | ||
| .dependencies = .{ | ||
| .zbuild = .{ | ||
| .url = "git+https://github.com/ChainSafe/zbuild?ref=refactor/comptime-library-rewrite#7ec852f1c6495b62d964e311bd210b6f9a3015be", | ||
| .hash = "zbuild-0.4.0-XJFav9lXAgCtcFwxSb5qEkex3kijECLtqo7z9FzrkUaf", | ||
| }, | ||
| }, | ||
| .options_modules = .{ | ||
| .build_options = .{ | ||
| .napi_version = .{ | ||
| .type = .string, | ||
| .default = "10", | ||
| .description = "Node.js NAPI version (default: 10).", | ||
| }, | ||
| }, | ||
| }, | ||
| .modules = .{ | ||
| // `napi` and `zapi` share the same source file but expose different | ||
| // imports — `napi` is used by `napi.zig`-only consumers, while `zapi` | ||
| // links libc and is the canonical entry point for example modules. | ||
| .napi = .{ | ||
| .root_source_file = "src/root.zig", | ||
| .include_paths = .{"include"}, | ||
| .imports = .{.build_options}, | ||
| }, | ||
| .zapi = .{ | ||
| .root_source_file = "src/root.zig", | ||
| .include_paths = .{"include"}, | ||
| .imports = .{.build_options}, | ||
| .link_libc = true, | ||
| }, | ||
| .example_hello_world = .{ | ||
| .root_source_file = "examples/hello_world/mod.zig", | ||
| .imports = .{.zapi}, | ||
| .link_libc = true, | ||
| }, | ||
| .example_type_tag = .{ | ||
| .root_source_file = "examples/type_tag/mod.zig", | ||
| .imports = .{.zapi}, | ||
| .link_libc = true, | ||
| }, | ||
| .example_js_dsl = .{ | ||
| .root_source_file = "examples/js_dsl/mod.zig", | ||
| .imports = .{.zapi}, | ||
| .link_libc = true, | ||
| }, | ||
| }, | ||
| .libraries = .{ | ||
| .example_hello_world = .{ | ||
| .root_module = .example_hello_world, | ||
| .linkage = .dynamic, | ||
| .linker_allow_shlib_undefined = true, | ||
| .dest_sub_path = "example_hello_world.node", | ||
| }, | ||
| .example_type_tag = .{ | ||
| .root_module = .example_type_tag, | ||
| .linkage = .dynamic, | ||
| .linker_allow_shlib_undefined = true, | ||
| .dest_sub_path = "example_type_tag.node", | ||
| }, | ||
| .example_js_dsl = .{ | ||
| .root_module = .example_js_dsl, | ||
| .linkage = .dynamic, | ||
| .linker_allow_shlib_undefined = true, | ||
| .dest_sub_path = "example_js_dsl.node", | ||
| }, | ||
| }, | ||
| .tests = .{ | ||
| .napi = .{ .root_module = .napi }, | ||
| .zapi = .{ .root_module = .zapi }, | ||
| // Example tests reference napi C symbols (`napi_wrap`, `napi_typeof`, …) | ||
| // which Node provides at dlopen time. Standalone zig test binaries don't | ||
| // have Node around, so allow undefined shared-library symbols. | ||
| .example_hello_world = .{ | ||
| .root_module = .example_hello_world, | ||
| .linker_allow_shlib_undefined = true, | ||
| }, | ||
| .example_type_tag = .{ | ||
| .root_module = .example_type_tag, | ||
| .linker_allow_shlib_undefined = true, | ||
| }, | ||
| .example_js_dsl = .{ | ||
| .root_module = .example_js_dsl, | ||
| .linker_allow_shlib_undefined = true, | ||
| }, | ||
| }, | ||
| } | ||
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.