Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/monodevelop.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLluis Sanchez <lluis@novell.com>2007-04-19 15:40:10 +0400
committerLluis Sanchez <lluis@novell.com>2007-04-19 15:40:10 +0400
commit6fd87f77b412afcba83aa5eb711b50f63f723d01 (patch)
tree30d313858c2ac358dbd5e98c8d6b48ddaf590887 /Extras/MonoDevelop.Autotools/SolutionDeployer.cs
parent8593f55b1676d5f3e09a377e484273f380756429 (diff)
* MonoDevelop.Autotools.addin.xml, Commands.cs,
TarballTargetEditorWidget.cs: Track api changes in deployment api. * MonoDevelop.Autotools.mdp, gtk-gui/gui.stetic, Makefile.am: Added dependency to MonoDevelop.Deployment. * SolutionMakefileHandler.cs: Allow generating makefiles a combine even if it contains unsupported projects. Those will be ignored. * SimpleProjectMakefileHandler.cs, Handler.cs, SolutionDeployer.cs, templates/Makefile.include: Use the new deployment api to get the list of files to deploy. * FileNodeBuilderExtension.cs, MakefileData.cs: Moved makefile integration check to MakefileData. * AutotoolsContext.cs: Keep a list of directories to deploy. Store the DeployContext in a field. * PropertyProvider.cs: New property provider which allows setting the makefile integration flag for each file. * gtk-gui/objects.xml: Updated. svn path=/trunk/monodevelop/; revision=75929
Diffstat (limited to 'Extras/MonoDevelop.Autotools/SolutionDeployer.cs')
-rw-r--r--Extras/MonoDevelop.Autotools/SolutionDeployer.cs51
1 files changed, 39 insertions, 12 deletions
diff --git a/Extras/MonoDevelop.Autotools/SolutionDeployer.cs b/Extras/MonoDevelop.Autotools/SolutionDeployer.cs
index 4a25143912..c32e96b765 100644
--- a/Extras/MonoDevelop.Autotools/SolutionDeployer.cs
+++ b/Extras/MonoDevelop.Autotools/SolutionDeployer.cs
@@ -19,6 +19,7 @@
*/
using System;
+using System.Collections;
using System.IO;
using System.Text;
@@ -27,6 +28,7 @@ using MonoDevelop.Core;
using MonoDevelop.Core.Execution;
using MonoDevelop.Core.ProgressMonitoring;
using MonoDevelop.Projects.Serialization;
+using MonoDevelop.Deployment;
using Mono.Unix.Native;
@@ -54,20 +56,20 @@ namespace MonoDevelop.Autotools
public bool CanDeploy ( Combine combine )
{
IMakefileHandler handler = AutotoolsContext.GetMakefileHandler ( combine );
- if ( !handler.CanDeploy (combine) ) return false;
+ if ( handler == null || !handler.CanDeploy (combine) ) return false;
return true;
}
- public bool GenerateFiles (Combine combine, IProgressMonitor monitor )
+ public bool GenerateFiles (DeployContext ctx, Combine combine, IProgressMonitor monitor )
{
if (combine.ActiveConfiguration != null)
- return GenerateFiles ( combine, combine.ActiveConfiguration.Name, monitor );
+ return GenerateFiles ( ctx, combine, combine.ActiveConfiguration.Name, monitor );
else
// Indicate with a null argument that there is no active configuration
- return GenerateFiles ( combine, null, monitor );
+ return GenerateFiles ( ctx, combine, null, monitor );
}
- public bool GenerateFiles (Combine combine, string defaultConf, IProgressMonitor monitor )
+ public bool GenerateFiles (DeployContext ctx, Combine combine, string defaultConf, IProgressMonitor monitor )
{
monitor.BeginTask ( GettextCatalog.GetString ("Generating Autotools files for Solution {0}", combine.Name), 1 );
@@ -79,10 +81,10 @@ namespace MonoDevelop.Autotools
for (int ii=0; ii < configs.Length; ii++ )
configs [ii] = combine.Configurations[ii].Name;
- context = new AutotoolsContext ( solution_dir, configs );
+ context = new AutotoolsContext ( ctx, solution_dir, configs );
IMakefileHandler handler = AutotoolsContext.GetMakefileHandler ( combine );
- if ( !handler.CanDeploy (combine) )
+ if ( handler == null || !handler.CanDeploy (combine) )
throw new Exception ( GettextCatalog.GetString ("MonoDevelop does not currently support generating autotools files for one (or more) child projects.") );
solution_name = combine.Name;
@@ -124,14 +126,14 @@ namespace MonoDevelop.Autotools
return true;
}
- public void Deploy ( Combine combine, string targetDir, IProgressMonitor monitor )
+ public void Deploy ( DeployContext ctx, Combine combine, string targetDir, IProgressMonitor monitor )
{
- Deploy ( combine, combine.ActiveConfiguration.Name, targetDir, monitor );
+ Deploy ( ctx, combine, combine.ActiveConfiguration.Name, targetDir, monitor );
}
- public void Deploy ( Combine combine, string defaultConf, string targetDir, IProgressMonitor monitor )
+ public void Deploy ( DeployContext ctx, Combine combine, string defaultConf, string targetDir, IProgressMonitor monitor )
{
- if ( !GenerateFiles ( combine, defaultConf, monitor ) ) return;
+ if ( !GenerateFiles ( ctx, combine, defaultConf, monitor ) ) return;
monitor.BeginTask ( GettextCatalog.GetString( "Deploying Solution to Tarball" ) , 3 );
try
@@ -391,6 +393,31 @@ namespace MonoDevelop.Autotools
void CreateMakefileInclude (IProgressMonitor monitor)
{
monitor.Log.WriteLine ( GettextCatalog.GetString ("Creating Makefile.include") );
+
+ TemplateEngine templateEngine = new TemplateEngine();
+
+ StringBuilder deployDirs = new StringBuilder ();
+ IDictionary dirs = context.GetReferencedTargetDirectories ();
+ foreach (DictionaryEntry e in dirs) {
+ // It may be a sub-path
+ string dir = (string) e.Key;
+ int i = dir.IndexOf ('/');
+ if (i != -1)
+ dir = dir.Substring (0, i);
+ string resolved = context.DeployContext.GetDirectory (dir);
+ if (resolved == null)
+ throw new InvalidOperationException ("Unknown directory: " + e.Key);
+
+ if (i != -1)
+ resolved += ((string)e.Key).Substring (i);
+
+ string var = (string) e.Value;
+ string dname = var.ToLower ().Replace ("_","");
+ deployDirs.AppendFormat ("{0}dir = {1}\n", dname, resolved);
+ deployDirs.AppendFormat ("{0}_DATA = $({1})\n", dname, var);
+ }
+
+ templateEngine.Variables["DEPLOY_DIRS"] = deployDirs.ToString();
string fileName = solution_dir + "/Makefile.include";
@@ -399,7 +426,7 @@ namespace MonoDevelop.Autotools
StreamReader reader = new StreamReader(stream);
StreamWriter writer = new StreamWriter(fileName);
- writer.Write(reader.ReadToEnd());
+ templateEngine.Process(reader, writer);
reader.Close();
writer.Close();