Author: lluis
Date: 2005-11-25 08:03:49 -0500 (Fri, 25 Nov 2005)
New Revision: 53476

Added:
   
trunk/monodevelop/Core/src/MonoDevelop.Core/MonoDevelop.Core.AddIns.Setup/AssemblyDependency.cs
Modified:
   trunk/monodevelop/Core/src/MonoDevelop.Core/ChangeLog
   trunk/monodevelop/Core/src/MonoDevelop.Core/Makefile.am
   
trunk/monodevelop/Core/src/MonoDevelop.Core/MonoDevelop.Core.AddIns.Setup/AddinInfo.cs
   
trunk/monodevelop/Core/src/MonoDevelop.Core/MonoDevelop.Core.AddIns.Setup/SetupService.cs
   trunk/monodevelop/Core/src/MonoDevelop.Core/MonoDevelop.Core.AddIns/AddIn.cs
   
trunk/monodevelop/Core/src/MonoDevelop.Core/MonoDevelop.Core.AddIns/AddInService.cs
   
trunk/monodevelop/Core/src/MonoDevelop.Core/MonoDevelop.Core.ProgressMonitoring/ConsoleProgressMonitor.cs
   trunk/monodevelop/Core/src/MonoDevelop.Core/MonoDevelop.Core.mdp
Log:
2005-11-25  Lluis Sanchez Gual  <[EMAIL PROTECTED]> 

        * MonoDevelop.Core.AddIns/AddIn.cs: Add support for "Assembly"
        dependencies. Removed unneeded error log message.
        
        * MonoDevelop.Core.AddIns.Setup/AddinInfo.cs:
        * MonoDevelop.Core.AddIns/AddInService.cs: Add support for "Assembly"
        dependencies.
        
        * MonoDevelop.Core.ProgressMonitoring/ConsoleProgressMonitor.cs:
        Improved formatting.
        
        * MonoDevelop.Core.AddIns.Setup/SetupService.cs: Generate an index page
        when building a repository.
        
        * Makefile.am:
        * MonoDevelop.Core.mdp: Added new files.



Modified: trunk/monodevelop/Core/src/MonoDevelop.Core/ChangeLog
===================================================================
--- trunk/monodevelop/Core/src/MonoDevelop.Core/ChangeLog       2005-11-25 
07:26:28 UTC (rev 53475)
+++ trunk/monodevelop/Core/src/MonoDevelop.Core/ChangeLog       2005-11-25 
13:03:49 UTC (rev 53476)
@@ -1,3 +1,21 @@
+2005-11-25  Lluis Sanchez Gual  <[EMAIL PROTECTED]> 
+
+       * MonoDevelop.Core.AddIns/AddIn.cs: Add support for "Assembly"
+       dependencies. Removed unneeded error log message.
+       
+       * MonoDevelop.Core.AddIns.Setup/AddinInfo.cs:
+       * MonoDevelop.Core.AddIns/AddInService.cs: Add support for "Assembly"
+       dependencies.
+       
+       * MonoDevelop.Core.ProgressMonitoring/ConsoleProgressMonitor.cs:
+       Improved formatting.
+       
+       * MonoDevelop.Core.AddIns.Setup/SetupService.cs: Generate an index page
+       when building a repository.
+       
+       * Makefile.am:
+       * MonoDevelop.Core.mdp: Added new files.
+
 2005-11-18  Lluis Sanchez Gual  <[EMAIL PROTECTED]> 
 
        * MonoDevelop.Core.AddIns/AddIn.cs: 

Modified: trunk/monodevelop/Core/src/MonoDevelop.Core/Makefile.am
===================================================================
--- trunk/monodevelop/Core/src/MonoDevelop.Core/Makefile.am     2005-11-25 
07:26:28 UTC (rev 53475)
+++ trunk/monodevelop/Core/src/MonoDevelop.Core/Makefile.am     2005-11-25 
13:03:49 UTC (rev 53476)
@@ -63,6 +63,7 @@
 MonoDevelop.Core.AddIns.Setup/AddinRepositoryEntry.cs \
 MonoDevelop.Core.AddIns.Setup/AddinSetupInfo.cs \
 MonoDevelop.Core.AddIns.Setup/AddinSystemConfiguration.cs \
+MonoDevelop.Core.AddIns.Setup/AssemblyDependency.cs \
 MonoDevelop.Core.AddIns.Setup/InstallException.cs \
 MonoDevelop.Core.AddIns.Setup/NativeDependency.cs \
 MonoDevelop.Core.AddIns.Setup/NativePackage.cs \

Modified: 
trunk/monodevelop/Core/src/MonoDevelop.Core/MonoDevelop.Core.AddIns/AddIn.cs
===================================================================
--- 
trunk/monodevelop/Core/src/MonoDevelop.Core/MonoDevelop.Core.AddIns/AddIn.cs    
    2005-11-25 07:26:28 UTC (rev 53475)
+++ 
trunk/monodevelop/Core/src/MonoDevelop.Core/MonoDevelop.Core.AddIns/AddIn.cs    
    2005-11-25 13:03:49 UTC (rev 53476)
@@ -266,10 +266,16 @@
                                                        string aname = 
dep.GetAttribute ("id");
                                                        AddIn addin = 
AddInTreeSingleton.AddInTree.AddIns [aname];
                                                        if (addin == null)
-                                                               throw new 
MissingDependencyException ("Addin: " + aname);
+                                                               throw new 
MissingDependencyException ("Required add-in not found: " + aname);
                                                        list.Add (addin);
                                                        break;
                                                }
+                                               case "Assembly": {
+                                                       string aname = 
dep.GetAttribute ("name");
+                                                       if 
(Runtime.SystemAssemblyService.GetAssemblyLocation (aname) == null)
+                                                               throw new 
MissingDependencyException ("Required assembly not found: " + aname);
+                                                       break;
+                                               }
                                        }
                                }
                                dependencies = (AddIn[]) list.ToArray 
(typeof(AddIn));
@@ -482,19 +488,8 @@
                /// <summary>
                /// Returns a type which is related to this Add-In.
                /// </summary>
-               /// <exception cref="TypeNotFoundException">
-               /// If className could not be found
-               /// </exception>
                public Type GetType (string className)
                {
-                       Type ct = GetTypeInternal (className);
-                       if (ct == null)
-                               Runtime.LoggingService.Error ("Type '" + 
className + "' referenced from add-in '" + Id + "' not found.");
-                       return ct;
-               }
-               
-               internal Type GetTypeInternal (string className)
-               {
                        foreach (DictionaryEntry library in runtimeLibraries) {
                                Type t = ((Assembly)library.Value).GetType 
(className);
                                if (t != null)
@@ -504,7 +499,7 @@
                        // Look in dependencies
                        
                        foreach (AddIn dep in Dependencies) {
-                               Type t = dep.GetTypeInternal (className);
+                               Type t = dep.GetType (className);
                                if (t != null) return t;
                        }
                        

Modified: 
trunk/monodevelop/Core/src/MonoDevelop.Core/MonoDevelop.Core.AddIns/AddInService.cs
===================================================================
--- 
trunk/monodevelop/Core/src/MonoDevelop.Core/MonoDevelop.Core.AddIns/AddInService.cs
 2005-11-25 07:26:28 UTC (rev 53475)
+++ 
trunk/monodevelop/Core/src/MonoDevelop.Core/MonoDevelop.Core.AddIns/AddInService.cs
 2005-11-25 13:03:49 UTC (rev 53476)
@@ -196,8 +196,11 @@
                        addins.Remove (iad);
                        addins.Add (iad);
                        
-                       foreach (AddinDependency dep in iad.Addin.Dependencies)
-                               ResolveLoadDependencies (addins, depCheck, 
dep.AddinId, dep.Version);
+                       foreach (PackageDependency dep in 
iad.Addin.Dependencies) {
+                               AddinDependency adep = dep as AddinDependency;
+                               if (adep != null)
+                                       ResolveLoadDependencies (addins, 
depCheck, adep.AddinId, adep.Version);
+                       }
                                
                        depCheck.Pop ();
                }

Modified: 
trunk/monodevelop/Core/src/MonoDevelop.Core/MonoDevelop.Core.AddIns.Setup/AddinInfo.cs
===================================================================
--- 
trunk/monodevelop/Core/src/MonoDevelop.Core/MonoDevelop.Core.AddIns.Setup/AddinInfo.cs
      2005-11-25 07:26:28 UTC (rev 53475)
+++ 
trunk/monodevelop/Core/src/MonoDevelop.Core/MonoDevelop.Core.AddIns.Setup/AddinInfo.cs
      2005-11-25 13:03:49 UTC (rev 53476)
@@ -99,6 +99,7 @@
                
                [XmlArrayItem ("AddinDependency", typeof(AddinDependency))]
                [XmlArrayItem ("NativeDependency", typeof(NativeDependency))]
+               [XmlArrayItem ("AssemblyDependency", 
typeof(AssemblyDependency))]
                public PackageDependencyCollection Dependencies {
                        get { return dependencies; }
                }
@@ -130,6 +131,13 @@
                                info.Dependencies.Add (adep);
                        }
                        
+                       foreach (XmlElement dep in doc.SelectNodes 
("AddIn/Dependencies/Assembly")) {
+                               AssemblyDependency adep = new 
AssemblyDependency ();
+                               adep.FullName = dep.GetAttribute ("name");
+                               adep.Package = dep.GetAttribute ("package");
+                               info.Dependencies.Add (adep);
+                       }
+                       
                        return info;
                }
                

Added: 
trunk/monodevelop/Core/src/MonoDevelop.Core/MonoDevelop.Core.AddIns.Setup/AssemblyDependency.cs
===================================================================
--- 
trunk/monodevelop/Core/src/MonoDevelop.Core/MonoDevelop.Core.AddIns.Setup/AssemblyDependency.cs
     2005-11-25 07:26:28 UTC (rev 53475)
+++ 
trunk/monodevelop/Core/src/MonoDevelop.Core/MonoDevelop.Core.AddIns.Setup/AssemblyDependency.cs
     2005-11-25 13:03:49 UTC (rev 53476)
@@ -0,0 +1,67 @@
+//
+// AssemblyDependency.cs
+//
+// Author:
+//   Lluis Sanchez Gual
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Collections;
+using System.Xml;
+using System.Xml.Serialization;
+
+namespace MonoDevelop.Core.AddIns.Setup
+{
+       [XmlType ("AssemblyDependency")]
+       public class AssemblyDependency: PackageDependency
+       {
+               string fullName;
+               string package;
+               
+               public string FullName {
+                       get { return fullName; }
+                       set { fullName = value; }
+               }
+               
+               public string Package {
+                       get { return package; }
+                       set { package = value; }
+               }
+               
+               public override string Name {
+                       get { return fullName + " (provided by " + package + 
")"; }
+               }
+               
+               public override bool CheckInstalled (SetupService service)
+               {
+                       return 
Runtime.SystemAssemblyService.GetAssemblyLocation (fullName) != null;
+               }
+               
+               public override void Resolve (IProgressMonitor monitor, 
SetupService service, AddinPackage parentPackage, PackageCollection toInstall, 
PackageCollection toUninstall, PackageCollection installedRequired, 
PackageDependencyCollection unresolved)
+               {
+                       if (!CheckInstalled (service))
+                               unresolved.Add (this);
+               }
+       }
+}

Modified: 
trunk/monodevelop/Core/src/MonoDevelop.Core/MonoDevelop.Core.AddIns.Setup/SetupService.cs
===================================================================
--- 
trunk/monodevelop/Core/src/MonoDevelop.Core/MonoDevelop.Core.AddIns.Setup/SetupService.cs
   2005-11-25 07:26:28 UTC (rev 53475)
+++ 
trunk/monodevelop/Core/src/MonoDevelop.Core/MonoDevelop.Core.AddIns.Setup/SetupService.cs
   2005-11-25 13:03:49 UTC (rev 53476)
@@ -814,17 +814,20 @@
                public void BuildRepository (IProgressMonitor monitor, string 
path)
                {
                        string mainPath = Path.Combine (path, "main.mrep");
+                       ArrayList allAddins = new ArrayList ();
+                       
                        Repository rootrep = (Repository) ReadObject (mainPath, 
typeof(Repository));
                        if (rootrep == null) {
                                rootrep = new Repository ();
                        }
                        
-                       BuildRepository (monitor, rootrep, path, "root.mrep");
+                       BuildRepository (monitor, rootrep, path, "root.mrep", 
allAddins);
                        WriteObject (mainPath, rootrep);
+                       GenerateIndexPage (rootrep, allAddins, path);
                        monitor.Log.WriteLine ("Updated main.mrep");
                }
                
-               void BuildRepository (IProgressMonitor monitor, Repository 
rootrep, string rootPath, string relFilePath)
+               void BuildRepository (IProgressMonitor monitor, Repository 
rootrep, string rootPath, string relFilePath, ArrayList allAddins)
                {
                        DateTime lastModified = DateTime.MinValue;
                        
@@ -852,6 +855,7 @@
                                        modified = true;
                                        monitor.Log.WriteLine ("Added addin: " 
+ fname);
                                }
+                               allAddins.Add (entry);
                                
                                DateTime date = File.GetLastWriteTime (file);
                                if (date > lastModified)
@@ -884,10 +888,33 @@
                        
                        foreach (string dir in Directory.GetDirectories 
(mainPath)) {
                                string based = dir.Substring (rootPath.Length + 
1);
-                               BuildRepository (monitor, rootrep, rootPath, 
Path.Combine (based, "main.mrep"));
+                               BuildRepository (monitor, rootrep, rootPath, 
Path.Combine (based, "main.mrep"), allAddins);
                        }
                }
                
+               void GenerateIndexPage (Repository rep, ArrayList addins, 
string basePath)
+               {
+                       StreamWriter sw = new StreamWriter (Path.Combine 
(basePath, "index.html"));
+                       sw.WriteLine ("<html><body><head>");
+                       sw.WriteLine ("<html><body>");
+                       sw.WriteLine ("<link type='text/css' rel='stylesheet' 
href='md.css' />");
+                       sw.WriteLine ("</head>");
+                       sw.WriteLine ("<h1>MonoDevelop Add-in Repository</h1>");
+                       if (rep.Name != null && rep.Name != "")
+                               sw.WriteLine ("<h2>" + rep.Name + "</h2>");
+                       sw.WriteLine ("<p>This is a list of add-ins available 
in this repository. ");
+                       sw.WriteLine ("If you need information about how to 
install add-ins, please read <a 
href='http://www.monodevelop.com/Installing_Add-ins'>this</a>.</p>");
+                       sw.WriteLine ("<table 
border=1><thead><tr><th>Add-in</th><th>Version</th><th>Description</th></tr></thead>");
+                       
+                       foreach (AddinRepositoryEntry entry in addins) {
+                               sw.WriteLine ("<tr><td>" + entry.Addin.Id + 
"</td><td>" + entry.Addin.Version + "</td><td>" + entry.Addin.Description + 
"</td></tr>");
+                       }
+                       
+                       sw.WriteLine ("</table>");
+                       sw.WriteLine ("</body></html>");
+                       sw.Close ();
+               }
+               
                public void BuildPackage (IProgressMonitor monitor, string 
targetDirectory, params string[] filePaths)
                {
                        foreach (string file in filePaths)

Modified: 
trunk/monodevelop/Core/src/MonoDevelop.Core/MonoDevelop.Core.ProgressMonitoring/ConsoleProgressMonitor.cs
===================================================================
--- 
trunk/monodevelop/Core/src/MonoDevelop.Core/MonoDevelop.Core.ProgressMonitoring/ConsoleProgressMonitor.cs
   2005-11-25 07:26:28 UTC (rev 53475)
+++ 
trunk/monodevelop/Core/src/MonoDevelop.Core/MonoDevelop.Core.ProgressMonitoring/ConsoleProgressMonitor.cs
   2005-11-25 13:03:49 UTC (rev 53476)
@@ -94,15 +94,15 @@
                
                public override void ReportWarning (string message)
                {
-                       WriteText ("WARNING: " + message);
+                       WriteText ("WARNING: " + message + "\n");
                }
                
                public override void ReportError (string message, Exception ex)
                {
                        if (message != null)
-                               WriteText ("ERROR: " + message);
+                               WriteText ("ERROR: " + message + "\n");
                        else if (ex != null)
-                               WriteText ("ERROR: " + ex.Message);
+                               WriteText ("ERROR: " + ex.Message + "\n");
                }
                
                void WriteText (string text)

Modified: trunk/monodevelop/Core/src/MonoDevelop.Core/MonoDevelop.Core.mdp
===================================================================
--- trunk/monodevelop/Core/src/MonoDevelop.Core/MonoDevelop.Core.mdp    
2005-11-25 07:26:28 UTC (rev 53475)
+++ trunk/monodevelop/Core/src/MonoDevelop.Core/MonoDevelop.Core.mdp    
2005-11-25 13:03:49 UTC (rev 53476)
@@ -144,6 +144,7 @@
     <File name="./MonoDevelop.Core.Utils.DirectoryArchive/ZipDecompressor.cs" 
subtype="Code" buildaction="Compile" />
     <File name="./MonoDevelop.Core.Utils.ReportingStream/ReportingStream.cs" 
subtype="Code" buildaction="Compile" />
     <File name="./CoreKey.key" subtype="Code" buildaction="Nothing" />
+    <File name="./MonoDevelop.Core.AddIns.Setup/AssemblyDependency.cs" 
subtype="Code" buildaction="Compile" />
   </Contents>
   <References>
     <ProjectReference type="Gac" localcopy="True" refto="System, 
Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to