diff --git a/app-k9mail/build.gradle.kts b/app-k9mail/build.gradle.kts index c228f740c3..48a12adc65 100644 --- a/app-k9mail/build.gradle.kts +++ b/app-k9mail/build.gradle.kts @@ -106,7 +106,7 @@ android { } signingConfigs { - createSigningConfig(project, SigningType.K9_RELEASE) + createSigningConfig(project, SigningType.K9_RELEASE, isUpload = false) } buildTypes { diff --git a/app-thunderbird/build.gradle.kts b/app-thunderbird/build.gradle.kts index 0414be744c..eff83a9c99 100644 --- a/app-thunderbird/build.gradle.kts +++ b/app-thunderbird/build.gradle.kts @@ -42,7 +42,7 @@ android { applicationId = "net.thunderbird.android" testApplicationId = "net.thunderbird.android.tests" - versionCode = 1 + versionCode = 2 versionName = "0.1" // Keep in sync with the resource string array "supported_languages" @@ -117,6 +117,8 @@ android { versionNameSuffix = "-SNAPSHOT" isMinifyEnabled = false + isShrinkResources = false + isDebuggable = true } release { @@ -124,6 +126,7 @@ android { isMinifyEnabled = true isShrinkResources = true + isDebuggable = false proguardFiles( getDefaultProguardFile("proguard-android.txt"), @@ -132,25 +135,39 @@ android { } create("beta") { - initWith(getByName("release")) - signingConfig = signingConfigs.getByType(SigningType.TB_BETA) applicationIdSuffix = ".beta" versionNameSuffix = "b1" + isMinifyEnabled = true + isShrinkResources = true + isDebuggable = false + matchingFallbacks += listOf("release") + + proguardFiles( + getDefaultProguardFile("proguard-android.txt"), + "proguard-rules.pro", + ) } create("daily") { - initWith(getByName("release")) - signingConfig = signingConfigs.getByType(SigningType.TB_DAILY) applicationIdSuffix = ".daily" versionNameSuffix = "a1" + isMinifyEnabled = true + isShrinkResources = true + isDebuggable = false + matchingFallbacks += listOf("release") + + proguardFiles( + getDefaultProguardFile("proguard-android.txt"), + "proguard-rules.pro", + ) } } diff --git a/build-plugin/src/main/kotlin/SigningExtensions.kt b/build-plugin/src/main/kotlin/SigningExtensions.kt index 284828244b..98dda8297d 100644 --- a/build-plugin/src/main/kotlin/SigningExtensions.kt +++ b/build-plugin/src/main/kotlin/SigningExtensions.kt @@ -6,6 +6,7 @@ import org.gradle.api.Project private const val SIGNING_FOLDER = ".signing" private const val SIGNING_FILE_ENDING = ".signing.properties" +private const val UPLOAD_FILE_ENDING = ".upload.properties" private const val PROPERTY_STORE_FILE = "storeFile" private const val PROPERTY_STORE_PASSWORD = "storePassword" @@ -16,7 +17,7 @@ private const val PROPERTY_KEY_PASSWORD = "keyPassword" * Creates an [ApkSigningConfig] for the given signing type. * * The signing properties are read from a file in the `.signing` folder in the project root directory. - * File names are expected to be in the format `$app.$type.signing.properties`. + * File names are expected to be in the format `$app.$type.signing.properties` or `$app.$type.upload.properties`. * * The file should contain the following properties: * - `$app.$type.storeFile` @@ -26,9 +27,14 @@ private const val PROPERTY_KEY_PASSWORD = "keyPassword" * * @param project the project to create the signing config for * @param signingType the signing type to create the signing config for + * @param isUpload whether the upload or signing config is used */ -fun NamedDomainObjectContainer.createSigningConfig(project: Project, signingType: SigningType) { - val properties = project.readSigningProperties(signingType) +fun NamedDomainObjectContainer.createSigningConfig( + project: Project, + signingType: SigningType, + isUpload: Boolean = true, +) { + val properties = project.readSigningProperties(signingType, isUpload) if (properties.hasSigningConfig(signingType)) { create(signingType.type) { @@ -37,6 +43,8 @@ fun NamedDomainObjectContainer.createSigningConfig(project keyAlias = properties.getSigningProperty(signingType, PROPERTY_KEY_ALIAS) keyPassword = properties.getSigningProperty(signingType, PROPERTY_KEY_PASSWORD) } + } else { + println("Signing config not created for ${signingType.type}") } } @@ -49,8 +57,13 @@ fun NamedDomainObjectContainer.getByType(signingType: Sign return findByName(signingType.type) } -private fun Project.readSigningProperties(signingType: SigningType) = Properties().apply { - val signingPropertiesFile = rootProject.file("$SIGNING_FOLDER/${signingType.id}$SIGNING_FILE_ENDING") +private fun Project.readSigningProperties(signingType: SigningType, isUpload: Boolean) = Properties().apply { + val signingPropertiesFile = if (isUpload) { + rootProject.file("$SIGNING_FOLDER/${signingType.id}$UPLOAD_FILE_ENDING") + } else { + rootProject.file("$SIGNING_FOLDER/${signingType.id}$SIGNING_FILE_ENDING") + } + if (signingPropertiesFile.exists()) { FileInputStream(signingPropertiesFile).use { inputStream -> load(inputStream)