From 54b86cd9e2da34eb8670727f29aaedf49680fed3 Mon Sep 17 00:00:00 2001 From: Dark_Avery Date: Mon, 23 Mar 2026 20:48:45 +0300 Subject: [PATCH] feat(android): add separate legacy32 APK build for armeabi-v7a --- .github/workflows/build.yml | 21 +++++++++++----- README.md | 33 ++++++++++++++++++++++--- android/app/build.gradle.kts | 26 +++++++++++++++++--- android/build-local-debug.sh | 47 ++++++++++++++++++++++++++++++------ 4 files changed, 105 insertions(+), 22 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 57bdb33..52f753f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -322,7 +322,8 @@ jobs: runs-on: ubuntu-latest timeout-minutes: 30 env: - ANDROID_APK_NAME: tg-ws-proxy-android-${{ github.event.inputs.version }}.apk + ANDROID_APK_STANDARD_NAME: tg-ws-proxy-android-${{ github.event.inputs.version }}.apk + ANDROID_APK_LEGACY32_NAME: tg-ws-proxy-android-${{ github.event.inputs.version }}-legacy32.apk defaults: run: working-directory: android @@ -370,7 +371,7 @@ jobs: printf '%s' "$ANDROID_KEYSTORE_BASE64" | base64 --decode > "$RUNNER_TEMP/android-release.keystore" test -s "$RUNNER_TEMP/android-release.keystore" - - name: Build Android release APK + - name: Build Android release APKs env: LOCAL_CHAQUOPY_REPO: ${{ github.workspace }}/android/.m2-chaquopy-ci ANDROID_KEYSTORE_FILE: ${{ runner.temp }}/android-release.keystore @@ -379,16 +380,23 @@ jobs: ANDROID_KEY_PASSWORD: ${{ secrets.ANDROID_KEY_PASSWORD }} run: | chmod +x gradlew build-local-debug.sh - ./build-local-debug.sh assembleRelease + ./build-local-debug.sh assembleStandardRelease + ./build-local-debug.sh assembleLegacy32Release - - name: Rename APK - run: cp app/build/outputs/apk/release/app-release.apk "app/build/outputs/apk/release/$ANDROID_APK_NAME" + - name: Rename APKs + run: | + cp app/build/outputs/apk/standard/release/app-standard-release.apk \ + "app/build/outputs/apk/standard/release/$ANDROID_APK_STANDARD_NAME" + cp app/build/outputs/apk/legacy32/release/app-legacy32-release.apk \ + "app/build/outputs/apk/legacy32/release/$ANDROID_APK_LEGACY32_NAME" - name: Upload artifact uses: actions/upload-artifact@v4 with: name: TgWsProxy-android-release - path: android/app/build/outputs/apk/release/${{ env.ANDROID_APK_NAME }} + path: | + android/app/build/outputs/apk/standard/release/${{ env.ANDROID_APK_STANDARD_NAME }} + android/app/build/outputs/apk/legacy32/release/${{ env.ANDROID_APK_LEGACY32_NAME }} release: needs: [build-windows, build-win7, build-macos, build-linux, build-android] @@ -422,6 +430,7 @@ jobs: dist/TgWsProxy_linux_amd64 dist/TgWsProxy_linux_amd64.deb dist/tg-ws-proxy-android-${{ github.event.inputs.version }}.apk + dist/tg-ws-proxy-android-${{ github.event.inputs.version }}-legacy32.apk draft: false prerelease: false env: diff --git a/README.md b/README.md index fa687a1..121d240 100644 --- a/README.md +++ b/README.md @@ -142,13 +142,25 @@ tg-ws-proxy [--port PORT] [--host HOST] [--dc-ip DC:IP ...] [-v] Требуются JDK 17, Android SDK и Gradle. Локальная debug-сборка: ```bash -./android/build-local-debug.sh +./android/build-local-debug.sh assembleStandardDebug ``` Результат: ```text -android/app/build/outputs/apk/debug/app-debug.apk +android/app/build/outputs/apk/standard/debug/app-standard-debug.apk +``` + +Legacy32 debug-сборка: + +```bash +./android/build-local-debug.sh assembleLegacy32Debug +``` + +Результат: + +```text +android/app/build/outputs/apk/legacy32/debug/app-legacy32-debug.apk ``` ### Android signed release APK @@ -166,13 +178,15 @@ export ANDROID_KEY_PASSWORD=... ```bash cd android -./gradlew assembleRelease +./build-local-debug.sh assembleStandardRelease +./build-local-debug.sh assembleLegacy32Release ``` Результат: ```text -android/app/build/outputs/apk/release/app-release.apk +android/app/build/outputs/apk/standard/release/app-standard-release.apk +android/app/build/outputs/apk/legacy32/release/app-legacy32-release.apk ``` **Аргументы:** @@ -285,6 +299,17 @@ Tray-приложение хранит данные в: - Apple Silicon macOS 11.0+ - Linux x86_64 (требуется AppIndicator для системного трея) +Android-артефакты: + +- `tg-ws-proxy-android-vX.Y.Z.apk` +- `tg-ws-proxy-android-vX.Y.Z-legacy32.apk` + +Для signed Android release в GitHub Actions нужны secrets: + +- `ANDROID_KEYSTORE_BASE64` +- `ANDROID_KEYSTORE_PASSWORD` +- `ANDROID_KEY_ALIAS` +- `ANDROID_KEY_PASSWORD` ## Лицензия [MIT License](LICENSE) diff --git a/android/app/build.gradle.kts b/android/app/build.gradle.kts index 7fdacff..216b0e5 100644 --- a/android/app/build.gradle.kts +++ b/android/app/build.gradle.kts @@ -70,9 +70,22 @@ android { versionName = "0.1.0" testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" + } - ndk { - abiFilters += listOf("arm64-v8a", "x86_64") + flavorDimensions += "runtime" + productFlavors { + create("standard") { + dimension = "runtime" + ndk { + abiFilters += listOf("arm64-v8a", "x86_64") + } + } + create("legacy32") { + dimension = "runtime" + versionNameSuffix = "-legacy32" + ndk { + abiFilters += listOf("armeabi-v7a") + } } } @@ -115,8 +128,13 @@ android { } chaquopy { - defaultConfig { - version = "3.12" + productFlavors { + getByName("standard") { + version = "3.12" + } + getByName("legacy32") { + version = "3.11" + } } sourceSets { getByName("main") { diff --git a/android/build-local-debug.sh b/android/build-local-debug.sh index 402fb06..5f26367 100644 --- a/android/build-local-debug.sh +++ b/android/build-local-debug.sh @@ -43,10 +43,26 @@ fi ATTEMPTS="${ATTEMPTS:-5}" SLEEP_SECONDS="${SLEEP_SECONDS:-15}" -TASK="${1:-assembleDebug}" +TASK="${1:-assembleStandardDebug}" LOCAL_CHAQUOPY_REPO="${LOCAL_CHAQUOPY_REPO:-$ROOT_DIR/.m2-chaquopy}" CHAQUOPY_MAVEN_BASE="${CHAQUOPY_MAVEN_BASE:-https://repo.maven.apache.org/maven2}" +task_uses_legacy32() { + [[ "$TASK" =~ [Ll]egacy32 ]] +} + +task_uses_standard() { + if [[ "$TASK" =~ [Ss]tandard ]]; then + return 0 + fi + + if task_uses_legacy32; then + return 1 + fi + + return 0 +} + prefetch_artifact() { local relative_path="$1" local destination="$LOCAL_CHAQUOPY_REPO/$relative_path" @@ -76,15 +92,30 @@ prefetch_chaquopy_runtime() { "com/chaquo/python/runtime/chaquopy_java/17.0.0/chaquopy_java-17.0.0.pom" "com/chaquo/python/runtime/chaquopy_java/17.0.0/chaquopy_java-17.0.0.jar" "com/chaquo/python/runtime/libchaquopy_java/17.0.0/libchaquopy_java-17.0.0.pom" - "com/chaquo/python/runtime/libchaquopy_java/17.0.0/libchaquopy_java-17.0.0-3.12-arm64-v8a.so" - "com/chaquo/python/runtime/libchaquopy_java/17.0.0/libchaquopy_java-17.0.0-3.12-x86_64.so" - "com/chaquo/python/target/3.12.12-0/target-3.12.12-0.pom" - "com/chaquo/python/target/3.12.12-0/target-3.12.12-0-arm64-v8a.zip" - "com/chaquo/python/target/3.12.12-0/target-3.12.12-0-stdlib-pyc.zip" - "com/chaquo/python/target/3.12.12-0/target-3.12.12-0-stdlib.zip" - "com/chaquo/python/target/3.12.12-0/target-3.12.12-0-x86_64.zip" ) + if task_uses_standard; then + artifacts+=( + "com/chaquo/python/runtime/libchaquopy_java/17.0.0/libchaquopy_java-17.0.0-3.12-arm64-v8a.so" + "com/chaquo/python/runtime/libchaquopy_java/17.0.0/libchaquopy_java-17.0.0-3.12-x86_64.so" + "com/chaquo/python/target/3.12.12-0/target-3.12.12-0.pom" + "com/chaquo/python/target/3.12.12-0/target-3.12.12-0-arm64-v8a.zip" + "com/chaquo/python/target/3.12.12-0/target-3.12.12-0-stdlib-pyc.zip" + "com/chaquo/python/target/3.12.12-0/target-3.12.12-0-stdlib.zip" + "com/chaquo/python/target/3.12.12-0/target-3.12.12-0-x86_64.zip" + ) + fi + + if task_uses_legacy32; then + artifacts+=( + "com/chaquo/python/runtime/libchaquopy_java/17.0.0/libchaquopy_java-17.0.0-3.11-armeabi-v7a.so" + "com/chaquo/python/target/3.11.10-0/target-3.11.10-0.pom" + "com/chaquo/python/target/3.11.10-0/target-3.11.10-0-armeabi-v7a.zip" + "com/chaquo/python/target/3.11.10-0/target-3.11.10-0-stdlib-pyc.zip" + "com/chaquo/python/target/3.11.10-0/target-3.11.10-0-stdlib.zip" + ) + fi + for artifact in "${artifacts[@]}"; do prefetch_artifact "$artifact" done