- compileSdk/targetSdk 36: Google Play rejects new apps below API 36 since 31 August 2026. - Release signing from ANDROID_KEYSTORE_* environment variables or local.properties; unsigned when no upload key is configured. - versionCode/versionName overridable via VERSION_CODE/VERSION_NAME. - scripts/build-release-aab.sh builds and verifies a signed AAB. - CI installs platform 36 until the CI image is rebuilt. - Document the internal-testing upload flow.
This commit is contained in:
1 parent
43bd9629d3
commit
9b105b3925
6 files changed
+179
-10
No files matched your search
@@ -1,5 +1,6 @@
|
||||
@file:OptIn(org.jetbrains.kotlin.gradle.ExperimentalWasmDsl::class)
|
||||
|
||||
import java.util.Properties
|
||||
import org.jetbrains.compose.desktop.application.dsl.TargetFormat
|
||||
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
|
||||
|
||||
@@ -11,6 +12,34 @@ plugins {
|
||||
id("com.android.application")
|
||||
}
|
||||
|
||||
// Release signing and version numbers come from the environment in CI, or from
|
||||
// local.properties for local release builds. Nothing secret is committed:
|
||||
// local.properties is git-ignored. Without an upload key the release build
|
||||
// still works, but the AAB is unsigned and cannot be uploaded to Play.
|
||||
val localProperties = Properties().apply {
|
||||
val file = rootProject.file("local.properties")
|
||||
if (file.exists()) file.inputStream().use { load(it) }
|
||||
}
|
||||
|
||||
fun signingValue(property: String, env: String): String? =
|
||||
(System.getenv(env) ?: localProperties.getProperty(property))?.takeIf { it.isNotBlank() }
|
||||
|
||||
val uploadKeyStore = signingValue("UPLOAD_STORE_FILE", "ANDROID_KEYSTORE_PATH")?.let { rootProject.file(it) }
|
||||
val uploadKeyStorePassword = signingValue("UPLOAD_STORE_PASSWORD", "ANDROID_KEYSTORE_PASSWORD")
|
||||
val uploadKeyAlias = signingValue("UPLOAD_KEY_ALIAS", "ANDROID_KEY_ALIAS")
|
||||
val uploadKeyPassword = signingValue("UPLOAD_KEY_PASSWORD", "ANDROID_KEY_PASSWORD")
|
||||
val hasUploadKey = uploadKeyStore?.exists() == true &&
|
||||
!uploadKeyStorePassword.isNullOrEmpty() &&
|
||||
!uploadKeyAlias.isNullOrEmpty() &&
|
||||
!uploadKeyPassword.isNullOrEmpty()
|
||||
|
||||
// Play requires a strictly increasing versionCode for every upload. CI can pass
|
||||
// VERSION_CODE / VERSION_NAME (for example from the git tag).
|
||||
val appVersionCode = (System.getenv("VERSION_CODE") ?: localProperties.getProperty("VERSION_CODE") ?: "1").toInt()
|
||||
val appVersionName = System.getenv("VERSION_NAME")
|
||||
?: localProperties.getProperty("VERSION_NAME")
|
||||
?: "0.1.0"
|
||||
|
||||
kotlin {
|
||||
androidTarget {
|
||||
compilerOptions {
|
||||
@@ -85,14 +114,35 @@ kotlin {
|
||||
|
||||
android {
|
||||
namespace = "win.taptap.musicmanager.client"
|
||||
compileSdk = 35
|
||||
// Google Play requires new apps and updates to target API 36 from
|
||||
// 31 August 2026.
|
||||
compileSdk = 36
|
||||
|
||||
defaultConfig {
|
||||
applicationId = "win.taptap.musicmanager.client"
|
||||
minSdk = 26
|
||||
targetSdk = 35
|
||||
versionCode = 1
|
||||
versionName = "0.1.0"
|
||||
targetSdk = 36
|
||||
versionCode = appVersionCode
|
||||
versionName = appVersionName
|
||||
}
|
||||
|
||||
signingConfigs {
|
||||
if (hasUploadKey) {
|
||||
create("release") {
|
||||
storeFile = uploadKeyStore
|
||||
storePassword = uploadKeyStorePassword
|
||||
keyAlias = uploadKeyAlias
|
||||
keyPassword = uploadKeyPassword
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
if (hasUploadKey) signingConfig = signingConfigs.getByName("release")
|
||||
isMinifyEnabled = false
|
||||
isShrinkResources = false
|
||||
}
|
||||
}
|
||||
|
||||
compileOptions {
|
||||
|
||||
Reference in new issue
Block a user