Introduce a `dev` app flavor for side-by-side installation

This commit is contained in:
lynxnb 2022-09-30 14:22:09 +02:00
parent 8d1026d0cc
commit b17364bb92
5 changed files with 24 additions and 8 deletions

View File

@ -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' }}

View File

@ -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
}

View File

@ -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 @@
<provider
android:name=".provider.DocumentsProvider"
android:authorities="emu.skyline.provider"
android:authorities="${applicationId}.provider"
android:exported="true"
android:grantUriPermissions="true"
android:permission="android.permission.MANAGE_DOCUMENTS">

View File

@ -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()
}

View File

@ -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