Skip to content

Commit

Permalink
feat: flutter v3: create client (#461)
Browse files Browse the repository at this point in the history
  • Loading branch information
dmccartney authored Jan 31, 2024
1 parent 7553f47 commit 7cb8b86
Show file tree
Hide file tree
Showing 27 changed files with 10,829 additions and 1 deletion.
6 changes: 6 additions & 0 deletions .gitattributes
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
99 changes: 99 additions & 0 deletions .github/workflows/bindings_flutter_test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
name: test bindings_flutter
on:
push:
branches:
- main
pull_request:
env:
LD_LIBRARY_PATH: ${{ github.workspace }}/bindings_flutter
jobs:
build_android:
runs-on: warp-macos-13-arm64-6x
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.16.8'
channel: 'stable'
- run: flutter pub get
- run: cargo install cargo-expand
- run: cargo install flutter_rust_bridge_codegen --version 2.0.0-dev.22
- run: flutter_rust_bridge_codegen generate
- 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: warp-ubuntu-latest-x64-4x
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
targets: x86_64-unknown-linux-gnu
- uses: Swatinem/rust-cache@v2
- uses: subosito/flutter-action@v2
with:
flutter-version: '3.16.8'
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 2.0.0-dev.22
- run: flutter_rust_bridge_codegen generate
- run: scripts/build-linux.sh
- run: cp target/x86_64-unknown-linux-gnu/release/libxmtp_bindings_flutter.so ./libxmtp_bindings_flutter.so
- run: dev/up
working-directory: ./
- run: flutter test
- 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: warp-macos-13-arm64-6x
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.16.8'
channel: 'stable'
- run: flutter pub get
- run: cargo install cargo-expand
- run: cargo install flutter_rust_bridge_codegen --version 2.0.0-dev.22
- run: flutter_rust_bridge_codegen generate
- 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
- uses: actions/upload-artifact@v3
with:
name: libxmtp_bindings_flutter.dylib
path: bindings_flutter/platform-build/libxmtp_bindings_flutter.dylib
retention-days: 1
4 changes: 4 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ jobs:
workspaces: |
.
bindings_ffi
bindings_flutter
- name: Start Docker containers
run: dev/up
Expand All @@ -43,3 +44,6 @@ jobs:
run: |
export CLASSPATH="${{ env.CLASSPATH }}"
cargo test --manifest-path bindings_ffi/Cargo.toml
- name: Run cargo test on Flutter bindings
run: cargo test --manifest-path bindings_flutter/Cargo.toml
7 changes: 6 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,12 @@ members = [
"xmtp_mls",
]

exclude = ["bindings_ffi", "bindings_wasm", "xmtp_api_grpc_gateway"]
exclude = [
"bindings_ffi",
"bindings_flutter",
"bindings_wasm",
"xmtp_api_grpc_gateway",
]

# Make the feature resolver explicit.
# See https://doc.rust-lang.org/edition-guide/rust-2021/default-cargo-resolver.html#details
Expand Down
36 changes: 36 additions & 0 deletions bindings_flutter/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# See `.flutter_rust_bridge.yml`
platform-build/
libxmtp_bindings_flutter.dylib
libxmtp_bindings_flutter.so


# 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
Loading

0 comments on commit 7cb8b86

Please sign in to comment.