From 2658f7a1b6a49f8b53c0bcfec3bba4055201c163 Mon Sep 17 00:00:00 2001 From: LooKeR Date: Sat, 7 Oct 2023 10:02:34 +0530 Subject: [PATCH 01/16] Migrate to newer actions --- .github/workflows/release_build.yml | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/.github/workflows/release_build.yml b/.github/workflows/release_build.yml index f6b104677..934cf2f10 100644 --- a/.github/workflows/release_build.yml +++ b/.github/workflows/release_build.yml @@ -23,19 +23,21 @@ jobs: uses: actions/checkout@v4.1.0 with: submodules: true - + + - name: Validate Gradle Wrapper + uses: gradle/wrapper-validation-action@v1 + - name: Set up Java 17 uses: actions/setup-java@v3.13.0 with: java-version: 17 distribution: 'adopt' cache: gradle - - - name: Grant execution permission to Gradle Wrapper - run: chmod +x gradlew - + - name: Build Release APK - run: ./gradlew assembleRelease + uses: gradle/gradle-command-action@v2 + with: + arguments: assembleRelease - name: Checks run: cd app/build && ls -R From 43360551e4ad41e7beff08e077f054ee67f2276b Mon Sep 17 00:00:00 2001 From: LooKeR Date: Sat, 7 Oct 2023 10:07:48 +0530 Subject: [PATCH 02/16] Make gradle executable --- .github/workflows/release_build.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release_build.yml b/.github/workflows/release_build.yml index 934cf2f10..d84803970 100644 --- a/.github/workflows/release_build.yml +++ b/.github/workflows/release_build.yml @@ -33,9 +33,12 @@ jobs: java-version: 17 distribution: 'adopt' cache: gradle + + - name: Grant execution permission to Gradle Wrapper + run: chmod +x gradlew - name: Build Release APK - uses: gradle/gradle-command-action@v2 + uses: gradle/gradle-build-action@v2.9.0 with: arguments: assembleRelease From ef9f0413c2e07e562728c9b217a38eb5279f120a Mon Sep 17 00:00:00 2001 From: LooKeR Date: Sat, 7 Oct 2023 10:18:22 +0530 Subject: [PATCH 03/16] Optimize debug builds --- .github/workflows/build_debug.yml | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build_debug.yml b/.github/workflows/build_debug.yml index 6f269bf36..5aa3155cd 100644 --- a/.github/workflows/build_debug.yml +++ b/.github/workflows/build_debug.yml @@ -3,16 +3,14 @@ name: Build Debug APK on: push: branches: - - '*' + - 'main' paths-ignore: - '**.md' - '**.yml' - pull_request: - branches: - - '*' + pull_request_review: paths-ignore: - '**.md' - types: [opened, reopened] + types: submitted workflow_dispatch: From 238a27d49de52ded679e88dc96be9fad7f211f0a Mon Sep 17 00:00:00 2001 From: LooKeR Date: Sat, 7 Oct 2023 10:19:17 +0530 Subject: [PATCH 04/16] Add proguard to `:core:common` --- core/common/proguard.pro | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 core/common/proguard.pro diff --git a/core/common/proguard.pro b/core/common/proguard.pro new file mode 100644 index 000000000..e87830b78 --- /dev/null +++ b/core/common/proguard.pro @@ -0,0 +1,6 @@ +-dontobfuscate + +# Disable ServiceLoader reproducibility-breaking optimizations +-keep class kotlinx.coroutines.CoroutineExceptionHandler +-keep class kotlinx.coroutines.internal.MainDispatcherFactory +-keep class com.looker.core.common.R$drawable \ No newline at end of file From 1082a7a834d44a5f86bcb27b11185dd98d9d2169 Mon Sep 17 00:00:00 2001 From: LooKeR Date: Sat, 7 Oct 2023 10:24:24 +0530 Subject: [PATCH 05/16] Try not to shrink resources --- app/src/main/res/raw/keep.xml | 3 --- core/common/src/main/res/raw/keep.xml | 3 --- 2 files changed, 6 deletions(-) delete mode 100644 app/src/main/res/raw/keep.xml delete mode 100644 core/common/src/main/res/raw/keep.xml diff --git a/app/src/main/res/raw/keep.xml b/app/src/main/res/raw/keep.xml deleted file mode 100644 index 3b9412bbe..000000000 --- a/app/src/main/res/raw/keep.xml +++ /dev/null @@ -1,3 +0,0 @@ - - diff --git a/core/common/src/main/res/raw/keep.xml b/core/common/src/main/res/raw/keep.xml deleted file mode 100644 index 3b9412bbe..000000000 --- a/core/common/src/main/res/raw/keep.xml +++ /dev/null @@ -1,3 +0,0 @@ - - From 3794b8900723a73f8f51489ae107c891c47ce027 Mon Sep 17 00:00:00 2001 From: LooKeR Date: Sat, 7 Oct 2023 10:31:26 +0530 Subject: [PATCH 06/16] Try dont warn for R files --- app/proguard.pro | 4 ++-- core/common/proguard.pro | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/proguard.pro b/app/proguard.pro index 6aa812e8d..cc9173efb 100644 --- a/app/proguard.pro +++ b/app/proguard.pro @@ -3,8 +3,8 @@ # Disable ServiceLoader reproducibility-breaking optimizations -keep class kotlinx.coroutines.CoroutineExceptionHandler -keep class kotlinx.coroutines.internal.MainDispatcherFactory --keep class com.looker.core.common.R$drawable -dontwarn kotlinx.serialization.KSerializer -dontwarn kotlinx.serialization.Serializable --dontwarn org.slf4j.impl.StaticLoggerBinder \ No newline at end of file +-dontwarn org.slf4j.impl.StaticLoggerBinder +-dontwarn com.looker.core.common.R$* \ No newline at end of file diff --git a/core/common/proguard.pro b/core/common/proguard.pro index e87830b78..faf0537e0 100644 --- a/core/common/proguard.pro +++ b/core/common/proguard.pro @@ -3,4 +3,4 @@ # Disable ServiceLoader reproducibility-breaking optimizations -keep class kotlinx.coroutines.CoroutineExceptionHandler -keep class kotlinx.coroutines.internal.MainDispatcherFactory --keep class com.looker.core.common.R$drawable \ No newline at end of file +-dontwarn com.looker.core.common.R$* \ No newline at end of file From c114947ced4ca3fd645a12526da32cc4e77f1a46 Mon Sep 17 00:00:00 2001 From: LooKeR Date: Sat, 7 Oct 2023 10:38:29 +0530 Subject: [PATCH 07/16] Try dont warn for R files --- core/common/proguard.pro | 1 - core/data/proguard.pro | 5 +++++ 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 core/data/proguard.pro diff --git a/core/common/proguard.pro b/core/common/proguard.pro index faf0537e0..637d77b04 100644 --- a/core/common/proguard.pro +++ b/core/common/proguard.pro @@ -1,6 +1,5 @@ -dontobfuscate -# Disable ServiceLoader reproducibility-breaking optimizations -keep class kotlinx.coroutines.CoroutineExceptionHandler -keep class kotlinx.coroutines.internal.MainDispatcherFactory -dontwarn com.looker.core.common.R$* \ No newline at end of file diff --git a/core/data/proguard.pro b/core/data/proguard.pro new file mode 100644 index 000000000..637d77b04 --- /dev/null +++ b/core/data/proguard.pro @@ -0,0 +1,5 @@ +-dontobfuscate + +-keep class kotlinx.coroutines.CoroutineExceptionHandler +-keep class kotlinx.coroutines.internal.MainDispatcherFactory +-dontwarn com.looker.core.common.R$* \ No newline at end of file From b87fede06c626e6fb378595f72dd1f6452006b49 Mon Sep 17 00:00:00 2001 From: LooKeR Date: Sat, 7 Oct 2023 10:44:04 +0530 Subject: [PATCH 08/16] Disable R8 fullMode --- app/proguard.pro | 3 +-- core/common/proguard.pro | 5 ----- core/data/proguard.pro | 5 ----- gradle.properties | 5 +++-- 4 files changed, 4 insertions(+), 14 deletions(-) delete mode 100644 core/common/proguard.pro delete mode 100644 core/data/proguard.pro diff --git a/app/proguard.pro b/app/proguard.pro index cc9173efb..950af2e28 100644 --- a/app/proguard.pro +++ b/app/proguard.pro @@ -6,5 +6,4 @@ -dontwarn kotlinx.serialization.KSerializer -dontwarn kotlinx.serialization.Serializable --dontwarn org.slf4j.impl.StaticLoggerBinder --dontwarn com.looker.core.common.R$* \ No newline at end of file +-dontwarn org.slf4j.impl.StaticLoggerBinder \ No newline at end of file diff --git a/core/common/proguard.pro b/core/common/proguard.pro deleted file mode 100644 index 637d77b04..000000000 --- a/core/common/proguard.pro +++ /dev/null @@ -1,5 +0,0 @@ --dontobfuscate - --keep class kotlinx.coroutines.CoroutineExceptionHandler --keep class kotlinx.coroutines.internal.MainDispatcherFactory --dontwarn com.looker.core.common.R$* \ No newline at end of file diff --git a/core/data/proguard.pro b/core/data/proguard.pro deleted file mode 100644 index 637d77b04..000000000 --- a/core/data/proguard.pro +++ /dev/null @@ -1,5 +0,0 @@ --dontobfuscate - --keep class kotlinx.coroutines.CoroutineExceptionHandler --keep class kotlinx.coroutines.internal.MainDispatcherFactory --dontwarn com.looker.core.common.R$* \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index 0aae9743d..796190ddc 100644 --- a/gradle.properties +++ b/gradle.properties @@ -14,8 +14,9 @@ org.gradle.daemon=true org.gradle.jvmargs=-Xmx6g -Dfile.encoding=UTF-8 -XX:+UseParallelGC -XX:MaxMetaspaceSize=1g android.useAndroidX=true org.gradle.parallel=true +android.nonFinalResIds=true android.enableJetifier=false +android.enableR8.fullMode=false android.nonTransitiveRClass=true -android.defaults.buildfeatures.buildconfig=false -android.nonFinalResIds=true org.gradle.unsafe.configuration-cache=true +android.defaults.buildfeatures.buildconfig=false From ae319dfc9bdf053c3828da5eeafbbe39eab2ae04 Mon Sep 17 00:00:00 2001 From: LooKeR Date: Sat, 7 Oct 2023 10:55:45 +0530 Subject: [PATCH 09/16] Try disabling R8 for `:core:common` --- core/common/build.gradle.kts | 2 +- gradle.properties | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/core/common/build.gradle.kts b/core/common/build.gradle.kts index 4368e77ae..8673365f2 100644 --- a/core/common/build.gradle.kts +++ b/core/common/build.gradle.kts @@ -12,7 +12,7 @@ android { buildTypes { release { - isMinifyEnabled = true + isMinifyEnabled = false proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt")) } create("alpha") { diff --git a/gradle.properties b/gradle.properties index 796190ddc..8a727282a 100644 --- a/gradle.properties +++ b/gradle.properties @@ -16,7 +16,7 @@ android.useAndroidX=true org.gradle.parallel=true android.nonFinalResIds=true android.enableJetifier=false -android.enableR8.fullMode=false +android.enableR8.fullMode=true android.nonTransitiveRClass=true org.gradle.unsafe.configuration-cache=true android.defaults.buildfeatures.buildconfig=false From 7b63a57ab8027590fb6f55fc698629425a4dbc00 Mon Sep 17 00:00:00 2001 From: LooKeR Date: Sat, 7 Oct 2023 11:01:20 +0530 Subject: [PATCH 10/16] Re-enable minify --- core/common/build.gradle.kts | 2 +- core/data/build.gradle.kts | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/core/common/build.gradle.kts b/core/common/build.gradle.kts index 8673365f2..4368e77ae 100644 --- a/core/common/build.gradle.kts +++ b/core/common/build.gradle.kts @@ -12,7 +12,7 @@ android { buildTypes { release { - isMinifyEnabled = false + isMinifyEnabled = true proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt")) } create("alpha") { diff --git a/core/data/build.gradle.kts b/core/data/build.gradle.kts index 899a5c57d..ad3deed7e 100644 --- a/core/data/build.gradle.kts +++ b/core/data/build.gradle.kts @@ -8,7 +8,8 @@ android { buildTypes { release { - isMinifyEnabled = true + // TODO: Enable once using + isMinifyEnabled = false proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt")) } create("alpha") { From 93f5429a10d327965ed6d9b99d76253a52ce3fef Mon Sep 17 00:00:00 2001 From: LooKeR Date: Sat, 7 Oct 2023 11:17:27 +0530 Subject: [PATCH 11/16] Find the apk file --- .github/workflows/release_build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release_build.yml b/.github/workflows/release_build.yml index d84803970..46a71a53e 100644 --- a/.github/workflows/release_build.yml +++ b/.github/workflows/release_build.yml @@ -43,7 +43,7 @@ jobs: arguments: assembleRelease - name: Checks - run: cd app/build && ls -R + run: find . -type f --name "*.apk" - uses: r0adkll/sign-android-release@v1 name: Sign app APK From 746b94697211550140e38d1f77487db3912351b5 Mon Sep 17 00:00:00 2001 From: LooKeR Date: Sat, 7 Oct 2023 11:24:54 +0530 Subject: [PATCH 12/16] Fix the find function --- .github/workflows/release_build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release_build.yml b/.github/workflows/release_build.yml index 46a71a53e..70c1715cf 100644 --- a/.github/workflows/release_build.yml +++ b/.github/workflows/release_build.yml @@ -43,7 +43,7 @@ jobs: arguments: assembleRelease - name: Checks - run: find . -type f --name "*.apk" + run: find . -type f -name "*.apk" - uses: r0adkll/sign-android-release@v1 name: Sign app APK From ddafe73aee9038db6d1cec86e61b1908a75f1b67 Mon Sep 17 00:00:00 2001 From: LooKeR Date: Sat, 7 Oct 2023 11:34:33 +0530 Subject: [PATCH 13/16] Fix release directory for now --- .github/workflows/release_build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release_build.yml b/.github/workflows/release_build.yml index 70c1715cf..ba9c3a8dd 100644 --- a/.github/workflows/release_build.yml +++ b/.github/workflows/release_build.yml @@ -49,7 +49,7 @@ jobs: name: Sign app APK id: sign_app with: - releaseDirectory: app/release + releaseDirectory: app/build/outputs/apk/release signingKeyBase64: ${{ secrets.KEY_BASE64 }} alias: ${{ secrets.ALIAS }} keyStorePassword: ${{ secrets.KEYSTORE_PASS }} From 795873f90323a474cc1393d11ee3999b05b0308e Mon Sep 17 00:00:00 2001 From: LooKeR Date: Sat, 7 Oct 2023 11:50:05 +0530 Subject: [PATCH 14/16] Upgrade BuildToolsVersion in workflow --- .github/workflows/release_build.yml | 2 ++ build-logic/structure/src/main/kotlin/DefaultConfig.kt | 1 + 2 files changed, 3 insertions(+) diff --git a/.github/workflows/release_build.yml b/.github/workflows/release_build.yml index ba9c3a8dd..9a689ebe5 100644 --- a/.github/workflows/release_build.yml +++ b/.github/workflows/release_build.yml @@ -54,6 +54,8 @@ jobs: alias: ${{ secrets.ALIAS }} keyStorePassword: ${{ secrets.KEYSTORE_PASS }} keyPassword: ${{ secrets.KEYSTORE_PASS }} + env: + BUILD_TOOLS_VERSION: "34.0.0" - uses: actions/upload-artifact@v3.1.3 with: diff --git a/build-logic/structure/src/main/kotlin/DefaultConfig.kt b/build-logic/structure/src/main/kotlin/DefaultConfig.kt index 6d0b2b5f9..d0010d38a 100644 --- a/build-logic/structure/src/main/kotlin/DefaultConfig.kt +++ b/build-logic/structure/src/main/kotlin/DefaultConfig.kt @@ -1,4 +1,5 @@ object DefaultConfig { + // Update [release_build.yml] along with this const val buildTools: String = "34.0.0" const val appId = "com.looker.droidify" const val compileSdk = 34 From 6c25acd7005e8d7424f741afed45ec1a63f53790 Mon Sep 17 00:00:00 2001 From: LooKeR Date: Sat, 7 Oct 2023 12:34:29 +0530 Subject: [PATCH 15/16] Fix alias name --- .github/workflows/release_build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release_build.yml b/.github/workflows/release_build.yml index 9a689ebe5..1e52e35f8 100644 --- a/.github/workflows/release_build.yml +++ b/.github/workflows/release_build.yml @@ -51,7 +51,7 @@ jobs: with: releaseDirectory: app/build/outputs/apk/release signingKeyBase64: ${{ secrets.KEY_BASE64 }} - alias: ${{ secrets.ALIAS }} + alias: ${{ secrets.KEY_ALIAS }} keyStorePassword: ${{ secrets.KEYSTORE_PASS }} keyPassword: ${{ secrets.KEYSTORE_PASS }} env: From f38426b83890c0fb4fd531757d580cd8f890acb4 Mon Sep 17 00:00:00 2001 From: LooKeR Date: Sat, 7 Oct 2023 14:45:41 +0530 Subject: [PATCH 16/16] Fix signing of debug build --- .github/workflows/build_debug.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_debug.yml b/.github/workflows/build_debug.yml index 5aa3155cd..51330f2e5 100644 --- a/.github/workflows/build_debug.yml +++ b/.github/workflows/build_debug.yml @@ -48,7 +48,7 @@ jobs: with: releaseDir: app/build/outputs/apk/debug signingKeyBase64: ${{ secrets.KEY_BASE64 }} - alias: ${{ secrets.ALIAS }} + alias: ${{ secrets.KEY_ALIAS }} keyStorePassword: ${{ secrets.KEYSTORE_PASS }} keyPassword: ${{ secrets.KEYSTORE_PASS }} - name: Remove file that aren't signed