Fix Android build signing configuration

This commit is contained in:
2026-07-04 14:58:27 +02:00
parent 292055ef9d
commit e8bd8adcdb
51 changed files with 351 additions and 290 deletions
+11 -13
View File
@@ -7,26 +7,24 @@ module.exports = function withAndroidSigning(config) {
const signingConfig = `
release {
if (project.hasProperty('SCHNAPPIX_RELEASE_STORE_FILE')) {
storeFile file("../../" + SCHNAPPIX_RELEASE_STORE_FILE)
storePassword SCHNAPPIX_RELEASE_STORE_PASSWORD
keyAlias SCHNAPPIX_RELEASE_KEY_ALIAS
keyPassword SCHNAPPIX_RELEASE_KEY_PASSWORD
}
storeFile file("../../schnappix-upload-key.keystore")
storePassword "#O0he7k00O0he7k00!"
keyAlias "schnappix-alias"
keyPassword "#O0he7k00O0he7k00!"
}
`;
if (!buildGradle.includes('SCHNAPPIX_RELEASE_STORE_FILE')) {
// Inject inside signingConfigs { ... }
if (!buildGradle.includes('schnappix-upload-key.keystore')) {
// Find the closing brace of the debug signing block and insert our release block
buildGradle = buildGradle.replace(
/signingConfigs\s*\{([\s\S]*?)debug\s*\{([\s\S]*?)\}/,
`signingConfigs {$1debug {$2}\n${signingConfig}`
/(signingConfigs\s*\{[\s\S]*?debug\s*\{[\s\S]*?\})\s*\}/,
`$1\n${signingConfig}\n }`
);
// Change buildTypes release to use signingConfigs.release
// Find the release buildType and update its signingConfig
buildGradle = buildGradle.replace(
/signingConfig signingConfigs\.debug/g,
`signingConfig signingConfigs.release`
/(buildTypes\s*\{[\s\S]*?release\s*\{[\s\S]*?)signingConfig signingConfigs\.debug/g,
`$1signingConfig signingConfigs.release`
);
}