@@ -112,22 +112,26 @@ android {
112
112
113
113
def localProperties = new Properties ()
114
114
localProperties. load(new FileInputStream (rootProject. file(" local.properties" )))
115
- def variantsArray = localProperties[' variantsUID' ]?. split(" ," )?. collect { it. trim() }
116
- def variantsAsArrayString = ' new String[] {' + variantsArray. collect { " \" $it \" " }. join(" , " ) + ' }'
115
+ def getPropertyOrEmpty = { key ->
116
+ def value = localProperties. getProperty(key)
117
+ return value != null ? " $value " : " \"\" "
118
+ }
119
+ def variantsArray = localProperties. getProperty(' variantsUID' )?. split(" ," )?. collect { it. trim() }
120
+ def variantsAsArrayString = variantsArray ? ' new String[] {' + variantsArray. collect { " \" $it \" " }. join(" , " ) + ' }' : " new String[0]"
117
121
buildTypes {
118
122
debug {
119
123
debuggable true
120
124
testCoverageEnabled true
121
125
proguardFiles getDefaultProguardFile(' proguard-android.txt' ), ' proguard-rules.pro'
122
126
123
- buildConfigField " String" , " host" , localProperties[ ' host' ]
124
- buildConfigField " String" , " APIKey" , localProperties[ ' APIKey' ]
125
- buildConfigField " String" , " deliveryToken" , localProperties[ ' deliveryToken' ]
126
- buildConfigField " String" , " environment" , localProperties[ ' environment' ]
127
- buildConfigField " String" , " contentTypeUID" , localProperties[ ' contentType' ]
128
- buildConfigField " String" , " assetUID" , localProperties[ ' assetUid' ]
129
- buildConfigField " String" , " variantUID" , localProperties[ ' variantUID' ]
130
- buildConfigField " String" , " variantEntryUID" , localProperties[ ' variantEntryUID' ]
127
+ buildConfigField " String" , " host" , getPropertyOrEmpty( ' host' )
128
+ buildConfigField " String" , " APIKey" , getPropertyOrEmpty( ' APIKey' )
129
+ buildConfigField " String" , " deliveryToken" , getPropertyOrEmpty( ' deliveryToken' )
130
+ buildConfigField " String" , " environment" , getPropertyOrEmpty( ' environment' )
131
+ buildConfigField " String" , " contentTypeUID" , getPropertyOrEmpty( ' contentType' )
132
+ buildConfigField " String" , " assetUID" , getPropertyOrEmpty( ' assetUid' )
133
+ buildConfigField " String" , " variantUID" , getPropertyOrEmpty( ' variantUID' )
134
+ buildConfigField " String" , " variantEntryUID" , getPropertyOrEmpty( ' variantEntryUID' )
131
135
buildConfigField " String[]" , " variantsUID" , variantsAsArrayString
132
136
}
133
137
release {
0 commit comments