Free cookie consent management tool by TermsFeed Policy Generator

Changeset 12518 for trunk/sources


Ignore:
Timestamp:
06/25/15 18:39:07 (9 years ago)
Author:
mkommend
Message:

#2401: Adapted plugin dependency unit test to check all plugin files to determine the necessary dependencies. Corrected plugin dependencies for HeuristicLab.AvalonEdit.

Location:
trunk/sources
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.ExtLibs/HeuristicLab.AvalonEdit/5.0.1/HeuristicLab.AvalonEdit-5.0.1/Plugin.cs.frame

    r12012 r12518  
    2727  [PluginFile("ICSharpCode.AvalonEdit.dll", PluginFileType.Assembly)]
    2828  [PluginFile("ICSharpCode.AvalonEdit License-5.0.1.txt", PluginFileType.License)]
     29  [PluginDependency("HeuristicLab.NRefactory", "5.5")]
    2930  public class HeuristicLabAvalonEditPlugin : PluginBase {
    3031  }
  • trunk/sources/HeuristicLab.Tests/HeuristicLab-3.3/PluginDependenciesTest.cs

    r12012 r12518  
    6060      foreach (Assembly pluginAssembly in loadedPlugins.Keys) {
    6161        Type plugin = loadedPlugins[pluginAssembly];
     62        var pluginFiles = new HashSet<string>(Attribute.GetCustomAttributes(plugin, false)
     63            .OfType<PluginFileAttribute>().Where(pf => pf.FileType == PluginFileType.Assembly).Select(pf => pf.FileName));
     64        var pluginAssemblies = PluginLoader.Assemblies.Where(a => pluginFiles.Contains(Path.GetFileName(a.Location))).ToList();
     65        var referencedAssemblies = pluginAssemblies.SelectMany(a => a.GetReferencedAssemblies()).ToList();
     66
    6267        Dictionary<string, PluginDependencyAttribute> pluginDependencies = Attribute.GetCustomAttributes(plugin, false).OfType<PluginDependencyAttribute>().ToDictionary(a => a.Dependency);
    6368
    64         foreach (AssemblyName referencedAssemblyName in pluginAssembly.GetReferencedAssemblies()) {
     69        foreach (AssemblyName referencedAssemblyName in referencedAssemblies) {
    6570          if (IsPluginAssemblyName(referencedAssemblyName)) {
    6671            if (!pluginDependencies.ContainsKey(pluginNames[referencedAssemblyName.FullName]))
     
    8792        Type plugin = loadedPlugins[pluginAssembly];
    8893        Dictionary<PluginDependencyAttribute, string> pluginDependencies = Attribute.GetCustomAttributes(plugin, false).OfType<PluginDependencyAttribute>().ToDictionary(a => a, a => a.Dependency);
     94        var pluginFiles = new HashSet<string>(Attribute.GetCustomAttributes(plugin, false)
     95          .OfType<PluginFileAttribute>().Where(pf => pf.FileType == PluginFileType.Assembly).Select(pf => pf.FileName));
     96        var pluginAssemblies = PluginLoader.Assemblies.Where(a => pluginFiles.Contains(Path.GetFileName(a.Location))).ToList();
     97        var referencedAssemblies = pluginAssemblies.SelectMany(a => a.GetReferencedAssemblies()).ToList();
    8998
    9099        foreach (PluginDependencyAttribute attribute in pluginDependencies.Keys) {
     
    93102          if (pluginDependencyName == "HeuristicLab.MathJax") continue; //is never referenced as this plugin contains HTML files
    94103          if (pluginDependencyName == "HeuristicLab.MatlabConnector") continue; //the matlab connector is loaded dynamically and hence not referenced by the dll
    95           var referencedPluginAssemblies = pluginAssembly.GetReferencedAssemblies().Where(IsPluginAssemblyName);
     104          var referencedPluginAssemblies = referencedAssemblies.Where(IsPluginAssemblyName);
    96105          if (referencedPluginAssemblies.Any(a => pluginNames[a.FullName] == pluginDependencyName)) continue;
    97106
    98           var referencedNonPluginAssemblies = pluginAssembly.GetReferencedAssemblies().Where(a => !IsPluginAssemblyName(a));
     107          var referencedNonPluginAssemblies = referencedAssemblies.Where(a => !IsPluginAssemblyName(a));
    99108          bool found = (from referencedNonPluginAssembly in referencedNonPluginAssemblies
    100109                        select referencedNonPluginAssembly.Name into assemblyName
Note: See TracChangeset for help on using the changeset viewer.