From 8db5e2ce01ca17191e7dbecfe29f386b28903e0e Mon Sep 17 00:00:00 2001 From: adbenitez Date: Thu, 16 Dec 2021 00:14:16 -0500 Subject: [PATCH] improve release process, generate split apks for each arch --- .github/workflows/release.yml | 32 +++++++++++++------------------- build.gradle | 35 ++++++++++++++++------------------- jni/Application.mk | 2 +- jni/deltachat-core-rust | 2 +- ndk-make.sh | 31 ++++++++++++++++--------------- 5 files changed, 47 insertions(+), 55 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 95500f3cd..7f13a66ea 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -10,12 +10,16 @@ jobs: runs-on: ubuntu-latest outputs: match: ${{ steps.check-tag.outputs.match }} + beta: ${{ steps.check-tag.outputs.beta }} steps: - id: check-tag run: | if [[ "${{ github.event.ref }}" =~ ^refs/tags/v[0-9]+\.[0-9]+\.[0-9]+.*$ ]]; then echo ::set-output name=match::true fi + if [[ "${{ github.event.ref }}" =~ ^refs/tags/v[0-9]+\.[0-9]+\.[0-9]+.*-beta$ ]]; then + echo ::set-output name=beta::true + fi build: needs: check @@ -63,23 +67,13 @@ jobs: keyPassword: ${{ secrets.KEY_PASSWORD }} - name: Create Release - id: create_release - uses: actions/create-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - uses: "marvinpinto/action-automatic-releases@latest" with: - tag_name: ${{ github.ref }} - release_name: ${{ env.RELEASE_VERSION }} - draft: false - prerelease: false - - - name: Upload Release Asset - id: upload-release-asset - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: ${{steps.sign_app.outputs.signedReleaseFile}} - asset_name: ${{ env.RELEASE_VERSION }}.apk - asset_content_type: application/zip + repo_token: "${{ secrets.GITHUB_TOKEN }}" + prerelease: needs.check.outputs.beta == 'true' + files: | + ${{ steps.sign_app.signedReleaseFile0 }} + ${{ steps.sign_app.signedReleaseFile1 }} + ${{ steps.sign_app.signedReleaseFile2 }} + ${{ steps.sign_app.signedReleaseFile3 }} + ${{ steps.sign_app.signedReleaseFile4 }} diff --git a/build.gradle b/build.gradle index c71be3f6e..ff48212df 100644 --- a/build.gradle +++ b/build.gradle @@ -111,10 +111,6 @@ android { buildConfigField "boolean", "DEV_BUILD", "false" buildConfigField "String", "MAP_ACCESS_TOKEN", '"pk.eyJ1IjoiZGVsdGFjaGF0IiwiYSI6ImNqc3c1aWczMzBjejY0M28wZmU0a3cwMzMifQ.ZPTH9dFJaav06RAu4rTYHw"' - ndk { - abiFilters "armeabi-v7a", "arm64-v8a" //, "x86", "x86_64" - } - testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" buildConfigField("String", "TEST_ADDR", buildConfigProperty("TEST_ADDR")) @@ -139,12 +135,6 @@ android { signingConfigs { signingConfigs { - debug { - // add `DC_DEBUG_STORE_FILE=/path/to/debug.keystore` to `~/.gradle/gradle.properties` - if(project.hasProperty("DC_DEBUG_STORE_FILE" )) { - storeFile file(DC_DEBUG_STORE_FILE ) - } - } release { // can be defined at `~/.gradle/gradle.properties` or at "Build/Generate signed APK" if(project.hasProperty("DC_RELEASE_STORE_FILE")) { @@ -159,10 +149,6 @@ android { } buildTypes { - debug { - minifyEnabled false - applicationIdSuffix ".beta" - } release { applicationIdSuffix ".lite2" // minification and proguard disabled for now. @@ -182,20 +168,31 @@ android { } productFlavors { - fat { - dimension "none" - } gplay { dimension "none" applicationId "chat.delta" } } + splits { + abi { + enable true + reset() + include "armeabi-v7a", "arm64-v8a", "x86", "x86_64" + universalApk true + } + } + + project.ext.versionCodes = ['armeabi': 1, 'armeabi-v7a': 2, 'arm64-v8a': 3, 'mips': 5, 'mips64': 6, 'x86': 8, 'x86_64': 9] + android.applicationVariants.all { variant -> - variant.outputs.all { - outputFileName = outputFileName + variant.outputs.all { output -> + output.outputFileName = output.outputFileName .replace("deltalab-android", "deltachat-lite") .replace(".apk", "-${variant.versionName}.apk") + output.versionCodeOverride = + project.ext.versionCodes.get(output.getFilter( + com.android.build.OutputFile.ABI), 0) * 10000000 + android.defaultConfig.versionCode } } diff --git a/jni/Application.mk b/jni/Application.mk index 074ad3572..a9694f97d 100644 --- a/jni/Application.mk +++ b/jni/Application.mk @@ -1,3 +1,3 @@ APP_PLATFORM := android-16 -APP_ABI := armeabi-v7a arm64-v8a # x86 x86_64 +APP_ABI := armeabi-v7a arm64-v8a x86 x86_64 APP_STL := c++_static diff --git a/jni/deltachat-core-rust b/jni/deltachat-core-rust index 1fa3cdd72..ebcf5e352 160000 --- a/jni/deltachat-core-rust +++ b/jni/deltachat-core-rust @@ -1 +1 @@ -Subproject commit 1fa3cdd729a952527c2e65c04c667c4aa90ba7cc +Subproject commit ebcf5e3521ce18ddb867dbee8358952b0e198d5e diff --git a/ndk-make.sh b/ndk-make.sh index 9e47a63e9..44b7e78a0 100755 --- a/ndk-make.sh +++ b/ndk-make.sh @@ -93,21 +93,21 @@ if test -z $1 || test $1 = arm64-v8a; then cp target/aarch64-linux-android/$RELEASE/libdeltachat.a $jnidir/arm64-v8a fi -# if test -z $1 || test $1 = x86; then -# echo "-- cross compiling to i686-linux-android (x86) --" -# export CFLAGS=-D__ANDROID_API__=16 -# TARGET_CC=i686-linux-android16-clang \ -# cargo +`cat rust-toolchain` build $RELEASEFLAG --target i686-linux-android -p deltachat_ffi -# cp target/i686-linux-android/$RELEASE/libdeltachat.a $jnidir/x86 -# fi +if test -z $1 || test $1 = x86; then + echo "-- cross compiling to i686-linux-android (x86) --" + export CFLAGS=-D__ANDROID_API__=16 + TARGET_CC=i686-linux-android16-clang \ + cargo +`cat rust-toolchain` build $RELEASEFLAG --target i686-linux-android -p deltachat_ffi + cp target/i686-linux-android/$RELEASE/libdeltachat.a $jnidir/x86 +fi -# if test -z $1 || test $1 = x86_64; then -# echo "-- cross compiling to x86_64-linux-android (x86_64) --" -# export CFLAGS=-D__ANDROID_API__=21 -# TARGET_CC=x86_64-linux-android21-clang \ -# cargo +`cat rust-toolchain` build $RELEASEFLAG --target x86_64-linux-android -p deltachat_ffi -# cp target/x86_64-linux-android/$RELEASE/libdeltachat.a $jnidir/x86_64 -# fi +if test -z $1 || test $1 = x86_64; then + echo "-- cross compiling to x86_64-linux-android (x86_64) --" + export CFLAGS=-D__ANDROID_API__=21 + TARGET_CC=x86_64-linux-android21-clang \ + cargo +`cat rust-toolchain` build $RELEASEFLAG --target x86_64-linux-android -p deltachat_ffi + cp target/x86_64-linux-android/$RELEASE/libdeltachat.a $jnidir/x86_64 +fi echo -- ndk-build -- @@ -123,11 +123,12 @@ if test $1; then else # We are compiling for all architectures: TMP=$(mktemp) - sed "s/APP_ABI.*/APP_ABI := armeabi-v7a arm64-v8a/g" Application.mk >"$TMP" + sed "s/APP_ABI.*/APP_ABI := armeabi-v7a arm64-v8a x86 x86_64/g" Application.mk >"$TMP" mv "$TMP" Application.mk fi cd .. +rm -fr libs/ ndk-build cd jni