File tree 1 file changed +9
-3
lines changed
1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -57,9 +57,10 @@ public PluginService(IOptions<PluginServiceOptions> options)
57
57
/// means that <see cref="PluginTree.Branches"/> will contain dependency-free plugins, with subsequent
58
58
/// dependents below them (recursively).
59
59
/// </summary>
60
+ /// <param name="filter">If provided, any plugins must match the defined predicate to be added to the <see cref="PluginTree"/>.</param>
60
61
/// <returns>The dependency tree.</returns>
61
62
[ PublicAPI , Pure ]
62
- public PluginTree LoadPluginTree ( )
63
+ public PluginTree LoadPluginTree ( Predicate < IPluginDescriptor > ? filter = null )
63
64
{
64
65
var pluginAssemblies = LoadAvailablePluginAssemblies ( ) . ToList ( ) ;
65
66
var pluginsWithDependencies = pluginAssemblies . ToDictionary
@@ -104,12 +105,17 @@ bool IsDirectDependency(Assembly assembly, Assembly dependency)
104
105
{
105
106
var current = sorted [ 0 ] ;
106
107
var loadDescriptorResult = LoadPluginDescriptor ( current ) ;
107
- if ( ! loadDescriptorResult . IsSuccess )
108
+ if ( ! loadDescriptorResult . IsDefined ( out IPluginDescriptor ? pluginDescriptor ) )
108
109
{
109
110
continue ;
110
111
}
111
112
112
- var node = new PluginTreeNode ( loadDescriptorResult . Entity ) ;
113
+ if ( ! filter ? . Invoke ( pluginDescriptor ) ?? false )
114
+ {
115
+ continue ;
116
+ }
117
+
118
+ var node = new PluginTreeNode ( pluginDescriptor ) ;
113
119
114
120
var dependencies = pluginsWithDependencies [ current ] . ToList ( ) ;
115
121
if ( ! dependencies . Any ( ) )
You can’t perform that action at this time.
0 commit comments