Allow more control over debug and staging signing.

fork-5.53.8
Greyson Parrelli 2020-11-02 08:18:50 -05:00
rodzic 4c43b0d1e3
commit 49e1ccea28
2 zmienionych plików z 38 dodań i 6 usunięć

2
.gitignore vendored
Wyświetl plik

@ -1,6 +1,8 @@
.classpath .classpath
captures/ captures/
project.properties project.properties
keystore.debug.properties
keystore.staging.properties
.project .project
.settings .settings
bin/ bin/

Wyświetl plik

@ -90,6 +90,9 @@ def abiPostFix = ['universal' : 0,
'x86' : 3, 'x86' : 3,
'x86_64' : 4] 'x86_64' : 4]
def keystores = [ 'debug' : loadKeystoreProperties('keystore.debug.properties'),
'staging': loadKeystoreProperties('keystore.staging.properties')]
android { android {
flavorDimensions "none" flavorDimensions "none"
compileSdkVersion 29 compileSdkVersion 29
@ -101,11 +104,22 @@ android {
} }
signingConfigs { signingConfigs {
staging { if (keystores['debug'] != null) {
storeFile file("${project.rootDir}/dev.keystore") debug {
storePassword 'android' storeFile file("${project.rootDir}/${keystores['debug']['storeFile']}")
keyAlias 'staging' storePassword keystores['debug']['storePassword']
keyPassword 'android' 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']
}
} }
} }
@ -180,6 +194,9 @@ android {
buildTypes { buildTypes {
debug { debug {
if (keystores['debug'] != null) {
signingConfig signingConfigs.debug
}
minifyEnabled true minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard/proguard-firebase-messaging.pro', 'proguard/proguard-firebase-messaging.pro',
@ -206,7 +223,9 @@ android {
staging { staging {
initWith debug initWith debug
applicationIdSuffix ".staging" applicationIdSuffix ".staging"
signingConfig signingConfigs.staging if (keystores['staging'] != null) {
signingConfig signingConfigs.staging
}
buildConfigField "String", "SIGNAL_URL", "\"https://textsecure-service-staging.whispersystems.org\"" buildConfigField "String", "SIGNAL_URL", "\"https://textsecure-service-staging.whispersystems.org\""
buildConfigField "String", "STORAGE_URL", "\"https://storage-staging.signal.org\"" buildConfigField "String", "STORAGE_URL", "\"https://storage-staging.signal.org\""
@ -490,3 +509,14 @@ tasks.withType(Test) {
showStackTraces true showStackTraces true
} }
} }
def loadKeystoreProperties(filename) {
def keystorePropertiesFile = file("${project.rootDir}/${filename}")
if (keystorePropertiesFile.exists()) {
def keystoreProperties = new Properties()
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
return keystoreProperties;
} else {
return null;
}
}