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