clean up of plugin to use classpath so it can use the kotlin class instead of having to intercept in the settings.gradle

This commit is contained in:
CarlosEsco 2020-06-05 15:41:13 -04:00
parent 1978b9a62e
commit 4e0c97a120
4 changed files with 25 additions and 27 deletions

View File

@ -4,13 +4,13 @@ import java.time.ZoneOffset
import java.time.format.DateTimeFormatter import java.time.format.DateTimeFormatter
plugins { plugins {
id("com.android.application") version BuildPluginsVersion.AGP id("com.android.application")
id("com.google.android.gms.oss-licenses-plugin") version BuildPluginsVersion.OSS_LICENSE id("com.google.android.gms.oss-licenses-plugin")
kotlin("android") version BuildPluginsVersion.KOTLIN kotlin("android")
kotlin("android.extensions") version BuildPluginsVersion.KOTLIN kotlin("android.extensions")
kotlin("kapt") version BuildPluginsVersion.KOTLIN kotlin("kapt")
id("com.google.gms.google-services") version BuildPluginsVersion.GOOGLE_SERVICES apply false id("com.google.gms.google-services") apply false
id("org.jmailen.kotlinter") version BuildPluginsVersion.KOTLINTER id("org.jmailen.kotlinter")
} }
fun getBuildTime() = DateTimeFormatter.ISO_DATE_TIME.format(LocalDateTime.now(ZoneOffset.UTC)) fun getBuildTime() = DateTimeFormatter.ISO_DATE_TIME.format(LocalDateTime.now(ZoneOffset.UTC))

View File

@ -2,6 +2,18 @@
plugins{ plugins{
id("com.github.ben-manes.versions") version BuildPluginsVersion.VERSIONS_PLUGIN 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. // Top-level build file where you can add configuration options common to all sub-projects/modules.
allprojects { allprojects {
repositories { repositories {

View File

@ -25,10 +25,12 @@ object AndroidVersions {
} }
object BuildPluginsVersion { object BuildPluginsVersion {
const val AGP = "4.0.0" const val AGP = "com.android.tools.build:gradle:4.0.0"
const val GOOGLE_SERVICES = "4.3.3"
const val KOTLIN = "1.3.72" const val KOTLIN = "1.3.72"
const val KOTLINTER = "2.3.2" const val ANDROID_EXTENSIONS = "org.jetbrains.kotlin:kotlin-android-extensions:$KOTLIN"
const val OSS_LICENSE = "0.10.2" 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" const val VERSIONS_PLUGIN = "0.28.0"
} }

View File

@ -4,22 +4,6 @@ pluginManagement {
jcenter() jcenter()
google() 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") include(":app")