From 6769baf559b6f33ec594843a4c36d5bda5a65db8 Mon Sep 17 00:00:00 2001 From: Joel Klinghed Date: Tue, 5 Dec 2017 11:21:43 +0100 Subject: Support gradle-experimental-0.11.0 Problem with the new gradle-experimental is that tasks are only created if needed, so searching for a generateDebugSources or compile*DebugJavaWithJavac is pointless as unless there is a dependency on them the tasks do not exist Only create the FlycheckAndroidJavaTask for projects that implement either an Android App module or Android Library module so that we can assume there will always be a generateDebugSources task. And use buildTypes and flavors to figure out what compile task names there should be and reference them directly --- src/main/groovy/FlycheckAndroidExperimentalInitPlugin.groovy | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/main/groovy/FlycheckAndroidExperimentalInitPlugin.groovy') diff --git a/src/main/groovy/FlycheckAndroidExperimentalInitPlugin.groovy b/src/main/groovy/FlycheckAndroidExperimentalInitPlugin.groovy index ad44335..53cbc7c 100644 --- a/src/main/groovy/FlycheckAndroidExperimentalInitPlugin.groovy +++ b/src/main/groovy/FlycheckAndroidExperimentalInitPlugin.groovy @@ -6,8 +6,12 @@ import org.gradle.api.invocation.Gradle class FlycheckAndroidExperimentalInitPlugin implements Plugin { void apply(Gradle gradle) { gradle.allprojects { project -> - project.task('flycheckAndroidJava', - type: FlycheckAndroidJavaTask) + project.plugins.whenPluginAdded { plugin -> + if (plugin.class.name == 'com.android.build.gradle.model.BaseComponentModelPlugin') { + project.task('flycheckAndroidJava', + type: FlycheckAndroidJavaTask) + } + } } } } -- cgit v1.2.3-70-g09d2