Skip to content

Commit

Permalink
Merge pull request quarkusio#12510 from 38leinaD/feature/find-quarkus…
Browse files Browse the repository at this point in the history
…-plugin-transitive

Search for quarkus gradle plugin in transitive dependencies
  • Loading branch information
gsmet authored Oct 7, 2020
2 parents 473f840 + 4c4c449 commit 0d5e73b
Showing 1 changed file with 26 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -481,6 +481,23 @@ private java.util.Optional<JavaCompile> getJavaCompileTask() {
.ofNullable((JavaCompile) getProject().getTasks().getByName(JavaPlugin.COMPILE_JAVA_TASK_NAME));
}

private ResolvedDependency findQuarkusPluginDependency(Set<ResolvedDependency> dependencies) {
for (ResolvedDependency rd : dependencies) {
if ("io.quarkus.gradle.plugin".equals(rd.getModuleName())) {
return rd;
} else {
Set<ResolvedDependency> 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();
Expand All @@ -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();
Expand Down

0 comments on commit 0d5e73b

Please sign in to comment.