From f3221601bb9160de7909baa0b673f79c02a432d9 Mon Sep 17 00:00:00 2001 From: Lena Date: Wed, 1 Jul 2026 00:00:00 +0000 Subject: app: require the full signing credential set signingConfigs.release populates only when all four of KEYSTORE_PATH, KEYSTORE_PASS, KEY_ALIAS and KEY_PASS are set, but the buildTypes wiring keyed on KEYSTORE_PATH alone. A half-set environment selected a half-populated config and failed with a confusing gradle error. Gate both on the same condition. --- app/build.gradle | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'app/build.gradle') diff --git a/app/build.gradle b/app/build.gradle index d16a8d5..d0913be 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -31,18 +31,18 @@ android { // Release signing pulls credentials from the environment. Set all // four of KEYSTORE_PATH / KEYSTORE_PASS / KEY_ALIAS / KEY_PASS and // assembleRelease produces a signed APK. With any of them missing - // the release build is unsigned (Gradle's default). + // the release build is unsigned (Gradle's default); the same + // all-four condition gates the buildTypes wiring below so a + // half-set environment cannot select a half-populated config. + def signingReady = ['KEYSTORE_PATH', 'KEYSTORE_PASS', 'KEY_ALIAS', 'KEY_PASS'] + .every { System.getenv(it) } signingConfigs { release { - def ksPath = System.getenv('KEYSTORE_PATH') - def ksPass = System.getenv('KEYSTORE_PASS') - def kAlias = System.getenv('KEY_ALIAS') - def kPass = System.getenv('KEY_PASS') - if (ksPath && ksPass && kAlias && kPass) { - storeFile file(ksPath) - storePassword ksPass - keyAlias kAlias - keyPassword kPass + if (signingReady) { + storeFile file(System.getenv('KEYSTORE_PATH')) + storePassword System.getenv('KEYSTORE_PASS') + keyAlias System.getenv('KEY_ALIAS') + keyPassword System.getenv('KEY_PASS') } } } @@ -67,7 +67,7 @@ android { shrinkResources true proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' - if (System.getenv('KEYSTORE_PATH')) { + if (signingReady) { signingConfig signingConfigs.release } } -- cgit v1.2.3