File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed
plugins/src/main/java/com/google/firebase/gradle/plugins Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -38,6 +38,11 @@ import org.gradle.kotlin.dsl.register
3838abstract class CopyGoogleServicesPlugin : Plugin <Project > {
3939 override fun apply (project : Project ) {
4040 val sourcePath = getSourcePath(project)
41+ if (sourcePath == null ) {
42+ project.logger.warn(" Google Services file already present in project, skipping copy task" )
43+ return
44+ }
45+
4146 val copyRootGoogleServices = registerCopyRootGoogleServicesTask(project, sourcePath)
4247
4348 project.allprojects {
@@ -94,10 +99,13 @@ abstract class CopyGoogleServicesPlugin : Plugin<Project> {
9499 return ! file.readText().contains(targetPackageLine)
95100 }
96101
97- private fun getSourcePath (project : Project ): String {
102+ private fun getSourcePath (project : Project ): String? {
98103 val path =
99104 System .getenv(" FIREBASE_GOOGLE_SERVICES_PATH" ) ? : " ${project.rootDir} /google-services.json"
100- if (File (project.projectDir, " google-services.json" ).exists() || File (path).exists()) {
105+ if (File (project.projectDir, " google-services.json" ).exists()) {
106+ return null
107+ }
108+ if (File (path).exists()) {
101109 return path
102110 }
103111 project.logger.warn(" Google services file not found, using fallback" )
You can’t perform that action at this time.
0 commit comments