-
Notifications
You must be signed in to change notification settings - Fork 328
Make "rust-async" feature optional #2723
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
base: master
Are you sure you want to change the base?
Conversation
So the reason why CI fails right now is basicaly this:
I sure can generate and push updated bindings but this would probably be wrong. I guess that the protocol for this should be something like: regenerated dart-sys, update dart-sys in Cargo.toml, upgrade FRB_MAIN_DART_VERSION and FRB_MAIN_FLUTTER_VERSION in github workflow, upgrade environment.sdk constraint in frb_dart/pubspec.yaml. So it seems to be out of scope fo this PR. |
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.
Great job! Only some small suggestions
@@ -0,0 +1,25 @@ | |||
//! RwLock implementation backed by tokio if "rust-async" feature is enabled |
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.
is it possible we do something like
#[cfg(feature = "rust-async")]
pub use tokio::sync::Soemthing;
#[cfg(not(feature = "rust-async"))]
pub use std::sync::Soemthing;
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.
it would be great to add some tests e.g. following #2681
No worries about that CI failure caused by dart sdk bump, I will handle it |
Fixes #2253
Changes
So I've got pretty much the same issue as described in #2253 - I only use
#[frb(sync)]
, so I want to turn offrust-async
andthreadpool
so there wont be 2*num_cpus threads just hangin there doing nothing. Disablingthreadpool
works fine, but when I try to disablerust-async
I get complation errors:Currently I fix this by having
rust-async
enbled and declaring a customFLUTTER_RUST_BRIDGE_HANDLER
that has no async executor. Thats fine, but I believe that this should be fixed here.So this PR tries to make
rust-async
feature optional and decouple it fromdart-opaque
.Procedure and Checklist
In order to quickly iterate and avoid slowing down development pace by making CI pass, only the following simplified steps are needed, and I (fzyzcjy) will handle the rest of CI / moving the tests currently (will have more automation in the future).
frb_example/dart_minimal
.dart_minimal
's CI green.Utility commands
cargo run --manifest-path /path/to/flutter_rust_bridge/frb_codegen/Cargo.toml -- generate
./frb_internal test-dart-native --package frb_example/dart_minimal