android: load release signing from keystore.properties
Read upload-keystore credentials from a gitignored keystore.properties (falling back to unsigned release when absent), bundle full native debug symbols for Play crash symbolication, and ignore keystore secrets. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,3 +1,6 @@
|
||||
import java.io.FileInputStream
|
||||
import java.util.Properties
|
||||
|
||||
plugins {
|
||||
alias(libs.plugins.android.application)
|
||||
alias(libs.plugins.kotlin.android)
|
||||
@@ -6,6 +9,14 @@ plugins {
|
||||
alias(libs.plugins.ksp)
|
||||
}
|
||||
|
||||
// Release signing credentials, loaded from android/keystore.properties (gitignored).
|
||||
// Falls back to no release signing when the file/keystore is absent (e.g. CI without secrets).
|
||||
val keystoreProps = Properties().apply {
|
||||
val f = rootProject.file("keystore.properties")
|
||||
if (f.exists()) load(FileInputStream(f))
|
||||
}
|
||||
val hasReleaseSigning = keystoreProps.getProperty("storeFile")?.let { file(it).exists() } == true
|
||||
|
||||
android {
|
||||
namespace = "app.voltplan.cable"
|
||||
compileSdk = 35
|
||||
@@ -25,17 +36,35 @@ android {
|
||||
resourceConfigurations += listOf("en", "de", "es", "fr", "nl")
|
||||
}
|
||||
|
||||
signingConfigs {
|
||||
if (hasReleaseSigning) {
|
||||
create("release") {
|
||||
storeFile = file(keystoreProps.getProperty("storeFile"))
|
||||
storePassword = keystoreProps.getProperty("storePassword")
|
||||
keyAlias = keystoreProps.getProperty("keyAlias")
|
||||
keyPassword = keystoreProps.getProperty("keyPassword")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
debug {
|
||||
isMinifyEnabled = false
|
||||
}
|
||||
release {
|
||||
if (hasReleaseSigning) {
|
||||
signingConfig = signingConfigs.getByName("release")
|
||||
}
|
||||
isMinifyEnabled = true
|
||||
isShrinkResources = true
|
||||
proguardFiles(
|
||||
getDefaultProguardFile("proguard-android-optimize.txt"),
|
||||
"proguard-rules.pro",
|
||||
)
|
||||
// Bundle native debug symbols so Play can symbolicate native crashes/ANRs.
|
||||
ndk {
|
||||
debugSymbolLevel = "FULL"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user