From 965e4577d95d4ab35076a72e27ff8b6a3856dd4b Mon Sep 17 00:00:00 2001 From: Uwe Schindler Date: Sun, 2 Sep 2018 20:09:55 +0200 Subject: [PATCH] Gradle: Always apply JavaBasePlugin, otherwise startup may fail with new plugin DSL, as initialization order is undefined. This closes #144 --- .../de/thetaphi/forbiddenapis/gradle/plugin-init.groovy | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/main/resources/de/thetaphi/forbiddenapis/gradle/plugin-init.groovy b/src/main/resources/de/thetaphi/forbiddenapis/gradle/plugin-init.groovy index 1b0f9c4a..a7f14b0e 100644 --- a/src/main/resources/de/thetaphi/forbiddenapis/gradle/plugin-init.groovy +++ b/src/main/resources/de/thetaphi/forbiddenapis/gradle/plugin-init.groovy @@ -18,11 +18,8 @@ import java.lang.reflect.Modifier; import org.gradle.api.plugins.JavaBasePlugin; -import org.gradle.api.plugins.PluginInstantiationException; -if (project.plugins.withType(JavaBasePlugin.class).isEmpty()) { - throw new PluginInstantiationException('Forbidden-apis only works in projects using the java plugin.'); -} +project.plugins.apply(JavaBasePlugin.class); // check if running in Gradle Daemon? // see: http://stackoverflow.com/questions/23265217/how-to-know-whether-you-are-running-inside-a-gradle-daemon