Skip to content

Commit

Permalink
fix JitPack build failed due to missing local.properties
Browse files Browse the repository at this point in the history
  • Loading branch information
anotherdev committed Oct 15, 2020
1 parent 4ff5507 commit c1b1ef5
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'

static def wrapString(aString) {
return '"' + aString + '"'
}

static def wrapBoolean(value) {
return "Boolean.parseBoolean(" + wrapString(value) + ")"
}

android {
def APP_NAME = "AuthRest"
def APP_TITLE = "Firebase Auth REST API"
Expand All @@ -26,10 +34,15 @@ android {
versionName rootProject.ext.versionName

def GOOGLE_CLIENT_SECRET = "google.client.secret"
if (!properties.containsKey(GOOGLE_CLIENT_SECRET)) {
project.logger.log(LogLevel.ERROR, String.format("Can't find property: \"%s\" in the local.properties file", GOOGLE_CLIENT_SECRET))
def googleClientSecret
if (properties.containsKey(GOOGLE_CLIENT_SECRET)) {
googleClientSecret = properties[GOOGLE_CLIENT_SECRET]
} else {
def errorMsg = String.format("Can't find property: '%s' in the local.properties file", GOOGLE_CLIENT_SECRET)
project.logger.log(LogLevel.ERROR, errorMsg)
googleClientSecret = wrapString(errorMsg)
}
buildConfigField("String", "GOOGLE_CLIENT_SECRET", properties[GOOGLE_CLIENT_SECRET])
buildConfigField("String", "GOOGLE_CLIENT_SECRET", googleClientSecret)

resValue "string", "app_name", APP_NAME
resValue "string", "app_title", APP_TITLE
Expand Down

0 comments on commit c1b1ef5

Please sign in to comment.