-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: introduce bindings_flutter crate (#333)
* feat: introduce bindings_flutter crate * feat: expose user preference encrypt/decrypt for flutter
- Loading branch information
1 parent
063845a
commit d28c187
Showing
138 changed files
with
7,198 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# Hint that these are generated. Practically this means: | ||
# - collapse diffs by default and | ||
# - don't count these during language analysis | ||
# https://docs.github.com/en/repositories/working-with-files/managing-files/customizing-how-changed-files-appear-on-github | ||
**/generated/** linguist-generated=true | ||
**/bridge_generated.* linguist-generated=true |
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,104 @@ | ||
name: test bindings_flutter | ||
on: | ||
pull_request: | ||
push: | ||
branches: | ||
- v2 | ||
jobs: | ||
build_android: | ||
runs-on: macos-latest | ||
defaults: | ||
run: | ||
working-directory: ./bindings_flutter | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-java@v2 | ||
with: | ||
distribution: 'zulu' | ||
java-version: '11' | ||
- uses: dtolnay/rust-toolchain@stable | ||
with: | ||
targets: aarch64-linux-android,armv7-linux-androideabi,x86_64-linux-android,i686-linux-android | ||
- uses: Swatinem/rust-cache@v2 | ||
- uses: subosito/flutter-action@v2 | ||
with: | ||
flutter-version: '3.13.9' | ||
channel: 'stable' | ||
- run: flutter pub get | ||
- run: cargo install cargo-expand | ||
- run: cargo install flutter_rust_bridge_codegen --version 1.82.4 | ||
- run: flutter_rust_bridge_codegen | ||
- run: scripts/build-android.sh | ||
- uses: actions/upload-artifact@v3 | ||
with: | ||
name: xmtp_bindings_flutter.jniLibs.tar.gz | ||
path: bindings_flutter/platform-build/xmtp_bindings_flutter.jniLibs.tar.gz | ||
retention-days: 1 | ||
build_linux: | ||
runs-on: ubuntu-latest | ||
defaults: | ||
run: | ||
working-directory: ./bindings_flutter | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: dtolnay/rust-toolchain@stable | ||
with: | ||
targets: aarch64-unknown-linux-gnu,x86_64-unknown-linux-gnu | ||
- uses: Swatinem/rust-cache@v2 | ||
- uses: subosito/flutter-action@v2 | ||
with: | ||
flutter-version: '3.13.9' | ||
channel: 'stable' | ||
- uses: goto-bus-stop/setup-zig@v2 | ||
- run: flutter pub get | ||
- run: cargo install cargo-expand | ||
- run: cargo install flutter_rust_bridge_codegen --version 1.82.4 | ||
- run: flutter_rust_bridge_codegen | ||
- run: scripts/build-linux.sh | ||
- uses: actions/upload-artifact@v3 | ||
with: | ||
name: xmtp_bindings_flutter.linux.tar.gz | ||
path: bindings_flutter/platform-build/xmtp_bindings_flutter.linux.tar.gz | ||
retention-days: 1 | ||
build_apple: | ||
runs-on: macos-latest | ||
defaults: | ||
run: | ||
working-directory: ./bindings_flutter | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: dtolnay/rust-toolchain@stable | ||
with: | ||
targets: aarch64-apple-ios,x86_64-apple-ios,aarch64-apple-ios-sim,aarch64-apple-darwin,x86_64-apple-darwin | ||
- uses: Swatinem/rust-cache@v2 | ||
- uses: subosito/flutter-action@v2 | ||
with: | ||
flutter-version: '3.13.9' | ||
channel: 'stable' | ||
- run: flutter pub get | ||
- run: cargo install cargo-expand | ||
- run: cargo install flutter_rust_bridge_codegen --version 1.82.4 | ||
- run: flutter_rust_bridge_codegen | ||
- run: scripts/build-apple.sh | ||
- uses: actions/upload-artifact@v3 | ||
with: | ||
name: xmtp_bindings_flutter.xcframework.zip | ||
path: bindings_flutter/platform-build/xmtp_bindings_flutter.xcframework.zip | ||
retention-days: 1 | ||
# Ordinarily, our .podspec script (which is triggered by pod install) | ||
# will try to download the corresponding xcframework.zip release artifact. | ||
# But because this release hasn't been published yet we short-circuit that | ||
# by moving the just-built artifact into place manually before pod install. | ||
# This way the .podspec script thinks it already downloaded it and proceeds. | ||
# See the file-exists check in the .podspec script for more details. | ||
- run: cp platform-build/xmtp_bindings_flutter.xcframework.zip macos/Frameworks/xmtp_bindings_flutter.xcframework.zip | ||
working-directory: ./bindings_flutter | ||
- run: flutter pub get | ||
working-directory: ./bindings_flutter/example | ||
- run: pod install | ||
working-directory: ./bindings_flutter/example/macos | ||
- run: flutter test -d macos integration_test | ||
working-directory: ./bindings_flutter/example | ||
# TODO: build & publish artifacts in a release job | ||
# TODO: ios/macos: update .podspec script to curl the release xcframework | ||
# TODO: android: update gradle script to download the release jniLibs |
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,14 @@ | ||
rust_input: | ||
- src/libxmtp_api.rs | ||
rust_output: | ||
- src/generated/bridge_generated.rs | ||
dart_output: | ||
- lib/src/generated/bridge_generated.dart | ||
c_output: | ||
- ios/Classes/bridge_generated.h | ||
extra_c_output_path: | ||
- macos/Classes | ||
dart_decl_output: lib/src/generated/bridge_definitions.dart | ||
dart_format_line_length: 80 | ||
wasm: false | ||
skip_add_mod_to_lib: true |
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,33 @@ | ||
# See `.flutter_rust_bridge.yml` | ||
platform-build/ | ||
|
||
# See https://www.dartlang.org/guides/libraries/private-files | ||
|
||
.flutter-plugins | ||
.flutter-plugins-dependencies | ||
|
||
# Files and directories created by pub | ||
.dart_tool/ | ||
.packages | ||
build/ | ||
# If you're building an application, you may want to check-in your pubspec.lock | ||
pubspec.lock | ||
|
||
# IntelliJ related | ||
*.iml | ||
*.ipr | ||
*.iws | ||
.idea/ | ||
|
||
# Directory created by dartdoc | ||
# If you don't generate documentation locally you can remove this line. | ||
doc/api/ | ||
|
||
# Avoid committing generated Javascript files: | ||
*.dart.js | ||
*.info.json # Produced by the --dump-info flag. | ||
*.js # When generated by dart2js. Don't specify *.js if your | ||
# project includes source files written in JavaScript. | ||
*.js_ | ||
*.js.deps | ||
*.js.map |
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,12 @@ | ||
## 0.0.1-development.3 | ||
- expose `user_preferences_encrypt()` and `user_preferences_decrypt()` | ||
|
||
## 0.0.1-development.2 | ||
- introduce setup script for artifacts during install | ||
|
||
## 0.0.1-development.1 | ||
- include generated code in the published package | ||
|
||
## 0.0.1-development | ||
- initial packaging | ||
- expose topic generator for preference storage |
Oops, something went wrong.