From e790b706016940804e6d51091e19fe1555cd0a68 Mon Sep 17 00:00:00 2001 From: Sujan Poudel Date: Tue, 12 Dec 2023 09:21:30 +0545 Subject: [PATCH 1/2] chore: dependencies version upgrade #53 --- androidApp/build.gradle.kts | 4 ++-- buildSrc/src/main/kotlin/Versions.kt | 12 ++++++------ gradle/wrapper/gradle-wrapper.properties | 3 ++- shared/build.gradle.kts | 15 +++++++++------ .../playdeals/common/utils/isDebugBuild.kt | 3 +++ strip_google_services.sh | 2 +- 6 files changed, 23 insertions(+), 16 deletions(-) diff --git a/androidApp/build.gradle.kts b/androidApp/build.gradle.kts index 00713e9..a430e77 100644 --- a/androidApp/build.gradle.kts +++ b/androidApp/build.gradle.kts @@ -8,13 +8,13 @@ plugins { kotlin { androidTarget() sourceSets { - val androidMain by getting { + androidMain { dependencies { implementation(project(":shared")) implementation("androidx.activity:activity-compose:1.8.1") implementation("androidx.core:core-ktx:1.12.0") - implementation(platform("com.google.firebase:firebase-bom:${Versions.FIREBASE_BOM}")) + implementation(project.dependencies.platform("com.google.firebase:firebase-bom:${Versions.FIREBASE_BOM}")) implementation("com.google.firebase:firebase-analytics-ktx") implementation("com.google.firebase:firebase-messaging-ktx") } diff --git a/buildSrc/src/main/kotlin/Versions.kt b/buildSrc/src/main/kotlin/Versions.kt index 7380dff..307da76 100644 --- a/buildSrc/src/main/kotlin/Versions.kt +++ b/buildSrc/src/main/kotlin/Versions.kt @@ -1,17 +1,17 @@ object Versions { - const val KOTLIN = "1.9.10" - const val AGP = "8.1.1" - const val COMPOSE = "1.5.1" + const val KOTLIN = "1.9.20" + const val AGP = "8.2.0" + const val COMPOSE = "1.5.11" const val SETTINGS = "1.0.0" const val SQLDELIGHT = "2.0.0" const val FIREBASE_BOM = "32.3.1" - const val KTOR = "2.3.5" + const val KTOR = "2.3.6" const val KODE_IN = "7.20.2" const val COROUTINE = "1.7.3" - const val KOTLINX_DATE_TIME = "0.4.0" + const val KOTLINX_DATE_TIME = "0.4.1" const val JUNIT_JUPITER = "5.9.3" - const val MOCKK = "1.13.5" + const val MOCKK = "1.13.8" const val KO_TEST = "5.5.5" } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 0c85a1f..998b5b0 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,7 @@ +#Thu Dec 07 17:50:32 NPT 2023 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip networkTimeout=10000 zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/shared/build.gradle.kts b/shared/build.gradle.kts index 000a92e..89c33ba 100644 --- a/shared/build.gradle.kts +++ b/shared/build.gradle.kts @@ -27,14 +27,17 @@ fun KotlinNativeTarget.configureFramework() { kotlin { jvmToolchain(17) + applyDefaultHierarchyTemplate() androidTarget() jvm("desktop") - ios { configureFramework() } + + iosArm64() { configureFramework() } + iosX64() { configureFramework() } iosSimulatorArm64().configureFramework() sourceSets { - val commonMain by getting { + commonMain { dependencies { implementation(compose.ui) implementation(compose.foundation) @@ -64,7 +67,7 @@ kotlin { } } - val androidMain by getting { + androidMain { dependencies { implementation("io.ktor:ktor-client-android:${Versions.KTOR}") implementation("androidx.appcompat:appcompat:1.6.1") @@ -72,7 +75,7 @@ kotlin { implementation("androidx.startup:startup-runtime:1.1.1") implementation("com.google.accompanist:accompanist-permissions:0.32.0") - implementation(platform("com.google.firebase:firebase-bom:${Versions.FIREBASE_BOM}")) + implementation(project.dependencies.platform("com.google.firebase:firebase-bom:${Versions.FIREBASE_BOM}")) implementation("com.google.firebase:firebase-analytics-ktx") implementation("com.google.firebase:firebase-messaging-ktx") } @@ -90,7 +93,7 @@ kotlin { } } - val iosMain by getting { + iosMain { dependencies { implementation("io.ktor:ktor-client-darwin:${Versions.KTOR}") implementation("app.cash.sqldelight:native-driver:${Versions.SQLDELIGHT}") @@ -98,7 +101,7 @@ kotlin { } val iosSimulatorArm64Main by getting { - dependsOn(iosMain) + dependsOn(iosMain.get()) } val desktopMain by getting { diff --git a/shared/src/iosMain/kotlin/me/sujanpoudel/playdeals/common/utils/isDebugBuild.kt b/shared/src/iosMain/kotlin/me/sujanpoudel/playdeals/common/utils/isDebugBuild.kt index bb6c212..5f94f3d 100644 --- a/shared/src/iosMain/kotlin/me/sujanpoudel/playdeals/common/utils/isDebugBuild.kt +++ b/shared/src/iosMain/kotlin/me/sujanpoudel/playdeals/common/utils/isDebugBuild.kt @@ -1,4 +1,7 @@ package me.sujanpoudel.playdeals.common.utils +import kotlin.experimental.ExperimentalNativeApi + +@OptIn(ExperimentalNativeApi::class) actual val isDebugBuild: Boolean get() = Platform.isDebugBinary diff --git a/strip_google_services.sh b/strip_google_services.sh index ddfb441..fccea92 100755 --- a/strip_google_services.sh +++ b/strip_google_services.sh @@ -5,5 +5,5 @@ sed -i'.bak' -e '26,34d;' androidApp/src/androidMain/AndroidManifest.xml rm androidApp/src/androidMain/kotlin/me/sujanpoudel/playdeals/FcmService.kt sed -i'.bak' -e '5d;14d;18d;' shared/src/androidMain/kotlin/me/sujanpoudel/playdeals/common/pushNotification/AndroidNotificationManager.kt -sed -i'.bak' -e '75,77d;' shared/build.gradle.kts +sed -i'.bak' -e '78,80d;' shared/build.gradle.kts sed -i'.bak' -e '16d;' build.gradle.kts From 15dee4f340047d8c955b7224fb6f3790b24f8a84 Mon Sep 17 00:00:00 2001 From: Sujan Poudel Date: Tue, 12 Dec 2023 09:38:32 +0545 Subject: [PATCH 2/2] feat: foss artifacts (#54) --- .github/workflows/deployment.yml | 65 ++++++++++++++++++++++++++------ androidApp/build.gradle.kts | 1 + 2 files changed, 54 insertions(+), 12 deletions(-) diff --git a/.github/workflows/deployment.yml b/.github/workflows/deployment.yml index 86ce9fb..fde63f1 100644 --- a/.github/workflows/deployment.yml +++ b/.github/workflows/deployment.yml @@ -48,9 +48,9 @@ jobs: - name: Build Project with Gradle uses: gradle/gradle-build-action@v2 - - name: Build Release AAB and apk + - name: Build Release AAB id: build_release - run: ./gradlew androidApp:assembleRelease androidApp:bundleRelease + run: ./gradlew androidApp:bundleRelease - name: Sign AAB id: sign_aab @@ -62,6 +62,31 @@ jobs: keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }} keyPassword: ${{ secrets.KEY_PASSWORD }} + - name: Create release apk path + run: mkdir --parents androidApp/build/outputs/apks/release + + - name: Build Release APK + id: build_release_apk + run: | + ./gradlew androidApp:assembleRelease + + ## move to apks/release + mv androidApp/build/outputs/apk/release/*.apk androidApp/build/outputs/apks/release + + - name: Build Foss APK + id: build_release_apk_foss + run: | + sh strip_google_services.sh + ./gradlew androidApp:assembleRelease + + ## set appropriate nam, i.e. play-deals-*-release-unsigned.apk -> play-deals-*-release-foss-unsigned.apk + TMP_APK=$(ls androidApp/build/outputs/apk/release/*.apk) + FOSS_APK="${TMP_APK/-release-unsigned/"-release-foss-unsigned"}" + mv $TMP_APK $FOSS_APK + + ## move to apks/release + mv androidApp/build/outputs/apk/release/*.apk androidApp/build/outputs/apks/release + - name: Upload to google play console uses: r0adkll/upload-google-play@v1 id: upload_to_play_console @@ -74,22 +99,43 @@ jobs: releaseName: ${{ github.ref_name }} status: draft - - name: Sign APK + - name: Sign APKs id: sign_apk uses: r0adkll/sign-android-release@v1 with: - releaseDirectory: androidApp/build/outputs/apk/release + releaseDirectory: androidApp/build/outputs/apks/release signingKeyBase64: ${{ secrets.SIGNING_KEY }} alias: ${{ secrets.ALIAS }} keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }} keyPassword: ${{ secrets.KEY_PASSWORD }} + - name: Collect Artifacts + id: collect_artifacts + run: | + ARTIFACTS=androidApp/build/outputs/artifacts + mkdir $ARTIFACTS + + TMP_APK=$(ls androidApp/build/outputs/apks/release/*-release-unsigned-signed.apk) + RELEASE_APK="${TMP_APK/-release-unsigned-signed/""}" + mv $TMP_APK $RELEASE_APK + mv $RELEASE_APK $ARTIFACTS + + TMP_APK=$(ls androidApp/build/outputs/apks/release/*-release-foss-unsigned-signed.apk) + RELEASE_APK="${TMP_APK/-release-foss-unsigned-signed/"-foss"}" + mv $TMP_APK $RELEASE_APK + mv $RELEASE_APK $ARTIFACTS + + TMP_BUNDLE=$(ls androidApp/build/outputs/bundle/release/*.aab) + RELEASE_BUNDLE="${TMP_BUNDLE/-release/""}" + mv $TMP_BUNDLE $RELEASE_BUNDLE + mv $RELEASE_BUNDLE $TMP_BUNDLE + + echo "artifacts=$ARTIFACTS" >> $GITHUB_OUTPUT + - uses: actions/upload-artifact@v3 with: name: android-bundles - path: | - ${{ steps.sign_aab.outputs.signedReleaseFile}} - ${{ steps.sign_apk.outputs.signedReleaseFile}} + path: ${{ steps.collect_artifacts.artifacts }} desktop_release: name: Build desktop apps @@ -138,11 +184,6 @@ jobs: - name: Collect artifacts run: | mkdir artifacts - TMP_APK=$(ls downloaded/android-bundles/apk/release/*.apk) - SIGNED_APK="${TMP_APK/-release-unsigned-signed/""}" - mv $TMP_APK $SIGNED_APK - mv downloaded/android-bundles/apk/release/* artifacts/ - mv downloaded/android-bundles/bundle/release/* artifacts/ mv downloaded/**/*.* artifacts/ - uses: softprops/action-gh-release@v1 diff --git a/androidApp/build.gradle.kts b/androidApp/build.gradle.kts index a430e77..2a46f2d 100644 --- a/androidApp/build.gradle.kts +++ b/androidApp/build.gradle.kts @@ -22,6 +22,7 @@ kotlin { } } + android { compileSdk = Artifact.ANDROID_COMPILE_SDK namespace = Artifact.APP_ID