Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/22/08 15:59:07 (16 years ago)
Author:
gkronber
Message:
  • added an attribute for the build time of an assembly.
  • build-date is automatically updated via SubWCRev in the pre-build action.
  • adapted PluginManager to correctly handle plugins with same version but newer build date

fixes ticket #39

Location:
trunk/sources/HeuristicLab.PluginInfrastructure.GUI
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.PluginInfrastructure.GUI/ManagerForm.cs

    r38 r91  
    147147    private void publishButton_Click(object sender, EventArgs args) {
    148148      PluginInfo plugin = ((PluginTag)pluginTreeView.SelectedNode.Tag).Plugin;
     149      publishPlugin(plugin);
     150    }
     151
     152    private void publishPlugin(PluginInfo plugin) {
    149153      try {
    150154        string packageFileName = plugin.Name + "-" + plugin.Version + ".zip";
     
    165169        infoTextBox.Text += "Upload this file to your plugin source and add the following entry to" +
    166170" the file plugins.xml residing in the base directory of your plugin source.\n\n";
    167         infoTextBox.Text += "  <Plugin Name=\"" + plugin.Name + "\" Version=\"" + plugin.Version + "\">\n";
     171        infoTextBox.Text += "  <Plugin Name=\"" + plugin.Name + "\" Version=\""
     172          + plugin.Version + "\" Build=\"" + plugin.BuildDate.ToUniversalTime().ToString(System.Globalization.CultureInfo.InvariantCulture.DateTimeFormat) + "\">\n";
    168173        foreach(PluginInfo dependency in plugin.Dependencies) {
    169174          infoTextBox.Text += "    <Dependency Name=\"" + dependency.Name + "\" />\n";
     
    251256        if(samePlugins.Count > 1) {
    252257          samePlugins.ForEach(delegate(PluginDescription tag2) {
    253             if(tag2.Version > mostRecentVersion.Version) {
     258            if(tag2.Version > mostRecentVersion.Version ||
     259              (tag2.Version == mostRecentVersion.Version && tag2.BuildDate>mostRecentVersion.BuildDate)) {
    254260              mostRecentVersion = tag2;
    255261            }
     
    288294      allAvailablePlugins.ForEach(delegate(PluginDescription availablePlugin) {
    289295        List<PluginTag> oldPlugins = allTags.FindAll(delegate(PluginTag currentPlugin) {
    290           return currentPlugin.PluginName == availablePlugin.Name && 
    291             (currentPlugin.State & (PluginState.Installed | PluginState.Disabled)) !=0;
     296          return currentPlugin.PluginName == availablePlugin.Name &&
     297            (currentPlugin.State & (PluginState.Installed | PluginState.Disabled)) != 0;
    292298        });
    293299
    294300        if(oldPlugins.Count == 1) {
    295           if(oldPlugins[0].PluginVersion < availablePlugin.Version) {
     301          if(oldPlugins[0].PluginVersion < availablePlugin.Version ||
     302            (oldPlugins[0].PluginVersion == availablePlugin.Version && oldPlugins[0].PluginBuildDate<availablePlugin.BuildDate)) {
    296303            upgrades.Add(availablePlugin);
    297304          }
     
    309316        });
    310317
    311         if(currentPlugins.Count == 1 && currentPlugins[0].PluginVersion < availablePlugin.Version) {
     318        if(currentPlugins.Count == 1 && (currentPlugins[0].PluginVersion < availablePlugin.Version ||
     319          (currentPlugins[0].PluginVersion==availablePlugin.Version && currentPlugins[0].PluginBuildDate<availablePlugin.BuildDate))) {
    312320          overrides.Add(availablePlugin);
    313321        }
  • trunk/sources/HeuristicLab.PluginInfrastructure.GUI/PluginDescription.cs

    r2 r91  
    2828  class PluginDescription {
    2929    private string name;
    30 
    3130    public string Name {
    3231      get { return name; }
     
    3433    }
    3534    private Version version;
    36 
    3735    public Version Version {
    3836      get { return version; }
    3937      set { version = value; }
     38    }
     39    private DateTime buildDate;
     40    public DateTime BuildDate {
     41      get { return buildDate; }
     42      set { buildDate = value; }
    4043    }
    4144
     
    5053    }
    5154
    52     public PluginDescription(string name, Version version, PluginSource source) {
     55    public PluginDescription(string name, Version version, DateTime buildDate, PluginSource source) {
    5356      this.name = name;
    5457      this.version = version;
    5558      this.source = source;
     59      this.buildDate = buildDate;
    5660    }
    5761  }
  • trunk/sources/HeuristicLab.PluginInfrastructure.GUI/PluginSource.cs

    r2 r91  
    7777        string version = child.Attributes["Version"].Value;
    7878
    79         PluginDescription description = new PluginDescription(name, new Version(version), this);
     79        DateTime buildDate;
     80        if(child.Attributes["Build"] != null) {
     81          string build = child.Attributes["Build"].Value;
     82          DateTime.TryParse(build, System.Globalization.CultureInfo.InvariantCulture.DateTimeFormat, System.Globalization.DateTimeStyles.AssumeUniversal, out buildDate);
     83        } else {
     84          buildDate = DateTime.MinValue;
     85        }
     86        PluginDescription description = new PluginDescription(name, new Version(version), buildDate, this);
    8087        availablePlugins.Add(description);
    8188
  • trunk/sources/HeuristicLab.PluginInfrastructure.GUI/PluginTag.cs

    r37 r91  
    3636  class PluginTag {
    3737    private PluginInfo plugin;
    38 
    3938    public PluginInfo Plugin {
    4039      get { return plugin; }
     
    5049      }
    5150    }
    52 
    5351
    5452    private PluginDescription upgradePluginDescription;
     
    7472      set { pluginVersion = value; }
    7573    }
     74    private DateTime pluginBuildDate;
     75    public DateTime PluginBuildDate {
     76      get { return pluginBuildDate; }
     77      set { pluginBuildDate = value; }
     78    }
    7679
    7780    private string pluginDetails;
     
    9699      this.state = state;
    97100      this.allTags = allTags;
    98 
    99101      this.pluginName = plugin.Name;
    100102      this.pluginVersion = plugin.Version;
     103      this.pluginBuildDate = plugin.BuildDate;
    101104      this.message = plugin.Message;
    102105      pluginDetails = GeneratePluginDetails(plugin);
     
    108111      this.state = state;
    109112      this.allTags = allTags;
    110 
    111113      this.pluginName = plugin.Name;
    112114      this.pluginVersion = plugin.Version;
    113 
     115      this.pluginBuildDate = plugin.BuildDate;
    114116      pluginDetails = GeneratePluginDetails(plugin);
    115117      pluginDependencies = GeneratePluginDependencies(plugin);
     
    132134      });
    133135      return "Plugin: " + plugin.Name + "\n" +
    134       "Version: " + plugin.Version + "\n\n" +
     136      "Version: " + plugin.Version + "\n" +
     137      "Build: " +plugin.BuildDate + "\n\n" +
    135138      (dependencies.Length != 0 ? "Requires: \n" + dependencies + "\n" : "") +
    136139      (dependents.Length != 0 ? "Used by:\n" + dependents + "\n" : "") +
     
    146149      return "plugin: " + plugin.Name + "\n" +
    147150      "Version: " + plugin.Version + "\n" +
     151      "Build: "+plugin.BuildDate +"\n" +
    148152      "Installed from: " + plugin.Source + "\n" +
    149153      "Requires: \n" + dependencies;
     
    156160      }
    157161      return "plugin: " + upgrade.Name + "\n" +
    158       "Current version: " + plugin.Version + " will be upgraded to new version: " + upgrade.Version + "\n"+
     162      "Current version: " + plugin.Version + " ("+plugin.BuildDate+") will be upgraded to new version: " + upgrade.Version + " ("+upgrade.BuildDate+")\n"+
    159163      "Upgraded from: " + upgrade.Source + "\n" +
    160164      "Requires: \n" + dependencies;
     
    163167    private List<string> GeneratePluginDependencies(PluginInfo plugin) {
    164168      List<string> dependencies = new List<string>();
    165 
    166169      plugin.Dependencies.ForEach(delegate(PluginInfo dependency) {
    167170        dependencies.Add(dependency.Name);
    168171      });
    169 
    170172      return dependencies;
    171173    }
Note: See TracChangeset for help on using the changeset viewer.