-
Notifications
You must be signed in to change notification settings - Fork 34
cbindgen: Add version defines #576
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
Conversation
Thanks for picking this up! Do you think it's possible to extend the rustls version test to enforce keeping this in sync? |
There are some pieces for parsing Writing the test is likely to be more work than it was to implement the change itself so I'm also OK leaving that as follow-up work if you're not keen on tackling it yourself. |
I made the test also verify the defines in the header file |
I'm not sure what to do about the failures in rust 1.73, tree-sitter-language requires rust 1.76. |
Ahh crud. I forgot that was one of the motivators for having a separate The simplest thing to do might be to move the whole test to |
I moved just the new part to |
af1e8dd
to
f403ba5
Compare
SGTM. Thanks!
The I think the best route here is to add a new tools:
name: Test rustls-ffi-tools
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4
with:
persist-credentials: false
- name: Install rust toolchain
uses: dtolnay/rust-toolchain@nightly
- name: Run tools unit tests
run: cargo test -p rustls-ffi-tools We don't want to add the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! I had a last round of nits but assuming those are addressed and nobody else has feedback I think this is ready for merge.
I appreciate you putting in the extra work to land the test. I know it was a lot more effort than the actual .h
update 😅
This will allow users to check the version of rustls-ffi without resorting to checking if functions are defined. Also add make rustls_version_match verify that defines are the correct. In addition to RUSTLS_VERSION_{MAJOR,MINOR,PATCH}, also define RUSTLS_VERSION_NUMBER, which includes each version part in it, bit shifted to the left. This is inspired by openssl[0], c-ares[1]. There are other options for this, for example zstd multiplies each part by a power of 100[2]. We might want to also have the entire version string here, which could help tools that need to parse the header file itself. [0] https://github.com/openssl/openssl/blob/cdd01b5e0734b0324251b32a8edd97f42ba90429/include/openssl/opensslv.h.in#L92-L102 [1] https://github.com/c-ares/c-ares/blob/42ddbc14ec008e738fa44aa2c16e74cad93742c2/include/ares_version.h#L43-L45 [2] https://github.com/facebook/zstd/blob/3c3b8274c517727952927c705940eb90c10c736f/lib/zstd.h#L115 Fixes rustls#557
This will allow users to check the version of rustls-ffi without resorting to checking if functions are defined.
In addition to RUSTLS_VERSION_{MAJOR,MINOR,PATCH}, also define RUSTLS_VERSION_NUMBER, which includes each version part in it, bit shifted to the left. This is inspired by openssl[0], c-ares[1]. There are other options for this, for example zstd multiplies each part by a power of 100[2].
We might want to also have the entire version string here, which could help tools that need to parse the header file itself.
[0] https://github.com/openssl/openssl/blob/cdd01b5e0734b0324251b32a8edd97f42ba90429/include/openssl/opensslv.h.in#L92-L102
[1] https://github.com/c-ares/c-ares/blob/42ddbc14ec008e738fa44aa2c16e74cad93742c2/include/ares_version.h#L43-L45
[2] https://github.com/facebook/zstd/blob/3c3b8274c517727952927c705940eb90c10c736f/lib/zstd.h#L115
Fixes #557