Skip to content

feat!: support zig 0.16#635

Merged
aherrmann merged 34 commits intoaherrmann:mainfrom
cerisier:upstreamable-zig-0.16
Apr 29, 2026
Merged

feat!: support zig 0.16#635
aherrmann merged 34 commits intoaherrmann:mainfrom
cerisier:upstreamable-zig-0.16

Conversation

@cerisier
Copy link
Copy Markdown
Contributor

@cerisier cerisier commented Apr 27, 2026

Closes #625

This PR is a mix of upstream of zml/rules_zig + additional fixes to comply with current aherrmann/rules_zig.
It's mainly porting all zig source code to support zig 0.16.x AND zig 0.15.x

The only changes non related to tests are:

  • Drops support for zig version 0.14.x
  • Defaults to zig version 0.16.0
  • passing GLOBAL_CACHE_DIR and related by env to zig and zig translate-c instead of CLI args since in zig 0.16, those variables are not always read from the CLI args (I think it's a bug from zig).

BREAKING CHANGE

  • Removes support for 0.14.x.
  • Changes the runfiles API for 0.16.x support.

@cerisier
Copy link
Copy Markdown
Contributor Author

@aherrmann I think this somehow surfaces that the removal of cc_common.link hack makes bazel 8 fail ?

@aherrmann
Copy link
Copy Markdown
Owner

@aherrmann I think this somehow surfaces that the removal of cc_common.link hack makes bazel 8 fail ?

I haven't looked at the changes, yet. But, I encountered the same issue in the Bazel 9 upgrade PR and therefore kept the workaround alive: 02914a0

@cerisier
Copy link
Copy Markdown
Contributor Author

I think there is another issue then because this PR is rebased on main@HEAD.

Copy link
Copy Markdown
Owner

@aherrmann aherrmann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm only about half-way through, but pushing these comments already.

Comment thread e2e/workspace/configure-target/main.zig Outdated
Comment thread e2e/workspace/simple-library/main.zig
Comment thread e2e/workspace/zig-docs/main.zig Outdated
Comment thread zig/runfiles/src/Directory.zig Outdated
Comment thread zig/runfiles/src/Directory.zig Outdated
Comment thread zig/runfiles/src/Directory.zig Outdated
@cerisier
Copy link
Copy Markdown
Contributor Author

cerisier commented Apr 27, 2026

@aherrmann I think this somehow surfaces that the removal of cc_common.link hack makes bazel 8 fail ?

I haven't looked at the changes, yet. But, I encountered the same issue in the Bazel 9 upgrade PR and therefore kept the workaround alive: 02914a0

Ok so actually this has been there since rules_cc 0.2.18.
But the tests that would make it surface were incompatible with 0.15.2 so they never ran and so never failed...

I'm not 100% sure but it seems that the issue is because the tools/build_defs/android package hack only works inside the main repo. When rules_zig is pulled transitively, this wouldn't work.

@cerisier
Copy link
Copy Markdown
Contributor Author

cerisier commented Apr 27, 2026

I'm only about half-way through, but pushing these comments already.

Thanks for the valid points ! changes were so wide things got lost.

It makes me wonder if we should provide support for previous Zig versions.

@cerisier
Copy link
Copy Markdown
Contributor Author

All first review addressed

cerisier and others added 3 commits April 27, 2026 21:38
It is not automatically tested, but, the purpose of those tests is to
check that docs generation works properly, and the source doc strings
make their way into the generated docs.
@cerisier
Copy link
Copy Markdown
Contributor Author

Fixed and green

The runfiles decltest is meant as an example how to use the library. As
such it shouldn't use testutils, since those won't be available to
users.
Copy link
Copy Markdown
Owner

@aherrmann aherrmann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for putting this together! Some small comments. I also found and fixed a remote execution failure with the runfiles decltest.

Comment thread zig/runfiles/src/discovery.zig Outdated
Comment thread zig/runfiles/src/discovery.zig Outdated
Comment thread zig/tests/integration_tests/workspace/extra-versions.json
Comment thread zig/tests/integration_tests/workspace/MODULE.bazel
Comment thread zig/tests/integration_tests/BUILD.bazel
Comment thread zig/tests/integration_tests/integration_tests_runner.zig Outdated
Comment thread zig/tests/strip_debug_symbols/main.zig Outdated
@aherrmann aherrmann changed the title feat: support zig 0.16 feat!: support zig 0.16 Apr 28, 2026
cerisier and others added 8 commits April 28, 2026 14:14
Co-authored-by: Andreas Herrmann <andreash87@gmx.ch>
Co-authored-by: Andreas Herrmann <andreash87@gmx.ch>
Co-authored-by: Andreas Herrmann <andreash87@gmx.ch>
@cerisier
Copy link
Copy Markdown
Contributor Author

Finally green !

Copy link
Copy Markdown
Owner

@aherrmann aherrmann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent! Thank you!

@aherrmann aherrmann merged commit 7d06ae7 into aherrmann:main Apr 29, 2026
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants