-
Notifications
You must be signed in to change notification settings - Fork 343
feat: (continued) allow omission of dart-opaque feature #2681
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
…--no-default-features
This addresses https://github.com/fzyzcjy/flutter_rust_bridge/actions/runs/14270290721/job/40001795109?pr=2662 by adding a The "pseudo-manual" tests using dart-opaque aren't fixed yet, I'm not quite sure what's wrong there or what would be a good way to approach it. |
That symbol is supposed to be gated on |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #2681 +/- ##
=======================================
Coverage 98.84% 98.84%
=======================================
Files 469 469
Lines 20498 20510 +12
=======================================
+ Hits 20262 20274 +12
Misses 236 236 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
I had to dig into a couple screens to figure out why the ubuntu CI jobs were "canceled". They failed with:
|
Ah, looks like we need to upgrade the ubuntu version in the CI. Do you have interest in making a PR for this? |
I put up a quick find/replace PR but if there are issues due to the change I won't have time this week to look into them |
Wow I did not realize CI became green, good job! I will have a review on it hopefully within a day. |
@@ -11,3 +11,6 @@ flutter_rust_bridge = REPLACE_ME_RUST_FRB_DEPENDENCY | |||
|
|||
[lints.rust] | |||
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(frb_expand)'] } | |||
|
|||
[features] | |||
dart-opaque = ["flutter_rust_bridge/dart-opaque"] |
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: this file is for all new projects' Cargo.toml, so it would be great to keep it unchanged
EDIT: Oh I see the reason
This can be worked around by adding the feature declaration.
Hmm, however, it would be great if we do not require all user code to have such a new feature in Cargo.toml :(
EDIT: This seems interesting https://stackoverflow.com/questions/64546459/how-can-my-crate-check-the-selected-features-of-a-dependency - is it possible we somehow utilize this approach
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.
That's an interesting hack. Never would have thought of it. Not sure if it's a good idea but I think it might work as long as the number of actually-needed feature combinations was small.
I would generalize that suggestion and say that it comes down to modifying flutter_rust_bridge::frb_generated_boilerplate_io
and flutter_rust_bridge::frb_generated_boilerplate_web
not to generate the code requiring dart-opaque
. Perhaps that StackOverflow macro approach is the best way to do that, or there might be another way.
|
||
[features] | ||
default = ["dart-opaque"] | ||
dart-opaque = ["flutter_rust_bridge/dart-opaque"] |
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: what about naming it flutter-rust-bridge--dart-opaque
or something like that, so that it is more clear we are forwarding to there when we read our test infra code.
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.
Not sure of the order of your comments, but just in case: No, this can't be renamed because the generated code from flutter_rust_bridge::frb_generated_boilerplate_* refers to "dart-opaque".
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.
Oh yes, the "EDIT" above is the last one, so we may use that approach etc.
flutter_rust_bridge = { path = "../../../frb_rust", features = [ | ||
"backtrace", | ||
"chrono", | ||
"dart-opaque", |
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: given that dart_opaque is a default feature, maybe we can keep these lines unchanged
@@ -26,5 +31,7 @@ tokio = { version = "1.34.0", features = ["rt"] } | |||
|
|||
[features] | |||
internal_feature_for_testing = [] | |||
dart-opaque = ["flutter_rust_bridge/dart-opaque"] |
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: is it possible we delete this line (same as above)
@@ -2,4 +2,4 @@ import 'package:flutter_rust_bridge_utils/flutter_rust_bridge_utils.dart'; | |||
|
|||
void main(List<String> args) async => simpleBuild(args, | |||
// This is solely used for testing | |||
features: ['internal_feature_for_testing']); | |||
features: ['dart-opaque', 'internal_feature_for_testing']); |
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: (same, can we del it)
Changes
Fixes #2661
In this implementation flutter_rust_bridge::frb_generated_boilerplate_io and web are still present in the generated code, and now they have a reference to a dart-opaque feature that isn't present by default in the client's Cargo.toml. This can be worked around by adding the feature declaration. Fixing this so the code isn't generated at all would be a much bigger change.