From 8c435edca03b079f1e321cbf519554667ae7c4f5 Mon Sep 17 00:00:00 2001 From: Pavlos-Petros Tournaris Date: Wed, 18 Dec 2019 00:39:08 +0200 Subject: [PATCH] Simplify few things in root build.gradle (#38) --- build.gradle | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/build.gradle b/build.gradle index 61723ae..7589d3f 100644 --- a/build.gradle +++ b/build.gradle @@ -1,4 +1,6 @@ -// Top-level build file where you can add configuration options common to all sub-projects/modules. +import com.android.build.gradle.AppPlugin +import com.android.build.gradle.LibraryPlugin + buildscript { repositories { mavenCentral() @@ -10,7 +12,7 @@ buildscript { } ext.versions = [ - androidGradlePlugin : '3.6.0-beta05', + androidGradlePlugin : '3.6.0-rc01', dexcountGradlePlugin: '1.0.2', kotlin : '1.3.61', dokkaGradlePlugin : '0.10.0', @@ -83,16 +85,10 @@ subprojects { } } - project.plugins.whenPluginAdded { plugin -> - if ("com.android.build.gradle.AppPlugin".equals(plugin.class.name)) { - project.android.dexOptions.preDexLibraries = rootProject.ext.preDexLibs - } else if ("com.android.build.gradle.LibraryPlugin".equals(plugin.class.name)) { - project.android.dexOptions.preDexLibraries = rootProject.ext.preDexLibs - } + def preDexClosure = { + project.android.dexOptions.preDexLibraries = rootProject.ext.preDexLibs } -} -task gitHooksInit(type: Exec) { - workingDir "$projectDir" - commandLine './init-git-hooks' + project.plugins.withType(AppPlugin).whenPluginAdded(preDexClosure) + project.plugins.withType(LibraryPlugin).whenPluginAdded(preDexClosure) }