mirror of
https://git.quad4.io/RNS-Things/MeshChatX.git
synced 2026-10-23 19:42:26 +00:00
feat(android): update Android build process by adding SDK setup for Chaquopy native wheels and enabling ABI selection for builds
This commit is contained in:
2 files changed
+40
-5
No files matched your search
@@ -93,8 +93,26 @@ jobs:
|
||||
./rustup-init.sh -y --profile minimal --default-toolchain stable
|
||||
echo "$HOME/.cargo/bin" >> "$GITHUB_PATH"
|
||||
|
||||
- name: Set up Android SDK for Chaquopy native wheels
|
||||
run: |
|
||||
set -euo pipefail
|
||||
SDK_ROOT="${RUNNER_TEMP}/android-sdk"
|
||||
mkdir -p "${SDK_ROOT}/cmdline-tools"
|
||||
curl -fsSL -o /tmp/android-cmdline-tools.zip \
|
||||
"https://dl.google.com/android/repository/commandlinetools-linux-11076708_latest.zip"
|
||||
unzip -q /tmp/android-cmdline-tools.zip -d /tmp
|
||||
rm -f /tmp/android-cmdline-tools.zip
|
||||
mv /tmp/cmdline-tools "${SDK_ROOT}/cmdline-tools/latest"
|
||||
yes | "${SDK_ROOT}/cmdline-tools/latest/bin/sdkmanager" --sdk_root="${SDK_ROOT}" --licenses >/dev/null
|
||||
yes | "${SDK_ROOT}/cmdline-tools/latest/bin/sdkmanager" --sdk_root="${SDK_ROOT}" \
|
||||
"ndk;27.3.13750724" "platform-tools" >/dev/null
|
||||
{
|
||||
echo "ANDROID_HOME=${SDK_ROOT}"
|
||||
echo "ANDROID_SDK_ROOT=${SDK_ROOT}"
|
||||
} >> "${GITHUB_ENV}"
|
||||
|
||||
- name: Build Android wheels
|
||||
run: bash scripts/build-android-wheels-local.sh --python-minor "${PYTHON_VERSION}" --chaquopy-ref "${CHAQUOPY_REF}"
|
||||
run: bash scripts/build-android-wheels-local.sh --python-minor "${PYTHON_VERSION}" --chaquopy-ref "${CHAQUOPY_REF}" --abis arm64-v8a,x86_64,armeabi-v7a
|
||||
|
||||
- name: Run unit tests
|
||||
if: ${{ github.event_name != 'workflow_dispatch' || inputs.run_tests }}
|
||||
|
||||
@@ -9,6 +9,21 @@ def chaquopyBuildPython = System.getenv("CHAQUOPY_BUILD_PYTHON")
|
||||
def pythonTempDir = new File(buildDir, "python-tmp")
|
||||
def vendorWheelDir = new File(rootProject.projectDir, "vendor")
|
||||
def lxstPatchedWheel = new File(rootProject.projectDir, "vendor/lxst-0.4.6-py3-none-any.whl")
|
||||
def allAndroidAbis = ["arm64-v8a", "x86_64", "armeabi-v7a"]
|
||||
def selectedAndroidAbis = (
|
||||
project.findProperty("meshchatxAbis")
|
||||
?: System.getenv("MESHCHATX_ABIS")
|
||||
?: allAndroidAbis.join(",")
|
||||
).split(",").collect { it.trim() }.findAll { it }
|
||||
|
||||
if (selectedAndroidAbis.isEmpty()) {
|
||||
throw new org.gradle.api.GradleException("No Android ABIs selected. Use -PmeshchatxAbis or MESHCHATX_ABIS.")
|
||||
}
|
||||
def invalidAndroidAbis = selectedAndroidAbis.findAll { !allAndroidAbis.contains(it) }
|
||||
if (!invalidAndroidAbis.isEmpty()) {
|
||||
throw new org.gradle.api.GradleException("Unsupported ABIs: ${invalidAndroidAbis}. Supported: ${allAndroidAbis}")
|
||||
}
|
||||
def enableAbiSplits = selectedAndroidAbis.size() > 1
|
||||
|
||||
android {
|
||||
namespace 'com.meshchatx'
|
||||
@@ -23,16 +38,18 @@ android {
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
ndk {
|
||||
abiFilters "arm64-v8a", "x86_64"
|
||||
abiFilters(*selectedAndroidAbis as String[])
|
||||
}
|
||||
}
|
||||
|
||||
splits {
|
||||
abi {
|
||||
enable true
|
||||
enable enableAbiSplits
|
||||
reset()
|
||||
include "arm64-v8a", "x86_64"
|
||||
universalApk true
|
||||
if (enableAbiSplits) {
|
||||
include(*selectedAndroidAbis as String[])
|
||||
}
|
||||
universalApk enableAbiSplits
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user