mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-14 09:25:43 +01:00
Fix plugin load order
The old algorithm failed, because the tree below lead to the issue, that
the scm-branchwp-plugin was loaded before the scm-review-plugin was
ready.
This commit changes the order in the way, that leafs are loaded last.
+- scm-editor-plugin d
+- scm-branchwp-plugin a
+- scm-mail-plugin c
+- scm-review-plugin b
+- scm-branchwp-plugin a
+- scm-branchwp-plugin a
This commit is contained in:
@@ -191,11 +191,11 @@ public final class PluginProcessor
|
||||
|
||||
logger.info("install plugin tree:\n{}", pluginTree);
|
||||
|
||||
List<PluginNode> rootNodes = pluginTree.getRootNodes();
|
||||
List<PluginNode> leafLastNodes = pluginTree.getLeafLastNodes();
|
||||
|
||||
logger.trace("create plugin wrappers and build classloaders");
|
||||
|
||||
Set<InstalledPlugin> wrappers = createPluginWrappers(classLoader, rootNodes);
|
||||
Set<InstalledPlugin> wrappers = createPluginWrappers(classLoader, leafLastNodes);
|
||||
|
||||
logger.debug("collected {} plugins", wrappers.size());
|
||||
|
||||
@@ -259,33 +259,6 @@ public final class PluginProcessor
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param plugins
|
||||
* @param classLoader
|
||||
* @param nodes
|
||||
*
|
||||
* @throws IOException
|
||||
*/
|
||||
private void appendPluginWrappers(Set<InstalledPlugin> plugins,
|
||||
ClassLoader classLoader, List<PluginNode> nodes)
|
||||
throws IOException
|
||||
{
|
||||
|
||||
// TODO fix plugin loading order
|
||||
for (PluginNode node : nodes)
|
||||
{
|
||||
appendPluginWrapper(plugins, classLoader, node);
|
||||
}
|
||||
|
||||
for (PluginNode node : nodes)
|
||||
{
|
||||
appendPluginWrappers(plugins, classLoader, node.getChildren());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
@@ -484,19 +457,22 @@ public final class PluginProcessor
|
||||
*
|
||||
*
|
||||
* @param classLoader
|
||||
* @param rootNodes
|
||||
* @param nodes
|
||||
*
|
||||
* @return
|
||||
*
|
||||
* @throws IOException
|
||||
*/
|
||||
private Set<InstalledPlugin> createPluginWrappers(ClassLoader classLoader,
|
||||
List<PluginNode> rootNodes)
|
||||
List<PluginNode> nodes)
|
||||
throws IOException
|
||||
{
|
||||
Set<InstalledPlugin> plugins = Sets.newHashSet();
|
||||
|
||||
appendPluginWrappers(plugins, classLoader, rootNodes);
|
||||
for (PluginNode node : nodes)
|
||||
{
|
||||
appendPluginWrapper(plugins, classLoader, node);
|
||||
}
|
||||
|
||||
return plugins;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user