Skip to content
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

Fix so cargo_metadata isn't a dependency without the cargo_metadata feature #2200

Merged
merged 1 commit into from
Jul 30, 2024

Conversation

mhammond
Copy link
Member

The uniffi_test crate unconditionally depends on cargo_metadata, and this will be difficult to change. This means that because uniffi_test is an unconditional dependency of uniffi_bindgen, the cargo_metadata feature doesn't actually prevent uniffi_bindgen from depending on cargo_metadata.

The top level uniffi create already has a feature bindgen-tests. This patch introduces a feature of the same name to uniffi_bindgen. Enabling that feature also enables the metadata feature. This means that if you do not enable either of these features you should be able to avoid cargo_metadata.

This patch also renames the new cargo_metadata feature to be cargo-metadata to be more consistent with our existing features and Rust feature naming in general.

This is on the path to trying to untangle the requirements for #2195, so I'd love feedback from @skeet70 - note that this doesn't actually fix the issue found there, but it's a step in the right direction. My intention is to push the actual execution of cargo metadata out to both the cli and to uniffi_testing, and this is a step in that direction.

@mhammond mhammond requested a review from bendk July 29, 2024 15:21
@mhammond mhammond requested a review from a team as a code owner July 29, 2024 15:21
…eature.

The `uniffi_test` crate unconditionally depends on `cargo_metadata`, and this will be
difficult to change. This means that because `uniffi_test` is an unconditional dependency
of `uniffi_bindgen`, the `cargo_metadata` feature doesn't actually prevent `uniffi_bindgen`
from depending on `cargo_metadata`.

The top level `uniffi` create already has a feature `bindgen-tests`. This patch
introduces a feature of the same name to `uniffi_bindgen`. Enabling that feature also
enables the metadata feature. This means that if you do not enable either of these features
you should be able to avoid `cargo_metadata`.

This patch also renames the new `cargo_metadata` feature to be `cargo-metadata` to
be more consistent with our existing features and Rust feature naming in general.
Copy link
Contributor

@skeet70 skeet70 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I think this makes sense as prerequisite of moving where the metadata run (or lack of it) happens.

@mhammond mhammond merged commit e585dc0 into mozilla:main Jul 30, 2024
5 checks passed
@mhammond mhammond deleted the push-rntxuztvtlkr branch July 30, 2024 13:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants