Author: mhutch
Date: 2007-09-19 18:46:24 -0400 (Wed, 19 Sep 2007)
New Revision: 86050

Modified:
   trunk/monodevelop/Core/src/MonoDevelop.Projects/ChangeLog
   
trunk/monodevelop/Core/src/MonoDevelop.Projects/MonoDevelop.Projects/CustomCommand.cs
Log:
* MonoDevelop.Projects/CustomCommand.cs: Implement custom substitution
  tag array for custom commands so that the tags are for the project
  being compiled rather than the project selected in the IDE. Bonus
  is that it no longer depends on the tags provider in
  MonoDevelop.Ide.

Modified: trunk/monodevelop/Core/src/MonoDevelop.Projects/ChangeLog
===================================================================
--- trunk/monodevelop/Core/src/MonoDevelop.Projects/ChangeLog   2007-09-19 
22:42:41 UTC (rev 86049)
+++ trunk/monodevelop/Core/src/MonoDevelop.Projects/ChangeLog   2007-09-19 
22:46:24 UTC (rev 86050)
@@ -1,3 +1,10 @@
+2007-09-19  Michael Hutchinson <[EMAIL PROTECTED]> 
+
+       * MonoDevelop.Projects/CustomCommand.cs: Implement custom substitution 
tag
+         array for custom commands so that the tags are for the project being
+         compiled rather than the project selected in the IDE. Bonus is that it
+         no longer depends on the tags provider in MonoDevelop.Ide.
+
 2007-09-15  Jérémie Laval <[EMAIL PROTECTED]>
 
        * MonoDevelop.Projects.Parser/ICompilationUnitBase.cs:

Modified: 
trunk/monodevelop/Core/src/MonoDevelop.Projects/MonoDevelop.Projects/CustomCommand.cs
===================================================================
--- 
trunk/monodevelop/Core/src/MonoDevelop.Projects/MonoDevelop.Projects/CustomCommand.cs
       2007-09-19 22:42:41 UTC (rev 86049)
+++ 
trunk/monodevelop/Core/src/MonoDevelop.Projects/MonoDevelop.Projects/CustomCommand.cs
       2007-09-19 22:46:24 UTC (rev 86050)
@@ -75,7 +75,25 @@
                }
                
                public void Execute (IProgressMonitor monitor, CombineEntry 
entry, ExecutionContext context)
-               {                       
+               {
+                       string [,] customtags = null;
+                       
+                       Project project = entry as Project;
+                       if (project != null) {
+                               string outputname = project.GetOutputFileName();
+                               customtags = new string [,] {
+                                       {"ProjectDir", entry.BaseDirectory},
+                                       {"TargetName", Path.GetFileName 
(outputname)},
+                                       {"TargetDir", Path.GetDirectoryName 
(outputname)},
+                                       {"CombineDir", 
entry.RootCombine.BaseDirectory},
+                               };
+                       } else {
+                               customtags = new string [,] {
+                                       {"ProjectDir", entry.BaseDirectory},
+                                       {"CombineDir", 
entry.RootCombine.BaseDirectory},
+                               };
+                       }
+                       
                        int i = command.IndexOf (' ');
                        string exe;
                        string args = string.Empty;
@@ -84,12 +102,12 @@
                                args = string.Empty;
                        } else {
                                exe = command.Substring (0, i);
-                               args = Runtime.StringParserService.Parse 
(command.Substring (i + 1));
+                               args = Runtime.StringParserService.Parse 
(command.Substring (i + 1), customtags);
                        }
                        
                        monitor.Log.WriteLine (GettextCatalog.GetString 
("Executing: {0} {1}", exe, args));
 
-                       string dir = (string.IsNullOrEmpty (workingdir) ? 
entry.BaseDirectory : Runtime.StringParserService.Parse (workingdir));
+                       string dir = (string.IsNullOrEmpty (workingdir) ? 
entry.BaseDirectory : Runtime.StringParserService.Parse (workingdir, 
customtags));
                        
                        string localPath = Path.Combine (entry.BaseDirectory, 
exe);
                        if (File.Exists (localPath))

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

Reply via email to