diff options
author | Lluis Sanchez <lluis@novell.com> | 2009-02-06 16:58:16 +0300 |
---|---|---|
committer | Lluis Sanchez <lluis@novell.com> | 2009-02-06 16:58:16 +0300 |
commit | 5fea1f52fd4aaa1b633137c6d811087f4d0ce11b (patch) | |
tree | 9c566a2213a06d7a1adbecba75a0109bbc1eeae3 | |
parent | fdc39c774df27b008e6652e88119e258d9af8556 (diff) |
* Mono.Addins.sln:
* Mono.Addins/Makefile.am:
* Mono.Addins/Mono.Addins.csproj: Updated.
* Mono.Addins.Setup/Mono.Addins.Setup/SetupTool.cs: Added command for
getting the list of assemblies of an add-in.
* Mono.Addins/Mono.Addins.Database/AddinScanner.cs:
* Mono.Addins/Mono.Addins.Description/AddinDescription.cs: BasePath is
now public.
* Mono.Addins/Mono.Addins.Database/Util.cs: Added methods for checking
if the app is running on mono.
* Mono.Addins/Mono.Addins.Database/SetupDomain.cs:
* Mono.Addins/Mono.Addins.Database/SetupProcess.cs:
* Mono.Addins/Mono.Addins.Database/ISetupHandler.cs:
* Mono.Addins/Mono.Addins.Database/AddinDatabase.cs: Added support for
scanning the addins in a separate appdomain instead of a separate
process.
svn path=/trunk/mono-addins/; revision=126043
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | Mono.Addins.Setup/ChangeLog | 5 | ||||
-rw-r--r-- | Mono.Addins.Setup/Mono.Addins.Setup/SetupTool.cs | 35 | ||||
-rw-r--r-- | Mono.Addins.sln | 21 | ||||
-rw-r--r-- | Mono.Addins/ChangeLog | 19 | ||||
-rw-r--r-- | Mono.Addins/Makefile.am | 2 | ||||
-rw-r--r-- | Mono.Addins/Mono.Addins.Database/AddinDatabase.cs | 29 | ||||
-rw-r--r-- | Mono.Addins/Mono.Addins.Database/AddinScanner.cs | 4 | ||||
-rw-r--r-- | Mono.Addins/Mono.Addins.Database/ISetupHandler.cs | 36 | ||||
-rw-r--r-- | Mono.Addins/Mono.Addins.Database/SetupDomain.cs | 180 | ||||
-rw-r--r-- | Mono.Addins/Mono.Addins.Database/SetupProcess.cs | 23 | ||||
-rw-r--r-- | Mono.Addins/Mono.Addins.Database/Util.cs | 26 | ||||
-rw-r--r-- | Mono.Addins/Mono.Addins.Description/AddinDescription.cs | 10 | ||||
-rw-r--r-- | Mono.Addins/Mono.Addins.csproj | 7 |
14 files changed, 383 insertions, 18 deletions
@@ -1,3 +1,7 @@ +2009-02-06 Lluis Sanchez Gual <lluis@novell.com> + + * Mono.Addins.sln: Updated. + 2008-11-10 Lluis Sanchez Gual <lluis@novell.com> * configure.ac: Respect custom libdir during ./configure. Fixes bug diff --git a/Mono.Addins.Setup/ChangeLog b/Mono.Addins.Setup/ChangeLog index a6029be..1b6b34a 100644 --- a/Mono.Addins.Setup/ChangeLog +++ b/Mono.Addins.Setup/ChangeLog @@ -1,3 +1,8 @@ +2009-02-06 Lluis Sanchez Gual <lluis@novell.com> + + * Mono.Addins.Setup/SetupTool.cs: Added command for getting + the list of assemblies of an add-in. + 2009/02/06 Lluis Sanchez Gual <lluis@novell.com> * Mono.Addins.Setup.csproj: Updated. diff --git a/Mono.Addins.Setup/Mono.Addins.Setup/SetupTool.cs b/Mono.Addins.Setup/Mono.Addins.Setup/SetupTool.cs index e703fdd..cdaa872 100644 --- a/Mono.Addins.Setup/Mono.Addins.Setup/SetupTool.cs +++ b/Mono.Addins.Setup/Mono.Addins.Setup/SetupTool.cs @@ -367,6 +367,30 @@ namespace Mono.Addins.Setup service.BuildPackage (new ConsoleProgressStatus (verbose), GetOption ("d", "."), GetArguments ()); } + void PrintLibraries (string[] args) + { + if (GetArguments ().Length < 1) + throw new InstallException ("An add-in id is required."); + + bool refFormat = HasOption ("r"); + + System.Text.StringBuilder sb = new System.Text.StringBuilder (); + foreach (string id in GetArguments ()) { + Addin addin = service.Registry.GetAddin (id); + if (addin != null) { + foreach (string asm in addin.Description.MainModule.Assemblies) { + string file = Path.Combine (addin.Description.BasePath, asm); + if (sb.Length > 0) + sb.Append (' '); + if (refFormat) + sb.Append ("-r:"); + sb.Append (file); + } + } + } + Console.WriteLine (sb); + } + void UpdateRegistry (string[] args) { registry.Update (new ConsoleProgressStatus (verbose)); @@ -911,6 +935,17 @@ namespace Mono.Addins.Setup cmd.Usage = "<command>"; commands.Add (cmd); + cat = "Build Commands"; + + cmd = new SetupCommand (cat, "libraries", "libs", new SetupCommandHandler (PrintLibraries)); + cmd.Description = "Lists add-in assemblies."; + cmd.Usage = "[-r] <addin-id> ..."; + cmd.AppendDesc ("Prints a list of assemblies exported by the add-in or add-ins provided"); + cmd.AppendDesc ("as arguments. This list of assemblies can be used as references for"); + cmd.AppendDesc ("building add-ins that depend on them. If the -r option is specified,"); + cmd.AppendDesc ("each assembly is prefixed with '-r:'."); + commands.Add (cmd); + cat = "Debug Commands"; cmd = new SetupCommand (cat, "dump-file", null, new SetupCommandHandler (DumpRegistryFile)); diff --git a/Mono.Addins.sln b/Mono.Addins.sln index 76c6d86..d0ae269 100644 --- a/Mono.Addins.sln +++ b/Mono.Addins.sln @@ -52,8 +52,8 @@ Global GlobalSection(ProjectConfigurationPlatforms) = postSolution
{04C62888-E58A-4C6E-8688-A4F6F5459E14}.Default|Any CPU.ActiveCfg = Debug|Any CPU
{04C62888-E58A-4C6E-8688-A4F6F5459E14}.Default|Any CPU.Build.0 = Debug|Any CPU
- {1CD51E61-1985-4D22-9BFA-D14C8FC61B46}.Default|Any CPU.ActiveCfg = Debug|Any CPU
- {1CD51E61-1985-4D22-9BFA-D14C8FC61B46}.Default|Any CPU.Build.0 = Debug|Any CPU
+ {1CD51E61-1985-4D22-9BFA-D14C8FC61B46}.Default|Any CPU.ActiveCfg = Default|Any CPU
+ {1CD51E61-1985-4D22-9BFA-D14C8FC61B46}.Default|Any CPU.Build.0 = Default|Any CPU
{2FF5459A-495C-4FDF-81EA-D0A6C07E7C0D}.Default|Any CPU.ActiveCfg = Debug|Any CPU
{2FF5459A-495C-4FDF-81EA-D0A6C07E7C0D}.Default|Any CPU.Build.0 = Debug|Any CPU
{42D1CE65-A14B-4218-B787-58AD7AA68513}.Default|Any CPU.ActiveCfg = Debug|Any CPU
@@ -111,6 +111,23 @@ Global name = Mono.Addins
version = 0.1
StartupItem = Mono.Addins\Mono.Addins.csproj
+ Policies = $0
+ $0.DotNetNamingPolicy = $1
+ $1.DirectoryNamespaceAssociation = Flat
+ $1.ResourceNamePolicy = FileName
+ $0.StandardHeader = $2
+ $2.inheritsSet = MITX11License
+ $0.TextStylePolicy = $3
+ $3.FileWidth = 120
+ $3.TabWidth = 4
+ $3.TabsToSpaces = False
+ $3.NoTabsAfterNonTabs = False
+ $3.RemoveTrailingWhitespace = False
+ $0.VersionControlPolicy = $4
+ $4.inheritsSet = Mono
+ $0.ChangeLogPolicy = $5
+ $5.UpdateMode = ProjectRoot
+ $5.inheritsSet = Mono
defaultDeployTarget = Directory
EndGlobalSection
EndGlobal
diff --git a/Mono.Addins/ChangeLog b/Mono.Addins/ChangeLog index 7b4df44..964609c 100644 --- a/Mono.Addins/ChangeLog +++ b/Mono.Addins/ChangeLog @@ -1,5 +1,24 @@ 2009-02-06 Lluis Sanchez Gual <lluis@novell.com> + * Makefile.am: + * Mono.Addins.csproj: Updated. + + * Mono.Addins.Database/AddinScanner.cs: + * Mono.Addins.Description/AddinDescription.cs: BasePath is now + public. + + * Mono.Addins.Database/Util.cs: Added methods for checking if + the app is running on mono. + + * Mono.Addins.Database/SetupDomain.cs: + * Mono.Addins.Database/SetupProcess.cs: + * Mono.Addins.Database/ISetupHandler.cs: + * Mono.Addins.Database/AddinDatabase.cs: Added support for + scanning the addins in a separate appdomain instead of a + separate process. + +2009-02-06 Lluis Sanchez Gual <lluis@novell.com> + * Mono.Addins/ExtensionNode.cs: Improve error message. 2009-02-06 Lluis Sanchez Gual <lluis@novell.com> diff --git a/Mono.Addins/Makefile.am b/Mono.Addins/Makefile.am index dd24e0e..82a7758 100644 --- a/Mono.Addins/Makefile.am +++ b/Mono.Addins/Makefile.am @@ -24,7 +24,9 @@ FILES = \ Mono.Addins.Database/DefaultAssemblyReflector.cs \ Mono.Addins.Database/FileDatabase.cs \ Mono.Addins.Database/IAssemblyReflector.cs \ + Mono.Addins.Database/ISetupHandler.cs \ Mono.Addins.Database/ProcessProgressStatus.cs \ + Mono.Addins.Database/SetupDomain.cs \ Mono.Addins.Database/SetupProcess.cs \ Mono.Addins.Database/Util.cs \ Mono.Addins.Description/AddinDependency.cs \ diff --git a/Mono.Addins/Mono.Addins.Database/AddinDatabase.cs b/Mono.Addins/Mono.Addins.Database/AddinDatabase.cs index 521c3fb..dec0348 100644 --- a/Mono.Addins/Mono.Addins.Database/AddinDatabase.cs +++ b/Mono.Addins/Mono.Addins.Database/AddinDatabase.cs @@ -673,6 +673,17 @@ namespace Mono.Addins.Database public bool AddinDependsOn (string domain, string id1, string id2) { + Hashtable visited = new Hashtable (); + return AddinDependsOn (visited, domain, id1, id2); + } + + bool AddinDependsOn (Hashtable visited, string domain, string id1, string id2) + { + if (visited.Contains (id1)) + return false; + + visited.Add (id1, id1); + Addin addin1 = GetInstalledAddin (domain, id1, false); // We can assumbe that if the add-in is not returned here, it may be a root addin. @@ -687,7 +698,7 @@ namespace Mono.Addins.Database string depid = Addin.GetFullId (addin1.AddinInfo.Namespace, adep.AddinId, null); if (depid == id2) return true; - else if (AddinDependsOn (domain, depid, id2)) + else if (AddinDependsOn (visited, domain, depid, id2)) return true; } return false; @@ -784,16 +795,17 @@ namespace Mono.Addins.Database void RunScannerProcess (IProgressStatus monitor) { + ISetupHandler setup = GetSetupHandler (); + IProgressStatus scanMonitor = monitor; ArrayList pparams = new ArrayList (); - pparams.Add (null); // scan folder bool retry = false; do { try { if (monitor.LogLevel > 1) monitor.Log ("Looking for addins"); - SetupProcess.ExecuteCommand (scanMonitor, registry.RegistryPath, registry.StartupDirectory, "scan", (string[]) pparams.ToArray (typeof(string))); + setup.Scan (scanMonitor, registry.RegistryPath, registry.StartupDirectory, null, (string[]) pparams.ToArray (typeof(string))); retry = false; } catch (Exception ex) { @@ -1052,7 +1064,8 @@ namespace Mono.Addins.Database public void ParseAddin (IProgressStatus progressStatus, string domain, string file, string outFile, bool inProcess) { if (!inProcess) { - SetupProcess.ExecuteCommand (progressStatus, registry.RegistryPath, registry.StartupDirectory, "get-desc", Path.GetFullPath (file), outFile); + ISetupHandler setup = GetSetupHandler (); + setup.GetAddinDescription (progressStatus, registry.RegistryPath, registry.StartupDirectory, Path.GetFullPath (file), outFile); return; } @@ -1328,6 +1341,14 @@ namespace Mono.Addins.Database return false; } + ISetupHandler GetSetupHandler () + { +/* if (Util.IsMono) + return new SetupProcess (); + else +*/ return new SetupDomain (); + } + public void ResetConfiguration () { if (File.Exists (ConfigFile)) diff --git a/Mono.Addins/Mono.Addins.Database/AddinScanner.cs b/Mono.Addins/Mono.Addins.Database/AddinScanner.cs index f4964e6..20e9511 100644 --- a/Mono.Addins/Mono.Addins.Database/AddinScanner.cs +++ b/Mono.Addins/Mono.Addins.Database/AddinScanner.cs @@ -518,7 +518,7 @@ namespace Mono.Addins.Database string basePath = Path.GetDirectoryName (filePath); config = AddinDescription.Read (filePath); - config.BasePath = basePath; + config.SetBasePath (basePath); config.AddinFile = filePath; return ScanDescription (monitor, config, null, scanResult); @@ -563,7 +563,7 @@ namespace Mono.Addins.Database config = new AddinDescription (); } - config.BasePath = Path.GetDirectoryName (filePath); + config.SetBasePath (Path.GetDirectoryName (filePath)); config.AddinFile = filePath; string rasmFile = Path.GetFileName (filePath); diff --git a/Mono.Addins/Mono.Addins.Database/ISetupHandler.cs b/Mono.Addins/Mono.Addins.Database/ISetupHandler.cs new file mode 100644 index 0000000..1f7e161 --- /dev/null +++ b/Mono.Addins/Mono.Addins.Database/ISetupHandler.cs @@ -0,0 +1,36 @@ +// +// ISetupHandler.cs +// +// Author: +// Lluis Sanchez Gual <lluis@novell.com> +// +// Copyright (c) 2009 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; + +namespace Mono.Addins.Database +{ + internal interface ISetupHandler + { + void Scan (IProgressStatus monitor, string registryPath, string startupDir, string scanFolder, string[] filesToIgnore); + void GetAddinDescription (IProgressStatus monitor, string registryPath, string startupDir, string file, string outFile); + } +} diff --git a/Mono.Addins/Mono.Addins.Database/SetupDomain.cs b/Mono.Addins/Mono.Addins.Database/SetupDomain.cs new file mode 100644 index 0000000..adeee48 --- /dev/null +++ b/Mono.Addins/Mono.Addins.Database/SetupDomain.cs @@ -0,0 +1,180 @@ +// http://bugzilla.novell.com/enter_bug.cgi?alias=&assigned_to=&blocked=&bug_file_loc=http%3A%2F%2F&bug_severity=Normal&bug_status=NEW&cf_foundby=---&cf_nts_priority=&cf_nts_support_num=&cf_partnerid=&comment=Description%20of%20Problem%3A%0D%0A%0D%0A%0D%0ASteps%20to%20reproduce%20the%20problem%3A%0D%0A1.%20%0D%0A2.%20%0D%0A%0D%0A%0D%0AActual%20Results%3A%0D%0A%0D%0A%0D%0AExpected%20Results%3A%0D%0A%0D%0A%0D%0AHow%20often%20does%20this%20happen%3F%20%0D%0A%0D%0A%0D%0AAdditional%20Information%3A%0D%0A%0D%0A%0D%0A&component=&contenttypeentry=&contenttypemethod=autodetect&contenttypeselection=text%2Fplain&data=&deadline=&dependson=&description=&estimated_time=0.0&flag_type-2=X&form_name=enter_bug&keywords=&maketemplate=Remember%20values%20as%20bookmarkable%20template&op_sys=Other&priority=P5%20-%20None&product=MonoDevelop%20&qa_contact=&rep_platform=Other&short_desc=&version=unspecified +// SetupDomain.cs +// +// Author: +// Lluis Sanchez Gual <lluis@novell.com> +// +// Copyright (c) 2009 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.Specialized; + +namespace Mono.Addins.Database +{ + class SetupDomain: ISetupHandler + { + AppDomain domain; + RemoteSetupDomain remoteSetupDomain; + int useCount; + + public void Scan (IProgressStatus monitor, string registryPath, string startupDir, string scanFolder, string[] filesToIgnore) + { + RemoteProgressStatus remMonitor = new RemoteProgressStatus (monitor); + try { + RemoteSetupDomain rsd = GetDomain (); + rsd.Scan (remMonitor, registryPath, startupDir, scanFolder, filesToIgnore); + } catch (Exception ex) { + throw new ProcessFailedException (remMonitor.ProgessLog, ex); + } finally { + System.Runtime.Remoting.RemotingServices.Disconnect (remMonitor); + ReleaseDomain (); + } + } + + public void GetAddinDescription (IProgressStatus monitor, string registryPath, string startupDir, string file, string outFile) + { + RemoteProgressStatus remMonitor = new RemoteProgressStatus (monitor); + try { + RemoteSetupDomain rsd = GetDomain (); + rsd.GetAddinDescription (remMonitor, registryPath, startupDir, file, outFile); + } catch (Exception ex) { + throw new ProcessFailedException (remMonitor.ProgessLog, ex); + } finally { + System.Runtime.Remoting.RemotingServices.Disconnect (remMonitor); + ReleaseDomain (); + } + } + + RemoteSetupDomain GetDomain () + { + lock (this) { + if (useCount++ == 0) { + domain = AppDomain.CreateDomain ("SetupDomain"); + remoteSetupDomain = (RemoteSetupDomain) domain.CreateInstanceFromAndUnwrap (typeof(RemoteSetupDomain).Assembly.Location, typeof(RemoteSetupDomain).FullName); + } + return remoteSetupDomain; + } + } + + void ReleaseDomain () + { + lock (this) { + if (--useCount == 0) { + AppDomain.Unload (domain); + domain = null; + remoteSetupDomain = null; + } + } + } + } + + class RemoteSetupDomain: MarshalByRefObject + { + public override object InitializeLifetimeService () + { + return null; + } + + public void Scan (IProgressStatus monitor, string registryPath, string startupDir, string scanFolder, string[] filesToIgnore) + { + Console.WriteLine ("pp SCAN: " + AppDomain.CurrentDomain.FriendlyName); + AddinDatabase.RunningSetupProcess = true; + AddinRegistry reg = new AddinRegistry (registryPath, startupDir); + StringCollection files = new StringCollection (); + for (int n=3; n<filesToIgnore.Length; n++) + files.Add (filesToIgnore[n]); + reg.ScanFolders (monitor, scanFolder, files); + } + + public void GetAddinDescription (IProgressStatus monitor, string registryPath, string startupDir, string file, string outFile) + { + Console.WriteLine ("pp GETDESC: " + AppDomain.CurrentDomain.FriendlyName); + AddinDatabase.RunningSetupProcess = true; + AddinRegistry reg = new AddinRegistry (registryPath, startupDir); + reg.ParseAddin (monitor, file, outFile); + } + } + + class RemoteProgressStatus: MarshalByRefObject, IProgressStatus + { + IProgressStatus local; + StringCollection progessLog = new StringCollection (); + + public RemoteProgressStatus (IProgressStatus local) + { + this.local = local; + } + + public StringCollection ProgessLog { + get { return progessLog; } + } + + public override object InitializeLifetimeService () + { + return null; + } + + public void SetMessage (string msg) + { + local.SetMessage (msg); + } + + public void SetProgress (double progress) + { + local.SetProgress (progress); + } + + public void Log (string msg) + { + if (msg.StartsWith ("plog:")) + progessLog.Add (msg.Substring (5)); + else + local.Log (msg); + } + + public void ReportWarning (string message) + { + local.ReportWarning (message); + } + + public void ReportError (string message, Exception exception) + { + local.ReportError (message, exception); + } + + public void Cancel () + { + local.Cancel (); + } + + public int LogLevel { + get { + return local.LogLevel; + } + } + + public bool IsCanceled { + get { + return local.IsCanceled; + } + } + } +} diff --git a/Mono.Addins/Mono.Addins.Database/SetupProcess.cs b/Mono.Addins/Mono.Addins.Database/SetupProcess.cs index 9a4934b..cb522a9 100644 --- a/Mono.Addins/Mono.Addins.Database/SetupProcess.cs +++ b/Mono.Addins/Mono.Addins.Database/SetupProcess.cs @@ -36,9 +36,19 @@ using System.Runtime.Serialization.Formatters.Binary; namespace Mono.Addins.Database { - internal class SetupProcess + internal class SetupProcess: ISetupHandler { - internal static void ExecuteCommand (IProgressStatus monitor, string registryPath, string startupDir, string name, params string[] args) + public void Scan (IProgressStatus monitor, string registryPath, string startupDir, string scanFolder, string[] filesToIgnore) + { + ExecuteCommand (monitor, registryPath, startupDir, "scan", scanFolder, filesToIgnore); + } + + public void GetAddinDescription (IProgressStatus monitor, string registryPath, string startupDir, string file, string outFile) + { + ExecuteCommand (monitor, registryPath, startupDir, "get-desc", file, outFile); + } + + internal static void ExecuteCommand (IProgressStatus monitor, string registryPath, string startupDir, string name, string arg1, params string[] args) { string asm = new Uri (typeof(SetupProcess).Assembly.CodeBase).LocalPath; string verboseParam = monitor.LogLevel.ToString (); @@ -46,11 +56,12 @@ namespace Mono.Addins.Database // Arguments string StringBuilder sb = new StringBuilder (); sb.Append (verboseParam).Append (' ').Append (name); + sb.Append (" \"").Append (arg1).Append ("\""); foreach (string arg in args) sb.Append (" \"").Append (arg).Append ("\""); Process process = new Process (); - if (Util.IsWindows) + if (!Util.IsMono) process.StartInfo = new ProcessStartInfo (asm, sb.ToString ()); else { asm = asm.Replace(" ", @"\ "); @@ -120,7 +131,11 @@ namespace Mono.Addins.Database { StringCollection progessLog; - public ProcessFailedException (StringCollection progessLog) + public ProcessFailedException (StringCollection progessLog): this (progessLog, null) + { + } + + public ProcessFailedException (StringCollection progessLog, Exception ex): base ("Setup process failed.", ex) { this.progessLog = progessLog; } diff --git a/Mono.Addins/Mono.Addins.Database/Util.cs b/Mono.Addins/Mono.Addins.Database/Util.cs index 298e082..fdb5457 100644 --- a/Mono.Addins/Mono.Addins.Database/Util.cs +++ b/Mono.Addins/Mono.Addins.Database/Util.cs @@ -38,9 +38,35 @@ namespace Mono.Addins.Database { internal class Util { + static int isMono; + static string monoVersion; + public static bool IsWindows { get { return Path.DirectorySeparatorChar == '\\'; } } + + public static bool IsMono { + get { + if (isMono == 0) + isMono = Type.GetType ("Mono.Runtime") != null ? 1 : -1; + return isMono == 1; + } + } + + public static string MonoVersion { + get { + if (monoVersion == null) { + if (!IsMono) + throw new InvalidOperationException (); + MethodInfo mi = Type.GetType ("Mono.Runtime").GetMethod ("GetDisplayName", BindingFlags.NonPublic|BindingFlags.Static); + if (mi != null) + monoVersion = (string) mi.Invoke (null, null); + else + monoVersion = string.Empty; + } + return monoVersion; + } + } public static void CheckWrittableFloder (string path) { diff --git a/Mono.Addins/Mono.Addins.Description/AddinDescription.cs b/Mono.Addins/Mono.Addins.Description/AddinDescription.cs index 0643a19..e32afa0 100644 --- a/Mono.Addins/Mono.Addins.Description/AddinDescription.cs +++ b/Mono.Addins/Mono.Addins.Description/AddinDescription.cs @@ -63,7 +63,7 @@ namespace Mono.Addins.Description bool defaultEnabled = true; AddinFlags flags = AddinFlags.None; string domain; - + ModuleDescription mainModule; ModuleCollection optionalModules; ExtensionNodeSetCollection nodeSets; @@ -165,9 +165,13 @@ namespace Mono.Addins.Description set { category = value; } } - internal string BasePath { + public string BasePath { get { return basePath != null ? basePath : string.Empty; } - set { basePath = value; } + } + + internal void SetBasePath (string path) + { + basePath = path; } public bool IsRoot { diff --git a/Mono.Addins/Mono.Addins.csproj b/Mono.Addins/Mono.Addins.csproj index 4599990..a50c3b1 100644 --- a/Mono.Addins/Mono.Addins.csproj +++ b/Mono.Addins/Mono.Addins.csproj @@ -7,7 +7,7 @@ <ProjectGuid>{91DD5A2D-9FE3-4C3C-9253-876141874DAD}</ProjectGuid> <OutputType>Library</OutputType> <AssemblyName>Mono.Addins</AssemblyName> - <TargetFrameworkVersion>v1.1</TargetFrameworkVersion> + <SchemaVersion>2.0</SchemaVersion> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Default|AnyCPU' "> <DebugSymbols>true</DebugSymbols> @@ -111,6 +111,8 @@ <Compile Include="Mono.Addins.Database\IAssemblyReflector.cs" /> <Compile Include="Mono.Addins.Database\DefaultAssemblyReflector.cs" /> <Compile Include="Mono.Addins.Description\AddinFlags.cs" /> + <Compile Include="Mono.Addins.Database\SetupDomain.cs" /> + <Compile Include="Mono.Addins.Database\ISetupHandler.cs" /> </ItemGroup> <ItemGroup> <Content Include="Mono.Addins.dll.config"> @@ -123,8 +125,7 @@ <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> <ProjectExtensions> <MonoDevelop> - <Properties> - <GtkDesignInfo /> + <Properties InternalTargetFrameworkVersion="1.1"> <MonoDevelop.Autotools.MakefileInfo IntegrationEnabled="true" RelativeMakefileName="./Makefile.am" BuildTargetName="" CleanTargetName="" SyncReferences="true"> <BuildFilesVar Sync="true" Name="FILES" /> <DeployFilesVar Sync="true" Name="DATA_FILES" /> |