From 4c4c44937af4787ef71136004f241825bfec66e7 Mon Sep 17 00:00:00 2001 From: Daniel Platz Date: Mon, 5 Oct 2020 09:30:43 +0200 Subject: [PATCH] Search for quarkus gradle plugin in transitive dependencies --- .../io/quarkus/gradle/tasks/QuarkusDev.java | 34 ++++++++++++++----- 1 file changed, 26 insertions(+), 8 deletions(-) diff --git a/devtools/gradle/src/main/java/io/quarkus/gradle/tasks/QuarkusDev.java b/devtools/gradle/src/main/java/io/quarkus/gradle/tasks/QuarkusDev.java index a878eb3d76519..7aedaa6b8066a 100644 --- a/devtools/gradle/src/main/java/io/quarkus/gradle/tasks/QuarkusDev.java +++ b/devtools/gradle/src/main/java/io/quarkus/gradle/tasks/QuarkusDev.java @@ -481,6 +481,23 @@ private java.util.Optional getJavaCompileTask() { .ofNullable((JavaCompile) getProject().getTasks().getByName(JavaPlugin.COMPILE_JAVA_TASK_NAME)); } + private ResolvedDependency findQuarkusPluginDependency(Set dependencies) { + for (ResolvedDependency rd : dependencies) { + if ("io.quarkus.gradle.plugin".equals(rd.getModuleName())) { + return rd; + } else { + Set children = rd.getChildren(); + if (children != null) { + ResolvedDependency quarkusPluginDependency = findQuarkusPluginDependency(children); + if (quarkusPluginDependency != null) { + return quarkusPluginDependency; + } + } + } + } + return null; + } + private void addGradlePluginDeps(StringBuilder classPathManifest, DevModeContext context) { boolean foundQuarkusPlugin = false; Project prj = getProject(); @@ -491,14 +508,15 @@ private void addGradlePluginDeps(StringBuilder classPathManifest, DevModeContext if (firstLevelDeps.isEmpty()) { // TODO this looks weird } else { - for (ResolvedDependency rd : firstLevelDeps) { - if ("io.quarkus.gradle.plugin".equals(rd.getModuleName())) { - rd.getAllModuleArtifacts().stream() - .map(ResolvedArtifact::getFile) - .forEach(f -> addToClassPaths(classPathManifest, f)); - foundQuarkusPlugin = true; - break; - } + ResolvedDependency quarkusPluginDependency = findQuarkusPluginDependency(firstLevelDeps); + if (quarkusPluginDependency != null) { + quarkusPluginDependency.getAllModuleArtifacts().stream() + .map(ResolvedArtifact::getFile) + .forEach(f -> addToClassPaths(classPathManifest, f)); + + foundQuarkusPlugin = true; + + break; } } prj = prj.getParent();