From 83a56ff62d4020a048c792897d3accb4bf679aab Mon Sep 17 00:00:00 2001 From: Maxim Kalina Date: Wed, 13 May 2026 20:27:07 +0200 Subject: [PATCH] fix(sdk): adapt to PlugwerkUpdateChecker.checkForUpdates(List) signature MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Upstream changed the update-checker SPI from a Map of pluginId→version to a List (a record carrying pluginId and version). Both example hosts now build the typed list from PF4J's PluginWrapper iterable directly — drops the Collectors.toMap + Map imports in the CLI command, keeps them in the Spring controller (still used for the "updates" view model on the next few lines). Without this change main is red against the current 1.0.0-SNAPSHOT, which also blocks Renovate-driven dependency PRs (e.g. #42) from ever going green. --- .../plugwerk/example/cli/command/UpdateCommand.java | 13 +++++-------- .../controller/PluginInstalledController.java | 8 ++++---- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/plugwerk-java-cli-example/plugwerk-java-cli-example-app/src/main/java/io/plugwerk/example/cli/command/UpdateCommand.java b/plugwerk-java-cli-example/plugwerk-java-cli-example-app/src/main/java/io/plugwerk/example/cli/command/UpdateCommand.java index 33e0a15..2815bee 100644 --- a/plugwerk-java-cli-example/plugwerk-java-cli-example-app/src/main/java/io/plugwerk/example/cli/command/UpdateCommand.java +++ b/plugwerk-java-cli-example/plugwerk-java-cli-example-app/src/main/java/io/plugwerk/example/cli/command/UpdateCommand.java @@ -18,11 +18,9 @@ import io.plugwerk.example.cli.DynamicCommandLoader; import io.plugwerk.example.cli.PlugwerkCli; import io.plugwerk.spi.extension.PlugwerkMarketplace; +import io.plugwerk.spi.model.InstalledPluginRef; import io.plugwerk.spi.model.UpdateInfo; import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; -import org.pf4j.PluginWrapper; import picocli.CommandLine.Command; import picocli.CommandLine.Option; import picocli.CommandLine.ParentCommand; @@ -54,12 +52,11 @@ public class UpdateCommand implements Runnable { public void run() { PlugwerkMarketplace marketplace = parent.getMarketplace(); - // Build a map of installed plugin ID → current version from PF4J plugin manager - Map installed = + // Collect installed plugin id+version pairs from the PF4J plugin manager + List installed = parent.getPluginManager().getPlugins().stream() - .collect( - Collectors.toMap( - PluginWrapper::getPluginId, pw -> pw.getDescriptor().getVersion())); + .map(pw -> new InstalledPluginRef(pw.getPluginId(), pw.getDescriptor().getVersion())) + .toList(); if (installed.isEmpty()) { System.out.println("No plugins currently installed."); diff --git a/plugwerk-springboot-thymeleaf-example/src/main/java/io/plugwerk/example/webapp/controller/PluginInstalledController.java b/plugwerk-springboot-thymeleaf-example/src/main/java/io/plugwerk/example/webapp/controller/PluginInstalledController.java index 0005f6d..dd44bdd 100644 --- a/plugwerk-springboot-thymeleaf-example/src/main/java/io/plugwerk/example/webapp/controller/PluginInstalledController.java +++ b/plugwerk-springboot-thymeleaf-example/src/main/java/io/plugwerk/example/webapp/controller/PluginInstalledController.java @@ -18,6 +18,7 @@ import io.plugwerk.example.webapp.config.PluginContributionRegistry; import io.plugwerk.spi.PlugwerkPlugin; import io.plugwerk.spi.extension.PlugwerkMarketplace; +import io.plugwerk.spi.model.InstalledPluginRef; import io.plugwerk.spi.model.UpdateInfo; import java.util.List; import java.util.Map; @@ -69,11 +70,10 @@ public String installed(Model model) { // Check for available updates if the marketplace is configured if (marketplace != null && !plugins.isEmpty()) { try { - Map installed = + List installed = plugins.stream() - .collect( - Collectors.toMap( - PluginWrapper::getPluginId, p -> p.getDescriptor().getVersion())); + .map(p -> new InstalledPluginRef(p.getPluginId(), p.getDescriptor().getVersion())) + .toList(); List updates = marketplace.updateChecker().checkForUpdates(installed); Map updateMap = updates.stream()