-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(rust): add flutter_rust_bridge (#347)
* feat(rust): add flutter_rust_bridge tool Signed-off-by: bkioshn <bkioshn@gmail.com> * fix(rust): flutter_rust_bridge tool package name Signed-off-by: bkioshn <bkioshn@gmail.com> * fix(rust): flutter_rust_bridge install Signed-off-by: bkioshn <bkioshn@gmail.com> * fix(rust): add builder for flutter_rust_bridge Signed-off-by: bkioshn <bkioshn@gmail.com> * fix(flutter): create install flutter function Signed-off-by: bkioshn <bkioshn@gmail.com> * fix(rust): create install rust function Signed-off-by: bkioshn <bkioshn@gmail.com> * fix: add word to dict Signed-off-by: bkioshn <bkioshn@gmail.com> * fix: add code gen web Signed-off-by: bkioshn <bkioshn@gmail.com> * fix: code gen web as a function Signed-off-by: bkioshn <bkioshn@gmail.com> * fix: remove save artifact Signed-off-by: bkioshn <bkioshn@gmail.com> * fix(rust): rust install Signed-off-by: bkioshn <bkioshn@gmail.com> * fix: flutter_rust_bridge builder Signed-off-by: bkioshn <bkioshn@gmail.com> * fix: typo Signed-off-by: bkioshn <bkioshn@gmail.com> * fix: add flutter_rust_bridge to existing flutter example Signed-off-by: bkioshn <bkioshn@gmail.com> * fix: doc and comment Signed-off-by: bkioshn <bkioshn@gmail.com> * fix: bash check Signed-off-by: bkioshn <bkioshn@gmail.com> * fix: flutter_rust_bridge Signed-off-by: bkioshn <bkioshn@gmail.com> * fix: auto gen file Signed-off-by: bkioshn <bkioshn@gmail.com> * fix: cp file command Signed-off-by: bkioshn <bkioshn@gmail.com> * fix: rm file command Signed-off-by: bkioshn <bkioshn@gmail.com> * fix: copy contents of pkg folder, not the folder itself --------- Signed-off-by: bkioshn <bkioshn@gmail.com> Co-authored-by: Dominik Toton <dominik.toton@iohk.io>
- Loading branch information
Showing
70 changed files
with
4,929 additions
and
135 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
VERSION 0.8 | ||
|
||
IMPORT ../flutter AS flutter-ci | ||
IMPORT ../rust AS rust-ci | ||
|
||
# This will be refactored in the future | ||
# TODO(bkioshn): https://github.com/input-output-hk/catalyst-ci/issues/322 | ||
# builder: Setup necessary tools for `flutter_rust_bridge` | ||
builder: | ||
FROM debian:stable-slim | ||
|
||
WORKDIR /work | ||
|
||
RUN apt-get update \ | ||
&& apt-get install -y \ | ||
apt-utils \ | ||
wget \ | ||
tar \ | ||
xz-utils \ | ||
git \ | ||
build-essential \ | ||
curl \ | ||
unzip | ||
|
||
DO flutter-ci+INSTALL_FLUTTER | ||
DO rust-ci+INSTALL_RUST | ||
DO rust-ci+INSTALL_TOOLS | ||
|
||
# Generated necessary files for running Flutter web. | ||
CODE_GENERATOR_WEB: | ||
FUNCTION | ||
|
||
RUN flutter_rust_bridge_codegen generate --default-external-library-loader-web-prefix=/assets/packages/catalyst_key_derivation/assets/js/ | ||
RUN flutter_rust_bridge_codegen build-web | ||
|
||
RUN mkdir -p assets/js && cp -rf ./web/pkg/* assets/js/ | ||
# Don't want this gitignore file. | ||
RUN rm -rf ./assets/js/.gitignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
rust_input: crate::api | ||
rust_root: rust/ | ||
dart_output: lib/src/rust |
13 changes: 13 additions & 0 deletions
13
examples/flutter/example/integration_test/simple_test.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import 'package:flutter_test/flutter_test.dart'; | ||
import 'package:example/main.dart'; | ||
import 'package:example/src/rust/frb_generated.dart'; | ||
import 'package:integration_test/integration_test.dart'; | ||
|
||
void main() { | ||
IntegrationTestWidgetsFlutterBinding.ensureInitialized(); | ||
setUpAll(() async => await RustLib.init()); | ||
testWidgets('Can call rust function', (WidgetTester tester) async { | ||
await tester.pumpWidget(const MyApp()); | ||
expect(find.textContaining('Result: `Hello, Tom!`'), findsOneWidget); | ||
}); | ||
} |
Oops, something went wrong.