Ship pregenerated bindings in ruby-prism-sys#4179
Open
sorafujitani wants to merge 4 commits into
Open
Conversation
Commit the bindgen output at src/bindings.rs so building the crate no longer requires bindgen or libclang. The committed file is generated with layout_tests(false) to stay portable across pointer widths. The new buildtime_bindgen feature restores build-time generation, and rake cargo:bindings regenerates the committed file.
The sys-bindings job regenerates the bindings and fails if the committed file is stale. The test matrix also runs the layout tests via buildtime_bindgen on 64-bit hosts and checks that the committed bindings compile for wasm32-wasip1.
kddnewton
reviewed
Jul 21, 2026
|
|
||
| - name: Check pregenerated bindings on wasm32-wasip1 | ||
| if: ${{ matrix.os == 'ubuntu-latest' }} | ||
| run: cargo check --target wasm32-wasip1 --no-default-features |
Collaborator
There was a problem hiding this comment.
I don't quite know enough about this, but I'm assuming we want to check other bindings besides just this right? Should we check x64/a64/etc?
Author
There was a problem hiding this comment.
64-bit targets are already tested: the matrix builds the committed bindings on x64 (ubuntu, windows) and arm64 (macos) and runs the test suite against them.
this step only exists because wasm32 is the only supported target with a different pointer width.
Earlopain
reviewed
Jul 21, 2026
Collaborator
There was a problem hiding this comment.
Please mark this as generated in .gitattributes
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.
Closes #4175.
ruby-prism-sysnow ships the bindgen output as a committed file (src/bindings.rs), so building the crate no longer requires bindgen or libclang. This follows the pattern of libsqlite3-sys and zstd-sys.Notes
layout_tests(false). Layout tests hardcode the generating host's struct sizes, which breaks 32-bit targets (wasm32-wasip1 fails with a const-eval overflow). Without them the output is source-portable; I verified byte-identical output on macOS arm64 and Linux x86_64.buildtime_bindgenfeature restores build-time generation. It is needed whenRUBY_PRISM_CFLAGSchanges the API surface.rake cargo:bindingsregenerates the committed file. CI regenerates and diffs it, runs the layout tests viabuildtime_bindgenon the 64-bit test matrix, and checks that the committed bindings compile for wasm32-wasip1.constassertions rather than#[test]functions. That is why the committed copy disables them.ccbuild of the vendored sources.