Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
package com.google.firebase.gradle.plugins

import com.android.build.gradle.BaseExtension
import com.android.build.gradle.internal.tasks.factory.dependsOn
import java.io.File
import org.gradle.api.Plugin
import org.gradle.api.Project
Expand All @@ -38,18 +37,17 @@ import org.gradle.kotlin.dsl.register
abstract class CopyGoogleServicesPlugin : Plugin<Project> {
override fun apply(project: Project) {
if (File(project.projectDir, "google-services.json").exists()) {
project.logger.warn("Google Services file already present in project, skipping copy task")
return
}

val sourcePath = getSourcePath(project)
val copyRootGoogleServices = registerCopyRootGoogleServicesTask(project, sourcePath)

project.allprojects {
// fixes dependencies with gradle tasks that do not properly dependOn `preBuild`
tasks.configureEach {
if (name !== "copyRootGoogleServices") {
dependsOn(copyRootGoogleServices)
project.logger.info("Google Services file already present in project, skipping copy task")
} else {
val sourcePath = getSourcePath(project)
val copyRootGoogleServices = registerCopyRootGoogleServicesTask(project, sourcePath)

project.allprojects {
// fixes dependencies with gradle tasks that do not properly dependOn `preBuild`
tasks.configureEach {
if (name !== "copyRootGoogleServices") {
dependsOn(copyRootGoogleServices)
}
}
}
}
Expand Down
Loading