From c22fe9faef4e246b8a9525a2f5624b9a5d5b707c Mon Sep 17 00:00:00 2001 From: Ezerous Date: Mon, 1 Jul 2019 12:29:42 +0300 Subject: [PATCH 1/2] Ensure correct google-services.json is supplied vol.2 --- app/build.gradle | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 1219d9fa..c26690b9 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -41,20 +41,30 @@ android { } } +def firebaseReleaseProjectId = "mthmmy-release-3aef0" + tasks.whenTaskAdded { task -> if (task.name.contains("assembleRelease")) { task.getDependsOn().add({ - def inputFile = new File("google-services.json") - def json = new JsonSlurper().parseText(inputFile.text) - if (json.project_info.project_id != "mthmmy-release-3aef0") - throw new GradleException('Please supply the correct google-services.json for release (or manually change the id above)!') + def googleServicesFile = new File("app/src/release/google-services.json") + if(googleServicesFile.exists()){ + def json = new JsonSlurper().parseText(googleServicesFile.text) + 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")) { task.getDependsOn().add({ - def inputFile = new File("app/google-services.json") - def json = new JsonSlurper().parseText(inputFile.text) - if (json.project_info.project_id == "mthmmy-release-3aef0") - throw new GradleException('Please replace the release google-services.json with a debug one!') + def googleServicesFile = new File("app/src/debug/google-services.json") + if(googleServicesFile.exists()){ + def json = new JsonSlurper().parseText(googleServicesFile.text) + 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!') }) } } From 81513ed3e71bc3fbfc9c59ca7f2439e7f3e161c2 Mon Sep 17 00:00:00 2001 From: Ezerous Date: Mon, 1 Jul 2019 12:30:26 +0300 Subject: [PATCH 2/2] Up version --- app/build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index c26690b9..c3aa2e1e 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -13,8 +13,8 @@ android { applicationId "gr.thmmy.mthmmy" minSdkVersion 19 targetSdkVersion 28 - versionCode 19 - versionName "1.7.1" + versionCode 20 + versionName "1.7.2" archivesBaseName = "mTHMMY-v$versionName" buildConfigField "String", "CURRENT_BRANCH", "\"" + getCurrentBranch() + "\"" buildConfigField "String", "COMMIT_HASH", "\"" + getCommitHash() + "\""