diff --git a/app/build.gradle b/app/build.gradle index a899b5546..d72a127b5 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -90,11 +90,10 @@ def abiPostFix = ['universal' : 0, 'x86' : 3, 'x86_64' : 4] -def keystores = [ 'debug' : loadKeystoreProperties('keystore.debug.properties'), - 'staging': loadKeystoreProperties('keystore.staging.properties')] +def keystores = [ 'debug' : loadKeystoreProperties('keystore.debug.properties') ] android { - flavorDimensions "none" + flavorDimensions 'distribution', 'environment' compileSdkVersion 29 buildToolsVersion '29.0.3' useLibrary 'org.apache.http.legacy' @@ -104,21 +103,12 @@ android { } signingConfigs { - if (keystores['debug'] != null) { + if (keystores.debug != null) { debug { - storeFile file("${project.rootDir}/${keystores['debug']['storeFile']}") - storePassword keystores['debug']['storePassword'] - keyAlias keystores['debug']['keyAlias'] - keyPassword keystores['debug']['keyPassword'] - } - } - - if (keystores['staging'] != null) { - staging { - storeFile file("${project.rootDir}/${keystores['staging']['storeFile']}") - storePassword keystores['staging']['storePassword'] - keyAlias keystores['staging']['keyAlias'] - keyPassword keystores['staging']['keyPassword'] + storeFile file("${project.rootDir}/${keystores.debug.storeFile}") + storePassword keystores.debug.storePassword + keyAlias keystores.debug.keyAlias + keyPassword keystores.debug.keyPassword } } } @@ -197,6 +187,7 @@ android { if (keystores['debug'] != null) { signingConfig signingConfigs.debug } + isDefault true minifyEnabled true proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard/proguard-firebase-messaging.pro', @@ -220,12 +211,50 @@ android { testProguardFiles 'proguard/proguard-automation.pro', 'proguard/proguard.cfg' } - staging { + flipper { initWith debug + isDefault false + minifyEnabled false + } + release { + minifyEnabled true + proguardFiles = buildTypes.debug.proguardFiles + } + } + + productFlavors { + play { + dimension 'distribution' + isDefault true + ext.websiteUpdateUrl = "null" + buildConfigField "boolean", "PLAY_STORE_DISABLED", "false" + buildConfigField "String", "NOPLAY_UPDATE_URL", "$ext.websiteUpdateUrl" + } + + website { + dimension 'distribution' + ext.websiteUpdateUrl = "https://updates.signal.org/android" + buildConfigField "boolean", "PLAY_STORE_DISABLED", "true" + buildConfigField "String", "NOPLAY_UPDATE_URL", "\"$ext.websiteUpdateUrl\"" + } + + internal { + dimension 'distribution' + ext.websiteUpdateUrl = "null" + buildConfigField "boolean", "PLAY_STORE_DISABLED", "false" + buildConfigField "String", "NOPLAY_UPDATE_URL", "$ext.websiteUpdateUrl" + } + + prod { + dimension 'environment' + + isDefault true + } + + staging { + dimension 'environment' + applicationIdSuffix ".staging" - if (keystores['staging'] != null) { - signingConfig signingConfigs.staging - } buildConfigField "String", "SIGNAL_URL", "\"https://textsecure-service-staging.whispersystems.org\"" buildConfigField "String", "STORAGE_URL", "\"https://storage-staging.signal.org\"" @@ -241,37 +270,6 @@ android { buildConfigField "String", "UNIDENTIFIED_SENDER_TRUST_ROOT", "\"BbqY1DzohE4NUZoVF+L18oUPrK3kILllLEJh2UnPSsEx\"" buildConfigField "String", "ZKGROUP_SERVER_PUBLIC_PARAMS", "\"ABSY21VckQcbSXVNCGRYJcfWHiAMZmpTtTELcDmxgdFbtp/bWsSxZdMKzfCp8rvIs8ocCU3B37fT3r4Mi5qAemeGeR2X+/YmOGR5ofui7tD5mDQfstAI9i+4WpMtIe8KC3wU5w3Inq3uNWVmoGtpKndsNfwJrCg0Hd9zmObhypUnSkfYn2ooMOOnBpfdanRtrvetZUayDMSC5iSRcXKpdls=\"" } - flipper { - initWith debug - minifyEnabled false - } - release { - minifyEnabled true - proguardFiles = buildTypes.debug.proguardFiles - } - } - - productFlavors { - play { - dimension "none" - ext.websiteUpdateUrl = "null" - buildConfigField "boolean", "PLAY_STORE_DISABLED", "false" - buildConfigField "String", "NOPLAY_UPDATE_URL", "$ext.websiteUpdateUrl" - } - - website { - dimension "none" - ext.websiteUpdateUrl = "https://updates.signal.org/android" - buildConfigField "boolean", "PLAY_STORE_DISABLED", "true" - buildConfigField "String", "NOPLAY_UPDATE_URL", "\"$ext.websiteUpdateUrl\"" - } - - internal { - dimension "none" - ext.websiteUpdateUrl = "null" - buildConfigField "boolean", "PLAY_STORE_DISABLED", "false" - buildConfigField "String", "NOPLAY_UPDATE_URL", "$ext.websiteUpdateUrl" - } } android.applicationVariants.all { variant -> @@ -423,7 +421,7 @@ dependencies { } dependencyVerification { - configuration = '(play|website)(Debug|Release)RuntimeClasspath' + configuration = '(play|website)(Prod|Staging)(Debug|Release)RuntimeClasspath' } @@ -470,13 +468,13 @@ def signProductionRelease = { variant -> task signProductionPlayRelease { doLast { - signProductionRelease(android.applicationVariants.find { (it.name == 'playRelease') }) + signProductionRelease(android.applicationVariants.find { (it.name == 'playProdRelease') }) } } task signProductionInternalRelease { doLast { - signProductionRelease(android.applicationVariants.find { (it.name == 'internalRelease') }) + signProductionRelease(android.applicationVariants.find { (it.name == 'internalProdRelease') }) } } diff --git a/build.gradle b/build.gradle index 409511e86..793e41ca3 100644 --- a/build.gradle +++ b/build.gradle @@ -19,8 +19,8 @@ subprojects { task qa { group 'Verification' description 'Quality Assurance. Run before pushing.' - dependsOn ':Signal-Android:testPlayReleaseUnitTest', - ':Signal-Android:lintPlayRelease', + dependsOn ':Signal-Android:testPlayProdReleaseUnitTest', + ':Signal-Android:lintPlayProdRelease', ':libsignal-service:test', - ':Signal-Android:assemblePlayDebug' + ':Signal-Android:assemblePlayProdDebug' }