Author: lluis
Date: 2007-04-27 13:32:52 -0400 (Fri, 27 Apr 2007)
New Revision: 76395

Added:
   
trunk/monodevelop/Extras/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment/DeployProjectServiceExtension.cs
Modified:
   trunk/monodevelop/Extras/Deployment/MonoDevelop.Deployment/ChangeLog
   trunk/monodevelop/Extras/Deployment/MonoDevelop.Deployment/Makefile.am
   
trunk/monodevelop/Extras/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment.addin.xml
   
trunk/monodevelop/Extras/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment.mdp
   
trunk/monodevelop/Extras/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment/DefaultDeployServiceExtension.cs
   
trunk/monodevelop/Extras/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment/DeployService.cs
Log:
* MonoDevelop.Deployment.addin.xml, MonoDevelop.Deployment.mdp,
  MonoDevelop.Deployment/DeployService.cs,
  MonoDevelop.Deployment/DeployProjectServiceExtension.cs,
  Makefile.am: After building a project, copy to the output directory
  all files marked with the deploy flag.
* MonoDevelop.Deployment/DefaultDeployServiceExtension.cs: Rename
  app.config files to <assembly-name>.config when deploying.

Modified: trunk/monodevelop/Extras/Deployment/MonoDevelop.Deployment/ChangeLog
===================================================================
--- trunk/monodevelop/Extras/Deployment/MonoDevelop.Deployment/ChangeLog        
2007-04-27 17:30:21 UTC (rev 76394)
+++ trunk/monodevelop/Extras/Deployment/MonoDevelop.Deployment/ChangeLog        
2007-04-27 17:32:52 UTC (rev 76395)
@@ -1,3 +1,13 @@
+2007-04-27  Lluis Sanchez Gual <[EMAIL PROTECTED]> 
+
+       * MonoDevelop.Deployment.addin.xml, MonoDevelop.Deployment.mdp,
+         MonoDevelop.Deployment/DeployService.cs,
+         MonoDevelop.Deployment/DeployProjectServiceExtension.cs,
+         Makefile.am: After building a project, copy to the output directory
+         all files marked with the deploy flag.
+       * MonoDevelop.Deployment/DefaultDeployServiceExtension.cs: Rename
+         app.config files to <assembly-name>.config when deploying.
+
 2007-04-26  Lluis Sanchez Gual <[EMAIL PROTECTED]> 
 
        * MonoDevelop.Deployment/PackageBuilder.cs: Avoid including duplicated

Modified: trunk/monodevelop/Extras/Deployment/MonoDevelop.Deployment/Makefile.am
===================================================================
--- trunk/monodevelop/Extras/Deployment/MonoDevelop.Deployment/Makefile.am      
2007-04-27 17:30:21 UTC (rev 76394)
+++ trunk/monodevelop/Extras/Deployment/MonoDevelop.Deployment/Makefile.am      
2007-04-27 17:32:52 UTC (rev 76395)
@@ -67,6 +67,7 @@
        MonoDevelop.Deployment/DeployFile.cs \
        MonoDevelop.Deployment/DeployPlatformInfo.cs \
        MonoDevelop.Deployment/DeployPlatformNodeType.cs \
+       MonoDevelop.Deployment/DeployProjectServiceExtension.cs \
        MonoDevelop.Deployment/DeployProperties.cs \
        MonoDevelop.Deployment/DeployService.cs \
        MonoDevelop.Deployment/DeployServiceExtension.cs \

Modified: 
trunk/monodevelop/Extras/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment/DefaultDeployServiceExtension.cs
===================================================================
--- 
trunk/monodevelop/Extras/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment/DefaultDeployServiceExtension.cs
  2007-04-27 17:30:21 UTC (rev 76394)
+++ 
trunk/monodevelop/Extras/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment/DefaultDeployServiceExtension.cs
  2007-04-27 17:32:52 UTC (rev 76395)
@@ -29,8 +29,15 @@
                        // Collect deployable files
                        
                        foreach (ProjectFile file in project.ProjectFiles) {
-                               if (file.BuildAction == BuildAction.FileCopy)
-                                       deployFiles.Add (new DeployFile (file));
+                               if (file.BuildAction == BuildAction.FileCopy) {
+                                       DeployFile dp = new DeployFile (file);
+                                       deployFiles.Add (dp);
+                                       
+                                       if (Path.GetFileName (dp.SourcePath) == 
"app.config" && Path.GetFileName (dp.RelativeTargetPath) == "app.config") {
+                                               string newName = 
Path.GetFileName (outputFile) + ".config";
+                                               dp.RelativeTargetPath = 
Path.Combine (Path.GetDirectoryName (dp.RelativeTargetPath), newName);
+                                       }
+                               }
                        }
 
                        // Collect referenced assemblies

Added: 
trunk/monodevelop/Extras/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment/DeployProjectServiceExtension.cs
===================================================================
--- 
trunk/monodevelop/Extras/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment/DeployProjectServiceExtension.cs
  2007-04-27 17:30:21 UTC (rev 76394)
+++ 
trunk/monodevelop/Extras/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment/DeployProjectServiceExtension.cs
  2007-04-27 17:32:52 UTC (rev 76395)
@@ -0,0 +1,80 @@
+
+using System;
+using System.IO;
+using MonoDevelop.Projects;
+using MonoDevelop.Core;
+
+namespace MonoDevelop.Deployment
+{
+       class DeployProjectServiceExtension: ProjectServiceExtension, 
IDirectoryResolver
+       {
+               public override ICompilerResult Build (IProgressMonitor 
monitor, CombineEntry entry)
+               {
+                       ICompilerResult res = base.Build (monitor, entry);
+                       Project project = entry as Project;
+                       if (project == null)
+                               return res;
+                       
+                       string outfile = project.GetOutputFileName ();
+                       if (string.IsNullOrEmpty (outfile))
+                               return res;
+                       
+                       outfile = Runtime.FileService.GetFullPath (outfile);
+                       
+                       // Copy deploy files with ProgramFiles as target 
directory
+                       
+                       using (DeployContext ctx = new DeployContext (this, 
DeployService.CurrentPlatform, Path.GetDirectoryName (outfile))) {
+                               DeployFileCollection files = 
DeployService.GetDeployFiles (ctx, entry);
+                               
+                               foreach (DeployFile file in files) {
+                                       if (Runtime.FileService.GetFullPath 
(file.SourcePath) == outfile)
+                                               continue;
+                                       
+                                       if (file.TargetDirectoryID == 
TargetDirectory.ProgramFiles) {
+                                               if (!File.Exists 
(file.SourcePath)) {
+                                                       res.AddError 
(GettextCatalog.GetString ("File '{0}' not found", file.SourcePath));
+                                                       continue;
+                                               }
+                                               string tfile = 
file.ResolvedTargetFile;
+                                               string tpath = 
Path.GetDirectoryName (tfile);
+                                               if (!Directory.Exists (tpath))
+                                                       
Directory.CreateDirectory (tpath);
+                                               File.Copy (file.SourcePath, 
tfile, true);
+                                       }
+                               }
+                       }
+                       return res;
+               }
+       
+               public override void Clean (IProgressMonitor monitor, 
CombineEntry entry)
+               {
+                       base.Clean (monitor, entry);
+                       Project project = entry as Project;
+                       if (project == null)
+                               return;
+                       
+                       string path = project.GetOutputFileName ();
+                       if (string.IsNullOrEmpty (path))
+                               return;
+                       
+                       path = Path.GetDirectoryName (path);
+                       
+                       using (DeployContext ctx = new DeployContext (this, 
DeployService.CurrentPlatform, path)) {
+                               DeployFileCollection files = 
DeployService.GetDeployFiles (ctx, entry);
+                               foreach (DeployFile file in files) {
+                                       if (file.TargetDirectoryID == 
TargetDirectory.ProgramFiles) {
+                                               string tfile = 
file.ResolvedTargetFile;
+                                               if (File.Exists (tfile))
+                                                       File.Delete (tfile);
+                                       }
+                               }
+                       }
+               }
+               
+               public string GetDirectory (DeployContext context, string 
folderId)
+               {
+                       return context.Prefix;
+               }
+
+       }
+}

Modified: 
trunk/monodevelop/Extras/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment/DeployService.cs
===================================================================
--- 
trunk/monodevelop/Extras/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment/DeployService.cs
  2007-04-27 17:30:21 UTC (rev 76394)
+++ 
trunk/monodevelop/Extras/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment/DeployService.cs
  2007-04-27 17:32:52 UTC (rev 76395)
@@ -61,6 +61,10 @@
                        };
                }
                
+               public static string CurrentPlatform {
+                       get { return "Linux"; }
+               }
+               
                public static DeployProperties GetDeployProperties (ProjectFile 
file)
                {
                        DeployProperties props = (DeployProperties) 
file.ExtendedProperties [typeof(DeployProperties)];
@@ -167,7 +171,7 @@
                        return col;
                }
                
-               static DeployFileCollection GetDeployFiles (DeployContext ctx, 
CombineEntry entry)
+               public static DeployFileCollection GetDeployFiles 
(DeployContext ctx, CombineEntry entry)
                {
                        ArrayList todel = new ArrayList ();
                        

Modified: 
trunk/monodevelop/Extras/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment.addin.xml
===================================================================
--- 
trunk/monodevelop/Extras/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment.addin.xml
 2007-04-27 17:30:21 UTC (rev 76394)
+++ 
trunk/monodevelop/Extras/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment.addin.xml
 2007-04-27 17:32:52 UTC (rev 76395)
@@ -125,6 +125,10 @@
                <DialogPanel id = "Deployment" _label = "Deployment" />
        </Extension>
 
+       <Extension path = "/SharpDevelop/Workbench/ProjectServiceExtensions">
+               <Class class = 
"MonoDevelop.Deployment.DeployProjectServiceExtension" 
insertbefore="FinalStep"/>
+       </Extension>
+       
        <Extension path = "/MonoDevelop/Deployment/DeployDirectories" 
extension-nodes="DeployDirectory">
                <DeployDirectory id="ProgramFiles" _label="Program files" />
                <DeployDirectory id="ProgramFilesRoot" _label="Program files 
root folder" />

Modified: 
trunk/monodevelop/Extras/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment.mdp
===================================================================
--- 
trunk/monodevelop/Extras/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment.mdp
       2007-04-27 17:30:21 UTC (rev 76394)
+++ 
trunk/monodevelop/Extras/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment.mdp
       2007-04-27 17:32:52 UTC (rev 76395)
@@ -89,6 +89,7 @@
     <File name="./gtk-gui/MonoDevelop.Deployment.DeployFileListWidget.cs" 
subtype="Code" buildaction="Compile" />
     <File 
name="./gtk-gui/MonoDevelop.Deployment.Gui.PackagingFeatureWidget.cs" 
subtype="Code" buildaction="Compile" />
     <File name="./MonoDevelop.Deployment.Gui/BinariesZipEditorWidget.cs" 
subtype="Code" buildaction="Compile" />
+    <File name="./MonoDevelop.Deployment/DeployProjectServiceExtension.cs" 
subtype="Code" buildaction="Compile" />
   </Contents>
   <References>
     <ProjectReference type="Gac" localcopy="True" refto="System, 
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />

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

Reply via email to