1
1
apply plugin : ' com.android.application'
2
2
apply plugin : ' com.google.gms.google-services'
3
3
4
+ static def wrapString (aString ) {
5
+ return ' "' + aString + ' "'
6
+ }
7
+
8
+ static def wrapBoolean (value ) {
9
+ return " Boolean.parseBoolean(" + wrapString(value) + " )"
10
+ }
11
+
4
12
android {
5
13
def APP_NAME = " AuthRest"
6
14
def APP_TITLE = " Firebase Auth REST API"
@@ -26,10 +34,15 @@ android {
26
34
versionName rootProject. ext. versionName
27
35
28
36
def GOOGLE_CLIENT_SECRET = " google.client.secret"
29
- if (! properties. containsKey(GOOGLE_CLIENT_SECRET )) {
30
- project. logger. log(LogLevel . ERROR , String . format(" Can't find property: \" %s\" in the local.properties file" , GOOGLE_CLIENT_SECRET ))
37
+ def googleClientSecret
38
+ if (properties. containsKey(GOOGLE_CLIENT_SECRET )) {
39
+ googleClientSecret = properties[GOOGLE_CLIENT_SECRET ]
40
+ } else {
41
+ def errorMsg = String . format(" Can't find property: '%s' in the local.properties file" , GOOGLE_CLIENT_SECRET )
42
+ project. logger. log(LogLevel . ERROR , errorMsg)
43
+ googleClientSecret = wrapString(errorMsg)
31
44
}
32
- buildConfigField(" String" , " GOOGLE_CLIENT_SECRET" , properties[ GOOGLE_CLIENT_SECRET ] )
45
+ buildConfigField(" String" , " GOOGLE_CLIENT_SECRET" , googleClientSecret )
33
46
34
47
resValue " string" , " app_name" , APP_NAME
35
48
resValue " string" , " app_title" , APP_TITLE
0 commit comments