aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Prebuild/src
diff options
context:
space:
mode:
authorlbsa712009-02-19 14:16:22 +0000
committerlbsa712009-02-19 14:16:22 +0000
commite36c452d4e891073768fd70915a65531f806f831 (patch)
tree40f7ec86c6813a7221f39f4e4483f81337b13158 /Prebuild/src
parent* Ignored some bins (diff)
downloadopensim-SC_OLD-e36c452d4e891073768fd70915a65531f806f831.zip
opensim-SC_OLD-e36c452d4e891073768fd70915a65531f806f831.tar.gz
opensim-SC_OLD-e36c452d4e891073768fd70915a65531f806f831.tar.bz2
opensim-SC_OLD-e36c452d4e891073768fd70915a65531f806f831.tar.xz
* Reverted Prebuild commit due to strange run-time errors.
Diffstat (limited to 'Prebuild/src')
-rw-r--r--Prebuild/src/Core/Attributes/DataNodeAttribute.cs11
-rw-r--r--Prebuild/src/Core/Attributes/OptionNodeAttribute.cs9
-rw-r--r--Prebuild/src/Core/Attributes/TargetAttribute.cs9
-rw-r--r--Prebuild/src/Core/FatalException.cs9
-rw-r--r--Prebuild/src/Core/Interfaces/IDataNode.cs9
-rw-r--r--Prebuild/src/Core/Interfaces/ITarget.cs9
-rw-r--r--Prebuild/src/Core/Kernel.cs149
-rw-r--r--Prebuild/src/Core/Nodes/AuthorNode.cs9
-rw-r--r--Prebuild/src/Core/Nodes/ConfigurationNode.cs9
-rw-r--r--Prebuild/src/Core/Nodes/DataNode.cs59
-rw-r--r--Prebuild/src/Core/Nodes/DatabaseProjectNode.cs94
-rw-r--r--Prebuild/src/Core/Nodes/DatabaseReferenceNode.cs63
-rw-r--r--Prebuild/src/Core/Nodes/DescriptionNode.cs9
-rw-r--r--Prebuild/src/Core/Nodes/ExcludeNode.cs9
-rw-r--r--Prebuild/src/Core/Nodes/FileNode.cs42
-rw-r--r--Prebuild/src/Core/Nodes/FilesNode.cs14
-rw-r--r--Prebuild/src/Core/Nodes/MatchNode.cs51
-rw-r--r--Prebuild/src/Core/Nodes/OptionsNode.cs11
-rw-r--r--Prebuild/src/Core/Nodes/ProcessNode.cs9
-rw-r--r--Prebuild/src/Core/Nodes/ProjectNode.cs169
-rw-r--r--Prebuild/src/Core/Nodes/ReferenceNode.cs9
-rw-r--r--Prebuild/src/Core/Nodes/ReferencePathNode.cs9
-rw-r--r--Prebuild/src/Core/Nodes/SolutionNode.cs120
-rw-r--r--Prebuild/src/Core/Parse/IfContext.cs9
-rw-r--r--Prebuild/src/Core/Parse/Preprocessor.cs272
-rw-r--r--Prebuild/src/Core/Targets/AutotoolsTarget.cs112
-rw-r--r--Prebuild/src/Core/Targets/DebugTarget.cs2
-rw-r--r--Prebuild/src/Core/Targets/MonoDevelopTarget.cs9
-rw-r--r--Prebuild/src/Core/Targets/NAntTarget.cs859
-rw-r--r--Prebuild/src/Core/Targets/SharpDevelop2Target.cs33
-rw-r--r--Prebuild/src/Core/Targets/SharpDevelopTarget.cs9
-rw-r--r--Prebuild/src/Core/Targets/ToolInfo.cs197
-rw-r--r--Prebuild/src/Core/Targets/VS2002Target.cs9
-rw-r--r--Prebuild/src/Core/Targets/VS2003Target.cs31
-rw-r--r--Prebuild/src/Core/Targets/VS2005Target.cs837
-rw-r--r--Prebuild/src/Core/Targets/VS2008Target.cs152
-rw-r--r--Prebuild/src/Core/Targets/VSGenericTarget.cs881
-rw-r--r--Prebuild/src/Core/Targets/VSVersion.cs50
-rw-r--r--Prebuild/src/Core/Targets/XcodeTarget.cs9
-rw-r--r--Prebuild/src/Core/Utilities/CommandLineCollection.cs9
-rw-r--r--Prebuild/src/Core/Utilities/CurrentDirectory.cs9
-rw-r--r--Prebuild/src/Core/Utilities/Helper.cs25
-rw-r--r--Prebuild/src/Core/Utilities/Log.cs9
-rw-r--r--Prebuild/src/Prebuild.cs2
-rw-r--r--Prebuild/src/Properties/AssemblyInfo.cs11
-rw-r--r--Prebuild/src/data/prebuild-1.7.xsd120
46 files changed, 2008 insertions, 2539 deletions
diff --git a/Prebuild/src/Core/Attributes/DataNodeAttribute.cs b/Prebuild/src/Core/Attributes/DataNodeAttribute.cs
index f1938a2..cdd0e0d 100644
--- a/Prebuild/src/Core/Attributes/DataNodeAttribute.cs
+++ b/Prebuild/src/Core/Attributes/DataNodeAttribute.cs
@@ -23,6 +23,15 @@ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY O
23*/ 23*/
24#endregion 24#endregion
25 25
26#region CVS Information
27/*
28 * $Source$
29 * $Author: jendave $
30 * $Date: 2006-01-28 09:49:58 +0900 (Sat, 28 Jan 2006) $
31 * $Revision: 71 $
32 */
33#endregion
34
26using System; 35using System;
27using System.Collections.Specialized; 36using System.Collections.Specialized;
28 37
@@ -31,7 +40,7 @@ namespace Prebuild.Core.Attributes
31 /// <summary> 40 /// <summary>
32 /// 41 ///
33 /// </summary> 42 /// </summary>
34 [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct, AllowMultiple=true)] 43 [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct)]
35 public sealed class DataNodeAttribute : Attribute 44 public sealed class DataNodeAttribute : Attribute
36 { 45 {
37 #region Fields 46 #region Fields
diff --git a/Prebuild/src/Core/Attributes/OptionNodeAttribute.cs b/Prebuild/src/Core/Attributes/OptionNodeAttribute.cs
index 2d6a6a7..5cefe68 100644
--- a/Prebuild/src/Core/Attributes/OptionNodeAttribute.cs
+++ b/Prebuild/src/Core/Attributes/OptionNodeAttribute.cs
@@ -23,6 +23,15 @@ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY O
23*/ 23*/
24#endregion 24#endregion
25 25
26#region CVS Information
27/*
28 * $Source$
29 * $Author: jendave $
30 * $Date: 2006-01-28 09:49:58 +0900 (Sat, 28 Jan 2006) $
31 * $Revision: 71 $
32 */
33#endregion
34
26using System; 35using System;
27 36
28namespace Prebuild.Core.Attributes 37namespace Prebuild.Core.Attributes
diff --git a/Prebuild/src/Core/Attributes/TargetAttribute.cs b/Prebuild/src/Core/Attributes/TargetAttribute.cs
index 5ad62ee..b17cc5b 100644
--- a/Prebuild/src/Core/Attributes/TargetAttribute.cs
+++ b/Prebuild/src/Core/Attributes/TargetAttribute.cs
@@ -23,6 +23,15 @@ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY O
23*/ 23*/
24#endregion 24#endregion
25 25
26#region CVS Information
27/*
28 * $Source$
29 * $Author: jendave $
30 * $Date: 2006-01-28 09:49:58 +0900 (Sat, 28 Jan 2006) $
31 * $Revision: 71 $
32 */
33#endregion
34
26using System; 35using System;
27 36
28namespace Prebuild.Core.Attributes 37namespace Prebuild.Core.Attributes
diff --git a/Prebuild/src/Core/FatalException.cs b/Prebuild/src/Core/FatalException.cs
index 3487905..784c35d 100644
--- a/Prebuild/src/Core/FatalException.cs
+++ b/Prebuild/src/Core/FatalException.cs
@@ -23,6 +23,15 @@ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY O
23*/ 23*/
24#endregion 24#endregion
25 25
26#region CVS Information
27/*
28 * $Source$
29 * $Author: jendave $
30 * $Date: 2006-01-28 09:49:58 +0900 (Sat, 28 Jan 2006) $
31 * $Revision: 71 $
32 */
33#endregion
34
26using System; 35using System;
27using System.Runtime.Serialization; 36using System.Runtime.Serialization;
28 37
diff --git a/Prebuild/src/Core/Interfaces/IDataNode.cs b/Prebuild/src/Core/Interfaces/IDataNode.cs
index 986dd2d..7583fd2 100644
--- a/Prebuild/src/Core/Interfaces/IDataNode.cs
+++ b/Prebuild/src/Core/Interfaces/IDataNode.cs
@@ -23,6 +23,15 @@ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY O
23*/ 23*/
24#endregion 24#endregion
25 25
26#region CVS Information
27/*
28 * $Source$
29 * $Author: jendave $
30 * $Date: 2006-01-28 09:49:58 +0900 (Sat, 28 Jan 2006) $
31 * $Revision: 71 $
32 */
33#endregion
34
26using System; 35using System;
27using System.Xml; 36using System.Xml;
28 37
diff --git a/Prebuild/src/Core/Interfaces/ITarget.cs b/Prebuild/src/Core/Interfaces/ITarget.cs
index 47115c6..77006d7 100644
--- a/Prebuild/src/Core/Interfaces/ITarget.cs
+++ b/Prebuild/src/Core/Interfaces/ITarget.cs
@@ -23,6 +23,15 @@ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY O
23*/ 23*/
24#endregion 24#endregion
25 25
26#region CVS Information
27/*
28 * $Source$
29 * $Author: jendave $
30 * $Date: 2006-01-28 09:49:58 +0900 (Sat, 28 Jan 2006) $
31 * $Revision: 71 $
32 */
33#endregion
34
26using System; 35using System;
27 36
28namespace Prebuild.Core.Interfaces 37namespace Prebuild.Core.Interfaces
diff --git a/Prebuild/src/Core/Kernel.cs b/Prebuild/src/Core/Kernel.cs
index 95ef04e..1f0ad70 100644
--- a/Prebuild/src/Core/Kernel.cs
+++ b/Prebuild/src/Core/Kernel.cs
@@ -36,8 +36,16 @@ POSSIBILITY OF SUCH DAMAGE.
36*/ 36*/
37#endregion 37#endregion
38 38
39#region CVS Information
40/*
41 * $Source$
42 * $Author: cjcollier $
43 * $Date: 2008-02-08 01:31:29 +0900 (Fri, 08 Feb 2008) $
44 * $Revision: 256 $
45 */
46#endregion
47
39using System; 48using System;
40using System.Collections.Generic;
41using System.Diagnostics; 49using System.Diagnostics;
42using System.Collections; 50using System.Collections;
43using System.Collections.Specialized; 51using System.Collections.Specialized;
@@ -72,17 +80,17 @@ namespace Prebuild.Core
72 80
73 #region Fields 81 #region Fields
74 82
75 private static readonly Kernel m_Instance = new Kernel(); 83 private static Kernel m_Instance = new Kernel();
76 84
77 /// <summary> 85 /// <summary>
78 /// This must match the version of the schema that is embeeded 86 /// This must match the version of the schema that is embeeded
79 /// </summary> 87 /// </summary>
80 private const string m_SchemaVersion = "1.7"; 88 private static string m_SchemaVersion = "1.7";
81 private const string m_Schema = "prebuild-" + m_SchemaVersion + ".xsd"; 89 private static string m_Schema = "prebuild-" + m_SchemaVersion + ".xsd";
82 private const string m_SchemaURI = "http://dnpb.sourceforge.net/schemas/" + m_Schema; 90 private static string m_SchemaURI = "http://dnpb.sourceforge.net/schemas/" + m_Schema;
83 bool disposed; 91 bool disposed;
84 private Version m_Version; 92 private Version m_Version;
85 private const string m_Revision = ""; 93 private string m_Revision = "";
86 private CommandLineCollection m_CommandLine; 94 private CommandLineCollection m_CommandLine;
87 private Log m_Log; 95 private Log m_Log;
88 private CurrentDirectory m_CurrentWorkingDirectory; 96 private CurrentDirectory m_CurrentWorkingDirectory;
@@ -90,16 +98,19 @@ namespace Prebuild.Core
90 98
91 private Hashtable m_Targets; 99 private Hashtable m_Targets;
92 private Hashtable m_Nodes; 100 private Hashtable m_Nodes;
93 101
94 readonly List<SolutionNode> m_Solutions = new List<SolutionNode>(); 102 ArrayList m_Solutions;
95 string m_Target; 103 string m_Target;
96 string m_Clean; 104 string m_Clean;
97 string[] m_RemoveDirectories; 105 string[] m_RemoveDirectories;
98 XmlDocument m_CurrentDoc; 106 string m_CurrentFile;
107 XmlDocument m_CurrentDoc;
99 bool m_PauseAfterFinish; 108 bool m_PauseAfterFinish;
100 string[] m_ProjectGroups; 109 string[] m_ProjectGroups;
110 StringCollection m_Refs;
101 111
102 #endregion 112
113 #endregion
103 114
104 #region Constructors 115 #region Constructors
105 116
@@ -199,7 +210,7 @@ namespace Prebuild.Core
199 /// Gets the solutions. 210 /// Gets the solutions.
200 /// </summary> 211 /// </summary>
201 /// <value>The solutions.</value> 212 /// <value>The solutions.</value>
202 public List<SolutionNode> Solutions 213 public ArrayList Solutions
203 { 214 {
204 get 215 get
205 { 216 {
@@ -224,7 +235,7 @@ namespace Prebuild.Core
224 235
225 #region Private Methods 236 #region Private Methods
226 237
227 private static void RemoveDirectories(string rootDir, string[] dirNames) 238 private void RemoveDirectories(string rootDir, string[] dirNames)
228 { 239 {
229 foreach(string dir in Directory.GetDirectories(rootDir)) 240 foreach(string dir in Directory.GetDirectories(rootDir))
230 { 241 {
@@ -286,15 +297,13 @@ namespace Prebuild.Core
286 foreach(Type t in assm.GetTypes()) 297 foreach(Type t in assm.GetTypes())
287 { 298 {
288 TargetAttribute ta = (TargetAttribute)Helper.CheckType(t, typeof(TargetAttribute), typeof(ITarget)); 299 TargetAttribute ta = (TargetAttribute)Helper.CheckType(t, typeof(TargetAttribute), typeof(ITarget));
289
290 if(ta == null) 300 if(ta == null)
301 {
291 continue; 302 continue;
292 303 }
293 if (t.IsAbstract) 304
294 continue;
295
296 ITarget target = (ITarget)assm.CreateInstance(t.FullName); 305 ITarget target = (ITarget)assm.CreateInstance(t.FullName);
297 if (target == null) 306 if(target == null)
298 { 307 {
299 throw new MissingMethodException("Could not create ITarget instance"); 308 throw new MissingMethodException("Could not create ITarget instance");
300 } 309 }
@@ -307,13 +316,16 @@ namespace Prebuild.Core
307 { 316 {
308 foreach(Type t in assm.GetTypes()) 317 foreach(Type t in assm.GetTypes())
309 { 318 {
310 foreach (DataNodeAttribute dna in t.GetCustomAttributes(typeof(DataNodeAttribute), true)) 319 DataNodeAttribute dna = (DataNodeAttribute)Helper.CheckType(t, typeof(DataNodeAttribute), typeof(IDataNode));
311 { 320 if(dna == null)
312 NodeEntry ne = new NodeEntry(); 321 {
313 ne.Type = t; 322 continue;
314 ne.Attribute = dna; 323 }
315 m_Nodes[dna.Name] = ne; 324
316 } 325 NodeEntry ne = new NodeEntry();
326 ne.Type = t;
327 ne.Attribute = dna;
328 m_Nodes[dna.Name] = ne;
317 } 329 }
318 } 330 }
319 331
@@ -331,32 +343,7 @@ namespace Prebuild.Core
331 m_Log.Write(); 343 m_Log.Write();
332 } 344 }
333 345
334 346 private void ProcessFile(string file)
335
336 private void ProcessFile(string file)
337 {
338 ProcessFile(file, this.m_Solutions);
339 }
340
341 public void ProcessFile(ProcessNode node, SolutionNode parent)
342 {
343 if (node.IsValid)
344 {
345 List<SolutionNode> list = new List<SolutionNode>();
346 ProcessFile(node.Path, list);
347
348 foreach (SolutionNode solution in list)
349 parent.SolutionsTable[solution.Name] = solution;
350 }
351 }
352
353 /// <summary>
354 ///
355 /// </summary>
356 /// <param name="file"></param>
357 /// <param name="solutions"></param>
358 /// <returns></returns>
359 public void ProcessFile(string file, IList<SolutionNode> solutions)
360 { 347 {
361 m_CurrentWorkingDirectory.Push(); 348 m_CurrentWorkingDirectory.Push();
362 349
@@ -374,7 +361,8 @@ namespace Prebuild.Core
374 return; 361 return;
375 } 362 }
376 363
377 Helper.SetCurrentDir(Path.GetDirectoryName(path)); 364 m_CurrentFile = path;
365 Helper.SetCurrentDir(Path.GetDirectoryName(path));
378 366
379 XmlTextReader reader = new XmlTextReader(path); 367 XmlTextReader reader = new XmlTextReader(path);
380 368
@@ -391,33 +379,6 @@ namespace Prebuild.Core
391 379
392 string xml = pre.Process(reader);//remove script and evaulate pre-proccessing to get schema-conforming XML 380 string xml = pre.Process(reader);//remove script and evaulate pre-proccessing to get schema-conforming XML
393 381
394 // See if the user put into a pseudo target of "prebuild:preprocessed-input" to indicate they want to see the
395 // output before the system processes it.
396 if (m_CommandLine.WasPassed("ppi"))
397 {
398 // Get the filename if there is one, otherwise use a default.
399 string ppiFile = m_CommandLine["ppi"];
400 if (ppiFile == null || ppiFile.Trim().Length == 0)
401 {
402 ppiFile = "preprocessed-input.xml";
403 }
404
405 // Write out the string to the given stream.
406 try
407 {
408 using (StreamWriter ppiWriter = new StreamWriter(ppiFile))
409 {
410 ppiWriter.WriteLine(xml);
411 }
412 }
413 catch(IOException ex)
414 {
415 Console.WriteLine("Could not write PPI file '{0}': {1}", ppiFile, ex.Message);
416 }
417
418 // Finish processing this special tag.
419 return;
420 }
421 382
422 m_CurrentDoc = new XmlDocument(); 383 m_CurrentDoc = new XmlDocument();
423 try 384 try
@@ -482,7 +443,7 @@ namespace Prebuild.Core
482 } 443 }
483 else if(dataNode is SolutionNode) 444 else if(dataNode is SolutionNode)
484 { 445 {
485 solutions.Add((SolutionNode)dataNode); 446 m_Solutions.Add(dataNode);
486 } 447 }
487 } 448 }
488 } 449 }
@@ -566,7 +527,7 @@ namespace Prebuild.Core
566 /// <returns></returns> 527 /// <returns></returns>
567 public IDataNode ParseNode(XmlNode node, IDataNode parent, IDataNode preNode) 528 public IDataNode ParseNode(XmlNode node, IDataNode parent, IDataNode preNode)
568 { 529 {
569 IDataNode dataNode; 530 IDataNode dataNode = null;
570 531
571 try 532 try
572 { 533 {
@@ -668,6 +629,9 @@ namespace Prebuild.Core
668 m_PauseAfterFinish = m_CommandLine.WasPassed("pause"); 629 m_PauseAfterFinish = m_CommandLine.WasPassed("pause");
669 630
670 LoadSchema(); 631 LoadSchema();
632
633 m_Solutions = new ArrayList();
634 m_Refs = new StringCollection();
671 } 635 }
672 636
673 /// <summary> 637 /// <summary>
@@ -700,18 +664,17 @@ namespace Prebuild.Core
700 m_Log.Write(LogType.Error, "The options /target and /clean cannot be passed together"); 664 m_Log.Write(LogType.Error, "The options /target and /clean cannot be passed together");
701 return; 665 return;
702 } 666 }
703 667 else if(m_Target == null && m_Clean == null)
704 if(m_Target == null && m_Clean == null) 668 {
705 { 669 if(perfomedOtherTask) //finished
706 if(perfomedOtherTask) //finished 670 {
707 { 671 return;
708 return; 672 }
709 } 673 m_Log.Write(LogType.Error, "Must pass either /target or /clean to process a Prebuild file");
710 m_Log.Write(LogType.Error, "Must pass either /target or /clean to process a Prebuild file"); 674 return;
711 return; 675 }
712 } 676
713 677 string file = "./prebuild.xml";
714 string file = "./prebuild.xml";
715 if(m_CommandLine.WasPassed("file")) 678 if(m_CommandLine.WasPassed("file"))
716 { 679 {
717 file = m_CommandLine["file"]; 680 file = m_CommandLine["file"];
diff --git a/Prebuild/src/Core/Nodes/AuthorNode.cs b/Prebuild/src/Core/Nodes/AuthorNode.cs
index 20e72c0..03ea934 100644
--- a/Prebuild/src/Core/Nodes/AuthorNode.cs
+++ b/Prebuild/src/Core/Nodes/AuthorNode.cs
@@ -23,6 +23,15 @@ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY O
23*/ 23*/
24#endregion 24#endregion
25 25
26#region CVS Information
27/*
28 * $Source $
29 * $Author: $
30 * $Date: $
31 * $Revision: $
32 */
33#endregion
34
26using System; 35using System;
27using System.Collections; 36using System.Collections;
28using System.Collections.Specialized; 37using System.Collections.Specialized;
diff --git a/Prebuild/src/Core/Nodes/ConfigurationNode.cs b/Prebuild/src/Core/Nodes/ConfigurationNode.cs
index 67d78d5..828bff6 100644
--- a/Prebuild/src/Core/Nodes/ConfigurationNode.cs
+++ b/Prebuild/src/Core/Nodes/ConfigurationNode.cs
@@ -23,6 +23,15 @@ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY O
23*/ 23*/
24#endregion 24#endregion
25 25
26#region CVS Information
27/*
28 * $Source$
29 * $Author: jendave $
30 * $Date: 2006-01-28 09:49:58 +0900 (Sat, 28 Jan 2006) $
31 * $Revision: 71 $
32 */
33#endregion
34
26using System; 35using System;
27using System.Xml; 36using System.Xml;
28 37
diff --git a/Prebuild/src/Core/Nodes/DataNode.cs b/Prebuild/src/Core/Nodes/DataNode.cs
index 763e6c3..60ed122 100644
--- a/Prebuild/src/Core/Nodes/DataNode.cs
+++ b/Prebuild/src/Core/Nodes/DataNode.cs
@@ -23,24 +23,31 @@ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY O
23*/ 23*/
24#endregion 24#endregion
25 25
26#region CVS Information
27/*
28 * $Source$
29 * $Author: jendave $
30 * $Date: 2006-01-28 09:49:58 +0900 (Sat, 28 Jan 2006) $
31 * $Revision: 71 $
32 */
33#endregion
34
26using System; 35using System;
27using System.Xml; 36using System.Xml;
28 37
29using Prebuild.Core.Attributes; 38using Prebuild.Core.Attributes;
30using Prebuild.Core.Interfaces; 39using Prebuild.Core.Interfaces;
31using System.IO;
32 40
33namespace Prebuild.Core.Nodes 41namespace Prebuild.Core.Nodes
34{ 42{
35 /// <summary> 43 /// <summary>
36 /// 44 ///
37 /// </summary> 45 /// </summary>
38 public abstract class DataNode : IDataNode 46 public class DataNode : IDataNode
39 { 47 {
40 #region Fields 48 #region Fields
41 49
42 private IDataNode parent; 50 private IDataNode parent;
43 string[] m_WebTypes = new string[] { "aspx", "ascx", "master", "ashx", "asmx" };
44 51
45 #endregion 52 #endregion
46 53
@@ -61,10 +68,7 @@ namespace Prebuild.Core.Nodes
61 parent = value; 68 parent = value;
62 } 69 }
63 } 70 }
64 public string[] WebTypes 71
65 {
66 get { return m_WebTypes; }
67 }
68 /// <summary> 72 /// <summary>
69 /// Parses the specified node. 73 /// Parses the specified node.
70 /// </summary> 74 /// </summary>
@@ -72,46 +76,7 @@ namespace Prebuild.Core.Nodes
72 public virtual void Parse(XmlNode node) 76 public virtual void Parse(XmlNode node)
73 { 77 {
74 } 78 }
75 public BuildAction GetBuildActionByFileName(string fileName) 79
76 {
77 string extension = Path.GetExtension(fileName).ToLower();
78 foreach (string type in WebTypes)
79 {
80 if (extension == type)
81 return BuildAction.Content;
82 }
83 return BuildAction.Compile;
84 }
85 /// <summary>
86 /// Parses the file type to figure out what type it is
87 /// </summary>
88 /// <returns></returns>
89 public SubType GetSubTypeByFileName(string fileName)
90 {
91 string extension = System.IO.Path.GetExtension(fileName).ToLower();
92 string designer = String.Format(".designer{0}", extension);
93 string path = fileName.ToLower();
94 if (extension == ".resx")
95 {
96 return SubType.Designer;
97 }
98 else if (path.EndsWith(".settings"))
99 {
100 return SubType.Settings;
101 }
102 else
103 {
104
105 foreach (string type in WebTypes)
106 {
107 if (path.EndsWith(string.Format("{0}{1}", type, extension)))
108 {
109 return SubType.CodeBehind;
110 }
111 }
112 }
113 return SubType.Code;
114 }
115 #endregion 80 #endregion
116 } 81 }
117} 82}
diff --git a/Prebuild/src/Core/Nodes/DatabaseProjectNode.cs b/Prebuild/src/Core/Nodes/DatabaseProjectNode.cs
deleted file mode 100644
index 8696a79..0000000
--- a/Prebuild/src/Core/Nodes/DatabaseProjectNode.cs
+++ /dev/null
@@ -1,94 +0,0 @@
1using System;
2using System.Collections;
3using System.Collections.Generic;
4using System.Text;
5using System.Xml;
6
7using Prebuild.Core.Attributes;
8using Prebuild.Core.Interfaces;
9using Prebuild.Core.Utilities;
10
11namespace Prebuild.Core.Nodes
12{
13 [DataNode("DatabaseProject")]
14 public class DatabaseProjectNode : DataNode
15 {
16 string name;
17 string path;
18 string fullpath;
19 Guid guid = Guid.NewGuid();
20 readonly List<AuthorNode> authors = new List<AuthorNode>();
21 readonly List<DatabaseReferenceNode> references = new List<DatabaseReferenceNode>();
22
23 public Guid Guid
24 {
25 get { return guid; }
26 }
27
28 public string Name
29 {
30 get { return name; }
31 }
32
33 public string Path
34 {
35 get { return path; }
36 }
37
38 public string FullPath
39 {
40 get { return fullpath; }
41 }
42
43 public IEnumerable<DatabaseReferenceNode> References
44 {
45 get { return references; }
46 }
47
48 public override void Parse(XmlNode node)
49 {
50 name = Helper.AttributeValue(node, "name", name);
51 path = Helper.AttributeValue(node, "path", name);
52
53 try
54 {
55 fullpath = Helper.ResolvePath(path);
56 }
57 catch
58 {
59 throw new WarningException("Could not resolve Solution path: {0}", path);
60 }
61
62 Kernel.Instance.CurrentWorkingDirectory.Push();
63
64 try
65 {
66 Helper.SetCurrentDir(fullpath);
67
68 if (node == null)
69 {
70 throw new ArgumentNullException("node");
71 }
72
73 foreach (XmlNode child in node.ChildNodes)
74 {
75 IDataNode dataNode = Kernel.Instance.ParseNode(child, this);
76
77 if (dataNode == null)
78 continue;
79
80 if (dataNode is AuthorNode)
81 authors.Add((AuthorNode)dataNode);
82 else if (dataNode is DatabaseReferenceNode)
83 references.Add((DatabaseReferenceNode)dataNode);
84 }
85 }
86 finally
87 {
88 Kernel.Instance.CurrentWorkingDirectory.Pop();
89 }
90
91 base.Parse(node);
92 }
93 }
94}
diff --git a/Prebuild/src/Core/Nodes/DatabaseReferenceNode.cs b/Prebuild/src/Core/Nodes/DatabaseReferenceNode.cs
deleted file mode 100644
index 97c3964..0000000
--- a/Prebuild/src/Core/Nodes/DatabaseReferenceNode.cs
+++ /dev/null
@@ -1,63 +0,0 @@
1using System;
2using Prebuild.Core.Attributes;
3using Prebuild.Core.Utilities;
4
5namespace Prebuild.Core.Nodes
6{
7 [DataNode("DatabaseReference")]
8 public class DatabaseReferenceNode : DataNode
9 {
10 string name;
11 Guid providerId;
12 string connectionString;
13
14 public string Name
15 {
16 get { return name; }
17 }
18
19 public Guid ProviderId
20 {
21 get { return providerId; }
22 }
23
24 public string ConnectionString
25 {
26 get { return connectionString; }
27 }
28
29 public override void Parse(System.Xml.XmlNode node)
30 {
31 name = Helper.AttributeValue(node, "name", name);
32
33 string providerName = Helper.AttributeValue(node, "providerName", string.Empty);
34 if (providerName != null)
35 {
36 switch (providerName)
37 {
38 // digitaljeebus: pulled from HKLM\SOFTWARE\Microsoft\VisualStudio\9.0\DataProviders\*
39 // Not sure if these will help other operating systems, or if there's a better way.
40 case "Microsoft.SqlServerCe.Client.3.5":
41 providerId = new Guid("7C602B5B-ACCB-4acd-9DC0-CA66388C1533"); break;
42 case "System.Data.OleDb":
43 providerId = new Guid("7F041D59-D76A-44ed-9AA2-FBF6B0548B80"); break;
44 case "System.Data.OracleClient":
45 providerId = new Guid("8F5C5018-AE09-42cf-B2CC-2CCCC7CFC2BB"); break;
46 case "System.Data.SqlClient":
47 providerId = new Guid("91510608-8809-4020-8897-FBA057E22D54"); break;
48 case "System.Data.Odbc":
49 providerId = new Guid("C3D4F4CE-2C48-4381-B4D6-34FA50C51C86"); break;
50
51 default:
52 throw new ArgumentOutOfRangeException("providerName", providerName, "Could not provider name to an id.");
53 }
54 }
55 else
56 providerId = new Guid(Helper.AttributeValue(node, "providerId", Guid.Empty.ToString("B")));
57
58 connectionString = Helper.AttributeValue(node, "connectionString", connectionString);
59
60 base.Parse(node);
61 }
62 }
63}
diff --git a/Prebuild/src/Core/Nodes/DescriptionNode.cs b/Prebuild/src/Core/Nodes/DescriptionNode.cs
index 353a5ae..cff7afc 100644
--- a/Prebuild/src/Core/Nodes/DescriptionNode.cs
+++ b/Prebuild/src/Core/Nodes/DescriptionNode.cs
@@ -23,6 +23,15 @@ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY O
23*/ 23*/
24#endregion 24#endregion
25 25
26#region CVS Information
27/*
28 * $Source $
29 * $Author: $
30 * $Date: $
31 * $Revision: $
32 */
33#endregion
34
26using System; 35using System;
27using System.Collections; 36using System.Collections;
28using System.Collections.Specialized; 37using System.Collections.Specialized;
diff --git a/Prebuild/src/Core/Nodes/ExcludeNode.cs b/Prebuild/src/Core/Nodes/ExcludeNode.cs
index 7f04cba..afc869d 100644
--- a/Prebuild/src/Core/Nodes/ExcludeNode.cs
+++ b/Prebuild/src/Core/Nodes/ExcludeNode.cs
@@ -23,6 +23,15 @@ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY O
23*/ 23*/
24#endregion 24#endregion
25 25
26#region CVS Information
27/*
28 * $Source$
29 * $Author: borrillis $
30 * $Date: 2007-05-25 01:03:16 +0900 (Fri, 25 May 2007) $
31 * $Revision: 243 $
32 */
33#endregion
34
26using System; 35using System;
27using System.Xml; 36using System.Xml;
28 37
diff --git a/Prebuild/src/Core/Nodes/FileNode.cs b/Prebuild/src/Core/Nodes/FileNode.cs
index 1520fcb..083dba5 100644
--- a/Prebuild/src/Core/Nodes/FileNode.cs
+++ b/Prebuild/src/Core/Nodes/FileNode.cs
@@ -23,6 +23,15 @@ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY O
23*/ 23*/
24#endregion 24#endregion
25 25
26#region CVS Information
27/*
28 * $Source$
29 * $Author: borrillis $
30 * $Date: 2007-05-25 01:03:16 +0900 (Fri, 25 May 2007) $
31 * $Revision: 243 $
32 */
33#endregion
34
26using System; 35using System;
27using System.IO; 36using System.IO;
28using System.Xml; 37using System.Xml;
@@ -30,7 +39,6 @@ using System.Xml;
30using Prebuild.Core.Attributes; 39using Prebuild.Core.Attributes;
31using Prebuild.Core.Interfaces; 40using Prebuild.Core.Interfaces;
32using Prebuild.Core.Utilities; 41using Prebuild.Core.Utilities;
33using Prebuild.Core.Targets;
34 42
35namespace Prebuild.Core.Nodes 43namespace Prebuild.Core.Nodes
36{ 44{
@@ -85,11 +93,7 @@ namespace Prebuild.Core.Nodes
85 /// <summary> 93 /// <summary>
86 /// 94 ///
87 /// </summary> 95 /// </summary>
88 UserControl, 96 UserControl
89 /// <summary>
90 ///
91 /// </summary>
92 CodeBehind,
93 } 97 }
94 98
95 public enum CopyToOutput 99 public enum CopyToOutput
@@ -109,9 +113,9 @@ namespace Prebuild.Core.Nodes
109 113
110 private string m_Path; 114 private string m_Path;
111 private string m_ResourceName = ""; 115 private string m_ResourceName = "";
112 private BuildAction? m_BuildAction; 116 private BuildAction m_BuildAction = BuildAction.Compile;
113 private bool m_Valid; 117 private bool m_Valid;
114 private SubType? m_SubType; 118 private SubType m_SubType = SubType.Code;
115 private CopyToOutput m_CopyToOutput = CopyToOutput.Never; 119 private CopyToOutput m_CopyToOutput = CopyToOutput.Never;
116 private bool m_Link = false; 120 private bool m_Link = false;
117 private string m_LinkPath = string.Empty; 121 private string m_LinkPath = string.Empty;
@@ -151,11 +155,7 @@ namespace Prebuild.Core.Nodes
151 { 155 {
152 get 156 get
153 { 157 {
154 if (m_BuildAction != null) 158 return m_BuildAction;
155 return m_BuildAction.Value;
156 else
157 return GetBuildActionByFileName(this.Path);
158
159 } 159 }
160 } 160 }
161 161
@@ -189,10 +189,7 @@ namespace Prebuild.Core.Nodes
189 { 189 {
190 get 190 get
191 { 191 {
192 if (m_SubType != null) 192 return m_SubType;
193 return m_SubType.Value;
194 else
195 return GetSubTypeByFileName(this.Path);
196 } 193 }
197 } 194 }
198 195
@@ -230,13 +227,10 @@ namespace Prebuild.Core.Nodes
230 /// <param name="node"></param> 227 /// <param name="node"></param>
231 public override void Parse(XmlNode node) 228 public override void Parse(XmlNode node)
232 { 229 {
233 string buildAction = Helper.AttributeValue(node, "buildAction", String.Empty); 230 m_BuildAction = (BuildAction)Enum.Parse(typeof(BuildAction),
234 if (buildAction != string.Empty) 231 Helper.AttributeValue(node, "buildAction", m_BuildAction.ToString()));
235 m_BuildAction = (BuildAction)Enum.Parse(typeof(BuildAction), buildAction); 232 m_SubType = (SubType)Enum.Parse(typeof(SubType),
236 string subType = Helper.AttributeValue(node, "subType", string.Empty); 233 Helper.AttributeValue(node, "subType", m_SubType.ToString()));
237 if (subType != String.Empty)
238 m_SubType = (SubType)Enum.Parse(typeof(SubType), subType);
239
240 m_ResourceName = Helper.AttributeValue(node, "resourceName", m_ResourceName.ToString()); 234 m_ResourceName = Helper.AttributeValue(node, "resourceName", m_ResourceName.ToString());
241 this.m_Link = bool.Parse(Helper.AttributeValue(node, "link", bool.FalseString)); 235 this.m_Link = bool.Parse(Helper.AttributeValue(node, "link", bool.FalseString));
242 if ( this.m_Link == true ) 236 if ( this.m_Link == true )
diff --git a/Prebuild/src/Core/Nodes/FilesNode.cs b/Prebuild/src/Core/Nodes/FilesNode.cs
index dc306c2..7c1dd19 100644
--- a/Prebuild/src/Core/Nodes/FilesNode.cs
+++ b/Prebuild/src/Core/Nodes/FilesNode.cs
@@ -23,6 +23,15 @@ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY O
23*/ 23*/
24#endregion 24#endregion
25 25
26#region CVS Information
27/*
28 * $Source$
29 * $Author: borrillis $
30 * $Date: 2007-05-25 01:03:16 +0900 (Fri, 25 May 2007) $
31 * $Revision: 243 $
32 */
33#endregion
34
26using System; 35using System;
27using System.Collections; 36using System.Collections;
28using System.Collections.Specialized; 37using System.Collections.Specialized;
@@ -30,7 +39,6 @@ using System.Xml;
30 39
31using Prebuild.Core.Attributes; 40using Prebuild.Core.Attributes;
32using Prebuild.Core.Interfaces; 41using Prebuild.Core.Interfaces;
33using System.IO;
34 42
35namespace Prebuild.Core.Nodes 43namespace Prebuild.Core.Nodes
36{ 44{
@@ -216,8 +224,8 @@ namespace Prebuild.Core.Nodes
216 if (!m_Files.Contains(file)) 224 if (!m_Files.Contains(file))
217 { 225 {
218 m_Files.Add(file); 226 m_Files.Add(file);
219 m_BuildActions[ file ] = matchNode.BuildAction == null ? GetBuildActionByFileName(file) : matchNode.BuildAction; 227 m_BuildActions[ file ] = matchNode.BuildAction;
220 m_SubTypes[file] = matchNode.SubType == null ? GetSubTypeByFileName(file) : matchNode.SubType.Value; 228 m_SubTypes[ file ] = matchNode.SubType;
221 m_ResourceNames[ file ] = matchNode.ResourceName; 229 m_ResourceNames[ file ] = matchNode.ResourceName;
222 this.m_PreservePaths[ file ] = matchNode.PreservePath; 230 this.m_PreservePaths[ file ] = matchNode.PreservePath;
223 this.m_Links[ file ] = matchNode.IsLink; 231 this.m_Links[ file ] = matchNode.IsLink;
diff --git a/Prebuild/src/Core/Nodes/MatchNode.cs b/Prebuild/src/Core/Nodes/MatchNode.cs
index 656d7d0..aeaf3c1 100644
--- a/Prebuild/src/Core/Nodes/MatchNode.cs
+++ b/Prebuild/src/Core/Nodes/MatchNode.cs
@@ -23,8 +23,16 @@ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY O
23*/ 23*/
24#endregion 24#endregion
25 25
26#region CVS Information
27/*
28 * $Source$
29 * $Author: borrillis $
30 * $Date: 2007-05-25 01:03:16 +0900 (Fri, 25 May 2007) $
31 * $Revision: 243 $
32 */
33#endregion
34
26using System; 35using System;
27using System.Collections.Generic;
28using System.Collections.Specialized; 36using System.Collections.Specialized;
29using System.IO; 37using System.IO;
30using System.Text.RegularExpressions; 38using System.Text.RegularExpressions;
@@ -45,16 +53,29 @@ namespace Prebuild.Core.Nodes
45 { 53 {
46 #region Fields 54 #region Fields
47 55
48 private readonly StringCollection m_Files = new StringCollection(); 56 private StringCollection m_Files;
49 private Regex m_Regex; 57 private Regex m_Regex;
50 private BuildAction? m_BuildAction; 58 private BuildAction m_BuildAction = BuildAction.Compile;
51 private SubType? m_SubType; 59 private SubType m_SubType = SubType.Code;
52 string m_ResourceName = ""; 60 string m_ResourceName = "";
53 private CopyToOutput m_CopyToOutput; 61 private CopyToOutput m_CopyToOutput;
54 private bool m_Link; 62 private bool m_Link;
55 private string m_LinkPath; 63 private string m_LinkPath;
56 private bool m_PreservePath; 64 private bool m_PreservePath;
57 private readonly List<ExcludeNode> m_Exclusions = new List<ExcludeNode>(); 65 private ArrayList m_Exclusions;
66
67 #endregion
68
69 #region Constructors
70
71 /// <summary>
72 ///
73 /// </summary>
74 public MatchNode()
75 {
76 m_Files = new StringCollection();
77 m_Exclusions = new ArrayList();
78 }
58 79
59 #endregion 80 #endregion
60 81
@@ -74,7 +95,7 @@ namespace Prebuild.Core.Nodes
74 /// <summary> 95 /// <summary>
75 /// 96 ///
76 /// </summary> 97 /// </summary>
77 public BuildAction? BuildAction 98 public BuildAction BuildAction
78 { 99 {
79 get 100 get
80 { 101 {
@@ -85,7 +106,7 @@ namespace Prebuild.Core.Nodes
85 /// <summary> 106 /// <summary>
86 /// 107 ///
87 /// </summary> 108 /// </summary>
88 public SubType? SubType 109 public SubType SubType
89 { 110 {
90 get 111 get
91 { 112 {
@@ -146,7 +167,7 @@ namespace Prebuild.Core.Nodes
146 /// <param name="pattern">The pattern.</param> 167 /// <param name="pattern">The pattern.</param>
147 /// <param name="recurse">if set to <c>true</c> [recurse].</param> 168 /// <param name="recurse">if set to <c>true</c> [recurse].</param>
148 /// <param name="useRegex">if set to <c>true</c> [use regex].</param> 169 /// <param name="useRegex">if set to <c>true</c> [use regex].</param>
149 private void RecurseDirectories(string path, string pattern, bool recurse, bool useRegex, List<ExcludeNode> exclusions) 170 private void RecurseDirectories(string path, string pattern, bool recurse, bool useRegex, ArrayList exclusions)
150 { 171 {
151 Match match; 172 Match match;
152 Boolean excludeFile; 173 Boolean excludeFile;
@@ -258,14 +279,10 @@ namespace Prebuild.Core.Nodes
258 string pattern = Helper.AttributeValue(node, "pattern", "*"); 279 string pattern = Helper.AttributeValue(node, "pattern", "*");
259 bool recurse = (bool)Helper.TranslateValue(typeof(bool), Helper.AttributeValue(node, "recurse", "false")); 280 bool recurse = (bool)Helper.TranslateValue(typeof(bool), Helper.AttributeValue(node, "recurse", "false"));
260 bool useRegex = (bool)Helper.TranslateValue(typeof(bool), Helper.AttributeValue(node, "useRegex", "false")); 281 bool useRegex = (bool)Helper.TranslateValue(typeof(bool), Helper.AttributeValue(node, "useRegex", "false"));
261 string buildAction = Helper.AttributeValue(node, "buildAction", String.Empty); 282 m_BuildAction = (BuildAction)Enum.Parse(typeof(BuildAction),
262 if (buildAction != string.Empty) 283 Helper.AttributeValue(node, "buildAction", m_BuildAction.ToString()));
263 m_BuildAction = (BuildAction)Enum.Parse(typeof(BuildAction), buildAction); 284 m_SubType = (SubType)Enum.Parse(typeof(SubType),
264 285 Helper.AttributeValue(node, "subType", m_SubType.ToString()));
265 //TODO: Figure out where the subtype node is being assigned
266 //string subType = Helper.AttributeValue(node, "subType", string.Empty);
267 //if (subType != String.Empty)
268 // m_SubType = (SubType)Enum.Parse(typeof(SubType), subType);
269 m_ResourceName = Helper.AttributeValue(node, "resourceName", m_ResourceName.ToString()); 286 m_ResourceName = Helper.AttributeValue(node, "resourceName", m_ResourceName.ToString());
270 this.m_CopyToOutput = (CopyToOutput) Enum.Parse(typeof(CopyToOutput), Helper.AttributeValue(node, "copyToOutput", this.m_CopyToOutput.ToString())); 287 this.m_CopyToOutput = (CopyToOutput) Enum.Parse(typeof(CopyToOutput), Helper.AttributeValue(node, "copyToOutput", this.m_CopyToOutput.ToString()));
271 this.m_Link = bool.Parse(Helper.AttributeValue(node, "link", bool.FalseString)); 288 this.m_Link = bool.Parse(Helper.AttributeValue(node, "link", bool.FalseString));
@@ -312,7 +329,7 @@ namespace Prebuild.Core.Nodes
312 if(dataNode is ExcludeNode) 329 if(dataNode is ExcludeNode)
313 { 330 {
314 ExcludeNode excludeNode = (ExcludeNode)dataNode; 331 ExcludeNode excludeNode = (ExcludeNode)dataNode;
315 m_Exclusions.Add( excludeNode ); 332 m_Exclusions.Add( dataNode );
316 } 333 }
317 } 334 }
318 335
diff --git a/Prebuild/src/Core/Nodes/OptionsNode.cs b/Prebuild/src/Core/Nodes/OptionsNode.cs
index b63034b..651c339 100644
--- a/Prebuild/src/Core/Nodes/OptionsNode.cs
+++ b/Prebuild/src/Core/Nodes/OptionsNode.cs
@@ -23,6 +23,17 @@ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY O
23*/ 23*/
24#endregion 24#endregion
25 25
26#region CVS Information
27/*
28 * $Source$
29 * $Author: jendave $
30 * $Date: 2007-01-09 01:55:40 +0900 (Tue, 09 Jan 2007) $
31 * $Revision: 197 $
32 */
33#endregion
34
35
36
26using System; 37using System;
27using System.Collections; 38using System.Collections;
28using System.Collections.Specialized; 39using System.Collections.Specialized;
diff --git a/Prebuild/src/Core/Nodes/ProcessNode.cs b/Prebuild/src/Core/Nodes/ProcessNode.cs
index 6bfbe16..2d2162c 100644
--- a/Prebuild/src/Core/Nodes/ProcessNode.cs
+++ b/Prebuild/src/Core/Nodes/ProcessNode.cs
@@ -23,6 +23,15 @@ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY O
23*/ 23*/
24#endregion 24#endregion
25 25
26#region CVS Information
27/*
28 * $Source$
29 * $Author: jendave $
30 * $Date: 2006-01-28 09:49:58 +0900 (Sat, 28 Jan 2006) $
31 * $Revision: 71 $
32 */
33#endregion
34
26using System; 35using System;
27using System.Collections; 36using System.Collections;
28using System.Collections.Specialized; 37using System.Collections.Specialized;
diff --git a/Prebuild/src/Core/Nodes/ProjectNode.cs b/Prebuild/src/Core/Nodes/ProjectNode.cs
index 0a24abf..e98ab5f 100644
--- a/Prebuild/src/Core/Nodes/ProjectNode.cs
+++ b/Prebuild/src/Core/Nodes/ProjectNode.cs
@@ -23,9 +23,17 @@ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY O
23*/ 23*/
24#endregion 24#endregion
25 25
26#region CVS Information
27/*
28 * $Source$
29 * $Author: jendave $
30 * $Date: 2007-05-26 06:58:26 +0900 (Sat, 26 May 2007) $
31 * $Revision: 244 $
32 */
33#endregion
34
26using System; 35using System;
27using System.Collections; 36using System.Collections;
28using System.Collections.Generic;
29using System.IO; 37using System.IO;
30using System.Xml; 38using System.Xml;
31 39
@@ -51,11 +59,7 @@ namespace Prebuild.Core.Nodes
51 /// <summary> 59 /// <summary>
52 /// The project is a library 60 /// The project is a library
53 /// </summary> 61 /// </summary>
54 Library, 62 Library
55 /// <summary>
56 /// The project is a website
57 /// </summary>
58 Web,
59 } 63 }
60 64
61 /// <summary> 65 /// <summary>
@@ -72,25 +76,7 @@ namespace Prebuild.Core.Nodes
72 /// </summary> 76 /// </summary>
73 Mono 77 Mono
74 } 78 }
75 /// <summary> 79
76 /// The version of the .NET framework to use (Required for VS2008)
77 /// <remarks>We don't need .NET 1.1 in here, it'll default when using vs2003.</remarks>
78 /// </summary>
79 public enum FrameworkVersion
80 {
81 /// <summary>
82 /// .NET 2.0
83 /// </summary>
84 v2_0,
85 /// <summary>
86 /// .NET 3.0
87 /// </summary>
88 v3_0,
89 /// <summary>
90 /// .NET 3.5
91 /// </summary>
92 v3_5,
93 }
94 /// <summary> 80 /// <summary>
95 /// The Node object representing /Prebuild/Solution/Project elements 81 /// The Node object representing /Prebuild/Solution/Project elements
96 /// </summary> 82 /// </summary>
@@ -109,45 +95,49 @@ namespace Prebuild.Core.Nodes
109 private string m_Language = "C#"; 95 private string m_Language = "C#";
110 private ProjectType m_Type = ProjectType.Exe; 96 private ProjectType m_Type = ProjectType.Exe;
111 private ClrRuntime m_Runtime = ClrRuntime.Microsoft; 97 private ClrRuntime m_Runtime = ClrRuntime.Microsoft;
112 private FrameworkVersion m_Framework = FrameworkVersion.v2_0;
113 private string m_StartupObject = ""; 98 private string m_StartupObject = "";
114 private string m_RootNamespace; 99 private string m_RootNamespace;
115 private string m_FilterGroups = ""; 100 private string m_FilterGroups = "";
116 private string m_Version = ""; 101 private string m_Version = "";
117 private Guid m_Guid; 102 private Guid m_Guid;
118 private string m_DebugStartParameters;
119 103
120 private Hashtable m_Configurations = new Hashtable(); 104 private Hashtable m_Configurations;
121 private readonly List<ReferencePathNode> m_ReferencePaths = new List<ReferencePathNode>(); 105 private ArrayList m_ReferencePaths;
122 private readonly List<ReferenceNode> m_References = new List<ReferenceNode>(); 106 private ArrayList m_References;
123 private readonly List<AuthorNode> m_Authors = new List<AuthorNode>(); 107 private ArrayList m_Authors;
124 private FilesNode m_Files; 108 private FilesNode m_Files;
125 109
126 #endregion 110 #endregion
127 111
128 #region Properties 112 #region Constructors
129 113
130 /// <summary> 114 /// <summary>
131 /// Gets the name. 115 /// Initializes a new instance of the <see cref="ProjectNode"/> class.
132 /// </summary> 116 /// </summary>
133 /// <value>The name.</value> 117 public ProjectNode()
134 public string Name
135 { 118 {
136 get 119 m_Configurations = new Hashtable();
137 { 120 m_ReferencePaths = new ArrayList();
138 return m_Name; 121 m_References = new ArrayList();
139 } 122 m_Authors = new ArrayList();
140 } 123 }
124
125 #endregion
126
127 #region Properties
128
141 /// <summary> 129 /// <summary>
142 /// The version of the .NET Framework to compile under 130 /// Gets the name.
143 /// </summary> 131 /// </summary>
144 public FrameworkVersion FrameworkVersion 132 /// <value>The name.</value>
133 public string Name
145 { 134 {
146 get 135 get
147 { 136 {
148 return this.m_Framework; 137 return m_Name;
149 } 138 }
150 } 139 }
140
151 /// <summary> 141 /// <summary>
152 /// Gets the path. 142 /// Gets the path.
153 /// </summary> 143 /// </summary>
@@ -220,17 +210,17 @@ namespace Prebuild.Core.Nodes
220 } 210 }
221 } 211 }
222 212
223 /// <summary> 213 /// <summary>
224 /// Gets the app icon. 214 /// Gets the app icon.
225 /// </summary> 215 /// </summary>
226 /// <value>The app icon.</value> 216 /// <value>The app icon.</value>
227 public string ConfigFile 217 public string ConfigFile
228 { 218 {
229 get 219 get
230 { 220 {
231 return m_ConfigFile; 221 return m_ConfigFile;
232 } 222 }
233 } 223 }
234 224
235 /// <summary> 225 /// <summary>
236 /// 226 ///
@@ -279,22 +269,22 @@ namespace Prebuild.Core.Nodes
279 } 269 }
280 } 270 }
281 271
282 private bool m_GenerateAssemblyInfoFile = false; 272 private bool m_GenerateAssemblyInfoFile = false;
283 273
284 /// <summary> 274 /// <summary>
285 /// 275 ///
286 /// </summary> 276 /// </summary>
287 public bool GenerateAssemblyInfoFile 277 public bool GenerateAssemblyInfoFile
288 { 278 {
289 get 279 get
290 { 280 {
291 return m_GenerateAssemblyInfoFile; 281 return m_GenerateAssemblyInfoFile;
292 } 282 }
293 set 283 set
294 { 284 {
295 m_GenerateAssemblyInfoFile = value; 285 m_GenerateAssemblyInfoFile = value;
296 } 286 }
297 } 287 }
298 288
299 /// <summary> 289 /// <summary>
300 /// Gets the startup object. 290 /// Gets the startup object.
@@ -324,7 +314,7 @@ namespace Prebuild.Core.Nodes
324 /// Gets the configurations. 314 /// Gets the configurations.
325 /// </summary> 315 /// </summary>
326 /// <value>The configurations.</value> 316 /// <value>The configurations.</value>
327 public IList Configurations 317 public ICollection Configurations
328 { 318 {
329 get 319 get
330 { 320 {
@@ -350,11 +340,11 @@ namespace Prebuild.Core.Nodes
350 /// Gets the reference paths. 340 /// Gets the reference paths.
351 /// </summary> 341 /// </summary>
352 /// <value>The reference paths.</value> 342 /// <value>The reference paths.</value>
353 public List<ReferencePathNode> ReferencePaths 343 public ArrayList ReferencePaths
354 { 344 {
355 get 345 get
356 { 346 {
357 List<ReferencePathNode> tmp = new List<ReferencePathNode>(m_ReferencePaths); 347 ArrayList tmp = new ArrayList(m_ReferencePaths);
358 tmp.Sort(); 348 tmp.Sort();
359 return tmp; 349 return tmp;
360 } 350 }
@@ -364,11 +354,11 @@ namespace Prebuild.Core.Nodes
364 /// Gets the references. 354 /// Gets the references.
365 /// </summary> 355 /// </summary>
366 /// <value>The references.</value> 356 /// <value>The references.</value>
367 public List<ReferenceNode> References 357 public ArrayList References
368 { 358 {
369 get 359 get
370 { 360 {
371 List<ReferenceNode> tmp = new List<ReferenceNode>(m_References); 361 ArrayList tmp = new ArrayList(m_References);
372 tmp.Sort(); 362 tmp.Sort();
373 return tmp; 363 return tmp;
374 } 364 }
@@ -378,7 +368,7 @@ namespace Prebuild.Core.Nodes
378 /// Gets the Authors list. 368 /// Gets the Authors list.
379 /// </summary> 369 /// </summary>
380 /// <value>The list of the project's authors.</value> 370 /// <value>The list of the project's authors.</value>
381 public List<AuthorNode> Authors 371 public ArrayList Authors
382 { 372 {
383 get 373 get
384 { 374 {
@@ -434,15 +424,7 @@ namespace Prebuild.Core.Nodes
434 } 424 }
435 } 425 }
436 426
437 public string DebugStartParameters 427 #endregion
438 {
439 get
440 {
441 return m_DebugStartParameters;
442 }
443 }
444
445 #endregion
446 428
447 #region Private Methods 429 #region Private Methods
448 430
@@ -488,18 +470,13 @@ namespace Prebuild.Core.Nodes
488 m_Language = Helper.AttributeValue(node, "language", m_Language); 470 m_Language = Helper.AttributeValue(node, "language", m_Language);
489 m_Type = (ProjectType)Helper.EnumAttributeValue(node, "type", typeof(ProjectType), m_Type); 471 m_Type = (ProjectType)Helper.EnumAttributeValue(node, "type", typeof(ProjectType), m_Type);
490 m_Runtime = (ClrRuntime)Helper.EnumAttributeValue(node, "runtime", typeof(ClrRuntime), m_Runtime); 472 m_Runtime = (ClrRuntime)Helper.EnumAttributeValue(node, "runtime", typeof(ClrRuntime), m_Runtime);
491 m_Framework = (FrameworkVersion)Helper.EnumAttributeValue(node, "frameworkVersion", typeof(FrameworkVersion), m_Framework);
492 m_StartupObject = Helper.AttributeValue(node, "startupObject", m_StartupObject); 473 m_StartupObject = Helper.AttributeValue(node, "startupObject", m_StartupObject);
493 m_RootNamespace = Helper.AttributeValue(node, "rootNamespace", m_RootNamespace); 474 m_RootNamespace = Helper.AttributeValue(node, "rootNamespace", m_RootNamespace);
494 475 m_GenerateAssemblyInfoFile = Helper.ParseBoolean(node, "generateAssemblyInfoFile", false);
476
495 int hash = m_Name.GetHashCode(); 477 int hash = m_Name.GetHashCode();
496 Guid guidByHash = new Guid(hash, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); 478 m_Guid = new Guid(hash, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
497 string guid = Helper.AttributeValue(node, "guid", guidByHash.ToString());
498 m_Guid = new Guid(guid);
499 479
500 m_GenerateAssemblyInfoFile = Helper.ParseBoolean(node, "generateAssemblyInfoFile", false);
501 m_DebugStartParameters = Helper.AttributeValue(node, "debugStartParameters", string.Empty);
502
503 if(m_AssemblyName == null || m_AssemblyName.Length < 1) 480 if(m_AssemblyName == null || m_AssemblyName.Length < 1)
504 { 481 {
505 m_AssemblyName = m_Name; 482 m_AssemblyName = m_Name;
@@ -539,15 +516,15 @@ namespace Prebuild.Core.Nodes
539 } 516 }
540 else if(dataNode is ReferencePathNode) 517 else if(dataNode is ReferencePathNode)
541 { 518 {
542 m_ReferencePaths.Add((ReferencePathNode)dataNode); 519 m_ReferencePaths.Add(dataNode);
543 } 520 }
544 else if(dataNode is ReferenceNode) 521 else if(dataNode is ReferenceNode)
545 { 522 {
546 m_References.Add((ReferenceNode)dataNode); 523 m_References.Add(dataNode);
547 } 524 }
548 else if(dataNode is AuthorNode) 525 else if(dataNode is AuthorNode)
549 { 526 {
550 m_Authors.Add((AuthorNode)dataNode); 527 m_Authors.Add(dataNode);
551 } 528 }
552 else if(dataNode is FilesNode) 529 else if(dataNode is FilesNode)
553 { 530 {
@@ -571,6 +548,6 @@ namespace Prebuild.Core.Nodes
571 return this.m_Name.CompareTo(that.m_Name); 548 return this.m_Name.CompareTo(that.m_Name);
572 } 549 }
573 550
574 #endregion 551 #endregion
575 } 552 }
576} 553}
diff --git a/Prebuild/src/Core/Nodes/ReferenceNode.cs b/Prebuild/src/Core/Nodes/ReferenceNode.cs
index 9c5d1a3..df0c2e4 100644
--- a/Prebuild/src/Core/Nodes/ReferenceNode.cs
+++ b/Prebuild/src/Core/Nodes/ReferenceNode.cs
@@ -23,6 +23,15 @@ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY O
23*/ 23*/
24#endregion 24#endregion
25 25
26#region CVS Information
27/*
28 * $Source$
29 * $Author: jendave $
30 * $Date: 2006-07-26 01:56:49 +0900 (Wed, 26 Jul 2006) $
31 * $Revision: 132 $
32 */
33#endregion
34
26using System; 35using System;
27using System.Xml; 36using System.Xml;
28 37
diff --git a/Prebuild/src/Core/Nodes/ReferencePathNode.cs b/Prebuild/src/Core/Nodes/ReferencePathNode.cs
index f0543c2..d4042ef 100644
--- a/Prebuild/src/Core/Nodes/ReferencePathNode.cs
+++ b/Prebuild/src/Core/Nodes/ReferencePathNode.cs
@@ -23,6 +23,15 @@ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY O
23*/ 23*/
24#endregion 24#endregion
25 25
26#region CVS Information
27/*
28 * $Source$
29 * $Author: jendave $
30 * $Date: 2006-01-28 09:49:58 +0900 (Sat, 28 Jan 2006) $
31 * $Revision: 71 $
32 */
33#endregion
34
26using System; 35using System;
27using System.Collections; 36using System.Collections;
28using System.Collections.Specialized; 37using System.Collections.Specialized;
diff --git a/Prebuild/src/Core/Nodes/SolutionNode.cs b/Prebuild/src/Core/Nodes/SolutionNode.cs
index 2a1b8e2..9473fe6 100644
--- a/Prebuild/src/Core/Nodes/SolutionNode.cs
+++ b/Prebuild/src/Core/Nodes/SolutionNode.cs
@@ -23,9 +23,17 @@ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY O
23*/ 23*/
24#endregion 24#endregion
25 25
26#region CVS Information
27/*
28 * $Source$
29 * $Author: jendave $
30 * $Date: 2006-03-01 01:15:42 +0900 (Wed, 01 Mar 2006) $
31 * $Revision: 92 $
32 */
33#endregion
34
26using System; 35using System;
27using System.Collections; 36using System.Collections;
28using System.Collections.Generic;
29using System.Diagnostics; 37using System.Diagnostics;
30using System.IO; 38using System.IO;
31using System.Xml; 39using System.Xml;
@@ -40,62 +48,40 @@ namespace Prebuild.Core.Nodes
40 /// 48 ///
41 /// </summary> 49 /// </summary>
42 [DataNode("Solution")] 50 [DataNode("Solution")]
43 [DataNode("EmbeddedSolution")]
44 [DebuggerDisplay("{Name}")]
45 public class SolutionNode : DataNode 51 public class SolutionNode : DataNode
46 { 52 {
47 #region Fields 53 #region Fields
48 54
49 private Guid m_Guid = Guid.NewGuid();
50 private string m_Name = "unknown"; 55 private string m_Name = "unknown";
51 private string m_Path = ""; 56 private string m_Path = "";
52 private string m_FullPath = ""; 57 private string m_FullPath = "";
53 private string m_ActiveConfig = "Debug"; 58 private string m_ActiveConfig = "Debug";
54 private string m_Version = "1.0.0"; 59 private string m_Version = "1.0.0";
55 60
56 private OptionsNode m_Options; 61 private OptionsNode m_Options;
57 private FilesNode m_Files; 62 private FilesNode m_Files;
58 private readonly Hashtable m_Configurations = new Hashtable(); 63 private Hashtable m_Configurations;
59 private readonly Hashtable m_Projects = new Hashtable(); 64 private Hashtable m_Projects;
60 private readonly Hashtable m_DatabaseProjects = new Hashtable(); 65 private ArrayList m_ProjectsOrder;
61 private readonly List<ProjectNode> m_ProjectsOrder = new List<ProjectNode>(); 66
62 private readonly Hashtable m_Solutions = new Hashtable(); 67 #endregion
68
69 #region Constructors
70
71 /// <summary>
72 /// Initializes a new instance of the <see cref="SolutionNode"/> class.
73 /// </summary>
74 public SolutionNode()
75 {
76 m_Configurations = new Hashtable();
77 m_Projects = new Hashtable();
78 m_ProjectsOrder = new ArrayList();
79 }
63 80
64 #endregion 81 #endregion
65 82
66 #region Properties 83 #region Properties
67 public override IDataNode Parent 84
68 {
69 get
70 {
71 return base.Parent;
72 }
73 set
74 {
75 if (value is SolutionNode)
76 {
77 SolutionNode solution = (SolutionNode)value;
78 foreach (ConfigurationNode conf in solution.Configurations)
79 {
80 m_Configurations[conf.Name] = conf.Clone();
81 }
82 }
83
84 base.Parent = value;
85 }
86 }
87
88 public Guid Guid
89 {
90 get
91 {
92 return m_Guid;
93 }
94 set
95 {
96 m_Guid = value;
97 }
98 }
99 /// <summary> 85 /// <summary>
100 /// Gets or sets the active config. 86 /// Gets or sets the active config.
101 /// </summary> 87 /// </summary>
@@ -209,36 +195,7 @@ namespace Prebuild.Core.Nodes
209 return m_Configurations; 195 return m_Configurations;
210 } 196 }
211 } 197 }
212 /// <summary> 198
213 /// Gets the database projects.
214 /// </summary>
215 public ICollection DatabaseProjects
216 {
217 get
218 {
219 return m_DatabaseProjects.Values;
220 }
221 }
222 /// <summary>
223 /// Gets the nested solutions.
224 /// </summary>
225 public ICollection Solutions
226 {
227 get
228 {
229 return m_Solutions.Values;
230 }
231 }
232 /// <summary>
233 /// Gets the nested solutions hash table.
234 /// </summary>
235 public Hashtable SolutionsTable
236 {
237 get
238 {
239 return this.m_Solutions;
240 }
241 }
242 /// <summary> 199 /// <summary>
243 /// Gets the projects. 200 /// Gets the projects.
244 /// </summary> 201 /// </summary>
@@ -269,7 +226,7 @@ namespace Prebuild.Core.Nodes
269 /// Gets the projects table. 226 /// Gets the projects table.
270 /// </summary> 227 /// </summary>
271 /// <value>The projects table.</value> 228 /// <value>The projects table.</value>
272 public List<ProjectNode> ProjectsTableOrder 229 public ArrayList ProjectsTableOrder
273 { 230 {
274 get 231 get
275 { 232 {
@@ -330,21 +287,8 @@ namespace Prebuild.Core.Nodes
330 else if(dataNode is ProjectNode) 287 else if(dataNode is ProjectNode)
331 { 288 {
332 m_Projects[((ProjectNode)dataNode).Name] = dataNode; 289 m_Projects[((ProjectNode)dataNode).Name] = dataNode;
333 m_ProjectsOrder.Add((ProjectNode)dataNode); 290 m_ProjectsOrder.Add(dataNode);
334 } 291 }
335 else if(dataNode is SolutionNode)
336 {
337 m_Solutions[((SolutionNode)dataNode).Name] = dataNode;
338 }
339 else if (dataNode is ProcessNode)
340 {
341 ProcessNode p = (ProcessNode)dataNode;
342 Kernel.Instance.ProcessFile(p, this);
343 }
344 else if (dataNode is DatabaseProjectNode)
345 {
346 m_DatabaseProjects[((DatabaseProjectNode)dataNode).Name] = dataNode;
347 }
348 } 292 }
349 } 293 }
350 finally 294 finally
diff --git a/Prebuild/src/Core/Parse/IfContext.cs b/Prebuild/src/Core/Parse/IfContext.cs
index 3c79d38..fc86885 100644
--- a/Prebuild/src/Core/Parse/IfContext.cs
+++ b/Prebuild/src/Core/Parse/IfContext.cs
@@ -23,6 +23,15 @@ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY O
23*/ 23*/
24#endregion 24#endregion
25 25
26#region CVS Information
27/*
28 * $Source$
29 * $Author: jendave $
30 * $Date: 2006-01-28 09:49:58 +0900 (Sat, 28 Jan 2006) $
31 * $Revision: 71 $
32 */
33#endregion
34
26using System; 35using System;
27 36
28namespace Prebuild.Core.Parse 37namespace Prebuild.Core.Parse
diff --git a/Prebuild/src/Core/Parse/Preprocessor.cs b/Prebuild/src/Core/Parse/Preprocessor.cs
index 013f8e1..eea5c30 100644
--- a/Prebuild/src/Core/Parse/Preprocessor.cs
+++ b/Prebuild/src/Core/Parse/Preprocessor.cs
@@ -23,10 +23,18 @@ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY O
23*/ 23*/
24#endregion 24#endregion
25 25
26#region CVS Information
27/*
28 * $Source$
29 * $Author: jendave $
30 * $Date: 2007-04-26 17:10:27 +0900 (Thu, 26 Apr 2007) $
31 * $Revision: 236 $
32 */
33#endregion
34
26using System; 35using System;
27using System.Collections; 36using System.Collections;
28using System.IO; 37using System.IO;
29using System.Text.RegularExpressions;
30using System.Xml; 38using System.Xml;
31 39
32namespace Prebuild.Core.Parse 40namespace Prebuild.Core.Parse
@@ -71,16 +79,6 @@ namespace Prebuild.Core.Parse
71 /// </summary> 79 /// </summary>
72 public class Preprocessor 80 public class Preprocessor
73 { 81 {
74 #region Constants
75
76 /// <summary>
77 /// Includes the regex to look for file tags in the <?include
78 /// ?> processing instruction.
79 /// </summary>
80 private static readonly Regex includeFileRegex = new Regex("file=\"(.+?)\"");
81
82 #endregion
83
84 #region Fields 82 #region Fields
85 83
86 XmlDocument m_OutDoc; 84 XmlDocument m_OutDoc;
@@ -140,10 +138,10 @@ namespace Prebuild.Core.Parse
140 return "Win32"; 138 return "Win32";
141 } 139 }
142 140
143 if (File.Exists("/System/Library/Frameworks/Cocoa.framework/Cocoa")) 141 if (File.Exists("/System/Library/Frameworks/Cocoa.framework/Cocoa"))
144 { 142 {
145 return "MACOSX"; 143 return "MACOSX";
146 } 144 }
147 145
148 /* 146 /*
149 * .NET 1.x, under Mono, the UNIX code is 128. Under 147 * .NET 1.x, under Mono, the UNIX code is 128. Under
@@ -238,7 +236,7 @@ namespace Prebuild.Core.Parse
238 OperatorSymbol oper = OperatorSymbol.None; 236 OperatorSymbol oper = OperatorSymbol.None;
239 bool inStr = false; 237 bool inStr = false;
240 char c; 238 char c;
241 239
242 for(int i = 0; i < exp.Length; i++) 240 for(int i = 0; i < exp.Length; i++)
243 { 241 {
244 c = exp[i]; 242 c = exp[i];
@@ -285,7 +283,7 @@ namespace Prebuild.Core.Parse
285 { 283 {
286 oper = OperatorSymbol.NotEqual; 284 oper = OperatorSymbol.NotEqual;
287 } 285 }
288 286
289 break; 287 break;
290 288
291 case '<': 289 case '<':
@@ -297,7 +295,7 @@ namespace Prebuild.Core.Parse
297 { 295 {
298 oper = OperatorSymbol.LessThan; 296 oper = OperatorSymbol.LessThan;
299 } 297 }
300 298
301 break; 299 break;
302 300
303 case '>': 301 case '>':
@@ -316,7 +314,7 @@ namespace Prebuild.Core.Parse
316 } 314 }
317 } 315 }
318 316
319 317
320 if(inStr) 318 if(inStr)
321 { 319 {
322 throw new WarningException("Expected end of string in expression"); 320 throw new WarningException("Expected end of string in expression");
@@ -394,9 +392,9 @@ namespace Prebuild.Core.Parse
394 /// <exception cref="ArgumentException">For invalid use of conditional expressions or for invalid XML syntax. If a XmlValidatingReader is passed, then will also throw exceptions for non-schema-conforming xml</exception> 392 /// <exception cref="ArgumentException">For invalid use of conditional expressions or for invalid XML syntax. If a XmlValidatingReader is passed, then will also throw exceptions for non-schema-conforming xml</exception>
395 /// <param name="reader"></param> 393 /// <param name="reader"></param>
396 /// <returns>the output xml </returns> 394 /// <returns>the output xml </returns>
397 public string Process(XmlReader initialReader) 395 public string Process(XmlReader reader)
398 { 396 {
399 if(initialReader == null) 397 if(reader == null)
400 { 398 {
401 throw new ArgumentException("Invalid XML reader to pre-process"); 399 throw new ArgumentException("Invalid XML reader to pre-process");
402 } 400 }
@@ -405,175 +403,119 @@ namespace Prebuild.Core.Parse
405 StringWriter xmlText = new StringWriter(); 403 StringWriter xmlText = new StringWriter();
406 XmlTextWriter writer = new XmlTextWriter(xmlText); 404 XmlTextWriter writer = new XmlTextWriter(xmlText);
407 writer.Formatting = Formatting.Indented; 405 writer.Formatting = Formatting.Indented;
408 406 while(reader.Read())
409 // Create a queue of XML readers and add the initial
410 // reader to it. Then we process until we run out of
411 // readers which lets the <?include?> operation add more
412 // readers to generate a multi-file parser and not require
413 // XML fragments that a recursive version would use.
414 Stack readerStack = new Stack();
415 readerStack.Push(initialReader);
416
417 while(readerStack.Count > 0)
418 { 407 {
419 // Pop off the next reader. 408 if(reader.NodeType == XmlNodeType.ProcessingInstruction)
420 XmlReader reader = (XmlReader) readerStack.Pop();
421
422 // Process through this XML reader until it is
423 // completed (or it is replaced by the include
424 // operation).
425 while(reader.Read())
426 { 409 {
427 // The prebuild file has a series of processing 410 bool ignore = false;
428 // instructions which allow for specific 411 switch(reader.LocalName)
429 // inclusions based on operating system or to
430 // include additional files.
431 if(reader.NodeType == XmlNodeType.ProcessingInstruction)
432 { 412 {
433 bool ignore = false; 413 case "if":
434 414 m_IfStack.Push(context);
435 switch(reader.LocalName) 415 context = new IfContext(context.Keep & context.Active, ParseExpression(reader.Value), IfState.If);
436 { 416 ignore = true;
437 case "include": 417 break;
438 // use regular expressions to parse out the attributes.
439 MatchCollection matches = includeFileRegex.Matches(reader.Value);
440
441 // make sure there is only one file attribute.
442 if(matches.Count > 1)
443 {
444 throw new WarningException("An <?include ?> node was found, but it specified more than one file.");
445 }
446
447 if(matches.Count == 0)
448 {
449 throw new WarningException("An <?include ?> node was found, but it did not specify the file attribute.");
450 }
451
452 // Pull the file out from the regex and make sure it is a valid file before using it.
453 string filename = matches[0].Groups[1].Value;
454 FileInfo includeFile = new FileInfo(filename);
455
456 if(!includeFile.Exists)
457 {
458 throw new WarningException("Cannot include file: " + includeFile.FullName);
459 }
460
461 // Create a new reader object for this file. Then put the old reader back on the stack and start
462 // processing using this new XML reader.
463 XmlReader newReader = new XmlTextReader(includeFile.Open(FileMode.Open, FileAccess.Read, FileShare.Read));
464
465 readerStack.Push(reader);
466 reader = newReader;
467 ignore = true;
468 break;
469
470 case "if":
471 m_IfStack.Push(context);
472 context = new IfContext(context.Keep & context.Active, ParseExpression(reader.Value), IfState.If);
473 ignore = true;
474 break;
475
476 case "elseif":
477 if(m_IfStack.Count == 0)
478 {
479 throw new WarningException("Unexpected 'elseif' outside of 'if'");
480 }
481 else if(context.State != IfState.If && context.State != IfState.ElseIf)
482 {
483 throw new WarningException("Unexpected 'elseif' outside of 'if'");
484 }
485 418
486 context.State = IfState.ElseIf; 419 case "elseif":
487 if(!context.EverKept) 420 if(m_IfStack.Count == 0)
488 { 421 {
489 context.Keep = ParseExpression(reader.Value); 422 throw new WarningException("Unexpected 'elseif' outside of 'if'");
490 } 423 }
491 else 424 else if(context.State != IfState.If && context.State != IfState.ElseIf)
492 { 425 {
493 context.Keep = false; 426 throw new WarningException("Unexpected 'elseif' outside of 'if'");
494 } 427 }
495 428
496 ignore = true; 429 context.State = IfState.ElseIf;
497 break; 430 if(!context.EverKept)
431 {
432 context.Keep = ParseExpression(reader.Value);
433 }
434 else
435 {
436 context.Keep = false;
437 }
498 438
499 case "else": 439 ignore = true;
500 if(m_IfStack.Count == 0) 440 break;
501 {
502 throw new WarningException("Unexpected 'else' outside of 'if'");
503 }
504 else if(context.State != IfState.If && context.State != IfState.ElseIf)
505 {
506 throw new WarningException("Unexpected 'else' outside of 'if'");
507 }
508 441
509 context.State = IfState.Else; 442 case "else":
510 context.Keep = !context.EverKept; 443 if(m_IfStack.Count == 0)
511 ignore = true; 444 {
512 break; 445 throw new WarningException("Unexpected 'else' outside of 'if'");
446 }
447 else if(context.State != IfState.If && context.State != IfState.ElseIf)
448 {
449 throw new WarningException("Unexpected 'else' outside of 'if'");
450 }
513 451
514 case "endif": 452 context.State = IfState.Else;
515 if(m_IfStack.Count == 0) 453 context.Keep = !context.EverKept;
516 { 454 ignore = true;
517 throw new WarningException("Unexpected 'endif' outside of 'if'"); 455 break;
518 }
519 456
520 context = (IfContext)m_IfStack.Pop(); 457 case "endif":
521 ignore = true; 458 if(m_IfStack.Count == 0)
522 break; 459 {
523 } 460 throw new WarningException("Unexpected 'endif' outside of 'if'");
461 }
524 462
525 if(ignore) 463 context = (IfContext)m_IfStack.Pop();
526 { 464 ignore = true;
527 continue; 465 break;
528 } 466 }
529 }//end pre-proc instruction
530 467
531 if(!context.Active || !context.Keep) 468 if(ignore)
532 { 469 {
533 continue; 470 continue;
534 } 471 }
472 }//end pre-proc instruction
535 473
536 switch(reader.NodeType) 474 if(!context.Active || !context.Keep)
537 { 475 {
538 case XmlNodeType.Element: 476 continue;
539 bool empty = reader.IsEmptyElement; 477 }
540 writer.WriteStartElement(reader.Name);
541 478
542 while (reader.MoveToNextAttribute()) 479 switch(reader.NodeType)
543 { 480 {
544 writer.WriteAttributeString(reader.Name, reader.Value); 481 case XmlNodeType.Element:
545 } 482 bool empty = reader.IsEmptyElement;
483 writer.WriteStartElement(reader.Name);
546 484
547 if(empty) 485 while (reader.MoveToNextAttribute())
548 { 486 {
549 writer.WriteEndElement(); 487 writer.WriteAttributeString(reader.Name, reader.Value);
550 } 488 }
551
552 break;
553 489
554 case XmlNodeType.EndElement: 490 if(empty)
491 {
555 writer.WriteEndElement(); 492 writer.WriteEndElement();
556 break; 493 }
494
495 break;
557 496
558 case XmlNodeType.Text: 497 case XmlNodeType.EndElement:
559 writer.WriteString(reader.Value); 498 writer.WriteEndElement();
560 break; 499 break;
561 500
562 case XmlNodeType.CDATA: 501 case XmlNodeType.Text:
563 writer.WriteCData(reader.Value); 502 writer.WriteString(reader.Value);
564 break; 503 break;
565 504
566 default: 505 case XmlNodeType.CDATA:
567 break; 506 writer.WriteCData(reader.Value);
568 } 507 break;
569 }
570 508
571 if(m_IfStack.Count != 0) 509 default:
572 { 510 break;
573 throw new WarningException("Mismatched 'if', 'endif' pair");
574 } 511 }
575 } 512 }
576 513
514 if(m_IfStack.Count != 0)
515 {
516 throw new WarningException("Mismatched 'if', 'endif' pair");
517 }
518
577 return xmlText.ToString(); 519 return xmlText.ToString();
578 } 520 }
579 521
diff --git a/Prebuild/src/Core/Targets/AutotoolsTarget.cs b/Prebuild/src/Core/Targets/AutotoolsTarget.cs
index 5dcbb38..f102038 100644
--- a/Prebuild/src/Core/Targets/AutotoolsTarget.cs
+++ b/Prebuild/src/Core/Targets/AutotoolsTarget.cs
@@ -65,9 +65,18 @@ POSSIBILITY OF SUCH DAMAGE.
65 */ 65 */
66 66
67#endregion 67#endregion
68
69#region CVS Information
70/*
71 * $Source$
72 * $Author: jendave $
73 * $Date: 2006-07-28 22:43:24 -0700 (Fri, 28 Jul 2006) $
74 * $Revision: 136 $
75 */
76#endregion
77
68using System; 78using System;
69using System.Collections; 79using System.Collections;
70using System.Collections.Generic;
71using System.Collections.Specialized; 80using System.Collections.Specialized;
72using System.IO; 81using System.IO;
73using System.Reflection; 82using System.Reflection;
@@ -173,7 +182,8 @@ namespace Prebuild.Core.Targets
173 Hashtable assemblyPathToPackage = new Hashtable(); 182 Hashtable assemblyPathToPackage = new Hashtable();
174 Hashtable assemblyFullNameToPath = new Hashtable(); 183 Hashtable assemblyFullNameToPath = new Hashtable();
175 Hashtable packagesHash = new Hashtable(); 184 Hashtable packagesHash = new Hashtable();
176 readonly List<SystemPackage> packages = new List<SystemPackage>(); 185 ArrayList packages = new ArrayList();
186 ClrVersion currentVersion;
177 187
178 #endregion 188 #endregion
179 189
@@ -193,6 +203,22 @@ namespace Prebuild.Core.Targets
193 di.Create(); 203 di.Create();
194 } 204 }
195 205
206 private void mkStubFiles(string dirName, ArrayList fileNames)
207 {
208 for (int i = 0; i < fileNames.Count; i++)
209 {
210 string tmpFile = dirName + "/" + (string)fileNames[i];
211
212 FileStream tmpFileStream =
213 new FileStream(tmpFile, FileMode.Create);
214
215 StreamWriter sw = new StreamWriter(tmpFileStream);
216 sw.WriteLine("These are not the files you are looking for.");
217 sw.Flush();
218 tmpFileStream.Close();
219 }
220 }
221
196 private void chkMkDir(string dirName) 222 private void chkMkDir(string dirName)
197 { 223 {
198 System.IO.DirectoryInfo di = 224 System.IO.DirectoryInfo di =
@@ -247,11 +273,11 @@ namespace Prebuild.Core.Targets
247 } 273 }
248 } 274 }
249 275
250 private List<string> GetAssembliesWithLibInfo(string line, string file) 276 private ArrayList GetAssembliesWithLibInfo(string line, string file)
251 { 277 {
252 List<string> references = new List<string>(); 278 ArrayList references = new ArrayList();
253 List<string> libdirs = new List<string>(); 279 ArrayList libdirs = new ArrayList();
254 List<string> retval = new List<string>(); 280 ArrayList retval = new ArrayList();
255 foreach (string piece in line.Split(' ')) 281 foreach (string piece in line.Split(' '))
256 { 282 {
257 if (piece.ToLower().Trim().StartsWith("/r:") || piece.ToLower().Trim().StartsWith("-r:")) 283 if (piece.ToLower().Trim().StartsWith("/r:") || piece.ToLower().Trim().StartsWith("-r:"))
@@ -278,9 +304,9 @@ namespace Prebuild.Core.Targets
278 return retval; 304 return retval;
279 } 305 }
280 306
281 private List<string> GetAssembliesWithoutLibInfo(string line, string file) 307 private ArrayList GetAssembliesWithoutLibInfo(string line, string file)
282 { 308 {
283 List<string> references = new List<string>(); 309 ArrayList references = new ArrayList();
284 foreach (string reference in line.Split(' ')) 310 foreach (string reference in line.Split(' '))
285 { 311 {
286 if (reference.ToLower().Trim().StartsWith("/r:") || reference.ToLower().Trim().StartsWith("-r:")) 312 if (reference.ToLower().Trim().StartsWith("/r:") || reference.ToLower().Trim().StartsWith("-r:"))
@@ -330,7 +356,7 @@ namespace Prebuild.Core.Targets
330 if (packagesHash.Contains(pname)) 356 if (packagesHash.Contains(pname))
331 return; 357 return;
332 358
333 List<string> fullassemblies = null; 359 ArrayList fullassemblies = null;
334 string version = ""; 360 string version = "";
335 string desc = ""; 361 string desc = "";
336 362
@@ -378,7 +404,7 @@ namespace Prebuild.Core.Targets
378 package.Initialize(pname, 404 package.Initialize(pname,
379 version, 405 version,
380 desc, 406 desc,
381 fullassemblies.ToArray(), 407 (string[])fullassemblies.ToArray(typeof(string)),
382 ClrVersion.Default, 408 ClrVersion.Default,
383 false); 409 false);
384 packages.Add(package); 410 packages.Add(package);
@@ -388,7 +414,7 @@ namespace Prebuild.Core.Targets
388 void RegisterSystemAssemblies(string prefix, string version, ClrVersion ver) 414 void RegisterSystemAssemblies(string prefix, string version, ClrVersion ver)
389 { 415 {
390 SystemPackage package = new SystemPackage(); 416 SystemPackage package = new SystemPackage();
391 List<string> list = new List<string>(); 417 ArrayList list = new ArrayList();
392 418
393 string dir = Path.Combine(prefix, version); 419 string dir = Path.Combine(prefix, version);
394 if (!Directory.Exists(dir)) 420 if (!Directory.Exists(dir))
@@ -405,7 +431,7 @@ namespace Prebuild.Core.Targets
405 package.Initialize("mono", 431 package.Initialize("mono",
406 version, 432 version,
407 "The Mono runtime", 433 "The Mono runtime",
408 list.ToArray(), 434 (string[])list.ToArray(typeof(string)),
409 ver, 435 ver,
410 false); 436 false);
411 packages.Add(package); 437 packages.Add(package);
@@ -418,10 +444,12 @@ namespace Prebuild.Core.Targets
418 if (Environment.Version.Major == 1) 444 if (Environment.Version.Major == 1)
419 { 445 {
420 versionDir = "1.0"; 446 versionDir = "1.0";
447 currentVersion = ClrVersion.Net_1_1;
421 } 448 }
422 else 449 else
423 { 450 {
424 versionDir = "2.0"; 451 versionDir = "2.0";
452 currentVersion = ClrVersion.Net_2_0;
425 } 453 }
426 454
427 //Pull up assemblies from the installed mono system. 455 //Pull up assemblies from the installed mono system.
@@ -455,9 +483,9 @@ namespace Prebuild.Core.Targets
455 } 483 }
456 } 484 }
457 search_dirs += Path.PathSeparator + libpath; 485 search_dirs += Path.PathSeparator + libpath;
458 if (!string.IsNullOrEmpty(search_dirs)) 486 if (search_dirs != null && search_dirs.Length > 0)
459 { 487 {
460 List<string> scanDirs = new List<string>(); 488 ArrayList scanDirs = new ArrayList();
461 foreach (string potentialDir in search_dirs.Split(Path.PathSeparator)) 489 foreach (string potentialDir in search_dirs.Split(Path.PathSeparator))
462 { 490 {
463 if (!scanDirs.Contains(potentialDir)) 491 if (!scanDirs.Contains(potentialDir))
@@ -735,22 +763,20 @@ namespace Prebuild.Core.Targets
735 bool hasAssemblyConfig = false; 763 bool hasAssemblyConfig = false;
736 chkMkDir(projectDir); 764 chkMkDir(projectDir);
737 765
738 List<string> 766 ArrayList
739 compiledFiles = new List<string>(), 767 compiledFiles = new ArrayList(),
740 contentFiles = new List<string>(), 768 contentFiles = new ArrayList(),
741 embeddedFiles = new List<string>(), 769 embeddedFiles = new ArrayList(),
742
743 binaryLibs = new List<string>(),
744 pkgLibs = new List<string>(),
745 systemLibs = new List<string>(),
746 runtimeLibs = new List<string>(),
747 770
748 extraDistFiles = new List<string>(), 771 binaryLibs = new ArrayList(),
749 localCopyTargets = new List<string>(); 772 pkgLibs = new ArrayList(),
773 systemLibs = new ArrayList(),
774 runtimeLibs = new ArrayList(),
750 775
751 // If there exists a .config file for this assembly, copy 776 extraDistFiles = new ArrayList(),
752 // it to the project folder 777 localCopyTargets = new ArrayList();
753 778
779 // If there exists a .config file for this assembly, copy it to the project folder
754 // TODO: Support copying .config.osx files 780 // TODO: Support copying .config.osx files
755 // TODO: support processing the .config file for native library deps 781 // TODO: support processing the .config file for native library deps
756 string projectAssemblyName = project.Name; 782 string projectAssemblyName = project.Name;
@@ -813,15 +839,11 @@ namespace Prebuild.Core.Targets
813 foreach (System.CodeDom.Compiler.CompilerError error in cr.Errors) 839 foreach (System.CodeDom.Compiler.CompilerError error in cr.Errors)
814 Console.WriteLine("Error! '{0}'", error.ErrorText); 840 Console.WriteLine("Error! '{0}'", error.ErrorText);
815 841
816 try { 842 string projectFullName = cr.CompiledAssembly.FullName;
817 string projectFullName = cr.CompiledAssembly.FullName; 843 Regex verRegex = new Regex("Version=([\\d\\.]+)");
818 Regex verRegex = new Regex("Version=([\\d\\.]+)"); 844 Match verMatch = verRegex.Match(projectFullName);
819 Match verMatch = verRegex.Match(projectFullName); 845 if (verMatch.Success)
820 if (verMatch.Success)
821 projectVersion = verMatch.Groups[1].Value; 846 projectVersion = verMatch.Groups[1].Value;
822 }catch{
823 Console.WriteLine("Couldn't compile AssemblyInfo.cs");
824 }
825 847
826 // Clean up the temp file 848 // Clean up the temp file
827 try 849 try
@@ -831,7 +853,7 @@ namespace Prebuild.Core.Targets
831 } 853 }
832 catch 854 catch
833 { 855 {
834 Console.WriteLine("Error! '{0}'", e.ToString()); 856 //Console.WriteLine("Error! '{0}'", e.ToString());
835 } 857 }
836 858
837 } 859 }
@@ -991,46 +1013,46 @@ namespace Prebuild.Core.Targets
991 } 1013 }
992 } 1014 }
993 1015
994 const string lineSep = " \\\n\t"; 1016 string lineSep = " \\\n\t";
995 string compiledFilesString = string.Empty; 1017 string compiledFilesString = string.Empty;
996 if (compiledFiles.Count > 0) 1018 if (compiledFiles.Count > 0)
997 compiledFilesString = 1019 compiledFilesString =
998 lineSep + string.Join(lineSep, compiledFiles.ToArray()); 1020 lineSep + string.Join(lineSep, (string[])compiledFiles.ToArray(typeof(string)));
999 1021
1000 string embeddedFilesString = ""; 1022 string embeddedFilesString = "";
1001 if (embeddedFiles.Count > 0) 1023 if (embeddedFiles.Count > 0)
1002 embeddedFilesString = 1024 embeddedFilesString =
1003 lineSep + string.Join(lineSep, embeddedFiles.ToArray()); 1025 lineSep + string.Join(lineSep, (string[])embeddedFiles.ToArray(typeof(string)));
1004 1026
1005 string contentFilesString = ""; 1027 string contentFilesString = "";
1006 if (contentFiles.Count > 0) 1028 if (contentFiles.Count > 0)
1007 contentFilesString = 1029 contentFilesString =
1008 lineSep + string.Join(lineSep, contentFiles.ToArray()); 1030 lineSep + string.Join(lineSep, (string[])contentFiles.ToArray(typeof(string)));
1009 1031
1010 string extraDistFilesString = ""; 1032 string extraDistFilesString = "";
1011 if (extraDistFiles.Count > 0) 1033 if (extraDistFiles.Count > 0)
1012 extraDistFilesString = 1034 extraDistFilesString =
1013 lineSep + string.Join(lineSep, extraDistFiles.ToArray()); 1035 lineSep + string.Join(lineSep, (string[])extraDistFiles.ToArray(typeof(string)));
1014 1036
1015 string pkgLibsString = ""; 1037 string pkgLibsString = "";
1016 if (pkgLibs.Count > 0) 1038 if (pkgLibs.Count > 0)
1017 pkgLibsString = 1039 pkgLibsString =
1018 lineSep + string.Join(lineSep, pkgLibs.ToArray()); 1040 lineSep + string.Join(lineSep, (string[])pkgLibs.ToArray(typeof(string)));
1019 1041
1020 string binaryLibsString = ""; 1042 string binaryLibsString = "";
1021 if (binaryLibs.Count > 0) 1043 if (binaryLibs.Count > 0)
1022 binaryLibsString = 1044 binaryLibsString =
1023 lineSep + string.Join(lineSep, binaryLibs.ToArray()); 1045 lineSep + string.Join(lineSep, (string[])binaryLibs.ToArray(typeof(string)));
1024 1046
1025 string systemLibsString = ""; 1047 string systemLibsString = "";
1026 if (systemLibs.Count > 0) 1048 if (systemLibs.Count > 0)
1027 systemLibsString = 1049 systemLibsString =
1028 lineSep + string.Join(lineSep, systemLibs.ToArray()); 1050 lineSep + string.Join(lineSep, (string[])systemLibs.ToArray(typeof(string)));
1029 1051
1030 string localCopyTargetsString = ""; 1052 string localCopyTargetsString = "";
1031 if (localCopyTargets.Count > 0) 1053 if (localCopyTargets.Count > 0)
1032 localCopyTargetsString = 1054 localCopyTargetsString =
1033 string.Join("\n", localCopyTargets.ToArray()); 1055 string.Join("\n", (string[])localCopyTargets.ToArray(typeof(string)));
1034 1056
1035 string monoPath = ""; 1057 string monoPath = "";
1036 foreach (string runtimeLib in runtimeLibs) 1058 foreach (string runtimeLib in runtimeLibs)
diff --git a/Prebuild/src/Core/Targets/DebugTarget.cs b/Prebuild/src/Core/Targets/DebugTarget.cs
index dc4e666..db19e05 100644
--- a/Prebuild/src/Core/Targets/DebugTarget.cs
+++ b/Prebuild/src/Core/Targets/DebugTarget.cs
@@ -27,7 +27,7 @@ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY O
27/* 27/*
28 * $Source$ 28 * $Source$
29 * $Author: jendave $ 29 * $Author: jendave $
30 * $Date: 2006-09-20 09:42:51 +0200 (on, 20 sep 2006) $ 30 * $Date: 2006-09-20 16:42:51 +0900 (Wed, 20 Sep 2006) $
31 * $Revision: 164 $ 31 * $Revision: 164 $
32 */ 32 */
33#endregion 33#endregion
diff --git a/Prebuild/src/Core/Targets/MonoDevelopTarget.cs b/Prebuild/src/Core/Targets/MonoDevelopTarget.cs
index c8401fd..5a5dc55 100644
--- a/Prebuild/src/Core/Targets/MonoDevelopTarget.cs
+++ b/Prebuild/src/Core/Targets/MonoDevelopTarget.cs
@@ -23,6 +23,15 @@ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY O
23*/ 23*/
24#endregion 24#endregion
25 25
26#region CVS Information
27/*
28 * $Source$
29 * $Author: cjcollier $
30 * $Date: 2007-04-11 07:10:35 +0900 (Wed, 11 Apr 2007) $
31 * $Revision: 231 $
32 */
33#endregion
34
26using System; 35using System;
27using System.Collections; 36using System.Collections;
28using System.Collections.Specialized; 37using System.Collections.Specialized;
diff --git a/Prebuild/src/Core/Targets/NAntTarget.cs b/Prebuild/src/Core/Targets/NAntTarget.cs
index 9a6ee17..eb5325d 100644
--- a/Prebuild/src/Core/Targets/NAntTarget.cs
+++ b/Prebuild/src/Core/Targets/NAntTarget.cs
@@ -1,9 +1,9 @@
1#region BSD License 1#region BSD License
2/* 2/*
3Copyright (c) 2004 - 2008 3Copyright (c) 2004 - 2008
4Matthew Holmes (matthew@wildfiregames.com), 4Matthew Holmes (matthew@wildfiregames.com),
5Dan Moorehead (dan05a@gmail.com), 5Dan Moorehead (dan05a@gmail.com),
6C.J. Adams-Collier (cjac@colliertech.org), 6C.J. Adams-Collier (cjac@colliertech.org),
7 7
8Redistribution and use in source and binary forms, with or without 8Redistribution and use in source and binary forms, with or without
9modification, are permitted provided that the following conditions are 9modification, are permitted provided that the following conditions are
@@ -35,6 +35,15 @@ POSSIBILITY OF SUCH DAMAGE.
35 35
36#endregion 36#endregion
37 37
38#region CVS Information
39/*
40 * $Source$
41 * $Author: cjcollier $
42 * $Date: 2008-02-07 10:22:36 +0900 (Thu, 07 Feb 2008) $
43 * $Revision: 255 $
44 */
45#endregion
46
38using System; 47using System;
39using System.Collections; 48using System.Collections;
40using System.Collections.Specialized; 49using System.Collections.Specialized;
@@ -49,73 +58,85 @@ using Prebuild.Core.Utilities;
49 58
50namespace Prebuild.Core.Targets 59namespace Prebuild.Core.Targets
51{ 60{
52 /// <summary> 61 /// <summary>
53 /// 62 ///
54 /// </summary> 63 /// </summary>
55 [Target("nant")] 64 [Target("nant")]
56 public class NAntTarget : ITarget 65 public class NAntTarget : ITarget
57 { 66 {
58 #region Fields 67 #region Fields
59 68
60 private Kernel m_Kernel; 69 private Kernel m_Kernel;
61 70
62 #endregion 71 #endregion
63 72
64 #region Private Methods 73 #region Private Methods
65 74
66 private static string PrependPath(string path) 75 private static string PrependPath(string path)
67 { 76 {
68 string tmpPath = Helper.NormalizePath(path, '/'); 77 string tmpPath = Helper.NormalizePath(path, '/');
69 Regex regex = new Regex(@"(\w):/(\w+)"); 78 Regex regex = new Regex(@"(\w):/(\w+)");
70 Match match = regex.Match(tmpPath); 79 Match match = regex.Match(tmpPath);
71 //if(match.Success || tmpPath[0] == '.' || tmpPath[0] == '/') 80 //if(match.Success || tmpPath[0] == '.' || tmpPath[0] == '/')
72 //{ 81 //{
73 tmpPath = Helper.NormalizePath(tmpPath); 82 tmpPath = Helper.NormalizePath(tmpPath);
74 //} 83 //}
75 // else 84 // else
76 // { 85 // {
77 // tmpPath = Helper.NormalizePath("./" + tmpPath); 86 // tmpPath = Helper.NormalizePath("./" + tmpPath);
78 // } 87 // }
79 88
80 return tmpPath; 89 return tmpPath;
81 } 90 }
82 91
83 private static string BuildReference(SolutionNode solution, ProjectNode currentProject, ReferenceNode refr) 92 private static string BuildReference(SolutionNode solution, ProjectNode currentProject, ReferenceNode refr)
84 { 93 {
94 string ret = "";
95 string referencePath = ((ReferencePathNode)currentProject.ReferencePaths[0]).Path;
85 96
86 if (!String.IsNullOrEmpty(refr.Path)) 97 if (String.IsNullOrEmpty(refr.Path))
87 { 98 {
88 return refr.Path; 99 if (solution.ProjectsTable.ContainsKey(refr.Name))
89 } 100 {
90 101 ProjectNode project = (ProjectNode) solution.ProjectsTable[refr.Name];
91 if (solution.ProjectsTable.ContainsKey(refr.Name)) 102 string finalPath =
92 { 103 Helper.NormalizePath(referencePath + refr.Name + GetProjectExtension(project), '/');
93 ProjectNode projectRef = (ProjectNode) solution.ProjectsTable[refr.Name]; 104 return finalPath;
94 string finalPath = 105 }
95 Helper.NormalizePath(refr.Name + GetProjectExtension(projectRef), '/'); 106 else
96 return finalPath; 107 {
97 } 108 ProjectNode project = (ProjectNode) refr.Parent;
98 109
99 ProjectNode project = (ProjectNode) refr.Parent; 110 // Do we have an explicit file reference?
111 string fileRef = FindFileReference(refr.Name, project);
112 if (fileRef != null)
113 {
114 return fileRef;
115 }
100 116
101 // Do we have an explicit file reference? 117 // Is there an explicit path in the project ref?
102 string fileRef = FindFileReference(refr.Name, project); 118 if (refr.Path != null)
103 if (fileRef != null) 119 {
104 { 120 return Helper.NormalizePath(refr.Path + "/" + refr.Name + GetProjectExtension(project), '/');
105 return fileRef; 121 }
106 }
107 122
108 // Is there an explicit path in the project ref? 123 // Is it a specified extension (dll or exe?)
109 if (refr.Path != null) 124 if (ExtensionSpecified(refr.Name))
125 {
126 return Helper.NormalizePath(referencePath + GetRefFileName(refr.Name), '/');
127 }
128
129 // No, it's an extensionless GAC ref, but nant needs the .dll extension anyway
130 return refr.Name + ".dll";
131 }
132 }
133 else
110 { 134 {
111 return Helper.NormalizePath(refr.Path + "/" + refr.Name + GetProjectExtension(project), '/'); 135 return refr.Path;
112 } 136 }
113
114 // No, it's an extensionless GAC ref, but nant needs the .dll extension anyway
115 return refr.Name + ".dll";
116 } 137 }
117 138
118 public static string GetRefFileName(string refName) 139 public static string GetRefFileName(string refName)
119 { 140 {
120 if (ExtensionSpecified(refName)) 141 if (ExtensionSpecified(refName))
121 { 142 {
@@ -123,7 +144,7 @@ namespace Prebuild.Core.Targets
123 } 144 }
124 else 145 else
125 { 146 {
126 return refName + ".dll"; 147 return refName + ".dll";
127 } 148 }
128 } 149 }
129 150
@@ -135,235 +156,268 @@ namespace Prebuild.Core.Targets
135 private static string GetProjectExtension(ProjectNode project) 156 private static string GetProjectExtension(ProjectNode project)
136 { 157 {
137 string extension = ".dll"; 158 string extension = ".dll";
138 if (project.Type == ProjectType.Exe || project.Type == ProjectType.WinExe) 159 if (project.Type == ProjectType.Exe)
139 { 160 {
140 extension = ".exe"; 161 extension = ".exe";
141 } 162 }
142 return extension; 163 return extension;
143 } 164 }
144 165
145 private static string FindFileReference(string refName, ProjectNode project) 166 //private static string BuildReferencePath(SolutionNode solution, ReferenceNode refr)
146 { 167 //{
147 foreach (ReferencePathNode refPath in project.ReferencePaths) 168 // string ret = "";
148 { 169 // if (solution.ProjectsTable.ContainsKey(refr.Name))
149 string fullPath = Helper.MakeFilePath(refPath.Path, refName); 170 // {
171 // ProjectNode project = (ProjectNode)solution.ProjectsTable[refr.Name];
172 // string finalPath = Helper.NormalizePath(((ReferencePathNode)project.ReferencePaths[0]).Path, '/');
173 // return finalPath;
174 // }
175 // else
176 // {
177 // if (refr.Path == null)
178 // {
179 // ProjectNode project = (ProjectNode) refr.Parent;
180 // string fileRef = FindFileReference(refr.Name, project);
181
182 // if (refr.Path != null || fileRef != null)
183 // {
184 // string finalPath = (refr.Path != null) ? Helper.NormalizePath(refr.Path, '/') : fileRef;
185 // ret += finalPath;
186 // return ret;
187 // }
188
189 // try
190 // {
191 // Assembly assem = Assembly.Load(refr.Name);
192 // if (assem != null)
193 // {
194 // ret += "";
195 // }
196 // else
197 // {
198 // ret += "";
199 // }
200 // }
201 // catch (System.NullReferenceException e)
202 // {
203 // e.ToString();
204 // ret += "";
205 // }
206 // }
207 // else
208 // {
209 // ret = refr.Path;
210 // }
211 // }
212 // return ret;
213 //}
214
215 private static string FindFileReference(string refName, ProjectNode project)
216 {
217 foreach (ReferencePathNode refPath in project.ReferencePaths)
218 {
219 string fullPath = Helper.MakeFilePath(refPath.Path, refName, "dll");
150 220
151 if (File.Exists(fullPath)) 221 if (File.Exists(fullPath))
152 { 222 {
153 return fullPath; 223 return fullPath;
154 } 224 }
155 225
156 fullPath = Helper.MakeFilePath(refPath.Path, refName, "dll");
157
158 if (File.Exists(fullPath))
159 {
160 return fullPath;
161 }
162
163 fullPath = Helper.MakeFilePath(refPath.Path, refName, "exe"); 226 fullPath = Helper.MakeFilePath(refPath.Path, refName, "exe");
164 227
165 if (File.Exists(fullPath)) 228 if (File.Exists(fullPath))
166 { 229 {
167 return fullPath; 230 return fullPath;
168 } 231 }
169 } 232 }
170 233
171 return null; 234 return null;
172 } 235 }
173 236
174 /// <summary> 237 /// <summary>
175 /// Gets the XML doc file. 238 /// Gets the XML doc file.
176 /// </summary> 239 /// </summary>
177 /// <param name="project">The project.</param> 240 /// <param name="project">The project.</param>
178 /// <param name="conf">The conf.</param> 241 /// <param name="conf">The conf.</param>
179 /// <returns></returns> 242 /// <returns></returns>
180 public static string GetXmlDocFile(ProjectNode project, ConfigurationNode conf) 243 public static string GetXmlDocFile(ProjectNode project, ConfigurationNode conf)
181 { 244 {
182 if (conf == null) 245 if (conf == null)
183 { 246 {
184 throw new ArgumentNullException("conf"); 247 throw new ArgumentNullException("conf");
185 } 248 }
186 if (project == null) 249 if (project == null)
187 { 250 {
188 throw new ArgumentNullException("project"); 251 throw new ArgumentNullException("project");
189 } 252 }
190 string docFile = (string)conf.Options["XmlDocFile"]; 253 string docFile = (string)conf.Options["XmlDocFile"];
191 // if(docFile != null && docFile.Length == 0)//default to assembly name if not specified 254 // if(docFile != null && docFile.Length == 0)//default to assembly name if not specified
192 // { 255 // {
193 // return Path.GetFileNameWithoutExtension(project.AssemblyName) + ".xml"; 256 // return Path.GetFileNameWithoutExtension(project.AssemblyName) + ".xml";
194 // } 257 // }
195 return docFile; 258 return docFile;
196 } 259 }
197 260
198 private void WriteProject(SolutionNode solution, ProjectNode project) 261 private void WriteProject(SolutionNode solution, ProjectNode project)
199 { 262 {
200 string projFile = Helper.MakeFilePath(project.FullPath, project.Name + GetProjectExtension(project), "build"); 263 string projFile = Helper.MakeFilePath(project.FullPath, project.Name + GetProjectExtension(project), "build");
201 StreamWriter ss = new StreamWriter(projFile); 264 StreamWriter ss = new StreamWriter(projFile);
202 265
203 m_Kernel.CurrentWorkingDirectory.Push(); 266 m_Kernel.CurrentWorkingDirectory.Push();
204 Helper.SetCurrentDir(Path.GetDirectoryName(projFile)); 267 Helper.SetCurrentDir(Path.GetDirectoryName(projFile));
205 bool hasDoc = false; 268 bool hasDoc = false;
206 269
207 using (ss) 270 using (ss)
208 { 271 {
209 ss.WriteLine("<?xml version=\"1.0\" ?>"); 272 ss.WriteLine("<?xml version=\"1.0\" ?>");
210 ss.WriteLine("<project name=\"{0}\" default=\"build\">", project.Name); 273 ss.WriteLine("<project name=\"{0}\" default=\"build\">", project.Name);
211 ss.WriteLine(" <target name=\"{0}\">", "build"); 274 ss.WriteLine(" <target name=\"{0}\">", "build");
212 ss.WriteLine(" <echo message=\"Build Directory is ${project::get-base-directory()}/${build.dir}\" />"); 275 ss.WriteLine(" <echo message=\"Build Directory is ${project::get-base-directory()}/${build.dir}\" />");
213 ss.WriteLine(" <mkdir dir=\"${project::get-base-directory()}/${build.dir}\" />"); 276 ss.WriteLine(" <mkdir dir=\"${project::get-base-directory()}/${build.dir}\" />");
214 ss.WriteLine(" <copy todir=\"${project::get-base-directory()}/${build.dir}\" flatten=\"true\">"); 277 ss.WriteLine(" <copy todir=\"${project::get-base-directory()}/${build.dir}\" flatten=\"true\">");
215 ss.WriteLine(" <fileset basedir=\"${project::get-base-directory()}\">"); 278 ss.WriteLine(" <fileset basedir=\"${project::get-base-directory()}\">");
216 foreach (ReferenceNode refr in project.References) 279 foreach (ReferenceNode refr in project.References)
217 { 280 {
218 if (refr.LocalCopy) 281 if (refr.LocalCopy)
219 { 282 {
220 ss.WriteLine(" <include name=\"{0}", Helper.NormalizePath(Helper.MakePathRelativeTo(project.FullPath, BuildReference(solution, project, refr)) + "\" />", '/')); 283 ss.WriteLine(" <include name=\"{0}", Helper.NormalizePath(Helper.MakePathRelativeTo(project.FullPath, BuildReference(solution, project, refr)) + "\" />", '/'));
221 } 284 }
222 } 285 }
223 286
224 ss.WriteLine(" </fileset>"); 287 ss.WriteLine(" </fileset>");
225 ss.WriteLine(" </copy>"); 288 ss.WriteLine(" </copy>");
226 if (project.ConfigFile != null && project.ConfigFile.Length!=0) 289 if (project.ConfigFile != null && project.ConfigFile.Length!=0)
227 { 290 {
228 ss.Write(" <copy file=\"" + project.ConfigFile + "\" tofile=\"${project::get-base-directory()}/${build.dir}/${project::get-name()}"); 291 ss.Write(" <copy file=\"" + project.ConfigFile + "\" tofile=\"${project::get-base-directory()}/${build.dir}/${project::get-name()}");
229 292
230 if (project.Type == ProjectType.Library) 293 if (project.Type == ProjectType.Library)
231 { 294 {
232 ss.Write(".dll.config\""); 295 ss.Write(".dll.config\"");
233 } 296 }
234 else 297 else
235 { 298 {
236 ss.Write(".exe.config\""); 299 ss.Write(".exe.config\"");
237 } 300 }
238 ss.WriteLine(" />"); 301 ss.WriteLine(" />");
239 } 302 }
240 303
241 // Add the content files to just be copied 304 // Add the content files to just be copied
242 ss.WriteLine(" {0}", "<copy todir=\"${project::get-base-directory()}/${build.dir}\">"); 305 ss.WriteLine(" {0}", "<copy todir=\"${project::get-base-directory()}/${build.dir}\">");
243 ss.WriteLine(" {0}", "<fileset basedir=\".\">"); 306 ss.WriteLine(" {0}", "<fileset basedir=\".\">");
244 307
245 foreach (string file in project.Files) 308 foreach (string file in project.Files)
246 { 309 {
247 // Ignore if we aren't content 310 // Ignore if we aren't content
248 if (project.Files.GetBuildAction(file) != BuildAction.Content) 311 if (project.Files.GetBuildAction(file) != BuildAction.Content)
249 continue; 312 continue;
250 313
251 // Create a include tag 314 // Create a include tag
252 ss.WriteLine(" {0}", "<include name=\"" + Helper.NormalizePath(PrependPath(file), '/') + "\" />"); 315 ss.WriteLine(" {0}", "<include name=\"" + Helper.NormalizePath(PrependPath(file), '/') + "\" />");
253 } 316 }
254 317
255 ss.WriteLine(" {0}", "</fileset>"); 318 ss.WriteLine(" {0}", "</fileset>");
256 ss.WriteLine(" {0}", "</copy>"); 319 ss.WriteLine(" {0}", "</copy>");
257 320
258 ss.Write(" <csc"); 321 ss.Write(" <csc");
259 ss.Write(" target=\"{0}\"", project.Type.ToString().ToLower()); 322 ss.Write(" target=\"{0}\"", project.Type.ToString().ToLower());
260 ss.Write(" debug=\"{0}\"", "${build.debug}"); 323 ss.Write(" debug=\"{0}\"", "${build.debug}");
261 foreach (ConfigurationNode conf in project.Configurations) 324 foreach (ConfigurationNode conf in project.Configurations)
262 { 325 {
263 if (conf.Options.KeyFile != "") 326 if (conf.Options.KeyFile != "")
264 { 327 {
265 ss.Write(" keyfile=\"{0}\"", conf.Options.KeyFile); 328 ss.Write(" keyfile=\"{0}\"", conf.Options.KeyFile);
266 break; 329 break;
267 } 330 }
268 } 331 }
269 foreach (ConfigurationNode conf in project.Configurations) 332 foreach (ConfigurationNode conf in project.Configurations)
270 {
271 ss.Write(" unsafe=\"{0}\"", conf.Options.AllowUnsafe);
272 break;
273 }
274 foreach (ConfigurationNode conf in project.Configurations)
275 {
276 ss.Write(" warnaserror=\"{0}\"", conf.Options.WarningsAsErrors);
277 break;
278 }
279 foreach (ConfigurationNode conf in project.Configurations)
280 {
281 ss.Write(" define=\"{0}\"", conf.Options.CompilerDefines);
282 break;
283 }
284 foreach (ConfigurationNode conf in project.Configurations)
285 {
286 ss.Write(" nostdlib=\"{0}\"", conf.Options["NoStdLib"]);
287 break;
288 }
289
290 ss.Write(" main=\"{0}\"", project.StartupObject);
291
292 foreach (ConfigurationNode conf in project.Configurations)
293 {
294 if (GetXmlDocFile(project, conf) != "")
295 {
296 ss.Write(" doc=\"{0}\"", "${project::get-base-directory()}/${build.dir}/" + GetXmlDocFile(project, conf));
297 hasDoc = true;
298 }
299 break;
300 }
301 ss.Write(" output=\"{0}", "${project::get-base-directory()}/${build.dir}/${project::get-name()}");
302 if (project.Type == ProjectType.Library)
303 {
304 ss.Write(".dll\"");
305 }
306 else
307 {
308 ss.Write(".exe\"");
309 }
310 if (project.AppIcon != null && project.AppIcon.Length != 0)
311 {
312 ss.Write(" win32icon=\"{0}\"", Helper.NormalizePath(project.AppIcon, '/'));
313 }
314 ss.WriteLine(">");
315 ss.WriteLine(" <resources prefix=\"{0}\" dynamicprefix=\"true\" >", project.RootNamespace);
316 foreach (string file in project.Files)
317 {
318 switch (project.Files.GetBuildAction(file))
319 {
320 case BuildAction.EmbeddedResource:
321 ss.WriteLine(" {0}", "<include name=\"" + Helper.NormalizePath(PrependPath(file), '/') + "\" />");
322 break;
323 default:
324 if (project.Files.GetSubType(file) != SubType.Code && project.Files.GetSubType(file) != SubType.Settings)
325 {
326 ss.WriteLine(" <include name=\"{0}\" />", file.Substring(0, file.LastIndexOf('.')) + ".resx");
327 }
328 break;
329 }
330 }
331 //if (project.Files.GetSubType(file).ToString() != "Code")
332 //{
333 // ps.WriteLine(" <EmbeddedResource Include=\"{0}\">", file.Substring(0, file.LastIndexOf('.')) + ".resx");
334
335 ss.WriteLine(" </resources>");
336 ss.WriteLine(" <sources failonempty=\"true\">");
337 foreach (string file in project.Files)
338 {
339 switch (project.Files.GetBuildAction(file))
340 {
341 case BuildAction.Compile:
342 ss.WriteLine(" <include name=\"" + Helper.NormalizePath(PrependPath(file), '/') + "\" />");
343 break;
344 default:
345 break;
346 }
347 }
348 ss.WriteLine(" </sources>");
349 ss.WriteLine(" <references basedir=\"${project::get-base-directory()}\">");
350 ss.WriteLine(" <lib>");
351 ss.WriteLine(" <include name=\"${project::get-base-directory()}\" />");
352 foreach(ReferencePathNode refPath in project.ReferencePaths)
353 { 333 {
354 ss.WriteLine(" <include name=\"${project::get-base-directory()}/" + refPath.Path.TrimEnd('/', '\\') + "\" />"); 334 ss.Write(" unsafe=\"{0}\"", conf.Options.AllowUnsafe);
335 break;
355 } 336 }
356 ss.WriteLine(" </lib>"); 337 foreach (ConfigurationNode conf in project.Configurations)
357 foreach (ReferenceNode refr in project.References) 338 {
358 { 339 ss.Write(" warnaserror=\"{0}\"", conf.Options.WarningsAsErrors);
359 string path = Helper.NormalizePath(Helper.MakePathRelativeTo(project.FullPath, BuildReference(solution, project, refr)), '/'); 340 break;
341 }
342 foreach (ConfigurationNode conf in project.Configurations)
343 {
344 ss.Write(" define=\"{0}\"", conf.Options.CompilerDefines);
345 break;
346 }
347 ss.Write(" main=\"{0}\"", project.StartupObject);
348
349 foreach (ConfigurationNode conf in project.Configurations)
350 {
351 if (GetXmlDocFile(project, conf) != "")
352 {
353 ss.Write(" doc=\"{0}\"", "${project::get-base-directory()}/${build.dir}/" + GetXmlDocFile(project, conf));
354 hasDoc = true;
355 }
356 break;
357 }
358 ss.Write(" output=\"{0}", "${project::get-base-directory()}/${build.dir}/${project::get-name()}");
359 if (project.Type == ProjectType.Library)
360 {
361 ss.Write(".dll\"");
362 }
363 else
364 {
365 ss.Write(".exe\"");
366 }
367 if (project.AppIcon != null && project.AppIcon.Length != 0)
368 {
369 ss.Write(" win32icon=\"{0}\"", Helper.NormalizePath(project.AppIcon, '/'));
370 }
371 ss.WriteLine(">");
372 ss.WriteLine(" <resources prefix=\"{0}\" dynamicprefix=\"true\" >", project.RootNamespace);
373 foreach (string file in project.Files)
374 {
375 switch (project.Files.GetBuildAction(file))
376 {
377 case BuildAction.EmbeddedResource:
378 ss.WriteLine(" {0}", "<include name=\"" + Helper.NormalizePath(PrependPath(file), '/') + "\" />");
379 break;
380 default:
381 if (project.Files.GetSubType(file) != SubType.Code && project.Files.GetSubType(file) != SubType.Settings)
382 {
383 ss.WriteLine(" <include name=\"{0}\" />", file.Substring(0, file.LastIndexOf('.')) + ".resx");
384 }
385 break;
386 }
387 }
388 //if (project.Files.GetSubType(file).ToString() != "Code")
389 //{
390 // ps.WriteLine(" <EmbeddedResource Include=\"{0}\">", file.Substring(0, file.LastIndexOf('.')) + ".resx");
391
392 ss.WriteLine(" </resources>");
393 ss.WriteLine(" <sources failonempty=\"true\">");
394 foreach (string file in project.Files)
395 {
396 switch (project.Files.GetBuildAction(file))
397 {
398 case BuildAction.Compile:
399 ss.WriteLine(" <include name=\"" + Helper.NormalizePath(PrependPath(file), '/') + "\" />");
400 break;
401 default:
402 break;
403 }
404 }
405 ss.WriteLine(" </sources>");
406 ss.WriteLine(" <references basedir=\"${project::get-base-directory()}\">");
407 ss.WriteLine(" <lib>");
408 ss.WriteLine(" <include name=\"${project::get-base-directory()}\" />");
409 ss.WriteLine(" <include name=\"${project::get-base-directory()}/${build.dir}\" />");
410 ss.WriteLine(" </lib>");
411 foreach (ReferenceNode refr in project.References)
412 {
413 string path = Helper.NormalizePath(Helper.MakePathRelativeTo(project.FullPath, BuildReference(solution, project, refr)), '/');
360 ss.WriteLine(" <include name=\"" + path + "\" />"); 414 ss.WriteLine(" <include name=\"" + path + "\" />");
361 } 415 }
362 ss.WriteLine(" </references>"); 416 ss.WriteLine(" </references>");
363 417
364 ss.WriteLine(" </csc>"); 418 ss.WriteLine(" </csc>");
365 419
366 foreach (ConfigurationNode conf in project.Configurations) 420 foreach (ConfigurationNode conf in project.Configurations)
367 { 421 {
368 if (!String.IsNullOrEmpty(conf.Options.OutputPath)) 422 if (!String.IsNullOrEmpty(conf.Options.OutputPath))
369 { 423 {
@@ -378,160 +432,149 @@ namespace Prebuild.Core.Targets
378 ss.WriteLine(" <include name=\"*.dll\"/>"); 432 ss.WriteLine(" <include name=\"*.dll\"/>");
379 ss.WriteLine(" <include name=\"*.exe\"/>"); 433 ss.WriteLine(" <include name=\"*.exe\"/>");
380 ss.WriteLine(" <include name=\"*.mdb\" if='${build.debug}'/>"); 434 ss.WriteLine(" <include name=\"*.mdb\" if='${build.debug}'/>");
381 ss.WriteLine(" <include name=\"*.pdb\" if='${build.debug}'/>");
382 ss.WriteLine(" </fileset>"); 435 ss.WriteLine(" </fileset>");
383 ss.WriteLine(" </copy>"); 436 ss.WriteLine(" </copy>");
384 break; 437 break;
385 } 438 }
386 } 439 }
387 440
388 ss.WriteLine(" </target>"); 441 ss.WriteLine(" </target>");
389 442
390 ss.WriteLine(" <target name=\"clean\">"); 443 ss.WriteLine(" <target name=\"clean\">");
391 ss.WriteLine(" <delete dir=\"${bin.dir}\" failonerror=\"false\" />"); 444 ss.WriteLine(" <delete dir=\"${obj.dir}\" failonerror=\"false\" />");
392 ss.WriteLine(" <delete dir=\"${obj.dir}\" failonerror=\"false\" />"); 445 ss.WriteLine(" <delete dir=\"${bin.dir}\" failonerror=\"false\" />");
393 ss.WriteLine(" </target>"); 446 ss.WriteLine(" </target>");
394 447
395 ss.WriteLine(" <target name=\"doc\" description=\"Creates documentation.\">"); 448 ss.WriteLine(" <target name=\"doc\" description=\"Creates documentation.\">");
396 if (hasDoc) 449 if (hasDoc)
397 { 450 {
398 ss.WriteLine(" <property name=\"doc.target\" value=\"\" />"); 451 ss.WriteLine(" <property name=\"doc.target\" value=\"\" />");
399 ss.WriteLine(" <if test=\"${platform::is-unix()}\">"); 452 ss.WriteLine(" <if test=\"${platform::is-unix()}\">");
400 ss.WriteLine(" <property name=\"doc.target\" value=\"Web\" />"); 453 ss.WriteLine(" <property name=\"doc.target\" value=\"Web\" />");
401 ss.WriteLine(" </if>"); 454 ss.WriteLine(" </if>");
402 ss.WriteLine(" <ndoc failonerror=\"false\" verbose=\"true\">"); 455 ss.WriteLine(" <ndoc failonerror=\"false\" verbose=\"true\">");
403 ss.WriteLine(" <assemblies basedir=\"${project::get-base-directory()}\">"); 456 ss.WriteLine(" <assemblies basedir=\"${project::get-base-directory()}\">");
404 ss.Write(" <include name=\"${build.dir}/${project::get-name()}"); 457 ss.Write(" <include name=\"${build.dir}/${project::get-name()}");
405 if (project.Type == ProjectType.Library) 458 if (project.Type == ProjectType.Library)
406 { 459 {
407 ss.WriteLine(".dll\" />"); 460 ss.WriteLine(".dll\" />");
408 } 461 }
409 else 462 else
410 { 463 {
411 ss.WriteLine(".exe\" />"); 464 ss.WriteLine(".exe\" />");
412 } 465 }
413 466
414 ss.WriteLine(" </assemblies>"); 467 ss.WriteLine(" </assemblies>");
415 ss.WriteLine(" <summaries basedir=\"${project::get-base-directory()}\">"); 468 ss.WriteLine(" <summaries basedir=\"${project::get-base-directory()}\">");
416 ss.WriteLine(" <include name=\"${build.dir}/${project::get-name()}.xml\"/>"); 469 ss.WriteLine(" <include name=\"${build.dir}/${project::get-name()}.xml\"/>");
417 ss.WriteLine(" </summaries>"); 470 ss.WriteLine(" </summaries>");
418 ss.WriteLine(" <referencepaths basedir=\"${project::get-base-directory()}\">"); 471 ss.WriteLine(" <referencepaths basedir=\"${project::get-base-directory()}\">");
419 ss.WriteLine(" <include name=\"${build.dir}\" />"); 472 ss.WriteLine(" <include name=\"${build.dir}\" />");
420 // foreach(ReferenceNode refr in project.References) 473 // foreach(ReferenceNode refr in project.References)
421 // { 474 // {
422 // string path = Helper.NormalizePath(Helper.MakePathRelativeTo(project.FullPath, BuildReferencePath(solution, refr)), '/'); 475 // string path = Helper.NormalizePath(Helper.MakePathRelativeTo(project.FullPath, BuildReferencePath(solution, refr)), '/');
423 // if (path != "") 476 // if (path != "")
424 // { 477 // {
425 // ss.WriteLine(" <include name=\"{0}\" />", path); 478 // ss.WriteLine(" <include name=\"{0}\" />", path);
426 // } 479 // }
427 // } 480 // }
428 ss.WriteLine(" </referencepaths>"); 481 ss.WriteLine(" </referencepaths>");
429 ss.WriteLine(" <documenters>"); 482 ss.WriteLine(" <documenters>");
430 ss.WriteLine(" <documenter name=\"MSDN\">"); 483 ss.WriteLine(" <documenter name=\"MSDN\">");
431 ss.WriteLine(" <property name=\"OutputDirectory\" value=\"${project::get-base-directory()}/${build.dir}/doc/${project::get-name()}\" />"); 484 ss.WriteLine(" <property name=\"OutputDirectory\" value=\"${project::get-base-directory()}/${build.dir}/doc/${project::get-name()}\" />");
432 ss.WriteLine(" <property name=\"OutputTarget\" value=\"${doc.target}\" />"); 485 ss.WriteLine(" <property name=\"OutputTarget\" value=\"${doc.target}\" />");
433 ss.WriteLine(" <property name=\"HtmlHelpName\" value=\"${project::get-name()}\" />"); 486 ss.WriteLine(" <property name=\"HtmlHelpName\" value=\"${project::get-name()}\" />");
434 ss.WriteLine(" <property name=\"IncludeFavorites\" value=\"False\" />"); 487 ss.WriteLine(" <property name=\"IncludeFavorites\" value=\"False\" />");
435 ss.WriteLine(" <property name=\"Title\" value=\"${project::get-name()} SDK Documentation\" />"); 488 ss.WriteLine(" <property name=\"Title\" value=\"${project::get-name()} SDK Documentation\" />");
436 ss.WriteLine(" <property name=\"SplitTOCs\" value=\"False\" />"); 489 ss.WriteLine(" <property name=\"SplitTOCs\" value=\"False\" />");
437 ss.WriteLine(" <property name=\"DefaulTOC\" value=\"\" />"); 490 ss.WriteLine(" <property name=\"DefaulTOC\" value=\"\" />");
438 ss.WriteLine(" <property name=\"ShowVisualBasic\" value=\"True\" />"); 491 ss.WriteLine(" <property name=\"ShowVisualBasic\" value=\"True\" />");
439 ss.WriteLine(" <property name=\"AutoDocumentConstructors\" value=\"True\" />"); 492 ss.WriteLine(" <property name=\"AutoDocumentConstructors\" value=\"True\" />");
440 ss.WriteLine(" <property name=\"ShowMissingSummaries\" value=\"${build.debug}\" />"); 493 ss.WriteLine(" <property name=\"ShowMissingSummaries\" value=\"${build.debug}\" />");
441 ss.WriteLine(" <property name=\"ShowMissingRemarks\" value=\"${build.debug}\" />"); 494 ss.WriteLine(" <property name=\"ShowMissingRemarks\" value=\"${build.debug}\" />");
442 ss.WriteLine(" <property name=\"ShowMissingParams\" value=\"${build.debug}\" />"); 495 ss.WriteLine(" <property name=\"ShowMissingParams\" value=\"${build.debug}\" />");
443 ss.WriteLine(" <property name=\"ShowMissingReturns\" value=\"${build.debug}\" />"); 496 ss.WriteLine(" <property name=\"ShowMissingReturns\" value=\"${build.debug}\" />");
444 ss.WriteLine(" <property name=\"ShowMissingValues\" value=\"${build.debug}\" />"); 497 ss.WriteLine(" <property name=\"ShowMissingValues\" value=\"${build.debug}\" />");
445 ss.WriteLine(" <property name=\"DocumentInternals\" value=\"False\" />"); 498 ss.WriteLine(" <property name=\"DocumentInternals\" value=\"False\" />");
446 ss.WriteLine(" <property name=\"DocumentPrivates\" value=\"False\" />"); 499 ss.WriteLine(" <property name=\"DocumentPrivates\" value=\"False\" />");
447 ss.WriteLine(" <property name=\"DocumentProtected\" value=\"True\" />"); 500 ss.WriteLine(" <property name=\"DocumentProtected\" value=\"True\" />");
448 ss.WriteLine(" <property name=\"DocumentEmptyNamespaces\" value=\"${build.debug}\" />"); 501 ss.WriteLine(" <property name=\"DocumentEmptyNamespaces\" value=\"${build.debug}\" />");
449 ss.WriteLine(" <property name=\"IncludeAssemblyVersion\" value=\"True\" />"); 502 ss.WriteLine(" <property name=\"IncludeAssemblyVersion\" value=\"True\" />");
450 ss.WriteLine(" </documenter>"); 503 ss.WriteLine(" </documenter>");
451 ss.WriteLine(" </documenters>"); 504 ss.WriteLine(" </documenters>");
452 ss.WriteLine(" </ndoc>"); 505 ss.WriteLine(" </ndoc>");
453 } 506 }
454 ss.WriteLine(" </target>"); 507 ss.WriteLine(" </target>");
455 ss.WriteLine("</project>"); 508 ss.WriteLine("</project>");
456 } 509 }
457 m_Kernel.CurrentWorkingDirectory.Pop(); 510 m_Kernel.CurrentWorkingDirectory.Pop();
458 } 511 }
459 512
460 private void WriteCombine(SolutionNode solution) 513 private void WriteCombine(SolutionNode solution)
461 { 514 {
462 m_Kernel.Log.Write("Creating NAnt build files"); 515 m_Kernel.Log.Write("Creating NAnt build files");
463 foreach (ProjectNode project in solution.Projects) 516 foreach (ProjectNode project in solution.Projects)
464 { 517 {
465 if (m_Kernel.AllowProject(project.FilterGroups)) 518 if (m_Kernel.AllowProject(project.FilterGroups))
466 { 519 {
467 m_Kernel.Log.Write("...Creating project: {0}", project.Name); 520 m_Kernel.Log.Write("...Creating project: {0}", project.Name);
468 WriteProject(solution, project); 521 WriteProject(solution, project);
469 } 522 }
470 } 523 }
471 524
472 m_Kernel.Log.Write(""); 525 m_Kernel.Log.Write("");
473 string combFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "build"); 526 string combFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "build");
474 StreamWriter ss = new StreamWriter(combFile); 527 StreamWriter ss = new StreamWriter(combFile);
475 528
476 m_Kernel.CurrentWorkingDirectory.Push(); 529 m_Kernel.CurrentWorkingDirectory.Push();
477 Helper.SetCurrentDir(Path.GetDirectoryName(combFile)); 530 Helper.SetCurrentDir(Path.GetDirectoryName(combFile));
478 531
479 using (ss) 532 using (ss)
480 { 533 {
481 ss.WriteLine("<?xml version=\"1.0\" ?>"); 534 ss.WriteLine("<?xml version=\"1.0\" ?>");
482 ss.WriteLine("<project name=\"{0}\" default=\"build\">", solution.Name); 535 ss.WriteLine("<project name=\"{0}\" default=\"build\">", solution.Name);
483 ss.WriteLine(" <echo message=\"Using '${nant.settings.currentframework}' Framework\"/>"); 536 ss.WriteLine(" <echo message=\"Using '${nant.settings.currentframework}' Framework\"/>");
484 ss.WriteLine(); 537 ss.WriteLine();
485 538
486 //ss.WriteLine(" <property name=\"dist.dir\" value=\"dist\" />"); 539 //ss.WriteLine(" <property name=\"dist.dir\" value=\"dist\" />");
487 //ss.WriteLine(" <property name=\"source.dir\" value=\"source\" />"); 540 //ss.WriteLine(" <property name=\"source.dir\" value=\"source\" />");
488 ss.WriteLine(" <property name=\"bin.dir\" value=\"bin\" />"); 541 ss.WriteLine(" <property name=\"bin.dir\" value=\"bin\" />");
489 ss.WriteLine(" <property name=\"obj.dir\" value=\"obj\" />"); 542 ss.WriteLine(" <property name=\"obj.dir\" value=\"obj\" />");
490 ss.WriteLine(" <property name=\"doc.dir\" value=\"doc\" />"); 543 ss.WriteLine(" <property name=\"doc.dir\" value=\"doc\" />");
491 ss.WriteLine(" <property name=\"project.main.dir\" value=\"${project::get-base-directory()}\" />"); 544 ss.WriteLine(" <property name=\"project.main.dir\" value=\"${project::get-base-directory()}\" />");
492 545
493 // actually use active config out of prebuild.xml 546 // actually use active config out of prebuild.xml
494 ss.WriteLine(" <property name=\"project.config\" value=\"{0}\" />", solution.ActiveConfig); 547 ss.WriteLine(" <property name=\"project.config\" value=\"{0}\" />", solution.ActiveConfig);
495 548
496 foreach (ConfigurationNode conf in solution.Configurations) 549 foreach (ConfigurationNode conf in solution.Configurations)
497 { 550 {
498 ss.WriteLine(); 551 ss.WriteLine();
499 ss.WriteLine(" <target name=\"{0}\" description=\"\">", conf.Name); 552 ss.WriteLine(" <target name=\"{0}\" description=\"\">", conf.Name);
500 ss.WriteLine(" <property name=\"project.config\" value=\"{0}\" />", conf.Name); 553 ss.WriteLine(" <property name=\"project.config\" value=\"{0}\" />", conf.Name);
501 ss.WriteLine(" <property name=\"build.debug\" value=\"{0}\" />", conf.Options["DebugInformation"].ToString().ToLower()); 554 ss.WriteLine(" <property name=\"build.debug\" value=\"{0}\" />", conf.Options["DebugInformation"].ToString().ToLower());
502 ss.WriteLine(" </target>"); 555 ss.WriteLine(" </target>");
503 ss.WriteLine(); 556 ss.WriteLine();
504 } 557 }
505 558
506 ss.WriteLine(" <target name=\"net-1.1\" description=\"Sets framework to .NET 1.1\">"); 559 ss.WriteLine(" <target name=\"net-1.1\" description=\"Sets framework to .NET 1.1\">");
507 ss.WriteLine(" <property name=\"nant.settings.currentframework\" value=\"net-1.1\" />"); 560 ss.WriteLine(" <property name=\"nant.settings.currentframework\" value=\"net-1.1\" />");
508 ss.WriteLine(" </target>"); 561 ss.WriteLine(" </target>");
509 ss.WriteLine(); 562 ss.WriteLine();
510 563
511 ss.WriteLine(" <target name=\"net-2.0\" description=\"Sets framework to .NET 2.0\">"); 564 ss.WriteLine(" <target name=\"net-2.0\" description=\"Sets framework to .NET 2.0\">");
512 ss.WriteLine(" <property name=\"nant.settings.currentframework\" value=\"net-2.0\" />"); 565 ss.WriteLine(" <property name=\"nant.settings.currentframework\" value=\"net-2.0\" />");
513 ss.WriteLine(" </target>"); 566 ss.WriteLine(" </target>");
514 ss.WriteLine(); 567 ss.WriteLine();
515 568
516 ss.WriteLine(" <target name=\"net-3.5\" description=\"Sets framework to .NET 3.5\">"); 569 ss.WriteLine(" <target name=\"mono-2.0\" description=\"Sets framework to mono 2.0\">");
517 ss.WriteLine(" <property name=\"nant.settings.currentframework\" value=\"net-3.5\" />"); 570 ss.WriteLine(" <property name=\"nant.settings.currentframework\" value=\"mono-2.0\" />");
518 ss.WriteLine(" </target>"); 571 ss.WriteLine(" </target>");
519 ss.WriteLine(); 572 ss.WriteLine();
520 573
521 ss.WriteLine(" <target name=\"mono-1.0\" description=\"Sets framework to mono 1.0\">"); 574 ss.WriteLine(" <target name=\"mono-1.0\" description=\"Sets framework to mono 1.0\">");
522 ss.WriteLine(" <property name=\"nant.settings.currentframework\" value=\"mono-1.0\" />"); 575 ss.WriteLine(" <property name=\"nant.settings.currentframework\" value=\"mono-1.0\" />");
523 ss.WriteLine(" </target>"); 576 ss.WriteLine(" </target>");
524 ss.WriteLine(); 577 ss.WriteLine();
525
526 ss.WriteLine(" <target name=\"mono-2.0\" description=\"Sets framework to mono 2.0\">");
527 ss.WriteLine(" <property name=\"nant.settings.currentframework\" value=\"mono-2.0\" />");
528 ss.WriteLine(" </target>");
529 ss.WriteLine();
530
531 ss.WriteLine(" <target name=\"mono-3.5\" description=\"Sets framework to mono 3.5\">");
532 ss.WriteLine(" <property name=\"nant.settings.currentframework\" value=\"mono-3.5\" />");
533 ss.WriteLine(" </target>");
534 ss.WriteLine();
535 578
536 ss.WriteLine(" <target name=\"init\" description=\"\">"); 579 ss.WriteLine(" <target name=\"init\" description=\"\">");
537 ss.WriteLine(" <call target=\"${project.config}\" />"); 580 ss.WriteLine(" <call target=\"${project.config}\" />");
diff --git a/Prebuild/src/Core/Targets/SharpDevelop2Target.cs b/Prebuild/src/Core/Targets/SharpDevelop2Target.cs
index 66dd1bc..0d78796 100644
--- a/Prebuild/src/Core/Targets/SharpDevelop2Target.cs
+++ b/Prebuild/src/Core/Targets/SharpDevelop2Target.cs
@@ -23,6 +23,15 @@ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY O
23*/ 23*/
24#endregion 24#endregion
25 25
26#region CVS Information
27/*
28 * $Source$
29 * $Author: jendave $
30 * $Date: 2006-01-27 16:49:58 -0800 (Fri, 27 Jan 2006) $
31 * $Revision: 71 $
32 */
33#endregion
34
26using System; 35using System;
27 36
28using Prebuild.Core.Attributes; 37using Prebuild.Core.Attributes;
@@ -34,38 +43,18 @@ namespace Prebuild.Core.Targets
34 /// </summary> 43 /// </summary>
35 [Target("sharpdev2")] 44 [Target("sharpdev2")]
36 public class SharpDevelop2Target : VS2005Target 45 public class SharpDevelop2Target : VS2005Target
37 { 46 {
38 #region Properties 47 protected override string VersionName
39 public override string VersionName
40 { 48 {
41 get 49 get
42 { 50 {
43 return "SharpDevelop2"; 51 return "SharpDevelop2";
44 } 52 }
45 } 53 }
46 #endregion
47 54
48 #region Public Methods 55 #region Public Methods
49 56
50 /// <summary> 57 /// <summary>
51 /// Writes the specified kern.
52 /// </summary>
53 /// <param name="kern">The kern.</param>
54 public override void Write(Kernel kern)
55 {
56 base.Write(kern);
57 }
58
59 /// <summary>
60 /// Cleans the specified kern.
61 /// </summary>
62 /// <param name="kern">The kern.</param>
63 public override void Clean(Kernel kern)
64 {
65 base.Clean(kern);
66 }
67
68 /// <summary>
69 /// Gets the name. 58 /// Gets the name.
70 /// </summary> 59 /// </summary>
71 /// <value>The name.</value> 60 /// <value>The name.</value>
diff --git a/Prebuild/src/Core/Targets/SharpDevelopTarget.cs b/Prebuild/src/Core/Targets/SharpDevelopTarget.cs
index cf7ce02..6fe038b 100644
--- a/Prebuild/src/Core/Targets/SharpDevelopTarget.cs
+++ b/Prebuild/src/Core/Targets/SharpDevelopTarget.cs
@@ -23,6 +23,15 @@ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY O
23*/ 23*/
24#endregion 24#endregion
25 25
26#region CVS Information
27/*
28 * $Source$
29 * $Author: jendave $
30 * $Date: 2007-02-14 05:58:03 +0900 (Wed, 14 Feb 2007) $
31 * $Revision: 205 $
32 */
33#endregion
34
26using System; 35using System;
27using System.Collections; 36using System.Collections;
28using System.Collections.Specialized; 37using System.Collections.Specialized;
diff --git a/Prebuild/src/Core/Targets/ToolInfo.cs b/Prebuild/src/Core/Targets/ToolInfo.cs
deleted file mode 100644
index 935c674..0000000
--- a/Prebuild/src/Core/Targets/ToolInfo.cs
+++ /dev/null
@@ -1,197 +0,0 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4
5namespace Prebuild.Core.Targets
6{
7 /// <summary>
8 ///
9 /// </summary>
10 public struct ToolInfo
11 {
12 string name;
13 string guid;
14 string fileExtension;
15 string xmlTag;
16 string importProject;
17
18 /// <summary>
19 /// Gets or sets the name.
20 /// </summary>
21 /// <value>The name.</value>
22 public string Name
23 {
24 get
25 {
26 return name;
27 }
28 set
29 {
30 name = value;
31 }
32 }
33
34 /// <summary>
35 /// Gets or sets the GUID.
36 /// </summary>
37 /// <value>The GUID.</value>
38 public string Guid
39 {
40 get
41 {
42 return guid;
43 }
44 set
45 {
46 guid = value;
47 }
48 }
49
50 /// <summary>
51 /// Gets or sets the file extension.
52 /// </summary>
53 /// <value>The file extension.</value>
54 public string FileExtension
55 {
56 get
57 {
58 return fileExtension;
59 }
60 set
61 {
62 fileExtension = value;
63 }
64 }
65 public string LanguageExtension
66 {
67 get
68 {
69 switch (this.Name)
70 {
71 case "C#":
72 return ".cs";
73 case "VisualBasic":
74 return ".vb";
75 case "Boo":
76 return ".boo";
77 default:
78 return ".cs";
79 }
80 }
81 }
82 /// <summary>
83 /// Gets or sets the XML tag.
84 /// </summary>
85 /// <value>The XML tag.</value>
86 public string XmlTag
87 {
88 get
89 {
90 return xmlTag;
91 }
92 set
93 {
94 xmlTag = value;
95 }
96 }
97
98 /// <summary>
99 /// Gets or sets the import project property.
100 /// </summary>
101 /// <value>The ImportProject tag.</value>
102 public string ImportProject
103 {
104 get
105 {
106 return importProject;
107 }
108 set
109 {
110 importProject = value;
111 }
112 }
113
114 /// <summary>
115 /// Initializes a new instance of the <see cref="ToolInfo"/> class.
116 /// </summary>
117 /// <param name="name">The name.</param>
118 /// <param name="guid">The GUID.</param>
119 /// <param name="fileExtension">The file extension.</param>
120 /// <param name="xml">The XML.</param>
121 /// <param name="importProject">The import project.</param>
122 public ToolInfo(string name, string guid, string fileExtension, string xml, string importProject)
123 {
124 this.name = name;
125 this.guid = guid;
126 this.fileExtension = fileExtension;
127 this.xmlTag = xml;
128 this.importProject = importProject;
129 }
130
131 /// <summary>
132 /// Initializes a new instance of the <see cref="ToolInfo"/> class.
133 /// </summary>
134 /// <param name="name">The name.</param>
135 /// <param name="guid">The GUID.</param>
136 /// <param name="fileExtension">The file extension.</param>
137 /// <param name="xml">The XML.</param>
138 public ToolInfo(string name, string guid, string fileExtension, string xml)
139 {
140 this.name = name;
141 this.guid = guid;
142 this.fileExtension = fileExtension;
143 this.xmlTag = xml;
144 this.importProject = "$(MSBuildBinPath)\\Microsoft." + xml + ".Targets";
145 }
146
147 /// <summary>
148 /// Equals operator
149 /// </summary>
150 /// <param name="obj">ToolInfo to compare</param>
151 /// <returns>true if toolInfos are equal</returns>
152 public override bool Equals(object obj)
153 {
154 if (obj == null)
155 {
156 throw new ArgumentNullException("obj");
157 }
158 if (obj.GetType() != typeof(ToolInfo))
159 return false;
160
161 ToolInfo c = (ToolInfo)obj;
162 return ((this.name == c.name) && (this.guid == c.guid) && (this.fileExtension == c.fileExtension) && (this.importProject == c.importProject));
163 }
164
165 /// <summary>
166 /// Equals operator
167 /// </summary>
168 /// <param name="c1">ToolInfo to compare</param>
169 /// <param name="c2">ToolInfo to compare</param>
170 /// <returns>True if toolInfos are equal</returns>
171 public static bool operator ==(ToolInfo c1, ToolInfo c2)
172 {
173 return ((c1.name == c2.name) && (c1.guid == c2.guid) && (c1.fileExtension == c2.fileExtension) && (c1.importProject == c2.importProject) && (c1.xmlTag == c2.xmlTag));
174 }
175
176 /// <summary>
177 /// Not equals operator
178 /// </summary>
179 /// <param name="c1">ToolInfo to compare</param>
180 /// <param name="c2">ToolInfo to compare</param>
181 /// <returns>True if toolInfos are not equal</returns>
182 public static bool operator !=(ToolInfo c1, ToolInfo c2)
183 {
184 return !(c1 == c2);
185 }
186
187 /// <summary>
188 /// Hash Code
189 /// </summary>
190 /// <returns>Hash code</returns>
191 public override int GetHashCode()
192 {
193 return name.GetHashCode() ^ guid.GetHashCode() ^ this.fileExtension.GetHashCode() ^ this.importProject.GetHashCode() ^ this.xmlTag.GetHashCode();
194
195 }
196 }
197}
diff --git a/Prebuild/src/Core/Targets/VS2002Target.cs b/Prebuild/src/Core/Targets/VS2002Target.cs
index 2292624..7067cf3 100644
--- a/Prebuild/src/Core/Targets/VS2002Target.cs
+++ b/Prebuild/src/Core/Targets/VS2002Target.cs
@@ -23,6 +23,15 @@ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY O
23*/ 23*/
24#endregion 24#endregion
25 25
26#region CVS Information
27/*
28 * $Source$
29 * $Author: jendave $
30 * $Date: 2006-01-28 09:49:58 +0900 (Sat, 28 Jan 2006) $
31 * $Revision: 71 $
32 */
33#endregion
34
26using System; 35using System;
27 36
28using Prebuild.Core.Attributes; 37using Prebuild.Core.Attributes;
diff --git a/Prebuild/src/Core/Targets/VS2003Target.cs b/Prebuild/src/Core/Targets/VS2003Target.cs
index 1bcb7dc..4bf05cb 100644
--- a/Prebuild/src/Core/Targets/VS2003Target.cs
+++ b/Prebuild/src/Core/Targets/VS2003Target.cs
@@ -23,6 +23,15 @@ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY O
23*/ 23*/
24#endregion 24#endregion
25 25
26#region CVS Information
27/*
28 * $Source$
29 * $Author: jendave $
30 * $Date: 2006-09-30 04:11:40 +0900 (Sat, 30 Sep 2006) $
31 * $Revision: 177 $
32 */
33#endregion
34
26using System; 35using System;
27using System.Collections; 36using System.Collections;
28using System.Collections.Specialized; 37using System.Collections.Specialized;
@@ -35,6 +44,28 @@ using Prebuild.Core.Utilities;
35 44
36namespace Prebuild.Core.Targets 45namespace Prebuild.Core.Targets
37{ 46{
47 /// <summary>
48 ///
49 /// </summary>
50 public enum VSVersion
51 {
52 /// <summary>
53 ///
54 /// </summary>
55 VS70,
56 /// <summary>
57 ///
58 /// </summary>
59 VS71,
60 /// <summary>
61 ///
62 /// </summary>
63 VS80
64 }
65
66 /// <summary>
67 ///
68 /// </summary>
38 [Target("vs2003")] 69 [Target("vs2003")]
39 public class VS2003Target : ITarget 70 public class VS2003Target : ITarget
40 { 71 {
diff --git a/Prebuild/src/Core/Targets/VS2005Target.cs b/Prebuild/src/Core/Targets/VS2005Target.cs
index 63461c9..5b7ad07 100644
--- a/Prebuild/src/Core/Targets/VS2005Target.cs
+++ b/Prebuild/src/Core/Targets/VS2005Target.cs
@@ -23,6 +23,15 @@ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY O
23*/ 23*/
24#endregion 24#endregion
25 25
26#region CVS Information
27/*
28 * $Source$
29 * $Author: borrillis $
30 * $Date: 2007-05-25 01:03:16 +0900 (Fri, 25 May 2007) $
31 * $Revision: 243 $
32 */
33#endregion
34
26using System; 35using System;
27using System.Collections; 36using System.Collections;
28using System.Collections.Specialized; 37using System.Collections.Specialized;
@@ -39,8 +48,182 @@ namespace Prebuild.Core.Targets
39 /// <summary> 48 /// <summary>
40 /// 49 ///
41 /// </summary> 50 /// </summary>
51 public struct ToolInfo
52 {
53 string name;
54 string guid;
55 string fileExtension;
56 string xmlTag;
57 string importProject;
58
59 /// <summary>
60 /// Gets or sets the name.
61 /// </summary>
62 /// <value>The name.</value>
63 public string Name
64 {
65 get
66 {
67 return name;
68 }
69 set
70 {
71 name = value;
72 }
73 }
74
75 /// <summary>
76 /// Gets or sets the GUID.
77 /// </summary>
78 /// <value>The GUID.</value>
79 public string Guid
80 {
81 get
82 {
83 return guid;
84 }
85 set
86 {
87 guid = value;
88 }
89 }
90
91 /// <summary>
92 /// Gets or sets the file extension.
93 /// </summary>
94 /// <value>The file extension.</value>
95 public string FileExtension
96 {
97 get
98 {
99 return fileExtension;
100 }
101 set
102 {
103 fileExtension = value;
104 }
105 }
106 /// <summary>
107 /// Gets or sets the XML tag.
108 /// </summary>
109 /// <value>The XML tag.</value>
110 public string XmlTag
111 {
112 get
113 {
114 return xmlTag;
115 }
116 set
117 {
118 xmlTag = value;
119 }
120 }
121
122 /// <summary>
123 /// Gets or sets the import project property.
124 /// </summary>
125 /// <value>The ImportProject tag.</value>
126 public string ImportProject
127 {
128 get
129 {
130 return importProject;
131 }
132 set
133 {
134 importProject = value;
135 }
136 }
137
138 /// <summary>
139 /// Initializes a new instance of the <see cref="ToolInfo"/> class.
140 /// </summary>
141 /// <param name="name">The name.</param>
142 /// <param name="guid">The GUID.</param>
143 /// <param name="fileExtension">The file extension.</param>
144 /// <param name="xml">The XML.</param>
145 /// <param name="importProject">The import project.</param>
146 public ToolInfo(string name, string guid, string fileExtension, string xml, string importProject)
147 {
148 this.name = name;
149 this.guid = guid;
150 this.fileExtension = fileExtension;
151 this.xmlTag = xml;
152 this.importProject = importProject;
153 }
154
155 /// <summary>
156 /// Initializes a new instance of the <see cref="ToolInfo"/> class.
157 /// </summary>
158 /// <param name="name">The name.</param>
159 /// <param name="guid">The GUID.</param>
160 /// <param name="fileExtension">The file extension.</param>
161 /// <param name="xml">The XML.</param>
162 public ToolInfo(string name, string guid, string fileExtension, string xml)
163 {
164 this.name = name;
165 this.guid = guid;
166 this.fileExtension = fileExtension;
167 this.xmlTag = xml;
168 this.importProject = "$(MSBuildBinPath)\\Microsoft." + xml + ".Targets";
169 }
170
171 /// <summary>
172 /// Equals operator
173 /// </summary>
174 /// <param name="obj">ToolInfo to compare</param>
175 /// <returns>true if toolInfos are equal</returns>
176 public override bool Equals(object obj)
177 {
178 if (obj == null)
179 {
180 throw new ArgumentNullException("obj");
181 }
182 if (obj.GetType() != typeof(ToolInfo))
183 return false;
184
185 ToolInfo c = (ToolInfo)obj;
186 return ((this.name == c.name) && (this.guid == c.guid) && (this.fileExtension == c.fileExtension) && (this.importProject == c.importProject));
187 }
188
189 /// <summary>
190 /// Equals operator
191 /// </summary>
192 /// <param name="c1">ToolInfo to compare</param>
193 /// <param name="c2">ToolInfo to compare</param>
194 /// <returns>True if toolInfos are equal</returns>
195 public static bool operator ==(ToolInfo c1, ToolInfo c2)
196 {
197 return ((c1.name == c2.name) && (c1.guid == c2.guid) && (c1.fileExtension == c2.fileExtension) && (c1.importProject == c2.importProject) && (c1.xmlTag == c2.xmlTag));
198 }
199
200 /// <summary>
201 /// Not equals operator
202 /// </summary>
203 /// <param name="c1">ToolInfo to compare</param>
204 /// <param name="c2">ToolInfo to compare</param>
205 /// <returns>True if toolInfos are not equal</returns>
206 public static bool operator !=(ToolInfo c1, ToolInfo c2)
207 {
208 return !(c1 == c2);
209 }
210
211 /// <summary>
212 /// Hash Code
213 /// </summary>
214 /// <returns>Hash code</returns>
215 public override int GetHashCode()
216 {
217 return name.GetHashCode() ^ guid.GetHashCode() ^ this.fileExtension.GetHashCode() ^ this.importProject.GetHashCode() ^ this.xmlTag.GetHashCode();
218
219 }
220 }
221
222 /// <summary>
223 ///
224 /// </summary>
42 [Target("vs2005")] 225 [Target("vs2005")]
43 public class VS2005Target : VSGenericTarget 226 public class VS2005Target : ITarget
44 { 227 {
45 #region Inner Classes 228 #region Inner Classes
46 229
@@ -48,100 +231,694 @@ namespace Prebuild.Core.Targets
48 231
49 #region Fields 232 #region Fields
50 233
51 string solutionVersion = "9.00";
52 string productVersion = "8.0.50727";
53 string schemaVersion = "2.0"; 234 string schemaVersion = "2.0";
54 string versionName = "Visual C# 2005";
55 string name = "vs2005";
56
57 VSVersion version = VSVersion.VS80; 235 VSVersion version = VSVersion.VS80;
58 236
59 public override string SolutionTag 237 Hashtable tools;
238 Kernel kernel;
239
240 protected virtual string ToolsVersionXml
60 { 241 {
61 get { return "# Visual Studio 2005"; } 242 get
243 {
244 return String.Empty;
245 }
62 } 246 }
63 247
64 protected override string GetToolsVersionXml(FrameworkVersion frameworkVersion) 248 protected virtual string SolutionTag
65 { 249 {
66 return string.Empty; 250 get { return "# Visual Studio 2005"; }
67 } 251 }
252
68 /// <summary> 253 /// <summary>
69 /// Gets or sets the solution version. 254 /// Gets or sets the solution version.
70 /// </summary> 255 /// </summary>
71 /// <value>The solution version.</value> 256 /// <value>The solution version.</value>
72 public override string SolutionVersion 257 protected virtual string SolutionVersion
73 { 258 {
74 get 259 get
75 { 260 {
76 return solutionVersion; 261 return "9.00";
77 } 262 }
78 } 263 }
264
79 /// <summary> 265 /// <summary>
80 /// Gets or sets the product version. 266 /// Gets or sets the product version.
81 /// </summary> 267 /// </summary>
82 /// <value>The product version.</value> 268 /// <value>The product version.</value>
83 public override string ProductVersion 269 protected virtual string ProductVersion
84 { 270 {
85 get 271 get
86 { 272 {
87 return productVersion; 273 return "8.0.50727";
88 } 274 }
89 } 275 }
276
90 /// <summary> 277 /// <summary>
91 /// Gets or sets the schema version. 278 /// Gets or sets the schema version.
92 /// </summary> 279 /// </summary>
93 /// <value>The schema version.</value> 280 /// <value>The schema version.</value>
94 public override string SchemaVersion 281 protected string SchemaVersion
95 { 282 {
96 get 283 get
97 { 284 {
98 return schemaVersion; 285 return this.schemaVersion;
286 }
287 set
288 {
289 this.schemaVersion = value;
99 } 290 }
100 } 291 }
292
101 /// <summary> 293 /// <summary>
102 /// Gets or sets the name of the version. 294 /// Gets or sets the name of the version.
103 /// </summary> 295 /// </summary>
104 /// <value>The name of the version.</value> 296 /// <value>The name of the version.</value>
105 public override string VersionName 297 protected virtual string VersionName
106 { 298 {
107 get 299 get
108 { 300 {
109 return versionName; 301 return "Visual C# 2005";
110 } 302 }
111 } 303 }
304
112 /// <summary> 305 /// <summary>
113 /// Gets or sets the version. 306 /// Gets or sets the version.
114 /// </summary> 307 /// </summary>
115 /// <value>The version.</value> 308 /// <value>The version.</value>
116 public override VSVersion Version 309 protected VSVersion Version
117 { 310 {
118 get 311 get
119 { 312 {
120 return version; 313 return this.version;
314 }
315 set
316 {
317 this.version = value;
121 } 318 }
122 } 319 }
320
321 #endregion
322
323 #region Constructors
324
123 /// <summary> 325 /// <summary>
124 /// Gets the name. 326 /// Initializes a new instance of the <see cref="VS2005Target"/> class.
125 /// </summary> 327 /// </summary>
126 /// <value>The name.</value> 328 public VS2005Target()
127 public override string Name
128 { 329 {
129 get 330 this.tools = new Hashtable();
331
332 this.tools["C#"] = new ToolInfo("C#", "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}", "csproj", "CSHARP", "$(MSBuildBinPath)\\Microsoft.CSHARP.Targets");
333 this.tools["Boo"] = new ToolInfo("Boo", "{45CEA7DC-C2ED-48A6-ACE0-E16144C02365}", "booproj", "Boo", "$(BooBinPath)\\Boo.Microsoft.Build.targets");
334 this.tools["VisualBasic"] = new ToolInfo("VisualBasic", "{F184B08F-C81C-45F6-A57F-5ABD9991F28F}", "vbproj", "VisualBasic", "$(MSBuildBinPath)\\Microsoft.VisualBasic.Targets");
335 }
336
337 #endregion
338
339 #region Private Methods
340
341 private string MakeRefPath(ProjectNode project)
342 {
343 string ret = "";
344 foreach (ReferencePathNode node in project.ReferencePaths)
130 { 345 {
131 return name; 346 try
347 {
348 string fullPath = Helper.ResolvePath(node.Path);
349 if (ret.Length < 1)
350 {
351 ret = fullPath;
352 }
353 else
354 {
355 ret += ";" + fullPath;
356 }
357 }
358 catch (ArgumentException)
359 {
360 this.kernel.Log.Write(LogType.Warning, "Could not resolve reference path: {0}", node.Path);
361 }
362 }
363
364 return ret;
365 }
366
367 private static bool ExtensionSpecified(string refName)
368 {
369 return refName.EndsWith(".dll") || refName.EndsWith(".exe");
370 }
371
372 private static string GetProjectExtension(ProjectNode project)
373 {
374 string extension = ".dll";
375 if (project.Type == ProjectType.Exe)
376 {
377 extension = ".exe";
378 }
379 return extension;
380 }
381
382 private void WriteProject(SolutionNode solution, ProjectNode project)
383 {
384 if (!tools.ContainsKey(project.Language))
385 {
386 throw new UnknownLanguageException("Unknown .NET language: " + project.Language);
387 }
388
389 ToolInfo toolInfo = (ToolInfo)tools[project.Language];
390 string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, toolInfo.FileExtension);
391 StreamWriter ps = new StreamWriter(projectFile);
392
393 kernel.CurrentWorkingDirectory.Push();
394 Helper.SetCurrentDir(Path.GetDirectoryName(projectFile));
395
396 #region Project File
397 using (ps)
398 {
399 ps.WriteLine("<Project DefaultTargets=\"Build\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\"{0}>", ToolsVersionXml);
400 //ps.WriteLine(" <{0}", toolInfo.XMLTag);
401 ps.WriteLine(" <PropertyGroup>");
402 ps.WriteLine(" <ProjectType>Local</ProjectType>");
403 ps.WriteLine(" <ProductVersion>{0}</ProductVersion>", this.ProductVersion);
404 ps.WriteLine(" <SchemaVersion>{0}</SchemaVersion>", this.SchemaVersion);
405 ps.WriteLine(" <ProjectGuid>{{{0}}}</ProjectGuid>", project.Guid.ToString().ToUpper());
406
407 ps.WriteLine(" <Configuration Condition=\" '$(Configuration)' == '' \">Debug</Configuration>");
408 ps.WriteLine(" <Platform Condition=\" '$(Platform)' == '' \">AnyCPU</Platform>");
409 //ps.WriteLine(" <Build>");
410
411 //ps.WriteLine(" <Settings");
412 ps.WriteLine(" <ApplicationIcon>{0}</ApplicationIcon>", project.AppIcon);
413 ps.WriteLine(" <AssemblyKeyContainerName>");
414 ps.WriteLine(" </AssemblyKeyContainerName>");
415 ps.WriteLine(" <AssemblyName>{0}</AssemblyName>", project.AssemblyName);
416 foreach (ConfigurationNode conf in project.Configurations)
417 {
418 if (conf.Options.KeyFile != "")
419 {
420 ps.WriteLine(" <AssemblyOriginatorKeyFile>{0}</AssemblyOriginatorKeyFile>", conf.Options.KeyFile);
421 ps.WriteLine(" <SignAssembly>true</SignAssembly>");
422 break;
423 }
424 }
425 ps.WriteLine(" <DefaultClientScript>JScript</DefaultClientScript>");
426 ps.WriteLine(" <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>");
427 ps.WriteLine(" <DefaultTargetSchema>IE50</DefaultTargetSchema>");
428 ps.WriteLine(" <DelaySign>false</DelaySign>");
429
430 //if(m_Version == VSVersion.VS70)
431 // ps.WriteLine(" NoStandardLibraries = \"false\"");
432
433 ps.WriteLine(" <OutputType>{0}</OutputType>", project.Type.ToString());
434 ps.WriteLine(" <AppDesignerFolder>{0}</AppDesignerFolder>", project.DesignerFolder);
435 ps.WriteLine(" <RootNamespace>{0}</RootNamespace>", project.RootNamespace);
436 ps.WriteLine(" <StartupObject>{0}</StartupObject>", project.StartupObject);
437 //ps.WriteLine(" >");
438 ps.WriteLine(" <FileUpgradeFlags>");
439 ps.WriteLine(" </FileUpgradeFlags>");
440
441 ps.WriteLine(" </PropertyGroup>");
442
443 foreach (ConfigurationNode conf in project.Configurations)
444 {
445 ps.Write(" <PropertyGroup ");
446 ps.WriteLine("Condition=\" '$(Configuration)|$(Platform)' == '{0}|AnyCPU' \">", conf.Name);
447 ps.WriteLine(" <AllowUnsafeBlocks>{0}</AllowUnsafeBlocks>", conf.Options["AllowUnsafe"]);
448 ps.WriteLine(" <BaseAddress>{0}</BaseAddress>", conf.Options["BaseAddress"]);
449 ps.WriteLine(" <CheckForOverflowUnderflow>{0}</CheckForOverflowUnderflow>", conf.Options["CheckUnderflowOverflow"]);
450 ps.WriteLine(" <ConfigurationOverrideFile>");
451 ps.WriteLine(" </ConfigurationOverrideFile>");
452 ps.WriteLine(" <DefineConstants>{0}</DefineConstants>", conf.Options["CompilerDefines"]);
453 ps.WriteLine(" <DocumentationFile>{0}</DocumentationFile>", Helper.NormalizePath(conf.Options["XmlDocFile"].ToString()));
454 ps.WriteLine(" <DebugSymbols>{0}</DebugSymbols>", conf.Options["DebugInformation"]);
455 ps.WriteLine(" <FileAlignment>{0}</FileAlignment>", conf.Options["FileAlignment"]);
456 // ps.WriteLine(" <IncrementalBuild = \"{0}\"", conf.Options["IncrementalBuild"]);
457
458 // if(m_Version == VSVersion.VS71)
459 // {
460 // ps.WriteLine(" NoStdLib = \"{0}\"", conf.Options["NoStdLib"]);
461 // ps.WriteLine(" NoWarn = \"{0}\"", conf.Options["SuppressWarnings"]);
462 // }
463
464 ps.WriteLine(" <Optimize>{0}</Optimize>", conf.Options["OptimizeCode"]);
465 ps.WriteLine(" <OutputPath>{0}</OutputPath>",
466 Helper.EndPath(Helper.NormalizePath(conf.Options["OutputPath"].ToString())));
467 ps.WriteLine(" <RegisterForComInterop>{0}</RegisterForComInterop>", conf.Options["RegisterComInterop"]);
468 ps.WriteLine(" <RemoveIntegerChecks>{0}</RemoveIntegerChecks>", conf.Options["RemoveIntegerChecks"]);
469 ps.WriteLine(" <TreatWarningsAsErrors>{0}</TreatWarningsAsErrors>", conf.Options["WarningsAsErrors"]);
470 ps.WriteLine(" <WarningLevel>{0}</WarningLevel>", conf.Options["WarningLevel"]);
471 ps.WriteLine(" <NoWarn>{0}</NoWarn>", conf.Options["SuppressWarnings"]);
472 ps.WriteLine(" </PropertyGroup>");
473 }
474
475 //ps.WriteLine(" </Settings>");
476
477 // Assembly References
478 ps.WriteLine(" <ItemGroup>");
479 string refPath = ((ReferencePathNode) project.ReferencePaths[0]).Path;
480
481 foreach (ReferenceNode refr in project.References)
482 {
483 if (!solution.ProjectsTable.ContainsKey(refr.Name))
484 {
485 ps.Write(" <Reference");
486 ps.Write(" Include=\"");
487 ps.Write(refr.Name);
488
489 ps.WriteLine("\" >");
490
491 string path;
492
493 if (String.IsNullOrEmpty(refr.Path))
494 {
495 if ( ExtensionSpecified( refr.Name ) )
496 {
497 path = Helper.NormalizePath(Path.Combine(refPath, refr.Name), '\\');
498 }
499 else
500 {
501 path = refr.Name + ".dll";
502 }
503 }
504 else
505 {
506 path = refr.Path;
507 }
508
509 // TODO: Allow reference to *.exe files
510 ps.WriteLine(" <HintPath>{0}</HintPath>", path );
511 ps.WriteLine(" <Private>{0}</Private>", refr.LocalCopy);
512 ps.WriteLine(" </Reference>");
513 }
514 }
515 ps.WriteLine(" </ItemGroup>");
516
517 //Project References
518 ps.WriteLine(" <ItemGroup>");
519 foreach (ReferenceNode refr in project.References)
520 {
521 if (solution.ProjectsTable.ContainsKey(refr.Name))
522 {
523 ProjectNode refProject = (ProjectNode)solution.ProjectsTable[refr.Name];
524 // TODO: Allow reference to visual basic projects
525 string path =
526 Helper.MakePathRelativeTo(project.FullPath,
527 Helper.MakeFilePath(refProject.FullPath, refProject.Name, "csproj"));
528 ps.WriteLine(" <ProjectReference Include=\"{0}\">", path );
529 //<ProjectReference Include="..\..\RealmForge\Utility\RealmForge.Utility.csproj">
530 ps.WriteLine(" <Name>{0}</Name>", refProject.Name);
531 // <Name>RealmForge.Utility</Name>
532 ps.WriteLine(" <Project>{{{0}}}</Project>", refProject.Guid.ToString().ToUpper());
533 // <Project>{6880D1D3-69EE-461B-B841-5319845B20D3}</Project>
534 ps.WriteLine(" <Package>{0}</Package>", toolInfo.Guid.ToString().ToUpper());
535 // <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
536 ps.WriteLine("\t\t\t<Private>{0}</Private>", refr.LocalCopy);
537 ps.WriteLine(" </ProjectReference>");
538 //</ProjectReference>
539 }
540 else
541 {
542 }
543 }
544 ps.WriteLine(" </ItemGroup>");
545
546 // ps.WriteLine(" </Build>");
547 ps.WriteLine(" <ItemGroup>");
548
549 // ps.WriteLine(" <Include>");
550 ArrayList list = new ArrayList();
551 foreach (string file in project.Files)
552 {
553 // if (file == "Properties\\Bind.Designer.cs")
554 // {
555 // Console.WriteLine("Wait a minute!");
556 // Console.WriteLine(project.Files.GetSubType(file).ToString());
557 // }
558
559 if (project.Files.GetSubType(file) != SubType.Code && project.Files.GetSubType(file) != SubType.Settings && project.Files.GetSubType(file) != SubType.Designer)
560 {
561 ps.WriteLine(" <EmbeddedResource Include=\"{0}\">", file.Substring(0, file.LastIndexOf('.')) + ".resx");
562
563 int slash = file.LastIndexOf('\\');
564 if (slash == -1)
565 {
566 ps.WriteLine(" <DependentUpon>{0}</DependentUpon>", file);
567 }
568 else
569 {
570 ps.WriteLine(" <DependentUpon>{0}</DependentUpon>", file.Substring(slash + 1, file.Length - slash - 1));
571 }
572 ps.WriteLine(" <SubType>Designer</SubType>");
573 ps.WriteLine(" </EmbeddedResource>");
574 //
575 }
576
577 if (project.Files.GetSubType(file) != SubType.Code && project.Files.GetSubType(file) == SubType.Designer)
578 {
579 ps.WriteLine(" <EmbeddedResource Include=\"{0}\">", file.Substring(0, file.LastIndexOf('.')) + ".resx");
580 ps.WriteLine(" <SubType>" + project.Files.GetSubType(file) + "</SubType>");
581 ps.WriteLine(" <Generator>ResXFileCodeGenerator</Generator>");
582 ps.WriteLine(" <LastGenOutput>Resources.Designer.cs</LastGenOutput>");
583 ps.WriteLine(" </EmbeddedResource>");
584 ps.WriteLine(" <Compile Include=\"{0}\">", file.Substring(0, file.LastIndexOf('.')) + ".Designer.cs");
585 ps.WriteLine(" <AutoGen>True</AutoGen>");
586 ps.WriteLine(" <DesignTime>True</DesignTime>");
587 ps.WriteLine(" <DependentUpon>Resources.resx</DependentUpon>");
588 ps.WriteLine(" </Compile>");
589 list.Add(file.Substring(0, file.LastIndexOf('.')) + ".Designer.cs");
590 }
591 if (project.Files.GetSubType(file).ToString() == "Settings")
592 {
593 //Console.WriteLine("File: " + file);
594 //Console.WriteLine("Last index: " + file.LastIndexOf('.'));
595 //Console.WriteLine("Length: " + file.Length);
596 ps.Write(" <{0} ", project.Files.GetBuildAction(file));
597 ps.WriteLine("Include=\"{0}\">", file);
598 int slash = file.LastIndexOf('\\');
599 string fileName = file.Substring(slash + 1, file.Length - slash - 1);
600 if (project.Files.GetBuildAction(file) == BuildAction.None)
601 {
602 ps.WriteLine(" <Generator>SettingsSingleFileGenerator</Generator>");
603
604 //Console.WriteLine("FileName: " + fileName);
605 //Console.WriteLine("FileNameMain: " + fileName.Substring(0, fileName.LastIndexOf('.')));
606 //Console.WriteLine("FileNameExt: " + fileName.Substring(fileName.LastIndexOf('.'), fileName.Length - fileName.LastIndexOf('.')));
607 if (slash == -1)
608 {
609 ps.WriteLine(" <LastGenOutput>{0}</LastGenOutput>", fileName.Substring(0, fileName.LastIndexOf('.')) + ".Designer.cs");
610 }
611 else
612 {
613 ps.WriteLine(" <LastGenOutput>{0}</LastGenOutput>", fileName.Substring(0, fileName.LastIndexOf('.')) + ".Designer.cs");
614 }
615 }
616 else
617 {
618 ps.WriteLine(" <SubType>Code</SubType>");
619 ps.WriteLine(" <AutoGen>True</AutoGen>");
620 ps.WriteLine(" <DesignTimeSharedInput>True</DesignTimeSharedInput>");
621 string fileNameShort = fileName.Substring(0, fileName.LastIndexOf('.'));
622 string fileNameShorter = fileNameShort.Substring(0, fileNameShort.LastIndexOf('.'));
623 ps.WriteLine(" <DependentUpon>{0}</DependentUpon>", fileNameShorter + ".settings");
624 }
625 ps.WriteLine(" </{0}>", project.Files.GetBuildAction(file));
626 }
627 else if (project.Files.GetSubType(file) != SubType.Designer)
628 {
629 if (!list.Contains(file))
630 {
631 ps.Write(" <{0} ", project.Files.GetBuildAction(file));
632
633 int startPos = 0;
634 if ( project.Files.GetPreservePath( file ) )
635 {
636 while ( ( @"./\" ).IndexOf( file.Substring( startPos, 1 ) ) != -1 )
637 startPos++;
638
639 }
640 else
641 {
642 startPos = file.LastIndexOf( Path.GetFileName( file ) );
643 }
644 ps.WriteLine("Include=\"{0}\">", Helper.NormalizePath(file));
645
646
647 if (file.Contains("Designer.cs"))
648 {
649 string d = ".Designer.cs";
650 int index = file.Contains("\\") ? file.IndexOf("\\") + 1 : 0;
651 ps.WriteLine(" <DependentUpon>{0}</DependentUpon>", file.Substring(index, file.Length - index - d.Length) + ".cs");
652 }
653
654 if (project.Files.GetIsLink(file))
655 {
656 string alias = project.Files.GetLinkPath( file );
657 alias += file.Substring( startPos );
658 alias = Helper.NormalizePath( alias );
659 ps.WriteLine( " <Link>{0}</Link>", alias );
660 }
661 else if (project.Files.GetBuildAction(file) != BuildAction.None)
662 {
663 if (project.Files.GetBuildAction(file) != BuildAction.EmbeddedResource)
664 {
665 ps.WriteLine(" <SubType>{0}</SubType>", project.Files.GetSubType(file));
666 }
667 }
668
669 if (project.Files.GetCopyToOutput(file) != CopyToOutput.Never)
670 {
671 ps.WriteLine(" <CopyToOutputDirectory>{0}</CopyToOutputDirectory>", project.Files.GetCopyToOutput(file));
672 }
673
674 ps.WriteLine(" </{0}>", project.Files.GetBuildAction(file));
675 }
676 }
677 }
678 // ps.WriteLine(" </Include>");
679
680 ps.WriteLine(" </ItemGroup>");
681 ps.WriteLine(" <Import Project=\"" + toolInfo.ImportProject + "\" />");
682 ps.WriteLine(" <PropertyGroup>");
683 ps.WriteLine(" <PreBuildEvent>");
684 ps.WriteLine(" </PreBuildEvent>");
685 ps.WriteLine(" <PostBuildEvent>");
686 ps.WriteLine(" </PostBuildEvent>");
687 ps.WriteLine(" </PropertyGroup>");
688 // ps.WriteLine(" </{0}>", toolInfo.XMLTag);
689 ps.WriteLine("</Project>");
690 }
691 #endregion
692
693 #region User File
694
695 ps = new StreamWriter(projectFile + ".user");
696 using (ps)
697 {
698 ps.WriteLine("<Project xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">");
699 //ps.WriteLine( "<VisualStudioProject>" );
700 //ps.WriteLine(" <{0}>", toolInfo.XMLTag);
701 //ps.WriteLine(" <Build>");
702 ps.WriteLine(" <PropertyGroup>");
703 //ps.WriteLine(" <Settings ReferencePath=\"{0}\">", MakeRefPath(project));
704
705 ps.WriteLine(" <Configuration Condition=\" '$(Configuration)' == '' \">Debug</Configuration>");
706
707 if (projectFile.Contains( "OpenSim.csproj" ))
708 {
709 ps.WriteLine(" <StartArguments>-loginserver -sandbox -accounts</StartArguments>");
710 }
711
712 ps.WriteLine(" <Platform Condition=\" '$(Platform)' == '' \">AnyCPU</Platform>");
713 ps.WriteLine(" <ReferencePath>{0}</ReferencePath>", MakeRefPath(project));
714 ps.WriteLine(" <LastOpenVersion>{0}</LastOpenVersion>", this.ProductVersion);
715 ps.WriteLine(" <ProjectView>ProjectFiles</ProjectView>");
716 ps.WriteLine(" <ProjectTrust>0</ProjectTrust>");
717 ps.WriteLine(" </PropertyGroup>");
718 foreach (ConfigurationNode conf in project.Configurations)
719 {
720 ps.Write(" <PropertyGroup");
721 ps.Write(" Condition = \" '$(Configuration)|$(Platform)' == '{0}|AnyCPU' \"", conf.Name);
722 ps.WriteLine(" />");
723 }
724
725 ps.WriteLine("</Project>");
726 }
727 #endregion
728
729 kernel.CurrentWorkingDirectory.Pop();
730 }
731
732 private void WriteSolution(SolutionNode solution)
733 {
734 kernel.Log.Write("Creating {0} solution and project files", this.VersionName);
735
736 foreach (ProjectNode project in solution.Projects)
737 {
738 kernel.Log.Write("...Creating project: {0}", project.Name);
739 WriteProject(solution, project);
132 } 740 }
741
742 kernel.Log.Write("");
743 string solutionFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "sln");
744 using (StreamWriter ss = new StreamWriter(solutionFile))
745 {
746 kernel.CurrentWorkingDirectory.Push();
747 Helper.SetCurrentDir(Path.GetDirectoryName(solutionFile));
748
749 using (ss)
750 {
751 ss.WriteLine("Microsoft Visual Studio Solution File, Format Version {0}", this.SolutionVersion);
752 ss.WriteLine(SolutionTag);
753 foreach (ProjectNode project in solution.Projects)
754 {
755 if (!tools.ContainsKey(project.Language))
756 {
757 throw new UnknownLanguageException("Unknown .NET language: " + project.Language);
758 }
759
760 ToolInfo toolInfo = (ToolInfo)tools[project.Language];
761
762 string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath);
763 ss.WriteLine("Project(\"{0}\") = \"{1}\", \"{2}\", \"{{{3}}}\"",
764 toolInfo.Guid, project.Name, Helper.MakeFilePath(path, project.Name,
765 toolInfo.FileExtension), project.Guid.ToString().ToUpper());
766
767 //ss.WriteLine(" ProjectSection(ProjectDependencies) = postProject");
768 //ss.WriteLine(" EndProjectSection");
769
770 ss.WriteLine("EndProject");
771 }
772
773 if (solution.Files != null)
774 {
775 ss.WriteLine("Project(\"{0}\") = \"Solution Items\", \"Solution Items\", \"{1}\"", "{2150E333-8FDC-42A3-9474-1A3956D46DE8}", "{468F1D07-AD17-4CC3-ABD0-2CA268E4E1A6}");
776 ss.WriteLine("\tProjectSection(SolutionItems) = preProject");
777 foreach (string file in solution.Files)
778 ss.WriteLine("\t\t{0} = {0}", file);
779 ss.WriteLine("\tEndProjectSection");
780 ss.WriteLine("EndProject");
781 }
782
783 ss.WriteLine("Global");
784
785 ss.WriteLine(" GlobalSection(SolutionConfigurationPlatforms) = preSolution");
786 foreach (ConfigurationNode conf in solution.Configurations)
787 {
788 ss.WriteLine(" {0}|Any CPU = {0}|Any CPU", conf.Name);
789 }
790 ss.WriteLine(" EndGlobalSection");
791
792 if (solution.Projects.Count > 1)
793 {
794 ss.WriteLine(" GlobalSection(ProjectDependencies) = postSolution");
795 }
796 foreach (ProjectNode project in solution.Projects)
797 {
798 for (int i = 0; i < project.References.Count; i++)
799 {
800 ReferenceNode refr = (ReferenceNode)project.References[i];
801 if (solution.ProjectsTable.ContainsKey(refr.Name))
802 {
803 ProjectNode refProject = (ProjectNode)solution.ProjectsTable[refr.Name];
804 ss.WriteLine(" ({{{0}}}).{1} = ({{{2}}})",
805 project.Guid.ToString().ToUpper()
806 , i,
807 refProject.Guid.ToString().ToUpper()
808 );
809 }
810 }
811 }
812 if (solution.Projects.Count > 1)
813 {
814 ss.WriteLine(" EndGlobalSection");
815 }
816 ss.WriteLine(" GlobalSection(ProjectConfigurationPlatforms) = postSolution");
817 foreach (ProjectNode project in solution.Projects)
818 {
819 foreach (ConfigurationNode conf in solution.Configurations)
820 {
821 ss.WriteLine(" {{{0}}}.{1}|Any CPU.ActiveCfg = {1}|Any CPU",
822 project.Guid.ToString().ToUpper(),
823 conf.Name);
824
825 ss.WriteLine(" {{{0}}}.{1}|Any CPU.Build.0 = {1}|Any CPU",
826 project.Guid.ToString().ToUpper(),
827 conf.Name);
828 }
829 }
830 ss.WriteLine(" EndGlobalSection");
831 ss.WriteLine(" GlobalSection(SolutionProperties) = preSolution");
832 ss.WriteLine(" HideSolutionNode = FALSE");
833 ss.WriteLine(" EndGlobalSection");
834
835 ss.WriteLine("EndGlobal");
836 }
837 }
838
839 kernel.CurrentWorkingDirectory.Pop();
840 }
841
842 private void CleanProject(ProjectNode project)
843 {
844 kernel.Log.Write("...Cleaning project: {0}", project.Name);
845
846 ToolInfo toolInfo = (ToolInfo)tools[project.Language];
847 string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, toolInfo.FileExtension);
848 string userFile = projectFile + ".user";
849
850 Helper.DeleteIfExists(projectFile);
851 Helper.DeleteIfExists(userFile);
852 }
853
854 private void CleanSolution(SolutionNode solution)
855 {
856 kernel.Log.Write("Cleaning {0} solution and project files", this.VersionName, solution.Name);
857
858 string slnFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "sln");
859 string suoFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "suo");
860
861 Helper.DeleteIfExists(slnFile);
862 Helper.DeleteIfExists(suoFile);
863
864 foreach (ProjectNode project in solution.Projects)
865 {
866 CleanProject(project);
867 }
868
869 kernel.Log.Write("");
133 } 870 }
134 871
135 #endregion 872 #endregion
136 873
137 #region Constructors 874 #region ITarget Members
138 875
139 /// <summary> 876 /// <summary>
140 /// Initializes a new instance of the <see cref="VS2005Target"/> class. 877 /// Writes the specified kern.
878 /// </summary>
879 /// <param name="kern">The kern.</param>
880 public virtual void Write(Kernel kern)
881 {
882 if (kern == null)
883 {
884 throw new ArgumentNullException("kern");
885 }
886 kernel = kern;
887 foreach (SolutionNode sol in kernel.Solutions)
888 {
889 WriteSolution(sol);
890 }
891 kernel = null;
892 }
893
894 /// <summary>
895 /// Cleans the specified kern.
141 /// </summary> 896 /// </summary>
142 public VS2005Target() 897 /// <param name="kern">The kern.</param>
143 : base() 898 public virtual void Clean(Kernel kern)
144 { 899 {
900 if (kern == null)
901 {
902 throw new ArgumentNullException("kern");
903 }
904 kernel = kern;
905 foreach (SolutionNode sol in kernel.Solutions)
906 {
907 CleanSolution(sol);
908 }
909 kernel = null;
910 }
911
912 /// <summary>
913 /// Gets the name.
914 /// </summary>
915 /// <value>The name.</value>
916 public virtual string Name
917 {
918 get
919 {
920 return "vs2005";
921 }
145 } 922 }
146 923
147 #endregion 924 #endregion
diff --git a/Prebuild/src/Core/Targets/VS2008Target.cs b/Prebuild/src/Core/Targets/VS2008Target.cs
index f30017b..88bb5e6 100644
--- a/Prebuild/src/Core/Targets/VS2008Target.cs
+++ b/Prebuild/src/Core/Targets/VS2008Target.cs
@@ -1,132 +1,56 @@
1using System; 1using System;
2using System.Collections; 2using System.Collections.Generic;
3using System.Collections.Specialized;
4using System.IO;
5using System.Text; 3using System.Text;
6
7using Prebuild.Core.Attributes; 4using Prebuild.Core.Attributes;
8using Prebuild.Core.Interfaces;
9using Prebuild.Core.Nodes;
10using Prebuild.Core.Utilities;
11using System.CodeDom.Compiler;
12 5
13namespace Prebuild.Core.Targets 6namespace Prebuild.Core.Targets
14{ 7{
8 [Target("vs2008")]
9 public class VS2008Target : VS2005Target
10 {
11 protected override string SolutionTag
12 {
13 get { return "# Visual Studio 2008"; }
14 }
15 15
16 /// <summary> 16 protected override string SolutionVersion
17 ///
18 /// </summary>
19 [Target("vs2008")]
20 public class VS2008Target : VSGenericTarget
21 {
22 #region Fields
23 string solutionVersion = "10.00";
24 string productVersion = "9.0.21022";
25 string schemaVersion = "2.0";
26 string versionName = "Visual Studio 2008";
27 string name = "vs2008";
28 VSVersion version = VSVersion.VS90;
29
30 Hashtable tools;
31 Kernel kernel;
32
33 /// <summary>
34 /// Gets or sets the solution version.
35 /// </summary>
36 /// <value>The solution version.</value>
37 public override string SolutionVersion
38 {
39 get
40 {
41 return solutionVersion;
42 }
43 }
44 /// <summary>
45 /// Gets or sets the product version.
46 /// </summary>
47 /// <value>The product version.</value>
48 public override string ProductVersion
49 {
50 get
51 {
52 return productVersion;
53 }
54 }
55 /// <summary>
56 /// Gets or sets the schema version.
57 /// </summary>
58 /// <value>The schema version.</value>
59 public override string SchemaVersion
60 {
61 get
62 {
63 return schemaVersion;
64 }
65 }
66 /// <summary>
67 /// Gets or sets the name of the version.
68 /// </summary>
69 /// <value>The name of the version.</value>
70 public override string VersionName
71 {
72 get
73 {
74 return versionName;
75 }
76 }
77 /// <summary>
78 /// Gets or sets the version.
79 /// </summary>
80 /// <value>The version.</value>
81 public override VSVersion Version
82 {
83 get
84 {
85 return version;
86 }
87 }
88 /// <summary>
89 /// Gets the name.
90 /// </summary>
91 /// <value>The name.</value>
92 public override string Name
93 {
94 get
95 {
96 return name;
97 }
98 }
99
100 protected override string GetToolsVersionXml(FrameworkVersion frameworkVersion)
101 { 17 {
102 switch (frameworkVersion) 18 get
103 { 19 {
104 case FrameworkVersion.v3_5: 20 return "10.00";
105 return "ToolsVersion=\"3.5\"";
106 case FrameworkVersion.v3_0:
107 return "ToolsVersion=\"3.0\"";
108 default:
109 return "ToolsVersion=\"2.0\"";
110 } 21 }
111 } 22 }
112 23
113 public override string SolutionTag 24 protected override string VersionName
114 { 25 {
115 get { return "# Visual Studio 2008"; } 26 get
27 {
28 return "Visual C# 2008";
29 }
116 } 30 }
117 31
118 #endregion 32 protected override string ToolsVersionXml
119 33 {
120 #region Constructors 34 get
35 {
36 return " ToolsVersion=\"3.5\"";
37 }
38 }
121 39
122 /// <summary> 40 protected override string ProductVersion
123 /// Initializes a new instance of the <see cref="VS2005Target"/> class. 41 {
124 /// </summary> 42 get
125 public VS2008Target() 43 {
126 : base() 44 return "9.0.21022";
127 { 45 }
128 } 46 }
129 47
130 #endregion 48 public override string Name
131 } 49 {
50 get
51 {
52 return "vs2008";
53 }
54 }
55 }
132} 56}
diff --git a/Prebuild/src/Core/Targets/VSGenericTarget.cs b/Prebuild/src/Core/Targets/VSGenericTarget.cs
deleted file mode 100644
index 401331d..0000000
--- a/Prebuild/src/Core/Targets/VSGenericTarget.cs
+++ /dev/null
@@ -1,881 +0,0 @@
1#region BSD License
2/*
3Copyright (c) 2008 Matthew Holmes (matthew@wildfiregames.com), John Anderson (sontek@gmail.com)
4
5Redistribution and use in source and binary forms, with or without modification, are permitted
6provided that the following conditions are met:
7
8* Redistributions of source code must retain the above copyright notice, this list of conditions
9 and the following disclaimer.
10* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
11 and the following disclaimer in the documentation and/or other materials provided with the
12 distribution.
13* The name of the author may not be used to endorse or promote products derived from this software
14 without specific prior written permission.
15
16THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
17BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
19EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
22IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23*/
24#endregion
25
26using System;
27using System.Collections;
28using System.Collections.Generic;
29using System.Collections.Specialized;
30using System.IO;
31using System.Text;
32
33using Prebuild.Core.Attributes;
34using Prebuild.Core.Interfaces;
35using Prebuild.Core.Nodes;
36using Prebuild.Core.Utilities;
37using System.CodeDom.Compiler;
38
39namespace Prebuild.Core.Targets
40{
41
42 /// <summary>
43 ///
44 /// </summary>
45 public abstract class VSGenericTarget : ITarget
46 {
47 #region Fields
48
49 readonly Hashtable tools = new Hashtable();
50 Kernel kernel;
51 #endregion
52
53 #region Properties
54 /// <summary>
55 /// Gets or sets the solution version.
56 /// </summary>
57 /// <value>The solution version.</value>
58 public abstract string SolutionVersion { get; }
59 /// <summary>
60 /// Gets or sets the product version.
61 /// </summary>
62 /// <value>The product version.</value>
63 public abstract string ProductVersion { get; }
64 /// <summary>
65 /// Gets or sets the schema version.
66 /// </summary>
67 /// <value>The schema version.</value>
68 public abstract string SchemaVersion { get; }
69 /// <summary>
70 /// Gets or sets the name of the version.
71 /// </summary>
72 /// <value>The name of the version.</value>
73 public abstract string VersionName { get; }
74 /// <summary>
75 /// Gets or sets the version.
76 /// </summary>
77 /// <value>The version.</value>
78 public abstract VSVersion Version { get; }
79 /// <summary>
80 /// Gets the name.
81 /// </summary>
82 /// <value>The name.</value>
83 public abstract string Name { get; }
84
85 protected abstract string GetToolsVersionXml(FrameworkVersion version);
86 public abstract string SolutionTag { get; }
87
88 #endregion
89
90 #region Constructors
91
92 /// <summary>
93 /// Initializes a new instance of the <see cref="VSGenericTarget"/> class.
94 /// </summary>
95 protected VSGenericTarget()
96 {
97 this.tools["C#"] = new ToolInfo("C#", "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}", "csproj", "CSHARP", "$(MSBuildBinPath)\\Microsoft.CSHARP.Targets");
98 this.tools["Database"] = new ToolInfo("Database", "{4F174C21-8C12-11D0-8340-0000F80270F8}", "dbp", "UNKNOWN");
99 this.tools["Boo"] = new ToolInfo("Boo", "{45CEA7DC-C2ED-48A6-ACE0-E16144C02365}", "booproj", "Boo", "$(BooBinPath)\\Boo.Microsoft.Build.targets");
100 this.tools["VisualBasic"] = new ToolInfo("VisualBasic", "{F184B08F-C81C-45F6-A57F-5ABD9991F28F}", "vbproj", "VisualBasic", "$(MSBuildBinPath)\\Microsoft.VisualBasic.Targets");
101 this.tools["Folder"] = new ToolInfo("Folder", "{2150E333-8FDC-42A3-9474-1A3956D46DE8}", null, null);
102 }
103
104 #endregion
105
106 #region Private Methods
107
108 private string MakeRefPath(ProjectNode project)
109 {
110 string ret = "";
111 foreach (ReferencePathNode node in project.ReferencePaths)
112 {
113 try
114 {
115 string fullPath = Helper.ResolvePath(node.Path);
116 if (ret.Length < 1)
117 {
118 ret = fullPath;
119 }
120 else
121 {
122 ret += ";" + fullPath;
123 }
124 }
125 catch (ArgumentException)
126 {
127 this.kernel.Log.Write(LogType.Warning, "Could not resolve reference path: {0}", node.Path);
128 }
129 }
130
131 return ret;
132 }
133
134 private static ProjectNode FindProjectInSolution(string name, SolutionNode solution)
135 {
136 SolutionNode node = solution;
137
138 while (node.Parent is SolutionNode)
139 node = node.Parent as SolutionNode;
140
141 return FindProjectInSolutionRecursively(name, node);
142 }
143
144 private static ProjectNode FindProjectInSolutionRecursively(string name, SolutionNode solution)
145 {
146 if (solution.ProjectsTable.ContainsKey(name))
147 return (ProjectNode)solution.ProjectsTable[name];
148
149 foreach (SolutionNode child in solution.Solutions)
150 {
151 ProjectNode node = FindProjectInSolutionRecursively(name, child);
152 if (node != null)
153 return node;
154 }
155
156 return null;
157 }
158
159 private void WriteProject(SolutionNode solution, ProjectNode project)
160 {
161 if (!tools.ContainsKey(project.Language))
162 {
163 throw new UnknownLanguageException("Unknown .NET language: " + project.Language);
164 }
165
166 ToolInfo toolInfo = (ToolInfo)tools[project.Language];
167 string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, toolInfo.FileExtension);
168 StreamWriter ps = new StreamWriter(projectFile);
169
170 kernel.CurrentWorkingDirectory.Push();
171 Helper.SetCurrentDir(Path.GetDirectoryName(projectFile));
172
173 #region Project File
174 using (ps)
175 {
176 ps.WriteLine("<Project DefaultTargets=\"Build\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\" {0}>", GetToolsVersionXml(project.FrameworkVersion));
177 ps.WriteLine(" <PropertyGroup>");
178 ps.WriteLine(" <ProjectType>Local</ProjectType>");
179 ps.WriteLine(" <ProductVersion>{0}</ProductVersion>", this.ProductVersion);
180 ps.WriteLine(" <SchemaVersion>{0}</SchemaVersion>", this.SchemaVersion);
181 ps.WriteLine(" <ProjectGuid>{{{0}}}</ProjectGuid>", project.Guid.ToString().ToUpper());
182
183 // Visual Studio has a hard coded guid for the project type
184 if (project.Type == ProjectType.Web)
185 ps.WriteLine(" <ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>");
186 ps.WriteLine(" <Configuration Condition=\" '$(Configuration)' == '' \">Debug</Configuration>");
187 ps.WriteLine(" <Platform Condition=\" '$(Platform)' == '' \">AnyCPU</Platform>");
188 ps.WriteLine(" <ApplicationIcon>{0}</ApplicationIcon>", project.AppIcon);
189 ps.WriteLine(" <AssemblyKeyContainerName>");
190 ps.WriteLine(" </AssemblyKeyContainerName>");
191 ps.WriteLine(" <AssemblyName>{0}</AssemblyName>", project.AssemblyName);
192 foreach (ConfigurationNode conf in project.Configurations)
193 {
194 if (conf.Options.KeyFile != "")
195 {
196 ps.WriteLine(" <AssemblyOriginatorKeyFile>{0}</AssemblyOriginatorKeyFile>", conf.Options.KeyFile);
197 ps.WriteLine(" <SignAssembly>true</SignAssembly>");
198 break;
199 }
200 }
201 ps.WriteLine(" <DefaultClientScript>JScript</DefaultClientScript>");
202 ps.WriteLine(" <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>");
203 ps.WriteLine(" <DefaultTargetSchema>IE50</DefaultTargetSchema>");
204 ps.WriteLine(" <DelaySign>false</DelaySign>");
205 ps.WriteLine(" <TargetFrameworkVersion>{0}</TargetFrameworkVersion>", project.FrameworkVersion.ToString().Replace("_", "."));
206
207 ps.WriteLine(" <OutputType>{0}</OutputType>", project.Type == ProjectType.Web ? ProjectType.Library.ToString() : project.Type.ToString());
208 ps.WriteLine(" <AppDesignerFolder>{0}</AppDesignerFolder>", project.DesignerFolder);
209 ps.WriteLine(" <RootNamespace>{0}</RootNamespace>", project.RootNamespace);
210 ps.WriteLine(" <StartupObject>{0}</StartupObject>", project.StartupObject);
211 if (string.IsNullOrEmpty(project.DebugStartParameters))
212 {
213 ps.WriteLine(" <StartArguments>{0}</StartArguments>", project.DebugStartParameters);
214 }
215 ps.WriteLine(" <FileUpgradeFlags>");
216 ps.WriteLine(" </FileUpgradeFlags>");
217
218 ps.WriteLine(" </PropertyGroup>");
219
220 foreach (ConfigurationNode conf in project.Configurations)
221 {
222 ps.Write(" <PropertyGroup ");
223 ps.WriteLine("Condition=\" '$(Configuration)|$(Platform)' == '{0}|AnyCPU' \">", conf.Name);
224 ps.WriteLine(" <AllowUnsafeBlocks>{0}</AllowUnsafeBlocks>", conf.Options["AllowUnsafe"]);
225 ps.WriteLine(" <BaseAddress>{0}</BaseAddress>", conf.Options["BaseAddress"]);
226 ps.WriteLine(" <CheckForOverflowUnderflow>{0}</CheckForOverflowUnderflow>", conf.Options["CheckUnderflowOverflow"]);
227 ps.WriteLine(" <ConfigurationOverrideFile>");
228 ps.WriteLine(" </ConfigurationOverrideFile>");
229 ps.WriteLine(" <DefineConstants>{0}</DefineConstants>", conf.Options["CompilerDefines"]);
230 ps.WriteLine(" <DocumentationFile>{0}</DocumentationFile>", Helper.NormalizePath(conf.Options["XmlDocFile"].ToString()));
231 ps.WriteLine(" <DebugSymbols>{0}</DebugSymbols>", conf.Options["DebugInformation"]);
232 ps.WriteLine(" <FileAlignment>{0}</FileAlignment>", conf.Options["FileAlignment"]);
233 ps.WriteLine(" <Optimize>{0}</Optimize>", conf.Options["OptimizeCode"]);
234 if (project.Type != ProjectType.Web)
235 ps.WriteLine(" <OutputPath>{0}</OutputPath>",
236 Helper.EndPath(Helper.NormalizePath(conf.Options["OutputPath"].ToString())));
237 else
238 ps.WriteLine(" <OutputPath>{0}</OutputPath>",
239 Helper.EndPath(Helper.NormalizePath("bin\\")));
240
241 ps.WriteLine(" <RegisterForComInterop>{0}</RegisterForComInterop>", conf.Options["RegisterComInterop"]);
242 ps.WriteLine(" <RemoveIntegerChecks>{0}</RemoveIntegerChecks>", conf.Options["RemoveIntegerChecks"]);
243 ps.WriteLine(" <TreatWarningsAsErrors>{0}</TreatWarningsAsErrors>", conf.Options["WarningsAsErrors"]);
244 ps.WriteLine(" <WarningLevel>{0}</WarningLevel>", conf.Options["WarningLevel"]);
245 ps.WriteLine(" <NoStdLib>{0}</NoStdLib>", conf.Options["NoStdLib"]);
246 ps.WriteLine(" <NoWarn>{0}</NoWarn>", conf.Options["SuppressWarnings"]);
247 ps.WriteLine(" </PropertyGroup>");
248 }
249
250 //ps.WriteLine(" </Settings>");
251
252 List<ProjectNode> projectReferences = new List<ProjectNode>();
253 List<ReferenceNode> otherReferences = new List<ReferenceNode>();
254
255 foreach (ReferenceNode refr in project.References)
256 {
257 ProjectNode projectNode = FindProjectInSolution(refr.Name, solution);
258
259 if (projectNode == null)
260 otherReferences.Add(refr);
261 else
262 projectReferences.Add(projectNode);
263 }
264 // Assembly References
265 ps.WriteLine(" <ItemGroup>");
266
267 foreach (ReferenceNode refr in otherReferences)
268 {
269 ps.Write(" <Reference");
270 ps.Write(" Include=\"");
271 ps.Write(refr.Name);
272 ps.WriteLine("\" >");
273 ps.Write(" <Name>");
274 ps.Write(refr.Name);
275 ps.WriteLine("</Name>");
276 // TODO: Allow reference to *.exe files
277 ps.WriteLine(" <Private>{0}</Private>", refr.LocalCopy);
278 ps.WriteLine(" </Reference>");
279 }
280 ps.WriteLine(" </ItemGroup>");
281
282 //Project References
283 ps.WriteLine(" <ItemGroup>");
284 foreach (ProjectNode projectReference in projectReferences)
285 {
286 ToolInfo tool = (ToolInfo)tools[projectReference.Language];
287 if (tools == null)
288 throw new UnknownLanguageException();
289
290 string path =
291 Helper.MakePathRelativeTo(project.FullPath,
292 Helper.MakeFilePath(projectReference.FullPath, projectReference.Name, tool.FileExtension));
293 ps.WriteLine(" <ProjectReference Include=\"{0}\">", path);
294
295 // TODO: Allow reference to visual basic projects
296 ps.WriteLine(" <Name>{0}</Name>", projectReference.Name);
297 ps.WriteLine(" <Project>{0}</Project>", projectReference.Guid.ToString("B").ToUpper());
298 ps.WriteLine(" <Package>{0}</Package>", tool.Guid.ToUpper());
299 ps.WriteLine(" </ProjectReference>");
300 }
301 ps.WriteLine(" </ItemGroup>");
302
303 // ps.WriteLine(" </Build>");
304 ps.WriteLine(" <ItemGroup>");
305
306 // ps.WriteLine(" <Include>");
307 List<string> list = new List<string>();
308
309 foreach (string path in project.Files)
310 {
311 string lower = path.ToLower();
312 if (lower.EndsWith(".resx"))
313 {
314 string codebehind = String.Format("{0}.Designer{1}", path.Substring(0, path.LastIndexOf('.')), toolInfo.LanguageExtension);
315 if (!list.Contains(codebehind))
316 list.Add(codebehind);
317 }
318 }
319
320 foreach (string file in project.Files)
321 {
322 // if (file == "Properties\\Bind.Designer.cs")
323 // {
324 // Console.WriteLine("Wait a minute!");
325 // Console.WriteLine(project.Files.GetSubType(file).ToString());
326 // }
327
328 SubType subType = project.Files.GetSubType(file);
329
330 if (subType != SubType.Code && subType != SubType.Settings && subType != SubType.Designer
331 && subType != SubType.CodeBehind)
332 {
333 ps.WriteLine(" <EmbeddedResource Include=\"{0}\">", file.Substring(0, file.LastIndexOf('.')) + ".resx");
334 ps.WriteLine(" <DependentUpon>{0}</DependentUpon>", Path.GetFileName(file));
335 ps.WriteLine(" <SubType>Designer</SubType>");
336 ps.WriteLine(" </EmbeddedResource>");
337 //
338 }
339
340 if (subType == SubType.Designer)
341 {
342 ps.WriteLine(" <EmbeddedResource Include=\"{0}\">", file);
343 ps.WriteLine(" <SubType>" + subType + "</SubType>");
344 ps.WriteLine(" <Generator>ResXFileCodeGenerator</Generator>");
345
346 string autogen_name = file.Substring(0, file.LastIndexOf('.')) + ".Designer.cs";
347 string dependent_name = file.Substring(0, file.LastIndexOf('.')) + ".cs";
348
349 ps.WriteLine(" <LastGenOutput>{0}</LastGenOutput>", autogen_name);
350
351 // Check for a parent .cs file with the same name as this designer file
352 if (File.Exists(dependent_name))
353 ps.WriteLine(" <DependentUpon>{0}</DependentUpon>", Path.GetFileName(dependent_name));
354
355 ps.WriteLine(" </EmbeddedResource>");
356 if (File.Exists(autogen_name))
357 {
358 ps.WriteLine(" <Compile Include=\"{0}\">", autogen_name);
359 ps.WriteLine(" <AutoGen>True</AutoGen>");
360 ps.WriteLine(" <DesignTime>True</DesignTime>");
361
362 // If a parent .cs file exists, link this autogen file to it. Otherwise link
363 // to the designer file
364 if (File.Exists(dependent_name))
365 ps.WriteLine(" <DependentUpon>{0}</DependentUpon>", Path.GetFileName(dependent_name));
366 else
367 ps.WriteLine(" <DependentUpon>{0}</DependentUpon>", Path.GetFileName(file));
368
369 ps.WriteLine(" </Compile>");
370 }
371 list.Add(autogen_name);
372 }
373 if (subType == SubType.Settings)
374 {
375 ps.Write(" <{0} ", project.Files.GetBuildAction(file));
376 ps.WriteLine("Include=\"{0}\">", file);
377 string fileName = Path.GetFileName(file);
378 if (project.Files.GetBuildAction(file) == BuildAction.None)
379 {
380 ps.WriteLine(" <Generator>SettingsSingleFileGenerator</Generator>");
381 ps.WriteLine(" <LastGenOutput>{0}</LastGenOutput>", fileName.Substring(0, fileName.LastIndexOf('.')) + ".Designer.cs");
382 }
383 else
384 {
385 ps.WriteLine(" <SubType>Code</SubType>");
386 ps.WriteLine(" <AutoGen>True</AutoGen>");
387 ps.WriteLine(" <DesignTimeSharedInput>True</DesignTimeSharedInput>");
388 string fileNameShort = fileName.Substring(0, fileName.LastIndexOf('.'));
389 string fileNameShorter = fileNameShort.Substring(0, fileNameShort.LastIndexOf('.'));
390 ps.WriteLine(" <DependentUpon>{0}</DependentUpon>", Path.GetFileName(fileNameShorter + ".settings"));
391 }
392 ps.WriteLine(" </{0}>", project.Files.GetBuildAction(file));
393 }
394 else if (subType != SubType.Designer)
395 {
396 string path = Helper.NormalizePath(file);
397 string path_lower = path.ToLower();
398
399 if (!list.Contains(file))
400 {
401 ps.Write(" <{0} ", project.Files.GetBuildAction(path));
402
403 int startPos = 0;
404 if (project.Files.GetPreservePath(file))
405 {
406 while ((@"./\").IndexOf(file.Substring(startPos, 1)) != -1)
407 startPos++;
408
409 }
410 else
411 {
412 startPos = file.LastIndexOf(Path.GetFileName(path));
413 }
414
415 ps.WriteLine("Include=\"{0}\">", path);
416
417 int last_period_index = file.LastIndexOf('.');
418 string short_file_name = file.Substring(0, last_period_index);
419 string extension = Path.GetExtension(path);
420 string designer_format = string.Format(".designer{0}", extension);
421
422 if (path_lower.EndsWith(designer_format))
423 {
424 int designer_index = path_lower.IndexOf(designer_format);
425 string file_name = path.Substring(0, designer_index);
426
427 if (File.Exists(file_name))
428 ps.WriteLine(" <DependentUpon>{0}</DependentUpon>", Path.GetFileName(file_name));
429 else if (File.Exists(file_name + ".resx"))
430 ps.WriteLine(" <DependentUpon>{0}</DependentUpon>", Path.GetFileName(file_name + ".resx"));
431 }
432 else if (subType == SubType.CodeBehind)
433 {
434 ps.WriteLine(" <DependentUpon>{0}</DependentUpon>", Path.GetFileName(short_file_name));
435 }
436 if (project.Files.GetIsLink(file))
437 {
438 string alias = project.Files.GetLinkPath(file);
439 alias += file.Substring(startPos);
440 alias = Helper.NormalizePath(alias);
441 ps.WriteLine(" <Link>{0}</Link>", alias);
442 }
443 else if (project.Files.GetBuildAction(file) != BuildAction.None)
444 {
445 if (project.Files.GetBuildAction(file) != BuildAction.EmbeddedResource)
446 {
447 ps.WriteLine(" <SubType>{0}</SubType>", subType);
448 }
449 }
450
451 if (project.Files.GetCopyToOutput(file) != CopyToOutput.Never)
452 {
453 ps.WriteLine(" <CopyToOutputDirectory>{0}</CopyToOutputDirectory>", project.Files.GetCopyToOutput(file));
454 }
455
456 ps.WriteLine(" </{0}>", project.Files.GetBuildAction(file));
457 }
458 }
459 }
460
461 ps.WriteLine(" </ItemGroup>");
462 ps.WriteLine(" <Import Project=\"" + toolInfo.ImportProject + "\" />");
463 ps.WriteLine(" <PropertyGroup>");
464 ps.WriteLine(" <PreBuildEvent>");
465 ps.WriteLine(" </PreBuildEvent>");
466 ps.WriteLine(" <PostBuildEvent>");
467 ps.WriteLine(" </PostBuildEvent>");
468 ps.WriteLine(" </PropertyGroup>");
469 ps.WriteLine("</Project>");
470 }
471 #endregion
472
473 #region User File
474
475 ps = new StreamWriter(projectFile + ".user");
476 using (ps)
477 {
478 ps.WriteLine("<Project xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">");
479 //ps.WriteLine( "<VisualStudioProject>" );
480 //ps.WriteLine(" <{0}>", toolInfo.XMLTag);
481 //ps.WriteLine(" <Build>");
482 ps.WriteLine(" <PropertyGroup>");
483 //ps.WriteLine(" <Settings ReferencePath=\"{0}\">", MakeRefPath(project));
484 ps.WriteLine(" <Configuration Condition=\" '$(Configuration)' == '' \">Debug</Configuration>");
485 ps.WriteLine(" <Platform Condition=\" '$(Platform)' == '' \">AnyCPU</Platform>");
486 ps.WriteLine(" <ReferencePath>{0}</ReferencePath>", MakeRefPath(project));
487 ps.WriteLine(" <LastOpenVersion>{0}</LastOpenVersion>", this.ProductVersion);
488 ps.WriteLine(" <ProjectView>ProjectFiles</ProjectView>");
489 ps.WriteLine(" <ProjectTrust>0</ProjectTrust>");
490 ps.WriteLine(" </PropertyGroup>");
491 foreach (ConfigurationNode conf in project.Configurations)
492 {
493 ps.Write(" <PropertyGroup");
494 ps.Write(" Condition = \" '$(Configuration)|$(Platform)' == '{0}|AnyCPU' \"", conf.Name);
495 ps.WriteLine(" />");
496 }
497 ps.WriteLine("</Project>");
498 }
499 #endregion
500
501 kernel.CurrentWorkingDirectory.Pop();
502 }
503
504 private void WriteSolution(SolutionNode solution, bool writeSolutionToDisk)
505 {
506 kernel.Log.Write("Creating {0} solution and project files", this.VersionName);
507
508 foreach (SolutionNode child in solution.Solutions)
509 {
510 kernel.Log.Write("...Creating folder: {0}", child.Name);
511 WriteSolution(child, false);
512 }
513
514 foreach (ProjectNode project in solution.Projects)
515 {
516 kernel.Log.Write("...Creating project: {0}", project.Name);
517 WriteProject(solution, project);
518 }
519
520 foreach (DatabaseProjectNode project in solution.DatabaseProjects)
521 {
522 kernel.Log.Write("...Creating database project: {0}", project.Name);
523 WriteDatabaseProject(solution, project);
524 }
525
526 if (writeSolutionToDisk) // only write main solution
527 {
528 kernel.Log.Write("");
529 string solutionFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "sln");
530
531 using (StreamWriter ss = new StreamWriter(solutionFile))
532 {
533 kernel.CurrentWorkingDirectory.Push();
534 Helper.SetCurrentDir(Path.GetDirectoryName(solutionFile));
535
536 ss.WriteLine("Microsoft Visual Studio Solution File, Format Version {0}", this.SolutionVersion);
537 ss.WriteLine(SolutionTag);
538
539 WriteProjectDeclarations(ss, solution, solution);
540
541 ss.WriteLine("Global");
542
543 ss.WriteLine("\tGlobalSection(SolutionConfigurationPlatforms) = preSolution");
544 foreach (ConfigurationNode conf in solution.Configurations)
545 {
546 ss.WriteLine("\t\t{0}|Any CPU = {0}|Any CPU", conf.Name);
547 }
548 ss.WriteLine("\tEndGlobalSection");
549
550 ss.WriteLine("\tGlobalSection(ProjectConfigurationPlatforms) = postSolution");
551 WriteConfigurationLines(solution.Configurations, solution, ss);
552 ss.WriteLine("\tEndGlobalSection");
553
554 if (solution.Solutions.Count > 0)
555 {
556 ss.WriteLine("\tGlobalSection(NestedProjects) = preSolution");
557 foreach (SolutionNode embeddedSolution in solution.Solutions)
558 {
559 WriteNestedProjectMap(ss, embeddedSolution);
560 }
561 ss.WriteLine("\tEndGlobalSection");
562 }
563
564 ss.WriteLine("EndGlobal");
565 }
566
567 kernel.CurrentWorkingDirectory.Pop();
568 }
569 }
570
571 private void WriteProjectDeclarations(StreamWriter writer, SolutionNode actualSolution, SolutionNode embeddedSolution)
572 {
573 foreach (SolutionNode childSolution in embeddedSolution.Solutions)
574 {
575 WriteEmbeddedSolution(writer, childSolution);
576 WriteProjectDeclarations(writer, actualSolution, childSolution);
577 }
578
579 foreach (ProjectNode project in embeddedSolution.Projects)
580 {
581 WriteProject(actualSolution, writer, project);
582 }
583
584 foreach (DatabaseProjectNode dbProject in embeddedSolution.DatabaseProjects)
585 {
586 WriteProject(actualSolution, writer, dbProject);
587 }
588
589 if (actualSolution.Guid == embeddedSolution.Guid)
590 {
591 WriteSolutionFiles(actualSolution, writer);
592 }
593 }
594
595 private static void WriteNestedProjectMap(StreamWriter writer, SolutionNode embeddedSolution)
596 {
597 foreach (ProjectNode project in embeddedSolution.Projects)
598 {
599 WriteNestedProject(writer, embeddedSolution, project.Guid);
600 }
601
602 foreach (DatabaseProjectNode dbProject in embeddedSolution.DatabaseProjects)
603 {
604 WriteNestedProject(writer, embeddedSolution, dbProject.Guid);
605 }
606
607 foreach (SolutionNode child in embeddedSolution.Solutions)
608 {
609 WriteNestedProject(writer, embeddedSolution, child.Guid);
610 WriteNestedProjectMap(writer, child);
611 }
612 }
613
614 private static void WriteNestedProject(StreamWriter writer, SolutionNode solution, Guid projectGuid)
615 {
616 WriteNestedFolder(writer, solution.Guid, projectGuid);
617 }
618
619 private static void WriteNestedFolder(StreamWriter writer, Guid parentGuid, Guid childGuid)
620 {
621 writer.WriteLine("\t\t{0} = {1}",
622 childGuid.ToString("B").ToUpper(),
623 parentGuid.ToString("B").ToUpper());
624 }
625
626 private static void WriteConfigurationLines(ICollection configurations, SolutionNode solution, StreamWriter ss)
627 {
628 foreach (ProjectNode project in solution.Projects)
629 {
630 foreach (ConfigurationNode conf in configurations)
631 {
632 ss.WriteLine("\t\t{0}.{1}|Any CPU.ActiveCfg = {1}|Any CPU",
633 project.Guid.ToString("B").ToUpper(),
634 conf.Name);
635
636 ss.WriteLine("\t\t{0}.{1}|Any CPU.Build.0 = {1}|Any CPU",
637 project.Guid.ToString("B").ToUpper(),
638 conf.Name);
639 }
640 }
641
642 foreach (SolutionNode child in solution.Solutions)
643 {
644 WriteConfigurationLines(configurations, child, ss);
645 }
646 }
647
648 private void WriteSolutionFiles(SolutionNode solution, StreamWriter ss)
649 {
650 WriteProject(ss, "Folder", solution.Guid, "Solution Files", "Solution Files", solution.Files);
651 }
652
653 private void WriteEmbeddedSolution(StreamWriter writer, SolutionNode embeddedSolution)
654 {
655 WriteProject(writer, "Folder", embeddedSolution.Guid, embeddedSolution.Name, embeddedSolution.Name, embeddedSolution.Files);
656 }
657
658 private void WriteProject(SolutionNode solution, StreamWriter ss, ProjectNode project)
659 {
660 WriteProject(ss, solution, project.Language, project.Guid, project.Name, project.FullPath);
661 }
662
663 private void WriteProject(SolutionNode solution, StreamWriter ss, DatabaseProjectNode dbProject)
664 {
665 if (solution.Files != null && solution.Files.Count > 0)
666 WriteProject(ss, solution, "Database", dbProject.Guid, dbProject.Name, dbProject.FullPath);
667 }
668
669 private static bool ExtensionSpecified(string refName)
670 {
671 return refName.EndsWith(".dll") || refName.EndsWith(".exe");
672 }
673
674 private static string GetProjectExtension(ProjectNode project)
675 {
676 string extension = ".dll";
677 if (project.Type == ProjectType.Exe)
678 {
679 extension = ".exe";
680 }
681 return extension;
682 }
683
684 const string ProjectDeclarationBeginFormat = "Project(\"{0}\") = \"{1}\", \"{2}\", \"{3}\"";
685 const string ProjectDeclarationEndFormat = "EndProject";
686
687 private void WriteProject(StreamWriter ss, SolutionNode solution, string language, Guid guid, string name, string projectFullPath)
688 {
689 if (!tools.ContainsKey(language))
690 throw new UnknownLanguageException("Unknown .NET language: " + language);
691
692 ToolInfo toolInfo = (ToolInfo)tools[language];
693
694 string path = Helper.MakePathRelativeTo(solution.FullPath, projectFullPath);
695
696 path = Helper.MakeFilePath(path, name, toolInfo.FileExtension);
697
698 WriteProject(ss, language, guid, name, path);
699 }
700
701 private void WriteProject(StreamWriter writer, string language, Guid projectGuid, string name, string location)
702 {
703 WriteProject(writer, language, projectGuid, name, location, null);
704 }
705
706 private void WriteProject(StreamWriter writer, string language, Guid projectGuid, string name, string location, FilesNode files)
707 {
708 if (!tools.ContainsKey(language))
709 throw new UnknownLanguageException("Unknown .NET language: " + language);
710
711 ToolInfo toolInfo = (ToolInfo)tools[language];
712
713 writer.WriteLine(ProjectDeclarationBeginFormat,
714 toolInfo.Guid,
715 name,
716 location,
717 projectGuid.ToString("B").ToUpper());
718
719 if (files != null)
720 {
721 writer.WriteLine("\tProjectSection(SolutionItems) = preProject");
722
723 foreach (string file in files)
724 writer.WriteLine("\t\t{0} = {0}", file);
725
726 writer.WriteLine("\tEndProjectSection");
727 }
728
729 writer.WriteLine(ProjectDeclarationEndFormat);
730 }
731
732 private void WriteDatabaseProject(SolutionNode solution, DatabaseProjectNode project)
733 {
734 string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, "dbp");
735 IndentedTextWriter ps = new IndentedTextWriter(new StreamWriter(projectFile), " ");
736
737 kernel.CurrentWorkingDirectory.Push();
738
739 Helper.SetCurrentDir(Path.GetDirectoryName(projectFile));
740
741 using (ps)
742 {
743 ps.WriteLine("# Microsoft Developer Studio Project File - Database Project");
744 ps.WriteLine("Begin DataProject = \"{0}\"", project.Name);
745 ps.Indent++;
746 ps.WriteLine("MSDTVersion = \"80\"");
747 // TODO: Use the project.Files property
748 if (ContainsSqlFiles(Path.GetDirectoryName(projectFile)))
749 WriteDatabaseFoldersAndFiles(ps, Path.GetDirectoryName(projectFile));
750
751 ps.WriteLine("Begin DBRefFolder = \"Database References\"");
752 ps.Indent++;
753 foreach (DatabaseReferenceNode reference in project.References)
754 {
755 ps.WriteLine("Begin DBRefNode = \"{0}\"", reference.Name);
756 ps.Indent++;
757 ps.WriteLine("ConnectStr = \"{0}\"", reference.ConnectionString);
758 ps.WriteLine("Provider = \"{0}\"", reference.ProviderId.ToString("B").ToUpper());
759 //ps.WriteLine("Colorizer = 5");
760 ps.Indent--;
761 ps.WriteLine("End");
762 }
763 ps.Indent--;
764 ps.WriteLine("End");
765 ps.Indent--;
766 ps.WriteLine("End");
767
768 ps.Flush();
769 }
770
771 kernel.CurrentWorkingDirectory.Pop();
772 }
773
774 private bool ContainsSqlFiles(string folder)
775 {
776 foreach (string file in Directory.GetFiles(folder, "*.sql"))
777 {
778 return true; // if the folder contains 1 .sql file, that's good enough
779 }
780
781 foreach (string child in Directory.GetDirectories(folder))
782 {
783 if (ContainsSqlFiles(child))
784 return true; // if 1 child folder contains a .sql file, still good enough
785 }
786
787 return false;
788 }
789
790 private void WriteDatabaseFoldersAndFiles(IndentedTextWriter writer, string folder)
791 {
792 foreach (string child in Directory.GetDirectories(folder))
793 {
794 if (ContainsSqlFiles(child))
795 {
796 writer.WriteLine("Begin Folder = \"{0}\"", Path.GetFileName(child));
797 writer.Indent++;
798 WriteDatabaseFoldersAndFiles(writer, child);
799 writer.Indent--;
800 writer.WriteLine("End");
801 }
802 }
803 foreach (string file in Directory.GetFiles(folder, "*.sql"))
804 {
805 writer.WriteLine("Script = \"{0}\"", Path.GetFileName(file));
806 }
807 }
808
809 private void CleanProject(ProjectNode project)
810 {
811 kernel.Log.Write("...Cleaning project: {0}", project.Name);
812
813 ToolInfo toolInfo = (ToolInfo)tools[project.Language];
814 string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, toolInfo.FileExtension);
815 string userFile = projectFile + ".user";
816
817 Helper.DeleteIfExists(projectFile);
818 Helper.DeleteIfExists(userFile);
819 }
820
821 private void CleanSolution(SolutionNode solution)
822 {
823 kernel.Log.Write("Cleaning {0} solution and project files", this.VersionName, solution.Name);
824
825 string slnFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "sln");
826 string suoFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "suo");
827
828 Helper.DeleteIfExists(slnFile);
829 Helper.DeleteIfExists(suoFile);
830
831 foreach (ProjectNode project in solution.Projects)
832 {
833 CleanProject(project);
834 }
835
836 kernel.Log.Write("");
837 }
838
839 #endregion
840
841 #region ITarget Members
842
843 /// <summary>
844 /// Writes the specified kern.
845 /// </summary>
846 /// <param name="kern">The kern.</param>
847 public virtual void Write(Kernel kern)
848 {
849 if (kern == null)
850 {
851 throw new ArgumentNullException("kern");
852 }
853 kernel = kern;
854 foreach (SolutionNode sol in kernel.Solutions)
855 {
856 WriteSolution(sol, true);
857 }
858 kernel = null;
859 }
860
861 /// <summary>
862 /// Cleans the specified kern.
863 /// </summary>
864 /// <param name="kern">The kern.</param>
865 public virtual void Clean(Kernel kern)
866 {
867 if (kern == null)
868 {
869 throw new ArgumentNullException("kern");
870 }
871 kernel = kern;
872 foreach (SolutionNode sol in kernel.Solutions)
873 {
874 CleanSolution(sol);
875 }
876 kernel = null;
877 }
878
879 #endregion
880 }
881}
diff --git a/Prebuild/src/Core/Targets/VSVersion.cs b/Prebuild/src/Core/Targets/VSVersion.cs
deleted file mode 100644
index f477086..0000000
--- a/Prebuild/src/Core/Targets/VSVersion.cs
+++ /dev/null
@@ -1,50 +0,0 @@
1#region BSD License
2/*
3Copyright (c) 2008-2009 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com), John Anderson (sontek@gmail.com)
4
5Redistribution and use in source and binary forms, with or without modification, are permitted
6provided that the following conditions are met:
7
8* Redistributions of source code must retain the above copyright notice, this list of conditions
9 and the following disclaimer.
10* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
11 and the following disclaimer in the documentation and/or other materials provided with the
12 distribution.
13* The name of the author may not be used to endorse or promote products derived from this software
14 without specific prior written permission.
15
16THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
17BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
19EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
22IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23*/
24#endregion
25
26namespace Prebuild.Core.Targets
27{
28 /// <summary>
29 ///
30 /// </summary>
31 public enum VSVersion
32 {
33 /// <summary>
34 /// Visual Studio 2002
35 /// </summary>
36 VS70,
37 /// <summary>
38 /// Visual Studio 2003
39 /// </summary>
40 VS71,
41 /// <summary>
42 /// Visual Studio 2005
43 /// </summary>
44 VS80,
45 /// <summary>
46 /// Visual Studio 2008
47 /// </summary>
48 VS90
49 }
50}
diff --git a/Prebuild/src/Core/Targets/XcodeTarget.cs b/Prebuild/src/Core/Targets/XcodeTarget.cs
index d96f65b..ee3b241 100644
--- a/Prebuild/src/Core/Targets/XcodeTarget.cs
+++ b/Prebuild/src/Core/Targets/XcodeTarget.cs
@@ -23,6 +23,15 @@ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY O
23*/ 23*/
24#endregion 24#endregion
25 25
26#region CVS Information
27/*
28 * $Source$
29 * $Author: jendave $
30 * $Date: 2007-02-13 12:58:03 -0800 (Tue, 13 Feb 2007) $
31 * $Revision: 205 $
32 */
33#endregion
34
26using System; 35using System;
27using System.Collections; 36using System.Collections;
28using System.Collections.Specialized; 37using System.Collections.Specialized;
diff --git a/Prebuild/src/Core/Utilities/CommandLineCollection.cs b/Prebuild/src/Core/Utilities/CommandLineCollection.cs
index 22752aa..5733547 100644
--- a/Prebuild/src/Core/Utilities/CommandLineCollection.cs
+++ b/Prebuild/src/Core/Utilities/CommandLineCollection.cs
@@ -23,6 +23,15 @@ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY O
23*/ 23*/
24#endregion 24#endregion
25 25
26#region CVS Information
27/*
28 * $Source$
29 * $Author: robloach $
30 * $Date: 2006-09-26 07:30:53 +0900 (Tue, 26 Sep 2006) $
31 * $Revision: 165 $
32 */
33#endregion
34
26using System; 35using System;
27using System.Collections; 36using System.Collections;
28using System.Collections.Specialized; 37using System.Collections.Specialized;
diff --git a/Prebuild/src/Core/Utilities/CurrentDirectory.cs b/Prebuild/src/Core/Utilities/CurrentDirectory.cs
index 5fabdf0..abbed52 100644
--- a/Prebuild/src/Core/Utilities/CurrentDirectory.cs
+++ b/Prebuild/src/Core/Utilities/CurrentDirectory.cs
@@ -23,6 +23,15 @@ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY O
23*/ 23*/
24#endregion 24#endregion
25 25
26#region CVS Information
27/*
28 * $Source$
29 * $Author: jendave $
30 * $Date: 2006-01-28 09:49:58 +0900 (Sat, 28 Jan 2006) $
31 * $Revision: 71 $
32 */
33#endregion
34
26using System; 35using System;
27using System.Collections; 36using System.Collections;
28 37
diff --git a/Prebuild/src/Core/Utilities/Helper.cs b/Prebuild/src/Core/Utilities/Helper.cs
index 9a0d131..19093ce 100644
--- a/Prebuild/src/Core/Utilities/Helper.cs
+++ b/Prebuild/src/Core/Utilities/Helper.cs
@@ -23,6 +23,15 @@ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY O
23*/ 23*/
24#endregion 24#endregion
25 25
26#region CVS Information
27/*
28 * $Source$
29 * $Author: jendave $
30 * $Date: 2007-02-14 05:58:03 +0900 (Wed, 14 Feb 2007) $
31 * $Revision: 205 $
32 */
33#endregion
34
26using System; 35using System;
27using System.Collections; 36using System.Collections;
28using System.Diagnostics; 37using System.Diagnostics;
@@ -280,8 +289,6 @@ namespace Prebuild.Core.Utilities
280 return true; 289 return true;
281 } 290 }
282 291
283 static readonly char seperator = Path.DirectorySeparatorChar;
284
285 // This little gem was taken from the NeL source, thanks guys! 292 // This little gem was taken from the NeL source, thanks guys!
286 /// <summary> 293 /// <summary>
287 /// Makes a relative path 294 /// Makes a relative path
@@ -291,8 +298,8 @@ namespace Prebuild.Core.Utilities
291 /// <returns>Path that will get from startPath to endPath</returns> 298 /// <returns>Path that will get from startPath to endPath</returns>
292 public static string MakePathRelativeTo(string startPath, string endPath) 299 public static string MakePathRelativeTo(string startPath, string endPath)
293 { 300 {
294 string tmp = NormalizePath(startPath, seperator); 301 string tmp = NormalizePath(startPath, '/');
295 string src = NormalizePath(endPath, seperator); 302 string src = NormalizePath(endPath, '/');
296 string prefix = ""; 303 string prefix = "";
297 304
298 while(true) 305 while(true)
@@ -305,14 +312,14 @@ namespace Prebuild.Core.Utilities
305 { 312 {
306 return "./"; 313 return "./";
307 } 314 }
308 if((src.Length > tmp.Length) && src[tmp.Length - 1] != seperator) 315 if ((src.Length > tmp.Length) && src[tmp.Length-1] != '/' && src[tmp.Length-1] != '\\')
309 { 316 {
310 } 317 }
311 else 318 else
312 { 319 {
313 ret = prefix + endPath.Substring(size, endPath.Length - size); 320 ret = prefix + endPath.Substring(size, endPath.Length - size);
314 ret = ret.Trim(); 321 ret = ret.Trim();
315 if(ret[0] == seperator) 322 if(ret[0] == '/' || ret[0] == '\\')
316 { 323 {
317 ret = "." + ret; 324 ret = "." + ret;
318 } 325 }
@@ -327,8 +334,8 @@ namespace Prebuild.Core.Utilities
327 break; 334 break;
328 } 335 }
329 336
330 int lastPos = tmp.LastIndexOf(seperator, tmp.Length - 2); 337 int lastPos = tmp.LastIndexOf('/', tmp.Length - 2);
331 int prevPos = tmp.IndexOf(seperator); 338 int prevPos = tmp.IndexOf('/');
332 339
333 if((lastPos == prevPos) || (lastPos == -1)) 340 if((lastPos == prevPos) || (lastPos == -1))
334 { 341 {
@@ -336,7 +343,7 @@ namespace Prebuild.Core.Utilities
336 } 343 }
337 344
338 tmp = tmp.Substring(0, lastPos + 1); 345 tmp = tmp.Substring(0, lastPos + 1);
339 prefix += ".." + seperator.ToString(); 346 prefix += "../";
340 } 347 }
341 348
342 return endPath; 349 return endPath;
diff --git a/Prebuild/src/Core/Utilities/Log.cs b/Prebuild/src/Core/Utilities/Log.cs
index 548e987..e8105ac 100644
--- a/Prebuild/src/Core/Utilities/Log.cs
+++ b/Prebuild/src/Core/Utilities/Log.cs
@@ -23,6 +23,15 @@ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY O
23*/ 23*/
24#endregion 24#endregion
25 25
26#region CVS Information
27/*
28 * $Source$
29 * $Author: jendave $
30 * $Date: 2006-01-28 09:49:58 +0900 (Sat, 28 Jan 2006) $
31 * $Revision: 71 $
32 */
33#endregion
34
26using System; 35using System;
27using System.IO; 36using System.IO;
28 37
diff --git a/Prebuild/src/Prebuild.cs b/Prebuild/src/Prebuild.cs
index 2d12b53..922b4c9 100644
--- a/Prebuild/src/Prebuild.cs
+++ b/Prebuild/src/Prebuild.cs
@@ -27,7 +27,7 @@ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY O
27/* 27/*
28 * $Source$ 28 * $Source$
29 * $Author: jendave $ 29 * $Author: jendave $
30 * $Date: 2006-09-26 23:43:35 +0200 (ti, 26 sep 2006) $ 30 * $Date: 2006-09-27 06:43:35 +0900 (Wed, 27 Sep 2006) $
31 * $Revision: 168 $ 31 * $Revision: 168 $
32 */ 32 */
33#endregion 33#endregion
diff --git a/Prebuild/src/Properties/AssemblyInfo.cs b/Prebuild/src/Properties/AssemblyInfo.cs
index 65c8736..e49aea5 100644
--- a/Prebuild/src/Properties/AssemblyInfo.cs
+++ b/Prebuild/src/Properties/AssemblyInfo.cs
@@ -38,6 +38,15 @@ POSSIBILITY OF SUCH DAMAGE.
38*/ 38*/
39#endregion 39#endregion
40 40
41#region CVS Information
42/*
43 * $Source$
44 * $Author: cjcollier $
45 * $Date: 2008-02-08 01:31:29 +0900 (Fri, 08 Feb 2008) $
46 * $Revision: 256 $
47 */
48#endregion
49
41using System; 50using System;
42using System.Reflection; 51using System.Reflection;
43using System.Runtime.CompilerServices; 52using System.Runtime.CompilerServices;
@@ -70,7 +79,7 @@ using System.Resources;
70[assembly: AssemblyTrademark("")] 79[assembly: AssemblyTrademark("")]
71[assembly: AssemblyCulture("")] 80[assembly: AssemblyCulture("")]
72[assembly: NeutralResourcesLanguageAttribute("en-US")] 81[assembly: NeutralResourcesLanguageAttribute("en-US")]
73[assembly: AssemblyVersion("2.0.4.*")] 82[assembly: AssemblyVersion("2.0.3.*")]
74 83
75// 84//
76// Version information for an assembly consists of the following four values: 85// Version information for an assembly consists of the following four values:
diff --git a/Prebuild/src/data/prebuild-1.7.xsd b/Prebuild/src/data/prebuild-1.7.xsd
index c3f8d6b..3c108f3 100644
--- a/Prebuild/src/data/prebuild-1.7.xsd
+++ b/Prebuild/src/data/prebuild-1.7.xsd
@@ -2,40 +2,39 @@
2<xs:schema elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://dnpb.sourceforge.net/schemas/prebuild-1.7.xsd" xmlns="http://dnpb.sourceforge.net/schemas/prebuild-1.7.xsd"> 2<xs:schema elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://dnpb.sourceforge.net/schemas/prebuild-1.7.xsd" xmlns="http://dnpb.sourceforge.net/schemas/prebuild-1.7.xsd">
3 <xs:annotation> 3 <xs:annotation>
4 <xs:documentation> 4 <xs:documentation>
5 Copyright (c) 2004-2007 5 Copyright (c) 2004-2007
6 Matthew Holmes (calefaction at houston . rr . com), 6 Matthew Holmes (calefaction at houston . rr . com),
7 Dan Moorehead (dan05a at gmail . com), 7 Dan Moorehead (dan05a at gmail . com),
8 David Hudson (jendave at yahoo dot com), 8 David Hudson (jendave at yahoo dot com),
9 C.J. Adams-Collier (cjac at colliertech dot com) 9 C.J. Adams-Collier (cjac at colliertech dot com)
10 10
11 .NET Prebuild is a cross-platform XML-driven pre-build tool which 11 .NET Prebuild is a cross-platform XML-driven pre-build tool which
12 allows developers to easily generate project or make files for major 12 allows developers to easily generate project or make files for major
13 IDE's and .NET development tools including: Visual Studio .NET 2002, 13 IDE's and .NET development tools including: Visual Studio .NET 2002,
14 2003, and 2005, SharpDevelop, MonoDevelop, NAnt, Xcode and the GNU Autotools. 14 2003, and 2005, SharpDevelop, MonoDevelop, NAnt, Xcode and the GNU Autotools.
15 15
16 BSD License: 16 BSD License:
17
18 Redistribution and use in source and binary forms, with or without modification, are permitted
19 provided that the following conditions are met:
17 20
18 Redistribution and use in source and binary forms, with or without modification, are permitted 21 * Redistributions of source code must retain the above copyright notice, this list of conditions
19 provided that the following conditions are met: 22 and the following disclaimer.
23 * Redistributions in binary form must reproduce the above copyright notice, this list of conditions
24 and the following disclaimer in the documentation and/or other materials provided with the
25 distribution.
26 * The name of the author may not be used to endorse or promote products derived from this software
27 without specific prior written permission.
20 28
21 * Redistributions of source code must retain the above copyright notice, this list of conditions 29 THIS SOFTWARE IS PROVIDED BY THE AUTHOR 'AS IS' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
22 and the following disclaimer. 30 BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 * Redistributions in binary form must reproduce the above copyright notice, this list of conditions 31 ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
24 and the following disclaimer in the documentation and/or other materials provided with the 32 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25 distribution. 33 OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
26 * The name of the author may not be used to endorse or promote products derived from this software 34 OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
27 without specific prior written permission. 35 IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 36 </xs:documentation>
29 THIS SOFTWARE IS PROVIDED BY THE AUTHOR 'AS IS' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
30 BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
31 ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
32 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
33 OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
34 OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
35 IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 </xs:documentation>
37 </xs:annotation> 37 </xs:annotation>
38
39 <xs:element name="Prebuild"> 38 <xs:element name="Prebuild">
40 <xs:complexType> 39 <xs:complexType>
41 <xs:sequence> 40 <xs:sequence>
@@ -46,35 +45,14 @@
46 <xs:attribute name="checkOsVars" /> 45 <xs:attribute name="checkOsVars" />
47 </xs:complexType> 46 </xs:complexType>
48 </xs:element> 47 </xs:element>
49
50 <xs:element name="Process" type="xs:string" /> 48 <xs:element name="Process" type="xs:string" />
51
52 <xs:element name="Solution"> 49 <xs:element name="Solution">
53 <xs:complexType> 50 <xs:complexType>
54 <xs:sequence> 51 <xs:sequence>
55 <xs:element ref="Configuration" minOccurs="1" maxOccurs="unbounded" />
56 <xs:element ref="Process" minOccurs="0" maxOccurs="unbounded" />
57 <xs:element ref="Options" minOccurs="0" /> 52 <xs:element ref="Options" minOccurs="0" />
53 <xs:element ref="Configuration" minOccurs="1" maxOccurs="unbounded" />
58 <xs:element ref="Files" minOccurs="0" /> 54 <xs:element ref="Files" minOccurs="0" />
59 <xs:element ref="Project" minOccurs="0" maxOccurs="unbounded" /> 55 <xs:element ref="Project" minOccurs="1" maxOccurs="unbounded" />
60 <xs:element ref="DatabaseProject" minOccurs="0" maxOccurs="unbounded" />
61 <xs:element ref="EmbeddedSolution" minOccurs="0" maxOccurs="unbounded" />
62 </xs:sequence>
63 <xs:attribute name="name" type="xs:string" use="required" />
64 <xs:attribute name="activeConfig" type="xs:string" default="Debug" />
65 <xs:attribute name="path" type="xs:string" default="" />
66 <xs:attribute name="version" type="xs:string" default="1.0.0" />
67 </xs:complexType>
68 </xs:element>
69
70 <xs:element name="EmbeddedSolution">
71 <xs:complexType>
72 <xs:sequence>
73 <xs:element ref="Process" minOccurs="0" maxOccurs="unbounded" />
74 <xs:element ref="Files" minOccurs="0" />
75 <xs:element ref="Project" minOccurs="0" maxOccurs="unbounded" />
76 <xs:element ref="DatabaseProject" minOccurs="0" maxOccurs="unbounded" />
77 <xs:element ref="EmbeddedSolution" minOccurs="0" maxOccurs="unbounded" />
78 </xs:sequence> 56 </xs:sequence>
79 <xs:attribute name="name" type="xs:string" use="required" /> 57 <xs:attribute name="name" type="xs:string" use="required" />
80 <xs:attribute name="activeConfig" type="xs:string" default="Debug" /> 58 <xs:attribute name="activeConfig" type="xs:string" default="Debug" />
@@ -82,33 +60,12 @@
82 <xs:attribute name="version" type="xs:string" default="1.0.0" /> 60 <xs:attribute name="version" type="xs:string" default="1.0.0" />
83 </xs:complexType> 61 </xs:complexType>
84 </xs:element> 62 </xs:element>
85
86 <xs:element name="DatabaseProject">
87 <xs:complexType>
88 <xs:sequence>
89 <xs:element name="Author" type="xs:string" minOccurs="0" maxOccurs="unbounded" />
90 <xs:element ref="DatabaseReference" minOccurs="0" maxOccurs="unbounded" />
91 </xs:sequence>
92 <xs:attribute name="name" type="xs:string" use="required" />
93 <xs:attribute name="path" type="xs:string" />
94 </xs:complexType>
95 </xs:element>
96
97 <xs:element name="DatabaseReference">
98 <xs:complexType>
99 <xs:attribute name="name" type="xs:string" use="required" />
100 <xs:attribute name="providerId" type="xs:string" />
101 <xs:attribute name="providerName" type="xs:string" />
102 <xs:attribute name="connectionString" type="xs:string" use="required" />
103 </xs:complexType>
104 </xs:element>
105
106 <xs:element name="Project"> 63 <xs:element name="Project">
107 <xs:complexType> 64 <xs:complexType>
108 <xs:sequence> 65 <xs:sequence>
109 <xs:element name="Author" type="xs:string" minOccurs="0" maxOccurs="unbounded" /> 66 <xs:element name="Author" type="xs:string" minOccurs="0" maxOccurs="unbounded" />
110 <xs:element name="Description" type="xs:string" minOccurs="0" maxOccurs="1" /> 67 <xs:element name="Description" type="xs:string" minOccurs="0" maxOccurs="1" />
111 <xs:element ref="Configuration" minOccurs="1" maxOccurs="unbounded" /> 68 <xs:element ref="Configuration" minOccurs="0" maxOccurs="unbounded" />
112 <xs:element name="ReferencePath" type="xs:string" minOccurs="0" maxOccurs="unbounded" /> 69 <xs:element name="ReferencePath" type="xs:string" minOccurs="0" maxOccurs="unbounded" />
113 <xs:element name="Reference" minOccurs="0" maxOccurs="unbounded"> 70 <xs:element name="Reference" minOccurs="0" maxOccurs="unbounded">
114 <xs:complexType> 71 <xs:complexType>
@@ -127,7 +84,6 @@
127 <xs:attribute name="icon" type="xs:string" default="" /> 84 <xs:attribute name="icon" type="xs:string" default="" />
128 <xs:attribute name="configFile" type="xs:string" default="" /> 85 <xs:attribute name="configFile" type="xs:string" default="" />
129 <xs:attribute name="version" type="xs:string" default="1.0.0" /> 86 <xs:attribute name="version" type="xs:string" default="1.0.0" />
130 <xs:attribute name="guid" type="xs:string"/>
131 <xs:attribute name="language" default="C#"> 87 <xs:attribute name="language" default="C#">
132 <xs:simpleType> 88 <xs:simpleType>
133 <xs:restriction base="xs:string"> 89 <xs:restriction base="xs:string">
@@ -142,7 +98,6 @@
142 <xs:enumeration value="Exe" /> 98 <xs:enumeration value="Exe" />
143 <xs:enumeration value="WinExe" /> 99 <xs:enumeration value="WinExe" />
144 <xs:enumeration value="Library" /> 100 <xs:enumeration value="Library" />
145 <xs:enumeration value="Web" />
146 </xs:restriction> 101 </xs:restriction>
147 </xs:simpleType> 102 </xs:simpleType>
148 </xs:attribute> 103 </xs:attribute>
@@ -154,23 +109,12 @@
154 </xs:restriction> 109 </xs:restriction>
155 </xs:simpleType> 110 </xs:simpleType>
156 </xs:attribute> 111 </xs:attribute>
157 <xs:attribute name="frameworkVersion" default="v2_0">
158 <xs:simpleType>
159 <xs:restriction base="xs:string">
160 <xs:enumeration value="v2_0" />
161 <xs:enumeration value="v3_0" />
162 <xs:enumeration value="v3_5" />
163 </xs:restriction>
164 </xs:simpleType>
165 </xs:attribute>
166 <xs:attribute name="startupObject" type="xs:string" default="" /> 112 <xs:attribute name="startupObject" type="xs:string" default="" />
167 <xs:attribute name="rootNamespace" type="xs:string" /> 113 <xs:attribute name="rootNamespace" type="xs:string" />
168 <xs:attribute name="debugStartParameters" type="xs:string" />
169 <xs:attribute name="assemblyName" type="xs:string" /> 114 <xs:attribute name="assemblyName" type="xs:string" />
170 <xs:attribute name="generateAssemblyInfoFile" type="xs:boolean" default="false" /> 115 <xs:attribute name="generateAssemblyInfoFile" type="xs:boolean" default="false" />
171 </xs:complexType> 116 </xs:complexType>
172 </xs:element> 117 </xs:element>
173
174 <xs:element name="Configuration"> 118 <xs:element name="Configuration">
175 <xs:complexType> 119 <xs:complexType>
176 <xs:sequence> 120 <xs:sequence>
@@ -251,7 +195,6 @@
251 <xs:simpleType> 195 <xs:simpleType>
252 <xs:restriction base="xs:string"> 196 <xs:restriction base="xs:string">
253 <xs:enumeration value="Code" /> 197 <xs:enumeration value="Code" />
254 <xs:enumeration value="CodeBehind" />
255 <xs:enumeration value="Component" /> 198 <xs:enumeration value="Component" />
256 <xs:enumeration value="Form" /> 199 <xs:enumeration value="Form" />
257 <xs:enumeration value="Settings" /> 200 <xs:enumeration value="Settings" />
@@ -299,7 +242,6 @@
299 <xs:simpleType> 242 <xs:simpleType>
300 <xs:restriction base="xs:string"> 243 <xs:restriction base="xs:string">
301 <xs:enumeration value="Code" /> 244 <xs:enumeration value="Code" />
302 <xs:enumeration value="CodeBehind" />
303 <xs:enumeration value="Component" /> 245 <xs:enumeration value="Component" />
304 <xs:enumeration value="Designer" /> 246 <xs:enumeration value="Designer" />
305 <xs:enumeration value="Form" /> 247 <xs:enumeration value="Form" />