public PluginInfo(Type type, PluginSetConstructionInfo constructionInfo, IPluginInfoProvider pluginInfoProvider) { if (type.IsAbstract) { throw Errors.PluginIsAbstract(type); } if (type.IsNotPublic) { throw Errors.PluginIsNonPublic(type); } Type = type; Ancestors = ImmutableArray.Create( type.GetAllBaseTypes().Select(t => (TypeRef)t).ToArray()); Interfaces = ImmutableArray.Create( type.GetInterfaces().Select(t => (TypeRef)t).ToArray()); CastableTo = ImmutableHashSet.Create( Ancestors.AddRange(Interfaces).Add(type).ToArray()); Capabilities = pluginInfoProvider.GetCapabilities(type); Dependencies = pluginInfoProvider.GetDependencies(type); var allAssemblyRefs = constructionInfo.AllAssemblyRefs[type.Assembly]; AllDependencies = constructionInfo.Plugins .Where(p => p != type && ( allAssemblyRefs.Contains(p.Assembly) || CastableTo.Contains(p))) .Select(t => (TypeRef)t) .Concat(Dependencies) .ToImmutableHashSet(); }
protected CachingPluginFinderBase( Options?options, IPluginInfoProvider pluginInfoProvider, ILogger <CachingPluginFinderBase>?log = null) { options ??= new Options(); Log = log ?? NullLogger <CachingPluginFinderBase> .Instance; PluginInfoProvider = pluginInfoProvider; _lazyCache = new Lazy <IAsyncCache <string, string> >( options.CacheFactory ?? CreateCache); }
public FileSystemPluginFinder( Options?options, IPluginInfoProvider pluginInfoProvider, ILogger <FileSystemPluginFinder>?log = null) : base(options ??= new Options(), pluginInfoProvider, log ?? NullLogger <FileSystemPluginFinder> .Instance) { PluginDir = options.PluginDir; AssemblyNamePattern = options.AssemblyNamePattern; ExcludedAssemblyNamesRegex = options.ExcludedAssemblyNamesRegex; UseCache = options.UseCache; CacheDir = options.CacheDir; }
public PredefinedPluginFinder(Options options, IPluginInfoProvider pluginInfoProvider) { var pluginTypes = new HashSet <Type>(options.PluginTypes); FoundPlugins = new PluginSetInfo(pluginTypes, pluginInfoProvider); }