@@ -88,7 +88,30 @@ android {
88
88
}
89
89
}
90
90
}
91
- release
91
+ release {
92
+ def propertiesPath = " ${ CI_HOME_DIR} /ddg_android_build.properties"
93
+ def propertiesFile = new File (propertiesPath)
94
+ if (propertiesFile. exists()) {
95
+ def props = new Properties ()
96
+ props. load(new FileInputStream (propertiesFile))
97
+ storeFile = file(" ${ CI_HOME_DIR} /${ props['key.store']} " )
98
+ storePassword = props[' key.store.password' ]
99
+ keyAlias = props[' key.alias' ]
100
+ keyPassword = props[' key.alias.password' ]
101
+ }
102
+ }
103
+ upload {
104
+ def propertiesPath = " ${ CI_HOME_DIR} /ddg_android_build_upload.properties"
105
+ def propertiesFile = new File (propertiesPath)
106
+ if (propertiesFile. exists()) {
107
+ def props = new Properties ()
108
+ props. load(new FileInputStream (propertiesFile))
109
+ storeFile = file(" ${ CI_HOME_DIR} /${ props['key.store']} " )
110
+ storePassword = props[' key.store.password' ]
111
+ keyAlias = props[' key.alias' ]
112
+ keyPassword = props[' key.alias.password' ]
113
+ }
114
+ }
92
115
}
93
116
buildTypes {
94
117
debug {
@@ -102,11 +125,19 @@ android {
102
125
release {
103
126
minifyEnabled false
104
127
proguardFiles getDefaultProguardFile(' proguard-android.txt' ), ' proguard-rules.pro'
105
- signingConfig signingConfigs. release
106
128
manifestPlaceholders = [
107
129
appIcon : " @mipmap/ic_launcher_red" ,
108
130
appIconRound : " @mipmap/ic_launcher_red_round"
109
131
]
132
+
133
+ if (project. hasProperty(' useUploadSigning' )) {
134
+ signingConfig = signingConfigs. upload
135
+ } else if (isValidSigningConfig(signingConfigs. release)) {
136
+ signingConfig = signingConfigs. release
137
+ } else {
138
+ println " Signing properties not found, release artifacts will not be signed."
139
+ signingConfig = null
140
+ }
110
141
}
111
142
}
112
143
flavorDimensions " store"
@@ -137,20 +168,14 @@ android {
137
168
unitTests. returnDefaultValues = true
138
169
animationsDisabled = true
139
170
}
171
+ }
140
172
141
- def propertiesPath = " ${ CI_HOME_DIR} /ddg_android_build.properties"
142
- def propertiesFile = new File (propertiesPath)
143
- if (propertiesFile. exists()) {
144
- def props = new Properties ()
145
- props. load(new FileInputStream (propertiesFile))
146
- android. signingConfigs. release. storeFile = file(" ${ CI_HOME_DIR} /${ props['key.store']} " )
147
- android. signingConfigs. release. storePassword = props[' key.store.password' ]
148
- android. signingConfigs. release. keyAlias = props[' key.alias' ]
149
- android. signingConfigs. release. keyPassword = props[' key.alias.password' ]
150
- } else {
151
- println " Signing properties not found at ${ propertiesPath} , releases will NOT succeed"
152
- android. buildTypes. release. signingConfig = null
153
- }
173
+ static def isValidSigningConfig (signingConfig ) {
174
+ return signingConfig != null &&
175
+ signingConfig. storeFile?. exists() &&
176
+ signingConfig. storePassword &&
177
+ signingConfig. keyAlias &&
178
+ signingConfig. keyPassword
154
179
}
155
180
156
181
fulladleModuleConfig {
0 commit comments