-
Notifications
You must be signed in to change notification settings - Fork 707
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
CargoCallbacks does not trigger rerun if the wrapper header changes #2643
Comments
I think including the wrapper could be a sensible default but I'm not sure as this behavior has not been the default and it could break other's people code in unexpected ways (I'm amazed to see what people do with bindgen 🤣) One possible justification for this behavior is that the A possible solution here would be to document this more explicitly on the |
That's exactly my case, except when something like #753 exists, and I need to add workaround like #753 (comment), which triggered me to discover that I also need explicit Granted, pretty much every tutorial about bindgen out there already has that line. Heck, those tutorials also have |
The issue is that I don't have an answer for this 😅. I don't see any reason to not recompile when the input header changes but somebody might be relying on this for some weird reason. |
Is there backward incompatible way to change the default and give people option to turn it off? If not, I still suggest at least explicitly mention the necessity of the wrapper rerun line in doc. The current tutorial doesn't |
There might be a not so pretty but backwards compatible way to implement this: pub trait ParseCallbacks {}
#[allow(dead_code)]
pub struct CargoCallbacks { include_input_headers: bool }
#[allow(non_upper_case_globals)]
const CargoCallbacks: CargoCallbacks = CargoCallbacks { include_input_headers: false };
impl CargoCallbacks {
fn include_input_headers(self) -> Self {
Self { include_input_headers: true }
}
}
impl ParseCallbacks for CargoCallbacks {}
pub fn parse_callbacks(_cb: Box<dyn ParseCallbacks>) {}
fn main() {
// This still works
parse_callbacks(Box::new(CargoCallbacks));
// But you can use this
parse_callbacks(Box::new(CargoCallbacks.include_input_headers()));
} |
Sure, but then how good is the discoverability of |
Well... one option would be to mark the |
@CrendKing I implemented this on #2653. Could you test it to see if it does what you expect? |
Yes, it solves the issue. My only nitpick is that I hope people understand that the file they put in |
I renamed the |
Input C/C++ Header
Bindgen Invocation
Actual Results
If I change the
test
value to 1, the generated binding should update.Expected Results
No rerun happens at all.
It seems only the headers transitively included by the
wrapper.h
trigger rerun. Shouldn't it also automatically include the wrapper header?The text was updated successfully, but these errors were encountered: