Skip to content
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

Flutter uniFFI #202

Merged
merged 13 commits into from
Oct 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
runs-on: macOS-latest
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: 🏗️ Setup l-breez repository
- name: 🏗️ Check-out l-breez repository
uses: actions/checkout@v4
with:
path: 'lbreez'
Expand All @@ -39,7 +39,7 @@ jobs:
uses: actions/checkout@v4
with:
repository: 'breez/breez-sdk-liquid'
ssh-key: ${{secrets.REPO_SSH_KEY}}
ssh-key: ${{ secrets.REPO_SSH_KEY }}
path: 'breez-sdk-liquid'
ref: ${{ inputs.liquid_sdk_ref }}

Expand Down
36 changes: 10 additions & 26 deletions .github/workflows/build-android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ jobs:
df -hI
echo "::endgroup::"

- name: 🏗️ Setup l-breez repository
- name: 🏗️ Check-out l-breez repository
uses: actions/checkout@v4
with:
path: 'lbreez'
Expand Down Expand Up @@ -234,12 +234,6 @@ jobs:
continue-on-error: true
run: just codegen

- name: Generate FFI bindings
if: ${{ needs.setup.outputs.use-published-plugins == 'false' }}
working-directory: breez-sdk-liquid/lib/bindings/langs/flutter/
continue-on-error: true
run: just ffigen

- name: 🔒 Install SSH Key
env:
SSH_PRIVATE_KEY: ${{ secrets.REPO_SSH_KEY }}
Expand All @@ -249,32 +243,22 @@ jobs:
sudo chmod 600 ~/.ssh/id_rsa
ssh-add ~/.ssh/id_rsa

- name: 🔨 Build Breez Liquid SDK
if: ${{ needs.setup.outputs.use-published-plugins == 'false' }}
working-directory: breez-sdk-liquid/lib/bindings/langs/flutter/
run: |
rm -rf ../../../target
just build

- name: 🔨 Build Android binaries
- name: 🔨 Build Breez Liquid SDK Android bindings
if: ${{ needs.setup.outputs.use-published-plugins == 'false' }}
working-directory: breez-sdk-liquid/lib/bindings/langs/flutter/
run: just build-android
run: just build-uniffi-android

- name: Copy the binaries to the needed location
- name: Link C Headers
if: ${{ needs.setup.outputs.use-published-plugins == 'false' }}
working-directory: breez-sdk-liquid/lib/bindings/langs/flutter/
run: just copy-android
continue-on-error: true
run: just link-headers

- name: 🔨 Build Breez Liquid SDK Android bindings
- name: Generate FFI bindings
if: ${{ needs.setup.outputs.use-published-plugins == 'false' }}
working-directory: breez-sdk-liquid/lib/bindings/langs/flutter/
run: just build-uniffi-android

- name: Use the production build.gradle
if: ${{ needs.setup.outputs.use-published-plugins == 'true' }}
working-directory: lbreez
run: mv android/app/build.gradle.production android/app/build.gradle
continue-on-error: true
run: just ffigen

- name: 🗂️ Populate Flutter tool's cache of binary artifacts.
working-directory: lbreez
Expand Down Expand Up @@ -325,7 +309,7 @@ jobs:
name: Android-APK
path: lbreez/build/app/outputs/flutter-apk/app-*.apk

- name: Remove Google Application Credentials file
- name: Cleanup Google Application Credentials
if: success() || failure()
run: |
if [ -d "lbreez" ] && [ -f "lbreez/google-application-credentials.json" ]; then
Expand Down
59 changes: 19 additions & 40 deletions .github/workflows/build-ios.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,13 @@ jobs:
env:
SCHEME: Runner
BUILD_CONFIGURATION: Release
TESTFLIGHT_USERNAME: ${{secrets.TESTFLIGHT_USERNAME}}
TESTFLIGHT_PASSWORD: ${{secrets.TESTFLIGHT_PASSWORD}}
TESTFLIGHT_USERNAME: ${{ secrets.TESTFLIGHT_USERNAME }}
TESTFLIGHT_PASSWORD: ${{ secrets.TESTFLIGHT_PASSWORD }}
IOS_VERSION_STRING: 0.1.0
DISTRIBUTION_CERT: ${{secrets.DISTRIBUTION_CERT}}
P12_BASE64: ${{secrets.P12_BASE64}}
P12_PASSWORD: ${{secrets.P12_PASSWORD}}
GOOGLE_SERVICES_IOS: ${{secrets.GOOGLE_SERVICES_IOS}}
DISTRIBUTION_CERT: ${{ secrets.DISTRIBUTION_CERT }}
P12_BASE64: ${{ secrets.P12_BASE64 }}
P12_PASSWORD: ${{ secrets.P12_PASSWORD }}
GOOGLE_SERVICES_IOS: ${{ secrets.GOOGLE_SERVICES_IOS }}
FIREBASE_PROJECT: breez-technology
FIREBASE_ANDROID_PACKAGE_NAME: com.breez.liquid.l_breez
FIREBASE_IOS_BUNDLE_ID: com.breez.liquid.lBreez
Expand All @@ -119,7 +119,7 @@ jobs:
df -hI
echo "::endgroup::"

- name: 🏗️ Setup l-breez repository
- name: 🏗️ Check-out l-breez repository
uses: actions/checkout@v4
with:
path: 'lbreez'
Expand Down Expand Up @@ -210,15 +210,10 @@ jobs:
uses: actions/checkout@v4
with:
repository: 'breez/breez-sdk-liquid'
ssh-key: ${{secrets.REPO_SSH_KEY}}
ssh-key: ${{ secrets.REPO_SSH_KEY }}
path: 'breez-sdk-liquid'
ref: ${{ needs.setup.outputs.liquid-sdk-ref }}

- name: Use production .podspec
if: ${{ needs.setup.outputs.use-published-plugins == 'false' }}
working-directory: breez-sdk-liquid/packages/flutter/ios/
run: mv flutter_breez_liquid.podspec.production flutter_breez_liquid.podspec

- name: 🏗️ Rust cache
if: ${{ needs.setup.outputs.use-published-plugins == 'false' }}
uses: Swatinem/rust-cache@v2
Expand All @@ -244,47 +239,31 @@ jobs:
continue-on-error: true
run: just codegen

- name: Generate FFI bindings
if: ${{ needs.setup.outputs.use-published-plugins == 'false' }}
working-directory: breez-sdk-liquid/lib/bindings/langs/flutter/
continue-on-error: true
run: just ffigen

- name: 🔒 Install SSH Key
env:
SSH_PRIVATE_KEY: ${{secrets.REPO_SSH_KEY}}
SSH_PRIVATE_KEY: ${{ secrets.REPO_SSH_KEY }}
run: |
mkdir -p ~/.ssh
echo "$SSH_PRIVATE_KEY" > ~/.ssh/id_rsa
sudo chmod 600 ~/.ssh/id_rsa
ssh-add ~/.ssh/id_rsa

- name: 🔨 Build Breez Liquid SDK
if: ${{ needs.setup.outputs.use-published-plugins == 'false' }}
working-directory: breez-sdk-liquid/lib/bindings/langs/flutter/
run: |
rm -rf ../../../target
just build

- name: 🔨 Build iOS binaries
- name: 🔨 Build Breez Liquid SDK Swift bindings
if: ${{ needs.setup.outputs.use-published-plugins == 'false' }}
working-directory: breez-sdk-liquid/lib/bindings/langs/flutter/
run: just build-apple
run: just build-uniffi-swift

- name: Copy the XCFramework to the needed location
- name: Link C Headers
if: ${{ needs.setup.outputs.use-published-plugins == 'false' }}
working-directory: breez-sdk-liquid/lib/bindings/langs/flutter/
run: just copy-apple
continue-on-error: true
run: just link-headers

- name: 🔨 Build Breez Liquid SDK Swift bindings
- name: Generate FFI bindings
if: ${{ needs.setup.outputs.use-published-plugins == 'false' }}
working-directory: breez-sdk-liquid/lib/bindings/langs/flutter/
run: just build-uniffi-swift

- name: Use the production Podfile
if: ${{ needs.setup.outputs.use-published-plugins == 'true' }}
working-directory: lbreez
run: mv ios/Podfile.production ios/Podfile
continue-on-error: true
run: just ffigen

- name: 🗂️ Populate Flutter tool's cache of binary artifacts.
working-directory: lbreez
Expand All @@ -300,7 +279,7 @@ jobs:

- name: ⚙️ Setup compile-time variables
env:
CONFIG_FILE: ${{secrets.CONFIG_FILE}}
CONFIG_FILE: ${{ secrets.CONFIG_FILE }}
run: echo "$CONFIG_FILE" > ./lbreez/config.json

- name: 📝 Install the Provisioning Profile
Expand Down Expand Up @@ -425,7 +404,7 @@ jobs:
ipa="$PWD/lbreez/build-output/ios/l_breez.ipa"
"$altool" --upload-app --type ios --file "$ipa" --username $TESTFLIGHT_USERNAME --password $TESTFLIGHT_PASSWORD

- name: Remove Google Application Credentials file
- name: Cleanup Google Application Credentials
if: success() || failure()
run: |
if [ -d "lbreez" ] && [ -f "lbreez/google-application-credentials.json" ]; then
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ migrate_working_dir/
.pub-cache/
.pub/
/build/
/build-output/
devtools_options.yaml

# Symbolication related
Expand Down
6 changes: 2 additions & 4 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -151,11 +151,9 @@ flutter {
}

dependencies {
implementation "androidx.core:core-ktx:1.12.0"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.9.22"
// Import FCM
/* FCM */
implementation 'com.google.firebase:firebase-messaging:23.4.1'
// Logging
/* Logging */
implementation 'org.tinylog:tinylog-api-kotlin:2.6.2'
implementation 'org.tinylog:tinylog-impl:2.6.2'
}
Loading
Loading