-
Notifications
You must be signed in to change notification settings - Fork 230
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
Small simplifications to the library mode implementation. #2078
Conversation
This moves all of the BindingsConfig mutations directly into `generate_external_bindings()`, the idea being that this makes all the operations easier to rationalize about and to make a future simplifications possible. Also removes the crate-name from `Source` and exposes it as a function on ComponentInterface instead.
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 good to me.
package, | ||
}) | ||
}) | ||
.collect::<Result<Vec<_>>>()?; |
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.
This step is also needed for non-external bindings, but I guess that's fine since generate_bindings
just calls generate_external_bindings
anyway. What's stopping us from merging those 2 functions together?
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.
Nothing really - this is just a small step to make future steps easier to rationalize about.
This is a breaking change for BindingGenerators, and follows up on other breaking changes made for this release (mozilla#2078). Between them, it is intended to offer a better framework for binding generators for future versions and break unintentional coupling between uniffi_bindgen and the builtin bindings. This patch updates the `BindingGenerator` trait to give binding generators more control over the binding generation process and to simplify the interactions between the generator and `uniffi_bindgen`. The trait `BindingsConfig` has been removed and replaced with a new method on `BindingGenerator` which passes the generator the entire list of all `ComponentInterface` and `Config` objects to be used in the generation, which the generator can modify as necessary. The binding generator is also passed the entire list of items to generate rather than called once per item - this gives the generator more flexibility in how the items are generated. A new `Component` struct has been introduced which holds all necessary information for a single crate/namespace, including the `ComponentInterface` and `Config`. These structs are passed to the `BindingGenerator`
This is a breaking change for BindingGenerators, and follows up on other breaking changes made for this release (mozilla#2078). Between them, it is intended to offer a better framework for binding generators for future versions and break unintentional coupling between uniffi_bindgen and the builtin bindings. This patch updates the `BindingGenerator` trait to give binding generators more control over the binding generation process and to simplify the interactions between the generator and `uniffi_bindgen`. The trait `BindingsConfig` has been removed and replaced with a new method on `BindingGenerator` which passes the generator the entire list of all `ComponentInterface` and `Config` objects to be used in the generation, which the generator can modify as necessary. The binding generator is also passed the entire list of items to generate rather than called once per item - this gives the generator more flexibility in how the items are generated. A new `Component` struct has been introduced which holds all necessary information for a single crate/namespace, including the `ComponentInterface` and `Config`. These structs are passed to the `BindingGenerator`
This is a breaking change for BindingGenerators, and follows up on other breaking changes made for this release (mozilla#2078). Between them, it is intended to offer a better framework for binding generators for future versions and break unintentional coupling between uniffi_bindgen and the builtin bindings. This patch updates the `BindingGenerator` trait to give binding generators more control over the binding generation process and to simplify the interactions between the generator and `uniffi_bindgen`. The trait `BindingsConfig` has been removed and replaced with a new method on `BindingGenerator` which passes the generator the entire list of all `ComponentInterface` and `Config` objects to be used in the generation, which the generator can modify as necessary. The binding generator is also passed the entire list of items to generate rather than called once per item - this gives the generator more flexibility in how the items are generated. A new `Component` struct has been introduced which holds all necessary information for a single crate/namespace, including the `ComponentInterface` and `Config`. These structs are passed to the `BindingGenerator`
This is a breaking change for BindingGenerators, and follows up on other breaking changes made for this release (mozilla#2078). Between them, it is intended to offer a better framework for binding generators for future versions and break unintentional coupling between uniffi_bindgen and the builtin bindings. This patch updates the `BindingGenerator` trait to give binding generators more control over the binding generation process and to simplify the interactions between the generator and `uniffi_bindgen`. The trait `BindingsConfig` has been removed and replaced with a new method on `BindingGenerator` which passes the generator the entire list of all `ComponentInterface` and `Config` objects to be used in the generation, which the generator can modify as necessary. The binding generator is also passed the entire list of items to generate rather than called once per item - this gives the generator more flexibility in how the items are generated. A new `Component` struct has been introduced which holds all necessary information for a single crate/namespace, including the `ComponentInterface` and `Config`. These structs are passed to the `BindingGenerator`
This is a breaking change for BindingGenerators, and follows up on other breaking changes made for this release (mozilla#2078). Between them, it is intended to offer a better framework for binding generators for future versions and break unintentional coupling between uniffi_bindgen and the builtin bindings. This patch updates the `BindingGenerator` trait to give binding generators more control over the binding generation process and to simplify the interactions between the generator and `uniffi_bindgen`. The trait `BindingsConfig` has been removed and replaced with a new method on `BindingGenerator` which passes the generator the entire list of all `ComponentInterface` and `Config` objects to be used in the generation, which the generator can modify as necessary. The binding generator is also passed the entire list of items to generate rather than called once per item - this gives the generator more flexibility in how the items are generated. A new `Component` struct has been introduced which holds all necessary information for a single crate/namespace, including the `ComponentInterface` and `Config`. These structs are passed to the `BindingGenerator` A new `GenerationSettings` struct is defined to pass options to the generators.
This is a breaking change for BindingGenerators, and follows up on other breaking changes made for this release (mozilla#2078). Between them, it is intended to offer a better framework for binding generators for future versions and break unintentional coupling between uniffi_bindgen and the builtin bindings. This patch updates the `BindingGenerator` trait to give binding generators more control over the binding generation process and to simplify the interactions between the generator and `uniffi_bindgen`. The trait `BindingsConfig` has been removed and replaced with a new method on `BindingGenerator` which passes the generator the entire list of all `ComponentInterface` and `Config` objects to be used in the generation, which the generator can modify as necessary. The binding generator is also passed the entire list of items to generate rather than called once per item - this gives the generator more flexibility in how the items are generated. A new `Component` struct has been introduced which holds all necessary information for a single crate/namespace, including the `ComponentInterface` and `Config`. These structs are passed to the `BindingGenerator` A new `GenerationSettings` struct is defined to pass options to the generators.
This is a breaking change for BindingGenerators, and follows up on other breaking changes made for this release (#2078). Between them, it is intended to offer a better framework for binding generators for future versions and break unintentional coupling between uniffi_bindgen and the builtin bindings. This patch updates the `BindingGenerator` trait to give binding generators more control over the binding generation process and to simplify the interactions between the generator and `uniffi_bindgen`. The trait `BindingsConfig` has been removed and replaced with a new method on `BindingGenerator` which passes the generator the entire list of all `ComponentInterface` and `Config` objects to be used in the generation, which the generator can modify as necessary. The binding generator is also passed the entire list of items to generate rather than called once per item - this gives the generator more flexibility in how the items are generated. A new `Component` struct has been introduced which holds all necessary information for a single crate/namespace, including the `ComponentInterface` and `Config`. These structs are passed to the `BindingGenerator` A new `GenerationSettings` struct is defined to pass options to the generators.
This moves all of the BindingsConfig mutations directly into
generate_external_bindings()
, the idea being that this makes all the operations easier to rationalize about and to make a future simplifications possible.Also removes the crate-name from
Source
and exposes it as a function on ComponentInterface instead.