|
@ -13,8 +13,8 @@ android { |
|
|
applicationId "gr.thmmy.mthmmy" |
|
|
applicationId "gr.thmmy.mthmmy" |
|
|
minSdkVersion 19 |
|
|
minSdkVersion 19 |
|
|
targetSdkVersion 28 |
|
|
targetSdkVersion 28 |
|
|
versionCode 19 |
|
|
versionCode 20 |
|
|
versionName "1.7.1" |
|
|
versionName "1.7.2" |
|
|
archivesBaseName = "mTHMMY-v$versionName" |
|
|
archivesBaseName = "mTHMMY-v$versionName" |
|
|
buildConfigField "String", "CURRENT_BRANCH", "\"" + getCurrentBranch() + "\"" |
|
|
buildConfigField "String", "CURRENT_BRANCH", "\"" + getCurrentBranch() + "\"" |
|
|
buildConfigField "String", "COMMIT_HASH", "\"" + getCommitHash() + "\"" |
|
|
buildConfigField "String", "COMMIT_HASH", "\"" + getCommitHash() + "\"" |
|
@ -41,20 +41,30 @@ android { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
def firebaseReleaseProjectId = "mthmmy-release-3aef0" |
|
|
|
|
|
|
|
|
tasks.whenTaskAdded { task -> |
|
|
tasks.whenTaskAdded { task -> |
|
|
if (task.name.contains("assembleRelease")) { |
|
|
if (task.name.contains("assembleRelease")) { |
|
|
task.getDependsOn().add({ |
|
|
task.getDependsOn().add({ |
|
|
def inputFile = new File("google-services.json") |
|
|
def googleServicesFile = new File("app/src/release/google-services.json") |
|
|
def json = new JsonSlurper().parseText(inputFile.text) |
|
|
if(googleServicesFile.exists()){ |
|
|
if (json.project_info.project_id != "mthmmy-release-3aef0") |
|
|
def json = new JsonSlurper().parseText(googleServicesFile.text) |
|
|
throw new GradleException('Please supply the correct google-services.json for release (or manually change the id above)!') |
|
|
if (json.project_info.project_id != firebaseReleaseProjectId) |
|
|
|
|
|
throw new GradleException('Please supply the correct google-services.json for release in app/src/release/ directory!') |
|
|
|
|
|
} |
|
|
|
|
|
else |
|
|
|
|
|
throw new GradleException('Please add the release google-services.json in app/src/release/ directory!') |
|
|
}) |
|
|
}) |
|
|
} else if (task.name.contains("assembleDebug")) { |
|
|
} else if (task.name.contains("assembleDebug")) { |
|
|
task.getDependsOn().add({ |
|
|
task.getDependsOn().add({ |
|
|
def inputFile = new File("app/google-services.json") |
|
|
def googleServicesFile = new File("app/src/debug/google-services.json") |
|
|
def json = new JsonSlurper().parseText(inputFile.text) |
|
|
if(googleServicesFile.exists()){ |
|
|
if (json.project_info.project_id == "mthmmy-release-3aef0") |
|
|
def json = new JsonSlurper().parseText(googleServicesFile.text) |
|
|
throw new GradleException('Please replace the release google-services.json with a debug one!') |
|
|
if (json.project_info.project_id == firebaseReleaseProjectId) |
|
|
|
|
|
throw new GradleException('Please replace google-services.json in app/src/debug/ with a debug one!') |
|
|
|
|
|
} |
|
|
|
|
|
else |
|
|
|
|
|
throw new GradleException('Please add a debug google-services.json in app/src/debug/ directory!') |
|
|
}) |
|
|
}) |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|