Fix Android Actions (#3)

* Add android

* Update android pipeline

* Update JDK

* set up toolchain

* Update abi

* More deps

* Add more target
This commit is contained in:
Daohan Chong 2022-03-22 09:54:24 +08:00 committed by GitHub
parent a4a136b6a9
commit ee00d39c79
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 45 additions and 22 deletions

View File

@ -25,24 +25,35 @@ jobs:
path: hello/target/HelloFFI.xcframework path: hello/target/HelloFFI.xcframework
retention-days: 7 retention-days: 7
# build_android: build_android:
# runs-on: ubuntu-latest runs-on: ubuntu-latest
# steps: steps:
# - uses: actions/checkout@v2 - uses: actions/checkout@v2
# with: with:
# lfs: true lfs: true
# - uses: actions/setup-java@v2 - uses: actions/setup-java@v2
# with: with:
# distribution: 'microsoft' distribution: 'temurin'
# java-version: '11' java-version: 11
# - name: Setup Android SDK cache: 'gradle'
# uses: android-actions/setup-android@v2 # Reference: https://github.com/mozilla/rust-android-gradle/blob/master/.github/workflows/check.yml
# - uses: nttld/setup-ndk@v1 - name: Setup Android SDK
# with: uses: android-actions/setup-android@v2
# ndk-version: r21e - uses: nttld/setup-ndk@v1
# - name: "Build Android library" with:
# env: ndk-version: r21e
# ANDROID_NDK_HOME: ${{ steps.setup-ndk.outputs.ndk-path }} - uses: actions-rs/toolchain@v1
# run: | # Reference: https://github.com/rust-windowing/android-ndk-rs/blob/master/.github/workflows/rust.yml
# cd hello/platforms/android/UniffiRustExample with:
# ./gradlew cargoBuild --info toolchain: stable
override: true
target: aarch64-linux-android
- name: "More dependencies"
run: |
make prepare-android
- name: "Build Android library"
env:
ANDROID_NDK_HOME: ${{ steps.setup-ndk.outputs.ndk-path }}
run: |
cd hello/platforms/android/UniffiRustExample
./gradlew cargoBuild --info

View File

@ -3,4 +3,16 @@ prepare-apple:
rustup toolchain install nightly rustup toolchain install nightly
rustup target add aarch64-apple-ios-sim --toolchain nightly && rustup target add aarch64-apple-ios x86_64-apple-ios rustup target add aarch64-apple-ios-sim --toolchain nightly && rustup target add aarch64-apple-ios x86_64-apple-ios
rustup component add rust-src --toolchain nightly rustup component add rust-src --toolchain nightly
cargo install uniffi_bindgen make install-uniffi-bindgen
prepare-android:
rustup toolchain install stable
rustup target add x86_64-linux-android
rustup target add x86_64-unknown-linux-gnu
rustup target add aarch64-linux-android
rustup target add armv7-linux-androideabi
rustup target add i686-linux-android
make install-uniffi-bindgen
install-uniffi-bindgen:
cargo install uniffi_bindgen --version 0.17.0