From 4e0c97a120928d375b3572670152c9b142d656c7 Mon Sep 17 00:00:00 2001 From: CarlosEsco Date: Fri, 5 Jun 2020 15:41:13 -0400 Subject: [PATCH] clean up of plugin to use classpath so it can use the kotlin class instead of having to intercept in the settings.gradle --- app/build.gradle.kts | 14 +++++++------- build.gradle.kts | 12 ++++++++++++ buildSrc/src/main/kotlin/Dependencies.kt | 10 ++++++---- settings.gradle.kts | 16 ---------------- 4 files changed, 25 insertions(+), 27 deletions(-) diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 1f5f7f240d..ef8dc37deb 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -4,13 +4,13 @@ import java.time.ZoneOffset import java.time.format.DateTimeFormatter plugins { - id("com.android.application") version BuildPluginsVersion.AGP - id("com.google.android.gms.oss-licenses-plugin") version BuildPluginsVersion.OSS_LICENSE - kotlin("android") version BuildPluginsVersion.KOTLIN - kotlin("android.extensions") version BuildPluginsVersion.KOTLIN - kotlin("kapt") version BuildPluginsVersion.KOTLIN - id("com.google.gms.google-services") version BuildPluginsVersion.GOOGLE_SERVICES apply false - id("org.jmailen.kotlinter") version BuildPluginsVersion.KOTLINTER + id("com.android.application") + id("com.google.android.gms.oss-licenses-plugin") + kotlin("android") + kotlin("android.extensions") + kotlin("kapt") + id("com.google.gms.google-services") apply false + id("org.jmailen.kotlinter") } fun getBuildTime() = DateTimeFormatter.ISO_DATE_TIME.format(LocalDateTime.now(ZoneOffset.UTC)) diff --git a/build.gradle.kts b/build.gradle.kts index c77b7fb347..824d101989 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -2,6 +2,18 @@ plugins{ id("com.github.ben-manes.versions") version BuildPluginsVersion.VERSIONS_PLUGIN } + +buildscript { + dependencies { + classpath(BuildPluginsVersion.AGP) + classpath(BuildPluginsVersion.OSS_LICENSE) + classpath(BuildPluginsVersion.GOOGLE_SERVICES) + classpath(BuildPluginsVersion.ANDROID_EXTENSIONS) + classpath(BuildPluginsVersion.KOTLIN_GRADLE) + classpath(BuildPluginsVersion.KOTLINTER) + } +} + // Top-level build file where you can add configuration options common to all sub-projects/modules. allprojects { repositories { diff --git a/buildSrc/src/main/kotlin/Dependencies.kt b/buildSrc/src/main/kotlin/Dependencies.kt index bce9d3ac74..7afb39bef2 100644 --- a/buildSrc/src/main/kotlin/Dependencies.kt +++ b/buildSrc/src/main/kotlin/Dependencies.kt @@ -25,10 +25,12 @@ object AndroidVersions { } object BuildPluginsVersion { - const val AGP = "4.0.0" - const val GOOGLE_SERVICES = "4.3.3" + const val AGP = "com.android.tools.build:gradle:4.0.0" const val KOTLIN = "1.3.72" - const val KOTLINTER = "2.3.2" - const val OSS_LICENSE = "0.10.2" + const val ANDROID_EXTENSIONS = "org.jetbrains.kotlin:kotlin-android-extensions:$KOTLIN" + const val KOTLIN_GRADLE = "org.jetbrains.kotlin:kotlin-gradle-plugin:$KOTLIN" + const val KOTLINTER = "org.jmailen.gradle:kotlinter-gradle:2.3.2" + const val GOOGLE_SERVICES = "com.google.gms:google-services:4.3.3" + const val OSS_LICENSE = "com.google.android.gms:oss-licenses-plugin:0.10.2" const val VERSIONS_PLUGIN = "0.28.0" } \ No newline at end of file diff --git a/settings.gradle.kts b/settings.gradle.kts index 729853d220..37b881a0f8 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -4,22 +4,6 @@ pluginManagement { jcenter() google() } - resolutionStrategy { - eachPlugin { - if (requested.id.id == "com.android.library") { - useModule("com.android.tools.build:gradle:${requested.version}") - } - else if (requested.id.id == "com.android.application") { - useModule("com.android.tools.build:gradle:${requested.version}") - } - else if (requested.id.id.equals("com.google.gms.google-services")) { - useModule("com.google.gms:google-services:${requested.version}") - } - else if (requested.id.id.equals("com.google.android.gms.oss-licenses-plugin")) { - useModule("com.google.android.gms:oss-licenses-plugin:${requested.version}") - } - } - } } include(":app")