Set<String> removedKeys = new HashSet<>();
do {
removedKeys.clear();
- for (PluginInfo plugin : pluginsByKey.values()) {
+ for (ServerPluginInfo plugin : pluginsByKey.values()) {
if (!isCompatible(plugin, pluginsByKey)) {
removedKeys.add(plugin.getKey());
}
}
@VisibleForTesting
- static boolean isCompatible(PluginInfo plugin, Map<String, ServerPluginInfo> allPluginsByKeys) {
+ static boolean isCompatible(ServerPluginInfo plugin, Map<String, ServerPluginInfo> allPluginsByKeys) {
if (!Strings.isNullOrEmpty(plugin.getBasePlugin()) && !allPluginsByKeys.containsKey(plugin.getBasePlugin())) {
// it extends a plugin that is not installed
LOG.warn("Plugin {} [{}] is ignored because its base plugin [{}] is not installed", plugin.getName(), plugin.getKey(), plugin.getBasePlugin());
return false;
}
+ if (plugin.getType() != BUNDLED && !plugin.getRequiredPlugins().isEmpty()) {
+ LOG.warn("Use of 'Plugin-Dependencies' mechanism is planned for removal. Update the plugin {} [{}] to shade its dependencies instead.",
+ plugin.getName(), plugin.getKey());
+ }
+
for (PluginInfo.RequiredPlugin requiredPlugin : plugin.getRequiredPlugins()) {
PluginInfo installedRequirement = allPluginsByKeys.get(requiredPlugin.getKey());
if (installedRequirement == null) {
assertThat(logs.logs()).contains("Plugin test [test] is ignored because entry point class is not defined");
}
+ @Test
+ public void warn_if_external_plugin_has_dependencies() throws IOException {
+ copyTestPluginTo("test-base-plugin", fs.getInstalledExternalPluginsDir());
+ copyTestPluginTo("test-require-plugin", fs.getInstalledExternalPluginsDir());
+
+ underTest.loadPlugins();
+ assertThat(logs.logs()).contains("Use of 'Plugin-Dependencies' mechanism is planned for removal. "
+ + "Update the plugin Test Require Plugin [testrequire] to shade its dependencies instead.");
+ }
+
@Test
public void fail_if_external_plugin_has_same_key_has_bundled_plugin() throws IOException {
File jar = createJar(fs.getInstalledExternalPluginsDir(), "plugin1", "main", null);