Skip to content

Commit c1b1ef5

Browse files
committed
fix JitPack build failed due to missing local.properties
1 parent 4ff5507 commit c1b1ef5

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

app/build.gradle

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
apply plugin: 'com.android.application'
22
apply plugin: 'com.google.gms.google-services'
33

4+
static def wrapString(aString) {
5+
return '"' + aString + '"'
6+
}
7+
8+
static def wrapBoolean(value) {
9+
return "Boolean.parseBoolean(" + wrapString(value) + ")"
10+
}
11+
412
android {
513
def APP_NAME = "AuthRest"
614
def APP_TITLE = "Firebase Auth REST API"
@@ -26,10 +34,15 @@ android {
2634
versionName rootProject.ext.versionName
2735

2836
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)
3144
}
32-
buildConfigField("String", "GOOGLE_CLIENT_SECRET", properties[GOOGLE_CLIENT_SECRET])
45+
buildConfigField("String", "GOOGLE_CLIENT_SECRET", googleClientSecret)
3346

3447
resValue "string", "app_name", APP_NAME
3548
resValue "string", "app_title", APP_TITLE

0 commit comments

Comments
 (0)