Skip to content

Commit

Permalink
feat: support transitive extensions when searching for plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
iocanel committed Sep 4, 2024
1 parent c4c9c1a commit 652370a
Showing 1 changed file with 25 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import java.nio.file.Path;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Optional;
Expand Down Expand Up @@ -173,8 +174,30 @@ public Map<String, Plugin> extensionPlugins() {
Map<String, Plugin> extensionPlugins = new HashMap<>();
projectRoot.map(r -> quarkusProject.get()).ifPresent(project -> {
try {
Set<ArtifactKey> installed = project.getExtensionManager().getInstalled().stream()
.map(ArtifactCoords::getKey).collect(Collectors.toSet());
Set<ArtifactKey> installed = new HashSet<>();
// Direct extensions
for (ArtifactCoords coords : project.getExtensionManager().getInstalled()) {
installed.add(coords.getKey());
}
// Transitives
for (Extension e : project.getExtensionsCatalog().getExtensions()) {
if (!installed.contains(e.getArtifact().getKey())) {
continue;
}
Map<String, Object> metadata = e.getMetadata();
if (metadata.get("extension-dependencies") instanceof List extensionDependencies) {
for (Object coords : extensionDependencies) {
project.getExtensionsCatalog().getExtensions().forEach(catalogExtension -> {
String extensionCoords = catalogExtension.getArtifact().getGroupId() + ":"
+ catalogExtension.getArtifact().getArtifactId();
if (extensionCoords.equals(coords)) {
installed.add(ArtifactCoords.fromString(catalogExtension.getArtifact().toCompactCoords())
.getKey());
}
});
}
}
}
for (Extension e : project.getExtensionsCatalog().getExtensions()) {
if (installed.contains(e.getArtifact().getKey())) {
for (String cliPlugin : ExtensionProcessor.getCliPlugins(e)) {
Expand Down

0 comments on commit 652370a

Please sign in to comment.