aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Prebuild/src
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--Prebuild/src/Core/Kernel.cs83
-rw-r--r--Prebuild/src/Core/Nodes/AuthorNode.cs2
-rw-r--r--Prebuild/src/Core/Nodes/CleanFilesNode.cs80
-rw-r--r--Prebuild/src/Core/Nodes/CleanupNode.cs85
-rw-r--r--Prebuild/src/Core/Nodes/ConfigurationNode.cs49
-rw-r--r--Prebuild/src/Core/Nodes/ConfigurationNodeCollection.cs71
-rw-r--r--Prebuild/src/Core/Nodes/DataNode.cs2
-rw-r--r--Prebuild/src/Core/Nodes/DatabaseProjectNode.cs1
-rw-r--r--Prebuild/src/Core/Nodes/DescriptionNode.cs2
-rw-r--r--Prebuild/src/Core/Nodes/FileNode.cs16
-rw-r--r--Prebuild/src/Core/Nodes/FilesNode.cs121
-rw-r--r--Prebuild/src/Core/Nodes/MatchNode.cs145
-rw-r--r--Prebuild/src/Core/Nodes/OptionsNode.cs20
-rw-r--r--Prebuild/src/Core/Nodes/ProcessNode.cs2
-rw-r--r--Prebuild/src/Core/Nodes/ProjectNode.cs37
-rw-r--r--Prebuild/src/Core/Nodes/ReferencePathNode.cs2
-rw-r--r--Prebuild/src/Core/Nodes/SolutionNode.cs74
-rw-r--r--Prebuild/src/Core/Parse/Preprocessor.cs267
-rw-r--r--Prebuild/src/Core/Targets/.NAntTarget.cs.swpbin0 -> 49152 bytes
-rw-r--r--Prebuild/src/Core/Targets/AutotoolsTarget.cs788
-rw-r--r--Prebuild/src/Core/Targets/DebugTarget.cs2
-rw-r--r--Prebuild/src/Core/Targets/MakefileTarget.cs10
-rw-r--r--Prebuild/src/Core/Targets/MonoDevelopTarget.cs61
-rw-r--r--Prebuild/src/Core/Targets/NAntTarget.cs84
-rw-r--r--Prebuild/src/Core/Targets/SharpDevelopTarget.cs3
-rw-r--r--Prebuild/src/Core/Targets/VS2003Target.cs63
-rw-r--r--Prebuild/src/Core/Targets/VS2005Target.cs2
-rw-r--r--Prebuild/src/Core/Targets/VS2008Target.cs7
-rw-r--r--Prebuild/src/Core/Targets/VS2010Target.cs202
-rw-r--r--Prebuild/src/Core/Targets/VSGenericTarget.cs619
-rw-r--r--Prebuild/src/Core/Targets/VSVersion.cs10
-rw-r--r--Prebuild/src/Core/Targets/XcodeTarget.cs2
-rw-r--r--Prebuild/src/Core/Utilities/CommandLineCollection.cs39
-rw-r--r--Prebuild/src/Core/Utilities/CurrentDirectory.cs18
-rw-r--r--Prebuild/src/Core/Utilities/Helper.cs83
-rw-r--r--Prebuild/src/Core/Utilities/Log.cs24
-rw-r--r--Prebuild/src/Core/WarningException.cs2
-rw-r--r--Prebuild/src/Prebuild.cs28
-rw-r--r--Prebuild/src/Properties/AssemblyInfo.cs7
-rw-r--r--Prebuild/src/data/prebuild-1.7.xsd21
-rw-r--r--Prebuild/src/data/prebuild-1.8.xsd331
-rw-r--r--Prebuild/src/data/prebuild-1.9.xsd336
42 files changed, 2048 insertions, 1753 deletions
diff --git a/Prebuild/src/Core/Kernel.cs b/Prebuild/src/Core/Kernel.cs
index 95ef04e..67051d5 100644
--- a/Prebuild/src/Core/Kernel.cs
+++ b/Prebuild/src/Core/Kernel.cs
@@ -36,21 +36,17 @@ POSSIBILITY OF SUCH DAMAGE.
36*/ 36*/
37#endregion 37#endregion
38 38
39#define NO_VALIDATE
40
39using System; 41using System;
40using System.Collections.Generic; 42using System.Collections.Generic;
41using System.Diagnostics;
42using System.Collections;
43using System.Collections.Specialized;
44using System.IO; 43using System.IO;
45using System.Reflection; 44using System.Reflection;
46using System.Xml; 45using System.Xml;
47using System.Xml.Schema; 46using System.Xml.Schema;
48using System.Text;
49
50using Prebuild.Core.Attributes; 47using Prebuild.Core.Attributes;
51using Prebuild.Core.Interfaces; 48using Prebuild.Core.Interfaces;
52using Prebuild.Core.Nodes; 49using Prebuild.Core.Nodes;
53using Prebuild.Core.Parse;
54using Prebuild.Core.Utilities; 50using Prebuild.Core.Utilities;
55 51
56namespace Prebuild.Core 52namespace Prebuild.Core
@@ -77,7 +73,7 @@ namespace Prebuild.Core
77 /// <summary> 73 /// <summary>
78 /// This must match the version of the schema that is embeeded 74 /// This must match the version of the schema that is embeeded
79 /// </summary> 75 /// </summary>
80 private const string m_SchemaVersion = "1.7"; 76 private const string m_SchemaVersion = "1.9";
81 private const string m_Schema = "prebuild-" + m_SchemaVersion + ".xsd"; 77 private const string m_Schema = "prebuild-" + m_SchemaVersion + ".xsd";
82 private const string m_SchemaURI = "http://dnpb.sourceforge.net/schemas/" + m_Schema; 78 private const string m_SchemaURI = "http://dnpb.sourceforge.net/schemas/" + m_Schema;
83 bool disposed; 79 bool disposed;
@@ -87,9 +83,9 @@ namespace Prebuild.Core
87 private Log m_Log; 83 private Log m_Log;
88 private CurrentDirectory m_CurrentWorkingDirectory; 84 private CurrentDirectory m_CurrentWorkingDirectory;
89 private XmlSchemaCollection m_Schemas; 85 private XmlSchemaCollection m_Schemas;
90 86
91 private Hashtable m_Targets; 87 private readonly Dictionary<string, ITarget> m_Targets = new Dictionary<string, ITarget>();
92 private Hashtable m_Nodes; 88 private readonly Dictionary<string, NodeEntry> m_Nodes = new Dictionary<string, NodeEntry>();
93 89
94 readonly List<SolutionNode> m_Solutions = new List<SolutionNode>(); 90 readonly List<SolutionNode> m_Solutions = new List<SolutionNode>();
95 string m_Target; 91 string m_Target;
@@ -163,7 +159,7 @@ namespace Prebuild.Core
163 /// Gets the targets. 159 /// Gets the targets.
164 /// </summary> 160 /// </summary>
165 /// <value>The targets.</value> 161 /// <value>The targets.</value>
166 public Hashtable Targets 162 public Dictionary<string, ITarget> Targets
167 { 163 {
168 get 164 get
169 { 165 {
@@ -259,7 +255,7 @@ namespace Prebuild.Core
259 255
260 private void LoadSchema() 256 private void LoadSchema()
261 { 257 {
262 Assembly assembly = this.GetType().Assembly; 258 Assembly assembly = GetType().Assembly;
263 Stream stream = assembly.GetManifestResourceStream("Prebuild.data." + m_Schema); 259 Stream stream = assembly.GetManifestResourceStream("Prebuild.data." + m_Schema);
264 if(stream == null) 260 if(stream == null)
265 { 261 {
@@ -319,23 +315,24 @@ namespace Prebuild.Core
319 315
320 private void LogBanner() 316 private void LogBanner()
321 { 317 {
322 m_Log.Write("Prebuild v" + this.Version); 318 m_Log.Write("Prebuild v" + Version);
323 m_Log.Write("Copyright (c) 2004-2008"); 319 m_Log.Write("Copyright (c) 2004-2010");
324 m_Log.Write("Matthew Holmes (matthew@wildfiregames.com),"); 320 m_Log.Write("Matthew Holmes (matthew@wildfiregames.com),");
325 m_Log.Write("Dan Moorehead (dan05a@gmail.com),"); 321 m_Log.Write("Dan Moorehead (dan05a@gmail.com),");
326 m_Log.Write("David Hudson (jendave@yahoo.com),"); 322 m_Log.Write("David Hudson (jendave@yahoo.com),");
327 m_Log.Write("Rob Loach (http://www.robloach.net),"); 323 m_Log.Write("Rob Loach (http://www.robloach.net),");
328 m_Log.Write("C.J. Adams-Collier (cjac@colliertech.org),"); 324 m_Log.Write("C.J. Adams-Collier (cjac@colliertech.org),");
329 325 m_Log.Write("John Hurliman (john.hurliman@intel.com),");
330 m_Log.Write("See 'prebuild /usage' for help"); 326
331 m_Log.Write(); 327 m_Log.Write("See 'prebuild /usage' for help");
328 m_Log.Write();
332 } 329 }
333 330
334 331
335 332
336 private void ProcessFile(string file) 333 private void ProcessFile(string file)
337 { 334 {
338 ProcessFile(file, this.m_Solutions); 335 ProcessFile(file, m_Solutions);
339 } 336 }
340 337
341 public void ProcessFile(ProcessNode node, SolutionNode parent) 338 public void ProcessFile(ProcessNode node, SolutionNode parent)
@@ -381,12 +378,12 @@ namespace Prebuild.Core
381 Core.Parse.Preprocessor pre = new Core.Parse.Preprocessor(); 378 Core.Parse.Preprocessor pre = new Core.Parse.Preprocessor();
382 379
383 //register command line arguments as XML variables 380 //register command line arguments as XML variables
384 IDictionaryEnumerator dict = m_CommandLine.GetEnumerator(); 381 IEnumerator<KeyValuePair<string, string>> dict = m_CommandLine.GetEnumerator();
385 while (dict.MoveNext()) 382 while (dict.MoveNext())
386 { 383 {
387 string name = dict.Key.ToString().Trim(); 384 string name = dict.Current.Key.Trim();
388 if (name.Length > 0) 385 if (name.Length > 0)
389 pre.RegisterVariable(name, dict.Value.ToString()); 386 pre.RegisterVariable(name, dict.Current.Value);
390 } 387 }
391 388
392 string xml = pre.Process(reader);//remove script and evaulate pre-proccessing to get schema-conforming XML 389 string xml = pre.Process(reader);//remove script and evaulate pre-proccessing to get schema-conforming XML
@@ -422,6 +419,10 @@ namespace Prebuild.Core
422 m_CurrentDoc = new XmlDocument(); 419 m_CurrentDoc = new XmlDocument();
423 try 420 try
424 { 421 {
422#if NO_VALIDATE
423 XmlReader validator = XmlReader.Create(new StringReader(xml));
424 m_CurrentDoc.Load(validator);
425#else
425 XmlValidatingReader validator = new XmlValidatingReader(new XmlTextReader(new StringReader(xml))); 426 XmlValidatingReader validator = new XmlValidatingReader(new XmlTextReader(new StringReader(xml)));
426 427
427 //validate while reading from string into XmlDocument DOM structure in memory 428 //validate while reading from string into XmlDocument DOM structure in memory
@@ -430,6 +431,7 @@ namespace Prebuild.Core
430 validator.Schemas.Add(schema); 431 validator.Schemas.Add(schema);
431 } 432 }
432 m_CurrentDoc.Load(validator); 433 m_CurrentDoc.Load(validator);
434#endif
433 } 435 }
434 catch(XmlException e) 436 catch(XmlException e)
435 { 437 {
@@ -541,7 +543,7 @@ namespace Prebuild.Core
541 return null; 543 return null;
542 } 544 }
543 545
544 NodeEntry ne = (NodeEntry)m_Nodes[node.Name]; 546 NodeEntry ne = m_Nodes[node.Name];
545 return ne.Type; 547 return ne.Type;
546 } 548 }
547 549
@@ -578,11 +580,11 @@ namespace Prebuild.Core
578 { 580 {
579 if(!m_Nodes.ContainsKey(node.Name)) 581 if(!m_Nodes.ContainsKey(node.Name))
580 { 582 {
581 //throw new XmlException("Unknown XML node: " + node.Name); 583 Console.WriteLine("WARNING: Unknown XML node: " + node.Name);
582 return null; 584 return null;
583 } 585 }
584 586
585 NodeEntry ne = (NodeEntry)m_Nodes[node.Name]; 587 NodeEntry ne = m_Nodes[node.Name];
586 Type type = ne.Type; 588 Type type = ne.Type;
587 //DataNodeAttribute dna = ne.Attribute; 589 //DataNodeAttribute dna = ne.Attribute;
588 590
@@ -624,10 +626,8 @@ namespace Prebuild.Core
624 /// <param name="args">The args.</param> 626 /// <param name="args">The args.</param>
625 public void Initialize(LogTargets target, string[] args) 627 public void Initialize(LogTargets target, string[] args)
626 { 628 {
627 m_Targets = new Hashtable(); 629 CacheTargets(GetType().Assembly);
628 CacheTargets(this.GetType().Assembly); 630 CacheNodeTypes(GetType().Assembly);
629 m_Nodes = new Hashtable();
630 CacheNodeTypes(this.GetType().Assembly);
631 CacheVersion(); 631 CacheVersion();
632 632
633 m_CommandLine = new CommandLineCollection(args); 633 m_CommandLine = new CommandLineCollection(args);
@@ -750,11 +750,11 @@ namespace Prebuild.Core
750 } 750 }
751 else 751 else
752 { 752 {
753 if (!m_Targets.Contains(target)) { 753 if (!m_Targets.ContainsKey(target)) {
754 m_Log.Write(LogType.Error, "Unknown Target \"{0}\"", target); 754 m_Log.Write(LogType.Error, "Unknown Target \"{0}\"", target);
755 return; 755 return;
756 } 756 }
757 ITarget targ = (ITarget)m_Targets[target]; 757 ITarget targ = m_Targets[target];
758 758
759 if(clean) 759 if(clean)
760 { 760 {
@@ -793,18 +793,19 @@ namespace Prebuild.Core
793 /// </remarks> 793 /// </remarks>
794 protected virtual void Dispose(bool disposing) 794 protected virtual void Dispose(bool disposing)
795 { 795 {
796 if (!this.disposed) 796 if (!disposed)
797 { 797 {
798 if (disposing) 798 if (disposing)
799 { 799 {
800 if (this.m_Log != null) 800 GC.SuppressFinalize(this);
801 if (m_Log != null)
801 { 802 {
802 this.m_Log.Close(); 803 m_Log.Close();
803 this.m_Log = null; 804 m_Log = null;
804 } 805 }
805 } 806 }
806 } 807 }
807 this.disposed = true; 808 disposed = true;
808 } 809 }
809 810
810 /// <summary> 811 /// <summary>
@@ -812,7 +813,7 @@ namespace Prebuild.Core
812 /// </summary> 813 /// </summary>
813 ~Kernel() 814 ~Kernel()
814 { 815 {
815 this.Dispose(false); 816 Dispose(false);
816 } 817 }
817 818
818 /// <summary> 819 /// <summary>
diff --git a/Prebuild/src/Core/Nodes/AuthorNode.cs b/Prebuild/src/Core/Nodes/AuthorNode.cs
index 20e72c0..4c415bb 100644
--- a/Prebuild/src/Core/Nodes/AuthorNode.cs
+++ b/Prebuild/src/Core/Nodes/AuthorNode.cs
@@ -24,8 +24,6 @@ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY O
24#endregion 24#endregion
25 25
26using System; 26using System;
27using System.Collections;
28using System.Collections.Specialized;
29using System.Xml; 27using System.Xml;
30 28
31using Prebuild.Core.Attributes; 29using Prebuild.Core.Attributes;
diff --git a/Prebuild/src/Core/Nodes/CleanFilesNode.cs b/Prebuild/src/Core/Nodes/CleanFilesNode.cs
new file mode 100644
index 0000000..71405f9
--- /dev/null
+++ b/Prebuild/src/Core/Nodes/CleanFilesNode.cs
@@ -0,0 +1,80 @@
1#region BSD License
2/*
3Copyright (c) 2007 C.J. Adams-Collier (cjac@colliertech.org)
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.Generic;
28using System.Xml;
29
30using Prebuild.Core.Attributes;
31using Prebuild.Core.Interfaces;
32using Prebuild.Core.Utilities;
33
34namespace Prebuild.Core.Nodes
35{
36 [DataNode("CleanFiles")]
37 public class CleanFilesNode : DataNode
38 {
39 #region Fields
40
41 private string m_Pattern;
42
43 #endregion
44
45 #region Properties
46
47 /// <summary>
48 /// Gets the signature.
49 /// </summary>
50 /// <value>The signature.</value>
51 public string Pattern
52 {
53 get
54 {
55 return m_Pattern;
56 }
57 }
58
59 #endregion
60
61 #region Public Methods
62
63 /// <summary>
64 /// Parses the specified node.
65 /// </summary>
66 /// <param name="node">The node.</param>
67 public override void Parse(XmlNode node)
68 {
69 if (node == null)
70 {
71 throw new ArgumentNullException("node");
72 }
73
74 m_Pattern = Helper.AttributeValue(node, "pattern", String.Empty); ;
75 m_Pattern = m_Pattern.Trim();
76 }
77
78 #endregion
79 }
80} \ No newline at end of file
diff --git a/Prebuild/src/Core/Nodes/CleanupNode.cs b/Prebuild/src/Core/Nodes/CleanupNode.cs
new file mode 100644
index 0000000..b8131b0
--- /dev/null
+++ b/Prebuild/src/Core/Nodes/CleanupNode.cs
@@ -0,0 +1,85 @@
1#region BSD License
2/*
3Copyright (c) 2007 C.J. Adams-Collier (cjac@colliertech.org)
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.Generic;
28using System.Xml;
29
30using Prebuild.Core.Attributes;
31using Prebuild.Core.Interfaces;
32
33namespace Prebuild.Core.Nodes
34{
35 [DataNode("Cleanup")]
36 public class CleanupNode : DataNode
37 {
38 #region Fields
39
40 private List<CleanFilesNode> m_CleanFiles = new List<CleanFilesNode>();
41
42 #endregion
43
44 #region Properties
45
46 /// <summary>
47 /// Gets the signature.
48 /// </summary>
49 /// <value>The signature.</value>
50 public List<CleanFilesNode> CleanFiles
51 {
52 get
53 {
54 return m_CleanFiles;
55 }
56 }
57
58 #endregion
59
60 #region Public Methods
61
62 /// <summary>
63 /// Parses the specified node.
64 /// </summary>
65 /// <param name="node">The node.</param>
66 public override void Parse(XmlNode node)
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 if (dataNode is CleanFilesNode)
77 {
78 m_CleanFiles.Add((CleanFilesNode)dataNode);
79 }
80 }
81 }
82
83 #endregion
84 }
85} \ No newline at end of file
diff --git a/Prebuild/src/Core/Nodes/ConfigurationNode.cs b/Prebuild/src/Core/Nodes/ConfigurationNode.cs
index 67d78d5..cd2f740 100644
--- a/Prebuild/src/Core/Nodes/ConfigurationNode.cs
+++ b/Prebuild/src/Core/Nodes/ConfigurationNode.cs
@@ -41,6 +41,7 @@ namespace Prebuild.Core.Nodes
41 #region Fields 41 #region Fields
42 42
43 private string m_Name = "unknown"; 43 private string m_Name = "unknown";
44 private string m_Platform = "AnyCPU";
44 private OptionsNode m_Options; 45 private OptionsNode m_Options;
45 46
46 #endregion 47 #endregion
@@ -84,6 +85,33 @@ namespace Prebuild.Core.Nodes
84 } 85 }
85 86
86 /// <summary> 87 /// <summary>
88 /// Identifies the platform for this specific configuration.
89 /// </summary>
90 public string Platform
91 {
92 get
93 {
94 return m_Platform;
95 }
96 set
97 {
98 switch ((value + "").ToLower())
99 {
100 case "x86":
101 case "x64":
102 m_Platform = value;
103 break;
104 case "itanium":
105 m_Platform = "Itanium";
106 break;
107 default:
108 m_Platform = "AnyCPU";
109 break;
110 }
111 }
112 }
113
114 /// <summary>
87 /// Gets the name. 115 /// Gets the name.
88 /// </summary> 116 /// </summary>
89 /// <value>The name.</value> 117 /// <value>The name.</value>
@@ -96,6 +124,22 @@ namespace Prebuild.Core.Nodes
96 } 124 }
97 125
98 /// <summary> 126 /// <summary>
127 /// Gets the name and platform for the configuration.
128 /// </summary>
129 /// <value>The name and platform.</value>
130 public string NameAndPlatform
131 {
132 get
133 {
134 string platform = m_Platform;
135 if (platform == "AnyCPU")
136 platform = "Any CPU";
137
138 return String.Format("{0}|{1}", m_Name, platform);
139 }
140 }
141
142 /// <summary>
99 /// Gets or sets the options. 143 /// Gets or sets the options.
100 /// </summary> 144 /// </summary>
101 /// <value>The options.</value> 145 /// <value>The options.</value>
@@ -122,7 +166,9 @@ namespace Prebuild.Core.Nodes
122 public override void Parse(XmlNode node) 166 public override void Parse(XmlNode node)
123 { 167 {
124 m_Name = Helper.AttributeValue(node, "name", m_Name); 168 m_Name = Helper.AttributeValue(node, "name", m_Name);
125 if( node == null ) 169 Platform = Helper.AttributeValue(node, "platform", m_Platform);
170
171 if (node == null)
126 { 172 {
127 throw new ArgumentNullException("node"); 173 throw new ArgumentNullException("node");
128 } 174 }
@@ -159,6 +205,7 @@ namespace Prebuild.Core.Nodes
159 { 205 {
160 ConfigurationNode ret = new ConfigurationNode(); 206 ConfigurationNode ret = new ConfigurationNode();
161 ret.m_Name = m_Name; 207 ret.m_Name = m_Name;
208 ret.m_Platform = m_Platform;
162 m_Options.CopyTo(ret.m_Options); 209 m_Options.CopyTo(ret.m_Options);
163 return ret; 210 return ret;
164 } 211 }
diff --git a/Prebuild/src/Core/Nodes/ConfigurationNodeCollection.cs b/Prebuild/src/Core/Nodes/ConfigurationNodeCollection.cs
new file mode 100644
index 0000000..1c38d9e
--- /dev/null
+++ b/Prebuild/src/Core/Nodes/ConfigurationNodeCollection.cs
@@ -0,0 +1,71 @@
1#region BSD License
2/*
3Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@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.Collections.Generic;
27
28namespace Prebuild.Core.Nodes
29{
30 /// <summary>
31 /// Implements a specialized list of configuration nodes which allows for lookup via
32 /// configuration name and platform.
33 /// </summary>
34 public class ConfigurationNodeCollection : List<ConfigurationNode>
35 {
36 #region Properties
37
38 public ConfigurationNode this[string nameAndPlatform]
39 {
40 get
41 {
42 foreach (ConfigurationNode configurationNode in this)
43 {
44 if (configurationNode.NameAndPlatform == nameAndPlatform)
45 {
46 return configurationNode;
47 }
48 }
49
50 return null;
51 }
52
53 set
54 {
55 // See if the node
56 ConfigurationNode configurationNode = this[nameAndPlatform];
57
58 if (configurationNode != null)
59 {
60 this[IndexOf(configurationNode)] = value;
61 }
62 else
63 {
64 Add(value);
65 }
66 }
67 }
68
69 #endregion
70 }
71}
diff --git a/Prebuild/src/Core/Nodes/DataNode.cs b/Prebuild/src/Core/Nodes/DataNode.cs
index 763e6c3..318b13c 100644
--- a/Prebuild/src/Core/Nodes/DataNode.cs
+++ b/Prebuild/src/Core/Nodes/DataNode.cs
@@ -104,7 +104,7 @@ namespace Prebuild.Core.Nodes
104 104
105 foreach (string type in WebTypes) 105 foreach (string type in WebTypes)
106 { 106 {
107 if (path.EndsWith(string.Format("{0}{1}", type, extension))) 107 if (path.EndsWith(type))
108 { 108 {
109 return SubType.CodeBehind; 109 return SubType.CodeBehind;
110 } 110 }
diff --git a/Prebuild/src/Core/Nodes/DatabaseProjectNode.cs b/Prebuild/src/Core/Nodes/DatabaseProjectNode.cs
index 27c2051..278ecd8 100644
--- a/Prebuild/src/Core/Nodes/DatabaseProjectNode.cs
+++ b/Prebuild/src/Core/Nodes/DatabaseProjectNode.cs
@@ -1,5 +1,4 @@
1using System; 1using System;
2using System.Collections;
3using System.Collections.Generic; 2using System.Collections.Generic;
4using System.Text; 3using System.Text;
5using System.Xml; 4using System.Xml;
diff --git a/Prebuild/src/Core/Nodes/DescriptionNode.cs b/Prebuild/src/Core/Nodes/DescriptionNode.cs
index 353a5ae..d1293a0 100644
--- a/Prebuild/src/Core/Nodes/DescriptionNode.cs
+++ b/Prebuild/src/Core/Nodes/DescriptionNode.cs
@@ -24,8 +24,6 @@ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY O
24#endregion 24#endregion
25 25
26using System; 26using System;
27using System.Collections;
28using System.Collections.Specialized;
29using System.Xml; 27using System.Xml;
30 28
31using Prebuild.Core.Attributes; 29using Prebuild.Core.Attributes;
diff --git a/Prebuild/src/Core/Nodes/FileNode.cs b/Prebuild/src/Core/Nodes/FileNode.cs
index 1520fcb..01cea1e 100644
--- a/Prebuild/src/Core/Nodes/FileNode.cs
+++ b/Prebuild/src/Core/Nodes/FileNode.cs
@@ -54,7 +54,15 @@ namespace Prebuild.Core.Nodes
54 /// <summary> 54 /// <summary>
55 /// 55 ///
56 /// </summary> 56 /// </summary>
57 EmbeddedResource 57 EmbeddedResource,
58 /// <summary>
59 ///
60 /// </summary>
61 ApplicationDefinition,
62 /// <summary>
63 ///
64 /// </summary>
65 Page
58 } 66 }
59 67
60 /// <summary> 68 /// <summary>
@@ -264,6 +272,12 @@ namespace Prebuild.Core.Nodes
264 m_Valid = false; 272 m_Valid = false;
265 Kernel.Instance.Log.Write(LogType.Warning, "File does not exist: {0}", m_Path); 273 Kernel.Instance.Log.Write(LogType.Warning, "File does not exist: {0}", m_Path);
266 } 274 }
275
276 if (System.IO.Path.GetExtension(m_Path) == ".settings")
277 {
278 m_SubType = SubType.Settings;
279 m_BuildAction = BuildAction.None;
280 }
267 } 281 }
268 282
269 #endregion 283 #endregion
diff --git a/Prebuild/src/Core/Nodes/FilesNode.cs b/Prebuild/src/Core/Nodes/FilesNode.cs
index dc306c2..23a716c 100644
--- a/Prebuild/src/Core/Nodes/FilesNode.cs
+++ b/Prebuild/src/Core/Nodes/FilesNode.cs
@@ -24,8 +24,7 @@ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY O
24#endregion 24#endregion
25 25
26using System; 26using System;
27using System.Collections; 27using System.Collections.Generic;
28using System.Collections.Specialized;
29using System.Xml; 28using System.Xml;
30 29
31using Prebuild.Core.Attributes; 30using Prebuild.Core.Attributes;
@@ -42,41 +41,19 @@ namespace Prebuild.Core.Nodes
42 { 41 {
43 #region Fields 42 #region Fields
44 43
45 private StringCollection m_Files; 44 private readonly List<string> m_Files = new List<string>();
46 private Hashtable m_BuildActions; 45 private readonly Dictionary<string,BuildAction> m_BuildActions = new Dictionary<string, BuildAction>();
47 private Hashtable m_SubTypes; 46 private readonly Dictionary<string, SubType> m_SubTypes = new Dictionary<string, SubType>();
48 private Hashtable m_ResourceNames; 47 private readonly Dictionary<string, string> m_ResourceNames = new Dictionary<string, string>();
49 private Hashtable m_CopyToOutputs; 48 private readonly Dictionary<string, CopyToOutput> m_CopyToOutputs = new Dictionary<string, CopyToOutput>();
50 private Hashtable m_Links; 49 private readonly Dictionary<string, bool> m_Links = new Dictionary<string, bool>();
51 private Hashtable m_LinkPaths; 50 private readonly Dictionary<string, string> m_LinkPaths = new Dictionary<string, string>();
52 private Hashtable m_PreservePaths; 51 private readonly Dictionary<string, bool> m_PreservePaths = new Dictionary<string, bool>();
53
54 #endregion
55
56 #region Constructors
57
58 /// <summary>
59 ///
60 /// </summary>
61 public FilesNode()
62 {
63 m_Files = new StringCollection();
64 m_BuildActions = new Hashtable();
65 m_SubTypes = new Hashtable();
66 m_ResourceNames = new Hashtable();
67 m_CopyToOutputs = new Hashtable();
68 m_Links = new Hashtable();
69 m_LinkPaths = new Hashtable();
70 m_PreservePaths = new Hashtable();
71 }
72 52
73 #endregion 53 #endregion
74 54
75 #region Properties 55 #region Properties
76 56
77 /// <summary>
78 ///
79 /// </summary>
80 public int Count 57 public int Count
81 { 58 {
82 get 59 get
@@ -89,11 +66,6 @@ namespace Prebuild.Core.Nodes
89 66
90 #region Public Methods 67 #region Public Methods
91 68
92 /// <summary>
93 ///
94 /// </summary>
95 /// <param name="file"></param>
96 /// <returns></returns>
97 public BuildAction GetBuildAction(string file) 69 public BuildAction GetBuildAction(string file)
98 { 70 {
99 if(!m_BuildActions.ContainsKey(file)) 71 if(!m_BuildActions.ContainsKey(file))
@@ -101,41 +73,41 @@ namespace Prebuild.Core.Nodes
101 return BuildAction.Compile; 73 return BuildAction.Compile;
102 } 74 }
103 75
104 return (BuildAction)m_BuildActions[file]; 76 return m_BuildActions[file];
105 } 77 }
106 78
107 public CopyToOutput GetCopyToOutput(string file) 79 public CopyToOutput GetCopyToOutput(string file)
108 { 80 {
109 if (!this.m_CopyToOutputs.ContainsKey(file)) 81 if (!m_CopyToOutputs.ContainsKey(file))
110 { 82 {
111 return CopyToOutput.Never; 83 return CopyToOutput.Never;
112 } 84 }
113 return (CopyToOutput) this.m_CopyToOutputs[file]; 85 return m_CopyToOutputs[file];
114 } 86 }
115 87
116 public bool GetIsLink(string file) 88 public bool GetIsLink(string file)
117 { 89 {
118 if (!this.m_Links.ContainsKey(file)) 90 if (!m_Links.ContainsKey(file))
119 { 91 {
120 return false; 92 return false;
121 } 93 }
122 return (bool) this.m_Links[file]; 94 return m_Links[file];
123 } 95 }
124 96
97 public bool Contains(string file)
98 {
99 return m_Files.Contains(file);
100 }
101
125 public string GetLinkPath( string file ) 102 public string GetLinkPath( string file )
126 { 103 {
127 if ( !this.m_LinkPaths.ContainsKey( file ) ) 104 if ( !m_LinkPaths.ContainsKey( file ) )
128 { 105 {
129 return string.Empty; 106 return string.Empty;
130 } 107 }
131 return (string)this.m_LinkPaths[ file ]; 108 return m_LinkPaths[ file ];
132 } 109 }
133 110
134 /// <summary>
135 ///
136 /// </summary>
137 /// <param name="file"></param>
138 /// <returns></returns>
139 public SubType GetSubType(string file) 111 public SubType GetSubType(string file)
140 { 112 {
141 if(!m_SubTypes.ContainsKey(file)) 113 if(!m_SubTypes.ContainsKey(file))
@@ -143,29 +115,19 @@ namespace Prebuild.Core.Nodes
143 return SubType.Code; 115 return SubType.Code;
144 } 116 }
145 117
146 return (SubType)m_SubTypes[file]; 118 return m_SubTypes[file];
147 } 119 }
148 120
149 /// <summary>
150 ///
151 /// </summary>
152 /// <param name="file"></param>
153 /// <returns></returns>
154 public string GetResourceName(string file) 121 public string GetResourceName(string file)
155 { 122 {
156 if(!m_ResourceNames.ContainsKey(file)) 123 if(!m_ResourceNames.ContainsKey(file))
157 { 124 {
158 return ""; 125 return string.Empty;
159 } 126 }
160 127
161 return (string)m_ResourceNames[file]; 128 return m_ResourceNames[file];
162 } 129 }
163 130
164 /// <summary>
165 ///
166 /// </summary>
167 /// <param name="file"></param>
168 /// <returns></returns>
169 public bool GetPreservePath( string file ) 131 public bool GetPreservePath( string file )
170 { 132 {
171 if ( !m_PreservePaths.ContainsKey( file ) ) 133 if ( !m_PreservePaths.ContainsKey( file ) )
@@ -173,13 +135,9 @@ namespace Prebuild.Core.Nodes
173 return false; 135 return false;
174 } 136 }
175 137
176 return (bool)m_PreservePaths[ file ]; 138 return m_PreservePaths[ file ];
177 } 139 }
178 140
179 /// <summary>
180 ///
181 /// </summary>
182 /// <param name="node"></param>
183 public override void Parse(XmlNode node) 141 public override void Parse(XmlNode node)
184 { 142 {
185 if( node == null ) 143 if( node == null )
@@ -200,10 +158,10 @@ namespace Prebuild.Core.Nodes
200 m_BuildActions[fileNode.Path] = fileNode.BuildAction; 158 m_BuildActions[fileNode.Path] = fileNode.BuildAction;
201 m_SubTypes[fileNode.Path] = fileNode.SubType; 159 m_SubTypes[fileNode.Path] = fileNode.SubType;
202 m_ResourceNames[fileNode.Path] = fileNode.ResourceName; 160 m_ResourceNames[fileNode.Path] = fileNode.ResourceName;
203 this.m_PreservePaths[ fileNode.Path ] = fileNode.PreservePath; 161 m_PreservePaths[ fileNode.Path ] = fileNode.PreservePath;
204 this.m_Links[ fileNode.Path ] = fileNode.IsLink; 162 m_Links[ fileNode.Path ] = fileNode.IsLink;
205 this.m_LinkPaths[ fileNode.Path ] = fileNode.LinkPath; 163 m_LinkPaths[ fileNode.Path ] = fileNode.LinkPath;
206 this.m_CopyToOutputs[ fileNode.Path ] = fileNode.CopyToOutput; 164 m_CopyToOutputs[ fileNode.Path ] = fileNode.CopyToOutput;
207 165
208 } 166 }
209 } 167 }
@@ -216,13 +174,16 @@ namespace Prebuild.Core.Nodes
216 if (!m_Files.Contains(file)) 174 if (!m_Files.Contains(file))
217 { 175 {
218 m_Files.Add(file); 176 m_Files.Add(file);
219 m_BuildActions[ file ] = matchNode.BuildAction == null ? GetBuildActionByFileName(file) : matchNode.BuildAction; 177 if (matchNode.BuildAction == null)
220 m_SubTypes[file] = matchNode.SubType == null ? GetSubTypeByFileName(file) : matchNode.SubType.Value; 178 m_BuildActions[file] = GetBuildActionByFileName(file);
179 else
180 m_BuildActions[file] = matchNode.BuildAction.Value;
181 m_SubTypes[file] = matchNode.SubType == null ? GetSubTypeByFileName(file) : matchNode.SubType.Value;
221 m_ResourceNames[ file ] = matchNode.ResourceName; 182 m_ResourceNames[ file ] = matchNode.ResourceName;
222 this.m_PreservePaths[ file ] = matchNode.PreservePath; 183 m_PreservePaths[ file ] = matchNode.PreservePath;
223 this.m_Links[ file ] = matchNode.IsLink; 184 m_Links[ file ] = matchNode.IsLink;
224 this.m_LinkPaths[ file ] = matchNode.LinkPath; 185 m_LinkPaths[ file ] = matchNode.LinkPath;
225 this.m_CopyToOutputs[ file ] = matchNode.CopyToOutput; 186 m_CopyToOutputs[ file ] = matchNode.CopyToOutput;
226 187
227 } 188 }
228 } 189 }
@@ -232,11 +193,7 @@ namespace Prebuild.Core.Nodes
232 193
233 // TODO: Check in to why StringCollection's enumerator doesn't implement 194 // TODO: Check in to why StringCollection's enumerator doesn't implement
234 // IEnumerator? 195 // IEnumerator?
235 /// <summary> 196 public IEnumerator<string> GetEnumerator()
236 ///
237 /// </summary>
238 /// <returns></returns>
239 public StringEnumerator GetEnumerator()
240 { 197 {
241 return m_Files.GetEnumerator(); 198 return m_Files.GetEnumerator();
242 } 199 }
diff --git a/Prebuild/src/Core/Nodes/MatchNode.cs b/Prebuild/src/Core/Nodes/MatchNode.cs
index 656d7d0..9735265 100644
--- a/Prebuild/src/Core/Nodes/MatchNode.cs
+++ b/Prebuild/src/Core/Nodes/MatchNode.cs
@@ -25,7 +25,6 @@ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY O
25 25
26using System; 26using System;
27using System.Collections.Generic; 27using System.Collections.Generic;
28using System.Collections.Specialized;
29using System.IO; 28using System.IO;
30using System.Text.RegularExpressions; 29using System.Text.RegularExpressions;
31using System.Xml; 30using System.Xml;
@@ -33,7 +32,6 @@ using System.Xml;
33using Prebuild.Core.Attributes; 32using Prebuild.Core.Attributes;
34using Prebuild.Core.Interfaces; 33using Prebuild.Core.Interfaces;
35using Prebuild.Core.Utilities; 34using Prebuild.Core.Utilities;
36using System.Collections;
37 35
38namespace Prebuild.Core.Nodes 36namespace Prebuild.Core.Nodes
39{ 37{
@@ -45,7 +43,7 @@ namespace Prebuild.Core.Nodes
45 { 43 {
46 #region Fields 44 #region Fields
47 45
48 private readonly StringCollection m_Files = new StringCollection(); 46 private readonly List<string> m_Files = new List<string>();
49 private Regex m_Regex; 47 private Regex m_Regex;
50 private BuildAction? m_BuildAction; 48 private BuildAction? m_BuildAction;
51 private SubType? m_SubType; 49 private SubType? m_SubType;
@@ -63,7 +61,7 @@ namespace Prebuild.Core.Nodes
63 /// <summary> 61 /// <summary>
64 /// 62 ///
65 /// </summary> 63 /// </summary>
66 public StringCollection Files 64 public IEnumerable<string> Files
67 { 65 {
68 get 66 get
69 { 67 {
@@ -97,7 +95,7 @@ namespace Prebuild.Core.Nodes
97 { 95 {
98 get 96 get
99 { 97 {
100 return this.m_CopyToOutput; 98 return m_CopyToOutput;
101 } 99 }
102 } 100 }
103 101
@@ -105,7 +103,7 @@ namespace Prebuild.Core.Nodes
105 { 103 {
106 get 104 get
107 { 105 {
108 return this.m_Link; 106 return m_Link;
109 } 107 }
110 } 108 }
111 109
@@ -113,7 +111,7 @@ namespace Prebuild.Core.Nodes
113 { 111 {
114 get 112 get
115 { 113 {
116 return this.m_LinkPath; 114 return m_LinkPath;
117 } 115 }
118 } 116 }
119 /// <summary> 117 /// <summary>
@@ -149,21 +147,35 @@ namespace Prebuild.Core.Nodes
149 private void RecurseDirectories(string path, string pattern, bool recurse, bool useRegex, List<ExcludeNode> exclusions) 147 private void RecurseDirectories(string path, string pattern, bool recurse, bool useRegex, List<ExcludeNode> exclusions)
150 { 148 {
151 Match match; 149 Match match;
152 Boolean excludeFile; 150 try
153 try
154 { 151 {
155 string[] files; 152 string[] files;
156 153
157 if(!useRegex) 154 Boolean excludeFile;
155 if(!useRegex)
158 { 156 {
159 files = Directory.GetFiles(path, pattern); 157 try
158 {
159 files = Directory.GetFiles(path, pattern);
160 }
161 catch (IOException)
162 {
163 // swallow weird IOException error when running in a virtual box
164 // guest OS on a network share when the host OS is not Windows.
165 // This seems to happen on network shares
166 // when no files match, and may be related to this report:
167 // http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=254546
168
169 files = null;
170 }
171
160 if(files != null) 172 if(files != null)
161 { 173 {
162 string fileTemp; 174 foreach (string file in files)
163 foreach (string file in files)
164 { 175 {
165 excludeFile = false; 176 excludeFile = false;
166 if (file.Substring(0,2) == "./" || file.Substring(0,2) == ".\\") 177 string fileTemp;
178 if (file.Substring(0,2) == "./" || file.Substring(0,2) == ".\\")
167 { 179 {
168 fileTemp = file.Substring(2); 180 fileTemp = file.Substring(2);
169 } 181 }
@@ -187,47 +199,64 @@ namespace Prebuild.Core.Nodes
187 199
188 } 200 }
189 } 201 }
190 else 202
191 { 203 // don't call return here, because we may need to recursively search directories below
192 return; 204 // this one, even if no matches were found in this directory.
193 }
194 } 205 }
195 else 206 else
196 { 207 {
197 files = Directory.GetFiles(path); 208 try
198 foreach(string file in files) 209 {
199 { 210 files = Directory.GetFiles(path);
200 excludeFile = false; 211 }
201 212 catch (IOException)
202 match = m_Regex.Match(file); 213 {
203 if(match.Success) 214 // swallow weird IOException error when running in a virtual box
204 { 215 // guest OS on a network share.
205 // Check all excludions and set flag if there are any hits. 216 files = null;
206 foreach ( ExcludeNode exclude in exclusions ) 217 }
207 { 218
208 Regex exRegEx = new Regex( exclude.Pattern ); 219 if (files != null)
209 match = exRegEx.Match( file ); 220 {
210 excludeFile |= !match.Success; 221 foreach (string file in files)
211 } 222 {
223 excludeFile = false;
212 224
213 if ( !excludeFile ) 225 match = m_Regex.Match(file);
226 if (match.Success)
214 { 227 {
215 m_Files.Add( file ); 228 // Check all excludions and set flag if there are any hits.
229 foreach (ExcludeNode exclude in exclusions)
230 {
231 Regex exRegEx = new Regex(exclude.Pattern);
232 match = exRegEx.Match(file);
233 excludeFile |= !match.Success;
234 }
235
236 if (!excludeFile)
237 {
238 m_Files.Add(file);
239 }
216 } 240 }
217 } 241 }
218 } 242 }
219 } 243 }
220 244
221 if(recurse) 245 if(recurse)
222 { 246 {
223 string[] dirs = Directory.GetDirectories(path); 247 string[] dirs = Directory.GetDirectories(path);
224 if(dirs != null && dirs.Length > 0) 248 if(dirs != null && dirs.Length > 0)
225 { 249 {
226 foreach(string str in dirs) 250 foreach (string str in dirs)
227 { 251 {
228 RecurseDirectories(Helper.NormalizePath(str), pattern, recurse, useRegex, exclusions); 252 // hack to skip subversion folders. Not having this can cause
229 } 253 // a significant performance hit when running on a network drive.
230 } 254 if (str.EndsWith(".svn"))
255 continue;
256
257 RecurseDirectories(Helper.NormalizePath(str), pattern, recurse, useRegex, exclusions);
258 }
259 }
231 } 260 }
232 } 261 }
233 catch(DirectoryNotFoundException) 262 catch(DirectoryNotFoundException)
@@ -266,14 +295,14 @@ namespace Prebuild.Core.Nodes
266 //string subType = Helper.AttributeValue(node, "subType", string.Empty); 295 //string subType = Helper.AttributeValue(node, "subType", string.Empty);
267 //if (subType != String.Empty) 296 //if (subType != String.Empty)
268 // m_SubType = (SubType)Enum.Parse(typeof(SubType), subType); 297 // m_SubType = (SubType)Enum.Parse(typeof(SubType), subType);
269 m_ResourceName = Helper.AttributeValue(node, "resourceName", m_ResourceName.ToString()); 298 m_ResourceName = Helper.AttributeValue(node, "resourceName", m_ResourceName);
270 this.m_CopyToOutput = (CopyToOutput) Enum.Parse(typeof(CopyToOutput), Helper.AttributeValue(node, "copyToOutput", this.m_CopyToOutput.ToString())); 299 m_CopyToOutput = (CopyToOutput) Enum.Parse(typeof(CopyToOutput), Helper.AttributeValue(node, "copyToOutput", m_CopyToOutput.ToString()));
271 this.m_Link = bool.Parse(Helper.AttributeValue(node, "link", bool.FalseString)); 300 m_Link = bool.Parse(Helper.AttributeValue(node, "link", bool.FalseString));
272 if ( this.m_Link == true ) 301 if ( m_Link )
273 { 302 {
274 this.m_LinkPath = Helper.AttributeValue( node, "linkPath", string.Empty ); 303 m_LinkPath = Helper.AttributeValue( node, "linkPath", string.Empty );
275 } 304 }
276 this.m_PreservePath = bool.Parse( Helper.AttributeValue( node, "preservePath", bool.FalseString ) ); 305 m_PreservePath = bool.Parse( Helper.AttributeValue( node, "preservePath", bool.FalseString ) );
277 306
278 307
279 if(path != null && path.Length == 0) 308 if(path != null && path.Length == 0)
@@ -318,11 +347,19 @@ namespace Prebuild.Core.Nodes
318 347
319 RecurseDirectories( path, pattern, recurse, useRegex, m_Exclusions ); 348 RecurseDirectories( path, pattern, recurse, useRegex, m_Exclusions );
320 349
321 if(m_Files.Count < 1) 350 if (m_Files.Count < 1)
322 { 351 {
323 throw new WarningException("Match returned no files: {0}{1}", Helper.EndPath(path), pattern); 352 // Include the project name when the match node returns no matches to provide extra
324 } 353 // debug info.
325 m_Regex = null; 354 ProjectNode project = Parent.Parent as ProjectNode;
355 string projectName = "";
356
357 if (project != null)
358 projectName = " in project " + project.AssemblyName;
359
360 throw new WarningException("Match" + projectName + " returned no files: {0}{1}", Helper.EndPath(path), pattern);
361 }
362 m_Regex = null;
326 } 363 }
327 364
328 #endregion 365 #endregion
diff --git a/Prebuild/src/Core/Nodes/OptionsNode.cs b/Prebuild/src/Core/Nodes/OptionsNode.cs
index b63034b..577de71 100644
--- a/Prebuild/src/Core/Nodes/OptionsNode.cs
+++ b/Prebuild/src/Core/Nodes/OptionsNode.cs
@@ -24,8 +24,7 @@ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY O
24#endregion 24#endregion
25 25
26using System; 26using System;
27using System.Collections; 27using System.Collections.Generic;
28using System.Collections.Specialized;
29using System.Reflection; 28using System.Reflection;
30using System.Xml; 29using System.Xml;
31 30
@@ -43,7 +42,7 @@ namespace Prebuild.Core.Nodes
43 { 42 {
44 #region Fields 43 #region Fields
45 44
46 private static Hashtable m_OptionFields; 45 private static readonly Dictionary<string,FieldInfo> m_OptionFields = new Dictionary<string, FieldInfo>();
47 46
48 [OptionNode("CompilerDefines")] 47 [OptionNode("CompilerDefines")]
49 private string m_CompilerDefines = ""; 48 private string m_CompilerDefines = "";
@@ -495,7 +494,7 @@ namespace Prebuild.Core.Nodes
495 } 494 }
496 } 495 }
497 496
498 private StringCollection m_FieldsDefined; 497 private readonly List<string> m_FieldsDefined = new List<string>();
499 498
500 #endregion 499 #endregion
501 500
@@ -508,7 +507,6 @@ namespace Prebuild.Core.Nodes
508 { 507 {
509 Type t = typeof(OptionsNode); 508 Type t = typeof(OptionsNode);
510 509
511 m_OptionFields = new Hashtable();
512 foreach(FieldInfo f in t.GetFields(BindingFlags.NonPublic | BindingFlags.Instance)) 510 foreach(FieldInfo f in t.GetFields(BindingFlags.NonPublic | BindingFlags.Instance))
513 { 511 {
514 object[] attrs = f.GetCustomAttributes(typeof(OptionNodeAttribute), false); 512 object[] attrs = f.GetCustomAttributes(typeof(OptionNodeAttribute), false);
@@ -522,14 +520,6 @@ namespace Prebuild.Core.Nodes
522 } 520 }
523 } 521 }
524 522
525 /// <summary>
526 /// Initializes a new instance of the <see cref="OptionsNode"/> class.
527 /// </summary>
528 public OptionsNode()
529 {
530 m_FieldsDefined = new StringCollection();
531 }
532
533 #endregion 523 #endregion
534 524
535 #region Properties 525 #region Properties
@@ -547,7 +537,7 @@ namespace Prebuild.Core.Nodes
547 return null; 537 return null;
548 } 538 }
549 539
550 FieldInfo f = (FieldInfo)m_OptionFields[index]; 540 FieldInfo f = m_OptionFields[index];
551 return f.GetValue(this); 541 return f.GetValue(this);
552 } 542 }
553 } 543 }
@@ -591,7 +581,7 @@ namespace Prebuild.Core.Nodes
591 return; 581 return;
592 } 582 }
593 583
594 FieldInfo f = (FieldInfo)m_OptionFields[nodeName]; 584 FieldInfo f = m_OptionFields[nodeName];
595 f.SetValue(this, Helper.TranslateValue(f.FieldType, val)); 585 f.SetValue(this, Helper.TranslateValue(f.FieldType, val));
596 FlagDefined(f.Name); 586 FlagDefined(f.Name);
597 } 587 }
diff --git a/Prebuild/src/Core/Nodes/ProcessNode.cs b/Prebuild/src/Core/Nodes/ProcessNode.cs
index 6bfbe16..8ca8e49 100644
--- a/Prebuild/src/Core/Nodes/ProcessNode.cs
+++ b/Prebuild/src/Core/Nodes/ProcessNode.cs
@@ -24,8 +24,6 @@ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY O
24#endregion 24#endregion
25 25
26using System; 26using System;
27using System.Collections;
28using System.Collections.Specialized;
29using System.Xml; 27using System.Xml;
30 28
31using Prebuild.Core.Attributes; 29using Prebuild.Core.Attributes;
diff --git a/Prebuild/src/Core/Nodes/ProjectNode.cs b/Prebuild/src/Core/Nodes/ProjectNode.cs
index 04af7a3..fb92b32 100644
--- a/Prebuild/src/Core/Nodes/ProjectNode.cs
+++ b/Prebuild/src/Core/Nodes/ProjectNode.cs
@@ -24,7 +24,6 @@ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY O
24#endregion 24#endregion
25 25
26using System; 26using System;
27using System.Collections;
28using System.Collections.Generic; 27using System.Collections.Generic;
29using System.IO; 28using System.IO;
30using System.Xml; 29using System.Xml;
@@ -90,10 +89,10 @@ namespace Prebuild.Core.Nodes
90 /// .NET 3.5 89 /// .NET 3.5
91 /// </summary> 90 /// </summary>
92 v3_5, 91 v3_5,
93 /// <summary> 92 /// <summary>
94 /// .NET 4.0 93 /// .NET 4.0
95 /// </summary> 94 /// </summary>
96 v4_0, 95 v4_0,
97 } 96 }
98 /// <summary> 97 /// <summary>
99 /// The Node object representing /Prebuild/Solution/Project elements 98 /// The Node object representing /Prebuild/Solution/Project elements
@@ -121,7 +120,7 @@ namespace Prebuild.Core.Nodes
121 private Guid m_Guid; 120 private Guid m_Guid;
122 private string m_DebugStartParameters; 121 private string m_DebugStartParameters;
123 122
124 private Hashtable m_Configurations = new Hashtable(); 123 private readonly Dictionary<string, ConfigurationNode> m_Configurations = new Dictionary<string, ConfigurationNode>();
125 private readonly List<ReferencePathNode> m_ReferencePaths = new List<ReferencePathNode>(); 124 private readonly List<ReferencePathNode> m_ReferencePaths = new List<ReferencePathNode>();
126 private readonly List<ReferenceNode> m_References = new List<ReferenceNode>(); 125 private readonly List<ReferenceNode> m_References = new List<ReferenceNode>();
127 private readonly List<AuthorNode> m_Authors = new List<AuthorNode>(); 126 private readonly List<AuthorNode> m_Authors = new List<AuthorNode>();
@@ -149,7 +148,7 @@ namespace Prebuild.Core.Nodes
149 { 148 {
150 get 149 get
151 { 150 {
152 return this.m_Framework; 151 return m_Framework;
153 } 152 }
154 } 153 }
155 /// <summary> 154 /// <summary>
@@ -283,7 +282,7 @@ namespace Prebuild.Core.Nodes
283 } 282 }
284 } 283 }
285 284
286 private bool m_GenerateAssemblyInfoFile = false; 285 private bool m_GenerateAssemblyInfoFile;
287 286
288 /// <summary> 287 /// <summary>
289 /// 288 ///
@@ -328,11 +327,11 @@ namespace Prebuild.Core.Nodes
328 /// Gets the configurations. 327 /// Gets the configurations.
329 /// </summary> 328 /// </summary>
330 /// <value>The configurations.</value> 329 /// <value>The configurations.</value>
331 public IList Configurations 330 public List<ConfigurationNode> Configurations
332 { 331 {
333 get 332 get
334 { 333 {
335 ArrayList tmp = new ArrayList(ConfigurationsTable.Values); 334 List<ConfigurationNode> tmp = new List<ConfigurationNode>(ConfigurationsTable.Values);
336 tmp.Sort(); 335 tmp.Sort();
337 return tmp; 336 return tmp;
338 } 337 }
@@ -342,7 +341,7 @@ namespace Prebuild.Core.Nodes
342 /// Gets the configurations table. 341 /// Gets the configurations table.
343 /// </summary> 342 /// </summary>
344 /// <value>The configurations table.</value> 343 /// <value>The configurations table.</value>
345 public Hashtable ConfigurationsTable 344 public Dictionary<string, ConfigurationNode> ConfigurationsTable
346 { 345 {
347 get 346 get
348 { 347 {
@@ -420,7 +419,7 @@ namespace Prebuild.Core.Nodes
420 SolutionNode parent = (SolutionNode)base.Parent; 419 SolutionNode parent = (SolutionNode)base.Parent;
421 foreach(ConfigurationNode conf in parent.Configurations) 420 foreach(ConfigurationNode conf in parent.Configurations)
422 { 421 {
423 m_Configurations[conf.Name] = conf.Clone(); 422 m_Configurations[conf.NameAndPlatform] = (ConfigurationNode) conf.Clone();
424 } 423 }
425 } 424 }
426 } 425 }
@@ -455,19 +454,19 @@ namespace Prebuild.Core.Nodes
455 if(String.Compare(conf.Name, "all", true) == 0) //apply changes to all, this may not always be applied first, 454 if(String.Compare(conf.Name, "all", true) == 0) //apply changes to all, this may not always be applied first,
456 //so it *may* override changes to the same properties for configurations defines at the project level 455 //so it *may* override changes to the same properties for configurations defines at the project level
457 { 456 {
458 foreach(ConfigurationNode confNode in this.m_Configurations.Values) 457 foreach(ConfigurationNode confNode in m_Configurations.Values)
459 { 458 {
460 conf.CopyTo(confNode);//update the config templates defines at the project level with the overrides 459 conf.CopyTo(confNode);//update the config templates defines at the project level with the overrides
461 } 460 }
462 } 461 }
463 if(m_Configurations.ContainsKey(conf.Name)) 462 if(m_Configurations.ContainsKey(conf.NameAndPlatform))
464 { 463 {
465 ConfigurationNode parentConf = (ConfigurationNode)m_Configurations[conf.Name]; 464 ConfigurationNode parentConf = m_Configurations[conf.NameAndPlatform];
466 conf.CopyTo(parentConf);//update the config templates defines at the project level with the overrides 465 conf.CopyTo(parentConf);//update the config templates defines at the project level with the overrides
467 } 466 }
468 else 467 else
469 { 468 {
470 m_Configurations[conf.Name] = conf; 469 m_Configurations[conf.NameAndPlatform] = conf;
471 } 470 }
472 } 471 }
473 472
@@ -504,12 +503,12 @@ namespace Prebuild.Core.Nodes
504 m_GenerateAssemblyInfoFile = Helper.ParseBoolean(node, "generateAssemblyInfoFile", false); 503 m_GenerateAssemblyInfoFile = Helper.ParseBoolean(node, "generateAssemblyInfoFile", false);
505 m_DebugStartParameters = Helper.AttributeValue(node, "debugStartParameters", string.Empty); 504 m_DebugStartParameters = Helper.AttributeValue(node, "debugStartParameters", string.Empty);
506 505
507 if(m_AssemblyName == null || m_AssemblyName.Length < 1) 506 if(string.IsNullOrEmpty(m_AssemblyName))
508 { 507 {
509 m_AssemblyName = m_Name; 508 m_AssemblyName = m_Name;
510 } 509 }
511 510
512 if(m_RootNamespace == null || m_RootNamespace.Length < 1) 511 if(string.IsNullOrEmpty(m_RootNamespace))
513 { 512 {
514 m_RootNamespace = m_Name; 513 m_RootNamespace = m_Name;
515 } 514 }
@@ -572,7 +571,7 @@ namespace Prebuild.Core.Nodes
572 public int CompareTo(object obj) 571 public int CompareTo(object obj)
573 { 572 {
574 ProjectNode that = (ProjectNode)obj; 573 ProjectNode that = (ProjectNode)obj;
575 return this.m_Name.CompareTo(that.m_Name); 574 return m_Name.CompareTo(that.m_Name);
576 } 575 }
577 576
578 #endregion 577 #endregion
diff --git a/Prebuild/src/Core/Nodes/ReferencePathNode.cs b/Prebuild/src/Core/Nodes/ReferencePathNode.cs
index f0543c2..7331cd7 100644
--- a/Prebuild/src/Core/Nodes/ReferencePathNode.cs
+++ b/Prebuild/src/Core/Nodes/ReferencePathNode.cs
@@ -24,8 +24,6 @@ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY O
24#endregion 24#endregion
25 25
26using System; 26using System;
27using System.Collections;
28using System.Collections.Specialized;
29using System.Xml; 27using System.Xml;
30 28
31using Prebuild.Core.Attributes; 29using Prebuild.Core.Attributes;
diff --git a/Prebuild/src/Core/Nodes/SolutionNode.cs b/Prebuild/src/Core/Nodes/SolutionNode.cs
index 2a1b8e2..10c0223 100644
--- a/Prebuild/src/Core/Nodes/SolutionNode.cs
+++ b/Prebuild/src/Core/Nodes/SolutionNode.cs
@@ -24,10 +24,8 @@ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY O
24#endregion 24#endregion
25 25
26using System; 26using System;
27using System.Collections;
28using System.Collections.Generic; 27using System.Collections.Generic;
29using System.Diagnostics; 28using System.Diagnostics;
30using System.IO;
31using System.Xml; 29using System.Xml;
32 30
33using Prebuild.Core.Attributes; 31using Prebuild.Core.Attributes;
@@ -50,18 +48,19 @@ namespace Prebuild.Core.Nodes
50 private string m_Name = "unknown"; 48 private string m_Name = "unknown";
51 private string m_Path = ""; 49 private string m_Path = "";
52 private string m_FullPath = ""; 50 private string m_FullPath = "";
53 private string m_ActiveConfig = "Debug"; 51 private string m_ActiveConfig;
54 private string m_Version = "1.0.0"; 52 private string m_Version = "1.0.0";
55 53
56 private OptionsNode m_Options; 54 private OptionsNode m_Options;
57 private FilesNode m_Files; 55 private FilesNode m_Files;
58 private readonly Hashtable m_Configurations = new Hashtable(); 56 private readonly ConfigurationNodeCollection m_Configurations = new ConfigurationNodeCollection();
59 private readonly Hashtable m_Projects = new Hashtable(); 57 private readonly Dictionary<string, ProjectNode> m_Projects = new Dictionary<string, ProjectNode>();
60 private readonly Hashtable m_DatabaseProjects = new Hashtable(); 58 private readonly Dictionary<string, DatabaseProjectNode> m_DatabaseProjects = new Dictionary<string, DatabaseProjectNode>();
61 private readonly List<ProjectNode> m_ProjectsOrder = new List<ProjectNode>(); 59 private readonly List<ProjectNode> m_ProjectsOrder = new List<ProjectNode>();
62 private readonly Hashtable m_Solutions = new Hashtable(); 60 private readonly Dictionary<string, SolutionNode> m_Solutions = new Dictionary<string, SolutionNode>();
61 private CleanupNode m_Cleanup;
63 62
64 #endregion 63 #endregion
65 64
66 #region Properties 65 #region Properties
67 public override IDataNode Parent 66 public override IDataNode Parent
@@ -77,7 +76,7 @@ namespace Prebuild.Core.Nodes
77 SolutionNode solution = (SolutionNode)value; 76 SolutionNode solution = (SolutionNode)value;
78 foreach (ConfigurationNode conf in solution.Configurations) 77 foreach (ConfigurationNode conf in solution.Configurations)
79 { 78 {
80 m_Configurations[conf.Name] = conf.Clone(); 79 m_Configurations[conf.Name] = (ConfigurationNode) conf.Clone();
81 } 80 }
82 } 81 }
83 82
@@ -85,6 +84,18 @@ namespace Prebuild.Core.Nodes
85 } 84 }
86 } 85 }
87 86
87 public CleanupNode Cleanup
88 {
89 get
90 {
91 return m_Cleanup;
92 }
93 set
94 {
95 m_Cleanup = value;
96 }
97 }
98
88 public Guid Guid 99 public Guid Guid
89 { 100 {
90 get 101 get
@@ -188,13 +199,13 @@ namespace Prebuild.Core.Nodes
188 /// Gets the configurations. 199 /// Gets the configurations.
189 /// </summary> 200 /// </summary>
190 /// <value>The configurations.</value> 201 /// <value>The configurations.</value>
191 public ICollection Configurations 202 public ConfigurationNodeCollection Configurations
192 { 203 {
193 get 204 get
194 { 205 {
195 ArrayList tmp = new ArrayList(ConfigurationsTable.Values); 206 ConfigurationNodeCollection tmp = new ConfigurationNodeCollection();
196 tmp.Sort(); 207 tmp.AddRange(ConfigurationsTable);
197 return tmp; 208 return tmp;
198 } 209 }
199 } 210 }
200 211
@@ -202,7 +213,7 @@ namespace Prebuild.Core.Nodes
202 /// Gets the configurations table. 213 /// Gets the configurations table.
203 /// </summary> 214 /// </summary>
204 /// <value>The configurations table.</value> 215 /// <value>The configurations table.</value>
205 public Hashtable ConfigurationsTable 216 public ConfigurationNodeCollection ConfigurationsTable
206 { 217 {
207 get 218 get
208 { 219 {
@@ -212,7 +223,7 @@ namespace Prebuild.Core.Nodes
212 /// <summary> 223 /// <summary>
213 /// Gets the database projects. 224 /// Gets the database projects.
214 /// </summary> 225 /// </summary>
215 public ICollection DatabaseProjects 226 public ICollection<DatabaseProjectNode> DatabaseProjects
216 { 227 {
217 get 228 get
218 { 229 {
@@ -222,7 +233,7 @@ namespace Prebuild.Core.Nodes
222 /// <summary> 233 /// <summary>
223 /// Gets the nested solutions. 234 /// Gets the nested solutions.
224 /// </summary> 235 /// </summary>
225 public ICollection Solutions 236 public ICollection<SolutionNode> Solutions
226 { 237 {
227 get 238 get
228 { 239 {
@@ -232,22 +243,22 @@ namespace Prebuild.Core.Nodes
232 /// <summary> 243 /// <summary>
233 /// Gets the nested solutions hash table. 244 /// Gets the nested solutions hash table.
234 /// </summary> 245 /// </summary>
235 public Hashtable SolutionsTable 246 public Dictionary<string, SolutionNode> SolutionsTable
236 { 247 {
237 get 248 get
238 { 249 {
239 return this.m_Solutions; 250 return m_Solutions;
240 } 251 }
241 } 252 }
242 /// <summary> 253 /// <summary>
243 /// Gets the projects. 254 /// Gets the projects.
244 /// </summary> 255 /// </summary>
245 /// <value>The projects.</value> 256 /// <value>The projects.</value>
246 public ICollection Projects 257 public ICollection<ProjectNode> Projects
247 { 258 {
248 get 259 get
249 { 260 {
250 ArrayList tmp = new ArrayList(m_Projects.Values); 261 List<ProjectNode> tmp = new List<ProjectNode>(m_Projects.Values);
251 tmp.Sort(); 262 tmp.Sort();
252 return tmp; 263 return tmp;
253 } 264 }
@@ -257,7 +268,7 @@ namespace Prebuild.Core.Nodes
257 /// Gets the projects table. 268 /// Gets the projects table.
258 /// </summary> 269 /// </summary>
259 /// <value>The projects table.</value> 270 /// <value>The projects table.</value>
260 public Hashtable ProjectsTable 271 public Dictionary<string, ProjectNode> ProjectsTable
261 { 272 {
262 get 273 get
263 { 274 {
@@ -325,16 +336,23 @@ namespace Prebuild.Core.Nodes
325 } 336 }
326 else if(dataNode is ConfigurationNode) 337 else if(dataNode is ConfigurationNode)
327 { 338 {
328 m_Configurations[((ConfigurationNode)dataNode).Name] = dataNode; 339 ConfigurationNode configurationNode = (ConfigurationNode) dataNode;
340 m_Configurations[configurationNode.NameAndPlatform] = configurationNode;
341
342 // If the active configuration is null, then we populate it.
343 if (ActiveConfig == null)
344 {
345 ActiveConfig = configurationNode.Name;
346 }
329 } 347 }
330 else if(dataNode is ProjectNode) 348 else if(dataNode is ProjectNode)
331 { 349 {
332 m_Projects[((ProjectNode)dataNode).Name] = dataNode; 350 m_Projects[((ProjectNode)dataNode).Name] = (ProjectNode) dataNode;
333 m_ProjectsOrder.Add((ProjectNode)dataNode); 351 m_ProjectsOrder.Add((ProjectNode)dataNode);
334 } 352 }
335 else if(dataNode is SolutionNode) 353 else if(dataNode is SolutionNode)
336 { 354 {
337 m_Solutions[((SolutionNode)dataNode).Name] = dataNode; 355 m_Solutions[((SolutionNode)dataNode).Name] = (SolutionNode) dataNode;
338 } 356 }
339 else if (dataNode is ProcessNode) 357 else if (dataNode is ProcessNode)
340 { 358 {
@@ -343,7 +361,13 @@ namespace Prebuild.Core.Nodes
343 } 361 }
344 else if (dataNode is DatabaseProjectNode) 362 else if (dataNode is DatabaseProjectNode)
345 { 363 {
346 m_DatabaseProjects[((DatabaseProjectNode)dataNode).Name] = dataNode; 364 m_DatabaseProjects[((DatabaseProjectNode)dataNode).Name] = (DatabaseProjectNode) dataNode;
365 }
366 else if(dataNode is CleanupNode)
367 {
368 if(m_Cleanup != null)
369 throw new WarningException("There can only be one Cleanup node.");
370 m_Cleanup = (CleanupNode)dataNode;
347 } 371 }
348 } 372 }
349 } 373 }
diff --git a/Prebuild/src/Core/Parse/Preprocessor.cs b/Prebuild/src/Core/Parse/Preprocessor.cs
index b2306e4..0648fad 100644
--- a/Prebuild/src/Core/Parse/Preprocessor.cs
+++ b/Prebuild/src/Core/Parse/Preprocessor.cs
@@ -24,7 +24,7 @@ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY O
24#endregion 24#endregion
25 25
26using System; 26using System;
27using System.Collections; 27using System.Collections.Generic;
28using System.IO; 28using System.IO;
29using System.Text.RegularExpressions; 29using System.Text.RegularExpressions;
30using System.Xml; 30using System.Xml;
@@ -83,9 +83,9 @@ namespace Prebuild.Core.Parse
83 83
84 #region Fields 84 #region Fields
85 85
86 XmlDocument m_OutDoc; 86 readonly XmlDocument m_OutDoc = new XmlDocument();
87 Stack m_IfStack; 87 readonly Stack<IfContext> m_IfStack = new Stack<IfContext>();
88 Hashtable m_Variables; 88 readonly Dictionary<string, object> m_Variables = new Dictionary<string, object>();
89 89
90 #endregion 90 #endregion
91 91
@@ -96,10 +96,6 @@ namespace Prebuild.Core.Parse
96 /// </summary> 96 /// </summary>
97 public Preprocessor() 97 public Preprocessor()
98 { 98 {
99 m_OutDoc = new XmlDocument();
100 m_IfStack = new Stack();
101 m_Variables = new Hashtable();
102
103 RegisterVariable("OS", GetOS()); 99 RegisterVariable("OS", GetOS());
104 RegisterVariable("RuntimeVersion", Environment.Version.Major); 100 RegisterVariable("RuntimeVersion", Environment.Version.Major);
105 RegisterVariable("RuntimeMajor", Environment.Version.Major); 101 RegisterVariable("RuntimeMajor", Environment.Version.Major);
@@ -237,11 +233,10 @@ namespace Prebuild.Core.Parse
237 string str = ""; 233 string str = "";
238 OperatorSymbol oper = OperatorSymbol.None; 234 OperatorSymbol oper = OperatorSymbol.None;
239 bool inStr = false; 235 bool inStr = false;
240 char c; 236
241 237 for(int i = 0; i < exp.Length; i++)
242 for(int i = 0; i < exp.Length; i++)
243 { 238 {
244 c = exp[i]; 239 char c = exp[i];
245 if(Char.IsWhiteSpace(c)) 240 if(Char.IsWhiteSpace(c))
246 { 241 {
247 continue; 242 continue;
@@ -326,16 +321,16 @@ namespace Prebuild.Core.Parse
326 { 321 {
327 throw new WarningException("Expected operator in expression"); 322 throw new WarningException("Expected operator in expression");
328 } 323 }
329 else if(id.Length < 1) 324 if(id.Length < 1)
330 { 325 {
331 throw new WarningException("Expected identifier in expression"); 326 throw new WarningException("Expected identifier in expression");
332 } 327 }
333 else if(str.Length < 1) 328 if(str.Length < 1)
334 { 329 {
335 throw new WarningException("Expected value in expression"); 330 throw new WarningException("Expected value in expression");
336 } 331 }
337 332
338 bool ret = false; 333 bool ret;
339 try 334 try
340 { 335 {
341 object val = m_Variables[id.ToLower()]; 336 object val = m_Variables[id.ToLower()];
@@ -344,19 +339,17 @@ namespace Prebuild.Core.Parse
344 throw new WarningException("Unknown identifier '{0}'", id); 339 throw new WarningException("Unknown identifier '{0}'", id);
345 } 340 }
346 341
347 int numVal, numVal2; 342 Type t = val.GetType();
348 string strVal, strVal2;
349 Type t = val.GetType();
350 if(t.IsAssignableFrom(typeof(int))) 343 if(t.IsAssignableFrom(typeof(int)))
351 { 344 {
352 numVal = (int)val; 345 int numVal = (int)val;
353 numVal2 = Int32.Parse(str); 346 int numVal2 = Int32.Parse(str);
354 ret = CompareNum(oper, numVal, numVal2); 347 ret = CompareNum(oper, numVal, numVal2);
355 } 348 }
356 else 349 else
357 { 350 {
358 strVal = val.ToString(); 351 string strVal = val.ToString();
359 strVal2 = str; 352 string strVal2 = str;
360 ret = CompareStr(oper, strVal, strVal2); 353 ret = CompareStr(oper, strVal, strVal2);
361 } 354 }
362 } 355 }
@@ -369,6 +362,70 @@ namespace Prebuild.Core.Parse
369 return ret; 362 return ret;
370 } 363 }
371 364
365 /// <summary>
366 /// Taken from current Prebuild included in OpenSim 0.7.x
367 /// </summary>
368 /// <param name="readerStack">
369 /// A <see cref="Stack<XmlReader>"/>
370 /// </param>
371 /// <param name="include">
372 /// A <see cref="System.String"/>
373 /// </param>
374 private static void WildCardInclude (Stack<XmlReader> readerStack, string include)
375 {
376 if (!include.Contains ("*")) {
377 return;
378 }
379
380 // Console.WriteLine("Processing {0}", include);
381
382 // Break up the include into pre and post wildcard sections
383 string preWildcard = include.Substring (0, include.IndexOf ("*"));
384 string postWildcard = include.Substring (include.IndexOf ("*") + 2);
385
386 // If preWildcard is a directory, recurse
387 if (Directory.Exists (preWildcard)) {
388 string[] directories = Directory.GetDirectories (preWildcard);
389 Array.Sort (directories);
390 Array.Reverse (directories);
391 foreach (string dirPath in directories) {
392 //Console.WriteLine ("Scanning : {0}", dirPath);
393
394 string includeFile = Path.Combine (dirPath, postWildcard);
395 if (includeFile.Contains ("*")) {
396 // postWildcard included another wildcard, recurse.
397 WildCardInclude (readerStack, includeFile);
398 } else {
399 FileInfo file = new FileInfo (includeFile);
400 if (file.Exists) {
401 //Console.WriteLine ("Including File: {0}", includeFile);
402 XmlReader newReader = new XmlTextReader (file.Open (FileMode.Open, FileAccess.Read, FileShare.Read));
403 readerStack.Push (newReader);
404 }
405 }
406 }
407 } else {
408 // preWildcard is not a path to a directory, so the wildcard is in the filename
409 string searchFilename = Path.GetFileName (preWildcard.Substring (preWildcard.IndexOf ("/") + 1) + "*" + postWildcard);
410 Console.WriteLine ("searchFilename: {0}", searchFilename);
411
412 string searchDirectory = Path.GetDirectoryName (preWildcard);
413 Console.WriteLine ("searchDirectory: {0}", searchDirectory);
414
415 string[] files = Directory.GetFiles (searchDirectory, searchFilename);
416 Array.Sort (files);
417 Array.Reverse (files);
418 foreach (string includeFile in files) {
419 FileInfo file = new FileInfo (includeFile);
420 if (file.Exists) {
421 // Console.WriteLine ("Including File: {0}", includeFile);
422 XmlReader newReader = new XmlTextReader (file.Open (FileMode.Open, FileAccess.Read, FileShare.Read));
423 readerStack.Push (newReader);
424 }
425 }
426 }
427 }
428
372 #endregion 429 #endregion
373 430
374 #region Public Methods 431 #region Public Methods
@@ -392,7 +449,7 @@ namespace Prebuild.Core.Parse
392 /// Performs validation on the xml source as well as evaluates conditional and flow expresions 449 /// Performs validation on the xml source as well as evaluates conditional and flow expresions
393 /// </summary> 450 /// </summary>
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> 451 /// <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> 452 /// <param name="initialReader"></param>
396 /// <returns>the output xml </returns> 453 /// <returns>the output xml </returns>
397 public string Process(XmlReader initialReader) 454 public string Process(XmlReader initialReader)
398 { 455 {
@@ -411,13 +468,13 @@ namespace Prebuild.Core.Parse
411 // readers which lets the <?include?> operation add more 468 // readers which lets the <?include?> operation add more
412 // readers to generate a multi-file parser and not require 469 // readers to generate a multi-file parser and not require
413 // XML fragments that a recursive version would use. 470 // XML fragments that a recursive version would use.
414 Stack readerStack = new Stack(); 471 Stack<XmlReader> readerStack = new Stack<XmlReader>();
415 readerStack.Push(initialReader); 472 readerStack.Push(initialReader);
416 473
417 while(readerStack.Count > 0) 474 while(readerStack.Count > 0)
418 { 475 {
419 // Pop off the next reader. 476 // Pop off the next reader.
420 XmlReader reader = (XmlReader) readerStack.Pop(); 477 XmlReader reader = readerStack.Pop();
421 478
422 // Process through this XML reader until it is 479 // Process through this XML reader until it is
423 // completed (or it is replaced by the include 480 // completed (or it is replaced by the include
@@ -437,7 +494,7 @@ namespace Prebuild.Core.Parse
437 case "include": 494 case "include":
438 // use regular expressions to parse out the attributes. 495 // use regular expressions to parse out the attributes.
439 MatchCollection matches = includeFileRegex.Matches(reader.Value); 496 MatchCollection matches = includeFileRegex.Matches(reader.Value);
440 497
441 // make sure there is only one file attribute. 498 // make sure there is only one file attribute.
442 if(matches.Count > 1) 499 if(matches.Count > 1)
443 { 500 {
@@ -448,38 +505,37 @@ namespace Prebuild.Core.Parse
448 { 505 {
449 throw new WarningException("An <?include ?> node was found, but it did not specify the file attribute."); 506 throw new WarningException("An <?include ?> node was found, but it did not specify the file attribute.");
450 } 507 }
451
452 // Push current reader back onto the stack.
453 readerStack.Push(reader);
454
455 // Pull the file out from the regex and make sure it is a valid file before using it.
456 string filename = matches[0].Groups[1].Value;
457 508
458 filename = String.Join(Path.DirectorySeparatorChar.ToString(), filename.Split(new char[] { '/', '\\' })); 509 // ***** Adding for wildcard handling
459 510 // Push current reader back onto the stack.
460 if (!filename.Contains("*")) 511 readerStack.Push (reader);
461 { 512
462 FileInfo includeFile = new FileInfo(filename); 513 // Pull the file out from the regex and make sure it is a valid file before using it.
463 514 string filename = matches[0].Groups[1].Value;
464 if (!includeFile.Exists) 515
465 { 516 filename = String.Join (Path.DirectorySeparatorChar.ToString (), filename.Split (new char[] { '/', '\\' }));
466 throw new WarningException("Cannot include file: " + includeFile.FullName); 517
518 if (!filename.Contains ("*")) {
519
520 FileInfo includeFile = new FileInfo (filename);
521 if (!includeFile.Exists) {
522 throw new WarningException ("Cannot include file: " + includeFile.FullName);
467 } 523 }
468 524
469 // Create a new reader object for this file, and push it onto the stack 525 // Create a new reader object for this file. Then put the old reader back on the stack and start
470 XmlReader newReader = new XmlTextReader(includeFile.Open(FileMode.Open, FileAccess.Read, FileShare.Read)); 526 // processing using this new XML reader.
471 readerStack.Push(newReader); 527
472 } 528 XmlReader newReader = new XmlTextReader (includeFile.Open (FileMode.Open, FileAccess.Read, FileShare.Read));
473 else 529 reader = newReader;
474 { 530 readerStack.Push (reader);
475 WildCardInclude(readerStack, filename); 531
532 } else {
533 WildCardInclude (readerStack, filename);
476 } 534 }
477 535
478 // continue reading with whatever reader is on the top of the stack 536 reader = (XmlReader)readerStack.Pop ();
479 reader = (XmlReader)readerStack.Pop();
480 ignore = true; 537 ignore = true;
481 538 break;
482 break;
483 539
484 case "if": 540 case "if":
485 m_IfStack.Push(context); 541 m_IfStack.Push(context);
@@ -492,12 +548,12 @@ namespace Prebuild.Core.Parse
492 { 548 {
493 throw new WarningException("Unexpected 'elseif' outside of 'if'"); 549 throw new WarningException("Unexpected 'elseif' outside of 'if'");
494 } 550 }
495 else if(context.State != IfState.If && context.State != IfState.ElseIf) 551 if(context.State != IfState.If && context.State != IfState.ElseIf)
496 { 552 {
497 throw new WarningException("Unexpected 'elseif' outside of 'if'"); 553 throw new WarningException("Unexpected 'elseif' outside of 'if'");
498 } 554 }
499 555
500 context.State = IfState.ElseIf; 556 context.State = IfState.ElseIf;
501 if(!context.EverKept) 557 if(!context.EverKept)
502 { 558 {
503 context.Keep = ParseExpression(reader.Value); 559 context.Keep = ParseExpression(reader.Value);
@@ -515,12 +571,12 @@ namespace Prebuild.Core.Parse
515 { 571 {
516 throw new WarningException("Unexpected 'else' outside of 'if'"); 572 throw new WarningException("Unexpected 'else' outside of 'if'");
517 } 573 }
518 else if(context.State != IfState.If && context.State != IfState.ElseIf) 574 if(context.State != IfState.If && context.State != IfState.ElseIf)
519 { 575 {
520 throw new WarningException("Unexpected 'else' outside of 'if'"); 576 throw new WarningException("Unexpected 'else' outside of 'if'");
521 } 577 }
522 578
523 context.State = IfState.Else; 579 context.State = IfState.Else;
524 context.Keep = !context.EverKept; 580 context.Keep = !context.EverKept;
525 ignore = true; 581 ignore = true;
526 break; 582 break;
@@ -531,7 +587,7 @@ namespace Prebuild.Core.Parse
531 throw new WarningException("Unexpected 'endif' outside of 'if'"); 587 throw new WarningException("Unexpected 'endif' outside of 'if'");
532 } 588 }
533 589
534 context = (IfContext)m_IfStack.Pop(); 590 context = m_IfStack.Pop();
535 ignore = true; 591 ignore = true;
536 break; 592 break;
537 } 593 }
@@ -591,73 +647,6 @@ namespace Prebuild.Core.Parse
591 return xmlText.ToString(); 647 return xmlText.ToString();
592 } 648 }
593 649
594 private static void WildCardInclude(Stack readerStack, string include)
595 {
596 if (!include.Contains("*"))
597 {
598 return;
599 }
600
601// Console.WriteLine("Processing {0}", include);
602
603 // Break up the include into pre and post wildcard sections
604 string preWildcard = include.Substring(0, include.IndexOf("*"));
605 string postWildcard = include.Substring(include.IndexOf("*") + 2);
606
607 // If preWildcard is a directory, recurse
608 if (Directory.Exists(preWildcard))
609 {
610 string[] directories = Directory.GetDirectories(preWildcard);
611 Array.Sort(directories);
612 Array.Reverse(directories);
613 foreach (string dirPath in directories )
614 {
615 Console.WriteLine("Scanning : {0}", dirPath);
616
617 string includeFile = Path.Combine(dirPath, postWildcard);
618 if (includeFile.Contains("*"))
619 {
620 // postWildcard included another wildcard, recurse.
621 WildCardInclude(readerStack, includeFile);
622 }
623 else
624 {
625 FileInfo file = new FileInfo(includeFile);
626 if (file.Exists)
627 {
628 Console.WriteLine("Including File: {0}", includeFile);
629 XmlReader newReader = new XmlTextReader(file.Open(FileMode.Open, FileAccess.Read, FileShare.Read));
630 readerStack.Push(newReader);
631 }
632 }
633 }
634 }
635 else
636 {
637 // preWildcard is not a path to a directory, so the wildcard is in the filename
638 string searchFilename = Path.GetFileName(preWildcard.Substring(preWildcard.IndexOf("/") + 1) + "*" + postWildcard);
639 // Console.WriteLine("searchFilename: {0}", searchFilename);
640
641 string searchDirectory = Path.GetDirectoryName(preWildcard);
642 // Console.WriteLine("searchDirectory: {0}", searchDirectory);
643
644 string[] files = Directory.GetFiles(searchDirectory, searchFilename);
645 Array.Sort(files);
646 Array.Reverse(files);
647 foreach (string includeFile in files)
648 {
649 FileInfo file = new FileInfo(includeFile);
650 if (file.Exists)
651 {
652 Console.WriteLine("Including File: {0}", includeFile);
653 XmlReader newReader = new XmlTextReader(file.Open(FileMode.Open, FileAccess.Read, FileShare.Read));
654 readerStack.Push(newReader);
655 }
656 }
657 }
658
659 }
660
661 #endregion 650 #endregion
662 } 651 }
663} 652}
diff --git a/Prebuild/src/Core/Targets/.NAntTarget.cs.swp b/Prebuild/src/Core/Targets/.NAntTarget.cs.swp
new file mode 100644
index 0000000..afec61c
--- /dev/null
+++ b/Prebuild/src/Core/Targets/.NAntTarget.cs.swp
Binary files differ
diff --git a/Prebuild/src/Core/Targets/AutotoolsTarget.cs b/Prebuild/src/Core/Targets/AutotoolsTarget.cs
index 5dcbb38..485e4dd 100644
--- a/Prebuild/src/Core/Targets/AutotoolsTarget.cs
+++ b/Prebuild/src/Core/Targets/AutotoolsTarget.cs
@@ -66,9 +66,7 @@ POSSIBILITY OF SUCH DAMAGE.
66 66
67#endregion 67#endregion
68using System; 68using System;
69using System.Collections;
70using System.Collections.Generic; 69using System.Collections.Generic;
71using System.Collections.Specialized;
72using System.IO; 70using System.IO;
73using System.Reflection; 71using System.Reflection;
74using System.Text; 72using System.Text;
@@ -81,7 +79,6 @@ using System.Diagnostics;
81using Prebuild.Core.Attributes; 79using Prebuild.Core.Attributes;
82using Prebuild.Core.Interfaces; 80using Prebuild.Core.Interfaces;
83using Prebuild.Core.Nodes; 81using Prebuild.Core.Nodes;
84using Prebuild.Core.Parse;
85using Prebuild.Core.Utilities; 82using Prebuild.Core.Utilities;
86 83
87namespace Prebuild.Core.Targets 84namespace Prebuild.Core.Targets
@@ -170,16 +167,16 @@ namespace Prebuild.Core.Targets
170 XmlDocument autotoolsDoc; 167 XmlDocument autotoolsDoc;
171 XmlUrlResolver xr; 168 XmlUrlResolver xr;
172 System.Security.Policy.Evidence e; 169 System.Security.Policy.Evidence e;
173 Hashtable assemblyPathToPackage = new Hashtable(); 170 readonly Dictionary<string, SystemPackage> assemblyPathToPackage = new Dictionary<string, SystemPackage>();
174 Hashtable assemblyFullNameToPath = new Hashtable(); 171 readonly Dictionary<string, string> assemblyFullNameToPath = new Dictionary<string, string>();
175 Hashtable packagesHash = new Hashtable(); 172 readonly Dictionary<string, SystemPackage> packagesHash = new Dictionary<string, SystemPackage>();
176 readonly List<SystemPackage> packages = new List<SystemPackage>(); 173 readonly List<SystemPackage> packages = new List<SystemPackage>();
177 174
178 #endregion 175 #endregion
179 176
180 #region Private Methods 177 #region Private Methods
181 178
182 private void mkdirDashP(string dirName) 179 private static void mkdirDashP(string dirName)
183 { 180 {
184 DirectoryInfo di = new DirectoryInfo(dirName); 181 DirectoryInfo di = new DirectoryInfo(dirName);
185 if (di.Exists) 182 if (di.Exists)
@@ -193,7 +190,7 @@ namespace Prebuild.Core.Targets
193 di.Create(); 190 di.Create();
194 } 191 }
195 192
196 private void chkMkDir(string dirName) 193 private static void chkMkDir(string dirName)
197 { 194 {
198 System.IO.DirectoryInfo di = 195 System.IO.DirectoryInfo di =
199 new System.IO.DirectoryInfo(dirName); 196 new System.IO.DirectoryInfo(dirName);
@@ -222,13 +219,12 @@ namespace Prebuild.Core.Targets
222 (m_Kernel.CurrentDoc, argList, templateWriter, xr); 219 (m_Kernel.CurrentDoc, argList, templateWriter, xr);
223 } 220 }
224 221
225 string NormalizeAsmName(string name) 222 static string NormalizeAsmName(string name)
226 { 223 {
227 int i = name.IndexOf(", PublicKeyToken=null"); 224 int i = name.IndexOf(", PublicKeyToken=null");
228 if (i != -1) 225 if (i != -1)
229 return name.Substring(0, i).Trim(); 226 return name.Substring(0, i).Trim();
230 else 227 return name;
231 return name;
232 } 228 }
233 229
234 private void AddAssembly(string assemblyfile, SystemPackage package) 230 private void AddAssembly(string assemblyfile, SystemPackage package)
@@ -247,7 +243,7 @@ namespace Prebuild.Core.Targets
247 } 243 }
248 } 244 }
249 245
250 private List<string> GetAssembliesWithLibInfo(string line, string file) 246 private static List<string> GetAssembliesWithLibInfo(string line, string file)
251 { 247 {
252 List<string> references = new List<string>(); 248 List<string> references = new List<string>();
253 List<string> libdirs = new List<string>(); 249 List<string> libdirs = new List<string>();
@@ -278,7 +274,7 @@ namespace Prebuild.Core.Targets
278 return retval; 274 return retval;
279 } 275 }
280 276
281 private List<string> GetAssembliesWithoutLibInfo(string line, string file) 277 private static List<string> GetAssembliesWithoutLibInfo(string line, string file)
282 { 278 {
283 List<string> references = new List<string>(); 279 List<string> references = new List<string>();
284 foreach (string reference in line.Split(' ')) 280 foreach (string reference in line.Split(' '))
@@ -292,7 +288,7 @@ namespace Prebuild.Core.Targets
292 return references; 288 return references;
293 } 289 }
294 290
295 private string ProcessPiece(string piece, string pcfile) 291 private static string ProcessPiece(string piece, string pcfile)
296 { 292 {
297 int start = piece.IndexOf("${"); 293 int start = piece.IndexOf("${");
298 if (start == -1) 294 if (start == -1)
@@ -307,7 +303,7 @@ namespace Prebuild.Core.Targets
307 return ProcessPiece(piece.Replace("${" + variable + "}", interp), pcfile); 303 return ProcessPiece(piece.Replace("${" + variable + "}", interp), pcfile);
308 } 304 }
309 305
310 private string GetVariableFromPkgConfig(string var, string pcfile) 306 private static string GetVariableFromPkgConfig(string var, string pcfile)
311 { 307 {
312 ProcessStartInfo psi = new ProcessStartInfo("pkg-config"); 308 ProcessStartInfo psi = new ProcessStartInfo("pkg-config");
313 psi.RedirectStandardOutput = true; 309 psi.RedirectStandardOutput = true;
@@ -327,7 +323,7 @@ namespace Prebuild.Core.Targets
327 { 323 {
328 // Don't register the package twice 324 // Don't register the package twice
329 string pname = Path.GetFileNameWithoutExtension(pcfile); 325 string pname = Path.GetFileNameWithoutExtension(pcfile);
330 if (packagesHash.Contains(pname)) 326 if (packagesHash.ContainsKey(pname))
331 return; 327 return;
332 328
333 List<string> fullassemblies = null; 329 List<string> fullassemblies = null;
@@ -507,158 +503,6 @@ namespace Prebuild.Core.Targets
507 WriteProject(solution, project); 503 WriteProject(solution, project);
508 } 504 }
509 } 505 }
510 private static string PrependPath(string path)
511 {
512 string tmpPath = Helper.NormalizePath(path, '/');
513 Regex regex = new Regex(@"(\w):/(\w+)");
514 Match match = regex.Match(tmpPath);
515 if (match.Success || tmpPath[0] == '.' || tmpPath[0] == '/')
516 {
517 tmpPath = Helper.NormalizePath(tmpPath);
518 }
519 else
520 {
521 tmpPath = Helper.NormalizePath("./" + tmpPath);
522 }
523
524 return tmpPath;
525 }
526
527 private static string BuildReference(SolutionNode solution,
528 ReferenceNode refr)
529 {
530 string ret = "";
531 if (solution.ProjectsTable.ContainsKey(refr.Name))
532 {
533 ProjectNode project =
534 (ProjectNode)solution.ProjectsTable[refr.Name];
535 string fileRef = FindFileReference(refr.Name, project);
536 string finalPath =
537 Helper.NormalizePath(Helper.MakeFilePath(project.FullPath +
538 "/$(BUILD_DIR)/$(CONFIG)/",
539 refr.Name, "dll"),
540 '/');
541 ret += finalPath;
542 return ret;
543 }
544 else
545 {
546 ProjectNode project = (ProjectNode)refr.Parent;
547 string fileRef = FindFileReference(refr.Name, project);
548
549 if (refr.Path != null || fileRef != null)
550 {
551 string finalPath = ((refr.Path != null) ?
552 Helper.NormalizePath(refr.Path + "/" +
553 refr.Name + ".dll",
554 '/') :
555 fileRef
556 );
557 ret += Path.Combine(project.Path, finalPath);
558 return ret;
559 }
560
561 try
562 {
563 //Assembly assem = Assembly.Load(refr.Name);
564 //if (assem != null)
565 //{
566 // int index = refr.Name.IndexOf(",");
567 // if ( index > 0)
568 // {
569 // ret += assem.Location;
570 // //Console.WriteLine("Location1: " + assem.Location);
571 // }
572 // else
573 // {
574 // ret += (refr.Name + ".dll");
575 // //Console.WriteLine("Location2: " + assem.Location);
576 // }
577 //}
578 //else
579 //{
580 int index = refr.Name.IndexOf(",");
581 if (index > 0)
582 {
583 ret += refr.Name.Substring(0, index) + ".dll";
584 //Console.WriteLine("Location3: " + assem.Location);
585 }
586 else
587 {
588 ret += (refr.Name + ".dll");
589 //Console.WriteLine("Location4: " + assem.Location);
590 }
591 //}
592 }
593 catch (System.NullReferenceException e)
594 {
595 e.ToString();
596 int index = refr.Name.IndexOf(",");
597 if (index > 0)
598 {
599 ret += refr.Name.Substring(0, index) + ".dll";
600 //Console.WriteLine("Location5: " + assem.Location);
601 }
602 else
603 {
604 ret += (refr.Name + ".dll");
605 //Console.WriteLine("Location6: " + assem.Location);
606 }
607 }
608 }
609 return ret;
610 }
611
612 private static string BuildReferencePath(SolutionNode solution,
613 ReferenceNode refr)
614 {
615 string ret = "";
616 if (solution.ProjectsTable.ContainsKey(refr.Name))
617 {
618 ProjectNode project =
619 (ProjectNode)solution.ProjectsTable[refr.Name];
620 string finalPath =
621 Helper.NormalizePath(Helper.MakeReferencePath(project.FullPath +
622 "/${build.dir}/"),
623 '/');
624 ret += finalPath;
625 return ret;
626 }
627 else
628 {
629 ProjectNode project = (ProjectNode)refr.Parent;
630 string fileRef = FindFileReference(refr.Name, project);
631
632 if (refr.Path != null || fileRef != null)
633 {
634 string finalPath = ((refr.Path != null) ?
635 Helper.NormalizePath(refr.Path, '/') :
636 fileRef
637 );
638 ret += finalPath;
639 return ret;
640 }
641
642 try
643 {
644 Assembly assem = Assembly.Load(refr.Name);
645 if (assem != null)
646 {
647 ret += "";
648 }
649 else
650 {
651 ret += "";
652 }
653 }
654 catch (System.NullReferenceException e)
655 {
656 e.ToString();
657 ret += "";
658 }
659 }
660 return ret;
661 }
662 506
663 private static string FindFileReference(string refName, 507 private static string FindFileReference(string refName,
664 ProjectNode project) 508 ProjectNode project)
@@ -831,7 +675,7 @@ namespace Prebuild.Core.Targets
831 } 675 }
832 catch 676 catch
833 { 677 {
834 Console.WriteLine("Error! '{0}'", e.ToString()); 678 Console.WriteLine("Error! '{0}'", e);
835 } 679 }
836 680
837 } 681 }
@@ -865,7 +709,7 @@ namespace Prebuild.Core.Targets
865 // Set up references 709 // Set up references
866 for (int refNum = 0; refNum < project.References.Count; refNum++) 710 for (int refNum = 0; refNum < project.References.Count; refNum++)
867 { 711 {
868 ReferenceNode refr = (ReferenceNode)project.References[refNum]; 712 ReferenceNode refr = project.References[refNum];
869 Assembly refAssembly = Assembly.LoadWithPartialName(refr.Name); 713 Assembly refAssembly = Assembly.LoadWithPartialName(refr.Name);
870 714
871 /* Determine which pkg-config (.pc) file refers to 715 /* Determine which pkg-config (.pc) file refers to
@@ -873,25 +717,28 @@ namespace Prebuild.Core.Targets
873 717
874 SystemPackage package = null; 718 SystemPackage package = null;
875 719
876 if (packagesHash.Contains(refr.Name)){ 720 if (packagesHash.ContainsKey(refr.Name))
877 package = (SystemPackage)packagesHash[refr.Name]; 721 {
878 722 package = packagesHash[refr.Name];
879 }else{
880 string assemblyFullName = string.Empty;
881 if (refAssembly != null)
882 assemblyFullName = refAssembly.FullName;
883
884 string assemblyFileName = string.Empty;
885 if (assemblyFullName != string.Empty &&
886 assemblyFullNameToPath.Contains(assemblyFullName)
887 )
888 assemblyFileName =
889 (string)assemblyFullNameToPath[assemblyFullName];
890 723
891 if (assemblyFileName != string.Empty && 724 }
892 assemblyPathToPackage.Contains(assemblyFileName) 725 else
893 ) 726 {
894 package = (SystemPackage)assemblyPathToPackage[assemblyFileName]; 727 string assemblyFullName = string.Empty;
728 if (refAssembly != null)
729 assemblyFullName = refAssembly.FullName;
730
731 string assemblyFileName = string.Empty;
732 if (assemblyFullName != string.Empty &&
733 assemblyFullNameToPath.ContainsKey(assemblyFullName)
734 )
735 assemblyFileName =
736 assemblyFullNameToPath[assemblyFullName];
737
738 if (assemblyFileName != string.Empty &&
739 assemblyPathToPackage.ContainsKey(assemblyFileName)
740 )
741 package = assemblyPathToPackage[assemblyFileName];
895 742
896 } 743 }
897 744
@@ -958,7 +805,7 @@ namespace Prebuild.Core.Targets
958 */ 805 */
959 806
960 ProjectNode sourcePrj = 807 ProjectNode sourcePrj =
961 ((ProjectNode)(solution.ProjectsTable[refr.Name])); 808 ((solution.ProjectsTable[refr.Name]));
962 809
963 string target = 810 string target =
964 String.Format("{0}:\n" + 811 String.Format("{0}:\n" +
@@ -1067,564 +914,6 @@ namespace Prebuild.Core.Targets
1067 transformToFile(Path.Combine(projectDir, project.Name.ToLower() + ".in"), argList, "/Autotools/ProjectWrapperScriptIn"); 914 transformToFile(Path.Combine(projectDir, project.Name.ToLower() + ".in"), argList, "/Autotools/ProjectWrapperScriptIn");
1068 } 915 }
1069 916
1070 private void WriteProjectOld(SolutionNode solution, ProjectNode project)
1071 {
1072 string projFile = Helper.MakeFilePath(project.FullPath, "Include", "am");
1073 StreamWriter ss = new StreamWriter(projFile);
1074 ss.NewLine = "\n";
1075
1076 m_Kernel.CurrentWorkingDirectory.Push();
1077 Helper.SetCurrentDir(Path.GetDirectoryName(projFile));
1078
1079 using (ss)
1080 {
1081 ss.WriteLine(Helper.AssemblyFullName(project.AssemblyName, project.Type) + ":");
1082 ss.WriteLine("\tmkdir -p " + Helper.MakePathRelativeTo(solution.FullPath, project.Path) + "/$(BUILD_DIR)/$(CONFIG)/");
1083 foreach (string file in project.Files)
1084 {
1085 if (project.Files.GetSubType(file) != SubType.Code && project.Files.GetSubType(file) != SubType.Settings)
1086 {
1087 ss.Write("\tresgen ");
1088 ss.Write(Helper.NormalizePath(Path.Combine(project.Path, file.Substring(0, file.LastIndexOf('.')) + ".resx "), '/'));
1089 if (project.Files.GetResourceName(file) != "")
1090 {
1091 ss.WriteLine(Helper.NormalizePath(Path.Combine(project.Path, project.RootNamespace + "." + project.Files.GetResourceName(file) + ".resources"), '/'));
1092 }
1093 else
1094 {
1095 ss.WriteLine(Helper.NormalizePath(Path.Combine(project.Path, project.RootNamespace + "." + file.Substring(0, file.LastIndexOf('.')) + ".resources"), '/'));
1096 }
1097 }
1098 }
1099 ss.WriteLine("\t$(CSC)\t/out:" + Helper.MakePathRelativeTo(solution.FullPath, project.Path) + "/$(BUILD_DIR)/$(CONFIG)/" + Helper.AssemblyFullName(project.AssemblyName, project.Type) + " \\");
1100 ss.WriteLine("\t\t/target:" + project.Type.ToString().ToLower() + " \\");
1101 if (project.References.Count > 0)
1102 {
1103 ss.Write("\t\t/reference:");
1104 bool firstref = true;
1105 foreach (ReferenceNode refr in project.References)
1106 {
1107 if (firstref)
1108 {
1109 firstref = false;
1110 }
1111 else
1112 {
1113 ss.Write(",");
1114 }
1115 ss.Write("{0}", Helper.NormalizePath(Helper.MakePathRelativeTo(solution.FullPath, BuildReference(solution, refr)), '/'));
1116 }
1117 ss.WriteLine(" \\");
1118 }
1119 //ss.WriteLine("\t\tProperties/AssemblyInfo.cs \\");
1120
1121 foreach (string file in project.Files)
1122 {
1123 switch (project.Files.GetBuildAction(file))
1124 {
1125 case BuildAction.EmbeddedResource:
1126 ss.Write("\t\t/resource:");
1127 ss.WriteLine(Helper.NormalizePath(Path.Combine(project.Path, file), '/') + " \\");
1128 break;
1129 default:
1130 if (project.Files.GetSubType(file) != SubType.Code && project.Files.GetSubType(file) != SubType.Settings)
1131 {
1132 ss.Write("\t\t/resource:");
1133 if (project.Files.GetResourceName(file) != "")
1134 {
1135 ss.WriteLine(Helper.NormalizePath(Path.Combine(project.Path, project.RootNamespace + "." + project.Files.GetResourceName(file) + ".resources"), '/') + "," + project.RootNamespace + "." + project.Files.GetResourceName(file) + ".resources" + " \\");
1136 }
1137 else
1138 {
1139 ss.WriteLine(Helper.NormalizePath(Path.Combine(project.Path, project.RootNamespace + "." + file.Substring(0, file.LastIndexOf('.')) + ".resources"), '/') + "," + project.RootNamespace + "." + file.Substring(0, file.LastIndexOf('.')) + ".resources" + " \\");
1140 }
1141 }
1142 break;
1143 }
1144 }
1145
1146 foreach (ConfigurationNode conf in project.Configurations)
1147 {
1148 if (conf.Options.KeyFile != "")
1149 {
1150 ss.WriteLine("\t\t/keyfile:" + Helper.NormalizePath(Path.Combine(project.Path, conf.Options.KeyFile), '/') + " \\");
1151 break;
1152 }
1153 }
1154 foreach (ConfigurationNode conf in project.Configurations)
1155 {
1156 if (conf.Options.AllowUnsafe)
1157 {
1158 ss.WriteLine("\t\t/unsafe \\");
1159 break;
1160 }
1161 }
1162 if (project.AppIcon != "")
1163 {
1164 ss.WriteLine("\t\t/win32icon:" + Helper.NormalizePath(Path.Combine(project.Path, project.AppIcon), '/') + " \\");
1165 }
1166
1167 foreach (ConfigurationNode conf in project.Configurations)
1168 {
1169 ss.WriteLine("\t\t/define:{0}", conf.Options.CompilerDefines.Replace(';', ',') + " \\");
1170 break;
1171 }
1172
1173 foreach (ConfigurationNode conf in project.Configurations)
1174 {
1175 if (GetXmlDocFile(project, conf) != "")
1176 {
1177 ss.WriteLine("\t\t/doc:" + Helper.MakePathRelativeTo(solution.FullPath, project.Path) + "/$(BUILD_DIR)/$(CONFIG)/" + project.Name + ".xml \\");
1178 break;
1179 }
1180 }
1181 foreach (string file in project.Files)
1182 {
1183 switch (project.Files.GetBuildAction(file))
1184 {
1185 case BuildAction.Compile:
1186 ss.WriteLine("\t\t\\");
1187 ss.Write("\t\t" + NormalizePath(Path.Combine(Helper.MakePathRelativeTo(solution.FullPath, project.Path), file)));
1188 break;
1189 default:
1190 break;
1191 }
1192 }
1193 ss.WriteLine();
1194 ss.WriteLine();
1195
1196 if (project.Type == ProjectType.Library)
1197 {
1198 ss.WriteLine("install-data-local:");
1199 ss.WriteLine(" echo \"$(GACUTIL) /i bin/Release/" + project.Name + ".dll /f $(GACUTIL_FLAGS)\"; \\");
1200 ss.WriteLine(" $(GACUTIL) /i bin/Release/" + project.Name + ".dll /f $(GACUTIL_FLAGS) || exit 1;");
1201 ss.WriteLine();
1202 ss.WriteLine("uninstall-local:");
1203 ss.WriteLine(" echo \"$(GACUTIL) /u " + project.Name + " $(GACUTIL_FLAGS)\"; \\");
1204 ss.WriteLine(" $(GACUTIL) /u " + project.Name + " $(GACUTIL_FLAGS) || exit 1;");
1205 ss.WriteLine();
1206 }
1207 ss.WriteLine("CLEANFILES = $(BUILD_DIR)/$(CONFIG)/" + Helper.AssemblyFullName(project.AssemblyName, project.Type) + " $(BUILD_DIR)/$(CONFIG)/" + project.AssemblyName + ".mdb $(BUILD_DIR)/$(CONFIG)/" + project.AssemblyName + ".pdb " + project.AssemblyName + ".xml");
1208 ss.WriteLine("EXTRA_DIST = \\");
1209 ss.Write(" $(FILES)");
1210 foreach (ConfigurationNode conf in project.Configurations)
1211 {
1212 if (conf.Options.KeyFile != "")
1213 {
1214 ss.Write(" \\");
1215 ss.WriteLine("\t" + conf.Options.KeyFile);
1216 }
1217 break;
1218 }
1219 }
1220 m_Kernel.CurrentWorkingDirectory.Pop();
1221 }
1222 bool hasLibrary = false;
1223
1224 private void WriteCombineOld(SolutionNode solution)
1225 {
1226
1227 /* TODO: These vars should be pulled from the prebuild.xml file */
1228 string releaseVersion = "2.0.0";
1229 string assemblyVersion = "2.1.0.0";
1230 string description =
1231 "Tao Framework " + solution.Name + " Binding For .NET";
1232
1233 hasLibrary = false;
1234 m_Kernel.Log.Write("Creating Autotools make files");
1235 foreach (ProjectNode project in solution.Projects)
1236 {
1237 if (m_Kernel.AllowProject(project.FilterGroups))
1238 {
1239 m_Kernel.Log.Write("...Creating makefile: {0}", project.Name);
1240 WriteProject(solution, project);
1241 }
1242 }
1243
1244 m_Kernel.Log.Write("");
1245 string combFile = Helper.MakeFilePath(solution.FullPath, "Makefile", "am");
1246 StreamWriter ss = new StreamWriter(combFile);
1247 ss.NewLine = "\n";
1248
1249 m_Kernel.CurrentWorkingDirectory.Push();
1250 Helper.SetCurrentDir(Path.GetDirectoryName(combFile));
1251
1252 using (ss)
1253 {
1254 foreach (ProjectNode project in solution.ProjectsTableOrder)
1255 {
1256 if (project.Type == ProjectType.Library)
1257 {
1258 hasLibrary = true;
1259 break;
1260 }
1261 }
1262
1263 if (hasLibrary)
1264 {
1265 ss.Write("pkgconfig_in_files = ");
1266 foreach (ProjectNode project in solution.ProjectsTableOrder)
1267 {
1268 if (project.Type == ProjectType.Library)
1269 {
1270 string combFilepc = Helper.MakeFilePath(solution.FullPath, project.Name, "pc.in");
1271 ss.Write(" " + project.Name + ".pc.in ");
1272 StreamWriter sspc = new StreamWriter(combFilepc);
1273 sspc.NewLine = "\n";
1274 using (sspc)
1275 {
1276 sspc.WriteLine("prefix=@prefix@");
1277 sspc.WriteLine("exec_prefix=${prefix}");
1278 sspc.WriteLine("libdir=${exec_prefix}/lib");
1279 sspc.WriteLine();
1280 sspc.WriteLine("Name: @PACKAGE_NAME@");
1281 sspc.WriteLine("Description: @DESCRIPTION@");
1282 sspc.WriteLine("Version: @ASSEMBLY_VERSION@");
1283 sspc.WriteLine("Libs: -r:${libdir}/mono/gac/@PACKAGE_NAME@/@ASSEMBLY_VERSION@__@PUBKEY@/@PACKAGE_NAME@.dll");
1284 }
1285 }
1286 }
1287
1288 ss.WriteLine();
1289 ss.WriteLine("pkgconfigdir=$(prefix)/lib/pkgconfig");
1290 ss.WriteLine("pkgconfig_DATA=$(pkgconfig_in_files:.pc.in=.pc)");
1291 }
1292 ss.WriteLine();
1293 foreach (ProjectNode project in solution.ProjectsTableOrder)
1294 {
1295 string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath);
1296 ss.WriteLine("-include x {0}",
1297 Helper.NormalizePath(Helper.MakeFilePath(path, "Include", "am"), '/'));
1298 }
1299 ss.WriteLine();
1300 ss.WriteLine("all: \\");
1301 ss.Write("\t");
1302 foreach (ProjectNode project in solution.ProjectsTableOrder)
1303 {
1304 string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath);
1305 ss.Write(Helper.AssemblyFullName(project.AssemblyName, project.Type) + " ");
1306
1307 }
1308 ss.WriteLine();
1309 if (hasLibrary)
1310 {
1311 ss.WriteLine("EXTRA_DIST = \\");
1312 ss.WriteLine("\t$(pkgconfig_in_files)");
1313 }
1314 else
1315 {
1316 ss.WriteLine("EXTRA_DIST = ");
1317 }
1318 ss.WriteLine();
1319 ss.WriteLine("DISTCLEANFILES = \\");
1320 ss.WriteLine("\tconfigure \\");
1321 ss.WriteLine("\tMakefile.in \\");
1322 ss.WriteLine("\taclocal.m4");
1323 }
1324 combFile = Helper.MakeFilePath(solution.FullPath, "configure", "ac");
1325 StreamWriter ts = new StreamWriter(combFile);
1326 ts.NewLine = "\n";
1327 using (ts)
1328 {
1329 if (this.hasLibrary)
1330 {
1331 foreach (ProjectNode project in solution.ProjectsTableOrder)
1332 {
1333 if (project.Type == ProjectType.Library)
1334 {
1335 ts.WriteLine("AC_INIT(" + project.Name + ".pc.in)");
1336 break;
1337 }
1338 }
1339 }
1340 else
1341 {
1342 ts.WriteLine("AC_INIT(Makefile.am)");
1343 }
1344 ts.WriteLine("AC_PREREQ(2.53)");
1345 ts.WriteLine("AC_CANONICAL_SYSTEM");
1346
1347 ts.WriteLine("PACKAGE_NAME={0}", solution.Name);
1348 ts.WriteLine("PACKAGE_VERSION={0}", releaseVersion);
1349 ts.WriteLine("DESCRIPTION=\"{0}\"", description);
1350 ts.WriteLine("AC_SUBST(DESCRIPTION)");
1351 ts.WriteLine("AM_INIT_AUTOMAKE([$PACKAGE_NAME],[$PACKAGE_VERSION],[$DESCRIPTION])");
1352
1353 ts.WriteLine("ASSEMBLY_VERSION={0}", assemblyVersion);
1354 ts.WriteLine("AC_SUBST(ASSEMBLY_VERSION)");
1355
1356 ts.WriteLine("PUBKEY=`sn -t $PACKAGE_NAME.snk | grep 'Public Key Token' | awk -F: '{print $2}' | sed -e 's/^ //'`");
1357 ts.WriteLine("AC_SUBST(PUBKEY)");
1358
1359 ts.WriteLine();
1360 ts.WriteLine("AM_MAINTAINER_MODE");
1361 ts.WriteLine();
1362 ts.WriteLine("dnl AC_PROG_INTLTOOL([0.25])");
1363 ts.WriteLine();
1364 ts.WriteLine("AC_PROG_INSTALL");
1365 ts.WriteLine();
1366 ts.WriteLine("MONO_REQUIRED_VERSION=1.1");
1367 ts.WriteLine();
1368 ts.WriteLine("AC_MSG_CHECKING([whether we're compiling from CVS])");
1369 ts.WriteLine("if test -f \"$srcdir/.cvs_version\" ; then");
1370 ts.WriteLine(" from_cvs=yes");
1371 ts.WriteLine("else");
1372 ts.WriteLine(" if test -f \"$srcdir/.svn\" ; then");
1373 ts.WriteLine(" from_cvs=yes");
1374 ts.WriteLine(" else");
1375 ts.WriteLine(" from_cvs=no");
1376 ts.WriteLine(" fi");
1377 ts.WriteLine("fi");
1378 ts.WriteLine();
1379 ts.WriteLine("AC_MSG_RESULT($from_cvs)");
1380 ts.WriteLine();
1381 ts.WriteLine("AC_PATH_PROG(MONO, mono)");
1382 ts.WriteLine("AC_PATH_PROG(GMCS, gmcs)");
1383 ts.WriteLine("AC_PATH_PROG(GACUTIL, gacutil)");
1384 ts.WriteLine();
1385 ts.WriteLine("AC_MSG_CHECKING([for mono])");
1386 ts.WriteLine("dnl if test \"x$MONO\" = \"x\" ; then");
1387 ts.WriteLine("dnl AC_MSG_ERROR([Can't find \"mono\" in your PATH])");
1388 ts.WriteLine("dnl else");
1389 ts.WriteLine(" AC_MSG_RESULT([found])");
1390 ts.WriteLine("dnl fi");
1391 ts.WriteLine();
1392 ts.WriteLine("AC_MSG_CHECKING([for gmcs])");
1393 ts.WriteLine("dnl if test \"x$GMCS\" = \"x\" ; then");
1394 ts.WriteLine("dnl AC_MSG_ERROR([Can't find \"gmcs\" in your PATH])");
1395 ts.WriteLine("dnl else");
1396 ts.WriteLine(" AC_MSG_RESULT([found])");
1397 ts.WriteLine("dnl fi");
1398 ts.WriteLine();
1399 //ts.WriteLine("AC_MSG_CHECKING([for gacutil])");
1400 //ts.WriteLine("if test \"x$GACUTIL\" = \"x\" ; then");
1401 //ts.WriteLine(" AC_MSG_ERROR([Can't find \"gacutil\" in your PATH])");
1402 //ts.WriteLine("else");
1403 //ts.WriteLine(" AC_MSG_RESULT([found])");
1404 //ts.WriteLine("fi");
1405 ts.WriteLine();
1406 ts.WriteLine("AC_SUBST(PATH)");
1407 ts.WriteLine("AC_SUBST(LD_LIBRARY_PATH)");
1408 ts.WriteLine();
1409 ts.WriteLine("dnl CSFLAGS=\"-debug -nowarn:1574\"");
1410 ts.WriteLine("CSFLAGS=\"\"");
1411 ts.WriteLine("AC_SUBST(CSFLAGS)");
1412 ts.WriteLine();
1413 // ts.WriteLine("AC_MSG_CHECKING(--disable-sdl argument)");
1414 // ts.WriteLine("AC_ARG_ENABLE(sdl,");
1415 // ts.WriteLine(" [ --disable-sdl Disable Sdl interface.],");
1416 // ts.WriteLine(" [disable_sdl=$disableval],");
1417 // ts.WriteLine(" [disable_sdl=\"no\"])");
1418 // ts.WriteLine("AC_MSG_RESULT($disable_sdl)");
1419 // ts.WriteLine("if test \"$disable_sdl\" = \"yes\"; then");
1420 // ts.WriteLine(" AC_DEFINE(FEAT_SDL)");
1421 // ts.WriteLine("fi");
1422 ts.WriteLine();
1423 ts.WriteLine("dnl Find pkg-config");
1424 ts.WriteLine("AC_PATH_PROG(PKGCONFIG, pkg-config, no)");
1425 ts.WriteLine("if test \"x$PKG_CONFIG\" = \"xno\"; then");
1426 ts.WriteLine(" AC_MSG_ERROR([You need to install pkg-config])");
1427 ts.WriteLine("fi");
1428 ts.WriteLine();
1429 ts.WriteLine("PKG_CHECK_MODULES(MONO_DEPENDENCY, mono >= $MONO_REQUIRED_VERSION, has_mono=true, has_mono=false)");
1430 ts.WriteLine("BUILD_DIR=\"bin\"");
1431 ts.WriteLine("AC_SUBST(BUILD_DIR)");
1432 ts.WriteLine("CONFIG=\"Release\"");
1433 ts.WriteLine("AC_SUBST(CONFIG)");
1434 ts.WriteLine();
1435 ts.WriteLine("if test \"x$has_mono\" = \"xtrue\"; then");
1436 ts.WriteLine(" AC_PATH_PROG(RUNTIME, mono, no)");
1437 ts.WriteLine(" AC_PATH_PROG(CSC, gmcs, no)");
1438 ts.WriteLine(" if test `uname -s` = \"Darwin\"; then");
1439 ts.WriteLine(" LIB_PREFIX=");
1440 ts.WriteLine(" LIB_SUFFIX=.dylib");
1441 ts.WriteLine(" else");
1442 ts.WriteLine(" LIB_PREFIX=.so");
1443 ts.WriteLine(" LIB_SUFFIX=");
1444 ts.WriteLine(" fi");
1445 ts.WriteLine("else");
1446 ts.WriteLine(" AC_PATH_PROG(CSC, csc.exe, no)");
1447 ts.WriteLine(" if test x$CSC = \"xno\"; then");
1448 ts.WriteLine(" AC_MSG_ERROR([You need to install either mono or .Net])");
1449 ts.WriteLine(" else");
1450 ts.WriteLine(" RUNTIME=");
1451 ts.WriteLine(" LIB_PREFIX=");
1452 ts.WriteLine(" LIB_SUFFIX=.dylib");
1453 ts.WriteLine(" fi");
1454 ts.WriteLine("fi");
1455 ts.WriteLine();
1456 ts.WriteLine("AC_SUBST(LIB_PREFIX)");
1457 ts.WriteLine("AC_SUBST(LIB_SUFFIX)");
1458 ts.WriteLine();
1459 ts.WriteLine("AC_SUBST(BASE_DEPENDENCIES_CFLAGS)");
1460 ts.WriteLine("AC_SUBST(BASE_DEPENDENCIES_LIBS)");
1461 ts.WriteLine();
1462 ts.WriteLine("dnl Find monodoc");
1463 ts.WriteLine("MONODOC_REQUIRED_VERSION=1.0");
1464 ts.WriteLine("AC_SUBST(MONODOC_REQUIRED_VERSION)");
1465 ts.WriteLine("PKG_CHECK_MODULES(MONODOC_DEPENDENCY, monodoc >= $MONODOC_REQUIRED_VERSION, enable_monodoc=yes, enable_monodoc=no)");
1466 ts.WriteLine();
1467 ts.WriteLine("if test \"x$enable_monodoc\" = \"xyes\"; then");
1468 ts.WriteLine(" AC_PATH_PROG(MONODOC, monodoc, no)");
1469 ts.WriteLine(" if test x$MONODOC = xno; then");
1470 ts.WriteLine(" enable_monodoc=no");
1471 ts.WriteLine(" fi");
1472 ts.WriteLine("else");
1473 ts.WriteLine(" MONODOC=");
1474 ts.WriteLine("fi");
1475 ts.WriteLine();
1476 ts.WriteLine("AC_SUBST(MONODOC)");
1477 ts.WriteLine("AM_CONDITIONAL(ENABLE_MONODOC, test \"x$enable_monodoc\" = \"xyes\")");
1478 ts.WriteLine();
1479 ts.WriteLine("AC_PATH_PROG(GACUTIL, gacutil, no)");
1480 ts.WriteLine("if test \"x$GACUTIL\" = \"xno\" ; then");
1481 ts.WriteLine(" AC_MSG_ERROR([No gacutil tool found])");
1482 ts.WriteLine("fi");
1483 ts.WriteLine();
1484 // foreach(ProjectNode project in solution.ProjectsTableOrder)
1485 // {
1486 // if (project.Type == ProjectType.Library)
1487 // {
1488 // }
1489 // }
1490 ts.WriteLine("GACUTIL_FLAGS='/package $(PACKAGE_NAME) /gacdir $(DESTDIR)$(prefix)'");
1491 ts.WriteLine("AC_SUBST(GACUTIL_FLAGS)");
1492 ts.WriteLine();
1493 ts.WriteLine("winbuild=no");
1494 ts.WriteLine("case \"$host\" in");
1495 ts.WriteLine(" *-*-mingw*|*-*-cygwin*)");
1496 ts.WriteLine(" winbuild=yes");
1497 ts.WriteLine(" ;;");
1498 ts.WriteLine("esac");
1499 ts.WriteLine("AM_CONDITIONAL(WINBUILD, test x$winbuild = xyes)");
1500 ts.WriteLine();
1501 // ts.WriteLine("dnl Check for SDL");
1502 // ts.WriteLine();
1503 // ts.WriteLine("AC_PATH_PROG([SDL_CONFIG], [sdl-config])");
1504 // ts.WriteLine("have_sdl=no");
1505 // ts.WriteLine("if test -n \"${SDL_CONFIG}\"; then");
1506 // ts.WriteLine(" have_sdl=yes");
1507 // ts.WriteLine(" SDL_CFLAGS=`$SDL_CONFIG --cflags`");
1508 // ts.WriteLine(" SDL_LIBS=`$SDL_CONFIG --libs`");
1509 // ts.WriteLine(" #");
1510 // ts.WriteLine(" # sdl-config sometimes emits an rpath flag pointing at its library");
1511 // ts.WriteLine(" # installation directory. We don't want this, as it prevents users from");
1512 // ts.WriteLine(" # linking sdl-viewer against, for example, a locally compiled libGL when a");
1513 // ts.WriteLine(" # version of the library also exists in SDL's library installation");
1514 // ts.WriteLine(" # directory, typically /usr/lib.");
1515 // ts.WriteLine(" #");
1516 // ts.WriteLine(" SDL_LIBS=`echo $SDL_LIBS | sed 's/-Wl,-rpath,[[^ ]]* //'`");
1517 // ts.WriteLine("fi");
1518 // ts.WriteLine("AC_SUBST([SDL_CFLAGS])");
1519 // ts.WriteLine("AC_SUBST([SDL_LIBS])");
1520 ts.WriteLine();
1521 ts.WriteLine("AC_OUTPUT([");
1522 ts.WriteLine("Makefile");
1523 // TODO: this does not work quite right.
1524 //ts.WriteLine("Properties/AssemblyInfo.cs");
1525 foreach (ProjectNode project in solution.ProjectsTableOrder)
1526 {
1527 if (project.Type == ProjectType.Library)
1528 {
1529 ts.WriteLine(project.Name + ".pc");
1530 }
1531 // string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath);
1532 // ts.WriteLine(Helper.NormalizePath(Helper.MakeFilePath(path, "Include"),'/'));
1533 }
1534 ts.WriteLine("])");
1535 ts.WriteLine();
1536 ts.WriteLine("#po/Makefile.in");
1537 ts.WriteLine();
1538 ts.WriteLine("echo \"---\"");
1539 ts.WriteLine("echo \"Configuration summary\"");
1540 ts.WriteLine("echo \"\"");
1541 ts.WriteLine("echo \" * Installation prefix: $prefix\"");
1542 ts.WriteLine("echo \" * compiler: $CSC\"");
1543 ts.WriteLine("echo \" * Documentation: $enable_monodoc ($MONODOC)\"");
1544 ts.WriteLine("echo \" * Package Name: $PACKAGE_NAME\"");
1545 ts.WriteLine("echo \" * Version: $PACKAGE_VERSION\"");
1546 ts.WriteLine("echo \" * Public Key: $PUBKEY\"");
1547 ts.WriteLine("echo \"\"");
1548 ts.WriteLine("echo \"---\"");
1549 ts.WriteLine();
1550 }
1551
1552 ts.NewLine = "\n";
1553 foreach (ProjectNode project in solution.ProjectsTableOrder)
1554 {
1555 if (project.GenerateAssemblyInfoFile)
1556 {
1557 GenerateAssemblyInfoFile(solution, combFile);
1558 }
1559 }
1560 }
1561
1562 private static void GenerateAssemblyInfoFile(SolutionNode solution, string combFile)
1563 {
1564 System.IO.Directory.CreateDirectory(Helper.MakePathRelativeTo(solution.FullPath, "Properties"));
1565 combFile = Helper.MakeFilePath(solution.FullPath + "/Properties/", "AssemblyInfo.cs", "in");
1566 StreamWriter ai = new StreamWriter(combFile);
1567
1568 using (ai)
1569 {
1570 ai.WriteLine("#region License");
1571 ai.WriteLine("/*");
1572 ai.WriteLine("MIT License");
1573 ai.WriteLine("Copyright (c)2003-2006 Tao Framework Team");
1574 ai.WriteLine("http://www.taoframework.com");
1575 ai.WriteLine("All rights reserved.");
1576 ai.WriteLine("");
1577 ai.WriteLine("Permission is hereby granted, free of charge, to any person obtaining a copy");
1578 ai.WriteLine("of this software and associated documentation files (the \"Software\"), to deal");
1579 ai.WriteLine("in the Software without restriction, including without limitation the rights");
1580 ai.WriteLine("to use, copy, modify, merge, publish, distribute, sublicense, and/or sell");
1581 ai.WriteLine("copies of the Software, and to permit persons to whom the Software is");
1582 ai.WriteLine("furnished to do so, subject to the following conditions:");
1583 ai.WriteLine("");
1584 ai.WriteLine("The above copyright notice and this permission notice shall be included in all");
1585 ai.WriteLine("copies or substantial portions of the Software.");
1586 ai.WriteLine("");
1587 ai.WriteLine("THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR");
1588 ai.WriteLine("IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,");
1589 ai.WriteLine("FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE");
1590 ai.WriteLine("AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER");
1591 ai.WriteLine("LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,");
1592 ai.WriteLine("OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE");
1593 ai.WriteLine("SOFTWARE.");
1594 ai.WriteLine("*/");
1595 ai.WriteLine("#endregion License");
1596 ai.WriteLine("");
1597 ai.WriteLine("using System;");
1598 ai.WriteLine("using System.Reflection;");
1599 ai.WriteLine("using System.Runtime.InteropServices;");
1600 ai.WriteLine("using System.Security;");
1601 ai.WriteLine("using System.Security.Permissions;");
1602 ai.WriteLine("");
1603 ai.WriteLine("[assembly: AllowPartiallyTrustedCallers]");
1604 ai.WriteLine("[assembly: AssemblyCompany(\"Tao Framework -- http://www.taoframework.com\")]");
1605 ai.WriteLine("[assembly: AssemblyConfiguration(\"Retail\")]");
1606 ai.WriteLine("[assembly: AssemblyCopyright(\"Copyright (c)2003-2006 Tao Framework Team. All rights reserved.\")]");
1607 ai.WriteLine("[assembly: AssemblyCulture(\"\")]");
1608 ai.WriteLine("[assembly: AssemblyDefaultAlias(\"@PACKAGE_NAME@\")]");
1609 ai.WriteLine("[assembly: AssemblyDelaySign(false)]");
1610 ai.WriteLine("[assembly: AssemblyDescription(\"@DESCRIPTION@\")]");
1611 ai.WriteLine("[assembly: AssemblyFileVersion(\"@ASSEMBLY_VERSION@\")]");
1612 ai.WriteLine("[assembly: AssemblyInformationalVersion(\"@ASSEMBLY_VERSION@\")]");
1613 ai.WriteLine("[assembly: AssemblyKeyName(\"\")]");
1614 ai.WriteLine("[assembly: AssemblyProduct(\"@PACKAGE_NAME@.dll\")]");
1615 ai.WriteLine("[assembly: AssemblyTitle(\"@DESCRIPTION@\")]");
1616 ai.WriteLine("[assembly: AssemblyTrademark(\"Tao Framework -- http://www.taoframework.com\")]");
1617 ai.WriteLine("[assembly: AssemblyVersion(\"@ASSEMBLY_VERSION@\")]");
1618 ai.WriteLine("[assembly: CLSCompliant(true)]");
1619 ai.WriteLine("[assembly: ComVisible(false)]");
1620 ai.WriteLine("[assembly: SecurityPermission(SecurityAction.RequestMinimum, Flags = SecurityPermissionFlag.Execution)]");
1621 ai.WriteLine("[assembly: SecurityPermission(SecurityAction.RequestMinimum, Flags = SecurityPermissionFlag.SkipVerification)]");
1622 ai.WriteLine("[assembly: SecurityPermission(SecurityAction.RequestMinimum, Flags = SecurityPermissionFlag.UnmanagedCode)]");
1623
1624 }
1625 //return combFile;
1626 }
1627
1628 private void CleanProject(ProjectNode project) 917 private void CleanProject(ProjectNode project)
1629 { 918 {
1630 m_Kernel.Log.Write("...Cleaning project: {0}", project.Name); 919 m_Kernel.Log.Write("...Cleaning project: {0}", project.Name);
@@ -1677,7 +966,7 @@ namespace Prebuild.Core.Targets
1677 m_Kernel.Log.Write("Parsing system pkg-config files"); 966 m_Kernel.Log.Write("Parsing system pkg-config files");
1678 RunInitialization(); 967 RunInitialization();
1679 968
1680 string streamName = "autotools.xml"; 969 const string streamName = "autotools.xml";
1681 string fqStreamName = String.Format("Prebuild.data.{0}", 970 string fqStreamName = String.Format("Prebuild.data.{0}",
1682 streamName 971 streamName
1683 ); 972 );
@@ -1727,10 +1016,9 @@ namespace Prebuild.Core.Targets
1727 1016
1728 string pwd = Directory.GetCurrentDirectory(); 1017 string pwd = Directory.GetCurrentDirectory();
1729 //string pwd = System.Environment.GetEnvironmentVariable("PWD"); 1018 //string pwd = System.Environment.GetEnvironmentVariable("PWD");
1730 string rootDir = "";
1731 //if (pwd.Length != 0) 1019 //if (pwd.Length != 0)
1732 //{ 1020 //{
1733 rootDir = Path.Combine(pwd, "autotools"); 1021 string rootDir = Path.Combine(pwd, "autotools");
1734 //} 1022 //}
1735 //else 1023 //else
1736 //{ 1024 //{
diff --git a/Prebuild/src/Core/Targets/DebugTarget.cs b/Prebuild/src/Core/Targets/DebugTarget.cs
index dc4e666..650007e 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 08:42:51 +0100 (Wed, 20 Sep 2006) $
31 * $Revision: 164 $ 31 * $Revision: 164 $
32 */ 32 */
33#endregion 33#endregion
diff --git a/Prebuild/src/Core/Targets/MakefileTarget.cs b/Prebuild/src/Core/Targets/MakefileTarget.cs
index 86676d0..54046dd 100644
--- a/Prebuild/src/Core/Targets/MakefileTarget.cs
+++ b/Prebuild/src/Core/Targets/MakefileTarget.cs
@@ -24,8 +24,6 @@ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY O
24#endregion 24#endregion
25 25
26using System; 26using System;
27using System.Collections;
28using System.Collections.Specialized;
29using System.IO; 27using System.IO;
30using System.Text.RegularExpressions; 28using System.Text.RegularExpressions;
31 29
@@ -110,7 +108,7 @@ namespace Prebuild.Core.Targets
110 { 108 {
111 string path; 109 string path;
112 // Project references change with configurations. 110 // Project references change with configurations.
113 if (solution.ProjectsTable.Contains(refr.Name)) 111 if (solution.ProjectsTable.ContainsKey(refr.Name))
114 continue; 112 continue;
115 path = FindFileReference(refr.Name, project); 113 path = FindFileReference(refr.Name, project);
116 if (path != null) 114 if (path != null)
@@ -220,7 +218,7 @@ namespace Prebuild.Core.Targets
220 } 218 }
221 // Dependencies on other projects. 219 // Dependencies on other projects.
222 foreach (ReferenceNode refr in project.References) 220 foreach (ReferenceNode refr in project.References)
223 if (solution.ProjectsTable.Contains(refr.Name)) 221 if (solution.ProjectsTable.ContainsKey(refr.Name))
224 { 222 {
225 ProjectNode refProj = (ProjectNode)solution.ProjectsTable[refr.Name]; 223 ProjectNode refProj = (ProjectNode)solution.ProjectsTable[refr.Name];
226 if (ProjectClashes(refProj)) 224 if (ProjectClashes(refProj))
@@ -256,7 +254,7 @@ namespace Prebuild.Core.Targets
256 // Build references to other projects. Now that sux. 254 // Build references to other projects. Now that sux.
257 // We have to reference the other project in the same conf. 255 // We have to reference the other project in the same conf.
258 foreach (ReferenceNode refr in project.References) 256 foreach (ReferenceNode refr in project.References)
259 if (solution.ProjectsTable.Contains(refr.Name)) 257 if (solution.ProjectsTable.ContainsKey(refr.Name))
260 { 258 {
261 ProjectNode refProj; 259 ProjectNode refProj;
262 refProj = (ProjectNode)solution.ProjectsTable[refr.Name]; 260 refProj = (ProjectNode)solution.ProjectsTable[refr.Name];
@@ -274,7 +272,7 @@ namespace Prebuild.Core.Targets
274 { 272 {
275 string outPath, srcPath, destPath; 273 string outPath, srcPath, destPath;
276 outPath = Helper.NormalizePath((string)conf.Options["OutputPath"]); 274 outPath = Helper.NormalizePath((string)conf.Options["OutputPath"]);
277 if (solution.ProjectsTable.Contains(refr.Name)) 275 if (solution.ProjectsTable.ContainsKey(refr.Name))
278 { 276 {
279 ProjectNode refProj; 277 ProjectNode refProj;
280 refProj = (ProjectNode)solution.ProjectsTable[refr.Name]; 278 refProj = (ProjectNode)solution.ProjectsTable[refr.Name];
diff --git a/Prebuild/src/Core/Targets/MonoDevelopTarget.cs b/Prebuild/src/Core/Targets/MonoDevelopTarget.cs
index c8401fd..ea6d2c2 100644
--- a/Prebuild/src/Core/Targets/MonoDevelopTarget.cs
+++ b/Prebuild/src/Core/Targets/MonoDevelopTarget.cs
@@ -24,8 +24,6 @@ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY O
24#endregion 24#endregion
25 25
26using System; 26using System;
27using System.Collections;
28using System.Collections.Specialized;
29using System.IO; 27using System.IO;
30using System.Reflection; 28using System.Reflection;
31using System.Text.RegularExpressions; 29using System.Text.RegularExpressions;
@@ -274,7 +272,11 @@ namespace Prebuild.Core.Targets
274 ss.WriteLine(" <Contents>"); 272 ss.WriteLine(" <Contents>");
275 foreach(string file in project.Files) 273 foreach(string file in project.Files)
276 { 274 {
277 string buildAction = "Compile"; 275 string buildAction;
276 string dependson = "";
277 string resource_id = "";
278 string copyToOutput = "";
279
278 switch(project.Files.GetBuildAction(file)) 280 switch(project.Files.GetBuildAction(file))
279 { 281 {
280 case BuildAction.None: 282 case BuildAction.None:
@@ -294,9 +296,58 @@ namespace Prebuild.Core.Targets
294 break; 296 break;
295 } 297 }
296 298
299 if (project.Files.GetCopyToOutput(file) != CopyToOutput.Never)
300 buildAction = "FileCopy";
301
297 // Sort of a hack, we try and resolve the path and make it relative, if we can. 302 // Sort of a hack, we try and resolve the path and make it relative, if we can.
298 string filePath = PrependPath(file); 303 string extension = Path.GetExtension(file);
299 ss.WriteLine(" <File name=\"{0}\" subtype=\"Code\" buildaction=\"{1}\" dependson=\"\" data=\"\" />", filePath, buildAction); 304 string designer_format = string.Format(".Designer{0}", extension);
305
306 if (file.EndsWith(designer_format))
307 {
308 string basename = file.Substring(0, file.LastIndexOf(designer_format));
309 string[] extensions = new string[] { ".cs", ".resx", ".settings" };
310
311 foreach(string ext in extensions)
312 {
313 if (project.Files.Contains(basename + ext))
314 {
315 dependson = string.Format(" dependson=\"{0}{1}\"", basename, ext);
316 break;
317 }
318 }
319 }
320 if (extension == ".resx")
321 {
322 buildAction = "EmbedAsResource";
323 string basename = file.Substring(0, file.LastIndexOf(".resx"));
324
325 // Visual Studio type resx + form dependency
326 if (project.Files.Contains(basename + ".cs"))
327 {
328 dependson = string.Format(" dependson=\"{0}{1}\"", basename, ".cs");
329 }
330
331 // We need to specify a resources file name to avoid MissingManifestResourceExceptions
332 // in libraries that are built.
333 resource_id = string.Format(" resource_id=\"{0}.{1}.resources\"",
334 project.AssemblyName, basename.Replace("/", "."));
335 }
336
337 switch(project.Files.GetCopyToOutput(file))
338 {
339 case CopyToOutput.Always:
340 copyToOutput = string.Format(" copyToOutputDirectory=\"Always\"");
341 break;
342 case CopyToOutput.PreserveNewest:
343 copyToOutput = string.Format(" copyToOutputDirectory=\"PreserveNewest\"");
344 break;
345 }
346
347 // Sort of a hack, we try and resolve the path and make it relative, if we can.
348 string filePath = PrependPath(file);
349 ss.WriteLine(" <File name=\"{0}\" subtype=\"Code\" buildaction=\"{1}\"{2}{3}{4} />",
350 filePath, buildAction, dependson, resource_id, copyToOutput);
300 } 351 }
301 ss.WriteLine(" </Contents>"); 352 ss.WriteLine(" </Contents>");
302 353
diff --git a/Prebuild/src/Core/Targets/NAntTarget.cs b/Prebuild/src/Core/Targets/NAntTarget.cs
index 9a6ee17..d4a33f8 100644
--- a/Prebuild/src/Core/Targets/NAntTarget.cs
+++ b/Prebuild/src/Core/Targets/NAntTarget.cs
@@ -36,10 +36,8 @@ POSSIBILITY OF SUCH DAMAGE.
36#endregion 36#endregion
37 37
38using System; 38using System;
39using System.Collections; 39using System.Collections.Generic;
40using System.Collections.Specialized;
41using System.IO; 40using System.IO;
42using System.Reflection;
43using System.Text.RegularExpressions; 41using System.Text.RegularExpressions;
44 42
45using Prebuild.Core.Attributes; 43using Prebuild.Core.Attributes;
@@ -255,9 +253,12 @@ namespace Prebuild.Core.Targets
255 ss.WriteLine(" {0}", "</fileset>"); 253 ss.WriteLine(" {0}", "</fileset>");
256 ss.WriteLine(" {0}", "</copy>"); 254 ss.WriteLine(" {0}", "</copy>");
257 255
258 ss.Write(" <csc"); 256 ss.Write(" <csc ");
259 ss.Write(" target=\"{0}\"", project.Type.ToString().ToLower()); 257 ss.Write(" target=\"{0}\"", project.Type.ToString().ToLower());
260 ss.Write(" debug=\"{0}\"", "${build.debug}"); 258 ss.Write(" debug=\"{0}\"", "${build.debug}");
259 ss.Write(" platform=\"${build.platform}\"");
260
261
261 foreach (ConfigurationNode conf in project.Configurations) 262 foreach (ConfigurationNode conf in project.Configurations)
262 { 263 {
263 if (conf.Options.KeyFile != "") 264 if (conf.Options.KeyFile != "")
@@ -311,7 +312,12 @@ namespace Prebuild.Core.Targets
311 { 312 {
312 ss.Write(" win32icon=\"{0}\"", Helper.NormalizePath(project.AppIcon, '/')); 313 ss.Write(" win32icon=\"{0}\"", Helper.NormalizePath(project.AppIcon, '/'));
313 } 314 }
314 ss.WriteLine(">"); 315 // This disables a very different behavior between VS and NAnt. With Nant,
316 // If you have using System.Xml; it will ensure System.Xml.dll is referenced,
317 // but not in VS. This will force the behaviors to match, so when it works
318 // in nant, it will work in VS.
319 ss.Write(" noconfig=\"true\"");
320 ss.WriteLine(">");
315 ss.WriteLine(" <resources prefix=\"{0}\" dynamicprefix=\"true\" >", project.RootNamespace); 321 ss.WriteLine(" <resources prefix=\"{0}\" dynamicprefix=\"true\" >", project.RootNamespace);
316 foreach (string file in project.Files) 322 foreach (string file in project.Files)
317 { 323 {
@@ -357,7 +363,20 @@ namespace Prebuild.Core.Targets
357 foreach (ReferenceNode refr in project.References) 363 foreach (ReferenceNode refr in project.References)
358 { 364 {
359 string path = Helper.NormalizePath(Helper.MakePathRelativeTo(project.FullPath, BuildReference(solution, project, refr)), '/'); 365 string path = Helper.NormalizePath(Helper.MakePathRelativeTo(project.FullPath, BuildReference(solution, project, refr)), '/');
360 ss.WriteLine(" <include name=\"" + path + "\" />"); 366 if (refr.Path != null) {
367 if (ExtensionSpecified(refr.Name))
368 {
369 ss.WriteLine (" <include name=\"" + path + refr.Name + "\"/>");
370 }
371 else
372 {
373 ss.WriteLine (" <include name=\"" + path + refr.Name + ".dll\"/>");
374 }
375 }
376 else
377 {
378 ss.WriteLine (" <include name=\"" + path + "\" />");
379 }
361 } 380 }
362 ss.WriteLine(" </references>"); 381 ss.WriteLine(" </references>");
363 382
@@ -490,15 +509,32 @@ namespace Prebuild.Core.Targets
490 ss.WriteLine(" <property name=\"doc.dir\" value=\"doc\" />"); 509 ss.WriteLine(" <property name=\"doc.dir\" value=\"doc\" />");
491 ss.WriteLine(" <property name=\"project.main.dir\" value=\"${project::get-base-directory()}\" />"); 510 ss.WriteLine(" <property name=\"project.main.dir\" value=\"${project::get-base-directory()}\" />");
492 511
493 // actually use active config out of prebuild.xml 512 // Use the active configuration, which is the first configuration name in the prebuild file.
494 ss.WriteLine(" <property name=\"project.config\" value=\"{0}\" />", solution.ActiveConfig); 513 Dictionary<string,string> emittedConfigurations = new Dictionary<string, string>();
514
515 ss.WriteLine(" <property name=\"project.config\" value=\"{0}\" />", solution.ActiveConfig);
516 ss.WriteLine();
495 517
496 foreach (ConfigurationNode conf in solution.Configurations) 518 foreach (ConfigurationNode conf in solution.Configurations)
497 { 519 {
498 ss.WriteLine(); 520 // If the name isn't in the emitted configurations, we give a high level target to the
499 ss.WriteLine(" <target name=\"{0}\" description=\"\">", conf.Name); 521 // platform specific on. This lets "Debug" point to "Debug-AnyCPU".
522 if (!emittedConfigurations.ContainsKey(conf.Name))
523 {
524 // Add it to the dictionary so we only emit one.
525 emittedConfigurations.Add(conf.Name, conf.Platform);
526
527 // Write out the target block.
528 ss.WriteLine(" <target name=\"{0}\" description=\"{0}|{1}\" depends=\"{0}-{1}\">", conf.Name, conf.Platform);
529 ss.WriteLine(" </target>");
530 ss.WriteLine();
531 }
532
533 // Write out the target for the configuration.
534 ss.WriteLine(" <target name=\"{0}-{1}\" description=\"{0}|{1}\">", conf.Name, conf.Platform);
500 ss.WriteLine(" <property name=\"project.config\" value=\"{0}\" />", conf.Name); 535 ss.WriteLine(" <property name=\"project.config\" value=\"{0}\" />", conf.Name);
501 ss.WriteLine(" <property name=\"build.debug\" value=\"{0}\" />", conf.Options["DebugInformation"].ToString().ToLower()); 536 ss.WriteLine(" <property name=\"build.debug\" value=\"{0}\" />", conf.Options["DebugInformation"].ToString().ToLower());
537 ss.WriteLine("\t\t <property name=\"build.platform\" value=\"{0}\" />", conf.Platform);
502 ss.WriteLine(" </target>"); 538 ss.WriteLine(" </target>");
503 ss.WriteLine(); 539 ss.WriteLine();
504 } 540 }
@@ -559,19 +595,19 @@ namespace Prebuild.Core.Targets
559 if (item is DirectoryInfo) { } 595 if (item is DirectoryInfo) { }
560 else if (item is FileInfo) 596 else if (item is FileInfo)
561 { 597 {
562 if (re.Match(((FileInfo)item).FullName) != 598 if (re.Match(item.FullName) !=
563 System.Text.RegularExpressions.Match.Empty) 599 System.Text.RegularExpressions.Match.Empty)
564 { 600 {
565 Console.WriteLine("Including file: " + ((FileInfo)item).FullName); 601 Console.WriteLine("Including file: " + item.FullName);
566 602
567 using (FileStream fs = new FileStream(((FileInfo)item).FullName, 603 using (FileStream fs = new FileStream(item.FullName,
568 FileMode.Open, 604 FileMode.Open,
569 FileAccess.Read, 605 FileAccess.Read,
570 FileShare.None)) 606 FileShare.None))
571 { 607 {
572 using (StreamReader sr = new StreamReader(fs)) 608 using (StreamReader sr = new StreamReader(fs))
573 { 609 {
574 ss.WriteLine("<!-- included from {0} -->", ((FileInfo)item).FullName); 610 ss.WriteLine("<!-- included from {0} -->", (item).FullName);
575 while (sr.Peek() != -1) 611 while (sr.Peek() != -1)
576 { 612 {
577 ss.WriteLine(sr.ReadLine()); 613 ss.WriteLine(sr.ReadLine());
@@ -601,6 +637,10 @@ namespace Prebuild.Core.Targets
601 ss.WriteLine(" <target name=\"clean\" description=\"\">"); 637 ss.WriteLine(" <target name=\"clean\" description=\"\">");
602 ss.WriteLine(" <echo message=\"Deleting all builds from all configurations\" />"); 638 ss.WriteLine(" <echo message=\"Deleting all builds from all configurations\" />");
603 //ss.WriteLine(" <delete dir=\"${dist.dir}\" failonerror=\"false\" />"); 639 //ss.WriteLine(" <delete dir=\"${dist.dir}\" failonerror=\"false\" />");
640
641 // justincc: FIXME FIXME FIXME - A temporary OpenSim hack to clean up files when "nant clean" is executed.
642 // Should be replaced with extreme prejudice once anybody finds out if the CleanFiles stuff works or there is
643 // another working mechanism for specifying this stuff
604 ss.WriteLine(" <delete failonerror=\"false\">"); 644 ss.WriteLine(" <delete failonerror=\"false\">");
605 ss.WriteLine(" <fileset basedir=\"${bin.dir}\">"); 645 ss.WriteLine(" <fileset basedir=\"${bin.dir}\">");
606 ss.WriteLine(" <include name=\"OpenSim*.dll\"/>"); 646 ss.WriteLine(" <include name=\"OpenSim*.dll\"/>");
@@ -611,7 +651,21 @@ namespace Prebuild.Core.Targets
611 ss.WriteLine(" <exclude name=\"ScriptEngines/Default.lsl\"/>"); 651 ss.WriteLine(" <exclude name=\"ScriptEngines/Default.lsl\"/>");
612 ss.WriteLine(" </fileset>"); 652 ss.WriteLine(" </fileset>");
613 ss.WriteLine(" </delete>"); 653 ss.WriteLine(" </delete>");
614 ss.WriteLine(" <delete dir=\"${obj.dir}\" failonerror=\"false\" />"); 654
655 if (solution.Cleanup != null && solution.Cleanup.CleanFiles.Count > 0)
656 {
657 foreach (CleanFilesNode cleanFile in solution.Cleanup.CleanFiles)
658 {
659 ss.WriteLine(" <delete failonerror=\"false\">");
660 ss.WriteLine(" <fileset basedir=\"${project::get-base-directory()}\">");
661 ss.WriteLine(" <include name=\"{0}/*\"/>", cleanFile.Pattern);
662 ss.WriteLine(" <include name=\"{0}\"/>", cleanFile.Pattern);
663 ss.WriteLine(" </fileset>");
664 ss.WriteLine(" </delete>");
665 }
666 }
667
668 ss.WriteLine(" <delete dir=\"${obj.dir}\" failonerror=\"false\" />");
615 foreach (ProjectNode project in solution.Projects) 669 foreach (ProjectNode project in solution.Projects)
616 { 670 {
617 string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath); 671 string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath);
diff --git a/Prebuild/src/Core/Targets/SharpDevelopTarget.cs b/Prebuild/src/Core/Targets/SharpDevelopTarget.cs
index cf7ce02..8e32050 100644
--- a/Prebuild/src/Core/Targets/SharpDevelopTarget.cs
+++ b/Prebuild/src/Core/Targets/SharpDevelopTarget.cs
@@ -24,11 +24,8 @@ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY O
24#endregion 24#endregion
25 25
26using System; 26using System;
27using System.Collections;
28using System.Collections.Specialized;
29using System.IO; 27using System.IO;
30using System.Text.RegularExpressions; 28using System.Text.RegularExpressions;
31using System.Reflection;
32 29
33using Prebuild.Core.Attributes; 30using Prebuild.Core.Attributes;
34using Prebuild.Core.Interfaces; 31using Prebuild.Core.Interfaces;
diff --git a/Prebuild/src/Core/Targets/VS2003Target.cs b/Prebuild/src/Core/Targets/VS2003Target.cs
index 1bcb7dc..10e2dc4 100644
--- a/Prebuild/src/Core/Targets/VS2003Target.cs
+++ b/Prebuild/src/Core/Targets/VS2003Target.cs
@@ -24,8 +24,7 @@ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY O
24#endregion 24#endregion
25 25
26using System; 26using System;
27using System.Collections; 27using System.Collections.Generic;
28using System.Collections.Specialized;
29using System.IO; 28using System.IO;
30 29
31using Prebuild.Core.Attributes; 30using Prebuild.Core.Attributes;
@@ -47,7 +46,7 @@ namespace Prebuild.Core.Targets
47 string versionName = "2003"; 46 string versionName = "2003";
48 VSVersion version = VSVersion.VS71; 47 VSVersion version = VSVersion.VS71;
49 48
50 Hashtable m_Tools; 49 readonly Dictionary<string, ToolInfo> m_Tools = new Dictionary<string, ToolInfo>();
51 Kernel m_Kernel; 50 Kernel m_Kernel;
52 51
53 /// <summary> 52 /// <summary>
@@ -58,11 +57,11 @@ namespace Prebuild.Core.Targets
58 { 57 {
59 get 58 get
60 { 59 {
61 return this.solutionVersion; 60 return solutionVersion;
62 } 61 }
63 set 62 set
64 { 63 {
65 this.solutionVersion = value; 64 solutionVersion = value;
66 } 65 }
67 } 66 }
68 /// <summary> 67 /// <summary>
@@ -73,11 +72,11 @@ namespace Prebuild.Core.Targets
73 { 72 {
74 get 73 get
75 { 74 {
76 return this.productVersion; 75 return productVersion;
77 } 76 }
78 set 77 set
79 { 78 {
80 this.productVersion = value; 79 productVersion = value;
81 } 80 }
82 } 81 }
83 /// <summary> 82 /// <summary>
@@ -88,11 +87,11 @@ namespace Prebuild.Core.Targets
88 { 87 {
89 get 88 get
90 { 89 {
91 return this.schemaVersion; 90 return schemaVersion;
92 } 91 }
93 set 92 set
94 { 93 {
95 this.schemaVersion = value; 94 schemaVersion = value;
96 } 95 }
97 } 96 }
98 /// <summary> 97 /// <summary>
@@ -103,11 +102,11 @@ namespace Prebuild.Core.Targets
103 { 102 {
104 get 103 get
105 { 104 {
106 return this.versionName; 105 return versionName;
107 } 106 }
108 set 107 set
109 { 108 {
110 this.versionName = value; 109 versionName = value;
111 } 110 }
112 } 111 }
113 /// <summary> 112 /// <summary>
@@ -118,11 +117,11 @@ namespace Prebuild.Core.Targets
118 { 117 {
119 get 118 get
120 { 119 {
121 return this.version; 120 return version;
122 } 121 }
123 set 122 set
124 { 123 {
125 this.version = value; 124 version = value;
126 } 125 }
127 } 126 }
128 127
@@ -135,8 +134,6 @@ namespace Prebuild.Core.Targets
135 /// </summary> 134 /// </summary>
136 public VS2003Target() 135 public VS2003Target()
137 { 136 {
138 m_Tools = new Hashtable();
139
140 m_Tools["C#"] = new ToolInfo("C#", "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}", "csproj", "CSHARP"); 137 m_Tools["C#"] = new ToolInfo("C#", "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}", "csproj", "CSHARP");
141 m_Tools["VB.NET"] = new ToolInfo("VB.NET", "{F184B08F-C81C-45F6-A57F-5ABD9991F28F}", "vbproj", "VisualBasic"); 138 m_Tools["VB.NET"] = new ToolInfo("VB.NET", "{F184B08F-C81C-45F6-A57F-5ABD9991F28F}", "vbproj", "VisualBasic");
142 } 139 }
@@ -178,23 +175,20 @@ namespace Prebuild.Core.Targets
178 throw new UnknownLanguageException("Unknown .NET language: " + project.Language); 175 throw new UnknownLanguageException("Unknown .NET language: " + project.Language);
179 } 176 }
180 177
181 ToolInfo toolInfo = (ToolInfo)m_Tools[project.Language]; 178 ToolInfo toolInfo = m_Tools[project.Language];
182 string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, toolInfo.FileExtension); 179 string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, toolInfo.FileExtension);
183 StreamWriter ps = new StreamWriter(projectFile); 180 StreamWriter ps = new StreamWriter(projectFile);
184 181
185 m_Kernel.CurrentWorkingDirectory.Push(); 182 m_Kernel.CurrentWorkingDirectory.Push();
186 Helper.SetCurrentDir(Path.GetDirectoryName(projectFile)); 183 Helper.SetCurrentDir(Path.GetDirectoryName(projectFile));
187 184
188 IEnumerator enumerator;
189 //ConfigurationNode scripts;
190
191 using(ps) 185 using(ps)
192 { 186 {
193 ps.WriteLine("<VisualStudioProject>"); 187 ps.WriteLine("<VisualStudioProject>");
194 ps.WriteLine(" <{0}", toolInfo.XmlTag); 188 ps.WriteLine(" <{0}", toolInfo.XmlTag);
195 ps.WriteLine("\t\t\t\tProjectType = \"Local\""); 189 ps.WriteLine("\t\t\t\tProjectType = \"Local\"");
196 ps.WriteLine("\t\t\t\tProductVersion = \"{0}\"", this.ProductVersion); 190 ps.WriteLine("\t\t\t\tProductVersion = \"{0}\"", ProductVersion);
197 ps.WriteLine("\t\t\t\tSchemaVersion = \"{0}\"", this.SchemaVersion); 191 ps.WriteLine("\t\t\t\tSchemaVersion = \"{0}\"", SchemaVersion);
198 ps.WriteLine("\t\t\t\tProjectGuid = \"{{{0}}}\"", project.Guid.ToString().ToUpper()); 192 ps.WriteLine("\t\t\t\tProjectGuid = \"{{{0}}}\"", project.Guid.ToString().ToUpper());
199 ps.WriteLine("\t\t>"); 193 ps.WriteLine("\t\t>");
200 194
@@ -209,16 +203,13 @@ namespace Prebuild.Core.Targets
209 ps.WriteLine("\t\t\t\t DefaultTargetSchema = \"IE50\""); 203 ps.WriteLine("\t\t\t\t DefaultTargetSchema = \"IE50\"");
210 ps.WriteLine("\t\t\t\t DelaySign = \"false\""); 204 ps.WriteLine("\t\t\t\t DelaySign = \"false\"");
211 205
212 if(this.Version == VSVersion.VS70) 206 if(Version == VSVersion.VS70)
213 { 207 {
214 ps.WriteLine("\t\t\t\t NoStandardLibraries = \"false\""); 208 ps.WriteLine("\t\t\t\t NoStandardLibraries = \"false\"");
215 } 209 }
216 210
217 ps.WriteLine("\t\t\t\t OutputType = \"{0}\"", project.Type.ToString()); 211 ps.WriteLine("\t\t\t\t OutputType = \"{0}\"", project.Type);
218 212
219 enumerator = project.Configurations.GetEnumerator();
220 enumerator.Reset();
221 enumerator.MoveNext();
222 foreach(ConfigurationNode conf in project.Configurations) 213 foreach(ConfigurationNode conf in project.Configurations)
223 { 214 {
224 if (conf.Options["PreBuildEvent"] != null && conf.Options["PreBuildEvent"].ToString().Length != 0) 215 if (conf.Options["PreBuildEvent"] != null && conf.Options["PreBuildEvent"].ToString().Length != 0)
@@ -266,7 +257,7 @@ namespace Prebuild.Core.Targets
266 ps.WriteLine("\t\t\t\t FileAlignment = \"{0}\"", conf.Options["FileAlignment"]); 257 ps.WriteLine("\t\t\t\t FileAlignment = \"{0}\"", conf.Options["FileAlignment"]);
267 ps.WriteLine("\t\t\t\t IncrementalBuild = \"{0}\"", conf.Options["IncrementalBuild"].ToString().ToLower()); 258 ps.WriteLine("\t\t\t\t IncrementalBuild = \"{0}\"", conf.Options["IncrementalBuild"].ToString().ToLower());
268 259
269 if(this.Version == VSVersion.VS71) 260 if(Version == VSVersion.VS71)
270 { 261 {
271 ps.WriteLine("\t\t\t\t NoStdLib = \"{0}\"", conf.Options["NoStdLib"].ToString().ToLower()); 262 ps.WriteLine("\t\t\t\t NoStdLib = \"{0}\"", conf.Options["NoStdLib"].ToString().ToLower());
272 ps.WriteLine("\t\t\t\t NoWarn = \"{0}\"", conf.Options["SuppressWarnings"].ToString().ToLower()); 263 ps.WriteLine("\t\t\t\t NoWarn = \"{0}\"", conf.Options["SuppressWarnings"].ToString().ToLower());
@@ -293,9 +284,9 @@ namespace Prebuild.Core.Targets
293 284
294 if(solution.ProjectsTable.ContainsKey(refr.Name)) 285 if(solution.ProjectsTable.ContainsKey(refr.Name))
295 { 286 {
296 ProjectNode refProject = (ProjectNode)solution.ProjectsTable[refr.Name]; 287 ProjectNode refProject = solution.ProjectsTable[refr.Name];
297 ps.WriteLine(" Project = \"{{{0}}}\"", refProject.Guid.ToString().ToUpper()); 288 ps.WriteLine(" Project = \"{{{0}}}\"", refProject.Guid.ToString().ToUpper());
298 ps.WriteLine(" Package = \"{0}\"", toolInfo.Guid.ToString().ToUpper()); 289 ps.WriteLine(" Package = \"{0}\"", toolInfo.Guid.ToUpper());
299 } 290 }
300 else 291 else
301 { 292 {
@@ -409,7 +400,7 @@ namespace Prebuild.Core.Targets
409 400
410 private void WriteSolution(SolutionNode solution) 401 private void WriteSolution(SolutionNode solution)
411 { 402 {
412 m_Kernel.Log.Write("Creating Visual Studio {0} solution and project files", this.VersionName); 403 m_Kernel.Log.Write("Creating Visual Studio {0} solution and project files", VersionName);
413 404
414 foreach(ProjectNode project in solution.Projects) 405 foreach(ProjectNode project in solution.Projects)
415 { 406 {
@@ -429,7 +420,7 @@ namespace Prebuild.Core.Targets
429 420
430 using(ss) 421 using(ss)
431 { 422 {
432 ss.WriteLine("Microsoft Visual Studio Solution File, Format Version {0}", this.SolutionVersion); 423 ss.WriteLine("Microsoft Visual Studio Solution File, Format Version {0}", SolutionVersion);
433 foreach(ProjectNode project in solution.Projects) 424 foreach(ProjectNode project in solution.Projects)
434 { 425 {
435 if(!m_Tools.ContainsKey(project.Language)) 426 if(!m_Tools.ContainsKey(project.Language))
@@ -437,7 +428,7 @@ namespace Prebuild.Core.Targets
437 throw new UnknownLanguageException("Unknown .NET language: " + project.Language); 428 throw new UnknownLanguageException("Unknown .NET language: " + project.Language);
438 } 429 }
439 430
440 ToolInfo toolInfo = (ToolInfo)m_Tools[project.Language]; 431 ToolInfo toolInfo = m_Tools[project.Language];
441 432
442 string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath); 433 string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath);
443 ss.WriteLine("Project(\"{0}\") = \"{1}\", \"{2}\", \"{{{3}}}\"", 434 ss.WriteLine("Project(\"{0}\") = \"{1}\", \"{2}\", \"{{{3}}}\"",
@@ -464,10 +455,10 @@ namespace Prebuild.Core.Targets
464 { 455 {
465 for(int i = 0; i < project.References.Count; i++) 456 for(int i = 0; i < project.References.Count; i++)
466 { 457 {
467 ReferenceNode refr = (ReferenceNode)project.References[i]; 458 ReferenceNode refr = project.References[i];
468 if(solution.ProjectsTable.ContainsKey(refr.Name)) 459 if(solution.ProjectsTable.ContainsKey(refr.Name))
469 { 460 {
470 ProjectNode refProject = (ProjectNode)solution.ProjectsTable[refr.Name]; 461 ProjectNode refProject = solution.ProjectsTable[refr.Name];
471 ss.WriteLine("\t\t({{{0}}}).{1} = ({{{2}}})", 462 ss.WriteLine("\t\t({{{0}}}).{1} = ({{{2}}})",
472 project.Guid.ToString().ToUpper() 463 project.Guid.ToString().ToUpper()
473 , i, 464 , i,
@@ -519,7 +510,7 @@ namespace Prebuild.Core.Targets
519 { 510 {
520 m_Kernel.Log.Write("...Cleaning project: {0}", project.Name); 511 m_Kernel.Log.Write("...Cleaning project: {0}", project.Name);
521 512
522 ToolInfo toolInfo = (ToolInfo)m_Tools[project.Language]; 513 ToolInfo toolInfo = m_Tools[project.Language];
523 string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, toolInfo.FileExtension); 514 string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, toolInfo.FileExtension);
524 string userFile = projectFile + ".user"; 515 string userFile = projectFile + ".user";
525 516
@@ -529,7 +520,7 @@ namespace Prebuild.Core.Targets
529 520
530 private void CleanSolution(SolutionNode solution) 521 private void CleanSolution(SolutionNode solution)
531 { 522 {
532 m_Kernel.Log.Write("Cleaning Visual Studio {0} solution and project files", this.VersionName, solution.Name); 523 m_Kernel.Log.Write("Cleaning Visual Studio {0} solution and project files", VersionName, solution.Name);
533 524
534 string slnFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "sln"); 525 string slnFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "sln");
535 string suoFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "suo"); 526 string suoFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "suo");
diff --git a/Prebuild/src/Core/Targets/VS2005Target.cs b/Prebuild/src/Core/Targets/VS2005Target.cs
index 63461c9..9c70e26 100644
--- a/Prebuild/src/Core/Targets/VS2005Target.cs
+++ b/Prebuild/src/Core/Targets/VS2005Target.cs
@@ -24,8 +24,6 @@ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY O
24#endregion 24#endregion
25 25
26using System; 26using System;
27using System.Collections;
28using System.Collections.Specialized;
29using System.IO; 27using System.IO;
30using System.Text; 28using System.Text;
31 29
diff --git a/Prebuild/src/Core/Targets/VS2008Target.cs b/Prebuild/src/Core/Targets/VS2008Target.cs
index e685962..fee4f7f 100644
--- a/Prebuild/src/Core/Targets/VS2008Target.cs
+++ b/Prebuild/src/Core/Targets/VS2008Target.cs
@@ -1,6 +1,4 @@
1using System; 1using System;
2using System.Collections;
3using System.Collections.Specialized;
4using System.IO; 2using System.IO;
5using System.Text; 3using System.Text;
6 4
@@ -27,9 +25,6 @@ namespace Prebuild.Core.Targets
27 string name = "vs2008"; 25 string name = "vs2008";
28 VSVersion version = VSVersion.VS90; 26 VSVersion version = VSVersion.VS90;
29 27
30 Hashtable tools;
31 Kernel kernel;
32
33 /// <summary> 28 /// <summary>
34 /// Gets or sets the solution version. 29 /// Gets or sets the solution version.
35 /// </summary> 30 /// </summary>
@@ -120,7 +115,7 @@ namespace Prebuild.Core.Targets
120 #region Constructors 115 #region Constructors
121 116
122 /// <summary> 117 /// <summary>
123 /// Initializes a new instance of the <see cref="VS2008Target"/> class. 118 /// Initializes a new instance of the <see cref="VS2005Target"/> class.
124 /// </summary> 119 /// </summary>
125 public VS2008Target() 120 public VS2008Target()
126 : base() 121 : base()
diff --git a/Prebuild/src/Core/Targets/VS2010Target.cs b/Prebuild/src/Core/Targets/VS2010Target.cs
index 8772d18..b16120c 100644
--- a/Prebuild/src/Core/Targets/VS2010Target.cs
+++ b/Prebuild/src/Core/Targets/VS2010Target.cs
@@ -1,6 +1,4 @@
1using System; 1using System;
2using System.Collections;
3using System.Collections.Specialized;
4using System.IO; 2using System.IO;
5using System.Text; 3using System.Text;
6 4
@@ -13,98 +11,104 @@ using System.CodeDom.Compiler;
13namespace Prebuild.Core.Targets 11namespace Prebuild.Core.Targets
14{ 12{
15 13
16 /// <summary> 14 /// <summary>
17 /// 15 ///
18 /// </summary> 16 /// </summary>
19 [Target("vs2010")] 17 [Target("vs2010")]
20 public class VS2010Target : VSGenericTarget 18 public class VS2010Target : VSGenericTarget
21 { 19 {
22 #region Fields 20 #region Fields
23 string solutionVersion = "11.00"; 21
24 string productVersion = "9.0.21022"; 22 string solutionVersion = "11.00";
25 string schemaVersion = "2.0"; 23 string productVersion = "9.0.30729";
26 string versionName = "Visual Studio 2010"; 24 string schemaVersion = "2.0";
27 string name = "vs2008"; 25 string versionName = "Visual Studio 2010";
28 VSVersion version = VSVersion.VS10; 26 string name = "vs2010";
27 VSVersion version = VSVersion.VS10;
29 28
30 Hashtable tools; 29 #endregion
31 Kernel kernel; 30
32 31 #region Properties
33 /// <summary> 32
34 /// Gets or sets the solution version. 33 /// <summary>
35 /// </summary> 34 /// Gets or sets the solution version.
36 /// <value>The solution version.</value> 35 /// </summary>
37 public override string SolutionVersion 36 /// <value>The solution version.</value>
38 { 37 public override string SolutionVersion
39 get 38 {
40 { 39 get
41 return solutionVersion; 40 {
42 } 41 return solutionVersion;
43 } 42 }
44 /// <summary> 43 }
45 /// Gets or sets the product version. 44
46 /// </summary> 45 /// <summary>
47 /// <value>The product version.</value> 46 /// Gets or sets the product version.
48 public override string ProductVersion 47 /// </summary>
49 { 48 /// <value>The product version.</value>
50 get 49 public override string ProductVersion
51 { 50 {
52 return productVersion; 51 get
53 } 52 {
54 } 53 return productVersion;
55 /// <summary> 54 }
56 /// Gets or sets the schema version. 55 }
57 /// </summary> 56
58 /// <value>The schema version.</value> 57 /// <summary>
59 public override string SchemaVersion 58 /// Gets or sets the schema version.
60 { 59 /// </summary>
61 get 60 /// <value>The schema version.</value>
62 { 61 public override string SchemaVersion
63 return schemaVersion; 62 {
64 } 63 get
65 } 64 {
66 /// <summary> 65 return schemaVersion;
67 /// Gets or sets the name of the version. 66 }
68 /// </summary> 67 }
69 /// <value>The name of the version.</value> 68
70 public override string VersionName 69 /// <summary>
71 { 70 /// Gets or sets the name of the version.
72 get 71 /// </summary>
73 { 72 /// <value>The name of the version.</value>
74 return versionName; 73 public override string VersionName
75 } 74 {
76 } 75 get
77 /// <summary> 76 {
78 /// Gets or sets the version. 77 return versionName;
79 /// </summary> 78 }
80 /// <value>The version.</value> 79 }
81 public override VSVersion Version 80
82 { 81 /// <summary>
83 get 82 /// Gets or sets the version.
84 { 83 /// </summary>
85 return version; 84 /// <value>The version.</value>
86 } 85 public override VSVersion Version
87 } 86 {
88 /// <summary> 87 get
89 /// Gets the name. 88 {
90 /// </summary> 89 return version;
91 /// <value>The name.</value> 90 }
92 public override string Name 91 }
93 { 92
94 get 93 /// <summary>
95 { 94 /// Gets the name.
96 return name; 95 /// </summary>
97 } 96 /// <value>The name.</value>
98 } 97 public override string Name
98 {
99 get
100 {
101 return name;
102 }
103 }
99 104
100 protected override string GetToolsVersionXml(FrameworkVersion frameworkVersion) 105 protected override string GetToolsVersionXml(FrameworkVersion frameworkVersion)
101 { 106 {
102 switch (frameworkVersion) 107 switch (frameworkVersion)
103 { 108 {
104 case FrameworkVersion.v4_0: 109 case FrameworkVersion.v4_0:
105 return "ToolsVersion=\"4.0\"";
106 case FrameworkVersion.v3_5: 110 case FrameworkVersion.v3_5:
107 return "ToolsVersion=\"3.5\""; 111 return "ToolsVersion=\"4.0\"";
108 case FrameworkVersion.v3_0: 112 case FrameworkVersion.v3_0:
109 return "ToolsVersion=\"3.0\""; 113 return "ToolsVersion=\"3.0\"";
110 default: 114 default:
@@ -117,18 +121,18 @@ namespace Prebuild.Core.Targets
117 get { return "# Visual Studio 2010"; } 121 get { return "# Visual Studio 2010"; }
118 } 122 }
119 123
120 #endregion 124 #endregion
121 125
122 #region Constructors 126 #region Constructors
123 127
124 /// <summary> 128 /// <summary>
125 /// Initializes a new instance of the <see cref="VS2010Target"/> class. 129 /// Initializes a new instance of the <see cref="VS2005Target"/> class.
126 /// </summary> 130 /// </summary>
127 public VS2010Target() 131 public VS2010Target()
128 : base() 132 : base()
129 { 133 {
130 } 134 }
131 135
132 #endregion 136 #endregion
133 } 137 }
134} 138}
diff --git a/Prebuild/src/Core/Targets/VSGenericTarget.cs b/Prebuild/src/Core/Targets/VSGenericTarget.cs
index fdcc2b9..cd3f5bb 100644
--- a/Prebuild/src/Core/Targets/VSGenericTarget.cs
+++ b/Prebuild/src/Core/Targets/VSGenericTarget.cs
@@ -5,32 +5,27 @@ Copyright (c) 2008 Matthew Holmes (matthew@wildfiregames.com), John Anderson (so
5Redistribution and use in source and binary forms, with or without modification, are permitted 5Redistribution and use in source and binary forms, with or without modification, are permitted
6provided that the following conditions are met: 6provided that the following conditions are met:
7 7
8* Redistributions of source code must retain the above copyright notice, this list of conditions 8 * Redistributions of source code must retain the above copyright notice, this list of conditions
9 and the following disclaimer. 9 and the following disclaimer.
10* Redistributions in binary form must reproduce the above copyright notice, this list of conditions 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 11 and the following disclaimer in the documentation and/or other materials provided with the
12 distribution. 12 distribution.
13* The name of the author may not be used to endorse or promote products derived from this software 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. 14 without specific prior written permission.
15 15
16THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, 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 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, 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 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 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 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. 22IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23*/ 23 */
24#endregion 24#endregion
25 25
26using System; 26using System;
27using System.Collections;
28using System.Collections.Generic; 27using System.Collections.Generic;
29using System.Collections.Specialized;
30using System.IO; 28using System.IO;
31using System.Text;
32
33using Prebuild.Core.Attributes;
34using Prebuild.Core.Interfaces; 29using Prebuild.Core.Interfaces;
35using Prebuild.Core.Nodes; 30using Prebuild.Core.Nodes;
36using Prebuild.Core.Utilities; 31using Prebuild.Core.Utilities;
@@ -46,59 +41,59 @@ namespace Prebuild.Core.Targets
46 { 41 {
47 #region Fields 42 #region Fields
48 43
49 readonly Hashtable tools = new Hashtable(); 44 readonly Dictionary<string, ToolInfo> tools = new Dictionary<string, ToolInfo>();
50 Kernel kernel; 45 Kernel kernel;
51 #endregion 46 #endregion
52 47
53 #region Properties 48 #region Properties
54 /// <summary> 49 /// <summary>
55 /// Gets or sets the solution version. 50 /// Gets or sets the solution version.
56 /// </summary> 51 /// </summary>
57 /// <value>The solution version.</value> 52 /// <value>The solution version.</value>
58 public abstract string SolutionVersion { get; } 53 public abstract string SolutionVersion { get; }
59 /// <summary> 54 /// <summary>
60 /// Gets or sets the product version. 55 /// Gets or sets the product version.
61 /// </summary> 56 /// </summary>
62 /// <value>The product version.</value> 57 /// <value>The product version.</value>
63 public abstract string ProductVersion { get; } 58 public abstract string ProductVersion { get; }
64 /// <summary> 59 /// <summary>
65 /// Gets or sets the schema version. 60 /// Gets or sets the schema version.
66 /// </summary> 61 /// </summary>
67 /// <value>The schema version.</value> 62 /// <value>The schema version.</value>
68 public abstract string SchemaVersion { get; } 63 public abstract string SchemaVersion { get; }
69 /// <summary> 64 /// <summary>
70 /// Gets or sets the name of the version. 65 /// Gets or sets the name of the version.
71 /// </summary> 66 /// </summary>
72 /// <value>The name of the version.</value> 67 /// <value>The name of the version.</value>
73 public abstract string VersionName { get; } 68 public abstract string VersionName { get; }
74 /// <summary> 69 /// <summary>
75 /// Gets or sets the version. 70 /// Gets or sets the version.
76 /// </summary> 71 /// </summary>
77 /// <value>The version.</value> 72 /// <value>The version.</value>
78 public abstract VSVersion Version { get; } 73 public abstract VSVersion Version { get; }
79 /// <summary> 74 /// <summary>
80 /// Gets the name. 75 /// Gets the name.
81 /// </summary> 76 /// </summary>
82 /// <value>The name.</value> 77 /// <value>The name.</value>
83 public abstract string Name { get; } 78 public abstract string Name { get; }
84 79
85 protected abstract string GetToolsVersionXml(FrameworkVersion version); 80 protected abstract string GetToolsVersionXml(FrameworkVersion version);
86 public abstract string SolutionTag { get; } 81 public abstract string SolutionTag { get; }
87 82
88 #endregion 83 #endregion
89 84
90 #region Constructors 85 #region Constructors
91 86
92 /// <summary> 87 /// <summary>
93 /// Initializes a new instance of the <see cref="VSGenericTarget"/> class. 88 /// Initializes a new instance of the <see cref="VSGenericTarget"/> class.
94 /// </summary> 89 /// </summary>
95 protected VSGenericTarget() 90 protected VSGenericTarget()
96 { 91 {
97 this.tools["C#"] = new ToolInfo("C#", "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}", "csproj", "CSHARP", "$(MSBuildBinPath)\\Microsoft.CSHARP.Targets"); 92 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"); 93 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"); 94 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"); 95 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); 96 tools["Folder"] = new ToolInfo("Folder", "{2150E333-8FDC-42A3-9474-1A3956D46DE8}", null, null);
102 } 97 }
103 98
104 #endregion 99 #endregion
@@ -124,7 +119,7 @@ namespace Prebuild.Core.Targets
124 } 119 }
125 catch (ArgumentException) 120 catch (ArgumentException)
126 { 121 {
127 this.kernel.Log.Write(LogType.Warning, "Could not resolve reference path: {0}", node.Path); 122 kernel.Log.Write(LogType.Warning, "Could not resolve reference path: {0}", node.Path);
128 } 123 }
129 } 124 }
130 125
@@ -144,7 +139,7 @@ namespace Prebuild.Core.Targets
144 private static ProjectNode FindProjectInSolutionRecursively(string name, SolutionNode solution) 139 private static ProjectNode FindProjectInSolutionRecursively(string name, SolutionNode solution)
145 { 140 {
146 if (solution.ProjectsTable.ContainsKey(name)) 141 if (solution.ProjectsTable.ContainsKey(name))
147 return (ProjectNode)solution.ProjectsTable[name]; 142 return solution.ProjectsTable[name];
148 143
149 foreach (SolutionNode child in solution.Solutions) 144 foreach (SolutionNode child in solution.Solutions)
150 { 145 {
@@ -163,7 +158,7 @@ namespace Prebuild.Core.Targets
163 throw new UnknownLanguageException("Unknown .NET language: " + project.Language); 158 throw new UnknownLanguageException("Unknown .NET language: " + project.Language);
164 } 159 }
165 160
166 ToolInfo toolInfo = (ToolInfo)tools[project.Language]; 161 ToolInfo toolInfo = tools[project.Language];
167 string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, toolInfo.FileExtension); 162 string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, toolInfo.FileExtension);
168 StreamWriter ps = new StreamWriter(projectFile); 163 StreamWriter ps = new StreamWriter(projectFile);
169 164
@@ -173,83 +168,83 @@ namespace Prebuild.Core.Targets
173 #region Project File 168 #region Project File
174 using (ps) 169 using (ps)
175 { 170 {
176 ps.WriteLine("<Project DefaultTargets=\"Build\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\" ToolsVersion=\"{0}\">", this.Version == VSVersion.VS10 ? "4.0" : "3.5"); 171 ps.WriteLine("<Project DefaultTargets=\"Build\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\" {0}>", GetToolsVersionXml(project.FrameworkVersion));
177 ps.WriteLine(" <PropertyGroup>"); 172 ps.WriteLine(" <PropertyGroup>");
178 ps.WriteLine(" <ProjectType>Local</ProjectType>"); 173 ps.WriteLine(" <ProjectType>Local</ProjectType>");
179 ps.WriteLine(" <ProductVersion>{0}</ProductVersion>", this.ProductVersion); 174 ps.WriteLine(" <ProductVersion>{0}</ProductVersion>", ProductVersion);
180 ps.WriteLine(" <SchemaVersion>{0}</SchemaVersion>", this.SchemaVersion); 175 ps.WriteLine(" <SchemaVersion>{0}</SchemaVersion>", SchemaVersion);
181 ps.WriteLine(" <ProjectGuid>{{{0}}}</ProjectGuid>", project.Guid.ToString().ToUpper()); 176 ps.WriteLine(" <ProjectGuid>{{{0}}}</ProjectGuid>", project.Guid.ToString().ToUpper());
182 177
183 // Visual Studio has a hard coded guid for the project type 178 // Visual Studio has a hard coded guid for the project type
184 if (project.Type == ProjectType.Web) 179 if (project.Type == ProjectType.Web)
185 ps.WriteLine(" <ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>"); 180 ps.WriteLine(" <ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>");
186 ps.WriteLine(" <Configuration Condition=\" '$(Configuration)' == '' \">Debug</Configuration>"); 181 ps.WriteLine(" <Configuration Condition=\" '$(Configuration)' == '' \">Debug</Configuration>");
187 ps.WriteLine(" <Platform Condition=\" '$(Platform)' == '' \">AnyCPU</Platform>"); 182 ps.WriteLine(" <ApplicationIcon>{0}</ApplicationIcon>", project.AppIcon);
188 ps.WriteLine(" <ApplicationIcon>{0}</ApplicationIcon>", project.AppIcon); 183 ps.WriteLine(" <AssemblyKeyContainerName>");
189 ps.WriteLine(" <AssemblyKeyContainerName>"); 184 ps.WriteLine(" </AssemblyKeyContainerName>");
190 ps.WriteLine(" </AssemblyKeyContainerName>"); 185 ps.WriteLine(" <AssemblyName>{0}</AssemblyName>", project.AssemblyName);
191 ps.WriteLine(" <AssemblyName>{0}</AssemblyName>", project.AssemblyName);
192 foreach (ConfigurationNode conf in project.Configurations) 186 foreach (ConfigurationNode conf in project.Configurations)
193 { 187 {
194 if (conf.Options.KeyFile != "") 188 if (conf.Options.KeyFile != "")
195 { 189 {
196 ps.WriteLine(" <AssemblyOriginatorKeyFile>{0}</AssemblyOriginatorKeyFile>", conf.Options.KeyFile); 190 ps.WriteLine(" <AssemblyOriginatorKeyFile>{0}</AssemblyOriginatorKeyFile>", conf.Options.KeyFile);
197 ps.WriteLine(" <SignAssembly>true</SignAssembly>"); 191 ps.WriteLine(" <SignAssembly>true</SignAssembly>");
198 break; 192 break;
199 } 193 }
200 } 194 }
201 ps.WriteLine(" <DefaultClientScript>JScript</DefaultClientScript>"); 195 ps.WriteLine(" <DefaultClientScript>JScript</DefaultClientScript>");
202 ps.WriteLine(" <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>"); 196 ps.WriteLine(" <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>");
203 ps.WriteLine(" <DefaultTargetSchema>IE50</DefaultTargetSchema>"); 197 ps.WriteLine(" <DefaultTargetSchema>IE50</DefaultTargetSchema>");
204 ps.WriteLine(" <DelaySign>false</DelaySign>"); 198 ps.WriteLine(" <DelaySign>false</DelaySign>");
205 ps.WriteLine(" <TargetFrameworkVersion>{0}</TargetFrameworkVersion>", project.FrameworkVersion.ToString().Replace("_", ".")); 199 ps.WriteLine(" <TargetFrameworkVersion>{0}</TargetFrameworkVersion>", project.FrameworkVersion.ToString().Replace("_", "."));
206 200
207 ps.WriteLine(" <OutputType>{0}</OutputType>", project.Type == ProjectType.Web ? ProjectType.Library.ToString() : project.Type.ToString()); 201 ps.WriteLine(" <OutputType>{0}</OutputType>", project.Type == ProjectType.Web ? ProjectType.Library.ToString() : project.Type.ToString());
208 ps.WriteLine(" <AppDesignerFolder>{0}</AppDesignerFolder>", project.DesignerFolder); 202 ps.WriteLine(" <AppDesignerFolder>{0}</AppDesignerFolder>", project.DesignerFolder);
209 ps.WriteLine(" <RootNamespace>{0}</RootNamespace>", project.RootNamespace); 203 ps.WriteLine(" <RootNamespace>{0}</RootNamespace>", project.RootNamespace);
210 ps.WriteLine(" <StartupObject>{0}</StartupObject>", project.StartupObject); 204 ps.WriteLine(" <StartupObject>{0}</StartupObject>", project.StartupObject);
211 if (string.IsNullOrEmpty(project.DebugStartParameters)) 205 if (string.IsNullOrEmpty(project.DebugStartParameters))
212 { 206 {
213 ps.WriteLine(" <StartArguments>{0}</StartArguments>", project.DebugStartParameters); 207 ps.WriteLine(" <StartArguments>{0}</StartArguments>", project.DebugStartParameters);
214 } 208 }
215 ps.WriteLine(" <FileUpgradeFlags>"); 209 ps.WriteLine(" <FileUpgradeFlags>");
216 ps.WriteLine(" </FileUpgradeFlags>"); 210 ps.WriteLine(" </FileUpgradeFlags>");
217 211
218 ps.WriteLine(" </PropertyGroup>"); 212 ps.WriteLine(" </PropertyGroup>");
219 213
220 foreach (ConfigurationNode conf in project.Configurations) 214 foreach (ConfigurationNode conf in project.Configurations)
221 { 215 {
222 ps.Write(" <PropertyGroup "); 216 ps.Write(" <PropertyGroup ");
223 ps.WriteLine("Condition=\" '$(Configuration)|$(Platform)' == '{0}|AnyCPU' \">", conf.Name); 217 ps.WriteLine("Condition=\" '$(Configuration)|$(Platform)' == '{0}|{1}' \">", conf.Name, conf.Platform);
224 ps.WriteLine(" <AllowUnsafeBlocks>{0}</AllowUnsafeBlocks>", conf.Options["AllowUnsafe"]); 218 ps.WriteLine(" <AllowUnsafeBlocks>{0}</AllowUnsafeBlocks>", conf.Options["AllowUnsafe"]);
225 ps.WriteLine(" <BaseAddress>{0}</BaseAddress>", conf.Options["BaseAddress"]); 219 ps.WriteLine(" <BaseAddress>{0}</BaseAddress>", conf.Options["BaseAddress"]);
226 ps.WriteLine(" <CheckForOverflowUnderflow>{0}</CheckForOverflowUnderflow>", conf.Options["CheckUnderflowOverflow"]); 220 ps.WriteLine(" <CheckForOverflowUnderflow>{0}</CheckForOverflowUnderflow>", conf.Options["CheckUnderflowOverflow"]);
227 ps.WriteLine(" <ConfigurationOverrideFile>"); 221 ps.WriteLine(" <ConfigurationOverrideFile>");
228 ps.WriteLine(" </ConfigurationOverrideFile>"); 222 ps.WriteLine(" </ConfigurationOverrideFile>");
229 ps.WriteLine(" <DefineConstants>{0}</DefineConstants>", conf.Options["CompilerDefines"]); 223 ps.WriteLine(" <DefineConstants>{0}</DefineConstants>", conf.Options["CompilerDefines"]);
230 ps.WriteLine(" <DocumentationFile>{0}</DocumentationFile>", Helper.NormalizePath(conf.Options["XmlDocFile"].ToString())); 224 ps.WriteLine(" <DocumentationFile>{0}</DocumentationFile>", Helper.NormalizePath(conf.Options["XmlDocFile"].ToString()));
231 ps.WriteLine(" <DebugSymbols>{0}</DebugSymbols>", conf.Options["DebugInformation"]); 225 ps.WriteLine(" <DebugSymbols>{0}</DebugSymbols>", conf.Options["DebugInformation"]);
232 ps.WriteLine(" <FileAlignment>{0}</FileAlignment>", conf.Options["FileAlignment"]); 226 ps.WriteLine(" <FileAlignment>{0}</FileAlignment>", conf.Options["FileAlignment"]);
233 ps.WriteLine(" <Optimize>{0}</Optimize>", conf.Options["OptimizeCode"]); 227 ps.WriteLine(" <Optimize>{0}</Optimize>", conf.Options["OptimizeCode"]);
234 if (project.Type != ProjectType.Web) 228 if (project.Type != ProjectType.Web)
235 ps.WriteLine(" <OutputPath>{0}</OutputPath>", 229 ps.WriteLine(" <OutputPath>{0}</OutputPath>",
236 Helper.EndPath(Helper.NormalizePath(conf.Options["OutputPath"].ToString()))); 230 Helper.EndPath(Helper.NormalizePath(conf.Options["OutputPath"].ToString())));
237 else 231 else
238 ps.WriteLine(" <OutputPath>{0}</OutputPath>", 232 ps.WriteLine(" <OutputPath>{0}</OutputPath>",
239 Helper.EndPath(Helper.NormalizePath("bin\\"))); 233 Helper.EndPath(Helper.NormalizePath("bin\\")));
240 234
241 ps.WriteLine(" <RegisterForComInterop>{0}</RegisterForComInterop>", conf.Options["RegisterComInterop"]); 235 ps.WriteLine(" <RegisterForComInterop>{0}</RegisterForComInterop>", conf.Options["RegisterComInterop"]);
242 ps.WriteLine(" <RemoveIntegerChecks>{0}</RemoveIntegerChecks>", conf.Options["RemoveIntegerChecks"]); 236 ps.WriteLine(" <RemoveIntegerChecks>{0}</RemoveIntegerChecks>", conf.Options["RemoveIntegerChecks"]);
243 ps.WriteLine(" <TreatWarningsAsErrors>{0}</TreatWarningsAsErrors>", conf.Options["WarningsAsErrors"]); 237 ps.WriteLine(" <TreatWarningsAsErrors>{0}</TreatWarningsAsErrors>", conf.Options["WarningsAsErrors"]);
244 ps.WriteLine(" <WarningLevel>{0}</WarningLevel>", conf.Options["WarningLevel"]); 238 ps.WriteLine(" <WarningLevel>{0}</WarningLevel>", conf.Options["WarningLevel"]);
245 ps.WriteLine(" <NoStdLib>{0}</NoStdLib>", conf.Options["NoStdLib"]); 239 ps.WriteLine(" <NoStdLib>{0}</NoStdLib>", conf.Options["NoStdLib"]);
246 ps.WriteLine(" <NoWarn>{0}</NoWarn>", conf.Options["SuppressWarnings"]); 240 ps.WriteLine(" <NoWarn>{0}</NoWarn>", conf.Options["SuppressWarnings"]);
247 ps.WriteLine(" </PropertyGroup>"); 241 ps.WriteLine(" <PlatformTarget>{0}</PlatformTarget>", conf.Platform);
242 ps.WriteLine(" </PropertyGroup>");
248 } 243 }
249 244
250 //ps.WriteLine(" </Settings>"); 245 //ps.WriteLine(" </Settings>");
251 246
252 List<ProjectNode> projectReferences = new List<ProjectNode>(); 247 Dictionary<ReferenceNode, ProjectNode> projectReferences = new Dictionary<ReferenceNode, ProjectNode>();
253 List<ReferenceNode> otherReferences = new List<ReferenceNode>(); 248 List<ReferenceNode> otherReferences = new List<ReferenceNode>();
254 249
255 foreach (ReferenceNode refr in project.References) 250 foreach (ReferenceNode refr in project.References)
@@ -259,57 +254,75 @@ namespace Prebuild.Core.Targets
259 if (projectNode == null) 254 if (projectNode == null)
260 otherReferences.Add(refr); 255 otherReferences.Add(refr);
261 else 256 else
262 projectReferences.Add(projectNode); 257 projectReferences.Add(refr, projectNode);
263 } 258 }
264 // Assembly References 259 // Assembly References
265 ps.WriteLine(" <ItemGroup>"); 260 ps.WriteLine(" <ItemGroup>");
266 261
267 foreach (ReferenceNode refr in otherReferences) 262 foreach (ReferenceNode refr in otherReferences)
268 { 263 {
269 ps.Write(" <Reference"); 264 ps.Write(" <Reference");
270 ps.Write(" Include=\""); 265 ps.Write(" Include=\"");
271 ps.Write(refr.Name); 266 ps.Write(refr.Name);
272 ps.WriteLine("\" >"); 267 ps.WriteLine("\" >");
273 ps.Write(" <Name>"); 268 ps.Write(" <Name>");
274 ps.Write(refr.Name); 269 ps.Write(refr.Name);
275 ps.WriteLine("</Name>"); 270 ps.WriteLine("</Name>");
276 // TODO: Allow reference to *.exe files 271
277 ps.WriteLine(" <Private>{0}</Private>", refr.LocalCopy); 272 if(!String.IsNullOrEmpty(refr.Path))
278 ps.WriteLine(" </Reference>"); 273 {
274 // Use absolute path to assembly (for determining assembly type)
275 string absolutePath = Path.Combine(project.FullPath, refr.Path);
276 if(File.Exists(Helper.MakeFilePath(absolutePath, refr.Name, "exe"))) {
277 // Assembly is an executable (exe)
278 ps.WriteLine(" <HintPath>{0}</HintPath>", Helper.MakeFilePath(refr.Path, refr.Name, "exe"));
279 } else if(File.Exists(Helper.MakeFilePath(absolutePath, refr.Name, "dll"))) {
280 // Assembly is an library (dll)
281 ps.WriteLine(" <HintPath>{0}</HintPath>", Helper.MakeFilePath(refr.Path, refr.Name, "dll"));
282 } else {
283 string referencePath = Helper.MakeFilePath(refr.Path, refr.Name, "dll");
284 kernel.Log.Write(LogType.Warning, "Reference \"{0}\": The specified file doesn't exist.", referencePath);
285 ps.WriteLine(" <HintPath>{0}</HintPath>", Helper.MakeFilePath(refr.Path, refr.Name, "dll"));
286 }
287 }
288
289 ps.WriteLine(" <Private>{0}</Private>", refr.LocalCopy);
290 ps.WriteLine(" </Reference>");
279 } 291 }
280 ps.WriteLine(" </ItemGroup>"); 292 ps.WriteLine(" </ItemGroup>");
281 293
282 //Project References 294 //Project References
283 ps.WriteLine(" <ItemGroup>"); 295 ps.WriteLine(" <ItemGroup>");
284 foreach (ProjectNode projectReference in projectReferences) 296 foreach (KeyValuePair<ReferenceNode, ProjectNode> pair in projectReferences)
285 { 297 {
286 ToolInfo tool = (ToolInfo)tools[projectReference.Language]; 298 ToolInfo tool = tools[pair.Value.Language];
287 if (tools == null) 299 if (tools == null)
288 throw new UnknownLanguageException(); 300 throw new UnknownLanguageException();
289 301
290 string path = 302 string path =
291 Helper.MakePathRelativeTo(project.FullPath, 303 Helper.MakePathRelativeTo(project.FullPath,
292 Helper.MakeFilePath(projectReference.FullPath, projectReference.Name, tool.FileExtension)); 304 Helper.MakeFilePath(pair.Value.FullPath, pair.Value.Name, tool.FileExtension));
293 ps.WriteLine(" <ProjectReference Include=\"{0}\">", path); 305 ps.WriteLine(" <ProjectReference Include=\"{0}\">", path);
294 306
295 // TODO: Allow reference to visual basic projects 307 // TODO: Allow reference to visual basic projects
296 ps.WriteLine(" <Name>{0}</Name>", projectReference.Name); 308 ps.WriteLine(" <Name>{0}</Name>", pair.Value.Name);
297 ps.WriteLine(" <Project>{0}</Project>", projectReference.Guid.ToString("B").ToUpper()); 309 ps.WriteLine(" <Project>{0}</Project>", pair.Value.Guid.ToString("B").ToUpper());
298 ps.WriteLine(" <Package>{0}</Package>", tool.Guid.ToUpper()); 310 ps.WriteLine(" <Package>{0}</Package>", tool.Guid.ToUpper());
299 311
300 ps.WriteLine(" <Private>False</Private>" ); 312 //This is the Copy Local flag in VS
313 ps.WriteLine(" <Private>{0}</Private>", pair.Key.LocalCopy);
301 314
302 ps.WriteLine(" </ProjectReference>"); 315 ps.WriteLine(" </ProjectReference>");
303 } 316 }
304 ps.WriteLine(" </ItemGroup>"); 317 ps.WriteLine(" </ItemGroup>");
305 318
306 // ps.WriteLine(" </Build>"); 319 // ps.WriteLine(" </Build>");
307 ps.WriteLine(" <ItemGroup>"); 320 ps.WriteLine(" <ItemGroup>");
308 321
309 // ps.WriteLine(" <Include>"); 322 // ps.WriteLine(" <Include>");
310 List<string> list = new List<string>(); 323 List<string> list = new List<string>();
311 324
312 foreach (string path in project.Files) 325 foreach (string path in project.Files)
313 { 326 {
314 string lower = path.ToLower(); 327 string lower = path.ToLower();
315 if (lower.EndsWith(".resx")) 328 if (lower.EndsWith(".resx"))
@@ -318,93 +331,106 @@ namespace Prebuild.Core.Targets
318 if (!list.Contains(codebehind)) 331 if (!list.Contains(codebehind))
319 list.Add(codebehind); 332 list.Add(codebehind);
320 } 333 }
334
321 } 335 }
322 336
323 foreach (string file in project.Files) 337 foreach (string filePath in project.Files)
324 { 338 {
325 // if (file == "Properties\\Bind.Designer.cs") 339 // if (file == "Properties\\Bind.Designer.cs")
326 // { 340 // {
327 // Console.WriteLine("Wait a minute!"); 341 // Console.WriteLine("Wait a minute!");
328 // Console.WriteLine(project.Files.GetSubType(file).ToString()); 342 // Console.WriteLine(project.Files.GetSubType(file).ToString());
329 // } 343 // }
330 344 SubType subType = project.Files.GetSubType(filePath);
331 SubType subType = project.Files.GetSubType(file); 345
346 // Visual Studio chokes on file names if forward slash is used as a path separator
347 // instead of backslash. So we must make sure that all file paths written to the
348 // project file use \ as a path separator.
349 string file = filePath.Replace(@"/", @"\");
332 350
333 if (subType != SubType.Code && subType != SubType.Settings && subType != SubType.Designer 351 if (subType != SubType.Code && subType != SubType.Settings && subType != SubType.Designer
334 && subType != SubType.CodeBehind) 352 && subType != SubType.CodeBehind)
335 { 353 {
336 ps.WriteLine(" <EmbeddedResource Include=\"{0}\">", file.Substring(0, file.LastIndexOf('.')) + ".resx"); 354 ps.WriteLine(" <EmbeddedResource Include=\"{0}\">", file.Substring(0, file.LastIndexOf('.')) + ".resx");
337 ps.WriteLine(" <DependentUpon>{0}</DependentUpon>", Path.GetFileName(file)); 355 ps.WriteLine(" <DependentUpon>{0}</DependentUpon>", Path.GetFileName(file));
338 ps.WriteLine(" <SubType>Designer</SubType>"); 356 ps.WriteLine(" <SubType>Designer</SubType>");
339 ps.WriteLine(" </EmbeddedResource>"); 357 ps.WriteLine(" </EmbeddedResource>");
340 // 358 //
341 } 359 }
342 360
343 if (subType == SubType.Designer) 361 if (subType == SubType.Designer)
344 { 362 {
345 ps.WriteLine(" <EmbeddedResource Include=\"{0}\">", file); 363 ps.WriteLine(" <EmbeddedResource Include=\"{0}\">", file);
346 ps.WriteLine(" <SubType>" + subType + "</SubType>");
347 ps.WriteLine(" <Generator>ResXFileCodeGenerator</Generator>");
348 364
349 string autogen_name = file.Substring(0, file.LastIndexOf('.')) + ".Designer.cs"; 365 string autogen_name = file.Substring(0, file.LastIndexOf('.')) + ".Designer.cs";
350 string dependent_name = file.Substring(0, file.LastIndexOf('.')) + ".cs"; 366 string dependent_name = filePath.Substring(0, file.LastIndexOf('.')) + ".cs";
351
352 ps.WriteLine(" <LastGenOutput>{0}</LastGenOutput>", autogen_name);
353 367
354 // Check for a parent .cs file with the same name as this designer file 368 // Check for a parent .cs file with the same name as this designer file
355 if (File.Exists(dependent_name)) 369 if (File.Exists(Helper.NormalizePath(dependent_name)))
356 ps.WriteLine(" <DependentUpon>{0}</DependentUpon>", Path.GetFileName(dependent_name)); 370 {
371 ps.WriteLine(" <DependentUpon>{0}</DependentUpon>", Path.GetFileName(dependent_name));
372 }
373 else
374 {
375 ps.WriteLine(" <Generator>ResXFileCodeGenerator</Generator>");
376 ps.WriteLine(" <LastGenOutput>{0}</LastGenOutput>", Path.GetFileName(autogen_name));
377 ps.WriteLine(" <SubType>" + subType + "</SubType>");
378 }
357 379
358 ps.WriteLine(" </EmbeddedResource>"); 380 ps.WriteLine(" </EmbeddedResource>");
359 if (File.Exists(autogen_name)) 381 if (File.Exists(Helper.NormalizePath(autogen_name)))
360 { 382 {
361 ps.WriteLine(" <Compile Include=\"{0}\">", autogen_name); 383 ps.WriteLine(" <Compile Include=\"{0}\">", autogen_name);
362 ps.WriteLine(" <AutoGen>True</AutoGen>"); 384 //ps.WriteLine(" <DesignTime>True</DesignTime>");
363 ps.WriteLine(" <DesignTime>True</DesignTime>"); 385
364 386 // If a parent .cs file exists, link this autogen file to it. Otherwise link
365 // If a parent .cs file exists, link this autogen file to it. Otherwise link 387 // to the designer file
366 // to the designer file 388 if (File.Exists(dependent_name))
367 if (File.Exists(dependent_name)) 389 {
368 ps.WriteLine(" <DependentUpon>{0}</DependentUpon>", Path.GetFileName(dependent_name)); 390 ps.WriteLine(" <DependentUpon>{0}</DependentUpon>", Path.GetFileName(dependent_name));
369 else 391 }
370 ps.WriteLine(" <DependentUpon>{0}</DependentUpon>", Path.GetFileName(file)); 392 else
371 393 {
372 ps.WriteLine(" </Compile>"); 394 ps.WriteLine(" <AutoGen>True</AutoGen>");
395 ps.WriteLine(" <DependentUpon>{0}</DependentUpon>", Path.GetFileName(filePath));
396 }
397
398 ps.WriteLine(" </Compile>");
373 } 399 }
374 list.Add(autogen_name); 400 list.Add(autogen_name);
375 } 401 }
376 if (subType == SubType.Settings) 402 if (subType == SubType.Settings)
377 { 403 {
378 ps.Write(" <{0} ", project.Files.GetBuildAction(file)); 404 ps.Write(" <{0} ", project.Files.GetBuildAction(filePath));
379 ps.WriteLine("Include=\"{0}\">", file); 405 ps.WriteLine("Include=\"{0}\">", file);
380 string fileName = Path.GetFileName(file); 406 string fileName = Path.GetFileName(filePath);
381 if (project.Files.GetBuildAction(file) == BuildAction.None) 407 if (project.Files.GetBuildAction(filePath) == BuildAction.None)
382 { 408 {
383 ps.WriteLine(" <Generator>SettingsSingleFileGenerator</Generator>"); 409 ps.WriteLine(" <Generator>SettingsSingleFileGenerator</Generator>");
384 ps.WriteLine(" <LastGenOutput>{0}</LastGenOutput>", fileName.Substring(0, fileName.LastIndexOf('.')) + ".Designer.cs"); 410 ps.WriteLine(" <LastGenOutput>{0}</LastGenOutput>", fileName.Substring(0, fileName.LastIndexOf('.')) + ".Designer.cs");
385 } 411 }
386 else 412 else
387 { 413 {
388 ps.WriteLine(" <SubType>Code</SubType>"); 414 ps.WriteLine(" <SubType>Code</SubType>");
389 ps.WriteLine(" <AutoGen>True</AutoGen>"); 415 ps.WriteLine(" <AutoGen>True</AutoGen>");
390 ps.WriteLine(" <DesignTimeSharedInput>True</DesignTimeSharedInput>"); 416 ps.WriteLine(" <DesignTimeSharedInput>True</DesignTimeSharedInput>");
391 string fileNameShort = fileName.Substring(0, fileName.LastIndexOf('.')); 417 string fileNameShort = fileName.Substring(0, fileName.LastIndexOf('.'));
392 string fileNameShorter = fileNameShort.Substring(0, fileNameShort.LastIndexOf('.')); 418 string fileNameShorter = fileNameShort.Substring(0, fileNameShort.LastIndexOf('.'));
393 ps.WriteLine(" <DependentUpon>{0}</DependentUpon>", Path.GetFileName(fileNameShorter + ".settings")); 419 ps.WriteLine(" <DependentUpon>{0}</DependentUpon>", Path.GetFileName(fileNameShorter + ".settings"));
394 } 420 }
395 ps.WriteLine(" </{0}>", project.Files.GetBuildAction(file)); 421 ps.WriteLine(" </{0}>", project.Files.GetBuildAction(filePath));
396 } 422 }
397 else if (subType != SubType.Designer) 423 else if (subType != SubType.Designer)
398 { 424 {
399 string path = Helper.NormalizePath(file); 425 string path = Helper.NormalizePath(file);
400 string path_lower = path.ToLower(); 426 string path_lower = path.ToLower();
401 427
402 if (!list.Contains(file)) 428 if (!list.Contains(filePath))
403 { 429 {
404 ps.Write(" <{0} ", project.Files.GetBuildAction(path)); 430 ps.Write(" <{0} ", project.Files.GetBuildAction(filePath));
405 431
406 int startPos = 0; 432 int startPos = 0;
407 if (project.Files.GetPreservePath(file)) 433 if (project.Files.GetPreservePath(filePath))
408 { 434 {
409 while ((@"./\").IndexOf(file.Substring(startPos, 1)) != -1) 435 while ((@"./\").IndexOf(file.Substring(startPos, 1)) != -1)
410 startPos++; 436 startPos++;
@@ -415,60 +441,75 @@ namespace Prebuild.Core.Targets
415 startPos = file.LastIndexOf(Path.GetFileName(path)); 441 startPos = file.LastIndexOf(Path.GetFileName(path));
416 } 442 }
417 443
418 ps.WriteLine("Include=\"{0}\">", path); 444 // be sure to write out the path with backslashes so VS recognizes
445 // the file properly.
446 ps.WriteLine("Include=\"{0}\">", file);
419 447
420 int last_period_index = file.LastIndexOf('.'); 448 int last_period_index = file.LastIndexOf('.');
421 string short_file_name = file.Substring(0, last_period_index); 449 string short_file_name = file.Substring(0, last_period_index);
422 string extension = Path.GetExtension(path); 450 string extension = Path.GetExtension(path);
423 string designer_format = string.Format(".designer{0}", extension); 451 // make this upper case, so that when File.Exists tests for the
452 // existence of a designer file on a case-sensitive platform,
453 // it is correctly identified.
454 string designer_format = string.Format(".Designer{0}", extension);
424 455
425 if (path_lower.EndsWith(designer_format)) 456 if (path_lower.EndsWith(designer_format.ToLowerInvariant()))
426 { 457 {
427 int designer_index = path_lower.IndexOf(designer_format); 458 int designer_index = path.IndexOf(designer_format);
428 string file_name = path.Substring(0, designer_index); 459 string file_name = path.Substring(0, designer_index);
429 460
430 if (File.Exists(file_name)) 461 // There are two corrections to the next lines:
431 ps.WriteLine(" <DependentUpon>{0}</DependentUpon>", Path.GetFileName(file_name)); 462 // 1. Fix the connection between a designer file and a form
463 // or usercontrol that don't have an associated resx file.
464 // 2. Connect settings files to associated designer files.
465 if (File.Exists(file_name + extension))
466 ps.WriteLine(" <DependentUpon>{0}</DependentUpon>", Path.GetFileName(file_name + extension));
432 else if (File.Exists(file_name + ".resx")) 467 else if (File.Exists(file_name + ".resx"))
433 ps.WriteLine(" <DependentUpon>{0}</DependentUpon>", Path.GetFileName(file_name + ".resx")); 468 ps.WriteLine(" <DependentUpon>{0}</DependentUpon>", Path.GetFileName(file_name + ".resx"));
469 else if (File.Exists(file_name + ".settings"))
470 {
471 ps.WriteLine(" <DependentUpon>{0}</DependentUpon>", Path.GetFileName(file_name + ".settings"));
472 ps.WriteLine(" <AutoGen>True</AutoGen>");
473 ps.WriteLine(" <DesignTimeSharedInput>True</DesignTimeSharedInput>");
474 }
434 } 475 }
435 else if (subType == SubType.CodeBehind) 476 else if (subType == SubType.CodeBehind)
436 { 477 {
437 ps.WriteLine(" <DependentUpon>{0}</DependentUpon>", Path.GetFileName(short_file_name)); 478 ps.WriteLine(" <DependentUpon>{0}</DependentUpon>", Path.GetFileName(short_file_name));
438 } 479 }
439 if (project.Files.GetIsLink(file)) 480 if (project.Files.GetIsLink(filePath))
440 { 481 {
441 string alias = project.Files.GetLinkPath(file); 482 string alias = project.Files.GetLinkPath(filePath);
442 alias += file.Substring(startPos); 483 alias += file.Substring(startPos);
443 alias = Helper.NormalizePath(alias); 484 alias = Helper.NormalizePath(alias);
444 ps.WriteLine(" <Link>{0}</Link>", alias); 485 ps.WriteLine(" <Link>{0}</Link>", alias);
445 } 486 }
446 else if (project.Files.GetBuildAction(file) != BuildAction.None) 487 else if (project.Files.GetBuildAction(filePath) != BuildAction.None)
447 { 488 {
448 if (project.Files.GetBuildAction(file) != BuildAction.EmbeddedResource) 489 if (project.Files.GetBuildAction(filePath) != BuildAction.EmbeddedResource)
449 { 490 {
450 ps.WriteLine(" <SubType>{0}</SubType>", subType); 491 ps.WriteLine(" <SubType>{0}</SubType>", subType);
451 } 492 }
452 } 493 }
453 494
454 if (project.Files.GetCopyToOutput(file) != CopyToOutput.Never) 495 if (project.Files.GetCopyToOutput(filePath) != CopyToOutput.Never)
455 { 496 {
456 ps.WriteLine(" <CopyToOutputDirectory>{0}</CopyToOutputDirectory>", project.Files.GetCopyToOutput(file)); 497 ps.WriteLine(" <CopyToOutputDirectory>{0}</CopyToOutputDirectory>", project.Files.GetCopyToOutput(filePath));
457 } 498 }
458 499
459 ps.WriteLine(" </{0}>", project.Files.GetBuildAction(file)); 500 ps.WriteLine(" </{0}>", project.Files.GetBuildAction(filePath));
460 } 501 }
461 } 502 }
462 } 503 }
463 504
464 ps.WriteLine(" </ItemGroup>"); 505 ps.WriteLine(" </ItemGroup>");
465 ps.WriteLine(" <Import Project=\"" + toolInfo.ImportProject + "\" />"); 506 ps.WriteLine(" <Import Project=\"" + toolInfo.ImportProject + "\" />");
466 ps.WriteLine(" <PropertyGroup>"); 507 ps.WriteLine(" <PropertyGroup>");
467 ps.WriteLine(" <PreBuildEvent>"); 508 ps.WriteLine(" <PreBuildEvent>");
468 ps.WriteLine(" </PreBuildEvent>"); 509 ps.WriteLine(" </PreBuildEvent>");
469 ps.WriteLine(" <PostBuildEvent>"); 510 ps.WriteLine(" <PostBuildEvent>");
470 ps.WriteLine(" </PostBuildEvent>"); 511 ps.WriteLine(" </PostBuildEvent>");
471 ps.WriteLine(" </PropertyGroup>"); 512 ps.WriteLine(" </PropertyGroup>");
472 ps.WriteLine("</Project>"); 513 ps.WriteLine("</Project>");
473 } 514 }
474 #endregion 515 #endregion
@@ -478,23 +519,36 @@ namespace Prebuild.Core.Targets
478 ps = new StreamWriter(projectFile + ".user"); 519 ps = new StreamWriter(projectFile + ".user");
479 using (ps) 520 using (ps)
480 { 521 {
522 // Get the first configuration from the project.
523 ConfigurationNode firstConfiguration = null;
524
525 if (project.Configurations.Count > 0)
526 {
527 firstConfiguration = project.Configurations[0];
528 }
529
481 ps.WriteLine("<Project xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">"); 530 ps.WriteLine("<Project xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">");
482 //ps.WriteLine( "<VisualStudioProject>" ); 531 //ps.WriteLine( "<VisualStudioProject>" );
483 //ps.WriteLine(" <{0}>", toolInfo.XMLTag); 532 //ps.WriteLine(" <{0}>", toolInfo.XMLTag);
484 //ps.WriteLine(" <Build>"); 533 //ps.WriteLine(" <Build>");
485 ps.WriteLine(" <PropertyGroup>"); 534 ps.WriteLine(" <PropertyGroup>");
486 //ps.WriteLine(" <Settings ReferencePath=\"{0}\">", MakeRefPath(project)); 535 //ps.WriteLine(" <Settings ReferencePath=\"{0}\">", MakeRefPath(project));
487 ps.WriteLine(" <Configuration Condition=\" '$(Configuration)' == '' \">Debug</Configuration>"); 536
488 ps.WriteLine(" <Platform Condition=\" '$(Platform)' == '' \">AnyCPU</Platform>"); 537 if (firstConfiguration != null)
489 ps.WriteLine(" <ReferencePath>{0}</ReferencePath>", MakeRefPath(project)); 538 {
490 ps.WriteLine(" <LastOpenVersion>{0}</LastOpenVersion>", this.ProductVersion); 539 ps.WriteLine(" <Configuration Condition=\" '$(Configuration)' == '' \">{0}</Configuration>", firstConfiguration.Name);
491 ps.WriteLine(" <ProjectView>ProjectFiles</ProjectView>"); 540 ps.WriteLine(" <Platform Condition=\" '$(Platform)' == '' \">{0}</Platform>", firstConfiguration.Platform);
492 ps.WriteLine(" <ProjectTrust>0</ProjectTrust>"); 541 }
493 ps.WriteLine(" </PropertyGroup>"); 542
543 ps.WriteLine(" <ReferencePath>{0}</ReferencePath>", MakeRefPath(project));
544 ps.WriteLine(" <LastOpenVersion>{0}</LastOpenVersion>", ProductVersion);
545 ps.WriteLine(" <ProjectView>ProjectFiles</ProjectView>");
546 ps.WriteLine(" <ProjectTrust>0</ProjectTrust>");
547 ps.WriteLine(" </PropertyGroup>");
494 foreach (ConfigurationNode conf in project.Configurations) 548 foreach (ConfigurationNode conf in project.Configurations)
495 { 549 {
496 ps.Write(" <PropertyGroup"); 550 ps.Write(" <PropertyGroup");
497 ps.Write(" Condition = \" '$(Configuration)|$(Platform)' == '{0}|AnyCPU' \"", conf.Name); 551 ps.Write(" Condition = \" '$(Configuration)|$(Platform)' == '{0}|{1}' \"", conf.Name, conf.Platform);
498 ps.WriteLine(" />"); 552 ps.WriteLine(" />");
499 } 553 }
500 ps.WriteLine("</Project>"); 554 ps.WriteLine("</Project>");
@@ -504,9 +558,9 @@ namespace Prebuild.Core.Targets
504 kernel.CurrentWorkingDirectory.Pop(); 558 kernel.CurrentWorkingDirectory.Pop();
505 } 559 }
506 560
507 private void WriteSolution(SolutionNode solution, bool writeSolutionToDisk) 561 private void WriteSolution(SolutionNode solution, bool writeSolutionToDisk)
508 { 562 {
509 kernel.Log.Write("Creating {0} solution and project files", this.VersionName); 563 kernel.Log.Write("Creating {0} solution and project files", VersionName);
510 564
511 foreach (SolutionNode child in solution.Solutions) 565 foreach (SolutionNode child in solution.Solutions)
512 { 566 {
@@ -531,13 +585,13 @@ namespace Prebuild.Core.Targets
531 kernel.Log.Write(""); 585 kernel.Log.Write("");
532 string solutionFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "sln"); 586 string solutionFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "sln");
533 587
534 using (StreamWriter ss = new StreamWriter(solutionFile)) 588 using (StreamWriter ss = new StreamWriter(solutionFile))
535 { 589 {
536 kernel.CurrentWorkingDirectory.Push(); 590 kernel.CurrentWorkingDirectory.Push();
537 Helper.SetCurrentDir(Path.GetDirectoryName(solutionFile)); 591 Helper.SetCurrentDir(Path.GetDirectoryName(solutionFile));
538 592
539 ss.WriteLine("Microsoft Visual Studio Solution File, Format Version {0}", this.SolutionVersion); 593 ss.WriteLine("Microsoft Visual Studio Solution File, Format Version {0}", SolutionVersion);
540 ss.WriteLine(SolutionTag); 594 ss.WriteLine(SolutionTag);
541 595
542 WriteProjectDeclarations(ss, solution, solution); 596 WriteProjectDeclarations(ss, solution, solution);
543 597
@@ -546,7 +600,7 @@ namespace Prebuild.Core.Targets
546 ss.WriteLine("\tGlobalSection(SolutionConfigurationPlatforms) = preSolution"); 600 ss.WriteLine("\tGlobalSection(SolutionConfigurationPlatforms) = preSolution");
547 foreach (ConfigurationNode conf in solution.Configurations) 601 foreach (ConfigurationNode conf in solution.Configurations)
548 { 602 {
549 ss.WriteLine("\t\t{0}|Any CPU = {0}|Any CPU", conf.Name); 603 ss.WriteLine("\t\t{0} = {0}", conf.NameAndPlatform);
550 } 604 }
551 ss.WriteLine("\tEndGlobalSection"); 605 ss.WriteLine("\tEndGlobalSection");
552 606
@@ -571,7 +625,7 @@ namespace Prebuild.Core.Targets
571 } 625 }
572 } 626 }
573 627
574 private void WriteProjectDeclarations(StreamWriter writer, SolutionNode actualSolution, SolutionNode embeddedSolution) 628 private void WriteProjectDeclarations(TextWriter writer, SolutionNode actualSolution, SolutionNode embeddedSolution)
575 { 629 {
576 foreach (SolutionNode childSolution in embeddedSolution.Solutions) 630 foreach (SolutionNode childSolution in embeddedSolution.Solutions)
577 { 631 {
@@ -595,7 +649,7 @@ namespace Prebuild.Core.Targets
595 } 649 }
596 } 650 }
597 651
598 private static void WriteNestedProjectMap(StreamWriter writer, SolutionNode embeddedSolution) 652 private static void WriteNestedProjectMap(TextWriter writer, SolutionNode embeddedSolution)
599 { 653 {
600 foreach (ProjectNode project in embeddedSolution.Projects) 654 foreach (ProjectNode project in embeddedSolution.Projects)
601 { 655 {
@@ -614,31 +668,31 @@ namespace Prebuild.Core.Targets
614 } 668 }
615 } 669 }
616 670
617 private static void WriteNestedProject(StreamWriter writer, SolutionNode solution, Guid projectGuid) 671 private static void WriteNestedProject(TextWriter writer, SolutionNode solution, Guid projectGuid)
618 { 672 {
619 WriteNestedFolder(writer, solution.Guid, projectGuid); 673 WriteNestedFolder(writer, solution.Guid, projectGuid);
620 } 674 }
621 675
622 private static void WriteNestedFolder(StreamWriter writer, Guid parentGuid, Guid childGuid) 676 private static void WriteNestedFolder(TextWriter writer, Guid parentGuid, Guid childGuid)
623 { 677 {
624 writer.WriteLine("\t\t{0} = {1}", 678 writer.WriteLine("\t\t{0} = {1}",
625 childGuid.ToString("B").ToUpper(), 679 childGuid.ToString("B").ToUpper(),
626 parentGuid.ToString("B").ToUpper()); 680 parentGuid.ToString("B").ToUpper());
627 } 681 }
628 682
629 private static void WriteConfigurationLines(ICollection configurations, SolutionNode solution, StreamWriter ss) 683 private static void WriteConfigurationLines(IEnumerable<ConfigurationNode> configurations, SolutionNode solution, TextWriter ss)
630 { 684 {
631 foreach (ProjectNode project in solution.Projects) 685 foreach (ProjectNode project in solution.Projects)
632 { 686 {
633 foreach (ConfigurationNode conf in configurations) 687 foreach (ConfigurationNode conf in configurations)
634 { 688 {
635 ss.WriteLine("\t\t{0}.{1}|Any CPU.ActiveCfg = {1}|Any CPU", 689 ss.WriteLine("\t\t{0}.{1}.ActiveCfg = {1}",
636 project.Guid.ToString("B").ToUpper(), 690 project.Guid.ToString("B").ToUpper(),
637 conf.Name); 691 conf.NameAndPlatform);
638 692
639 ss.WriteLine("\t\t{0}.{1}|Any CPU.Build.0 = {1}|Any CPU", 693 ss.WriteLine("\t\t{0}.{1}.Build.0 = {1}",
640 project.Guid.ToString("B").ToUpper(), 694 project.Guid.ToString("B").ToUpper(),
641 conf.Name); 695 conf.NameAndPlatform);
642 } 696 }
643 } 697 }
644 698
@@ -648,54 +702,37 @@ namespace Prebuild.Core.Targets
648 } 702 }
649 } 703 }
650 704
651 private void WriteSolutionFiles(SolutionNode solution, StreamWriter ss) 705 private void WriteSolutionFiles(SolutionNode solution, TextWriter ss)
652 { 706 {
653 if (solution.Files != null && solution.Files.Count > 0) 707 if(solution.Files != null && solution.Files.Count > 0)
654 { 708 WriteProject(ss, "Folder", solution.Guid, "Solution Files", "Solution Files", solution.Files);
655 WriteProject(ss, "Folder", solution.Guid, "Solution Files", "Solution Files", solution.Files);
656 }
657 } 709 }
658 710
659 private void WriteEmbeddedSolution(StreamWriter writer, SolutionNode embeddedSolution) 711 private void WriteEmbeddedSolution(TextWriter writer, SolutionNode embeddedSolution)
660 { 712 {
661 WriteProject(writer, "Folder", embeddedSolution.Guid, embeddedSolution.Name, embeddedSolution.Name, embeddedSolution.Files); 713 WriteProject(writer, "Folder", embeddedSolution.Guid, embeddedSolution.Name, embeddedSolution.Name, embeddedSolution.Files);
662 } 714 }
663 715
664 private void WriteProject(SolutionNode solution, StreamWriter ss, ProjectNode project) 716 private void WriteProject(SolutionNode solution, TextWriter ss, ProjectNode project)
665 { 717 {
666 WriteProject(ss, solution, project.Language, project.Guid, project.Name, project.FullPath); 718 WriteProject(ss, solution, project.Language, project.Guid, project.Name, project.FullPath);
667 } 719 }
668 720
669 private void WriteProject(SolutionNode solution, StreamWriter ss, DatabaseProjectNode dbProject) 721 private void WriteProject(SolutionNode solution, TextWriter ss, DatabaseProjectNode dbProject)
670 { 722 {
671 if (solution.Files != null && solution.Files.Count > 0) 723 if (solution.Files != null && solution.Files.Count > 0)
672 WriteProject(ss, solution, "Database", dbProject.Guid, dbProject.Name, dbProject.FullPath); 724 WriteProject(ss, solution, "Database", dbProject.Guid, dbProject.Name, dbProject.FullPath);
673 } 725 }
674 726
675 private static bool ExtensionSpecified(string refName)
676 {
677 return refName.EndsWith(".dll") || refName.EndsWith(".exe");
678 }
679
680 private static string GetProjectExtension(ProjectNode project)
681 {
682 string extension = ".dll";
683 if (project.Type == ProjectType.Exe)
684 {
685 extension = ".exe";
686 }
687 return extension;
688 }
689
690 const string ProjectDeclarationBeginFormat = "Project(\"{0}\") = \"{1}\", \"{2}\", \"{3}\""; 727 const string ProjectDeclarationBeginFormat = "Project(\"{0}\") = \"{1}\", \"{2}\", \"{3}\"";
691 const string ProjectDeclarationEndFormat = "EndProject"; 728 const string ProjectDeclarationEndFormat = "EndProject";
692 729
693 private void WriteProject(StreamWriter ss, SolutionNode solution, string language, Guid guid, string name, string projectFullPath) 730 private void WriteProject(TextWriter ss, SolutionNode solution, string language, Guid guid, string name, string projectFullPath)
694 { 731 {
695 if (!tools.ContainsKey(language)) 732 if (!tools.ContainsKey(language))
696 throw new UnknownLanguageException("Unknown .NET language: " + language); 733 throw new UnknownLanguageException("Unknown .NET language: " + language);
697 734
698 ToolInfo toolInfo = (ToolInfo)tools[language]; 735 ToolInfo toolInfo = tools[language];
699 736
700 string path = Helper.MakePathRelativeTo(solution.FullPath, projectFullPath); 737 string path = Helper.MakePathRelativeTo(solution.FullPath, projectFullPath);
701 738
@@ -704,23 +741,23 @@ namespace Prebuild.Core.Targets
704 WriteProject(ss, language, guid, name, path); 741 WriteProject(ss, language, guid, name, path);
705 } 742 }
706 743
707 private void WriteProject(StreamWriter writer, string language, Guid projectGuid, string name, string location) 744 private void WriteProject(TextWriter writer, string language, Guid projectGuid, string name, string location)
708 { 745 {
709 WriteProject(writer, language, projectGuid, name, location, null); 746 WriteProject(writer, language, projectGuid, name, location, null);
710 } 747 }
711 748
712 private void WriteProject(StreamWriter writer, string language, Guid projectGuid, string name, string location, FilesNode files) 749 private void WriteProject(TextWriter writer, string language, Guid projectGuid, string name, string location, FilesNode files)
713 { 750 {
714 if (!tools.ContainsKey(language)) 751 if (!tools.ContainsKey(language))
715 throw new UnknownLanguageException("Unknown .NET language: " + language); 752 throw new UnknownLanguageException("Unknown .NET language: " + language);
716 753
717 ToolInfo toolInfo = (ToolInfo)tools[language]; 754 ToolInfo toolInfo = tools[language];
718 755
719 writer.WriteLine(ProjectDeclarationBeginFormat, 756 writer.WriteLine(ProjectDeclarationBeginFormat,
720 toolInfo.Guid, 757 toolInfo.Guid,
721 name, 758 name,
722 location, 759 location,
723 projectGuid.ToString("B").ToUpper()); 760 projectGuid.ToString("B").ToUpper());
724 761
725 if (files != null) 762 if (files != null)
726 { 763 {
@@ -738,7 +775,7 @@ namespace Prebuild.Core.Targets
738 private void WriteDatabaseProject(SolutionNode solution, DatabaseProjectNode project) 775 private void WriteDatabaseProject(SolutionNode solution, DatabaseProjectNode project)
739 { 776 {
740 string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, "dbp"); 777 string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, "dbp");
741 IndentedTextWriter ps = new IndentedTextWriter(new StreamWriter(projectFile), " "); 778 IndentedTextWriter ps = new IndentedTextWriter(new StreamWriter(projectFile), " ");
742 779
743 kernel.CurrentWorkingDirectory.Push(); 780 kernel.CurrentWorkingDirectory.Push();
744 781
@@ -777,12 +814,10 @@ namespace Prebuild.Core.Targets
777 kernel.CurrentWorkingDirectory.Pop(); 814 kernel.CurrentWorkingDirectory.Pop();
778 } 815 }
779 816
780 private bool ContainsSqlFiles(string folder) 817 private static bool ContainsSqlFiles(string folder)
781 { 818 {
782 foreach (string file in Directory.GetFiles(folder, "*.sql")) 819 if(Directory.GetFiles(folder, "*.sql").Length > 0)
783 {
784 return true; // if the folder contains 1 .sql file, that's good enough 820 return true; // if the folder contains 1 .sql file, that's good enough
785 }
786 821
787 foreach (string child in Directory.GetDirectories(folder)) 822 foreach (string child in Directory.GetDirectories(folder))
788 { 823 {
@@ -793,7 +828,7 @@ namespace Prebuild.Core.Targets
793 return false; 828 return false;
794 } 829 }
795 830
796 private void WriteDatabaseFoldersAndFiles(IndentedTextWriter writer, string folder) 831 private static void WriteDatabaseFoldersAndFiles(IndentedTextWriter writer, string folder)
797 { 832 {
798 foreach (string child in Directory.GetDirectories(folder)) 833 foreach (string child in Directory.GetDirectories(folder))
799 { 834 {
@@ -816,7 +851,7 @@ namespace Prebuild.Core.Targets
816 { 851 {
817 kernel.Log.Write("...Cleaning project: {0}", project.Name); 852 kernel.Log.Write("...Cleaning project: {0}", project.Name);
818 853
819 ToolInfo toolInfo = (ToolInfo)tools[project.Language]; 854 ToolInfo toolInfo = tools[project.Language];
820 string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, toolInfo.FileExtension); 855 string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, toolInfo.FileExtension);
821 string userFile = projectFile + ".user"; 856 string userFile = projectFile + ".user";
822 857
@@ -826,7 +861,7 @@ namespace Prebuild.Core.Targets
826 861
827 private void CleanSolution(SolutionNode solution) 862 private void CleanSolution(SolutionNode solution)
828 { 863 {
829 kernel.Log.Write("Cleaning {0} solution and project files", this.VersionName, solution.Name); 864 kernel.Log.Write("Cleaning {0} solution and project files", VersionName, solution.Name);
830 865
831 string slnFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "sln"); 866 string slnFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "sln");
832 string suoFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "suo"); 867 string suoFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "suo");
diff --git a/Prebuild/src/Core/Targets/VSVersion.cs b/Prebuild/src/Core/Targets/VSVersion.cs
index 59549b0..699b5ca 100644
--- a/Prebuild/src/Core/Targets/VSVersion.cs
+++ b/Prebuild/src/Core/Targets/VSVersion.cs
@@ -45,10 +45,10 @@ namespace Prebuild.Core.Targets
45 /// <summary> 45 /// <summary>
46 /// Visual Studio 2008 46 /// Visual Studio 2008
47 /// </summary> 47 /// </summary>
48 VS90, 48 VS90,
49 /// <summary> 49 /// <summary>
50 /// Visual Studio 2010 50 /// Visual Studio 2010
51 /// </summary> 51 /// </summary>
52 VS10 52 VS10
53 } 53 }
54} 54}
diff --git a/Prebuild/src/Core/Targets/XcodeTarget.cs b/Prebuild/src/Core/Targets/XcodeTarget.cs
index d96f65b..5393cec 100644
--- a/Prebuild/src/Core/Targets/XcodeTarget.cs
+++ b/Prebuild/src/Core/Targets/XcodeTarget.cs
@@ -24,8 +24,6 @@ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY O
24#endregion 24#endregion
25 25
26using System; 26using System;
27using System.Collections;
28using System.Collections.Specialized;
29using System.IO; 27using System.IO;
30using System.Reflection; 28using System.Reflection;
31using System.Text.RegularExpressions; 29using System.Text.RegularExpressions;
diff --git a/Prebuild/src/Core/Utilities/CommandLineCollection.cs b/Prebuild/src/Core/Utilities/CommandLineCollection.cs
index 22752aa..786fa1e 100644
--- a/Prebuild/src/Core/Utilities/CommandLineCollection.cs
+++ b/Prebuild/src/Core/Utilities/CommandLineCollection.cs
@@ -23,10 +23,8 @@ 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
26using System;
27using System.Collections; 26using System.Collections;
28using System.Collections.Specialized; 27using System.Collections.Generic;
29using System.Diagnostics;
30 28
31namespace Prebuild.Core.Utilities 29namespace Prebuild.Core.Utilities
32{ 30{
@@ -34,15 +32,15 @@ namespace Prebuild.Core.Utilities
34 /// The CommandLine class parses and interprets the command-line arguments passed to 32 /// The CommandLine class parses and interprets the command-line arguments passed to
35 /// prebuild. 33 /// prebuild.
36 /// </summary> 34 /// </summary>
37 public class CommandLineCollection 35 public class CommandLineCollection : IEnumerable<KeyValuePair<string, string>>
38 { 36 {
39 #region Fields 37 #region Fields
40 38
41 // The raw OS arguments 39 // The raw OS arguments
42 private string[] m_RawArgs; 40 private readonly string[] m_RawArgs;
43 41
44 // Command-line argument storage 42 // Command-line argument storage
45 private Hashtable m_Arguments; 43 private readonly Dictionary<string, string> m_Arguments = new Dictionary<string, string>();
46 44
47 #endregion 45 #endregion
48 46
@@ -54,8 +52,7 @@ namespace Prebuild.Core.Utilities
54 public CommandLineCollection(string[] args) 52 public CommandLineCollection(string[] args)
55 { 53 {
56 m_RawArgs = args; 54 m_RawArgs = args;
57 m_Arguments = new Hashtable(); 55
58
59 Parse(); 56 Parse();
60 } 57 }
61 58
@@ -69,11 +66,11 @@ namespace Prebuild.Core.Utilities
69 return; 66 return;
70 67
71 int idx = 0; 68 int idx = 0;
72 string arg = null, lastArg = null; 69 string lastArg = null;
73 70
74 while(idx <m_RawArgs.Length) 71 while(idx <m_RawArgs.Length)
75 { 72 {
76 arg = m_RawArgs[idx]; 73 string arg = m_RawArgs[idx];
77 74
78 if(arg.Length > 2 && arg[0] == '/') 75 if(arg.Length > 2 && arg[0] == '/')
79 { 76 {
@@ -119,16 +116,13 @@ namespace Prebuild.Core.Utilities
119 /// null string if no parameter was specified, and the value if a parameter was specified</remarks> 116 /// null string if no parameter was specified, and the value if a parameter was specified</remarks>
120 public string this[string index] 117 public string this[string index]
121 { 118 {
122 get 119 get
123 { 120 {
124 if(m_Arguments.ContainsKey(index)) 121 if(m_Arguments.ContainsKey(index))
125 { 122 {
126 return (string)(m_Arguments[index]); 123 return (m_Arguments[index]);
127 }
128 else
129 {
130 return null;
131 } 124 }
125 return null;
132 } 126 }
133 } 127 }
134 128
@@ -143,11 +137,16 @@ namespace Prebuild.Core.Utilities
143 /// An <see cref="T:System.Collections.IDictionaryEnumerator"/> 137 /// An <see cref="T:System.Collections.IDictionaryEnumerator"/>
144 /// that can be used to iterate through the collection. 138 /// that can be used to iterate through the collection.
145 /// </returns> 139 /// </returns>
146 public IDictionaryEnumerator GetEnumerator() 140 public IEnumerator<KeyValuePair<string, string>> GetEnumerator()
147 { 141 {
148 return m_Arguments.GetEnumerator(); 142 return m_Arguments.GetEnumerator();
149 } 143 }
150 144
151 #endregion 145 IEnumerator IEnumerable.GetEnumerator()
146 {
147 return GetEnumerator();
148 }
149
150 #endregion
152 } 151 }
153} 152}
diff --git a/Prebuild/src/Core/Utilities/CurrentDirectory.cs b/Prebuild/src/Core/Utilities/CurrentDirectory.cs
index 5fabdf0..9624c35 100644
--- a/Prebuild/src/Core/Utilities/CurrentDirectory.cs
+++ b/Prebuild/src/Core/Utilities/CurrentDirectory.cs
@@ -24,7 +24,7 @@ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY O
24#endregion 24#endregion
25 25
26using System; 26using System;
27using System.Collections; 27using System.Collections.Generic;
28 28
29namespace Prebuild.Core.Utilities 29namespace Prebuild.Core.Utilities
30{ 30{
@@ -35,19 +35,7 @@ namespace Prebuild.Core.Utilities
35 { 35 {
36 #region Fields 36 #region Fields
37 37
38 private Stack m_Stack; 38 private readonly Stack<string> m_Stack = new Stack<string>();
39
40 #endregion
41
42 #region Constructors
43
44 /// <summary>
45 /// Initializes a new instance of the <see cref="CurrentDirectory"/> class.
46 /// </summary>
47 public CurrentDirectory()
48 {
49 m_Stack = new Stack();
50 }
51 39
52 #endregion 40 #endregion
53 41
@@ -71,7 +59,7 @@ namespace Prebuild.Core.Utilities
71 return; 59 return;
72 } 60 }
73 61
74 string cwd = (string)m_Stack.Pop(); 62 string cwd = m_Stack.Pop();
75 Helper.SetCurrentDir(cwd); 63 Helper.SetCurrentDir(cwd);
76 } 64 }
77 65
diff --git a/Prebuild/src/Core/Utilities/Helper.cs b/Prebuild/src/Core/Utilities/Helper.cs
index 9a0d131..8c3e968 100644
--- a/Prebuild/src/Core/Utilities/Helper.cs
+++ b/Prebuild/src/Core/Utilities/Helper.cs
@@ -24,7 +24,7 @@ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY O
24#endregion 24#endregion
25 25
26using System; 26using System;
27using System.Collections; 27using System.Collections.Generic;
28using System.Diagnostics; 28using System.Diagnostics;
29using System.IO; 29using System.IO;
30using System.Runtime.InteropServices; 30using System.Runtime.InteropServices;
@@ -42,8 +42,6 @@ namespace Prebuild.Core.Utilities
42 { 42 {
43 #region Fields 43 #region Fields
44 44
45 private static Stack dirStack;
46 private static Regex varRegex;
47 static bool checkForOSVariables; 45 static bool checkForOSVariables;
48 46
49 /// <summary> 47 /// <summary>
@@ -62,60 +60,12 @@ namespace Prebuild.Core.Utilities
62 } 60 }
63 61
64 #endregion 62 #endregion
65
66 #region Constructors
67
68 /// <summary>
69 /// Initializes the <see cref="Helper"/> class.
70 /// </summary>
71 static Helper()
72 {
73 dirStack = new Stack();
74 //m_VarRegex = new Regex(@"\${(?<var>[\w|_]+)}");
75 }
76
77 #endregion
78
79 #region Properties
80
81 /// <summary>
82 ///
83 /// </summary>
84 public static Stack DirStack
85 {
86 get
87 {
88 return dirStack;
89 }
90 }
91
92 /// <summary>
93 ///
94 /// </summary>
95 public static Regex VarRegex
96 {
97 get
98 {
99 return varRegex;
100 }
101 set
102 {
103 varRegex = value;
104 }
105 }
106
107 #endregion
108 63
109 #region Public Methods 64 #region Public Methods
110 65
111 #region String Parsing 66 #region String Parsing
112 #region Inner Classes and Delegates 67
113 /// <summary>
114 ///
115 /// </summary>
116 public delegate string StringLookup(string key); 68 public delegate string StringLookup(string key);
117
118 #endregion
119 69
120 /// <summary> 70 /// <summary>
121 /// Gets a collection of StringLocationPair objects that represent the matches 71 /// Gets a collection of StringLocationPair objects that represent the matches
@@ -545,35 +495,6 @@ namespace Prebuild.Core.Utilities
545 return attrs[0]; 495 return attrs[0];
546 } 496 }
547 497
548 /* A bit of overhead for simple group parsing, there are problems with Regex in Mono
549 public static string ParseValue(string val)
550 {
551 if(val == null || val.Length < 1 || !CheckForOSVariables)
552 return val;
553
554 string tmp = val;
555 Match m = m_VarRegex.Match(val);
556 while(m.Success)
557 {
558 if(m.Groups["var"] == null)
559 continue;
560
561 Capture c = m.Groups["var"].Captures[0];
562 if(c == null)
563 continue;
564
565 string var = c.Value;
566 string envVal = Environment.GetEnvironmentVariable(var);
567 if(envVal == null)
568 envVal = "";
569
570 tmp = tmp.Replace("${" + var + "}", envVal);
571 m = m.NextMatch();
572 }
573
574 return tmp;
575 }*/
576
577 /// <summary> 498 /// <summary>
578 /// Attributes the value. 499 /// Attributes the value.
579 /// </summary> 500 /// </summary>
diff --git a/Prebuild/src/Core/Utilities/Log.cs b/Prebuild/src/Core/Utilities/Log.cs
index 548e987..4df3def 100644
--- a/Prebuild/src/Core/Utilities/Log.cs
+++ b/Prebuild/src/Core/Utilities/Log.cs
@@ -82,7 +82,7 @@ namespace Prebuild.Core.Utilities
82 { 82 {
83 #region Fields 83 #region Fields
84 84
85 private StreamWriter m_Writer; 85 private TextWriter m_Writer;
86 private LogTargets m_Target = LogTargets.Null; 86 private LogTargets m_Target = LogTargets.Null;
87 bool disposed; 87 bool disposed;
88 88
@@ -96,14 +96,20 @@ namespace Prebuild.Core.Utilities
96 /// <param name="target">The target.</param> 96 /// <param name="target">The target.</param>
97 /// <param name="fileName">Name of the file.</param> 97 /// <param name="fileName">Name of the file.</param>
98 public Log(LogTargets target, string fileName) 98 public Log(LogTargets target, string fileName)
99 { 99 {
100 m_Target = target; 100 m_Target = target;
101 101
102 if((m_Target & LogTargets.File) != 0) 102 if ((m_Target & LogTargets.File) != 0)
103 { 103 {
104 m_Writer = new StreamWriter(fileName, false); 104 m_Writer = new StreamWriter(fileName, false);
105 } 105 }
106 } 106 else if ((m_Target & LogTargets.Console) != 0)
107 {
108 // Prevents null reference exceptions when outputing to the log file.
109 // This seems to only happen when running on a network drive.
110 m_Writer = Console.Out;
111 }
112 }
107 113
108 #endregion 114 #endregion
109 115
diff --git a/Prebuild/src/Core/WarningException.cs b/Prebuild/src/Core/WarningException.cs
index df90dc8..b7c3668 100644
--- a/Prebuild/src/Core/WarningException.cs
+++ b/Prebuild/src/Core/WarningException.cs
@@ -31,7 +31,7 @@ namespace Prebuild.Core
31 /// <summary> 31 /// <summary>
32 /// 32 ///
33 /// </summary> 33 /// </summary>
34 [Serializable()] 34 [Serializable]
35 public class WarningException : Exception 35 public class WarningException : Exception
36 { 36 {
37 #region Constructors 37 #region Constructors
diff --git a/Prebuild/src/Prebuild.cs b/Prebuild/src/Prebuild.cs
index 2d12b53..081c89c 100644
--- a/Prebuild/src/Prebuild.cs
+++ b/Prebuild/src/Prebuild.cs
@@ -26,9 +26,9 @@ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY O
26#region CVS Information 26#region CVS Information
27/* 27/*
28 * $Source$ 28 * $Source$
29 * $Author: jendave $ 29 * $Author: kunnis $
30 * $Date: 2006-09-26 23:43:35 +0200 (ti, 26 sep 2006) $ 30 * $Date: 2009-04-15 02:33:14 +0100 (Wed, 15 Apr 2009) $
31 * $Revision: 168 $ 31 * $Revision: 308 $
32 */ 32 */
33#endregion 33#endregion
34 34
@@ -86,17 +86,17 @@ namespace Prebuild
86 { 86 {
87 kernel.Process(); 87 kernel.Process();
88 } 88 }
89 } 89 }
90 catch(Exception ex) 90#if !DEBUG
91 { 91 catch (Exception ex)
92 Console.WriteLine("Unhandled error: {0}", ex.Message); 92 {
93 //#if DEBUG 93 Console.WriteLine("Unhandled error: {0}", ex.Message);
94 Console.WriteLine("{0}", ex.StackTrace); 94 Console.WriteLine("{0}", ex.StackTrace);
95 //#endif 95 }
96 } 96#endif
97 finally 97 finally
98 { 98 {
99 if(kernel.PauseAfterFinish) 99 if(kernel != null && kernel.PauseAfterFinish)
100 { 100 {
101 Console.WriteLine("\nPress enter to continue..."); 101 Console.WriteLine("\nPress enter to continue...");
102 Console.ReadLine(); 102 Console.ReadLine();
diff --git a/Prebuild/src/Properties/AssemblyInfo.cs b/Prebuild/src/Properties/AssemblyInfo.cs
index 65c8736..f3ac30f 100644
--- a/Prebuild/src/Properties/AssemblyInfo.cs
+++ b/Prebuild/src/Properties/AssemblyInfo.cs
@@ -61,16 +61,17 @@ using System.Resources;
61[assembly: AssemblyConfiguration(".NET CLR")] 61[assembly: AssemblyConfiguration(".NET CLR")]
62[assembly: AssemblyCompany("The Prebuild Project")] 62[assembly: AssemblyCompany("The Prebuild Project")]
63[assembly: AssemblyProduct("")] 63[assembly: AssemblyProduct("")]
64[assembly: AssemblyCopyright("Copyright 2004-2008 " + 64[assembly: AssemblyCopyright("Copyright 2004-2010 " +
65 "Matthew Holmes, " + 65 "Matthew Holmes, " +
66 "Dan Moorehead, " + 66 "Dan Moorehead, " +
67 "C.J. Adams-Collier, " + 67 "C.J. Adams-Collier, " +
68 "Rob Loach, " + 68 "Rob Loach, " +
69 "David Hudson,")] 69 "David Hudson," +
70 "John Hurliman")]
70[assembly: AssemblyTrademark("")] 71[assembly: AssemblyTrademark("")]
71[assembly: AssemblyCulture("")] 72[assembly: AssemblyCulture("")]
72[assembly: NeutralResourcesLanguageAttribute("en-US")] 73[assembly: NeutralResourcesLanguageAttribute("en-US")]
73[assembly: AssemblyVersion("2.0.4.*")] 74[assembly: AssemblyVersion("2.0.5.*")]
74 75
75// 76//
76// Version information for an assembly consists of the following four values: 77// 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..3675503 100644
--- a/Prebuild/src/data/prebuild-1.7.xsd
+++ b/Prebuild/src/data/prebuild-1.7.xsd
@@ -40,7 +40,7 @@
40 <xs:complexType> 40 <xs:complexType>
41 <xs:sequence> 41 <xs:sequence>
42 <xs:element ref="Process" minOccurs="0" maxOccurs="unbounded" /> 42 <xs:element ref="Process" minOccurs="0" maxOccurs="unbounded" />
43 <xs:element ref="Solution" minOccurs="0" maxOccurs="unbounded" /> 43 <xs:element ref="Solution" minOccurs="1" maxOccurs="unbounded" />
44 </xs:sequence> 44 </xs:sequence>
45 <xs:attribute name="version" /> 45 <xs:attribute name="version" />
46 <xs:attribute name="checkOsVars" /> 46 <xs:attribute name="checkOsVars" />
@@ -57,6 +57,7 @@
57 <xs:element ref="Options" minOccurs="0" /> 57 <xs:element ref="Options" minOccurs="0" />
58 <xs:element ref="Files" minOccurs="0" /> 58 <xs:element ref="Files" minOccurs="0" />
59 <xs:element ref="Project" minOccurs="0" maxOccurs="unbounded" /> 59 <xs:element ref="Project" minOccurs="0" maxOccurs="unbounded" />
60 <xs:element ref="Cleanup" minOccurs="0" maxOccurs="1" />
60 <xs:element ref="DatabaseProject" minOccurs="0" maxOccurs="unbounded" /> 61 <xs:element ref="DatabaseProject" minOccurs="0" maxOccurs="unbounded" />
61 <xs:element ref="EmbeddedSolution" minOccurs="0" maxOccurs="unbounded" /> 62 <xs:element ref="EmbeddedSolution" minOccurs="0" maxOccurs="unbounded" />
62 </xs:sequence> 63 </xs:sequence>
@@ -224,6 +225,7 @@
224 </xs:all> 225 </xs:all>
225 </xs:complexType> 226 </xs:complexType>
226 </xs:element> 227 </xs:element>
228
227 <xs:element name="Files"> 229 <xs:element name="Files">
228 <xs:complexType> 230 <xs:complexType>
229 <xs:sequence> 231 <xs:sequence>
@@ -232,6 +234,7 @@
232 </xs:sequence> 234 </xs:sequence>
233 </xs:complexType> 235 </xs:complexType>
234 </xs:element> 236 </xs:element>
237
235 <xs:element name="File"> 238 <xs:element name="File">
236 <xs:complexType> 239 <xs:complexType>
237 <xs:simpleContent> 240 <xs:simpleContent>
@@ -275,6 +278,7 @@
275 </xs:simpleContent> 278 </xs:simpleContent>
276 </xs:complexType> 279 </xs:complexType>
277 </xs:element> 280 </xs:element>
281
278 <xs:element name="Match"> 282 <xs:element name="Match">
279 <xs:complexType> 283 <xs:complexType>
280 <xs:sequence> 284 <xs:sequence>
@@ -322,10 +326,25 @@
322 <xs:attribute name="linkPath" type="xs:string" /> 326 <xs:attribute name="linkPath" type="xs:string" />
323 </xs:complexType> 327 </xs:complexType>
324 </xs:element> 328 </xs:element>
329
325 <xs:element name="Exclude"> 330 <xs:element name="Exclude">
326 <xs:complexType> 331 <xs:complexType>
327 <xs:attribute name="name" type="xs:string" /> 332 <xs:attribute name="name" type="xs:string" />
328 <xs:attribute name="pattern" type="xs:string" /> 333 <xs:attribute name="pattern" type="xs:string" />
329 </xs:complexType> 334 </xs:complexType>
330 </xs:element> 335 </xs:element>
336
337 <xs:element name="Cleanup">
338 <xs:complexType>
339 <xs:sequence>
340 <xs:element ref="CleanFiles" minOccurs="1" maxOccurs="unbounded" />
341 </xs:sequence>
342 </xs:complexType>
343 </xs:element>
344
345 <xs:element name="CleanFiles">
346 <xs:complexType>
347 <xs:attribute name="pattern" type="xs:string" />
348 </xs:complexType>
349 </xs:element>
331</xs:schema> 350</xs:schema>
diff --git a/Prebuild/src/data/prebuild-1.8.xsd b/Prebuild/src/data/prebuild-1.8.xsd
new file mode 100644
index 0000000..8f5c1a4
--- /dev/null
+++ b/Prebuild/src/data/prebuild-1.8.xsd
@@ -0,0 +1,331 @@
1<?xml version="1.0" encoding="utf-8"?>
2<xs:schema elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://dnpb.sourceforge.net/schemas/prebuild-1.8.xsd" xmlns="http://dnpb.sourceforge.net/schemas/prebuild-1.8.xsd">
3 <xs:annotation>
4 <xs:documentation>
5 Copyright (c) 2004-2007
6 Matthew Holmes (calefaction at houston . rr . com),
7 Dan Moorehead (dan05a at gmail . com),
8 David Hudson (jendave at yahoo dot com),
9 C.J. Adams-Collier (cjac at colliertech dot com)
10
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
13 IDE's and .NET development tools including: Visual Studio .NET 2002,
14 2003, and 2005, SharpDevelop, MonoDevelop, NAnt, Xcode and the GNU Autotools.
15
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:
20
21 * Redistributions of source code must retain the above copyright notice, this list of conditions
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.
28
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>
38
39 <xs:element name="Prebuild">
40 <xs:complexType>
41 <xs:sequence>
42 <xs:element ref="Process" minOccurs="0" maxOccurs="unbounded" />
43 <xs:element ref="Solution" minOccurs="1" maxOccurs="1" />
44 </xs:sequence>
45 <xs:attribute name="version" />
46 <xs:attribute name="checkOsVars" />
47 </xs:complexType>
48 </xs:element>
49
50 <xs:element name="Process" type="xs:string" />
51
52 <xs:element name="Solution">
53 <xs:complexType>
54 <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" />
58 <xs:element ref="Files" minOccurs="0" />
59 <xs:element ref="Project" minOccurs="0" 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>
79 <xs:attribute name="name" type="xs:string" use="required" />
80 <xs:attribute name="activeConfig" type="xs:string" default="Debug" />
81 <xs:attribute name="path" type="xs:string" default="" />
82 <xs:attribute name="version" type="xs:string" default="1.0.0" />
83 </xs:complexType>
84 </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">
107 <xs:complexType>
108 <xs:sequence>
109 <xs:element name="Author" type="xs:string" minOccurs="0" maxOccurs="unbounded" />
110 <xs:element name="Description" type="xs:string" minOccurs="0" maxOccurs="1" />
111 <xs:element ref="Configuration" minOccurs="1" maxOccurs="unbounded" />
112 <xs:element name="ReferencePath" type="xs:string" minOccurs="0" maxOccurs="unbounded" />
113 <xs:element name="Reference" minOccurs="0" maxOccurs="unbounded">
114 <xs:complexType>
115 <xs:attribute name="name" type="xs:string" use="required" />
116 <xs:attribute name="path" type="xs:string" />
117 <xs:attribute name="localCopy" type="xs:boolean" />
118 <xs:attribute name="version" type="xs:string" />
119 </xs:complexType>
120 </xs:element>
121 <xs:element ref="Files" />
122 </xs:sequence>
123 <xs:attribute name="name" type="xs:string" use="required" />
124 <xs:attribute name="designerFolder" type="xs:string" default="" />
125 <xs:attribute name="filterGroups" type="xs:string" default="" />
126 <xs:attribute name="path" type="xs:string" default="" />
127 <xs:attribute name="icon" type="xs:string" default="" />
128 <xs:attribute name="configFile" type="xs:string" default="" />
129 <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#">
132 <xs:simpleType>
133 <xs:restriction base="xs:string">
134 <xs:enumeration value="C#" />
135 <xs:enumeration value="VB.NET" />
136 </xs:restriction>
137 </xs:simpleType>
138 </xs:attribute>
139 <xs:attribute name="type" default="Exe">
140 <xs:simpleType>
141 <xs:restriction base="xs:string">
142 <xs:enumeration value="Exe" />
143 <xs:enumeration value="WinExe" />
144 <xs:enumeration value="Library" />
145 <xs:enumeration value="Web" />
146 </xs:restriction>
147 </xs:simpleType>
148 </xs:attribute>
149 <xs:attribute name="runtime" default="Microsoft">
150 <xs:simpleType>
151 <xs:restriction base="xs:string">
152 <xs:enumeration value="Microsoft" />
153 <xs:enumeration value="Mono" />
154 </xs:restriction>
155 </xs:simpleType>
156 </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="" />
167 <xs:attribute name="rootNamespace" type="xs:string" />
168 <xs:attribute name="assemblyName" type="xs:string" />
169 <xs:attribute name="generateAssemblyInfoFile" type="xs:boolean" default="false" />
170 </xs:complexType>
171 </xs:element>
172
173 <xs:element name="Configuration">
174 <xs:complexType>
175 <xs:sequence>
176 <xs:element ref="Options" minOccurs="0" />
177 </xs:sequence>
178 <xs:attribute name="name" type="xs:string" use="required" />
179 <xs:attribute name="platform" type="xs:string" use="required" />
180 </xs:complexType>
181 </xs:element>
182 <xs:element name="Options">
183 <xs:complexType>
184 <xs:all>
185 <xs:element name="CompilerDefines" type="xs:string" minOccurs="0" />
186 <xs:element name="OptimizeCode" type="xs:boolean" minOccurs="0" />
187 <xs:element name="CheckUnderflowOverflow" type="xs:boolean" minOccurs="0" />
188 <xs:element name="AllowUnsafe" type="xs:boolean" minOccurs="0" />
189 <xs:element name="PreBuildEvent" type="xs:string" minOccurs="0" />
190 <xs:element name="PostBuildEvent" type="xs:string" minOccurs="0" />
191 <xs:element name="RunPostBuildEvent" minOccurs="0" default="OnBuildSuccess">
192 <xs:simpleType>
193 <xs:restriction base="xs:string">
194 <xs:enumeration value="OnBuildSuccess" />
195 <xs:enumeration value="Always" />
196 <xs:enumeration value="OnOutputUpdated" />
197 </xs:restriction>
198 </xs:simpleType>
199 </xs:element>
200 <xs:element name="RunScript" type="xs:string" minOccurs="0" />
201 <xs:element name="PreBuildEventArgs" type="xs:string" minOccurs="0" />
202 <xs:element name="PostBuildEventArgs" type="xs:string" minOccurs="0" />
203 <xs:element name="WarningLevel" minOccurs="0">
204 <xs:simpleType>
205 <xs:restriction base="xs:integer">
206 <xs:minInclusive value="0" />
207 <xs:maxInclusive value="4" />
208 </xs:restriction>
209 </xs:simpleType>
210 </xs:element>
211 <xs:element name="WarningsAsErrors" type="xs:boolean" minOccurs="0" />
212 <xs:element name="SuppressWarnings" type="xs:string" minOccurs="0" />
213 <xs:element name="OutputPath" type="xs:string" minOccurs="0" />
214 <xs:element name="GenerateDocumentation" type="xs:boolean" minOccurs="0" />
215 <xs:element name="XmlDocFile" type="xs:string" minOccurs="0" />
216 <xs:element name="DebugInformation" type="xs:boolean" minOccurs="0" />
217 <xs:element name="RegisterComInterop" type="xs:boolean" minOccurs="0" />
218 <xs:element name="RemoveIntegerChecks" type="xs:boolean" minOccurs="0" />
219 <xs:element name="IncrementalBuild" type="xs:boolean" minOccurs="0" />
220 <xs:element name="BaseAddress" type="xs:string" minOccurs="0" />
221 <xs:element name="FileAlignment" type="xs:integer" minOccurs="0" />
222 <xs:element name="NoStdLib" type="xs:boolean" minOccurs="0" />
223 <xs:element name="KeyFile" type="xs:string" minOccurs="0" />
224 </xs:all>
225 </xs:complexType>
226 </xs:element>
227 <xs:element name="Files">
228 <xs:complexType>
229 <xs:sequence>
230 <xs:element ref="File" minOccurs="0" maxOccurs="unbounded" />
231 <xs:element ref="Match" minOccurs="0" maxOccurs="unbounded" />
232 </xs:sequence>
233 </xs:complexType>
234 </xs:element>
235 <xs:element name="File">
236 <xs:complexType>
237 <xs:simpleContent>
238 <xs:extension base="xs:string">
239 <xs:attribute name="resourceName" type="xs:string" default="" />
240 <xs:attribute name="buildAction" default="Compile">
241 <xs:simpleType>
242 <xs:restriction base="xs:string">
243 <xs:enumeration value="None" />
244 <xs:enumeration value="Compile" />
245 <xs:enumeration value="Content" />
246 <xs:enumeration value="EmbeddedResource" />
247 </xs:restriction>
248 </xs:simpleType>
249 </xs:attribute>
250 <xs:attribute name="subType" default="Code">
251 <xs:simpleType>
252 <xs:restriction base="xs:string">
253 <xs:enumeration value="Code" />
254 <xs:enumeration value="CodeBehind" />
255 <xs:enumeration value="Component" />
256 <xs:enumeration value="Form" />
257 <xs:enumeration value="Settings" />
258 <xs:enumeration value="UserControl" />
259 </xs:restriction>
260 </xs:simpleType>
261 </xs:attribute>
262 <xs:attribute name="link" type="xs:boolean" />
263 <xs:attribute name="copyToOutput" default="Never">
264 <xs:simpleType>
265 <xs:restriction base="xs:string">
266 <xs:enumeration value="Never" />
267 <xs:enumeration value="Always" />
268 <xs:enumeration value="PreserveNewest" />
269 </xs:restriction>
270 </xs:simpleType>
271 </xs:attribute>
272 <xs:attribute name="preservePath" type="xs:boolean" />
273 <xs:attribute name="linkPath" type="xs:string" />
274 </xs:extension>
275 </xs:simpleContent>
276 </xs:complexType>
277 </xs:element>
278 <xs:element name="Match">
279 <xs:complexType>
280 <xs:sequence>
281 <xs:element ref="Exclude" minOccurs="0" maxOccurs="unbounded" />
282 </xs:sequence>
283 <xs:attribute name="path" type="xs:string" />
284 <xs:attribute name="pattern" type="xs:string" use="required" />
285 <xs:attribute name="recurse" type="xs:boolean" default="false" />
286 <xs:attribute name="useRegex" type="xs:boolean" default="false" />
287 <xs:attribute name="buildAction" default="Compile">
288 <xs:simpleType>
289 <xs:restriction base="xs:string">
290 <xs:enumeration value="None" />
291 <xs:enumeration value="Compile" />
292 <xs:enumeration value="Content" />
293 <xs:enumeration value="EmbeddedResource" />
294 </xs:restriction>
295 </xs:simpleType>
296 </xs:attribute>
297 <xs:attribute name="resourceName" type="xs:string" default="" />
298 <xs:attribute name="subType" default="Code">
299 <xs:simpleType>
300 <xs:restriction base="xs:string">
301 <xs:enumeration value="Code" />
302 <xs:enumeration value="CodeBehind" />
303 <xs:enumeration value="Component" />
304 <xs:enumeration value="Designer" />
305 <xs:enumeration value="Form" />
306 <xs:enumeration value="Settings" />
307 <xs:enumeration value="UserControl" />
308 </xs:restriction>
309 </xs:simpleType>
310 </xs:attribute>
311 <xs:attribute name="link" type="xs:boolean" />
312 <xs:attribute name="copyToOutput" default="Never">
313 <xs:simpleType>
314 <xs:restriction base="xs:string">
315 <xs:enumeration value="Never" />
316 <xs:enumeration value="Always" />
317 <xs:enumeration value="PreserveNewest" />
318 </xs:restriction>
319 </xs:simpleType>
320 </xs:attribute>
321 <xs:attribute name="preservePath" type="xs:boolean" />
322 <xs:attribute name="linkPath" type="xs:string" />
323 </xs:complexType>
324 </xs:element>
325 <xs:element name="Exclude">
326 <xs:complexType>
327 <xs:attribute name="name" type="xs:string" />
328 <xs:attribute name="pattern" type="xs:string" />
329 </xs:complexType>
330 </xs:element>
331</xs:schema>
diff --git a/Prebuild/src/data/prebuild-1.9.xsd b/Prebuild/src/data/prebuild-1.9.xsd
new file mode 100644
index 0000000..fbca556
--- /dev/null
+++ b/Prebuild/src/data/prebuild-1.9.xsd
@@ -0,0 +1,336 @@
1<?xml version="1.0" encoding="utf-8"?>
2<xs:schema elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://dnpb.sourceforge.net/schemas/prebuild-1.9.xsd" xmlns="http://dnpb.sourceforge.net/schemas/prebuild-1.9.xsd">
3 <xs:annotation>
4 <xs:documentation>
5 Copyright (c) 2004-2007
6 Matthew Holmes (calefaction at houston . rr . com),
7 Dan Moorehead (dan05a at gmail . com),
8 David Hudson (jendave at yahoo dot com),
9 C.J. Adams-Collier (cjac at colliertech dot com)
10
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
13 IDE's and .NET development tools including: Visual Studio .NET 2002,
14 2003, and 2005, SharpDevelop, MonoDevelop, NAnt, Xcode and the GNU Autotools.
15
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:
20
21 * Redistributions of source code must retain the above copyright notice, this list of conditions
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.
28
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>
38
39 <xs:element name="Prebuild">
40 <xs:complexType>
41 <xs:sequence>
42 <xs:element ref="Process" minOccurs="0" maxOccurs="unbounded" />
43 <xs:element ref="Solution" minOccurs="1" maxOccurs="1" />
44 </xs:sequence>
45 <xs:attribute name="version" />
46 <xs:attribute name="checkOsVars" />
47 </xs:complexType>
48 </xs:element>
49
50 <xs:element name="Process" type="xs:string" />
51
52 <xs:element name="Solution">
53 <xs:complexType>
54 <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" />
58 <xs:element ref="Files" minOccurs="0" />
59 <xs:element ref="Project" minOccurs="0" 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>
79 <xs:attribute name="name" type="xs:string" use="required" />
80 <xs:attribute name="activeConfig" type="xs:string" default="Debug" />
81 <xs:attribute name="path" type="xs:string" default="" />
82 <xs:attribute name="version" type="xs:string" default="1.0.0" />
83 </xs:complexType>
84 </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">
107 <xs:complexType>
108 <xs:sequence>
109 <xs:element name="Author" type="xs:string" minOccurs="0" maxOccurs="unbounded" />
110 <xs:element name="Description" type="xs:string" minOccurs="0" maxOccurs="1" />
111 <xs:element ref="Configuration" minOccurs="1" maxOccurs="unbounded" />
112 <xs:element name="ReferencePath" type="xs:string" minOccurs="0" maxOccurs="unbounded" />
113 <xs:element name="Reference" minOccurs="0" maxOccurs="unbounded">
114 <xs:complexType>
115 <xs:attribute name="name" type="xs:string" use="required" />
116 <xs:attribute name="path" type="xs:string" />
117 <xs:attribute name="localCopy" type="xs:boolean" />
118 <xs:attribute name="version" type="xs:string" />
119 </xs:complexType>
120 </xs:element>
121 <xs:element ref="Files" />
122 </xs:sequence>
123 <xs:attribute name="name" type="xs:string" use="required" />
124 <xs:attribute name="designerFolder" type="xs:string" default="" />
125 <xs:attribute name="filterGroups" type="xs:string" default="" />
126 <xs:attribute name="path" type="xs:string" default="" />
127 <xs:attribute name="icon" type="xs:string" default="" />
128 <xs:attribute name="configFile" type="xs:string" default="" />
129 <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#">
132 <xs:simpleType>
133 <xs:restriction base="xs:string">
134 <xs:enumeration value="C#" />
135 <xs:enumeration value="VB.NET" />
136 </xs:restriction>
137 </xs:simpleType>
138 </xs:attribute>
139 <xs:attribute name="type" default="Exe">
140 <xs:simpleType>
141 <xs:restriction base="xs:string">
142 <xs:enumeration value="Exe" />
143 <xs:enumeration value="WinExe" />
144 <xs:enumeration value="Library" />
145 <xs:enumeration value="Web" />
146 </xs:restriction>
147 </xs:simpleType>
148 </xs:attribute>
149 <xs:attribute name="runtime" default="Microsoft">
150 <xs:simpleType>
151 <xs:restriction base="xs:string">
152 <xs:enumeration value="Microsoft" />
153 <xs:enumeration value="Mono" />
154 </xs:restriction>
155 </xs:simpleType>
156 </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:enumeration value="v4_0" />
164 </xs:restriction>
165 </xs:simpleType>
166 </xs:attribute>
167 <xs:attribute name="startupObject" type="xs:string" default="" />
168 <xs:attribute name="rootNamespace" type="xs:string" />
169 <xs:attribute name="assemblyName" type="xs:string" />
170 <xs:attribute name="generateAssemblyInfoFile" type="xs:boolean" default="false" />
171 </xs:complexType>
172 </xs:element>
173
174 <xs:element name="Configuration">
175 <xs:complexType>
176 <xs:sequence>
177 <xs:element ref="Options" minOccurs="0" />
178 </xs:sequence>
179 <xs:attribute name="name" type="xs:string" use="required" />
180 <xs:attribute name="platform" type="xs:string" use="required" />
181 </xs:complexType>
182 </xs:element>
183 <xs:element name="Options">
184 <xs:complexType>
185 <xs:all>
186 <xs:element name="CompilerDefines" type="xs:string" minOccurs="0" />
187 <xs:element name="OptimizeCode" type="xs:boolean" minOccurs="0" />
188 <xs:element name="CheckUnderflowOverflow" type="xs:boolean" minOccurs="0" />
189 <xs:element name="AllowUnsafe" type="xs:boolean" minOccurs="0" />
190 <xs:element name="PreBuildEvent" type="xs:string" minOccurs="0" />
191 <xs:element name="PostBuildEvent" type="xs:string" minOccurs="0" />
192 <xs:element name="RunPostBuildEvent" minOccurs="0" default="OnBuildSuccess">
193 <xs:simpleType>
194 <xs:restriction base="xs:string">
195 <xs:enumeration value="OnBuildSuccess" />
196 <xs:enumeration value="Always" />
197 <xs:enumeration value="OnOutputUpdated" />
198 </xs:restriction>
199 </xs:simpleType>
200 </xs:element>
201 <xs:element name="RunScript" type="xs:string" minOccurs="0" />
202 <xs:element name="PreBuildEventArgs" type="xs:string" minOccurs="0" />
203 <xs:element name="PostBuildEventArgs" type="xs:string" minOccurs="0" />
204 <xs:element name="WarningLevel" minOccurs="0">
205 <xs:simpleType>
206 <xs:restriction base="xs:integer">
207 <xs:minInclusive value="0" />
208 <xs:maxInclusive value="4" />
209 </xs:restriction>
210 </xs:simpleType>
211 </xs:element>
212 <xs:element name="WarningsAsErrors" type="xs:boolean" minOccurs="0" />
213 <xs:element name="SuppressWarnings" type="xs:string" minOccurs="0" />
214 <xs:element name="OutputPath" type="xs:string" minOccurs="0" />
215 <xs:element name="GenerateDocumentation" type="xs:boolean" minOccurs="0" />
216 <xs:element name="XmlDocFile" type="xs:string" minOccurs="0" />
217 <xs:element name="DebugInformation" type="xs:boolean" minOccurs="0" />
218 <xs:element name="RegisterComInterop" type="xs:boolean" minOccurs="0" />
219 <xs:element name="RemoveIntegerChecks" type="xs:boolean" minOccurs="0" />
220 <xs:element name="IncrementalBuild" type="xs:boolean" minOccurs="0" />
221 <xs:element name="BaseAddress" type="xs:string" minOccurs="0" />
222 <xs:element name="FileAlignment" type="xs:integer" minOccurs="0" />
223 <xs:element name="NoStdLib" type="xs:boolean" minOccurs="0" />
224 <xs:element name="KeyFile" type="xs:string" minOccurs="0" />
225 </xs:all>
226 </xs:complexType>
227 </xs:element>
228 <xs:element name="Files">
229 <xs:complexType>
230 <xs:sequence>
231 <xs:element ref="File" minOccurs="0" maxOccurs="unbounded" />
232 <xs:element ref="Match" minOccurs="0" maxOccurs="unbounded" />
233 </xs:sequence>
234 </xs:complexType>
235 </xs:element>
236 <xs:element name="File">
237 <xs:complexType>
238 <xs:simpleContent>
239 <xs:extension base="xs:string">
240 <xs:attribute name="resourceName" type="xs:string" default="" />
241 <xs:attribute name="buildAction" default="Compile">
242 <xs:simpleType>
243 <xs:restriction base="xs:string">
244 <xs:enumeration value="None" />
245 <xs:enumeration value="Compile" />
246 <xs:enumeration value="Content" />
247 <xs:enumeration value="EmbeddedResource" />
248 <xs:enumeration value="ApplicationDefinition" />
249 <xs:enumeration value="Page" />
250 </xs:restriction>
251 </xs:simpleType>
252 </xs:attribute>
253 <xs:attribute name="subType" default="Code">
254 <xs:simpleType>
255 <xs:restriction base="xs:string">
256 <xs:enumeration value="Code" />
257 <xs:enumeration value="CodeBehind" />
258 <xs:enumeration value="Component" />
259 <xs:enumeration value="Form" />
260 <xs:enumeration value="Settings" />
261 <xs:enumeration value="UserControl" />
262 </xs:restriction>
263 </xs:simpleType>
264 </xs:attribute>
265 <xs:attribute name="link" type="xs:boolean" />
266 <xs:attribute name="copyToOutput" default="Never">
267 <xs:simpleType>
268 <xs:restriction base="xs:string">
269 <xs:enumeration value="Never" />
270 <xs:enumeration value="Always" />
271 <xs:enumeration value="PreserveNewest" />
272 </xs:restriction>
273 </xs:simpleType>
274 </xs:attribute>
275 <xs:attribute name="preservePath" type="xs:boolean" />
276 <xs:attribute name="linkPath" type="xs:string" />
277 </xs:extension>
278 </xs:simpleContent>
279 </xs:complexType>
280 </xs:element>
281 <xs:element name="Match">
282 <xs:complexType>
283 <xs:sequence>
284 <xs:element ref="Exclude" minOccurs="0" maxOccurs="unbounded" />
285 </xs:sequence>
286 <xs:attribute name="path" type="xs:string" />
287 <xs:attribute name="pattern" type="xs:string" use="required" />
288 <xs:attribute name="recurse" type="xs:boolean" default="false" />
289 <xs:attribute name="useRegex" type="xs:boolean" default="false" />
290 <xs:attribute name="buildAction" default="Compile">
291 <xs:simpleType>
292 <xs:restriction base="xs:string">
293 <xs:enumeration value="None" />
294 <xs:enumeration value="Compile" />
295 <xs:enumeration value="Content" />
296 <xs:enumeration value="EmbeddedResource" />
297 <xs:enumeration value="ApplicationDefinition" />
298 <xs:enumeration value="Page" />
299 </xs:restriction>
300 </xs:simpleType>
301 </xs:attribute>
302 <xs:attribute name="resourceName" type="xs:string" default="" />
303 <xs:attribute name="subType" default="Code">
304 <xs:simpleType>
305 <xs:restriction base="xs:string">
306 <xs:enumeration value="Code" />
307 <xs:enumeration value="CodeBehind" />
308 <xs:enumeration value="Component" />
309 <xs:enumeration value="Designer" />
310 <xs:enumeration value="Form" />
311 <xs:enumeration value="Settings" />
312 <xs:enumeration value="UserControl" />
313 </xs:restriction>
314 </xs:simpleType>
315 </xs:attribute>
316 <xs:attribute name="link" type="xs:boolean" />
317 <xs:attribute name="copyToOutput" default="Never">
318 <xs:simpleType>
319 <xs:restriction base="xs:string">
320 <xs:enumeration value="Never" />
321 <xs:enumeration value="Always" />
322 <xs:enumeration value="PreserveNewest" />
323 </xs:restriction>
324 </xs:simpleType>
325 </xs:attribute>
326 <xs:attribute name="preservePath" type="xs:boolean" />
327 <xs:attribute name="linkPath" type="xs:string" />
328 </xs:complexType>
329 </xs:element>
330 <xs:element name="Exclude">
331 <xs:complexType>
332 <xs:attribute name="name" type="xs:string" />
333 <xs:attribute name="pattern" type="xs:string" />
334 </xs:complexType>
335 </xs:element>
336</xs:schema>