mirror of
https://github.com/ruffle-rs/ruffle-android.git
synced 2024-11-23 05:39:38 +00:00
Switch to cargo-ndk.
Skip the cargo-ndk gradle plugin on GHA.
This commit is contained in:
parent
59c3de4286
commit
afc578b716
39
.github/workflows/build.yml
vendored
39
.github/workflows/build.yml
vendored
@ -16,35 +16,41 @@ jobs:
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
target: [
|
||||
aarch64-linux-android,
|
||||
armv7-linux-androideabi,
|
||||
x86_64-linux-android,
|
||||
i686-linux-android,
|
||||
]
|
||||
include:
|
||||
- android-abi: arm64-v8a
|
||||
rust-target: aarch64-linux-android
|
||||
|
||||
- android-abi: armeabi-v7a
|
||||
rust-target: armv7-linux-androideabi
|
||||
|
||||
- android-abi: x86_64
|
||||
rust-target: x86_64-linux-android
|
||||
|
||||
- android-abi: x86
|
||||
rust-target: i686-linux-android
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Add Android target to Rust
|
||||
run: rustup target add ${{ matrix.target }}
|
||||
run: rustup target add ${{ matrix.rust-target }}
|
||||
|
||||
- name: Update Rust
|
||||
run: rustup update
|
||||
|
||||
- name: Install cargo-apk
|
||||
run: cargo install cargo-apk
|
||||
- name: Install cargo-ndk
|
||||
run: cargo install cargo-ndk
|
||||
|
||||
- name: Build native libs
|
||||
run: |
|
||||
unset ANDROID_SDK_ROOT # Deprecated, will cause an error if left set.
|
||||
cd native
|
||||
cargo apk -- build --release --target ${{ matrix.target }}
|
||||
cargo ndk --target ${{ matrix.android-abi }} --platform 29 -o ../jniLibs build --release
|
||||
|
||||
- uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: native-lib-${{ matrix.target }}
|
||||
path: native/target/${{ matrix.target }}/release/libruffle_android.so
|
||||
name: native-lib-${{ matrix.android-abi }}
|
||||
path: jniLibs
|
||||
|
||||
build-apks:
|
||||
needs: build-native-libs
|
||||
@ -60,14 +66,7 @@ jobs:
|
||||
- name: Copy native libs
|
||||
run: |
|
||||
mkdir app/ruffle/src/main/jniLibs
|
||||
mkdir app/ruffle/src/main/jniLibs/arm64-v8a
|
||||
cp native-libs/native-lib-aarch64-linux-android/libruffle_android.so app/ruffle/src/main/jniLibs/arm64-v8a/
|
||||
mkdir app/ruffle/src/main/jniLibs/armeabi-v7a
|
||||
cp native-libs/native-lib-armv7-linux-androideabi/libruffle_android.so app/ruffle/src/main/jniLibs/armeabi-v7a/
|
||||
mkdir app/ruffle/src/main/jniLibs/x86_64
|
||||
cp native-libs/native-lib-x86_64-linux-android/libruffle_android.so app/ruffle/src/main/jniLibs/x86_64/
|
||||
mkdir app/ruffle/src/main/jniLibs/x86
|
||||
cp native-libs/native-lib-i686-linux-android/libruffle_android.so app/ruffle/src/main/jniLibs/x86/
|
||||
cp -r native-libs/*/* app/ruffle/src/main/jniLibs/
|
||||
|
||||
- name: Set up Java 17
|
||||
uses: actions/setup-java@v3
|
||||
|
@ -1,5 +1,6 @@
|
||||
plugins {
|
||||
id 'com.android.application'
|
||||
id "com.github.willir.rust.cargo-ndk-android" version "0.3.4" apply false
|
||||
}
|
||||
|
||||
android {
|
||||
@ -10,7 +11,7 @@ android {
|
||||
}
|
||||
defaultConfig {
|
||||
applicationId "rs.ruffle"
|
||||
minSdk 28
|
||||
minSdk 29
|
||||
targetSdk 33
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
@ -86,4 +87,16 @@ dependencies {
|
||||
// To use the Games Text Input Library
|
||||
//implementation "androidx.games:games-text-input:1.1.0"
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// On GHA, we prebuild the native libs separately for fasterness,
|
||||
// and this plugin doesn't recognize them, so would build them again.
|
||||
if (System.getenv("GITHUB_ACTIONS") == null) {
|
||||
apply plugin: "com.github.willir.rust.cargo-ndk-android"
|
||||
|
||||
cargoNdk {
|
||||
module = "../native"
|
||||
apiLevel = 29
|
||||
buildType = "release"
|
||||
}
|
||||
}
|
||||
|
2
native/Cargo.lock
generated
2
native/Cargo.lock
generated
@ -2457,7 +2457,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "216080ab382b992234dda86873c18d4c48358f5cfcb70fd693d7f6f2131b628b"
|
||||
|
||||
[[package]]
|
||||
name = "ruffle-android"
|
||||
name = "ruffle_android"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"android-activity",
|
||||
|
@ -1,5 +1,6 @@
|
||||
[package]
|
||||
name = "ruffle-android"
|
||||
# Underscore because the cargo-ndk gradle plugin doesn't transform a hyphen to it.
|
||||
name = "ruffle_android"
|
||||
version = "0.1.0"
|
||||
authors = ["TÖRÖK Attila <torokati44@gmail.com>"]
|
||||
edition = "2018"
|
||||
|
Loading…
Reference in New Issue
Block a user