-
Notifications
You must be signed in to change notification settings - Fork 699
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
Split off bindgen library into a sub-crate #204
Conversation
As mentioned in #78. |
FWIW, you can also probably get rid of syntex if you add an |
I believe this is another case where we need rust-lang/cargo#1982 |
Unfortunately that issue is unlikely to be fixed soon, so I'd recommend for now at least to do the refactoring to separate the binary/library into two cargo projects |
Hmm, @emilio: How do you feel about @alexcrichton's suggestion? It'd mean breaking one meaning of bindgen in
Sounds like a lot of pain without a lot of gain. My use case is exclusively nightly, so I'll give @emilio's suggestion a go before getting too excited about splitting crates. |
Servo wants to move to running bindgen as part of the build, as does Stylo and probably Quantum Render. What we do now is pretty awful and requires access to every platform configuration to generate bindings to check in. |
To add to that, we're probably willing to endure a lot of renaming pain, because the current situation is already extremely painful. |
That gives us a lot of latitude! In that case, I'd suggest breaking (My interest is in the @Yamakaky, could you weigh in with your thoughts on what we should do when it comes to bindgen on |
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.
Please rebase instead of merging, you have a lot of unrelated commits in this branch.
In general the idea looks nice, but some setup scripts rely on the following to work:
$ git clone https://github.com/servo/rust-bindgen
$ cd rust-bindgen && cargo build
$ ./target/debug/bindgen foo
Updating those is probably not an issue, but... cc @bholley and @Manishearth.
In any case, this is not ready to land yet, needs a rebase and get CI working again.
I think instead of moving the binary, moving the library may be less-breaking in this case (this crate is not yet pusblished on crates.io, and I believe there aren't a lot of people using it as a library with a git dependency).
After this move, we could publish the library on crates.io so it's straight-forward to reference it.
Some(version) if version != expected_version => { | ||
error!("Using clang {:?}, expected {:?}", version, expected_version); | ||
println!("Using clang {:?}, expected {:?}", | ||
version, |
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.
nit: Alignment here looks odd.
Yep, this is very much work-in-progress, not ready to merge. I've been working on the test suite this afternoon. I'll switch things around to have the library as sub-crate -- thanks. |
Fine with breaking that and doing a major bump. |
Status:
|
Corrections:
1 failure on Linux, 20 on Windows. |
☔ The latest upstream changes (presumably #215) made this pull request unmergeable. Please resolve the merge conflicts. |
4d9fdc8
to
eec7d27
Compare
1 failure on MacOS, btw. Same as Linux: One of the module names in diff expected generated
--- expected: "/Users/jdub/src/rust-bindgen/libbindgen/tests/expectations/namespace.rs"
+++ generated from: "/Users/jdub/src/rust-bindgen/libbindgen/tests/headers/namespace.hpp"
pub mod root {
... 8< ...
- pub mod _bindgen_mod_id_13 {
+ pub mod _bindgen_mod_id_977 { |
Hmm, which failures are we talking about on Windows? Id mismatches? Or binding generation/type layout failures? |
Here's the
Pretty sure it hasn't been tested on Windows though (or at least for ages), because the old tests attempted to run |
☔ The latest upstream changes (presumably #216) made this pull request unmergeable. Please resolve the merge conflicts. |
1c64974
to
f4158e5
Compare
6823663
to
073b12f
Compare
Never been so happy to see the number 13. |
@bors-servo r+ I think with the new harness expectations aren't updated automatically right? Seems like an easy fix once this macro-patch lands. |
📌 Commit 073b12f has been approved by |
Split off bindgen library into a sub-crate - Unfortunately there's a dependency on log via syntex_errors, so we don't get rid of it all - I can't find a more sensible way to set dependencies based on whether you're building the lib or bin - So `--no-default-features` means you need to know what you're doing, as only the lib will build without the logging crates for now - The replacement log macros are pretty gross too, but they show a proof of concept ;-)
☀️ Test successful - status-travis |
\o/ Thanks again @jdub! |
Generate a separate test function for every header - Header tests can now be run selectively, e.g. `cargo test header` will test all headers `cargo test union` will test headers with 'union' in the file name - The list of test functions is generated by `build.rs`, so never needs to be updated - Clever approach suggested by @fitzgen This PR depends on #204, so will include those changes until they're merged into master and this can be rebased. But I'll keep the commits separate.
Thanks a bunch for landing this @jdub! :) |
Thanks to you both for being so helpful! |
libbindgen: Make logging optional Note that the log crate isn't completely banished, as other is required by other dependencies. Believe it or not, this change was the original aim of #204.
don't get rid of it all
you're building the lib or bin
--no-default-features
means you need to know what you're doing,as only the lib will build without the logging crates for now
of concept ;-)