From b17364bb92739162a0499972b2638767635b0492 Mon Sep 17 00:00:00 2001 From: lynxnb Date: Fri, 30 Sep 2022 14:22:09 +0200 Subject: [PATCH] Introduce a `dev` app flavor for side-by-side installation --- .github/workflows/ci.yml | 6 +++--- app/build.gradle | 15 +++++++++++++++ app/src/main/AndroidManifest.xml | 4 ++-- .../main/java/emu/skyline/EmulationActivity.kt | 2 +- .../emu/skyline/provider/DocumentsProvider.kt | 5 +++-- 5 files changed, 24 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 08b9405a..384afb97 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -54,13 +54,13 @@ jobs: CMAKE_C_COMPILER_LAUNCHER: "ccache" CMAKE_CXX_COMPILER_LAUNCHER: "ccache" CCACHE_NOCOMPRESS: "true" - run: ./gradlew --stacktrace --configuration-cache --build-cache --parallel --configure-on-demand assemble + run: ./gradlew --stacktrace --configuration-cache --build-cache --parallel --configure-on-demand assembleFull - name: Rename APKs (Signed) if: ${{ env.IS_SKYLINE_SIGNED == 'true' }} run: | - mv app/build/outputs/apk/debug/app-debug.apk skyline-$GITHUB_RUN_NUMBER-debug.apk - mv app/build/outputs/apk/release/app-release.apk skyline-$GITHUB_RUN_NUMBER-release.apk + mv app/build/outputs/apk/full/debug/app-full-debug.apk skyline-$GITHUB_RUN_NUMBER-debug.apk + mv app/build/outputs/apk/full/release/app-full-release.apk skyline-$GITHUB_RUN_NUMBER-release.apk - name: Upload Signed Debug APK if: ${{ env.IS_SKYLINE_SIGNED == 'true' }} diff --git a/app/build.gradle b/app/build.gradle index 1a4d4690..3f422883 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -81,6 +81,21 @@ android { } } + flavorDimensions += "version" + productFlavors { + full { + dimension = "version" + manifestPlaceholders = [appLabel: "Skyline"] + } + + dev { + dimension = "version" + applicationIdSuffix = ".dev" + versionNameSuffix = "-dev" + manifestPlaceholders = [appLabel: "Skyline Dev"] + } + } + buildFeatures { viewBinding true } diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index d78bb29c..de5f006c 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -18,7 +18,7 @@ android:hasFragileUserData="${shouldSaveUserData}" android:icon="@drawable/logo_skyline" android:isGame="true" - android:label="@string/app_name" + android:label="${appLabel}" android:supportsRtl="true" android:theme="@style/AppTheme" tools:ignore="GoogleAppIndexingWarning,UnusedAttribute"> @@ -105,7 +105,7 @@ diff --git a/app/src/main/java/emu/skyline/EmulationActivity.kt b/app/src/main/java/emu/skyline/EmulationActivity.kt index 682dcd9c..76bf84d1 100644 --- a/app/src/main/java/emu/skyline/EmulationActivity.kt +++ b/app/src/main/java/emu/skyline/EmulationActivity.kt @@ -635,7 +635,7 @@ class EmulationActivity : AppCompatActivity(), SurfaceHolder.Callback, View.OnTo @ExperimentalUnsignedTypes @Suppress("unused") fun getVersionCode() : Int { - val (major, minor, patch) = BuildConfig.VERSION_NAME.split('.').map { it.toUInt() } + val (major, minor, patch) = BuildConfig.VERSION_NAME.split('-')[0].split('.').map { it.toUInt() } return ((major shl 22) or (minor shl 12) or (patch)).toInt() } diff --git a/app/src/main/java/emu/skyline/provider/DocumentsProvider.kt b/app/src/main/java/emu/skyline/provider/DocumentsProvider.kt index 7ae663b5..b76d06ee 100644 --- a/app/src/main/java/emu/skyline/provider/DocumentsProvider.kt +++ b/app/src/main/java/emu/skyline/provider/DocumentsProvider.kt @@ -12,6 +12,7 @@ import android.os.ParcelFileDescriptor import android.provider.DocumentsContract import android.provider.DocumentsProvider import android.webkit.MimeTypeMap +import emu.skyline.BuildConfig import emu.skyline.R import emu.skyline.SkylineApplication import emu.skyline.getPublicFilesDir @@ -42,7 +43,7 @@ class DocumentsProvider : DocumentsProvider() { DocumentsContract.Document.COLUMN_SIZE ) - const val AUTHORITY : String = "emu.skyline.provider" + const val AUTHORITY : String = BuildConfig.APPLICATION_ID + ".provider" const val ROOT_ID : String = "root" } @@ -100,7 +101,7 @@ class DocumentsProvider : DocumentsProvider() { /** * @return A new [File] with a unique name based off the supplied [name], not conflicting with any existing file */ - fun File.resolveWithoutConflict(name: String): File { + fun File.resolveWithoutConflict(name : String) : File { var file = resolve(name) if (file.exists()) { var noConflictId = 1 // Makes sure two files don't have the same name by adding a number to the end