fix: defer keystore existence check to assembleRelease execution time, not config time
dev / Build debug APK (push) Failing after 18s
dev / Build debug APK (push) Failing after 18s
This commit is contained in:
1 parent
f153ad8702
commit
06d647cf72
1 file changed
+32
-24
+32
-24
@@ -47,32 +47,14 @@ android {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// --- Signing ---
|
// --- Signing ---
|
||||||
// v0.3.6.3: Fail fast (at config time) with an actionable error
|
// The release signing config is declared even when the keystore is absent;
|
||||||
// when keystore/release.jks is missing, rather than silently
|
// the existence check is deferred to assembleRelease execution time so that
|
||||||
// letting packageRelease die later with the cryptic "SigningConfig
|
// assembleDebug (which doesn't need the keystore) runs cleanly on a fresh
|
||||||
// release is missing required property storeFile". CI (see
|
// clone. CI always mints the keystore before calling assembleRelease, so
|
||||||
// .gitea/workflows/release.yml) already mints the keystore before
|
// this branch never fires in the normal workflow.
|
||||||
// assembleRelease (since v0.3.6.2), so this branch never fires on
|
|
||||||
// a release runner — only on a fresh local clone.
|
|
||||||
signingConfigs {
|
signingConfigs {
|
||||||
create("release") {
|
create("release") {
|
||||||
val keystoreFilePath = rootProject.file("keystore/release.jks")
|
storeFile = rootProject.file("keystore/release.jks")
|
||||||
if (!keystoreFilePath.exists()) {
|
|
||||||
throw GradleException(
|
|
||||||
"Missing ${keystoreFilePath.absolutePath}.\n" +
|
|
||||||
"Generate the dev keystore documented in " +
|
|
||||||
"keystore/README.md:\n" +
|
|
||||||
" keytool -genkey -noprompt -v \\\n" +
|
|
||||||
" -keystore keystore/release.jks \\\n" +
|
|
||||||
" -keyalg RSA -keysize 2048 -validity 10000 \\\n" +
|
|
||||||
" -alias incido \\\n" +
|
|
||||||
" -storepass incido_dev_keystore \\\n" +
|
|
||||||
" -keypass incido_dev_keystore \\\n" +
|
|
||||||
" -dname \"CN=Incido Dev, OU=Local, O=Incido, " +
|
|
||||||
"L=Local, ST=Local, C=NZ\""
|
|
||||||
)
|
|
||||||
}
|
|
||||||
storeFile = keystoreFilePath
|
|
||||||
storePassword = "incido_dev_keystore"
|
storePassword = "incido_dev_keystore"
|
||||||
keyAlias = "incido"
|
keyAlias = "incido"
|
||||||
keyPassword = "incido_dev_keystore"
|
keyPassword = "incido_dev_keystore"
|
||||||
@@ -89,6 +71,32 @@ android {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Fail fast with an actionable message only when assembleRelease actually
|
||||||
|
// runs and the keystore is missing — not during project configuration.
|
||||||
|
tasks.register<AbstractTask>("validateReleaseKeystore") {
|
||||||
|
group = "build"
|
||||||
|
description = "Validates that keystore/release.jks exists before assembleRelease runs"
|
||||||
|
onlyIf {
|
||||||
|
val f = rootProject.file("keystore/release.jks")
|
||||||
|
if (!f.exists()) {
|
||||||
|
throw GradleException(
|
||||||
|
"Missing ${f.absolutePath}.\n" +
|
||||||
|
"Generate the dev keystore documented in keystore/README.md:\n" +
|
||||||
|
" keytool -genkey -noprompt -v \\\n" +
|
||||||
|
" -keystore keystore/release.jks \\\n" +
|
||||||
|
" -keyalg RSA -keysize 2048 -validity 10000 \\\n" +
|
||||||
|
" -alias incido \\\n" +
|
||||||
|
" -storepass incido_dev_keystore \\\n" +
|
||||||
|
" -keypass incido_dev_keystore \\\n" +
|
||||||
|
" -dname \"CN=Incido Dev, OU=Local, O=Incido, " +
|
||||||
|
"L=Local, ST=Local, C=NZ\""
|
||||||
|
)
|
||||||
|
}
|
||||||
|
true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
tasks.named("assembleRelease") { dependsOn("validateReleaseKeystore") }
|
||||||
|
|
||||||
buildFeatures {
|
buildFeatures {
|
||||||
compose = true
|
compose = true
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user