aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Prebuild/src/Core
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--Prebuild/src/Core/Attributes/DataNodeAttribute.cs2
-rw-r--r--Prebuild/src/Core/Attributes/OptionNodeAttribute.cs2
-rw-r--r--Prebuild/src/Core/Attributes/TargetAttribute.cs2
-rw-r--r--Prebuild/src/Core/FatalException.cs2
-rw-r--r--Prebuild/src/Core/Interfaces/IDataNode.cs2
-rw-r--r--Prebuild/src/Core/Interfaces/ITarget.cs2
-rw-r--r--Prebuild/src/Core/Kernel.cs120
-rw-r--r--Prebuild/src/Core/Nodes/AuthorNode.cs98
-rw-r--r--Prebuild/src/Core/Nodes/ConfigurationNode.cs4
-rw-r--r--Prebuild/src/Core/Nodes/DataNode.cs2
-rw-r--r--Prebuild/src/Core/Nodes/DescriptionNode.cs98
-rw-r--r--Prebuild/src/Core/Nodes/ExcludeNode.cs27
-rw-r--r--Prebuild/src/Core/Nodes/FileNode.cs33
-rw-r--r--Prebuild/src/Core/Nodes/FilesNode.cs56
-rw-r--r--Prebuild/src/Core/Nodes/MatchNode.cs78
-rw-r--r--Prebuild/src/Core/Nodes/OptionsNode.cs2
-rw-r--r--Prebuild/src/Core/Nodes/ProcessNode.cs2
-rw-r--r--Prebuild/src/Core/Nodes/ProjectNode.cs79
-rw-r--r--Prebuild/src/Core/Nodes/ReferenceNode.cs4
-rw-r--r--Prebuild/src/Core/Nodes/ReferencePathNode.cs4
-rw-r--r--Prebuild/src/Core/Nodes/SolutionNode.cs34
-rw-r--r--Prebuild/src/Core/Parse/IfContext.cs2
-rw-r--r--Prebuild/src/Core/Parse/Preprocessor.cs4
-rw-r--r--Prebuild/src/Core/Targets/AutotoolsTarget.cs2408
-rw-r--r--Prebuild/src/Core/Targets/DebugTarget.cs2
-rw-r--r--Prebuild/src/Core/Targets/MakefileTarget.cs471
-rw-r--r--Prebuild/src/Core/Targets/MonoDevelopTarget.cs27
-rw-r--r--Prebuild/src/Core/Targets/NAntTarget.cs103
-rw-r--r--Prebuild/src/Core/Targets/SharpDevelop2Target.cs2
-rw-r--r--Prebuild/src/Core/Targets/SharpDevelopTarget.cs2
-rw-r--r--Prebuild/src/Core/Targets/VS2002Target.cs2
-rw-r--r--Prebuild/src/Core/Targets/VS2003Target.cs2
-rw-r--r--Prebuild/src/Core/Targets/VS2005Target.cs89
-rw-r--r--Prebuild/src/Core/Targets/XcodeTarget.cs605
-rw-r--r--Prebuild/src/Core/Utilities/CommandLineCollection.cs2
-rw-r--r--Prebuild/src/Core/Utilities/CurrentDirectory.cs2
-rw-r--r--Prebuild/src/Core/Utilities/Helper.cs2
-rw-r--r--Prebuild/src/Core/Utilities/Log.cs2
-rw-r--r--Prebuild/src/Core/WarningException.cs9
39 files changed, 3405 insertions, 984 deletions
diff --git a/Prebuild/src/Core/Attributes/DataNodeAttribute.cs b/Prebuild/src/Core/Attributes/DataNodeAttribute.cs
index 0786fe5..cdd0e0d 100644
--- a/Prebuild/src/Core/Attributes/DataNodeAttribute.cs
+++ b/Prebuild/src/Core/Attributes/DataNodeAttribute.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-01-28 01:49:58 +0100 (, 28 jan 2006) $ 30 * $Date: 2006-01-28 09:49:58 +0900 (Sat, 28 Jan 2006) $
31 * $Revision: 71 $ 31 * $Revision: 71 $
32 */ 32 */
33#endregion 33#endregion
diff --git a/Prebuild/src/Core/Attributes/OptionNodeAttribute.cs b/Prebuild/src/Core/Attributes/OptionNodeAttribute.cs
index a63e840..5cefe68 100644
--- a/Prebuild/src/Core/Attributes/OptionNodeAttribute.cs
+++ b/Prebuild/src/Core/Attributes/OptionNodeAttribute.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-01-28 01:49:58 +0100 (, 28 jan 2006) $ 30 * $Date: 2006-01-28 09:49:58 +0900 (Sat, 28 Jan 2006) $
31 * $Revision: 71 $ 31 * $Revision: 71 $
32 */ 32 */
33#endregion 33#endregion
diff --git a/Prebuild/src/Core/Attributes/TargetAttribute.cs b/Prebuild/src/Core/Attributes/TargetAttribute.cs
index 8724d69..b17cc5b 100644
--- a/Prebuild/src/Core/Attributes/TargetAttribute.cs
+++ b/Prebuild/src/Core/Attributes/TargetAttribute.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-01-28 01:49:58 +0100 (, 28 jan 2006) $ 30 * $Date: 2006-01-28 09:49:58 +0900 (Sat, 28 Jan 2006) $
31 * $Revision: 71 $ 31 * $Revision: 71 $
32 */ 32 */
33#endregion 33#endregion
diff --git a/Prebuild/src/Core/FatalException.cs b/Prebuild/src/Core/FatalException.cs
index a997c98..784c35d 100644
--- a/Prebuild/src/Core/FatalException.cs
+++ b/Prebuild/src/Core/FatalException.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-01-28 01:49:58 +0100 (, 28 jan 2006) $ 30 * $Date: 2006-01-28 09:49:58 +0900 (Sat, 28 Jan 2006) $
31 * $Revision: 71 $ 31 * $Revision: 71 $
32 */ 32 */
33#endregion 33#endregion
diff --git a/Prebuild/src/Core/Interfaces/IDataNode.cs b/Prebuild/src/Core/Interfaces/IDataNode.cs
index 2562b1d..7583fd2 100644
--- a/Prebuild/src/Core/Interfaces/IDataNode.cs
+++ b/Prebuild/src/Core/Interfaces/IDataNode.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-01-28 01:49:58 +0100 (, 28 jan 2006) $ 30 * $Date: 2006-01-28 09:49:58 +0900 (Sat, 28 Jan 2006) $
31 * $Revision: 71 $ 31 * $Revision: 71 $
32 */ 32 */
33#endregion 33#endregion
diff --git a/Prebuild/src/Core/Interfaces/ITarget.cs b/Prebuild/src/Core/Interfaces/ITarget.cs
index e74ff9a..77006d7 100644
--- a/Prebuild/src/Core/Interfaces/ITarget.cs
+++ b/Prebuild/src/Core/Interfaces/ITarget.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-01-28 01:49:58 +0100 (, 28 jan 2006) $ 30 * $Date: 2006-01-28 09:49:58 +0900 (Sat, 28 Jan 2006) $
31 * $Revision: 71 $ 31 * $Revision: 71 $
32 */ 32 */
33#endregion 33#endregion
diff --git a/Prebuild/src/Core/Kernel.cs b/Prebuild/src/Core/Kernel.cs
index 170d0f5..1f0ad70 100644
--- a/Prebuild/src/Core/Kernel.cs
+++ b/Prebuild/src/Core/Kernel.cs
@@ -1,34 +1,47 @@
1#region BSD License 1#region BSD License
2/* 2/*
3Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) 3Copyright (c) 2004-2008
4 4Matthew Holmes (matthew@wildfiregames.com),
5Redistribution and use in source and binary forms, with or without modification, are permitted 5Dan Moorehead (dan05a@gmail.com),
6provided that the following conditions are met: 6Rob Loach (http://www.robloach.net),
7 7C.J. Adams-Collier (cjac@colliertech.org)
8* Redistributions of source code must retain the above copyright notice, this list of conditions 8
9 and the following disclaimer. 9Redistribution and use in source and binary forms, with or without
10* Redistributions in binary form must reproduce the above copyright notice, this list of conditions 10modification, are permitted provided that the following conditions are
11 and the following disclaimer in the documentation and/or other materials provided with the 11met:
12 distribution. 12
13* The name of the author may not be used to endorse or promote products derived from this software 13* Redistributions of source code must retain the above copyright
14 without specific prior written permission. 14 notice, this list of conditions and the following disclaimer.
15 15
16THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, 16* Redistributions in binary form must reproduce the above copyright
17BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17 notice, this list of conditions and the following disclaimer in the
18ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 18 documentation and/or other materials provided with the distribution.
19EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 19
20OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 20* The name of the author may not be used to endorse or promote
21OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 21 products derived from this software without specific prior written
22IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 22 permission.
23
24THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
25IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
26WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
27DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
28INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
29(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
30SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
32STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
33IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34POSSIBILITY OF SUCH DAMAGE.
35
23*/ 36*/
24#endregion 37#endregion
25 38
26#region CVS Information 39#region CVS Information
27/* 40/*
28 * $Source$ 41 * $Source$
29 * $Author: robloach $ 42 * $Author: cjcollier $
30 * $Date: 2006-09-26 00:30:53 +0200 (ti, 26 sep 2006) $ 43 * $Date: 2008-02-08 01:31:29 +0900 (Fri, 08 Feb 2008) $
31 * $Revision: 165 $ 44 * $Revision: 256 $
32 */ 45 */
33#endregion 46#endregion
34 47
@@ -91,6 +104,7 @@ namespace Prebuild.Core
91 string m_Clean; 104 string m_Clean;
92 string[] m_RemoveDirectories; 105 string[] m_RemoveDirectories;
93 string m_CurrentFile; 106 string m_CurrentFile;
107 XmlDocument m_CurrentDoc;
94 bool m_PauseAfterFinish; 108 bool m_PauseAfterFinish;
95 string[] m_ProjectGroups; 109 string[] m_ProjectGroups;
96 StringCollection m_Refs; 110 StringCollection m_Refs;
@@ -203,6 +217,19 @@ namespace Prebuild.Core
203 return m_Solutions; 217 return m_Solutions;
204 } 218 }
205 } 219 }
220
221 /// <summary>
222 /// Gets the XmlDocument object representing the prebuild.xml
223 /// being processed
224 /// </summary>
225 /// <value>The XmlDocument object</value>
226 public XmlDocument CurrentDoc
227 {
228 get
229 {
230 return m_CurrentDoc;
231 }
232 }
206 233
207 #endregion 234 #endregion
208 235
@@ -304,10 +331,16 @@ namespace Prebuild.Core
304 331
305 private void LogBanner() 332 private void LogBanner()
306 { 333 {
307 m_Log.Write("Prebuild v" + this.Version); 334 m_Log.Write("Prebuild v" + this.Version);
308 m_Log.Write("Copyright (c) Matthew Holmes, Dan Moorehead and David Hudson"); 335 m_Log.Write("Copyright (c) 2004-2008");
309 m_Log.Write("See 'prebuild /usage' for help"); 336 m_Log.Write("Matthew Holmes (matthew@wildfiregames.com),");
310 m_Log.Write(); 337 m_Log.Write("Dan Moorehead (dan05a@gmail.com),");
338 m_Log.Write("David Hudson (jendave@yahoo.com),");
339 m_Log.Write("Rob Loach (http://www.robloach.net),");
340 m_Log.Write("C.J. Adams-Collier (cjac@colliertech.org),");
341
342 m_Log.Write("See 'prebuild /usage' for help");
343 m_Log.Write();
311 } 344 }
312 345
313 private void ProcessFile(string file) 346 private void ProcessFile(string file)
@@ -330,7 +363,6 @@ namespace Prebuild.Core
330 363
331 m_CurrentFile = path; 364 m_CurrentFile = path;
332 Helper.SetCurrentDir(Path.GetDirectoryName(path)); 365 Helper.SetCurrentDir(Path.GetDirectoryName(path));
333
334 366
335 XmlTextReader reader = new XmlTextReader(path); 367 XmlTextReader reader = new XmlTextReader(path);
336 368
@@ -348,7 +380,7 @@ namespace Prebuild.Core
348 string xml = pre.Process(reader);//remove script and evaulate pre-proccessing to get schema-conforming XML 380 string xml = pre.Process(reader);//remove script and evaulate pre-proccessing to get schema-conforming XML
349 381
350 382
351 XmlDocument doc = new XmlDocument(); 383 m_CurrentDoc = new XmlDocument();
352 try 384 try
353 { 385 {
354 XmlValidatingReader validator = new XmlValidatingReader(new XmlTextReader(new StringReader(xml))); 386 XmlValidatingReader validator = new XmlValidatingReader(new XmlTextReader(new StringReader(xml)));
@@ -358,7 +390,7 @@ namespace Prebuild.Core
358 { 390 {
359 validator.Schemas.Add(schema); 391 validator.Schemas.Add(schema);
360 } 392 }
361 doc.Load(validator); 393 m_CurrentDoc.Load(validator);
362 } 394 }
363 catch(XmlException e) 395 catch(XmlException e)
364 { 396 {
@@ -394,7 +426,7 @@ namespace Prebuild.Core
394 return; 426 return;
395 } 427 }
396 //start reading the xml config file 428 //start reading the xml config file
397 XmlElement rootNode = doc.DocumentElement; 429 XmlElement rootNode = m_CurrentDoc.DocumentElement;
398 //string suggestedVersion = Helper.AttributeValue(rootNode,"version","1.0"); 430 //string suggestedVersion = Helper.AttributeValue(rootNode,"version","1.0");
399 Helper.CheckForOSVariables = Helper.ParseBoolean(rootNode,"checkOsVars",false); 431 Helper.CheckForOSVariables = Helper.ParseBoolean(rootNode,"checkOsVars",false);
400 432
@@ -681,17 +713,21 @@ namespace Prebuild.Core
681 } 713 }
682 else 714 else
683 { 715 {
684 ITarget targ = (ITarget)m_Targets[target]; 716 if (!m_Targets.Contains(target)) {
717 m_Log.Write(LogType.Error, "Unknown Target \"{0}\"", target);
718 return;
719 }
720 ITarget targ = (ITarget)m_Targets[target];
685 721
686 if(clean) 722 if(clean)
687 { 723 {
688 targ.Clean(this); 724 targ.Clean(this);
689 } 725 }
690 else 726 else
691 { 727 {
692 targ.Write(this); 728 targ.Write(this);
693 } 729 }
694 } 730 }
695 731
696 m_Log.Flush(); 732 m_Log.Flush();
697 } 733 }
@@ -755,4 +791,4 @@ namespace Prebuild.Core
755 791
756 #endregion 792 #endregion
757 } 793 }
758} \ No newline at end of file 794}
diff --git a/Prebuild/src/Core/Nodes/AuthorNode.cs b/Prebuild/src/Core/Nodes/AuthorNode.cs
new file mode 100644
index 0000000..03ea934
--- /dev/null
+++ b/Prebuild/src/Core/Nodes/AuthorNode.cs
@@ -0,0 +1,98 @@
1#region BSD License
2/*
3Copyright (c) 2007 C.J. Adams-Collier (cjac@colliertech.org)
4
5Redistribution and use in source and binary forms, with or without modification, are permitted
6provided that the following conditions are met:
7
8* Redistributions of source code must retain the above copyright notice, this list of conditions
9 and the following disclaimer.
10* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
11 and the following disclaimer in the documentation and/or other materials provided with the
12 distribution.
13* The name of the author may not be used to endorse or promote products derived from this software
14 without specific prior written permission.
15
16THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
17BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
19EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
22IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23*/
24#endregion
25
26#region CVS Information
27/*
28 * $Source $
29 * $Author: $
30 * $Date: $
31 * $Revision: $
32 */
33#endregion
34
35using System;
36using System.Collections;
37using System.Collections.Specialized;
38using System.Xml;
39
40using Prebuild.Core.Attributes;
41using Prebuild.Core.Interfaces;
42using Prebuild.Core.Utilities;
43
44namespace Prebuild.Core.Nodes
45{
46 /// <summary>
47 ///
48 /// </summary>
49 [DataNode("Author")]
50 public class AuthorNode : DataNode
51 {
52 #region Fields
53
54 private string m_Signature;
55
56 #endregion
57
58 #region Properties
59
60 /// <summary>
61 /// Gets the signature.
62 /// </summary>
63 /// <value>The signature.</value>
64 public string Signature
65 {
66 get
67 {
68 return m_Signature;
69 }
70 }
71
72 #endregion
73
74 #region Public Methods
75
76 /// <summary>
77 /// Parses the specified node.
78 /// </summary>
79 /// <param name="node">The node.</param>
80 public override void Parse(XmlNode node)
81 {
82 if( node == null )
83 {
84 throw new ArgumentNullException("node");
85 }
86
87 m_Signature = Helper.InterpolateForEnvironmentVariables(node.InnerText);
88 if(m_Signature == null)
89 {
90 m_Signature = "";
91 }
92
93 m_Signature = m_Signature.Trim();
94 }
95
96 #endregion
97 }
98}
diff --git a/Prebuild/src/Core/Nodes/ConfigurationNode.cs b/Prebuild/src/Core/Nodes/ConfigurationNode.cs
index d2a5d20..828bff6 100644
--- a/Prebuild/src/Core/Nodes/ConfigurationNode.cs
+++ b/Prebuild/src/Core/Nodes/ConfigurationNode.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-01-28 01:49:58 +0100 (, 28 jan 2006) $ 30 * $Date: 2006-01-28 09:49:58 +0900 (Sat, 28 Jan 2006) $
31 * $Revision: 71 $ 31 * $Revision: 71 $
32 */ 32 */
33#endregion 33#endregion
@@ -183,5 +183,5 @@ namespace Prebuild.Core.Nodes
183 } 183 }
184 184
185 #endregion 185 #endregion
186 } 186 }
187} 187}
diff --git a/Prebuild/src/Core/Nodes/DataNode.cs b/Prebuild/src/Core/Nodes/DataNode.cs
index aa05faa..60ed122 100644
--- a/Prebuild/src/Core/Nodes/DataNode.cs
+++ b/Prebuild/src/Core/Nodes/DataNode.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-01-28 01:49:58 +0100 (, 28 jan 2006) $ 30 * $Date: 2006-01-28 09:49:58 +0900 (Sat, 28 Jan 2006) $
31 * $Revision: 71 $ 31 * $Revision: 71 $
32 */ 32 */
33#endregion 33#endregion
diff --git a/Prebuild/src/Core/Nodes/DescriptionNode.cs b/Prebuild/src/Core/Nodes/DescriptionNode.cs
new file mode 100644
index 0000000..cff7afc
--- /dev/null
+++ b/Prebuild/src/Core/Nodes/DescriptionNode.cs
@@ -0,0 +1,98 @@
1#region BSD License
2/*
3Copyright (c) 2007 C.J. Adams-Collier (cjac@colliertech.org)
4
5Redistribution and use in source and binary forms, with or without modification, are permitted
6provided that the following conditions are met:
7
8* Redistributions of source code must retain the above copyright notice, this list of conditions
9 and the following disclaimer.
10* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
11 and the following disclaimer in the documentation and/or other materials provided with the
12 distribution.
13* The name of the author may not be used to endorse or promote products derived from this software
14 without specific prior written permission.
15
16THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
17BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
19EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
22IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23*/
24#endregion
25
26#region CVS Information
27/*
28 * $Source $
29 * $Author: $
30 * $Date: $
31 * $Revision: $
32 */
33#endregion
34
35using System;
36using System.Collections;
37using System.Collections.Specialized;
38using System.Xml;
39
40using Prebuild.Core.Attributes;
41using Prebuild.Core.Interfaces;
42using Prebuild.Core.Utilities;
43
44namespace Prebuild.Core.Nodes
45{
46 /// <summary>
47 /// The object representing the /Prebuild/Solution/Project/Description element
48 /// </summary>
49 [DataNode("Description")]
50 public class DescriptionNode : DataNode
51 {
52 #region Fields
53
54 private string m_Value;
55
56 #endregion
57
58 #region Properties
59
60 /// <summary>
61 /// Gets the description Value.
62 /// </summary>
63 /// <value>The description Value.</value>
64 public string Value
65 {
66 get
67 {
68 return m_Value;
69 }
70 }
71
72 #endregion
73
74 #region Public Methods
75
76 /// <summary>
77 /// Parses the specified node.
78 /// </summary>
79 /// <param name="node">The node.</param>
80 public override void Parse(XmlNode node)
81 {
82 if( node == null )
83 {
84 throw new ArgumentNullException("node");
85 }
86
87 m_Value = Helper.InterpolateForEnvironmentVariables(node.InnerText);
88 if(m_Value == null)
89 {
90 m_Value = "";
91 }
92
93 m_Value = m_Value.Trim();
94 }
95
96 #endregion
97 }
98}
diff --git a/Prebuild/src/Core/Nodes/ExcludeNode.cs b/Prebuild/src/Core/Nodes/ExcludeNode.cs
index 905626d..afc869d 100644
--- a/Prebuild/src/Core/Nodes/ExcludeNode.cs
+++ b/Prebuild/src/Core/Nodes/ExcludeNode.cs
@@ -26,9 +26,9 @@ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY O
26#region CVS Information 26#region CVS Information
27/* 27/*
28 * $Source$ 28 * $Source$
29 * $Author: jendave $ 29 * $Author: borrillis $
30 * $Date: 2006-01-31 16:35:39 +0100 (ti, 31 jan 2006) $ 30 * $Date: 2007-05-25 01:03:16 +0900 (Fri, 25 May 2007) $
31 * $Revision: 74 $ 31 * $Revision: 243 $
32 */ 32 */
33#endregion 33#endregion
34 34
@@ -49,7 +49,7 @@ namespace Prebuild.Core.Nodes
49 { 49 {
50 #region Fields 50 #region Fields
51 51
52 private string m_Name = "unknown"; 52 private string m_Pattern = "";
53 53
54 #endregion 54 #endregion
55 55
@@ -63,11 +63,23 @@ namespace Prebuild.Core.Nodes
63 { 63 {
64 get 64 get
65 { 65 {
66 return m_Name; 66 return m_Pattern;
67 } 67 }
68 } 68 }
69 69
70 #endregion 70 /// <summary>
71 /// Gets the pattern.
72 /// </summary>
73 /// <value>The pattern.</value>
74 public string Pattern
75 {
76 get
77 {
78 return m_Pattern;
79 }
80 }
81
82 #endregion
71 83
72 #region Public Methods 84 #region Public Methods
73 85
@@ -77,7 +89,8 @@ namespace Prebuild.Core.Nodes
77 /// <param name="node">The node.</param> 89 /// <param name="node">The node.</param>
78 public override void Parse(XmlNode node) 90 public override void Parse(XmlNode node)
79 { 91 {
80 m_Name = Helper.AttributeValue(node, "name", m_Name); 92 m_Pattern = Helper.AttributeValue( node, "name", m_Pattern );
93 m_Pattern = Helper.AttributeValue(node, "pattern", m_Pattern );
81 } 94 }
82 95
83 #endregion 96 #endregion
diff --git a/Prebuild/src/Core/Nodes/FileNode.cs b/Prebuild/src/Core/Nodes/FileNode.cs
index ab0a2a3..083dba5 100644
--- a/Prebuild/src/Core/Nodes/FileNode.cs
+++ b/Prebuild/src/Core/Nodes/FileNode.cs
@@ -26,9 +26,9 @@ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY O
26#region CVS Information 26#region CVS Information
27/* 27/*
28 * $Source$ 28 * $Source$
29 * $Author: jendave $ 29 * $Author: borrillis $
30 * $Date: 2007-01-08 17:55:40 +0100 (, 08 jan 2007) $ 30 * $Date: 2007-05-25 01:03:16 +0900 (Fri, 25 May 2007) $
31 * $Revision: 197 $ 31 * $Revision: 243 $
32 */ 32 */
33#endregion 33#endregion
34 34
@@ -118,6 +118,8 @@ namespace Prebuild.Core.Nodes
118 private SubType m_SubType = SubType.Code; 118 private SubType m_SubType = SubType.Code;
119 private CopyToOutput m_CopyToOutput = CopyToOutput.Never; 119 private CopyToOutput m_CopyToOutput = CopyToOutput.Never;
120 private bool m_Link = false; 120 private bool m_Link = false;
121 private string m_LinkPath = string.Empty;
122 private bool m_PreservePath = false;
121 123
122 124
123 #endregion 125 #endregion
@@ -173,6 +175,13 @@ namespace Prebuild.Core.Nodes
173 } 175 }
174 } 176 }
175 177
178 public string LinkPath
179 {
180 get
181 {
182 return this.m_LinkPath;
183 }
184 }
176 /// <summary> 185 /// <summary>
177 /// 186 ///
178 /// </summary> 187 /// </summary>
@@ -195,6 +204,19 @@ namespace Prebuild.Core.Nodes
195 } 204 }
196 } 205 }
197 206
207 /// <summary>
208 ///
209 /// </summary>
210 /// <param name="file"></param>
211 /// <returns></returns>
212 public bool PreservePath
213 {
214 get
215 {
216 return m_PreservePath;
217 }
218 }
219
198 #endregion 220 #endregion
199 221
200 #region Public Methods 222 #region Public Methods
@@ -211,7 +233,12 @@ namespace Prebuild.Core.Nodes
211 Helper.AttributeValue(node, "subType", m_SubType.ToString())); 233 Helper.AttributeValue(node, "subType", m_SubType.ToString()));
212 m_ResourceName = Helper.AttributeValue(node, "resourceName", m_ResourceName.ToString()); 234 m_ResourceName = Helper.AttributeValue(node, "resourceName", m_ResourceName.ToString());
213 this.m_Link = bool.Parse(Helper.AttributeValue(node, "link", bool.FalseString)); 235 this.m_Link = bool.Parse(Helper.AttributeValue(node, "link", bool.FalseString));
236 if ( this.m_Link == true )
237 {
238 this.m_LinkPath = Helper.AttributeValue( node, "linkPath", string.Empty );
239 }
214 this.m_CopyToOutput = (CopyToOutput) Enum.Parse(typeof(CopyToOutput), Helper.AttributeValue(node, "copyToOutput", this.m_CopyToOutput.ToString())); 240 this.m_CopyToOutput = (CopyToOutput) Enum.Parse(typeof(CopyToOutput), Helper.AttributeValue(node, "copyToOutput", this.m_CopyToOutput.ToString()));
241 this.m_PreservePath = bool.Parse( Helper.AttributeValue( node, "preservePath", bool.FalseString ) );
215 242
216 if( node == null ) 243 if( node == null )
217 { 244 {
diff --git a/Prebuild/src/Core/Nodes/FilesNode.cs b/Prebuild/src/Core/Nodes/FilesNode.cs
index 05b2255..7c1dd19 100644
--- a/Prebuild/src/Core/Nodes/FilesNode.cs
+++ b/Prebuild/src/Core/Nodes/FilesNode.cs
@@ -26,9 +26,9 @@ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY O
26#region CVS Information 26#region CVS Information
27/* 27/*
28 * $Source$ 28 * $Source$
29 * $Author: jendave $ 29 * $Author: borrillis $
30 * $Date: 2006-09-20 09:42:51 +0200 (on, 20 sep 2006) $ 30 * $Date: 2007-05-25 01:03:16 +0900 (Fri, 25 May 2007) $
31 * $Revision: 164 $ 31 * $Revision: 243 $
32 */ 32 */
33#endregion 33#endregion
34 34
@@ -56,7 +56,8 @@ namespace Prebuild.Core.Nodes
56 private Hashtable m_ResourceNames; 56 private Hashtable m_ResourceNames;
57 private Hashtable m_CopyToOutputs; 57 private Hashtable m_CopyToOutputs;
58 private Hashtable m_Links; 58 private Hashtable m_Links;
59 59 private Hashtable m_LinkPaths;
60 private Hashtable m_PreservePaths;
60 61
61 #endregion 62 #endregion
62 63
@@ -73,7 +74,9 @@ namespace Prebuild.Core.Nodes
73 m_ResourceNames = new Hashtable(); 74 m_ResourceNames = new Hashtable();
74 m_CopyToOutputs = new Hashtable(); 75 m_CopyToOutputs = new Hashtable();
75 m_Links = new Hashtable(); 76 m_Links = new Hashtable();
76 } 77 m_LinkPaths = new Hashtable();
78 m_PreservePaths = new Hashtable();
79 }
77 80
78 #endregion 81 #endregion
79 82
@@ -127,6 +130,15 @@ namespace Prebuild.Core.Nodes
127 return (bool) this.m_Links[file]; 130 return (bool) this.m_Links[file];
128 } 131 }
129 132
133 public string GetLinkPath( string file )
134 {
135 if ( !this.m_LinkPaths.ContainsKey( file ) )
136 {
137 return string.Empty;
138 }
139 return (string)this.m_LinkPaths[ file ];
140 }
141
130 /// <summary> 142 /// <summary>
131 /// 143 ///
132 /// </summary> 144 /// </summary>
@@ -157,6 +169,21 @@ namespace Prebuild.Core.Nodes
157 return (string)m_ResourceNames[file]; 169 return (string)m_ResourceNames[file];
158 } 170 }
159 171
172 /// <summary>
173 ///
174 /// </summary>
175 /// <param name="file"></param>
176 /// <returns></returns>
177 public bool GetPreservePath( string file )
178 {
179 if ( !m_PreservePaths.ContainsKey( file ) )
180 {
181 return false;
182 }
183
184 return (bool)m_PreservePaths[ file ];
185 }
186
160 /// <summary> 187 /// <summary>
161 /// 188 ///
162 /// </summary> 189 /// </summary>
@@ -181,8 +208,10 @@ namespace Prebuild.Core.Nodes
181 m_BuildActions[fileNode.Path] = fileNode.BuildAction; 208 m_BuildActions[fileNode.Path] = fileNode.BuildAction;
182 m_SubTypes[fileNode.Path] = fileNode.SubType; 209 m_SubTypes[fileNode.Path] = fileNode.SubType;
183 m_ResourceNames[fileNode.Path] = fileNode.ResourceName; 210 m_ResourceNames[fileNode.Path] = fileNode.ResourceName;
184 this.m_Links[fileNode.Path] = fileNode.IsLink; 211 this.m_PreservePaths[ fileNode.Path ] = fileNode.PreservePath;
185 this.m_CopyToOutputs[fileNode.Path] = fileNode.CopyToOutput; 212 this.m_Links[ fileNode.Path ] = fileNode.IsLink;
213 this.m_LinkPaths[ fileNode.Path ] = fileNode.LinkPath;
214 this.m_CopyToOutputs[ fileNode.Path ] = fileNode.CopyToOutput;
186 215
187 } 216 }
188 } 217 }
@@ -191,14 +220,17 @@ namespace Prebuild.Core.Nodes
191 { 220 {
192 foreach(string file in ((MatchNode)dataNode).Files) 221 foreach(string file in ((MatchNode)dataNode).Files)
193 { 222 {
223 MatchNode matchNode = (MatchNode)dataNode;
194 if (!m_Files.Contains(file)) 224 if (!m_Files.Contains(file))
195 { 225 {
196 m_Files.Add(file); 226 m_Files.Add(file);
197 m_BuildActions[file] = ((MatchNode)dataNode).BuildAction; 227 m_BuildActions[ file ] = matchNode.BuildAction;
198 m_SubTypes[file] = ((MatchNode)dataNode).SubType; 228 m_SubTypes[ file ] = matchNode.SubType;
199 m_ResourceNames[file] = ((MatchNode)dataNode).ResourceName; 229 m_ResourceNames[ file ] = matchNode.ResourceName;
200 this.m_Links[file] = ((MatchNode) dataNode).IsLink; 230 this.m_PreservePaths[ file ] = matchNode.PreservePath;
201 this.m_CopyToOutputs[file] = ((MatchNode) dataNode).CopyToOutput; 231 this.m_Links[ file ] = matchNode.IsLink;
232 this.m_LinkPaths[ file ] = matchNode.LinkPath;
233 this.m_CopyToOutputs[ file ] = matchNode.CopyToOutput;
202 234
203 } 235 }
204 } 236 }
diff --git a/Prebuild/src/Core/Nodes/MatchNode.cs b/Prebuild/src/Core/Nodes/MatchNode.cs
index 8d7b467..aeaf3c1 100644
--- a/Prebuild/src/Core/Nodes/MatchNode.cs
+++ b/Prebuild/src/Core/Nodes/MatchNode.cs
@@ -26,9 +26,9 @@ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY O
26#region CVS Information 26#region CVS Information
27/* 27/*
28 * $Source$ 28 * $Source$
29 * $Author: jendave $ 29 * $Author: borrillis $
30 * $Date: 2006-09-20 09:42:51 +0200 (on, 20 sep 2006) $ 30 * $Date: 2007-05-25 01:03:16 +0900 (Fri, 25 May 2007) $
31 * $Revision: 164 $ 31 * $Revision: 243 $
32 */ 32 */
33#endregion 33#endregion
34 34
@@ -41,6 +41,7 @@ using System.Xml;
41using Prebuild.Core.Attributes; 41using Prebuild.Core.Attributes;
42using Prebuild.Core.Interfaces; 42using Prebuild.Core.Interfaces;
43using Prebuild.Core.Utilities; 43using Prebuild.Core.Utilities;
44using System.Collections;
44 45
45namespace Prebuild.Core.Nodes 46namespace Prebuild.Core.Nodes
46{ 47{
@@ -59,7 +60,9 @@ namespace Prebuild.Core.Nodes
59 string m_ResourceName = ""; 60 string m_ResourceName = "";
60 private CopyToOutput m_CopyToOutput; 61 private CopyToOutput m_CopyToOutput;
61 private bool m_Link; 62 private bool m_Link;
62 63 private string m_LinkPath;
64 private bool m_PreservePath;
65 private ArrayList m_Exclusions;
63 66
64 #endregion 67 #endregion
65 68
@@ -71,6 +74,7 @@ namespace Prebuild.Core.Nodes
71 public MatchNode() 74 public MatchNode()
72 { 75 {
73 m_Files = new StringCollection(); 76 m_Files = new StringCollection();
77 m_Exclusions = new ArrayList();
74 } 78 }
75 79
76 #endregion 80 #endregion
@@ -126,6 +130,13 @@ namespace Prebuild.Core.Nodes
126 } 130 }
127 } 131 }
128 132
133 public string LinkPath
134 {
135 get
136 {
137 return this.m_LinkPath;
138 }
139 }
129 /// <summary> 140 /// <summary>
130 /// 141 ///
131 /// </summary> 142 /// </summary>
@@ -137,6 +148,13 @@ namespace Prebuild.Core.Nodes
137 } 148 }
138 } 149 }
139 150
151 public bool PreservePath
152 {
153 get
154 {
155 return m_PreservePath;
156 }
157 }
140 158
141 #endregion 159 #endregion
142 160
@@ -149,8 +167,10 @@ namespace Prebuild.Core.Nodes
149 /// <param name="pattern">The pattern.</param> 167 /// <param name="pattern">The pattern.</param>
150 /// <param name="recurse">if set to <c>true</c> [recurse].</param> 168 /// <param name="recurse">if set to <c>true</c> [recurse].</param>
151 /// <param name="useRegex">if set to <c>true</c> [use regex].</param> 169 /// <param name="useRegex">if set to <c>true</c> [use regex].</param>
152 private void RecurseDirectories(string path, string pattern, bool recurse, bool useRegex) 170 private void RecurseDirectories(string path, string pattern, bool recurse, bool useRegex, ArrayList exclusions)
153 { 171 {
172 Match match;
173 Boolean excludeFile;
154 try 174 try
155 { 175 {
156 string[] files; 176 string[] files;
@@ -163,6 +183,7 @@ namespace Prebuild.Core.Nodes
163 string fileTemp; 183 string fileTemp;
164 foreach (string file in files) 184 foreach (string file in files)
165 { 185 {
186 excludeFile = false;
166 if (file.Substring(0,2) == "./" || file.Substring(0,2) == ".\\") 187 if (file.Substring(0,2) == "./" || file.Substring(0,2) == ".\\")
167 { 188 {
168 fileTemp = file.Substring(2); 189 fileTemp = file.Substring(2);
@@ -171,8 +192,20 @@ namespace Prebuild.Core.Nodes
171 { 192 {
172 fileTemp = file; 193 fileTemp = file;
173 } 194 }
174 195
175 m_Files.Add(fileTemp); 196 // Check all excludions and set flag if there are any hits.
197 foreach ( ExcludeNode exclude in exclusions )
198 {
199 Regex exRegEx = new Regex( exclude.Pattern );
200 match = exRegEx.Match( file );
201 excludeFile |= match.Success;
202 }
203
204 if ( !excludeFile )
205 {
206 m_Files.Add( fileTemp );
207 }
208
176 } 209 }
177 } 210 }
178 else 211 else
@@ -182,14 +215,26 @@ namespace Prebuild.Core.Nodes
182 } 215 }
183 else 216 else
184 { 217 {
185 Match match;
186 files = Directory.GetFiles(path); 218 files = Directory.GetFiles(path);
187 foreach(string file in files) 219 foreach(string file in files)
188 { 220 {
221 excludeFile = false;
222
189 match = m_Regex.Match(file); 223 match = m_Regex.Match(file);
190 if(match.Success) 224 if(match.Success)
191 { 225 {
192 m_Files.Add(file); 226 // Check all excludions and set flag if there are any hits.
227 foreach ( ExcludeNode exclude in exclusions )
228 {
229 Regex exRegEx = new Regex( exclude.Pattern );
230 match = exRegEx.Match( file );
231 excludeFile |= !match.Success;
232 }
233
234 if ( !excludeFile )
235 {
236 m_Files.Add( file );
237 }
193 } 238 }
194 } 239 }
195 } 240 }
@@ -201,7 +246,7 @@ namespace Prebuild.Core.Nodes
201 { 246 {
202 foreach(string str in dirs) 247 foreach(string str in dirs)
203 { 248 {
204 RecurseDirectories(Helper.NormalizePath(str), pattern, recurse, useRegex); 249 RecurseDirectories(Helper.NormalizePath(str), pattern, recurse, useRegex, exclusions);
205 } 250 }
206 } 251 }
207 } 252 }
@@ -241,6 +286,11 @@ namespace Prebuild.Core.Nodes
241 m_ResourceName = Helper.AttributeValue(node, "resourceName", m_ResourceName.ToString()); 286 m_ResourceName = Helper.AttributeValue(node, "resourceName", m_ResourceName.ToString());
242 this.m_CopyToOutput = (CopyToOutput) Enum.Parse(typeof(CopyToOutput), Helper.AttributeValue(node, "copyToOutput", this.m_CopyToOutput.ToString())); 287 this.m_CopyToOutput = (CopyToOutput) Enum.Parse(typeof(CopyToOutput), Helper.AttributeValue(node, "copyToOutput", this.m_CopyToOutput.ToString()));
243 this.m_Link = bool.Parse(Helper.AttributeValue(node, "link", bool.FalseString)); 288 this.m_Link = bool.Parse(Helper.AttributeValue(node, "link", bool.FalseString));
289 if ( this.m_Link == true )
290 {
291 this.m_LinkPath = Helper.AttributeValue( node, "linkPath", string.Empty );
292 }
293 this.m_PreservePath = bool.Parse( Helper.AttributeValue( node, "preservePath", bool.FalseString ) );
244 294
245 295
246 if(path != null && path.Length == 0) 296 if(path != null && path.Length == 0)
@@ -272,7 +322,6 @@ namespace Prebuild.Core.Nodes
272 throw new WarningException("Could not compile regex pattern: {0}", ex.Message); 322 throw new WarningException("Could not compile regex pattern: {0}", ex.Message);
273 } 323 }
274 324
275 RecurseDirectories(path, pattern, recurse, useRegex);
276 325
277 foreach(XmlNode child in node.ChildNodes) 326 foreach(XmlNode child in node.ChildNodes)
278 { 327 {
@@ -280,13 +329,12 @@ namespace Prebuild.Core.Nodes
280 if(dataNode is ExcludeNode) 329 if(dataNode is ExcludeNode)
281 { 330 {
282 ExcludeNode excludeNode = (ExcludeNode)dataNode; 331 ExcludeNode excludeNode = (ExcludeNode)dataNode;
283 if (m_Files.Contains(Helper.NormalizePath(excludeNode.Name))) 332 m_Exclusions.Add( dataNode );
284 {
285 m_Files.Remove(Helper.NormalizePath(excludeNode.Name));
286 }
287 } 333 }
288 } 334 }
289 335
336 RecurseDirectories( path, pattern, recurse, useRegex, m_Exclusions );
337
290 if(m_Files.Count < 1) 338 if(m_Files.Count < 1)
291 { 339 {
292 throw new WarningException("Match returned no files: {0}{1}", Helper.EndPath(path), pattern); 340 throw new WarningException("Match returned no files: {0}{1}", Helper.EndPath(path), pattern);
diff --git a/Prebuild/src/Core/Nodes/OptionsNode.cs b/Prebuild/src/Core/Nodes/OptionsNode.cs
index b7a784d..651c339 100644
--- a/Prebuild/src/Core/Nodes/OptionsNode.cs
+++ b/Prebuild/src/Core/Nodes/OptionsNode.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: 2007-01-08 17:55:40 +0100 (, 08 jan 2007) $ 30 * $Date: 2007-01-09 01:55:40 +0900 (Tue, 09 Jan 2007) $
31 * $Revision: 197 $ 31 * $Revision: 197 $
32 */ 32 */
33#endregion 33#endregion
diff --git a/Prebuild/src/Core/Nodes/ProcessNode.cs b/Prebuild/src/Core/Nodes/ProcessNode.cs
index 5f3dbe6..2d2162c 100644
--- a/Prebuild/src/Core/Nodes/ProcessNode.cs
+++ b/Prebuild/src/Core/Nodes/ProcessNode.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-01-28 01:49:58 +0100 (, 28 jan 2006) $ 30 * $Date: 2006-01-28 09:49:58 +0900 (Sat, 28 Jan 2006) $
31 * $Revision: 71 $ 31 * $Revision: 71 $
32 */ 32 */
33#endregion 33#endregion
diff --git a/Prebuild/src/Core/Nodes/ProjectNode.cs b/Prebuild/src/Core/Nodes/ProjectNode.cs
index bddaace..e98ab5f 100644
--- a/Prebuild/src/Core/Nodes/ProjectNode.cs
+++ b/Prebuild/src/Core/Nodes/ProjectNode.cs
@@ -27,8 +27,8 @@ 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-11-11 05:43:20 +0100 (, 11 nov 2006) $ 30 * $Date: 2007-05-26 06:58:26 +0900 (Sat, 26 May 2007) $
31 * $Revision: 192 $ 31 * $Revision: 244 $
32 */ 32 */
33#endregion 33#endregion
34 34
@@ -44,20 +44,20 @@ using Prebuild.Core.Utilities;
44namespace Prebuild.Core.Nodes 44namespace Prebuild.Core.Nodes
45{ 45{
46 /// <summary> 46 /// <summary>
47 /// 47 /// A set of values that the Project's type can be
48 /// </summary> 48 /// </summary>
49 public enum ProjectType 49 public enum ProjectType
50 { 50 {
51 /// <summary> 51 /// <summary>
52 /// 52 /// The project is a console executable
53 /// </summary> 53 /// </summary>
54 Exe, 54 Exe,
55 /// <summary> 55 /// <summary>
56 /// 56 /// The project is a windows executable
57 /// </summary> 57 /// </summary>
58 WinExe, 58 WinExe,
59 /// <summary> 59 /// <summary>
60 /// 60 /// The project is a library
61 /// </summary> 61 /// </summary>
62 Library 62 Library
63 } 63 }
@@ -78,7 +78,7 @@ namespace Prebuild.Core.Nodes
78 } 78 }
79 79
80 /// <summary> 80 /// <summary>
81 /// 81 /// The Node object representing /Prebuild/Solution/Project elements
82 /// </summary> 82 /// </summary>
83 [DataNode("Project")] 83 [DataNode("Project")]
84 public class ProjectNode : DataNode, IComparable 84 public class ProjectNode : DataNode, IComparable
@@ -90,6 +90,7 @@ namespace Prebuild.Core.Nodes
90 private string m_FullPath = ""; 90 private string m_FullPath = "";
91 private string m_AssemblyName; 91 private string m_AssemblyName;
92 private string m_AppIcon = ""; 92 private string m_AppIcon = "";
93 private string m_ConfigFile = "";
93 private string m_DesignerFolder = ""; 94 private string m_DesignerFolder = "";
94 private string m_Language = "C#"; 95 private string m_Language = "C#";
95 private ProjectType m_Type = ProjectType.Exe; 96 private ProjectType m_Type = ProjectType.Exe;
@@ -97,11 +98,13 @@ namespace Prebuild.Core.Nodes
97 private string m_StartupObject = ""; 98 private string m_StartupObject = "";
98 private string m_RootNamespace; 99 private string m_RootNamespace;
99 private string m_FilterGroups = ""; 100 private string m_FilterGroups = "";
101 private string m_Version = "";
100 private Guid m_Guid; 102 private Guid m_Guid;
101 103
102 private Hashtable m_Configurations; 104 private Hashtable m_Configurations;
103 private ArrayList m_ReferencePaths; 105 private ArrayList m_ReferencePaths;
104 private ArrayList m_References; 106 private ArrayList m_References;
107 private ArrayList m_Authors;
105 private FilesNode m_Files; 108 private FilesNode m_Files;
106 109
107 #endregion 110 #endregion
@@ -116,6 +119,7 @@ namespace Prebuild.Core.Nodes
116 m_Configurations = new Hashtable(); 119 m_Configurations = new Hashtable();
117 m_ReferencePaths = new ArrayList(); 120 m_ReferencePaths = new ArrayList();
118 m_References = new ArrayList(); 121 m_References = new ArrayList();
122 m_Authors = new ArrayList();
119 } 123 }
120 124
121 #endregion 125 #endregion
@@ -159,6 +163,18 @@ namespace Prebuild.Core.Nodes
159 } 163 }
160 164
161 /// <summary> 165 /// <summary>
166 /// Gets the project's version
167 /// </summary>
168 /// <value>The project's version.</value>
169 public string Version
170 {
171 get
172 {
173 return m_Version;
174 }
175 }
176
177 /// <summary>
162 /// Gets the full path. 178 /// Gets the full path.
163 /// </summary> 179 /// </summary>
164 /// <value>The full path.</value> 180 /// <value>The full path.</value>
@@ -194,6 +210,18 @@ namespace Prebuild.Core.Nodes
194 } 210 }
195 } 211 }
196 212
213 /// <summary>
214 /// Gets the app icon.
215 /// </summary>
216 /// <value>The app icon.</value>
217 public string ConfigFile
218 {
219 get
220 {
221 return m_ConfigFile;
222 }
223 }
224
197 /// <summary> 225 /// <summary>
198 /// 226 ///
199 /// </summary> 227 /// </summary>
@@ -290,9 +318,9 @@ namespace Prebuild.Core.Nodes
290 { 318 {
291 get 319 get
292 { 320 {
293 ArrayList tmp = new ArrayList( ConfigurationsTable.Values); 321 ArrayList tmp = new ArrayList(ConfigurationsTable.Values);
294 tmp.Sort(); 322 tmp.Sort();
295 return tmp; 323 return tmp;
296 } 324 }
297 } 325 }
298 326
@@ -319,7 +347,7 @@ namespace Prebuild.Core.Nodes
319 ArrayList tmp = new ArrayList(m_ReferencePaths); 347 ArrayList tmp = new ArrayList(m_ReferencePaths);
320 tmp.Sort(); 348 tmp.Sort();
321 return tmp; 349 return tmp;
322 } 350 }
323 } 351 }
324 352
325 /// <summary> 353 /// <summary>
@@ -335,6 +363,18 @@ namespace Prebuild.Core.Nodes
335 return tmp; 363 return tmp;
336 } 364 }
337 } 365 }
366
367 /// <summary>
368 /// Gets the Authors list.
369 /// </summary>
370 /// <value>The list of the project's authors.</value>
371 public ArrayList Authors
372 {
373 get
374 {
375 return m_Authors;
376 }
377 }
338 378
339 /// <summary> 379 /// <summary>
340 /// Gets the files. 380 /// Gets the files.
@@ -422,7 +462,9 @@ namespace Prebuild.Core.Nodes
422 m_Name = Helper.AttributeValue(node, "name", m_Name); 462 m_Name = Helper.AttributeValue(node, "name", m_Name);
423 m_Path = Helper.AttributeValue(node, "path", m_Path); 463 m_Path = Helper.AttributeValue(node, "path", m_Path);
424 m_FilterGroups = Helper.AttributeValue(node, "filterGroups", m_FilterGroups); 464 m_FilterGroups = Helper.AttributeValue(node, "filterGroups", m_FilterGroups);
465 m_Version = Helper.AttributeValue(node, "version", m_Version);
425 m_AppIcon = Helper.AttributeValue(node, "icon", m_AppIcon); 466 m_AppIcon = Helper.AttributeValue(node, "icon", m_AppIcon);
467 m_ConfigFile = Helper.AttributeValue(node, "configFile", m_ConfigFile);
426 m_DesignerFolder = Helper.AttributeValue(node, "designerFolder", m_DesignerFolder); 468 m_DesignerFolder = Helper.AttributeValue(node, "designerFolder", m_DesignerFolder);
427 m_AssemblyName = Helper.AttributeValue(node, "assemblyName", m_AssemblyName); 469 m_AssemblyName = Helper.AttributeValue(node, "assemblyName", m_AssemblyName);
428 m_Language = Helper.AttributeValue(node, "language", m_Language); 470 m_Language = Helper.AttributeValue(node, "language", m_Language);
@@ -430,13 +472,11 @@ namespace Prebuild.Core.Nodes
430 m_Runtime = (ClrRuntime)Helper.EnumAttributeValue(node, "runtime", typeof(ClrRuntime), m_Runtime); 472 m_Runtime = (ClrRuntime)Helper.EnumAttributeValue(node, "runtime", typeof(ClrRuntime), m_Runtime);
431 m_StartupObject = Helper.AttributeValue(node, "startupObject", m_StartupObject); 473 m_StartupObject = Helper.AttributeValue(node, "startupObject", m_StartupObject);
432 m_RootNamespace = Helper.AttributeValue(node, "rootNamespace", m_RootNamespace); 474 m_RootNamespace = Helper.AttributeValue(node, "rootNamespace", m_RootNamespace);
433 475 m_GenerateAssemblyInfoFile = Helper.ParseBoolean(node, "generateAssemblyInfoFile", false);
476
434 int hash = m_Name.GetHashCode(); 477 int hash = m_Name.GetHashCode();
478 m_Guid = new Guid(hash, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
435 479
436 m_Guid = new Guid( hash, 0, 0, 0, 0, 0, 0,0,0,0,0 );
437
438 m_GenerateAssemblyInfoFile = Helper.ParseBoolean(node, "generateAssemblyInfoFile", false);
439
440 if(m_AssemblyName == null || m_AssemblyName.Length < 1) 480 if(m_AssemblyName == null || m_AssemblyName.Length < 1)
441 { 481 {
442 m_AssemblyName = m_Name; 482 m_AssemblyName = m_Name;
@@ -482,6 +522,10 @@ namespace Prebuild.Core.Nodes
482 { 522 {
483 m_References.Add(dataNode); 523 m_References.Add(dataNode);
484 } 524 }
525 else if(dataNode is AuthorNode)
526 {
527 m_Authors.Add(dataNode);
528 }
485 else if(dataNode is FilesNode) 529 else if(dataNode is FilesNode)
486 { 530 {
487 m_Files = (FilesNode)dataNode; 531 m_Files = (FilesNode)dataNode;
@@ -494,7 +538,6 @@ namespace Prebuild.Core.Nodes
494 } 538 }
495 } 539 }
496 540
497
498 #endregion 541 #endregion
499 542
500 #region IComparable Members 543 #region IComparable Members
@@ -506,5 +549,5 @@ namespace Prebuild.Core.Nodes
506 } 549 }
507 550
508 #endregion 551 #endregion
509 } 552 }
510} 553}
diff --git a/Prebuild/src/Core/Nodes/ReferenceNode.cs b/Prebuild/src/Core/Nodes/ReferenceNode.cs
index 4b8262e..df0c2e4 100644
--- a/Prebuild/src/Core/Nodes/ReferenceNode.cs
+++ b/Prebuild/src/Core/Nodes/ReferenceNode.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-07-25 18:56:49 +0200 (ti, 25 jul 2006) $ 30 * $Date: 2006-07-26 01:56:49 +0900 (Wed, 26 Jul 2006) $
31 * $Revision: 132 $ 31 * $Revision: 132 $
32 */ 32 */
33#endregion 33#endregion
@@ -149,5 +149,5 @@ namespace Prebuild.Core.Nodes
149 } 149 }
150 150
151 #endregion 151 #endregion
152 } 152 }
153} 153}
diff --git a/Prebuild/src/Core/Nodes/ReferencePathNode.cs b/Prebuild/src/Core/Nodes/ReferencePathNode.cs
index 4c981e7..d4042ef 100644
--- a/Prebuild/src/Core/Nodes/ReferencePathNode.cs
+++ b/Prebuild/src/Core/Nodes/ReferencePathNode.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-01-28 01:49:58 +0100 (, 28 jan 2006) $ 30 * $Date: 2006-01-28 09:49:58 +0900 (Sat, 28 Jan 2006) $
31 * $Revision: 71 $ 31 * $Revision: 71 $
32 */ 32 */
33#endregion 33#endregion
@@ -104,5 +104,5 @@ namespace Prebuild.Core.Nodes
104 } 104 }
105 105
106 #endregion 106 #endregion
107 } 107 }
108} 108}
diff --git a/Prebuild/src/Core/Nodes/SolutionNode.cs b/Prebuild/src/Core/Nodes/SolutionNode.cs
index 3ea53a4..9473fe6 100644
--- a/Prebuild/src/Core/Nodes/SolutionNode.cs
+++ b/Prebuild/src/Core/Nodes/SolutionNode.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-02-28 17:15:42 +0100 (ti, 28 feb 2006) $ 30 * $Date: 2006-03-01 01:15:42 +0900 (Wed, 01 Mar 2006) $
31 * $Revision: 92 $ 31 * $Revision: 92 $
32 */ 32 */
33#endregion 33#endregion
@@ -53,11 +53,11 @@ namespace Prebuild.Core.Nodes
53 #region Fields 53 #region Fields
54 54
55 private string m_Name = "unknown"; 55 private string m_Name = "unknown";
56 private string m_Version = "1.0.0";
57 private string m_Path = ""; 56 private string m_Path = "";
58 private string m_FullPath = ""; 57 private string m_FullPath = "";
59 private string m_ActiveConfig = "Debug"; 58 private string m_ActiveConfig = "Debug";
60 59 private string m_Version = "1.0.0";
60
61 private OptionsNode m_Options; 61 private OptionsNode m_Options;
62 private FilesNode m_Files; 62 private FilesNode m_Files;
63 private Hashtable m_Configurations; 63 private Hashtable m_Configurations;
@@ -111,18 +111,6 @@ namespace Prebuild.Core.Nodes
111 } 111 }
112 112
113 /// <summary> 113 /// <summary>
114 /// Gets the version.
115 /// </summary>
116 /// <value>The version.</value>
117 public string Version
118 {
119 get
120 {
121 return m_Version;
122 }
123 }
124
125 /// <summary>
126 /// Gets the path. 114 /// Gets the path.
127 /// </summary> 115 /// </summary>
128 /// <value>The path.</value> 116 /// <value>The path.</value>
@@ -147,6 +135,18 @@ namespace Prebuild.Core.Nodes
147 } 135 }
148 136
149 /// <summary> 137 /// <summary>
138 /// Gets the version.
139 /// </summary>
140 /// <value>The version.</value>
141 public string Version
142 {
143 get
144 {
145 return m_Version;
146 }
147 }
148
149 /// <summary>
150 /// Gets the options. 150 /// Gets the options.
151 /// </summary> 151 /// </summary>
152 /// <value>The options.</value> 152 /// <value>The options.</value>
@@ -181,7 +181,7 @@ namespace Prebuild.Core.Nodes
181 ArrayList tmp = new ArrayList(ConfigurationsTable.Values); 181 ArrayList tmp = new ArrayList(ConfigurationsTable.Values);
182 tmp.Sort(); 182 tmp.Sort();
183 return tmp; 183 return tmp;
184 } 184 }
185 } 185 }
186 186
187 /// <summary> 187 /// <summary>
@@ -245,9 +245,9 @@ namespace Prebuild.Core.Nodes
245 public override void Parse(XmlNode node) 245 public override void Parse(XmlNode node)
246 { 246 {
247 m_Name = Helper.AttributeValue(node, "name", m_Name); 247 m_Name = Helper.AttributeValue(node, "name", m_Name);
248 m_Version = Helper.AttributeValue(node, "version", m_Version);
249 m_ActiveConfig = Helper.AttributeValue(node, "activeConfig", m_ActiveConfig); 248 m_ActiveConfig = Helper.AttributeValue(node, "activeConfig", m_ActiveConfig);
250 m_Path = Helper.AttributeValue(node, "path", m_Path); 249 m_Path = Helper.AttributeValue(node, "path", m_Path);
250 m_Version = Helper.AttributeValue(node, "version", m_Version);
251 251
252 m_FullPath = m_Path; 252 m_FullPath = m_Path;
253 try 253 try
diff --git a/Prebuild/src/Core/Parse/IfContext.cs b/Prebuild/src/Core/Parse/IfContext.cs
index 6311f47..fc86885 100644
--- a/Prebuild/src/Core/Parse/IfContext.cs
+++ b/Prebuild/src/Core/Parse/IfContext.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-01-28 01:49:58 +0100 (, 28 jan 2006) $ 30 * $Date: 2006-01-28 09:49:58 +0900 (Sat, 28 Jan 2006) $
31 * $Revision: 71 $ 31 * $Revision: 71 $
32 */ 32 */
33#endregion 33#endregion
diff --git a/Prebuild/src/Core/Parse/Preprocessor.cs b/Prebuild/src/Core/Parse/Preprocessor.cs
index af21090..eea5c30 100644
--- a/Prebuild/src/Core/Parse/Preprocessor.cs
+++ b/Prebuild/src/Core/Parse/Preprocessor.cs
@@ -27,8 +27,8 @@ 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-01 19:55:06 +0200 (fr, 01 sep 2006) $ 30 * $Date: 2007-04-26 17:10:27 +0900 (Thu, 26 Apr 2007) $
31 * $Revision: 147 $ 31 * $Revision: 236 $
32 */ 32 */
33#endregion 33#endregion
34 34
diff --git a/Prebuild/src/Core/Targets/AutotoolsTarget.cs b/Prebuild/src/Core/Targets/AutotoolsTarget.cs
index cf575e3..f102038 100644
--- a/Prebuild/src/Core/Targets/AutotoolsTarget.cs
+++ b/Prebuild/src/Core/Targets/AutotoolsTarget.cs
@@ -1,11 +1,11 @@
1#region BSD License 1#region BSD License
2/* 2/*
3 3
4Copyright (c) 2004 - 2006 4Copyright (c) 2004 - 2008
5Matthew Holmes (matthew@wildfiregames.com), 5Matthew Holmes (matthew@wildfiregames.com),
6Dan Moorehead (dan05a@gmail.com), 6Dan Moorehead (dan05a@gmail.com),
7Dave Hudson (jendave@yahoo.com), 7Dave Hudson (jendave@yahoo.com),
8C.J. Adams-Collier (cjcollier@colliertech.org), 8C.J. Adams-Collier (cjac@colliertech.org),
9 9
10Redistribution and use in source and binary forms, with or without 10Redistribution and use in source and binary forms, with or without
11modification, are permitted provided that the following conditions are 11modification, are permitted provided that the following conditions are
@@ -37,6 +37,35 @@ POSSIBILITY OF SUCH DAMAGE.
37*/ 37*/
38#endregion 38#endregion
39 39
40#region MIT X11 license
41
42/*
43 Portions of this file authored by Lluis Sanchez Gual
44
45 Copyright (C) 2006 Novell, Inc (http://www.novell.com)
46
47 Permission is hereby granted, free of charge, to any person obtaining
48 a copy of this software and associated documentation files (the
49 "Software"), to deal in the Software without restriction, including
50 without limitation the rights to use, copy, modify, merge, publish,
51 distribute, sublicense, and/or sell copies of the Software, and to
52 permit persons to whom the Software is furnished to do so, subject to
53 the following conditions:
54
55 The above copyright notice and this permission notice shall be
56 included in all copies or substantial portions of the Software.
57
58 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
59 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
60 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
61 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
62 LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
63 OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
64 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
65 */
66
67#endregion
68
40#region CVS Information 69#region CVS Information
41/* 70/*
42 * $Source$ 71 * $Source$
@@ -53,6 +82,10 @@ using System.IO;
53using System.Reflection; 82using System.Reflection;
54using System.Text; 83using System.Text;
55using System.Text.RegularExpressions; 84using System.Text.RegularExpressions;
85using System.Xml;
86using System.Xml.Xsl;
87using System.Net;
88using System.Diagnostics;
56 89
57using Prebuild.Core.Attributes; 90using Prebuild.Core.Attributes;
58using Prebuild.Core.Interfaces; 91using Prebuild.Core.Interfaces;
@@ -62,63 +95,500 @@ using Prebuild.Core.Utilities;
62 95
63namespace Prebuild.Core.Targets 96namespace Prebuild.Core.Targets
64{ 97{
65 /// <summary> 98 public enum ClrVersion
66 /// 99 {
67 /// </summary> 100 Default,
68 [Target("autotools")] 101 Net_1_1,
69 public class AutotoolsTarget : ITarget 102 Net_2_0
70 { 103 }
71 #region Fields 104
72 105 public class SystemPackage
73 private Kernel m_Kernel; 106 {
74 107 string name;
75 #endregion 108 string version;
76 109 string description;
77 #region Private Methods 110 string[] assemblies;
78 111 bool isInternal;
79 private static string PrependPath(string path) 112 ClrVersion targetVersion;
80 { 113
81 string tmpPath = Helper.NormalizePath(path, '/'); 114 public void Initialize(string name,
82 Regex regex = new Regex(@"(\w):/(\w+)"); 115 string version,
83 Match match = regex.Match(tmpPath); 116 string description,
84 if(match.Success || tmpPath[0] == '.' || tmpPath[0] == '/') 117 string[] assemblies,
85 { 118 ClrVersion targetVersion,
86 tmpPath = Helper.NormalizePath(tmpPath); 119 bool isInternal)
87 } 120 {
88 else 121 this.isInternal = isInternal;
89 { 122 this.name = name;
90 tmpPath = Helper.NormalizePath("./" + tmpPath); 123 this.version = version;
91 } 124 this.assemblies = assemblies;
92 125 this.description = description;
93 return tmpPath; 126 this.targetVersion = targetVersion;
94 } 127 }
95 128
96 private static string BuildReference(SolutionNode solution, ReferenceNode refr) 129 public string Name
97 { 130 {
98 string ret = ""; 131 get { return name; }
99 if(solution.ProjectsTable.ContainsKey(refr.Name)) 132 }
100 { 133
101 ProjectNode project = (ProjectNode)solution.ProjectsTable[refr.Name]; 134 public string Version
102 string fileRef = FindFileReference(refr.Name, project); 135 {
103 string finalPath = Helper.NormalizePath(Helper.MakeFilePath(project.FullPath + "/$(BUILD_DIR)/$(CONFIG)/", refr.Name, "dll"), '/'); 136 get { return version; }
104 ret += finalPath; 137 }
105 return ret; 138
106 } 139 public string Description
107 else 140 {
108 { 141 get { return description; }
109 ProjectNode project = (ProjectNode)refr.Parent; 142 }
110 string fileRef = FindFileReference(refr.Name, project); 143
111 144 public ClrVersion TargetVersion
112 if(refr.Path != null || fileRef != null) 145 {
113 { 146 get { return targetVersion; }
114 string finalPath = (refr.Path != null) ? Helper.NormalizePath(refr.Path + "/" + refr.Name + ".dll", '/') : fileRef; 147 }
115 ret += Path.Combine(project.Path, finalPath); 148
116 return ret; 149 // The package is part of the mono SDK
117 } 150 public bool IsCorePackage
118 151 {
119 try 152 get { return name == "mono"; }
120 { 153 }
121 //Assembly assem = Assembly.Load(refr.Name); 154
155 // The package has been registered by an add-in, and is not installed
156 // in the system.
157 public bool IsInternalPackage
158 {
159 get { return isInternal; }
160 }
161
162 public string[] Assemblies
163 {
164 get { return assemblies; }
165 }
166
167 }
168
169
170 /// <summary>
171 ///
172 /// </summary>
173 [Target("autotools")]
174 public class AutotoolsTarget : ITarget
175 {
176 #region Fields
177
178 Kernel m_Kernel;
179 XmlDocument autotoolsDoc;
180 XmlUrlResolver xr;
181 System.Security.Policy.Evidence e;
182 Hashtable assemblyPathToPackage = new Hashtable();
183 Hashtable assemblyFullNameToPath = new Hashtable();
184 Hashtable packagesHash = new Hashtable();
185 ArrayList packages = new ArrayList();
186 ClrVersion currentVersion;
187
188 #endregion
189
190 #region Private Methods
191
192 private void mkdirDashP(string dirName)
193 {
194 DirectoryInfo di = new DirectoryInfo(dirName);
195 if (di.Exists)
196 return;
197
198 string parentDirName = System.IO.Path.GetDirectoryName(dirName);
199 DirectoryInfo parentDi = new DirectoryInfo(parentDirName);
200 if (!parentDi.Exists)
201 mkdirDashP(parentDirName);
202
203 di.Create();
204 }
205
206 private void mkStubFiles(string dirName, ArrayList fileNames)
207 {
208 for (int i = 0; i < fileNames.Count; i++)
209 {
210 string tmpFile = dirName + "/" + (string)fileNames[i];
211
212 FileStream tmpFileStream =
213 new FileStream(tmpFile, FileMode.Create);
214
215 StreamWriter sw = new StreamWriter(tmpFileStream);
216 sw.WriteLine("These are not the files you are looking for.");
217 sw.Flush();
218 tmpFileStream.Close();
219 }
220 }
221
222 private void chkMkDir(string dirName)
223 {
224 System.IO.DirectoryInfo di =
225 new System.IO.DirectoryInfo(dirName);
226
227 if (!di.Exists)
228 di.Create();
229 }
230
231 private void transformToFile(string filename, XsltArgumentList argList, string nodeName)
232 {
233 // Create an XslTransform for this file
234 XslTransform templateTransformer =
235 new XslTransform();
236
237 // Load up the template
238 XmlNode templateNode =
239 autotoolsDoc.SelectSingleNode(nodeName + "/*");
240 templateTransformer.Load(templateNode.CreateNavigator(), xr, e);
241
242 // Create a writer for the transformed template
243 XmlTextWriter templateWriter =
244 new XmlTextWriter(filename, null);
245
246 // Perform transformation, writing the file
247 templateTransformer.Transform
248 (m_Kernel.CurrentDoc, argList, templateWriter, xr);
249 }
250
251 string NormalizeAsmName(string name)
252 {
253 int i = name.IndexOf(", PublicKeyToken=null");
254 if (i != -1)
255 return name.Substring(0, i).Trim();
256 else
257 return name;
258 }
259
260 private void AddAssembly(string assemblyfile, SystemPackage package)
261 {
262 if (!File.Exists(assemblyfile))
263 return;
264
265 try
266 {
267 System.Reflection.AssemblyName an = System.Reflection.AssemblyName.GetAssemblyName(assemblyfile);
268 assemblyFullNameToPath[NormalizeAsmName(an.FullName)] = assemblyfile;
269 assemblyPathToPackage[assemblyfile] = package;
270 }
271 catch
272 {
273 }
274 }
275
276 private ArrayList GetAssembliesWithLibInfo(string line, string file)
277 {
278 ArrayList references = new ArrayList();
279 ArrayList libdirs = new ArrayList();
280 ArrayList retval = new ArrayList();
281 foreach (string piece in line.Split(' '))
282 {
283 if (piece.ToLower().Trim().StartsWith("/r:") || piece.ToLower().Trim().StartsWith("-r:"))
284 {
285 references.Add(ProcessPiece(piece.Substring(3).Trim(), file));
286 }
287 else if (piece.ToLower().Trim().StartsWith("/lib:") || piece.ToLower().Trim().StartsWith("-lib:"))
288 {
289 libdirs.Add(ProcessPiece(piece.Substring(5).Trim(), file));
290 }
291 }
292
293 foreach (string refrnc in references)
294 {
295 foreach (string libdir in libdirs)
296 {
297 if (File.Exists(libdir + Path.DirectorySeparatorChar + refrnc))
298 {
299 retval.Add(libdir + Path.DirectorySeparatorChar + refrnc);
300 }
301 }
302 }
303
304 return retval;
305 }
306
307 private ArrayList GetAssembliesWithoutLibInfo(string line, string file)
308 {
309 ArrayList references = new ArrayList();
310 foreach (string reference in line.Split(' '))
311 {
312 if (reference.ToLower().Trim().StartsWith("/r:") || reference.ToLower().Trim().StartsWith("-r:"))
313 {
314 string final_ref = reference.Substring(3).Trim();
315 references.Add(ProcessPiece(final_ref, file));
316 }
317 }
318 return references;
319 }
320
321 private string ProcessPiece(string piece, string pcfile)
322 {
323 int start = piece.IndexOf("${");
324 if (start == -1)
325 return piece;
326
327 int end = piece.IndexOf("}");
328 if (end == -1)
329 return piece;
330
331 string variable = piece.Substring(start + 2, end - start - 2);
332 string interp = GetVariableFromPkgConfig(variable, Path.GetFileNameWithoutExtension(pcfile));
333 return ProcessPiece(piece.Replace("${" + variable + "}", interp), pcfile);
334 }
335
336 private string GetVariableFromPkgConfig(string var, string pcfile)
337 {
338 ProcessStartInfo psi = new ProcessStartInfo("pkg-config");
339 psi.RedirectStandardOutput = true;
340 psi.UseShellExecute = false;
341 psi.Arguments = String.Format("--variable={0} {1}", var, pcfile);
342 Process p = new Process();
343 p.StartInfo = psi;
344 p.Start();
345 string ret = p.StandardOutput.ReadToEnd().Trim();
346 p.WaitForExit();
347 if (String.IsNullOrEmpty(ret))
348 return String.Empty;
349 return ret;
350 }
351
352 private void ParsePCFile(string pcfile)
353 {
354 // Don't register the package twice
355 string pname = Path.GetFileNameWithoutExtension(pcfile);
356 if (packagesHash.Contains(pname))
357 return;
358
359 ArrayList fullassemblies = null;
360 string version = "";
361 string desc = "";
362
363 SystemPackage package = new SystemPackage();
364
365 using (StreamReader reader = new StreamReader(pcfile))
366 {
367 string line;
368 while ((line = reader.ReadLine()) != null)
369 {
370 string lowerLine = line.ToLower();
371 if (lowerLine.StartsWith("libs:") && lowerLine.IndexOf(".dll") != -1)
372 {
373 string choppedLine = line.Substring(5).Trim();
374 if (choppedLine.IndexOf("-lib:") != -1 || choppedLine.IndexOf("/lib:") != -1)
375 {
376 fullassemblies = GetAssembliesWithLibInfo(choppedLine, pcfile);
377 }
378 else
379 {
380 fullassemblies = GetAssembliesWithoutLibInfo(choppedLine, pcfile);
381 }
382 }
383 else if (lowerLine.StartsWith("version:"))
384 {
385 // "version:".Length == 8
386 version = line.Substring(8).Trim();
387 }
388 else if (lowerLine.StartsWith("description:"))
389 {
390 // "description:".Length == 12
391 desc = line.Substring(12).Trim();
392 }
393 }
394 }
395
396 if (fullassemblies == null)
397 return;
398
399 foreach (string assembly in fullassemblies)
400 {
401 AddAssembly(assembly, package);
402 }
403
404 package.Initialize(pname,
405 version,
406 desc,
407 (string[])fullassemblies.ToArray(typeof(string)),
408 ClrVersion.Default,
409 false);
410 packages.Add(package);
411 packagesHash[pname] = package;
412 }
413
414 void RegisterSystemAssemblies(string prefix, string version, ClrVersion ver)
415 {
416 SystemPackage package = new SystemPackage();
417 ArrayList list = new ArrayList();
418
419 string dir = Path.Combine(prefix, version);
420 if (!Directory.Exists(dir))
421 {
422 return;
423 }
424
425 foreach (string assembly in Directory.GetFiles(dir, "*.dll"))
426 {
427 AddAssembly(assembly, package);
428 list.Add(assembly);
429 }
430
431 package.Initialize("mono",
432 version,
433 "The Mono runtime",
434 (string[])list.ToArray(typeof(string)),
435 ver,
436 false);
437 packages.Add(package);
438 }
439
440 void RunInitialization()
441 {
442 string versionDir;
443
444 if (Environment.Version.Major == 1)
445 {
446 versionDir = "1.0";
447 currentVersion = ClrVersion.Net_1_1;
448 }
449 else
450 {
451 versionDir = "2.0";
452 currentVersion = ClrVersion.Net_2_0;
453 }
454
455 //Pull up assemblies from the installed mono system.
456 string prefix = Path.GetDirectoryName(typeof(int).Assembly.Location);
457
458 if (prefix.IndexOf(Path.Combine("mono", versionDir)) == -1)
459 prefix = Path.Combine(prefix, "mono");
460 else
461 prefix = Path.GetDirectoryName(prefix);
462
463 RegisterSystemAssemblies(prefix, "1.0", ClrVersion.Net_1_1);
464 RegisterSystemAssemblies(prefix, "2.0", ClrVersion.Net_2_0);
465
466 string search_dirs = Environment.GetEnvironmentVariable("PKG_CONFIG_PATH");
467 string libpath = Environment.GetEnvironmentVariable("PKG_CONFIG_LIBPATH");
468
469 if (String.IsNullOrEmpty(libpath))
470 {
471 string path_dirs = Environment.GetEnvironmentVariable("PATH");
472 foreach (string pathdir in path_dirs.Split(Path.PathSeparator))
473 {
474 if (pathdir == null)
475 continue;
476 if (File.Exists(pathdir + Path.DirectorySeparatorChar + "pkg-config"))
477 {
478 libpath = Path.Combine(pathdir, "..");
479 libpath = Path.Combine(libpath, "lib");
480 libpath = Path.Combine(libpath, "pkgconfig");
481 break;
482 }
483 }
484 }
485 search_dirs += Path.PathSeparator + libpath;
486 if (search_dirs != null && search_dirs.Length > 0)
487 {
488 ArrayList scanDirs = new ArrayList();
489 foreach (string potentialDir in search_dirs.Split(Path.PathSeparator))
490 {
491 if (!scanDirs.Contains(potentialDir))
492 scanDirs.Add(potentialDir);
493 }
494 foreach (string pcdir in scanDirs)
495 {
496 if (pcdir == null)
497 continue;
498
499 if (Directory.Exists(pcdir))
500 {
501 foreach (string pcfile in Directory.GetFiles(pcdir, "*.pc"))
502 {
503 ParsePCFile(pcfile);
504 }
505 }
506 }
507 }
508 }
509
510 private void WriteCombine(SolutionNode solution)
511 {
512 #region "Create Solution directory if it doesn't exist"
513 string solutionDir = Path.Combine(solution.FullPath,
514 Path.Combine("autotools",
515 solution.Name));
516 chkMkDir(solutionDir);
517 #endregion
518
519 #region "Write Solution-level files"
520 XsltArgumentList argList = new XsltArgumentList();
521 argList.AddParam("solutionName", "", solution.Name);
522 // $solutionDir is $rootDir/$solutionName/
523 transformToFile(Path.Combine(solutionDir, "configure.ac"),
524 argList, "/Autotools/SolutionConfigureAc");
525 transformToFile(Path.Combine(solutionDir, "Makefile.am"),
526 argList, "/Autotools/SolutionMakefileAm");
527 transformToFile(Path.Combine(solutionDir, "autogen.sh"),
528 argList, "/Autotools/SolutionAutogenSh");
529 #endregion
530
531 foreach (ProjectNode project in solution.ProjectsTableOrder)
532 {
533 m_Kernel.Log.Write(String.Format("Writing project: {0}",
534 project.Name));
535 WriteProject(solution, project);
536 }
537 }
538 private static string PrependPath(string path)
539 {
540 string tmpPath = Helper.NormalizePath(path, '/');
541 Regex regex = new Regex(@"(\w):/(\w+)");
542 Match match = regex.Match(tmpPath);
543 if (match.Success || tmpPath[0] == '.' || tmpPath[0] == '/')
544 {
545 tmpPath = Helper.NormalizePath(tmpPath);
546 }
547 else
548 {
549 tmpPath = Helper.NormalizePath("./" + tmpPath);
550 }
551
552 return tmpPath;
553 }
554
555 private static string BuildReference(SolutionNode solution,
556 ReferenceNode refr)
557 {
558 string ret = "";
559 if (solution.ProjectsTable.ContainsKey(refr.Name))
560 {
561 ProjectNode project =
562 (ProjectNode)solution.ProjectsTable[refr.Name];
563 string fileRef = FindFileReference(refr.Name, project);
564 string finalPath =
565 Helper.NormalizePath(Helper.MakeFilePath(project.FullPath +
566 "/$(BUILD_DIR)/$(CONFIG)/",
567 refr.Name, "dll"),
568 '/');
569 ret += finalPath;
570 return ret;
571 }
572 else
573 {
574 ProjectNode project = (ProjectNode)refr.Parent;
575 string fileRef = FindFileReference(refr.Name, project);
576
577 if (refr.Path != null || fileRef != null)
578 {
579 string finalPath = ((refr.Path != null) ?
580 Helper.NormalizePath(refr.Path + "/" +
581 refr.Name + ".dll",
582 '/') :
583 fileRef
584 );
585 ret += Path.Combine(project.Path, finalPath);
586 return ret;
587 }
588
589 try
590 {
591 //Assembly assem = Assembly.Load(refr.Name);
122 //if (assem != null) 592 //if (assem != null)
123 //{ 593 //{
124 // int index = refr.Name.IndexOf(","); 594 // int index = refr.Name.IndexOf(",");
@@ -135,629 +605,971 @@ namespace Prebuild.Core.Targets
135 //} 605 //}
136 //else 606 //else
137 //{ 607 //{
138 int index = refr.Name.IndexOf(","); 608 int index = refr.Name.IndexOf(",");
139 if ( index > 0) 609 if (index > 0)
140 { 610 {
141 ret += refr.Name.Substring(0, index) + ".dll"; 611 ret += refr.Name.Substring(0, index) + ".dll";
142 //Console.WriteLine("Location3: " + assem.Location); 612 //Console.WriteLine("Location3: " + assem.Location);
143 } 613 }
144 else 614 else
145 { 615 {
146 ret += (refr.Name + ".dll"); 616 ret += (refr.Name + ".dll");
147 //Console.WriteLine("Location4: " + assem.Location); 617 //Console.WriteLine("Location4: " + assem.Location);
148 } 618 }
149 //} 619 //}
150 } 620 }
151 catch (System.NullReferenceException e) 621 catch (System.NullReferenceException e)
152 { 622 {
153 e.ToString(); 623 e.ToString();
154 int index = refr.Name.IndexOf(","); 624 int index = refr.Name.IndexOf(",");
155 if ( index > 0) 625 if (index > 0)
156 { 626 {
157 ret += refr.Name.Substring(0, index) + ".dll"; 627 ret += refr.Name.Substring(0, index) + ".dll";
158 //Console.WriteLine("Location5: " + assem.Location); 628 //Console.WriteLine("Location5: " + assem.Location);
159 } 629 }
160 else 630 else
161 { 631 {
162 ret += (refr.Name + ".dll"); 632 ret += (refr.Name + ".dll");
163 //Console.WriteLine("Location6: " + assem.Location); 633 //Console.WriteLine("Location6: " + assem.Location);
164 } 634 }
165 } 635 }
166 } 636 }
167 return ret; 637 return ret;
168 } 638 }
169 639
170 private static string BuildReferencePath(SolutionNode solution, ReferenceNode refr) 640 private static string BuildReferencePath(SolutionNode solution,
171 { 641 ReferenceNode refr)
172 string ret = ""; 642 {
173 if(solution.ProjectsTable.ContainsKey(refr.Name)) 643 string ret = "";
174 { 644 if (solution.ProjectsTable.ContainsKey(refr.Name))
175 ProjectNode project = (ProjectNode)solution.ProjectsTable[refr.Name]; 645 {
176 string finalPath = Helper.NormalizePath(Helper.MakeReferencePath(project.FullPath + "/${build.dir}/"), '/'); 646 ProjectNode project =
177 ret += finalPath; 647 (ProjectNode)solution.ProjectsTable[refr.Name];
178 return ret; 648 string finalPath =
179 } 649 Helper.NormalizePath(Helper.MakeReferencePath(project.FullPath +
180 else 650 "/${build.dir}/"),
181 { 651 '/');
182 ProjectNode project = (ProjectNode)refr.Parent; 652 ret += finalPath;
183 string fileRef = FindFileReference(refr.Name, project); 653 return ret;
184 654 }
185 655 else
186 if(refr.Path != null || fileRef != null) 656 {
187 { 657 ProjectNode project = (ProjectNode)refr.Parent;
188 string finalPath = (refr.Path != null) ? Helper.NormalizePath(refr.Path, '/') : fileRef; 658 string fileRef = FindFileReference(refr.Name, project);
189 ret += finalPath; 659
190 return ret; 660 if (refr.Path != null || fileRef != null)
191 } 661 {
192 662 string finalPath = ((refr.Path != null) ?
193 try 663 Helper.NormalizePath(refr.Path, '/') :
194 { 664 fileRef
195 Assembly assem = Assembly.Load(refr.Name); 665 );
196 if (assem != null) 666 ret += finalPath;
197 { 667 return ret;
198 ret += ""; 668 }
199 } 669
200 else 670 try
201 { 671 {
202 ret += ""; 672 Assembly assem = Assembly.Load(refr.Name);
203 } 673 if (assem != null)
204 } 674 {
205 catch (System.NullReferenceException e) 675 ret += "";
206 { 676 }
207 e.ToString(); 677 else
208 ret += ""; 678 {
209 } 679 ret += "";
210 } 680 }
211 return ret; 681 }
212 } 682 catch (System.NullReferenceException e)
213 683 {
214 private static string FindFileReference(string refName, ProjectNode project) 684 e.ToString();
215 { 685 ret += "";
216 foreach(ReferencePathNode refPath in project.ReferencePaths) 686 }
217 { 687 }
218 string fullPath = Helper.MakeFilePath(refPath.Path, refName, "dll"); 688 return ret;
219 689 }
220 if(File.Exists(fullPath)) 690
221 { 691 private static string FindFileReference(string refName,
222 return fullPath; 692 ProjectNode project)
223 } 693 {
224 } 694 foreach (ReferencePathNode refPath in project.ReferencePaths)
225 695 {
226 return null; 696 string fullPath =
227 } 697 Helper.MakeFilePath(refPath.Path, refName, "dll");
228 698
229 /// <summary> 699 if (File.Exists(fullPath)) {
230 /// Gets the XML doc file. 700 return fullPath;
231 /// </summary> 701 }
232 /// <param name="project">The project.</param> 702 }
233 /// <param name="conf">The conf.</param> 703
234 /// <returns></returns> 704 return null;
235 public static string GetXmlDocFile(ProjectNode project, ConfigurationNode conf) 705 }
236 { 706
237 if( conf == null ) 707 /// <summary>
238 { 708 /// Gets the XML doc file.
239 throw new ArgumentNullException("conf"); 709 /// </summary>
240 } 710 /// <param name="project">The project.</param>
241 if( project == null ) 711 /// <param name="conf">The conf.</param>
242 { 712 /// <returns></returns>
243 throw new ArgumentNullException("project"); 713 public static string GetXmlDocFile(ProjectNode project, ConfigurationNode conf)
244 } 714 {
245 string docFile = (string)conf.Options["XmlDocFile"]; 715 if (conf == null)
246 // if(docFile != null && docFile.Length == 0)//default to assembly name if not specified 716 {
247 // { 717 throw new ArgumentNullException("conf");
248 // return Path.GetFileNameWithoutExtension(project.AssemblyName) + ".xml"; 718 }
249 // } 719 if (project == null)
250 return docFile; 720 {
251 } 721 throw new ArgumentNullException("project");
252 722 }
253 /// <summary> 723 string docFile = (string)conf.Options["XmlDocFile"];
254 /// Normalizes the path. 724 // if(docFile != null && docFile.Length == 0)//default to assembly name if not specified
255 /// </summary> 725 // {
256 /// <param name="path">The path.</param> 726 // return Path.GetFileNameWithoutExtension(project.AssemblyName) + ".xml";
257 /// <returns></returns> 727 // }
258 public static string NormalizePath(string path) 728 return docFile;
259 { 729 }
260 if(path == null) 730
261 { 731 /// <summary>
262 return ""; 732 /// Normalizes the path.
263 } 733 /// </summary>
264 734 /// <param name="path">The path.</param>
265 StringBuilder tmpPath; 735 /// <returns></returns>
266 736 public static string NormalizePath(string path)
267 if (Core.Parse.Preprocessor.GetOS() == "Win32") 737 {
268 { 738 if (path == null)
269 tmpPath = new StringBuilder(path.Replace('\\', '/')); 739 {
270 tmpPath.Replace("/", @"\\"); 740 return "";
271 } 741 }
272 else 742
273 { 743 StringBuilder tmpPath;
274 tmpPath = new StringBuilder(path.Replace('\\', '/')); 744
275 tmpPath = tmpPath.Replace('/', Path.DirectorySeparatorChar); 745 if (Core.Parse.Preprocessor.GetOS() == "Win32")
276 } 746 {
277 return tmpPath.ToString(); 747 tmpPath = new StringBuilder(path.Replace('\\', '/'));
278 } 748 tmpPath.Replace("/", @"\\");
279 749 }
280 private void WriteProject(SolutionNode solution, ProjectNode project) 750 else
281 { 751 {
282 string projFile = Helper.MakeFilePath(project.FullPath, "Include", "am"); 752 tmpPath = new StringBuilder(path.Replace('\\', '/'));
283 StreamWriter ss = new StreamWriter(projFile); 753 tmpPath = tmpPath.Replace('/', Path.DirectorySeparatorChar);
284 ss.NewLine = "\n"; 754 }
285 755 return tmpPath.ToString();
286 m_Kernel.CurrentWorkingDirectory.Push(); 756 }
287 Helper.SetCurrentDir(Path.GetDirectoryName(projFile)); 757
288 758 private void WriteProject(SolutionNode solution, ProjectNode project)
289 using(ss) 759 {
290 { 760 string solutionDir = Path.Combine(solution.FullPath, Path.Combine("autotools", solution.Name));
291 ss.WriteLine(Helper.AssemblyFullName(project.AssemblyName, project.Type) + ":"); 761 string projectDir = Path.Combine(solutionDir, project.Name);
292 ss.WriteLine("\tmkdir -p " + Helper.MakePathRelativeTo(solution.FullPath, project.Path) + "/$(BUILD_DIR)/$(CONFIG)/"); 762 string projectVersion = project.Version;
293 foreach(string file in project.Files) 763 bool hasAssemblyConfig = false;
294 { 764 chkMkDir(projectDir);
295 if (project.Files.GetSubType(file) != SubType.Code && project.Files.GetSubType(file) != SubType.Settings) 765
296 { 766 ArrayList
297 ss.Write("\tresgen "); 767 compiledFiles = new ArrayList(),
298 ss.Write(Helper.NormalizePath(Path.Combine(project.Path, file.Substring(0, file.LastIndexOf('.')) + ".resx "), '/')); 768 contentFiles = new ArrayList(),
299 if (project.Files.GetResourceName(file) != "") 769 embeddedFiles = new ArrayList(),
300 { 770
301 ss.WriteLine(Helper.NormalizePath(Path.Combine(project.Path, project.RootNamespace + "." + project.Files.GetResourceName(file) + ".resources"), '/')); 771 binaryLibs = new ArrayList(),
302 } 772 pkgLibs = new ArrayList(),
303 else 773 systemLibs = new ArrayList(),
304 { 774 runtimeLibs = new ArrayList(),
305 ss.WriteLine(Helper.NormalizePath(Path.Combine(project.Path, project.RootNamespace + "." + file.Substring(0, file.LastIndexOf('.')) + ".resources"), '/')); 775
306 } 776 extraDistFiles = new ArrayList(),
307 } 777 localCopyTargets = new ArrayList();
308 } 778
309 ss.WriteLine("\t$(CSC)\t/out:" + Helper.MakePathRelativeTo(solution.FullPath, project.Path) + "/$(BUILD_DIR)/$(CONFIG)/" + Helper.AssemblyFullName(project.AssemblyName, project.Type) + " \\"); 779 // If there exists a .config file for this assembly, copy it to the project folder
310 ss.WriteLine("\t\t/target:" + project.Type.ToString().ToLower() + " \\"); 780 // TODO: Support copying .config.osx files
311 if (project.References.Count > 0) 781 // TODO: support processing the .config file for native library deps
312 { 782 string projectAssemblyName = project.Name;
313 ss.Write("\t\t/reference:"); 783 if (project.AssemblyName != null)
314 bool firstref = true; 784 projectAssemblyName = project.AssemblyName;
315 foreach(ReferenceNode refr in project.References) 785
316 { 786 if (File.Exists(Path.Combine(project.FullPath, projectAssemblyName) + ".dll.config"))
317 if (firstref) 787 {
318 { 788 hasAssemblyConfig = true;
319 firstref = false; 789 System.IO.File.Copy(Path.Combine(project.FullPath, projectAssemblyName + ".dll.config"), Path.Combine(projectDir, projectAssemblyName + ".dll.config"), true);
320 } 790 extraDistFiles.Add(project.AssemblyName + ".dll.config");
321 else 791 }
322 { 792
323 ss.Write(","); 793 foreach (ConfigurationNode conf in project.Configurations)
324 } 794 {
325 ss.Write("{0}", Helper.NormalizePath(Helper.MakePathRelativeTo(solution.FullPath, BuildReference(solution, refr)), '/')); 795 if (conf.Options.KeyFile != string.Empty)
326 } 796 {
327 ss.WriteLine(" \\"); 797 // Copy snk file into the project's directory
328 } 798 // Use the snk from the project directory directly
329 //ss.WriteLine("\t\tProperties/AssemblyInfo.cs \\"); 799 string source = Path.Combine(project.FullPath, conf.Options.KeyFile);
330 800 string keyFile = conf.Options.KeyFile;
331 foreach(string file in project.Files) 801 Regex re = new Regex(".*/");
332 { 802 keyFile = re.Replace(keyFile, "");
333 switch(project.Files.GetBuildAction(file)) 803
334 { 804 string dest = Path.Combine(projectDir, keyFile);
335 case BuildAction.EmbeddedResource: 805 // Tell the user if there's a problem copying the file
336 ss.Write("\t\t/resource:"); 806 try
337 ss.WriteLine(Helper.NormalizePath(Path.Combine(project.Path, file), '/') + " \\"); 807 {
338 break; 808 mkdirDashP(System.IO.Path.GetDirectoryName(dest));
339 default: 809 System.IO.File.Copy(source, dest, true);
340 if (project.Files.GetSubType(file) != SubType.Code && project.Files.GetSubType(file) != SubType.Settings) 810 }
341 { 811 catch (System.IO.IOException e)
342 ss.Write("\t\t/resource:"); 812 {
343 if (project.Files.GetResourceName(file) != "") 813 Console.WriteLine(e.Message);
344 { 814 }
345 ss.WriteLine(Helper.NormalizePath(Path.Combine(project.Path, project.RootNamespace + "." + project.Files.GetResourceName(file) + ".resources"), '/') + "," + project.RootNamespace + "." + project.Files.GetResourceName(file) + ".resources" + " \\"); 815 }
346 } 816 }
347 else 817
348 { 818 // Copy compiled, embedded and content files into the project's directory
349 ss.WriteLine(Helper.NormalizePath(Path.Combine(project.Path, project.RootNamespace + "." + file.Substring(0, file.LastIndexOf('.')) + ".resources"), '/') + "," + project.RootNamespace + "." + file.Substring(0, file.LastIndexOf('.')) + ".resources" + " \\"); 819 foreach (string filename in project.Files)
350 } 820 {
351 } 821 string source = Path.Combine(project.FullPath, filename);
352 break; 822 string dest = Path.Combine(projectDir, filename);
353 } 823
354 } 824 if (filename.Contains("AssemblyInfo.cs"))
355 825 {
356 foreach(ConfigurationNode conf in project.Configurations) 826 // If we've got an AssemblyInfo.cs, pull the version number from it
357 { 827 string[] sources = { source };
358 if (conf.Options.KeyFile !="") 828 string[] args = { "" };
359 { 829 Microsoft.CSharp.CSharpCodeProvider cscp =
360 ss.WriteLine("\t\t/keyfile:" + Helper.NormalizePath(Path.Combine(project.Path, conf.Options.KeyFile), '/') + " \\"); 830 new Microsoft.CSharp.CSharpCodeProvider();
361 break; 831
362 } 832 string tempAssemblyFile = Path.Combine(Path.GetTempPath(), project.Name + "-temp.dll");
363 } 833 System.CodeDom.Compiler.CompilerParameters cparam =
364 foreach(ConfigurationNode conf in project.Configurations) 834 new System.CodeDom.Compiler.CompilerParameters(args, tempAssemblyFile);
365 { 835
366 if (conf.Options.AllowUnsafe) 836 System.CodeDom.Compiler.CompilerResults cr =
367 { 837 cscp.CompileAssemblyFromFile(cparam, sources);
368 ss.WriteLine("\t\t/unsafe \\"); 838
369 break; 839 foreach (System.CodeDom.Compiler.CompilerError error in cr.Errors)
370 } 840 Console.WriteLine("Error! '{0}'", error.ErrorText);
371 } 841
372 if (project.AppIcon != "") 842 string projectFullName = cr.CompiledAssembly.FullName;
373 { 843 Regex verRegex = new Regex("Version=([\\d\\.]+)");
374 ss.WriteLine("\t\t/win32icon:" + Helper.NormalizePath(Path.Combine(project.Path, project.AppIcon), '/') + " \\"); 844 Match verMatch = verRegex.Match(projectFullName);
375 } 845 if (verMatch.Success)
376 846 projectVersion = verMatch.Groups[1].Value;
377 foreach(ConfigurationNode conf in project.Configurations) 847
378 { 848 // Clean up the temp file
379 ss.WriteLine("\t\t/define:{0}", conf.Options.CompilerDefines.Replace(';', ',') + " \\"); 849 try
380 break; 850 {
381 } 851 if (File.Exists(tempAssemblyFile))
382 852 File.Delete(tempAssemblyFile);
383 foreach(ConfigurationNode conf in project.Configurations) 853 }
384 { 854 catch
385 if (GetXmlDocFile(project, conf) !="") 855 {
386 { 856 //Console.WriteLine("Error! '{0}'", e.ToString());
387 ss.WriteLine("\t\t/doc:" + Helper.MakePathRelativeTo(solution.FullPath, project.Path) + "/$(BUILD_DIR)/$(CONFIG)/" + project.Name + ".xml \\"); 857 }
388 break; 858
389 } 859 }
390 } 860
391 foreach(string file in project.Files) 861 // Tell the user if there's a problem copying the file
392 { 862 try
393 switch(project.Files.GetBuildAction(file)) 863 {
394 { 864 mkdirDashP(System.IO.Path.GetDirectoryName(dest));
395 case BuildAction.Compile: 865 System.IO.File.Copy(source, dest, true);
396 ss.WriteLine("\t\t\\"); 866 }
397 ss.Write("\t\t" + NormalizePath(Path.Combine(Helper.MakePathRelativeTo(solution.FullPath, project.Path), file))); 867 catch (System.IO.IOException e)
398 break; 868 {
399 default: 869 Console.WriteLine(e.Message);
400 break; 870 }
401 } 871
402 } 872 switch (project.Files.GetBuildAction(filename))
403 ss.WriteLine(); 873 {
404 ss.WriteLine(); 874 case BuildAction.Compile:
405 875 compiledFiles.Add(filename);
406 if (project.Type == ProjectType.Library) 876 break;
407 { 877 case BuildAction.Content:
408 ss.WriteLine("install-data-local:"); 878 contentFiles.Add(filename);
409 ss.WriteLine(" echo \"$(GACUTIL) /i bin/Release/" + project.Name + ".dll /f $(GACUTIL_FLAGS)\"; \\"); 879 extraDistFiles.Add(filename);
410 ss.WriteLine(" $(GACUTIL) /i bin/Release/" + project.Name + ".dll /f $(GACUTIL_FLAGS) || exit 1;"); 880 break;
411 ss.WriteLine(); 881 case BuildAction.EmbeddedResource:
412 ss.WriteLine("uninstall-local:"); 882 embeddedFiles.Add(filename);
413 ss.WriteLine(" echo \"$(GACUTIL) /u " + project.Name + " $(GACUTIL_FLAGS)\"; \\"); 883 break;
414 ss.WriteLine(" $(GACUTIL) /u " + project.Name + " $(GACUTIL_FLAGS) || exit 1;"); 884 }
415 ss.WriteLine(); 885 }
416 } 886
417 ss.WriteLine("CLEANFILES = $(BUILD_DIR)/$(CONFIG)/" + Helper.AssemblyFullName(project.AssemblyName, project.Type) + " $(BUILD_DIR)/$(CONFIG)/" + project.AssemblyName + ".mdb $(BUILD_DIR)/$(CONFIG)/" + project.AssemblyName + ".pdb " + project.AssemblyName + ".xml"); 887 // Set up references
418 ss.WriteLine("EXTRA_DIST = \\"); 888 for (int refNum = 0; refNum < project.References.Count; refNum++)
419 ss.Write(" $(FILES)"); 889 {
420 foreach(ConfigurationNode conf in project.Configurations) 890 ReferenceNode refr = (ReferenceNode)project.References[refNum];
421 { 891 Assembly refAssembly = Assembly.LoadWithPartialName(refr.Name);
422 if (conf.Options.KeyFile != "") 892
423 { 893 /* Determine which pkg-config (.pc) file refers to
424 ss.Write(" \\"); 894 this assembly */
425 ss.WriteLine("\t" + conf.Options.KeyFile); 895
426 } 896 SystemPackage package = null;
427 break; 897
428 } 898 if (packagesHash.Contains(refr.Name)){
429 } 899 package = (SystemPackage)packagesHash[refr.Name];
430 m_Kernel.CurrentWorkingDirectory.Pop(); 900
431 } 901 }else{
432 bool hasLibrary = false; 902 string assemblyFullName = string.Empty;
433 903 if (refAssembly != null)
434 private void WriteCombine(SolutionNode solution) 904 assemblyFullName = refAssembly.FullName;
435 { 905
436 906 string assemblyFileName = string.Empty;
437 /* TODO: These vars should be pulled from the prebuild.xml file */ 907 if (assemblyFullName != string.Empty &&
438 string releaseVersion = "2.0.0"; 908 assemblyFullNameToPath.Contains(assemblyFullName)
439 string assemblyVersion = "2.1.0.0"; 909 )
440 string description = 910 assemblyFileName =
441 "Tao Framework " + solution.Name + " Binding For .NET"; 911 (string)assemblyFullNameToPath[assemblyFullName];
442 912
443 hasLibrary = false; 913 if (assemblyFileName != string.Empty &&
444 m_Kernel.Log.Write("Creating Autotools make files"); 914 assemblyPathToPackage.Contains(assemblyFileName)
445 foreach(ProjectNode project in solution.Projects) 915 )
446 { 916 package = (SystemPackage)assemblyPathToPackage[assemblyFileName];
447 if(m_Kernel.AllowProject(project.FilterGroups)) 917
448 { 918 }
449 m_Kernel.Log.Write("...Creating makefile: {0}", project.Name); 919
450 WriteProject(solution, project); 920 /* If we know the .pc file and it is not "mono"
451 } 921 (already in the path), add a -pkg: argument */
452 } 922
453 923 if (package != null &&
454 m_Kernel.Log.Write(""); 924 package.Name != "mono" &&
455 string combFile = Helper.MakeFilePath(solution.FullPath, "Makefile", "am"); 925 !pkgLibs.Contains(package.Name)
456 StreamWriter ss = new StreamWriter(combFile); 926 )
457 ss.NewLine = "\n"; 927 pkgLibs.Add(package.Name);
458 928
459 m_Kernel.CurrentWorkingDirectory.Push(); 929 string fileRef =
460 Helper.SetCurrentDir(Path.GetDirectoryName(combFile)); 930 FindFileReference(refr.Name, (ProjectNode)refr.Parent);
461 931
462 using(ss) 932 if (refr.LocalCopy ||
463 { 933 solution.ProjectsTable.ContainsKey(refr.Name) ||
464 foreach(ProjectNode project in solution.ProjectsTableOrder) 934 fileRef != null ||
465 { 935 refr.Path != null
466 if (project.Type == ProjectType.Library) 936 )
467 { 937 {
468 hasLibrary = true; 938
469 break; 939 /* Attempt to copy the referenced lib to the
470 } 940 project's directory */
471 } 941
472 942 string filename = refr.Name + ".dll";
473 if (hasLibrary) 943 string source = filename;
474 { 944 if (refr.Path != null)
475 ss.Write("pkgconfig_in_files = "); 945 source = Path.Combine(refr.Path, source);
476 foreach(ProjectNode project in solution.ProjectsTableOrder) 946 source = Path.Combine(project.FullPath, source);
477 { 947 string dest = Path.Combine(projectDir, filename);
478 if (project.Type == ProjectType.Library) 948
479 { 949 /* Since we depend on this binary dll to build, we
480 string combFilepc = Helper.MakeFilePath(solution.FullPath, project.Name, "pc.in"); 950 * will add a compile- time dependency on the
481 ss.Write(" " + project.Name + ".pc.in "); 951 * copied dll, and add the dll to the list of
482 StreamWriter sspc = new StreamWriter(combFilepc); 952 * files distributed with this package
483 sspc.NewLine = "\n"; 953 */
484 using(sspc) 954
485 { 955 binaryLibs.Add(refr.Name + ".dll");
486 sspc.WriteLine("prefix=@prefix@"); 956 extraDistFiles.Add(refr.Name + ".dll");
487 sspc.WriteLine("exec_prefix=${prefix}"); 957
488 sspc.WriteLine("libdir=${exec_prefix}/lib"); 958 // TODO: Support copying .config.osx files
489 sspc.WriteLine(); 959 // TODO: Support for determining native dependencies
490 sspc.WriteLine("Name: @PACKAGE_NAME@"); 960 if (File.Exists(source + ".config"))
491 sspc.WriteLine("Description: @DESCRIPTION@"); 961 {
492 sspc.WriteLine("Version: @ASSEMBLY_VERSION@"); 962 System.IO.File.Copy(source + ".config", Path.GetDirectoryName(dest), true);
493 sspc.WriteLine("Libs: -r:${libdir}/mono/gac/@PACKAGE_NAME@/@ASSEMBLY_VERSION@__@PUBKEY@/@PACKAGE_NAME@.dll"); 963 extraDistFiles.Add(refr.Name + ".dll.config");
494 } 964 }
495 } 965
496 } 966 try
497 967 {
498 ss.WriteLine(); 968 System.IO.File.Copy(source, dest, true);
499 ss.WriteLine("pkgconfigdir=$(prefix)/lib/pkgconfig"); 969 }
500 ss.WriteLine("pkgconfig_DATA=$(pkgconfig_in_files:.pc.in=.pc)"); 970 catch (System.IO.IOException)
501 } 971 {
502 ss.WriteLine(); 972 if (solution.ProjectsTable.ContainsKey(refr.Name)){
503 foreach(ProjectNode project in solution.ProjectsTableOrder) 973
504 { 974 /* If an assembly is referenced, marked for
505 string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath); 975 * local copy, in the list of projects for
506 ss.WriteLine("-include x {0}", 976 * this solution, but does not exist, put a
507 Helper.NormalizePath(Helper.MakeFilePath(path, "Include", "am"),'/')); 977 * target into the Makefile.am to build the
508 } 978 * assembly and copy it to this project's
509 ss.WriteLine(); 979 * directory
510 ss.WriteLine("all: \\"); 980 */
511 ss.Write("\t"); 981
512 foreach(ProjectNode project in solution.ProjectsTableOrder) 982 ProjectNode sourcePrj =
513 { 983 ((ProjectNode)(solution.ProjectsTable[refr.Name]));
514 string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath); 984
515 ss.Write(Helper.AssemblyFullName(project.AssemblyName, project.Type) + " "); 985 string target =
516 986 String.Format("{0}:\n" +
517 } 987 "\t$(MAKE) -C ../{1}\n" +
518 ss.WriteLine(); 988 "\tln ../{2}/$@ $@\n",
519 if (hasLibrary) 989 filename,
520 { 990 sourcePrj.Name,
521 ss.WriteLine("EXTRA_DIST = \\"); 991 sourcePrj.Name );
522 ss.WriteLine("\t$(pkgconfig_in_files)"); 992
523 } 993 localCopyTargets.Add(target);
524 else 994 }
525 { 995 }
526 ss.WriteLine("EXTRA_DIST = "); 996 }
527 } 997 else if( !pkgLibs.Contains(refr.Name) )
528 ss.WriteLine(); 998 {
529 ss.WriteLine("DISTCLEANFILES = \\"); 999 // Else, let's assume it's in the GAC or the lib path
530 ss.WriteLine("\tconfigure \\"); 1000 string assemName = string.Empty;
531 ss.WriteLine("\tMakefile.in \\"); 1001 int index = refr.Name.IndexOf(",");
532 ss.WriteLine("\taclocal.m4"); 1002
533 } 1003 if (index > 0)
534 combFile = Helper.MakeFilePath(solution.FullPath, "configure", "ac"); 1004 assemName = refr.Name.Substring(0, index);
535 StreamWriter ts = new StreamWriter(combFile); 1005 else
536 ts.NewLine = "\n"; 1006 assemName = refr.Name;
537 using(ts) 1007
538 { 1008 m_Kernel.Log.Write(String.Format(
539 if (this.hasLibrary) 1009 "Warning: Couldn't find an appropriate assembly " +
540 { 1010 "for reference:\n'{0}'", refr.Name
541 foreach(ProjectNode project in solution.ProjectsTableOrder) 1011 ));
542 { 1012 systemLibs.Add(assemName);
543 if (project.Type == ProjectType.Library) 1013 }
544 { 1014 }
545 ts.WriteLine("AC_INIT(" + project.Name + ".pc.in)"); 1015
546 break; 1016 string lineSep = " \\\n\t";
547 } 1017 string compiledFilesString = string.Empty;
548 } 1018 if (compiledFiles.Count > 0)
549 } 1019 compiledFilesString =
550 else 1020 lineSep + string.Join(lineSep, (string[])compiledFiles.ToArray(typeof(string)));
551 { 1021
552 ts.WriteLine("AC_INIT(Makefile.am)"); 1022 string embeddedFilesString = "";
553 } 1023 if (embeddedFiles.Count > 0)
554 ts.WriteLine("AC_PREREQ(2.53)"); 1024 embeddedFilesString =
555 ts.WriteLine("AC_CANONICAL_SYSTEM"); 1025 lineSep + string.Join(lineSep, (string[])embeddedFiles.ToArray(typeof(string)));
556 1026
557 ts.WriteLine("PACKAGE_NAME={0}", solution.Name); 1027 string contentFilesString = "";
558 ts.WriteLine("PACKAGE_VERSION={0}", releaseVersion); 1028 if (contentFiles.Count > 0)
559 ts.WriteLine("DESCRIPTION=\"{0}\"", description); 1029 contentFilesString =
560 ts.WriteLine("AC_SUBST(DESCRIPTION)"); 1030 lineSep + string.Join(lineSep, (string[])contentFiles.ToArray(typeof(string)));
561 ts.WriteLine("AM_INIT_AUTOMAKE([$PACKAGE_NAME],[$PACKAGE_VERSION],[$DESCRIPTION])"); 1031
562 1032 string extraDistFilesString = "";
563 ts.WriteLine("ASSEMBLY_VERSION={0}", assemblyVersion); 1033 if (extraDistFiles.Count > 0)
564 ts.WriteLine("AC_SUBST(ASSEMBLY_VERSION)"); 1034 extraDistFilesString =
565 1035 lineSep + string.Join(lineSep, (string[])extraDistFiles.ToArray(typeof(string)));
566 ts.WriteLine("PUBKEY=`sn -t $PACKAGE_NAME.snk | grep 'Public Key Token' | awk -F: '{print $2}' | sed -e 's/^ //'`"); 1036
567 ts.WriteLine("AC_SUBST(PUBKEY)"); 1037 string pkgLibsString = "";
568 1038 if (pkgLibs.Count > 0)
569 ts.WriteLine(); 1039 pkgLibsString =
570 ts.WriteLine("AM_MAINTAINER_MODE"); 1040 lineSep + string.Join(lineSep, (string[])pkgLibs.ToArray(typeof(string)));
571 ts.WriteLine(); 1041
572 ts.WriteLine("dnl AC_PROG_INTLTOOL([0.25])"); 1042 string binaryLibsString = "";
573 ts.WriteLine(); 1043 if (binaryLibs.Count > 0)
574 ts.WriteLine("AC_PROG_INSTALL"); 1044 binaryLibsString =
575 ts.WriteLine(); 1045 lineSep + string.Join(lineSep, (string[])binaryLibs.ToArray(typeof(string)));
576 ts.WriteLine("MONO_REQUIRED_VERSION=1.1"); 1046
577 ts.WriteLine(); 1047 string systemLibsString = "";
578 ts.WriteLine("AC_MSG_CHECKING([whether we're compiling from CVS])"); 1048 if (systemLibs.Count > 0)
579 ts.WriteLine("if test -f \"$srcdir/.cvs_version\" ; then"); 1049 systemLibsString =
580 ts.WriteLine(" from_cvs=yes"); 1050 lineSep + string.Join(lineSep, (string[])systemLibs.ToArray(typeof(string)));
581 ts.WriteLine("else"); 1051
582 ts.WriteLine(" if test -f \"$srcdir/.svn\" ; then"); 1052 string localCopyTargetsString = "";
583 ts.WriteLine(" from_cvs=yes"); 1053 if (localCopyTargets.Count > 0)
584 ts.WriteLine(" else"); 1054 localCopyTargetsString =
585 ts.WriteLine(" from_cvs=no"); 1055 string.Join("\n", (string[])localCopyTargets.ToArray(typeof(string)));
586 ts.WriteLine(" fi"); 1056
587 ts.WriteLine("fi"); 1057 string monoPath = "";
588 ts.WriteLine(); 1058 foreach (string runtimeLib in runtimeLibs)
589 ts.WriteLine("AC_MSG_RESULT($from_cvs)"); 1059 {
590 ts.WriteLine(); 1060 monoPath += ":`pkg-config --variable=libdir " + runtimeLib + "`";
591 ts.WriteLine("AC_PATH_PROG(MONO, mono)"); 1061 }
592 ts.WriteLine("AC_PATH_PROG(GMCS, gmcs)"); 1062
593 ts.WriteLine("AC_PATH_PROG(GACUTIL, gacutil)"); 1063 // Add the project name to the list of transformation
594 ts.WriteLine(); 1064 // parameters
595 ts.WriteLine("AC_MSG_CHECKING([for mono])"); 1065 XsltArgumentList argList = new XsltArgumentList();
596 ts.WriteLine("dnl if test \"x$MONO\" = \"x\" ; then"); 1066 argList.AddParam("projectName", "", project.Name);
597 ts.WriteLine("dnl AC_MSG_ERROR([Can't find \"mono\" in your PATH])"); 1067 argList.AddParam("solutionName", "", solution.Name);
598 ts.WriteLine("dnl else"); 1068 argList.AddParam("assemblyName", "", projectAssemblyName);
599 ts.WriteLine(" AC_MSG_RESULT([found])"); 1069 argList.AddParam("compiledFiles", "", compiledFilesString);
600 ts.WriteLine("dnl fi"); 1070 argList.AddParam("embeddedFiles", "", embeddedFilesString);
601 ts.WriteLine(); 1071 argList.AddParam("contentFiles", "", contentFilesString);
602 ts.WriteLine("AC_MSG_CHECKING([for gmcs])"); 1072 argList.AddParam("extraDistFiles", "", extraDistFilesString);
603 ts.WriteLine("dnl if test \"x$GMCS\" = \"x\" ; then"); 1073 argList.AddParam("pkgLibs", "", pkgLibsString);
604 ts.WriteLine("dnl AC_MSG_ERROR([Can't find \"gmcs\" in your PATH])"); 1074 argList.AddParam("binaryLibs", "", binaryLibsString);
605 ts.WriteLine("dnl else"); 1075 argList.AddParam("systemLibs", "", systemLibsString);
606 ts.WriteLine(" AC_MSG_RESULT([found])"); 1076 argList.AddParam("monoPath", "", monoPath);
607 ts.WriteLine("dnl fi"); 1077 argList.AddParam("localCopyTargets", "", localCopyTargetsString);
608 ts.WriteLine(); 1078 argList.AddParam("projectVersion", "", projectVersion);
1079 argList.AddParam("hasAssemblyConfig", "", hasAssemblyConfig ? "true" : "");
1080
1081 // Transform the templates
1082 transformToFile(Path.Combine(projectDir, "configure.ac"), argList, "/Autotools/ProjectConfigureAc");
1083 transformToFile(Path.Combine(projectDir, "Makefile.am"), argList, "/Autotools/ProjectMakefileAm");
1084 transformToFile(Path.Combine(projectDir, "autogen.sh"), argList, "/Autotools/ProjectAutogenSh");
1085
1086 if (project.Type == Core.Nodes.ProjectType.Library)
1087 transformToFile(Path.Combine(projectDir, project.Name + ".pc.in"), argList, "/Autotools/ProjectPcIn");
1088 if (project.Type == Core.Nodes.ProjectType.Exe || project.Type == Core.Nodes.ProjectType.WinExe)
1089 transformToFile(Path.Combine(projectDir, project.Name.ToLower() + ".in"), argList, "/Autotools/ProjectWrapperScriptIn");
1090 }
1091
1092 private void WriteProjectOld(SolutionNode solution, ProjectNode project)
1093 {
1094 string projFile = Helper.MakeFilePath(project.FullPath, "Include", "am");
1095 StreamWriter ss = new StreamWriter(projFile);
1096 ss.NewLine = "\n";
1097
1098 m_Kernel.CurrentWorkingDirectory.Push();
1099 Helper.SetCurrentDir(Path.GetDirectoryName(projFile));
1100
1101 using (ss)
1102 {
1103 ss.WriteLine(Helper.AssemblyFullName(project.AssemblyName, project.Type) + ":");
1104 ss.WriteLine("\tmkdir -p " + Helper.MakePathRelativeTo(solution.FullPath, project.Path) + "/$(BUILD_DIR)/$(CONFIG)/");
1105 foreach (string file in project.Files)
1106 {
1107 if (project.Files.GetSubType(file) != SubType.Code && project.Files.GetSubType(file) != SubType.Settings)
1108 {
1109 ss.Write("\tresgen ");
1110 ss.Write(Helper.NormalizePath(Path.Combine(project.Path, file.Substring(0, file.LastIndexOf('.')) + ".resx "), '/'));
1111 if (project.Files.GetResourceName(file) != "")
1112 {
1113 ss.WriteLine(Helper.NormalizePath(Path.Combine(project.Path, project.RootNamespace + "." + project.Files.GetResourceName(file) + ".resources"), '/'));
1114 }
1115 else
1116 {
1117 ss.WriteLine(Helper.NormalizePath(Path.Combine(project.Path, project.RootNamespace + "." + file.Substring(0, file.LastIndexOf('.')) + ".resources"), '/'));
1118 }
1119 }
1120 }
1121 ss.WriteLine("\t$(CSC)\t/out:" + Helper.MakePathRelativeTo(solution.FullPath, project.Path) + "/$(BUILD_DIR)/$(CONFIG)/" + Helper.AssemblyFullName(project.AssemblyName, project.Type) + " \\");
1122 ss.WriteLine("\t\t/target:" + project.Type.ToString().ToLower() + " \\");
1123 if (project.References.Count > 0)
1124 {
1125 ss.Write("\t\t/reference:");
1126 bool firstref = true;
1127 foreach (ReferenceNode refr in project.References)
1128 {
1129 if (firstref)
1130 {
1131 firstref = false;
1132 }
1133 else
1134 {
1135 ss.Write(",");
1136 }
1137 ss.Write("{0}", Helper.NormalizePath(Helper.MakePathRelativeTo(solution.FullPath, BuildReference(solution, refr)), '/'));
1138 }
1139 ss.WriteLine(" \\");
1140 }
1141 //ss.WriteLine("\t\tProperties/AssemblyInfo.cs \\");
1142
1143 foreach (string file in project.Files)
1144 {
1145 switch (project.Files.GetBuildAction(file))
1146 {
1147 case BuildAction.EmbeddedResource:
1148 ss.Write("\t\t/resource:");
1149 ss.WriteLine(Helper.NormalizePath(Path.Combine(project.Path, file), '/') + " \\");
1150 break;
1151 default:
1152 if (project.Files.GetSubType(file) != SubType.Code && project.Files.GetSubType(file) != SubType.Settings)
1153 {
1154 ss.Write("\t\t/resource:");
1155 if (project.Files.GetResourceName(file) != "")
1156 {
1157 ss.WriteLine(Helper.NormalizePath(Path.Combine(project.Path, project.RootNamespace + "." + project.Files.GetResourceName(file) + ".resources"), '/') + "," + project.RootNamespace + "." + project.Files.GetResourceName(file) + ".resources" + " \\");
1158 }
1159 else
1160 {
1161 ss.WriteLine(Helper.NormalizePath(Path.Combine(project.Path, project.RootNamespace + "." + file.Substring(0, file.LastIndexOf('.')) + ".resources"), '/') + "," + project.RootNamespace + "." + file.Substring(0, file.LastIndexOf('.')) + ".resources" + " \\");
1162 }
1163 }
1164 break;
1165 }
1166 }
1167
1168 foreach (ConfigurationNode conf in project.Configurations)
1169 {
1170 if (conf.Options.KeyFile != "")
1171 {
1172 ss.WriteLine("\t\t/keyfile:" + Helper.NormalizePath(Path.Combine(project.Path, conf.Options.KeyFile), '/') + " \\");
1173 break;
1174 }
1175 }
1176 foreach (ConfigurationNode conf in project.Configurations)
1177 {
1178 if (conf.Options.AllowUnsafe)
1179 {
1180 ss.WriteLine("\t\t/unsafe \\");
1181 break;
1182 }
1183 }
1184 if (project.AppIcon != "")
1185 {
1186 ss.WriteLine("\t\t/win32icon:" + Helper.NormalizePath(Path.Combine(project.Path, project.AppIcon), '/') + " \\");
1187 }
1188
1189 foreach (ConfigurationNode conf in project.Configurations)
1190 {
1191 ss.WriteLine("\t\t/define:{0}", conf.Options.CompilerDefines.Replace(';', ',') + " \\");
1192 break;
1193 }
1194
1195 foreach (ConfigurationNode conf in project.Configurations)
1196 {
1197 if (GetXmlDocFile(project, conf) != "")
1198 {
1199 ss.WriteLine("\t\t/doc:" + Helper.MakePathRelativeTo(solution.FullPath, project.Path) + "/$(BUILD_DIR)/$(CONFIG)/" + project.Name + ".xml \\");
1200 break;
1201 }
1202 }
1203 foreach (string file in project.Files)
1204 {
1205 switch (project.Files.GetBuildAction(file))
1206 {
1207 case BuildAction.Compile:
1208 ss.WriteLine("\t\t\\");
1209 ss.Write("\t\t" + NormalizePath(Path.Combine(Helper.MakePathRelativeTo(solution.FullPath, project.Path), file)));
1210 break;
1211 default:
1212 break;
1213 }
1214 }
1215 ss.WriteLine();
1216 ss.WriteLine();
1217
1218 if (project.Type == ProjectType.Library)
1219 {
1220 ss.WriteLine("install-data-local:");
1221 ss.WriteLine(" echo \"$(GACUTIL) /i bin/Release/" + project.Name + ".dll /f $(GACUTIL_FLAGS)\"; \\");
1222 ss.WriteLine(" $(GACUTIL) /i bin/Release/" + project.Name + ".dll /f $(GACUTIL_FLAGS) || exit 1;");
1223 ss.WriteLine();
1224 ss.WriteLine("uninstall-local:");
1225 ss.WriteLine(" echo \"$(GACUTIL) /u " + project.Name + " $(GACUTIL_FLAGS)\"; \\");
1226 ss.WriteLine(" $(GACUTIL) /u " + project.Name + " $(GACUTIL_FLAGS) || exit 1;");
1227 ss.WriteLine();
1228 }
1229 ss.WriteLine("CLEANFILES = $(BUILD_DIR)/$(CONFIG)/" + Helper.AssemblyFullName(project.AssemblyName, project.Type) + " $(BUILD_DIR)/$(CONFIG)/" + project.AssemblyName + ".mdb $(BUILD_DIR)/$(CONFIG)/" + project.AssemblyName + ".pdb " + project.AssemblyName + ".xml");
1230 ss.WriteLine("EXTRA_DIST = \\");
1231 ss.Write(" $(FILES)");
1232 foreach (ConfigurationNode conf in project.Configurations)
1233 {
1234 if (conf.Options.KeyFile != "")
1235 {
1236 ss.Write(" \\");
1237 ss.WriteLine("\t" + conf.Options.KeyFile);
1238 }
1239 break;
1240 }
1241 }
1242 m_Kernel.CurrentWorkingDirectory.Pop();
1243 }
1244 bool hasLibrary = false;
1245
1246 private void WriteCombineOld(SolutionNode solution)
1247 {
1248
1249 /* TODO: These vars should be pulled from the prebuild.xml file */
1250 string releaseVersion = "2.0.0";
1251 string assemblyVersion = "2.1.0.0";
1252 string description =
1253 "Tao Framework " + solution.Name + " Binding For .NET";
1254
1255 hasLibrary = false;
1256 m_Kernel.Log.Write("Creating Autotools make files");
1257 foreach (ProjectNode project in solution.Projects)
1258 {
1259 if (m_Kernel.AllowProject(project.FilterGroups))
1260 {
1261 m_Kernel.Log.Write("...Creating makefile: {0}", project.Name);
1262 WriteProject(solution, project);
1263 }
1264 }
1265
1266 m_Kernel.Log.Write("");
1267 string combFile = Helper.MakeFilePath(solution.FullPath, "Makefile", "am");
1268 StreamWriter ss = new StreamWriter(combFile);
1269 ss.NewLine = "\n";
1270
1271 m_Kernel.CurrentWorkingDirectory.Push();
1272 Helper.SetCurrentDir(Path.GetDirectoryName(combFile));
1273
1274 using (ss)
1275 {
1276 foreach (ProjectNode project in solution.ProjectsTableOrder)
1277 {
1278 if (project.Type == ProjectType.Library)
1279 {
1280 hasLibrary = true;
1281 break;
1282 }
1283 }
1284
1285 if (hasLibrary)
1286 {
1287 ss.Write("pkgconfig_in_files = ");
1288 foreach (ProjectNode project in solution.ProjectsTableOrder)
1289 {
1290 if (project.Type == ProjectType.Library)
1291 {
1292 string combFilepc = Helper.MakeFilePath(solution.FullPath, project.Name, "pc.in");
1293 ss.Write(" " + project.Name + ".pc.in ");
1294 StreamWriter sspc = new StreamWriter(combFilepc);
1295 sspc.NewLine = "\n";
1296 using (sspc)
1297 {
1298 sspc.WriteLine("prefix=@prefix@");
1299 sspc.WriteLine("exec_prefix=${prefix}");
1300 sspc.WriteLine("libdir=${exec_prefix}/lib");
1301 sspc.WriteLine();
1302 sspc.WriteLine("Name: @PACKAGE_NAME@");
1303 sspc.WriteLine("Description: @DESCRIPTION@");
1304 sspc.WriteLine("Version: @ASSEMBLY_VERSION@");
1305 sspc.WriteLine("Libs: -r:${libdir}/mono/gac/@PACKAGE_NAME@/@ASSEMBLY_VERSION@__@PUBKEY@/@PACKAGE_NAME@.dll");
1306 }
1307 }
1308 }
1309
1310 ss.WriteLine();
1311 ss.WriteLine("pkgconfigdir=$(prefix)/lib/pkgconfig");
1312 ss.WriteLine("pkgconfig_DATA=$(pkgconfig_in_files:.pc.in=.pc)");
1313 }
1314 ss.WriteLine();
1315 foreach (ProjectNode project in solution.ProjectsTableOrder)
1316 {
1317 string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath);
1318 ss.WriteLine("-include x {0}",
1319 Helper.NormalizePath(Helper.MakeFilePath(path, "Include", "am"), '/'));
1320 }
1321 ss.WriteLine();
1322 ss.WriteLine("all: \\");
1323 ss.Write("\t");
1324 foreach (ProjectNode project in solution.ProjectsTableOrder)
1325 {
1326 string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath);
1327 ss.Write(Helper.AssemblyFullName(project.AssemblyName, project.Type) + " ");
1328
1329 }
1330 ss.WriteLine();
1331 if (hasLibrary)
1332 {
1333 ss.WriteLine("EXTRA_DIST = \\");
1334 ss.WriteLine("\t$(pkgconfig_in_files)");
1335 }
1336 else
1337 {
1338 ss.WriteLine("EXTRA_DIST = ");
1339 }
1340 ss.WriteLine();
1341 ss.WriteLine("DISTCLEANFILES = \\");
1342 ss.WriteLine("\tconfigure \\");
1343 ss.WriteLine("\tMakefile.in \\");
1344 ss.WriteLine("\taclocal.m4");
1345 }
1346 combFile = Helper.MakeFilePath(solution.FullPath, "configure", "ac");
1347 StreamWriter ts = new StreamWriter(combFile);
1348 ts.NewLine = "\n";
1349 using (ts)
1350 {
1351 if (this.hasLibrary)
1352 {
1353 foreach (ProjectNode project in solution.ProjectsTableOrder)
1354 {
1355 if (project.Type == ProjectType.Library)
1356 {
1357 ts.WriteLine("AC_INIT(" + project.Name + ".pc.in)");
1358 break;
1359 }
1360 }
1361 }
1362 else
1363 {
1364 ts.WriteLine("AC_INIT(Makefile.am)");
1365 }
1366 ts.WriteLine("AC_PREREQ(2.53)");
1367 ts.WriteLine("AC_CANONICAL_SYSTEM");
1368
1369 ts.WriteLine("PACKAGE_NAME={0}", solution.Name);
1370 ts.WriteLine("PACKAGE_VERSION={0}", releaseVersion);
1371 ts.WriteLine("DESCRIPTION=\"{0}\"", description);
1372 ts.WriteLine("AC_SUBST(DESCRIPTION)");
1373 ts.WriteLine("AM_INIT_AUTOMAKE([$PACKAGE_NAME],[$PACKAGE_VERSION],[$DESCRIPTION])");
1374
1375 ts.WriteLine("ASSEMBLY_VERSION={0}", assemblyVersion);
1376 ts.WriteLine("AC_SUBST(ASSEMBLY_VERSION)");
1377
1378 ts.WriteLine("PUBKEY=`sn -t $PACKAGE_NAME.snk | grep 'Public Key Token' | awk -F: '{print $2}' | sed -e 's/^ //'`");
1379 ts.WriteLine("AC_SUBST(PUBKEY)");
1380
1381 ts.WriteLine();
1382 ts.WriteLine("AM_MAINTAINER_MODE");
1383 ts.WriteLine();
1384 ts.WriteLine("dnl AC_PROG_INTLTOOL([0.25])");
1385 ts.WriteLine();
1386 ts.WriteLine("AC_PROG_INSTALL");
1387 ts.WriteLine();
1388 ts.WriteLine("MONO_REQUIRED_VERSION=1.1");
1389 ts.WriteLine();
1390 ts.WriteLine("AC_MSG_CHECKING([whether we're compiling from CVS])");
1391 ts.WriteLine("if test -f \"$srcdir/.cvs_version\" ; then");
1392 ts.WriteLine(" from_cvs=yes");
1393 ts.WriteLine("else");
1394 ts.WriteLine(" if test -f \"$srcdir/.svn\" ; then");
1395 ts.WriteLine(" from_cvs=yes");
1396 ts.WriteLine(" else");
1397 ts.WriteLine(" from_cvs=no");
1398 ts.WriteLine(" fi");
1399 ts.WriteLine("fi");
1400 ts.WriteLine();
1401 ts.WriteLine("AC_MSG_RESULT($from_cvs)");
1402 ts.WriteLine();
1403 ts.WriteLine("AC_PATH_PROG(MONO, mono)");
1404 ts.WriteLine("AC_PATH_PROG(GMCS, gmcs)");
1405 ts.WriteLine("AC_PATH_PROG(GACUTIL, gacutil)");
1406 ts.WriteLine();
1407 ts.WriteLine("AC_MSG_CHECKING([for mono])");
1408 ts.WriteLine("dnl if test \"x$MONO\" = \"x\" ; then");
1409 ts.WriteLine("dnl AC_MSG_ERROR([Can't find \"mono\" in your PATH])");
1410 ts.WriteLine("dnl else");
1411 ts.WriteLine(" AC_MSG_RESULT([found])");
1412 ts.WriteLine("dnl fi");
1413 ts.WriteLine();
1414 ts.WriteLine("AC_MSG_CHECKING([for gmcs])");
1415 ts.WriteLine("dnl if test \"x$GMCS\" = \"x\" ; then");
1416 ts.WriteLine("dnl AC_MSG_ERROR([Can't find \"gmcs\" in your PATH])");
1417 ts.WriteLine("dnl else");
1418 ts.WriteLine(" AC_MSG_RESULT([found])");
1419 ts.WriteLine("dnl fi");
1420 ts.WriteLine();
609 //ts.WriteLine("AC_MSG_CHECKING([for gacutil])"); 1421 //ts.WriteLine("AC_MSG_CHECKING([for gacutil])");
610 //ts.WriteLine("if test \"x$GACUTIL\" = \"x\" ; then"); 1422 //ts.WriteLine("if test \"x$GACUTIL\" = \"x\" ; then");
611 //ts.WriteLine(" AC_MSG_ERROR([Can't find \"gacutil\" in your PATH])"); 1423 //ts.WriteLine(" AC_MSG_ERROR([Can't find \"gacutil\" in your PATH])");
612 //ts.WriteLine("else"); 1424 //ts.WriteLine("else");
613 //ts.WriteLine(" AC_MSG_RESULT([found])"); 1425 //ts.WriteLine(" AC_MSG_RESULT([found])");
614 //ts.WriteLine("fi"); 1426 //ts.WriteLine("fi");
615 ts.WriteLine(); 1427 ts.WriteLine();
616 ts.WriteLine("AC_SUBST(PATH)"); 1428 ts.WriteLine("AC_SUBST(PATH)");
617 ts.WriteLine("AC_SUBST(LD_LIBRARY_PATH)"); 1429 ts.WriteLine("AC_SUBST(LD_LIBRARY_PATH)");
618 ts.WriteLine(); 1430 ts.WriteLine();
619 ts.WriteLine("dnl CSFLAGS=\"-debug -nowarn:1574\""); 1431 ts.WriteLine("dnl CSFLAGS=\"-debug -nowarn:1574\"");
620 ts.WriteLine("CSFLAGS=\"\""); 1432 ts.WriteLine("CSFLAGS=\"\"");
621 ts.WriteLine("AC_SUBST(CSFLAGS)"); 1433 ts.WriteLine("AC_SUBST(CSFLAGS)");
622 ts.WriteLine(); 1434 ts.WriteLine();
623 // ts.WriteLine("AC_MSG_CHECKING(--disable-sdl argument)"); 1435 // ts.WriteLine("AC_MSG_CHECKING(--disable-sdl argument)");
624 // ts.WriteLine("AC_ARG_ENABLE(sdl,"); 1436 // ts.WriteLine("AC_ARG_ENABLE(sdl,");
625 // ts.WriteLine(" [ --disable-sdl Disable Sdl interface.],"); 1437 // ts.WriteLine(" [ --disable-sdl Disable Sdl interface.],");
626 // ts.WriteLine(" [disable_sdl=$disableval],"); 1438 // ts.WriteLine(" [disable_sdl=$disableval],");
627 // ts.WriteLine(" [disable_sdl=\"no\"])"); 1439 // ts.WriteLine(" [disable_sdl=\"no\"])");
628 // ts.WriteLine("AC_MSG_RESULT($disable_sdl)"); 1440 // ts.WriteLine("AC_MSG_RESULT($disable_sdl)");
629 // ts.WriteLine("if test \"$disable_sdl\" = \"yes\"; then"); 1441 // ts.WriteLine("if test \"$disable_sdl\" = \"yes\"; then");
630 // ts.WriteLine(" AC_DEFINE(FEAT_SDL)"); 1442 // ts.WriteLine(" AC_DEFINE(FEAT_SDL)");
631 // ts.WriteLine("fi"); 1443 // ts.WriteLine("fi");
632 ts.WriteLine(); 1444 ts.WriteLine();
633 ts.WriteLine("dnl Find pkg-config"); 1445 ts.WriteLine("dnl Find pkg-config");
634 ts.WriteLine("AC_PATH_PROG(PKGCONFIG, pkg-config, no)"); 1446 ts.WriteLine("AC_PATH_PROG(PKGCONFIG, pkg-config, no)");
635 ts.WriteLine("if test \"x$PKG_CONFIG\" = \"xno\"; then"); 1447 ts.WriteLine("if test \"x$PKG_CONFIG\" = \"xno\"; then");
636 ts.WriteLine(" AC_MSG_ERROR([You need to install pkg-config])"); 1448 ts.WriteLine(" AC_MSG_ERROR([You need to install pkg-config])");
637 ts.WriteLine("fi"); 1449 ts.WriteLine("fi");
638 ts.WriteLine(); 1450 ts.WriteLine();
639 ts.WriteLine("PKG_CHECK_MODULES(MONO_DEPENDENCY, mono >= $MONO_REQUIRED_VERSION, has_mono=true, has_mono=false)"); 1451 ts.WriteLine("PKG_CHECK_MODULES(MONO_DEPENDENCY, mono >= $MONO_REQUIRED_VERSION, has_mono=true, has_mono=false)");
640 ts.WriteLine("BUILD_DIR=\"bin\""); 1452 ts.WriteLine("BUILD_DIR=\"bin\"");
641 ts.WriteLine("AC_SUBST(BUILD_DIR)"); 1453 ts.WriteLine("AC_SUBST(BUILD_DIR)");
642 ts.WriteLine("CONFIG=\"Release\""); 1454 ts.WriteLine("CONFIG=\"Release\"");
643 ts.WriteLine("AC_SUBST(CONFIG)"); 1455 ts.WriteLine("AC_SUBST(CONFIG)");
644 ts.WriteLine(); 1456 ts.WriteLine();
645 ts.WriteLine("if test \"x$has_mono\" = \"xtrue\"; then"); 1457 ts.WriteLine("if test \"x$has_mono\" = \"xtrue\"; then");
646 ts.WriteLine(" AC_PATH_PROG(RUNTIME, mono, no)"); 1458 ts.WriteLine(" AC_PATH_PROG(RUNTIME, mono, no)");
647 ts.WriteLine(" AC_PATH_PROG(CSC, gmcs, no)"); 1459 ts.WriteLine(" AC_PATH_PROG(CSC, gmcs, no)");
648 ts.WriteLine(" if test `uname -s` = \"Darwin\"; then"); 1460 ts.WriteLine(" if test `uname -s` = \"Darwin\"; then");
649 ts.WriteLine(" LIB_PREFIX="); 1461 ts.WriteLine(" LIB_PREFIX=");
650 ts.WriteLine(" LIB_SUFFIX=.dylib"); 1462 ts.WriteLine(" LIB_SUFFIX=.dylib");
651 ts.WriteLine(" else"); 1463 ts.WriteLine(" else");
652 ts.WriteLine(" LIB_PREFIX=.so"); 1464 ts.WriteLine(" LIB_PREFIX=.so");
653 ts.WriteLine(" LIB_SUFFIX="); 1465 ts.WriteLine(" LIB_SUFFIX=");
654 ts.WriteLine(" fi"); 1466 ts.WriteLine(" fi");
655 ts.WriteLine("else"); 1467 ts.WriteLine("else");
656 ts.WriteLine(" AC_PATH_PROG(CSC, csc.exe, no)"); 1468 ts.WriteLine(" AC_PATH_PROG(CSC, csc.exe, no)");
657 ts.WriteLine(" if test x$CSC = \"xno\"; then"); 1469 ts.WriteLine(" if test x$CSC = \"xno\"; then");
658 ts.WriteLine(" AC_MSG_ERROR([You need to install either mono or .Net])"); 1470 ts.WriteLine(" AC_MSG_ERROR([You need to install either mono or .Net])");
659 ts.WriteLine(" else"); 1471 ts.WriteLine(" else");
660 ts.WriteLine(" RUNTIME="); 1472 ts.WriteLine(" RUNTIME=");
661 ts.WriteLine(" LIB_PREFIX="); 1473 ts.WriteLine(" LIB_PREFIX=");
662 ts.WriteLine(" LIB_SUFFIX=.dylib"); 1474 ts.WriteLine(" LIB_SUFFIX=.dylib");
663 ts.WriteLine(" fi"); 1475 ts.WriteLine(" fi");
664 ts.WriteLine("fi"); 1476 ts.WriteLine("fi");
665 ts.WriteLine(); 1477 ts.WriteLine();
666 ts.WriteLine("AC_SUBST(LIB_PREFIX)"); 1478 ts.WriteLine("AC_SUBST(LIB_PREFIX)");
667 ts.WriteLine("AC_SUBST(LIB_SUFFIX)"); 1479 ts.WriteLine("AC_SUBST(LIB_SUFFIX)");
668 ts.WriteLine(); 1480 ts.WriteLine();
669 ts.WriteLine("AC_SUBST(BASE_DEPENDENCIES_CFLAGS)"); 1481 ts.WriteLine("AC_SUBST(BASE_DEPENDENCIES_CFLAGS)");
670 ts.WriteLine("AC_SUBST(BASE_DEPENDENCIES_LIBS)"); 1482 ts.WriteLine("AC_SUBST(BASE_DEPENDENCIES_LIBS)");
671 ts.WriteLine(); 1483 ts.WriteLine();
672 ts.WriteLine("dnl Find monodoc"); 1484 ts.WriteLine("dnl Find monodoc");
673 ts.WriteLine("MONODOC_REQUIRED_VERSION=1.0"); 1485 ts.WriteLine("MONODOC_REQUIRED_VERSION=1.0");
674 ts.WriteLine("AC_SUBST(MONODOC_REQUIRED_VERSION)"); 1486 ts.WriteLine("AC_SUBST(MONODOC_REQUIRED_VERSION)");
675 ts.WriteLine("PKG_CHECK_MODULES(MONODOC_DEPENDENCY, monodoc >= $MONODOC_REQUIRED_VERSION, enable_monodoc=yes, enable_monodoc=no)"); 1487 ts.WriteLine("PKG_CHECK_MODULES(MONODOC_DEPENDENCY, monodoc >= $MONODOC_REQUIRED_VERSION, enable_monodoc=yes, enable_monodoc=no)");
676 ts.WriteLine(); 1488 ts.WriteLine();
677 ts.WriteLine("if test \"x$enable_monodoc\" = \"xyes\"; then"); 1489 ts.WriteLine("if test \"x$enable_monodoc\" = \"xyes\"; then");
678 ts.WriteLine(" AC_PATH_PROG(MONODOC, monodoc, no)"); 1490 ts.WriteLine(" AC_PATH_PROG(MONODOC, monodoc, no)");
679 ts.WriteLine(" if test x$MONODOC = xno; then"); 1491 ts.WriteLine(" if test x$MONODOC = xno; then");
680 ts.WriteLine(" enable_monodoc=no"); 1492 ts.WriteLine(" enable_monodoc=no");
681 ts.WriteLine(" fi"); 1493 ts.WriteLine(" fi");
682 ts.WriteLine("else"); 1494 ts.WriteLine("else");
683 ts.WriteLine(" MONODOC="); 1495 ts.WriteLine(" MONODOC=");
684 ts.WriteLine("fi"); 1496 ts.WriteLine("fi");
685 ts.WriteLine(); 1497 ts.WriteLine();
686 ts.WriteLine("AC_SUBST(MONODOC)"); 1498 ts.WriteLine("AC_SUBST(MONODOC)");
687 ts.WriteLine("AM_CONDITIONAL(ENABLE_MONODOC, test \"x$enable_monodoc\" = \"xyes\")"); 1499 ts.WriteLine("AM_CONDITIONAL(ENABLE_MONODOC, test \"x$enable_monodoc\" = \"xyes\")");
688 ts.WriteLine(); 1500 ts.WriteLine();
689 ts.WriteLine("AC_PATH_PROG(GACUTIL, gacutil, no)"); 1501 ts.WriteLine("AC_PATH_PROG(GACUTIL, gacutil, no)");
690 ts.WriteLine("if test \"x$GACUTIL\" = \"xno\" ; then"); 1502 ts.WriteLine("if test \"x$GACUTIL\" = \"xno\" ; then");
691 ts.WriteLine(" AC_MSG_ERROR([No gacutil tool found])"); 1503 ts.WriteLine(" AC_MSG_ERROR([No gacutil tool found])");
692 ts.WriteLine("fi"); 1504 ts.WriteLine("fi");
693 ts.WriteLine(); 1505 ts.WriteLine();
694 // foreach(ProjectNode project in solution.ProjectsTableOrder) 1506 // foreach(ProjectNode project in solution.ProjectsTableOrder)
695 // { 1507 // {
696 // if (project.Type == ProjectType.Library) 1508 // if (project.Type == ProjectType.Library)
697 // { 1509 // {
698 // } 1510 // }
699 // } 1511 // }
700 ts.WriteLine("GACUTIL_FLAGS='/package $(PACKAGE_NAME) /gacdir $(DESTDIR)$(prefix)'"); 1512 ts.WriteLine("GACUTIL_FLAGS='/package $(PACKAGE_NAME) /gacdir $(DESTDIR)$(prefix)'");
701 ts.WriteLine("AC_SUBST(GACUTIL_FLAGS)"); 1513 ts.WriteLine("AC_SUBST(GACUTIL_FLAGS)");
702 ts.WriteLine(); 1514 ts.WriteLine();
703 ts.WriteLine("winbuild=no"); 1515 ts.WriteLine("winbuild=no");
704 ts.WriteLine("case \"$host\" in"); 1516 ts.WriteLine("case \"$host\" in");
705 ts.WriteLine(" *-*-mingw*|*-*-cygwin*)"); 1517 ts.WriteLine(" *-*-mingw*|*-*-cygwin*)");
706 ts.WriteLine(" winbuild=yes"); 1518 ts.WriteLine(" winbuild=yes");
707 ts.WriteLine(" ;;"); 1519 ts.WriteLine(" ;;");
708 ts.WriteLine("esac"); 1520 ts.WriteLine("esac");
709 ts.WriteLine("AM_CONDITIONAL(WINBUILD, test x$winbuild = xyes)"); 1521 ts.WriteLine("AM_CONDITIONAL(WINBUILD, test x$winbuild = xyes)");
710 ts.WriteLine(); 1522 ts.WriteLine();
711 // ts.WriteLine("dnl Check for SDL"); 1523 // ts.WriteLine("dnl Check for SDL");
712 // ts.WriteLine(); 1524 // ts.WriteLine();
713 // ts.WriteLine("AC_PATH_PROG([SDL_CONFIG], [sdl-config])"); 1525 // ts.WriteLine("AC_PATH_PROG([SDL_CONFIG], [sdl-config])");
714 // ts.WriteLine("have_sdl=no"); 1526 // ts.WriteLine("have_sdl=no");
715 // ts.WriteLine("if test -n \"${SDL_CONFIG}\"; then"); 1527 // ts.WriteLine("if test -n \"${SDL_CONFIG}\"; then");
716 // ts.WriteLine(" have_sdl=yes"); 1528 // ts.WriteLine(" have_sdl=yes");
717 // ts.WriteLine(" SDL_CFLAGS=`$SDL_CONFIG --cflags`"); 1529 // ts.WriteLine(" SDL_CFLAGS=`$SDL_CONFIG --cflags`");
718 // ts.WriteLine(" SDL_LIBS=`$SDL_CONFIG --libs`"); 1530 // ts.WriteLine(" SDL_LIBS=`$SDL_CONFIG --libs`");
719 // ts.WriteLine(" #"); 1531 // ts.WriteLine(" #");
720 // ts.WriteLine(" # sdl-config sometimes emits an rpath flag pointing at its library"); 1532 // ts.WriteLine(" # sdl-config sometimes emits an rpath flag pointing at its library");
721 // ts.WriteLine(" # installation directory. We don't want this, as it prevents users from"); 1533 // ts.WriteLine(" # installation directory. We don't want this, as it prevents users from");
722 // ts.WriteLine(" # linking sdl-viewer against, for example, a locally compiled libGL when a"); 1534 // ts.WriteLine(" # linking sdl-viewer against, for example, a locally compiled libGL when a");
723 // ts.WriteLine(" # version of the library also exists in SDL's library installation"); 1535 // ts.WriteLine(" # version of the library also exists in SDL's library installation");
724 // ts.WriteLine(" # directory, typically /usr/lib."); 1536 // ts.WriteLine(" # directory, typically /usr/lib.");
725 // ts.WriteLine(" #"); 1537 // ts.WriteLine(" #");
726 // ts.WriteLine(" SDL_LIBS=`echo $SDL_LIBS | sed 's/-Wl,-rpath,[[^ ]]* //'`"); 1538 // ts.WriteLine(" SDL_LIBS=`echo $SDL_LIBS | sed 's/-Wl,-rpath,[[^ ]]* //'`");
727 // ts.WriteLine("fi"); 1539 // ts.WriteLine("fi");
728 // ts.WriteLine("AC_SUBST([SDL_CFLAGS])"); 1540 // ts.WriteLine("AC_SUBST([SDL_CFLAGS])");
729 // ts.WriteLine("AC_SUBST([SDL_LIBS])"); 1541 // ts.WriteLine("AC_SUBST([SDL_LIBS])");
730 ts.WriteLine(); 1542 ts.WriteLine();
731 ts.WriteLine("AC_OUTPUT(["); 1543 ts.WriteLine("AC_OUTPUT([");
732 ts.WriteLine("Makefile"); 1544 ts.WriteLine("Makefile");
733 // TODO: this does not work quite right. 1545 // TODO: this does not work quite right.
734 //ts.WriteLine("Properties/AssemblyInfo.cs"); 1546 //ts.WriteLine("Properties/AssemblyInfo.cs");
735 foreach(ProjectNode project in solution.ProjectsTableOrder) 1547 foreach (ProjectNode project in solution.ProjectsTableOrder)
736 { 1548 {
737 if (project.Type == ProjectType.Library) 1549 if (project.Type == ProjectType.Library)
738 { 1550 {
739 ts.WriteLine(project.Name + ".pc"); 1551 ts.WriteLine(project.Name + ".pc");
740 } 1552 }
741 // string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath); 1553 // string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath);
742 // ts.WriteLine(Helper.NormalizePath(Helper.MakeFilePath(path, "Include"),'/')); 1554 // ts.WriteLine(Helper.NormalizePath(Helper.MakeFilePath(path, "Include"),'/'));
743 } 1555 }
744 ts.WriteLine("])"); 1556 ts.WriteLine("])");
745 ts.WriteLine(); 1557 ts.WriteLine();
746 ts.WriteLine("#po/Makefile.in"); 1558 ts.WriteLine("#po/Makefile.in");
747 ts.WriteLine(); 1559 ts.WriteLine();
748 ts.WriteLine("echo \"---\""); 1560 ts.WriteLine("echo \"---\"");
749 ts.WriteLine("echo \"Configuration summary\""); 1561 ts.WriteLine("echo \"Configuration summary\"");
750 ts.WriteLine("echo \"\""); 1562 ts.WriteLine("echo \"\"");
751 ts.WriteLine("echo \" * Installation prefix: $prefix\""); 1563 ts.WriteLine("echo \" * Installation prefix: $prefix\"");
752 ts.WriteLine("echo \" * compiler: $CSC\""); 1564 ts.WriteLine("echo \" * compiler: $CSC\"");
753 ts.WriteLine("echo \" * Documentation: $enable_monodoc ($MONODOC)\""); 1565 ts.WriteLine("echo \" * Documentation: $enable_monodoc ($MONODOC)\"");
754 ts.WriteLine("echo \" * Package Name: $PACKAGE_NAME\""); 1566 ts.WriteLine("echo \" * Package Name: $PACKAGE_NAME\"");
755 ts.WriteLine("echo \" * Version: $PACKAGE_VERSION\""); 1567 ts.WriteLine("echo \" * Version: $PACKAGE_VERSION\"");
756 ts.WriteLine("echo \" * Public Key: $PUBKEY\""); 1568 ts.WriteLine("echo \" * Public Key: $PUBKEY\"");
757 ts.WriteLine("echo \"\""); 1569 ts.WriteLine("echo \"\"");
758 ts.WriteLine("echo \"---\""); 1570 ts.WriteLine("echo \"---\"");
759 ts.WriteLine(); 1571 ts.WriteLine();
760 } 1572 }
761 1573
762 ts.NewLine = "\n"; 1574 ts.NewLine = "\n";
763 foreach (ProjectNode project in solution.ProjectsTableOrder) 1575 foreach (ProjectNode project in solution.ProjectsTableOrder)
@@ -767,14 +1579,14 @@ namespace Prebuild.Core.Targets
767 GenerateAssemblyInfoFile(solution, combFile); 1579 GenerateAssemblyInfoFile(solution, combFile);
768 } 1580 }
769 } 1581 }
770 } 1582 }
771 1583
772 private static void GenerateAssemblyInfoFile(SolutionNode solution, string combFile) 1584 private static void GenerateAssemblyInfoFile(SolutionNode solution, string combFile)
773 { 1585 {
774 System.IO.Directory.CreateDirectory(Helper.MakePathRelativeTo(solution.FullPath, "Properties")); 1586 System.IO.Directory.CreateDirectory(Helper.MakePathRelativeTo(solution.FullPath, "Properties"));
775 combFile = Helper.MakeFilePath(solution.FullPath + "/Properties/", "AssemblyInfo.cs", "in"); 1587 combFile = Helper.MakeFilePath(solution.FullPath + "/Properties/", "AssemblyInfo.cs", "in");
776 StreamWriter ai = new StreamWriter(combFile); 1588 StreamWriter ai = new StreamWriter(combFile);
777 1589
778 using (ai) 1590 using (ai)
779 { 1591 {
780 ai.WriteLine("#region License"); 1592 ai.WriteLine("#region License");
@@ -835,92 +1647,158 @@ namespace Prebuild.Core.Targets
835 //return combFile; 1647 //return combFile;
836 } 1648 }
837 1649
838 private void CleanProject(ProjectNode project) 1650 private void CleanProject(ProjectNode project)
839 { 1651 {
840 m_Kernel.Log.Write("...Cleaning project: {0}", project.Name); 1652 m_Kernel.Log.Write("...Cleaning project: {0}", project.Name);
841 string projectFile = Helper.MakeFilePath(project.FullPath, "Include", "am"); 1653 string projectFile = Helper.MakeFilePath(project.FullPath, "Include", "am");
842 Helper.DeleteIfExists(projectFile); 1654 Helper.DeleteIfExists(projectFile);
843 } 1655 }
844 1656
845 private void CleanSolution(SolutionNode solution) 1657 private void CleanSolution(SolutionNode solution)
846 { 1658 {
847 m_Kernel.Log.Write("Cleaning Autotools make files for", solution.Name); 1659 m_Kernel.Log.Write("Cleaning Autotools make files for", solution.Name);
848 1660
849 string slnFile = Helper.MakeFilePath(solution.FullPath, "Makefile", "am"); 1661 string slnFile = Helper.MakeFilePath(solution.FullPath, "Makefile", "am");
850 Helper.DeleteIfExists(slnFile); 1662 Helper.DeleteIfExists(slnFile);
851 1663
852 slnFile = Helper.MakeFilePath(solution.FullPath, "Makefile", "in"); 1664 slnFile = Helper.MakeFilePath(solution.FullPath, "Makefile", "in");
853 Helper.DeleteIfExists(slnFile); 1665 Helper.DeleteIfExists(slnFile);
854 1666
855 slnFile = Helper.MakeFilePath(solution.FullPath, "configure", "ac"); 1667 slnFile = Helper.MakeFilePath(solution.FullPath, "configure", "ac");
856 Helper.DeleteIfExists(slnFile); 1668 Helper.DeleteIfExists(slnFile);
857 1669
858 slnFile = Helper.MakeFilePath(solution.FullPath, "configure"); 1670 slnFile = Helper.MakeFilePath(solution.FullPath, "configure");
859 Helper.DeleteIfExists(slnFile); 1671 Helper.DeleteIfExists(slnFile);
860 1672
861 slnFile = Helper.MakeFilePath(solution.FullPath, "Makefile"); 1673 slnFile = Helper.MakeFilePath(solution.FullPath, "Makefile");
862 Helper.DeleteIfExists(slnFile); 1674 Helper.DeleteIfExists(slnFile);
863 1675
864 foreach(ProjectNode project in solution.Projects) 1676 foreach (ProjectNode project in solution.Projects)
865 { 1677 {
866 CleanProject(project); 1678 CleanProject(project);
867 } 1679 }
868 1680
869 m_Kernel.Log.Write(""); 1681 m_Kernel.Log.Write("");
870 } 1682 }
871 1683
872 #endregion 1684 #endregion
873 1685
874 #region ITarget Members 1686 #region ITarget Members
875 1687
876 /// <summary> 1688 /// <summary>
877 /// Writes the specified kern. 1689 /// Writes the specified kern.
878 /// </summary> 1690 /// </summary>
879 /// <param name="kern">The kern.</param> 1691 /// <param name="kern">The kern.</param>
880 public void Write(Kernel kern) 1692 public void Write(Kernel kern)
881 { 1693 {
882 if( kern == null ) 1694 if (kern == null)
883 { 1695 {
884 throw new ArgumentNullException("kern"); 1696 throw new ArgumentNullException("kern");
885 } 1697 }
886 m_Kernel = kern; 1698 m_Kernel = kern;
887 foreach(SolutionNode solution in kern.Solutions) 1699 m_Kernel.Log.Write("Parsing system pkg-config files");
888 { 1700 RunInitialization();
889 WriteCombine(solution); 1701
890 } 1702 string streamName = "autotools.xml";
891 m_Kernel = null; 1703 string fqStreamName = String.Format("Prebuild.data.{0}",
892 } 1704 streamName
893 1705 );
894 /// <summary> 1706
895 /// Cleans the specified kern. 1707 // Retrieve stream for the autotools template XML
896 /// </summary> 1708 Stream autotoolsStream = Assembly.GetExecutingAssembly()
897 /// <param name="kern">The kern.</param> 1709 .GetManifestResourceStream(fqStreamName);
898 public virtual void Clean(Kernel kern) 1710
899 { 1711 if(autotoolsStream == null) {
900 if( kern == null ) 1712
901 { 1713 /*
902 throw new ArgumentNullException("kern"); 1714 * try without the default namespace prepended, in
903 } 1715 * case prebuild.exe assembly was compiled with
904 m_Kernel = kern; 1716 * something other than Visual Studio .NET
905 foreach(SolutionNode sol in kern.Solutions) 1717 */
906 { 1718
907 CleanSolution(sol); 1719 autotoolsStream = Assembly.GetExecutingAssembly()
908 } 1720 .GetManifestResourceStream(streamName);
909 m_Kernel = null; 1721 if(autotoolsStream == null){
910 } 1722 string errStr =
911 1723 String.Format("Could not find embedded resource file:\n" +
912 /// <summary> 1724 "'{0}' or '{1}'",
913 /// Gets the name. 1725 streamName, fqStreamName
914 /// </summary> 1726 );
915 /// <value>The name.</value> 1727
916 public string Name 1728 m_Kernel.Log.Write(errStr);
917 { 1729
918 get 1730 throw new System.Reflection.TargetException(errStr);
919 { 1731 }
920 return "autotools"; 1732 }
921 } 1733
922 } 1734 // Create an XML URL Resolver with default credentials
923 1735 xr = new System.Xml.XmlUrlResolver();
924 #endregion 1736 xr.Credentials = CredentialCache.DefaultCredentials;
925 } 1737
1738 // Create a default evidence - no need to limit access
1739 e = new System.Security.Policy.Evidence();
1740
1741 // Load the autotools XML
1742 autotoolsDoc = new XmlDocument();
1743 autotoolsDoc.Load(autotoolsStream);
1744
1745 /* rootDir is the filesystem location where the Autotools
1746 * build tree will be created - for now we'll make it
1747 * $PWD/autotools
1748 */
1749
1750 string pwd = Directory.GetCurrentDirectory();
1751 //string pwd = System.Environment.GetEnvironmentVariable("PWD");
1752 string rootDir = "";
1753 //if (pwd.Length != 0)
1754 //{
1755 rootDir = Path.Combine(pwd, "autotools");
1756 //}
1757 //else
1758 //{
1759 // pwd = Assembly.GetExecutingAssembly()
1760 //}
1761 chkMkDir(rootDir);
1762
1763 foreach (SolutionNode solution in kern.Solutions)
1764 {
1765 m_Kernel.Log.Write(String.Format("Writing solution: {0}",
1766 solution.Name));
1767 WriteCombine(solution);
1768 }
1769 m_Kernel = null;
1770 }
1771
1772 /// <summary>
1773 /// Cleans the specified kern.
1774 /// </summary>
1775 /// <param name="kern">The kern.</param>
1776 public virtual void Clean(Kernel kern)
1777 {
1778 if (kern == null)
1779 {
1780 throw new ArgumentNullException("kern");
1781 }
1782 m_Kernel = kern;
1783 foreach (SolutionNode sol in kern.Solutions)
1784 {
1785 CleanSolution(sol);
1786 }
1787 m_Kernel = null;
1788 }
1789
1790 /// <summary>
1791 /// Gets the name.
1792 /// </summary>
1793 /// <value>The name.</value>
1794 public string Name
1795 {
1796 get
1797 {
1798 return "autotools";
1799 }
1800 }
1801
1802 #endregion
1803 }
926} 1804}
diff --git a/Prebuild/src/Core/Targets/DebugTarget.cs b/Prebuild/src/Core/Targets/DebugTarget.cs
index dc4e666..db19e05 100644
--- a/Prebuild/src/Core/Targets/DebugTarget.cs
+++ b/Prebuild/src/Core/Targets/DebugTarget.cs
@@ -27,7 +27,7 @@ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY O
27/* 27/*
28 * $Source$ 28 * $Source$
29 * $Author: jendave $ 29 * $Author: jendave $
30 * $Date: 2006-09-20 09:42:51 +0200 (on, 20 sep 2006) $ 30 * $Date: 2006-09-20 16:42:51 +0900 (Wed, 20 Sep 2006) $
31 * $Revision: 164 $ 31 * $Revision: 164 $
32 */ 32 */
33#endregion 33#endregion
diff --git a/Prebuild/src/Core/Targets/MakefileTarget.cs b/Prebuild/src/Core/Targets/MakefileTarget.cs
new file mode 100644
index 0000000..86676d0
--- /dev/null
+++ b/Prebuild/src/Core/Targets/MakefileTarget.cs
@@ -0,0 +1,471 @@
1#region BSD License
2/*
3Copyright (c) 2004 Crestez Leonard (cleonard@go.ro)
4
5Redistribution and use in source and binary forms, with or without modification, are permitted
6provided that the following conditions are met:
7
8* Redistributions of source code must retain the above copyright notice, this list of conditions
9 and the following disclaimer.
10* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
11 and the following disclaimer in the documentation and/or other materials provided with the
12 distribution.
13* The name of the author may not be used to endorse or promote products derived from this software
14 without specific prior written permission.
15
16THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
17BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
19EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
22IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23*/
24#endregion
25
26using System;
27using System.Collections;
28using System.Collections.Specialized;
29using System.IO;
30using System.Text.RegularExpressions;
31
32using Prebuild.Core.Attributes;
33using Prebuild.Core.Interfaces;
34using Prebuild.Core.Nodes;
35using Prebuild.Core.Utilities;
36
37namespace Prebuild.Core.Targets
38{
39 [Target("makefile")]
40 public class MakefileTarget : ITarget
41 {
42 #region Fields
43
44 private Kernel m_Kernel = null;
45
46 #endregion
47
48 #region Private Methods
49
50 // This converts a path relative to the path of a project to
51 // a path relative to the solution path.
52 private string NicePath(ProjectNode proj, string path)
53 {
54 string res;
55 SolutionNode solution = (SolutionNode)proj.Parent;
56 res = Path.Combine(Helper.NormalizePath(proj.FullPath, '/'), Helper.NormalizePath(path, '/'));
57 res = Helper.NormalizePath(res, '/');
58 res = res.Replace("/./", "/");
59 while (res.IndexOf("/../") >= 0)
60 {
61 int a = res.IndexOf("/../");
62 int b = res.LastIndexOf("/", a - 1);
63 res = res.Remove(b, a - b + 3);
64 }
65 res = Helper.MakePathRelativeTo(solution.FullPath, res);
66 if (res.StartsWith("./"))
67 res = res.Substring(2, res.Length - 2);
68 res = Helper.NormalizePath(res, '/');
69 return res;
70 }
71
72 private void WriteProjectFiles(StreamWriter f, SolutionNode solution, ProjectNode project)
73 {
74 // Write list of source code files
75 f.WriteLine("SOURCES_{0} = \\", project.Name);
76 foreach (string file in project.Files)
77 if (project.Files.GetBuildAction(file) == BuildAction.Compile)
78 f.WriteLine("\t{0} \\", NicePath(project, file));
79 f.WriteLine();
80
81 // Write list of resource files
82 f.WriteLine("RESOURCES_{0} = \\", project.Name);
83 foreach (string file in project.Files)
84 if (project.Files.GetBuildAction(file) == BuildAction.EmbeddedResource)
85 {
86 string path = NicePath(project, file);
87 f.WriteLine("\t-resource:{0},{1} \\", path, Path.GetFileName(path));
88 }
89 f.WriteLine();
90
91 // There's also Content and None in BuildAction.
92 // What am I supposed to do with that?
93 }
94
95 private string FindFileReference(string refName, ProjectNode project)
96 {
97 foreach (ReferencePathNode refPath in project.ReferencePaths)
98 {
99 string fullPath = NicePath(project, Helper.MakeFilePath(refPath.Path, refName, "dll"));
100 if (File.Exists(fullPath))
101 return fullPath;
102 }
103 return null;
104 }
105
106 private void WriteProjectReferences(StreamWriter f, SolutionNode solution, ProjectNode project)
107 {
108 f.WriteLine("REFERENCES_{0} = \\", project.Name);
109 foreach (ReferenceNode refr in project.References)
110 {
111 string path;
112 // Project references change with configurations.
113 if (solution.ProjectsTable.Contains(refr.Name))
114 continue;
115 path = FindFileReference(refr.Name, project);
116 if (path != null)
117 f.WriteLine("\t-r:{0} \\", path);
118 else
119 f.WriteLine("\t-r:{0} \\", refr.Name);
120 }
121 f.WriteLine();
122 }
123
124 private void WriteProjectDependencies(StreamWriter f, SolutionNode solution, ProjectNode project)
125 {
126 f.WriteLine("DEPENDENCIES_{0} = \\", project.Name);
127 f.WriteLine("\t$(SOURCES_{0}) \\", project.Name);
128 foreach (string file in project.Files)
129 if (project.Files.GetBuildAction(file) == BuildAction.EmbeddedResource)
130 f.WriteLine("\t{0} \\", NicePath(project, file));
131 f.WriteLine();
132 }
133
134 private string ProjectTypeToExtension(ProjectType t)
135 {
136 if (t == ProjectType.Exe || t == ProjectType.WinExe)
137 {
138 return "exe";
139 }
140 else if (t == ProjectType.Library)
141 {
142 return "dll";
143 }
144 else
145 {
146 throw new FatalException("Bad ProjectType: {0}", t);
147 }
148 }
149
150 private string ProjectTypeToTarget(ProjectType t)
151 {
152 if (t == ProjectType.Exe)
153 {
154 return "exe";
155 }
156 else if (t == ProjectType.WinExe)
157 {
158 return "winexe";
159 }
160 else if (t == ProjectType.Library)
161 {
162 return "library";
163 }
164 else
165 {
166 throw new FatalException("Bad ProjectType: {0}", t);
167 }
168 }
169
170 private string ProjectOutput(ProjectNode project, ConfigurationNode config)
171 {
172 string filepath;
173 filepath = Helper.MakeFilePath((string)config.Options["OutputPath"],
174 project.AssemblyName, ProjectTypeToExtension(project.Type));
175 return NicePath(project, filepath);
176 }
177
178 // Returns true if two configs in one project have the same output.
179 private bool ProjectClashes(ProjectNode project)
180 {
181 foreach (ConfigurationNode conf1 in project.Configurations)
182 foreach (ConfigurationNode conf2 in project.Configurations)
183 if (ProjectOutput(project, conf1) == ProjectOutput(project, conf2) && conf1 != conf2)
184 {
185 m_Kernel.Log.Write("Warning: Configurations {0} and {1} for project {2} output the same file",
186 conf1.Name, conf2.Name, project.Name);
187 m_Kernel.Log.Write("Warning: I'm going to use some timestamps(extra empty files).");
188 return true;
189 }
190 return false;
191 }
192
193 private void WriteProject(StreamWriter f, SolutionNode solution, ProjectNode project)
194 {
195 f.WriteLine("# This is for project {0}", project.Name);
196 f.WriteLine();
197
198 WriteProjectFiles(f, solution, project);
199 WriteProjectReferences(f, solution, project);
200 WriteProjectDependencies(f, solution, project);
201
202 bool clash = ProjectClashes(project);
203
204 foreach (ConfigurationNode conf in project.Configurations)
205 {
206 string outpath = ProjectOutput(project, conf);
207 string filesToClean = outpath;
208
209 if (clash)
210 {
211 f.WriteLine("{0}-{1}: .{0}-{1}-timestamp", project.Name, conf.Name);
212 f.WriteLine();
213 f.Write(".{0}-{1}-timestamp: $(DEPENDENCIES_{0})", project.Name, conf.Name);
214 }
215 else
216 {
217 f.WriteLine("{0}-{1}: {2}", project.Name, conf.Name, outpath);
218 f.WriteLine();
219 f.Write("{2}: $(DEPENDENCIES_{0})", project.Name, conf.Name, outpath);
220 }
221 // Dependencies on other projects.
222 foreach (ReferenceNode refr in project.References)
223 if (solution.ProjectsTable.Contains(refr.Name))
224 {
225 ProjectNode refProj = (ProjectNode)solution.ProjectsTable[refr.Name];
226 if (ProjectClashes(refProj))
227 f.Write(" .{0}-{1}-timestamp", refProj.Name, conf.Name);
228 else
229 f.Write(" {0}", ProjectOutput(refProj, conf));
230 }
231 f.WriteLine();
232
233 // make directory for output.
234 if (Path.GetDirectoryName(outpath) != "")
235 {
236 f.WriteLine("\tmkdir -p {0}", Path.GetDirectoryName(outpath));
237 }
238 // mcs command line.
239 f.Write("\tgmcs", project.Name);
240 f.Write(" -warn:{0}", conf.Options["WarningLevel"]);
241 if ((bool)conf.Options["DebugInformation"])
242 f.Write(" -debug");
243 if ((bool)conf.Options["AllowUnsafe"])
244 f.Write(" -unsafe");
245 if ((bool)conf.Options["CheckUnderflowOverflow"])
246 f.Write(" -checked");
247 if (project.StartupObject != "")
248 f.Write(" -main:{0}", project.StartupObject);
249 if ((string)conf.Options["CompilerDefines"] != "")
250 {
251 f.Write(" -define:\"{0}\"", conf.Options["CompilerDefines"]);
252 }
253
254 f.Write(" -target:{0} -out:{1}", ProjectTypeToTarget(project.Type), outpath);
255
256 // Build references to other projects. Now that sux.
257 // We have to reference the other project in the same conf.
258 foreach (ReferenceNode refr in project.References)
259 if (solution.ProjectsTable.Contains(refr.Name))
260 {
261 ProjectNode refProj;
262 refProj = (ProjectNode)solution.ProjectsTable[refr.Name];
263 f.Write(" -r:{0}", ProjectOutput(refProj, conf));
264 }
265
266 f.Write(" $(REFERENCES_{0})", project.Name);
267 f.Write(" $(RESOURCES_{0})", project.Name);
268 f.Write(" $(SOURCES_{0})", project.Name);
269 f.WriteLine();
270
271 // Copy references with localcopy.
272 foreach (ReferenceNode refr in project.References)
273 if (refr.LocalCopy)
274 {
275 string outPath, srcPath, destPath;
276 outPath = Helper.NormalizePath((string)conf.Options["OutputPath"]);
277 if (solution.ProjectsTable.Contains(refr.Name))
278 {
279 ProjectNode refProj;
280 refProj = (ProjectNode)solution.ProjectsTable[refr.Name];
281 srcPath = ProjectOutput(refProj, conf);
282 destPath = Path.Combine(outPath, Path.GetFileName(srcPath));
283 destPath = NicePath(project, destPath);
284 if (srcPath != destPath)
285 {
286 f.WriteLine("\tcp -f {0} {1}", srcPath, destPath);
287 filesToClean += " " + destPath;
288 }
289 continue;
290 }
291 srcPath = FindFileReference(refr.Name, project);
292 if (srcPath != null)
293 {
294 destPath = Path.Combine(outPath, Path.GetFileName(srcPath));
295 destPath = NicePath(project, destPath);
296 f.WriteLine("\tcp -f {0} {1}", srcPath, destPath);
297 filesToClean += " " + destPath;
298 }
299 }
300
301 if (clash)
302 {
303 filesToClean += String.Format(" .{0}-{1}-timestamp", project.Name, conf.Name);
304 f.WriteLine("\ttouch .{0}-{1}-timestamp", project.Name, conf.Name);
305 f.Write("\trm -rf");
306 foreach (ConfigurationNode otherConf in project.Configurations)
307 if (otherConf != conf)
308 f.WriteLine(" .{0}-{1}-timestamp", project.Name, otherConf.Name);
309 f.WriteLine();
310 }
311 f.WriteLine();
312 f.WriteLine("{0}-{1}-clean:", project.Name, conf.Name);
313 f.WriteLine("\trm -rf {0}", filesToClean);
314 f.WriteLine();
315 }
316 }
317
318 private void WriteIntro(StreamWriter f, SolutionNode solution)
319 {
320 f.WriteLine("# Makefile for {0} generated by Prebuild ( http://dnpb.sf.net )", solution.Name);
321 f.WriteLine("# Do not edit.");
322 f.WriteLine("#");
323
324 f.Write("# Configurations:");
325 foreach (ConfigurationNode conf in solution.Configurations)
326 f.Write(" {0}", conf.Name);
327 f.WriteLine();
328
329 f.WriteLine("# Projects:");
330 foreach (ProjectNode proj in solution.Projects)
331 f.WriteLine("#\t{0}", proj.Name);
332
333 f.WriteLine("#");
334 f.WriteLine("# Building:");
335 f.WriteLine("#\t\"make\" to build everything under the default(first) configuration");
336 f.WriteLine("#\t\"make CONF\" to build every project under configuration CONF");
337 f.WriteLine("#\t\"make PROJ\" to build project PROJ under the default(first) configuration");
338 f.WriteLine("#\t\"make PROJ-CONF\" to build project PROJ under configuration CONF");
339 f.WriteLine("#");
340 f.WriteLine("# Cleaning (removing results of build):");
341 f.WriteLine("#\t\"make clean\" to clean everything, that's what you probably want");
342 f.WriteLine("#\t\"make CONF\" to clean everything for a configuration");
343 f.WriteLine("#\t\"make PROJ\" to clean everything for a project");
344 f.WriteLine("#\t\"make PROJ-CONF\" to clea project PROJ under configuration CONF");
345 f.WriteLine();
346 }
347
348 private void WritePhony(StreamWriter f, SolutionNode solution)
349 {
350 string defconf = "";
351 foreach (ConfigurationNode conf in solution.Configurations)
352 {
353 defconf = conf.Name;
354 break;
355 }
356
357 f.Write(".PHONY: all");
358 foreach (ProjectNode proj in solution.Projects)
359 f.Write(" {0} {0}-clean", proj.Name);
360 foreach (ConfigurationNode conf in solution.Configurations)
361 f.Write(" {0} {0}-clean", conf.Name);
362 foreach (ProjectNode proj in solution.Projects)
363 foreach (ConfigurationNode conf in solution.Configurations)
364 f.Write(" {0}-{1} {0}-{1}-clean", proj.Name, conf.Name);
365 f.WriteLine();
366 f.WriteLine();
367
368 f.WriteLine("all: {0}", defconf);
369 f.WriteLine();
370
371 f.Write("clean:");
372 foreach (ConfigurationNode conf in solution.Configurations)
373 f.Write(" {0}-clean", conf.Name);
374 f.WriteLine();
375 f.WriteLine();
376
377 foreach (ConfigurationNode conf in solution.Configurations)
378 {
379 f.Write("{0}: ", conf.Name);
380 foreach (ProjectNode proj in solution.Projects)
381 f.Write(" {0}-{1}", proj.Name, conf.Name);
382 f.WriteLine();
383 f.WriteLine();
384
385 f.Write("{0}-clean: ", conf.Name);
386 foreach (ProjectNode proj in solution.Projects)
387 f.Write(" {0}-{1}-clean", proj.Name, conf.Name);
388 f.WriteLine();
389 f.WriteLine();
390 }
391
392 foreach (ProjectNode proj in solution.Projects)
393 {
394 f.WriteLine("{0}: {0}-{1}", proj.Name, defconf);
395 f.WriteLine();
396
397 f.Write("{0}-clean:", proj.Name);
398 foreach (ConfigurationNode conf in proj.Configurations)
399 f.Write(" {0}-{1}-clean", proj.Name, conf.Name);
400 f.WriteLine();
401 f.WriteLine();
402 }
403 }
404
405 private void WriteSolution(SolutionNode solution)
406 {
407 m_Kernel.Log.Write("Creating makefile for {0}", solution.Name);
408 m_Kernel.CurrentWorkingDirectory.Push();
409
410 string file = "Makefile";// Helper.MakeFilePath(solution.FullPath, solution.Name, "make");
411 StreamWriter f = new StreamWriter(file);
412
413 Helper.SetCurrentDir(Path.GetDirectoryName(file));
414
415 using (f)
416 {
417 WriteIntro(f, solution);
418 WritePhony(f, solution);
419
420 foreach (ProjectNode project in solution.Projects)
421 {
422 m_Kernel.Log.Write("...Creating Project: {0}", project.Name);
423 WriteProject(f, solution, project);
424 }
425 }
426
427 m_Kernel.Log.Write("");
428 m_Kernel.CurrentWorkingDirectory.Pop();
429 }
430
431 private void CleanSolution(SolutionNode solution)
432 {
433 m_Kernel.Log.Write("Cleaning makefile for {0}", solution.Name);
434
435 string file = Helper.MakeFilePath(solution.FullPath, solution.Name, "make");
436 Helper.DeleteIfExists(file);
437
438 m_Kernel.Log.Write("");
439 }
440
441 #endregion
442
443 #region ITarget Members
444
445 public void Write(Kernel kern)
446 {
447 m_Kernel = kern;
448 foreach (SolutionNode solution in kern.Solutions)
449 WriteSolution(solution);
450 m_Kernel = null;
451 }
452
453 public virtual void Clean(Kernel kern)
454 {
455 m_Kernel = kern;
456 foreach (SolutionNode sol in kern.Solutions)
457 CleanSolution(sol);
458 m_Kernel = null;
459 }
460
461 public string Name
462 {
463 get
464 {
465 return "makefile";
466 }
467 }
468
469 #endregion
470 }
471}
diff --git a/Prebuild/src/Core/Targets/MonoDevelopTarget.cs b/Prebuild/src/Core/Targets/MonoDevelopTarget.cs
index 7c0a1e2..af3341f 100644
--- a/Prebuild/src/Core/Targets/MonoDevelopTarget.cs
+++ b/Prebuild/src/Core/Targets/MonoDevelopTarget.cs
@@ -26,9 +26,9 @@ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY O
26#region CVS Information 26#region CVS Information
27/* 27/*
28 * $Source$ 28 * $Source$
29 * $Author: jendave $ 29 * $Author: cjcollier $
30 * $Date: 2007-02-13 22:07:07 +0100 (ti, 13 feb 2007) $ 30 * $Date: 2007-04-11 07:10:35 +0900 (Wed, 11 Apr 2007) $
31 * $Revision: 206 $ 31 * $Revision: 231 $
32 */ 32 */
33#endregion 33#endregion
34 34
@@ -106,9 +106,24 @@ namespace Prebuild.Core.Targets
106 ret += " refto=\""; 106 ret += " refto=\"";
107 try 107 try
108 { 108 {
109 //Assembly assem = Assembly.Load(refr.Name); 109 /*
110 //ret += assem.FullName; 110 Day changed to 28 Mar 2007
111 ret += refr.Name; 111 ...
112 08:09 < cj> is there anything that replaces Assembly.LoadFromPartialName() ?
113 08:09 < jonp> no
114 08:10 < jonp> in their infinite wisdom [sic], microsoft decided that the
115 ability to load any assembly version by-name was an inherently
116 bad idea
117 08:11 < cj> I'm thinking of a bunch of four-letter words right now...
118 08:11 < cj> security through making it difficult for the developer!!!
119 08:12 < jonp> just use the Obsolete API
120 08:12 < jonp> it should still work
121 08:12 < cj> alrighty.
122 08:12 < jonp> you just get warnings when using it
123 */
124 Assembly assem = Assembly.LoadWithPartialName(refr.Name);
125 ret += assem.FullName;
126 //ret += refr.Name;
112 } 127 }
113 catch (System.NullReferenceException e) 128 catch (System.NullReferenceException e)
114 { 129 {
diff --git a/Prebuild/src/Core/Targets/NAntTarget.cs b/Prebuild/src/Core/Targets/NAntTarget.cs
index 8a6dbdf..6ee6aef 100644
--- a/Prebuild/src/Core/Targets/NAntTarget.cs
+++ b/Prebuild/src/Core/Targets/NAntTarget.cs
@@ -1,34 +1,46 @@
1#region BSD License 1#region BSD License
2/* 2/*
3 Copyright (c) 2004 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) 3Copyright (c) 2004 - 2008
4 4Matthew Holmes (matthew@wildfiregames.com),
5 Redistribution and use in source and binary forms, with or without modification, are permitted 5Dan Moorehead (dan05a@gmail.com),
6 provided that the following conditions are met: 6C.J. Adams-Collier (cjac@colliertech.org),
7 7
8 * Redistributions of source code must retain the above copyright notice, this list of conditions 8Redistribution and use in source and binary forms, with or without
9 and the following disclaimer. 9modification, are permitted provided that the following conditions are
10 * Redistributions in binary form must reproduce the above copyright notice, this list of conditions 10met:
11 and the following disclaimer in the documentation and/or other materials provided with the 11
12 distribution. 12* Redistributions of source code must retain the above copyright
13 * The name of the author may not be used to endorse or promote products derived from this software 13 notice, this list of conditions and the following disclaimer.
14 without specific prior written permission. 14
15 15* Redistributions in binary form must reproduce the above copyright
16 THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, 16 notice, this list of conditions and the following disclaimer in the
17 BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17 documentation and/or other materials provided with the distribution.
18 ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 18
19 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 19* The name of the author may not be used to endorse or promote
20 OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 20 products derived from this software without specific prior written
21 OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 21 permission.
22 IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 22
23THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
24IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
25WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
26DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
27INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
28(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
29SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
31STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
32IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33POSSIBILITY OF SUCH DAMAGE.
23*/ 34*/
35
24#endregion 36#endregion
25 37
26#region CVS Information 38#region CVS Information
27/* 39/*
28 * $Source$ 40 * $Source$
29 * $Author: jendave $ 41 * $Author: cjcollier $
30 * $Date: 2007-02-13 21:58:03 +0100 (ti, 13 feb 2007) $ 42 * $Date: 2008-02-07 10:22:36 +0900 (Thu, 07 Feb 2008) $
31 * $Revision: 205 $ 43 * $Revision: 255 $
32 */ 44 */
33#endregion 45#endregion
34 46
@@ -83,9 +95,7 @@ namespace Prebuild.Core.Targets
83 if (solution.ProjectsTable.ContainsKey(refr.Name)) 95 if (solution.ProjectsTable.ContainsKey(refr.Name))
84 { 96 {
85 ProjectNode project = (ProjectNode)solution.ProjectsTable[refr.Name]; 97 ProjectNode project = (ProjectNode)solution.ProjectsTable[refr.Name];
86
87 string finalPath = Helper.NormalizePath(((ReferencePathNode)currentProject.ReferencePaths[0]).Path + refr.Name + GetProjectExtension(project), '/'); 98 string finalPath = Helper.NormalizePath(((ReferencePathNode)currentProject.ReferencePaths[0]).Path + refr.Name + GetProjectExtension(project), '/');
88
89 return finalPath; 99 return finalPath;
90 } 100 }
91 else 101 else
@@ -122,7 +132,6 @@ namespace Prebuild.Core.Targets
122 { 132 {
123 ProjectNode project = (ProjectNode)solution.ProjectsTable[refr.Name]; 133 ProjectNode project = (ProjectNode)solution.ProjectsTable[refr.Name];
124 string finalPath = Helper.NormalizePath(((ReferencePathNode)project.ReferencePaths[0]).Path, '/'); 134 string finalPath = Helper.NormalizePath(((ReferencePathNode)project.ReferencePaths[0]).Path, '/');
125
126 return finalPath; 135 return finalPath;
127 } 136 }
128 else 137 else
@@ -213,7 +222,7 @@ namespace Prebuild.Core.Targets
213 ss.WriteLine(" <target name=\"{0}\">", "build"); 222 ss.WriteLine(" <target name=\"{0}\">", "build");
214 ss.WriteLine(" <echo message=\"Build Directory is ${project::get-base-directory()}/${build.dir}\" />"); 223 ss.WriteLine(" <echo message=\"Build Directory is ${project::get-base-directory()}/${build.dir}\" />");
215 ss.WriteLine(" <mkdir dir=\"${project::get-base-directory()}/${build.dir}\" />"); 224 ss.WriteLine(" <mkdir dir=\"${project::get-base-directory()}/${build.dir}\" />");
216 ss.WriteLine(" <copy todir=\"${project::get-base-directory()}/${build.dir}\">"); 225 ss.WriteLine(" <copy todir=\"${project::get-base-directory()}/${build.dir}\" flatten=\"true\">");
217 ss.WriteLine(" <fileset basedir=\"${project::get-base-directory()}\">"); 226 ss.WriteLine(" <fileset basedir=\"${project::get-base-directory()}\">");
218 foreach (ReferenceNode refr in project.References) 227 foreach (ReferenceNode refr in project.References)
219 { 228 {
@@ -222,8 +231,41 @@ namespace Prebuild.Core.Targets
222 ss.WriteLine(" <include name=\"{0}", Helper.NormalizePath(Helper.MakePathRelativeTo(project.FullPath, BuildReference(solution, project, refr)) + "\" />", '/')); 231 ss.WriteLine(" <include name=\"{0}", Helper.NormalizePath(Helper.MakePathRelativeTo(project.FullPath, BuildReference(solution, project, refr)) + "\" />", '/'));
223 } 232 }
224 } 233 }
234
225 ss.WriteLine(" </fileset>"); 235 ss.WriteLine(" </fileset>");
226 ss.WriteLine(" </copy>"); 236 ss.WriteLine(" </copy>");
237 if (project.ConfigFile != null && project.ConfigFile.Length!=0)
238 {
239 ss.Write(" <copy file=\"" + project.ConfigFile + "\" tofile=\"${project::get-base-directory()}/${build.dir}/${project::get-name()}");
240
241 if (project.Type == ProjectType.Library)
242 {
243 ss.Write(".dll.config\"");
244 }
245 else
246 {
247 ss.Write(".exe.config\"");
248 }
249 ss.WriteLine(" />");
250 }
251
252 // Add the content files to just be copied
253 ss.WriteLine(" {0}", "<copy todir=\"${project::get-base-directory()}/${build.dir}\">");
254 ss.WriteLine(" {0}", "<fileset basedir=\".\">");
255
256 foreach (string file in project.Files)
257 {
258 // Ignore if we aren't content
259 if (project.Files.GetBuildAction(file) != BuildAction.Content)
260 continue;
261
262 // Create a include tag
263 ss.WriteLine(" {0}", "<include name=\"" + Helper.NormalizePath(PrependPath(file), '/') + "\" />");
264 }
265
266 ss.WriteLine(" {0}", "</fileset>");
267 ss.WriteLine(" {0}", "</copy>");
268
227 ss.Write(" <csc"); 269 ss.Write(" <csc");
228 ss.Write(" target=\"{0}\"", project.Type.ToString().ToLower()); 270 ss.Write(" target=\"{0}\"", project.Type.ToString().ToLower());
229 ss.Write(" debug=\"{0}\"", "${build.debug}"); 271 ss.Write(" debug=\"{0}\"", "${build.debug}");
@@ -245,6 +287,8 @@ namespace Prebuild.Core.Targets
245 ss.Write(" define=\"{0}\"", conf.Options.CompilerDefines); 287 ss.Write(" define=\"{0}\"", conf.Options.CompilerDefines);
246 break; 288 break;
247 } 289 }
290 ss.Write(" main=\"{0}\"", project.StartupObject);
291
248 foreach (ConfigurationNode conf in project.Configurations) 292 foreach (ConfigurationNode conf in project.Configurations)
249 { 293 {
250 if (GetXmlDocFile(project, conf) != "") 294 if (GetXmlDocFile(project, conf) != "")
@@ -476,14 +520,15 @@ namespace Prebuild.Core.Targets
476 520
477 ss.WriteLine(" <target name=\"init\" description=\"\">"); 521 ss.WriteLine(" <target name=\"init\" description=\"\">");
478 ss.WriteLine(" <call target=\"${project.config}\" />"); 522 ss.WriteLine(" <call target=\"${project.config}\" />");
479 ss.WriteLine(" <sysinfo />"); 523 ss.WriteLine(" <property name=\"sys.os.platform\"");
524 ss.WriteLine(" value=\"${platform::get-name()}\"");
525 ss.WriteLine(" />");
480 ss.WriteLine(" <echo message=\"Platform ${sys.os.platform}\" />"); 526 ss.WriteLine(" <echo message=\"Platform ${sys.os.platform}\" />");
481 ss.WriteLine(" <property name=\"build.dir\" value=\"${bin.dir}/${project.config}\" />"); 527 ss.WriteLine(" <property name=\"build.dir\" value=\"${bin.dir}/${project.config}\" />");
482 ss.WriteLine(" </target>"); 528 ss.WriteLine(" </target>");
483 ss.WriteLine(); 529 ss.WriteLine();
484 530
485 531
486
487 // sdague - ok, this is an ugly hack, but what it lets 532 // sdague - ok, this is an ugly hack, but what it lets
488 // us do is native include of files into the nant 533 // us do is native include of files into the nant
489 // created files from all .nant/*include files. This 534 // created files from all .nant/*include files. This
diff --git a/Prebuild/src/Core/Targets/SharpDevelop2Target.cs b/Prebuild/src/Core/Targets/SharpDevelop2Target.cs
index 6b0552e..0d78796 100644
--- a/Prebuild/src/Core/Targets/SharpDevelop2Target.cs
+++ b/Prebuild/src/Core/Targets/SharpDevelop2Target.cs
@@ -53,7 +53,7 @@ namespace Prebuild.Core.Targets
53 } 53 }
54 54
55 #region Public Methods 55 #region Public Methods
56 56
57 /// <summary> 57 /// <summary>
58 /// Gets the name. 58 /// Gets the name.
59 /// </summary> 59 /// </summary>
diff --git a/Prebuild/src/Core/Targets/SharpDevelopTarget.cs b/Prebuild/src/Core/Targets/SharpDevelopTarget.cs
index ededadb..6fe038b 100644
--- a/Prebuild/src/Core/Targets/SharpDevelopTarget.cs
+++ b/Prebuild/src/Core/Targets/SharpDevelopTarget.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: 2007-02-13 21:58:03 +0100 (ti, 13 feb 2007) $ 30 * $Date: 2007-02-14 05:58:03 +0900 (Wed, 14 Feb 2007) $
31 * $Revision: 205 $ 31 * $Revision: 205 $
32 */ 32 */
33#endregion 33#endregion
diff --git a/Prebuild/src/Core/Targets/VS2002Target.cs b/Prebuild/src/Core/Targets/VS2002Target.cs
index b380f36..7067cf3 100644
--- a/Prebuild/src/Core/Targets/VS2002Target.cs
+++ b/Prebuild/src/Core/Targets/VS2002Target.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-01-28 01:49:58 +0100 (, 28 jan 2006) $ 30 * $Date: 2006-01-28 09:49:58 +0900 (Sat, 28 Jan 2006) $
31 * $Revision: 71 $ 31 * $Revision: 71 $
32 */ 32 */
33#endregion 33#endregion
diff --git a/Prebuild/src/Core/Targets/VS2003Target.cs b/Prebuild/src/Core/Targets/VS2003Target.cs
index c3ca930..4bf05cb 100644
--- a/Prebuild/src/Core/Targets/VS2003Target.cs
+++ b/Prebuild/src/Core/Targets/VS2003Target.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-29 21:11:40 +0200 (fr, 29 sep 2006) $ 30 * $Date: 2006-09-30 04:11:40 +0900 (Sat, 30 Sep 2006) $
31 * $Revision: 177 $ 31 * $Revision: 177 $
32 */ 32 */
33#endregion 33#endregion
diff --git a/Prebuild/src/Core/Targets/VS2005Target.cs b/Prebuild/src/Core/Targets/VS2005Target.cs
index bd56beb..4c17a3a 100644
--- a/Prebuild/src/Core/Targets/VS2005Target.cs
+++ b/Prebuild/src/Core/Targets/VS2005Target.cs
@@ -26,9 +26,9 @@ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY O
26#region CVS Information 26#region CVS Information
27/* 27/*
28 * $Source$ 28 * $Source$
29 * $Author: robloach $ 29 * $Author: borrillis $
30 * $Date: 2007-02-27 19:52:34 +0100 (ti, 27 feb 2007) $ 30 * $Date: 2007-05-25 01:03:16 +0900 (Fri, 25 May 2007) $
31 * $Revision: 207 $ 31 * $Revision: 243 $
32 */ 32 */
33#endregion 33#endregion
34 34
@@ -36,6 +36,7 @@ using System;
36using System.Collections; 36using System.Collections;
37using System.Collections.Specialized; 37using System.Collections.Specialized;
38using System.IO; 38using System.IO;
39using System.Text;
39 40
40using Prebuild.Core.Attributes; 41using Prebuild.Core.Attributes;
41using Prebuild.Core.Interfaces; 42using Prebuild.Core.Interfaces;
@@ -235,7 +236,7 @@ namespace Prebuild.Core.Targets
235 236
236 Hashtable tools; 237 Hashtable tools;
237 Kernel kernel; 238 Kernel kernel;
238 239
239 protected virtual string ToolsVersionXml 240 protected virtual string ToolsVersionXml
240 { 241 {
241 get 242 get
@@ -249,7 +250,7 @@ namespace Prebuild.Core.Targets
249 get { return "# Visual Studio 2005"; } 250 get { return "# Visual Studio 2005"; }
250 } 251 }
251 252
252 /// <summary> 253 /// <summary>
253 /// Gets or sets the solution version. 254 /// Gets or sets the solution version.
254 /// </summary> 255 /// </summary>
255 /// <value>The solution version.</value> 256 /// <value>The solution version.</value>
@@ -260,6 +261,7 @@ namespace Prebuild.Core.Targets
260 return "9.00"; 261 return "9.00";
261 } 262 }
262 } 263 }
264
263 /// <summary> 265 /// <summary>
264 /// Gets or sets the product version. 266 /// Gets or sets the product version.
265 /// </summary> 267 /// </summary>
@@ -287,6 +289,7 @@ namespace Prebuild.Core.Targets
287 this.schemaVersion = value; 289 this.schemaVersion = value;
288 } 290 }
289 } 291 }
292
290 /// <summary> 293 /// <summary>
291 /// Gets or sets the name of the version. 294 /// Gets or sets the name of the version.
292 /// </summary> 295 /// </summary>
@@ -298,6 +301,7 @@ namespace Prebuild.Core.Targets
298 return "Visual C# 2005"; 301 return "Visual C# 2005";
299 } 302 }
300 } 303 }
304
301 /// <summary> 305 /// <summary>
302 /// Gets or sets the version. 306 /// Gets or sets the version.
303 /// </summary> 307 /// </summary>
@@ -377,7 +381,7 @@ namespace Prebuild.Core.Targets
377 #region Project File 381 #region Project File
378 using (ps) 382 using (ps)
379 { 383 {
380 ps.WriteLine("<Project DefaultTargets=\"Build\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\"{0}>", ToolsVersionXml ); 384 ps.WriteLine("<Project DefaultTargets=\"Build\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\"{0}>", ToolsVersionXml);
381 //ps.WriteLine(" <{0}", toolInfo.XMLTag); 385 //ps.WriteLine(" <{0}", toolInfo.XMLTag);
382 ps.WriteLine(" <PropertyGroup>"); 386 ps.WriteLine(" <PropertyGroup>");
383 ps.WriteLine(" <ProjectType>Local</ProjectType>"); 387 ps.WriteLine(" <ProjectType>Local</ProjectType>");
@@ -431,7 +435,7 @@ namespace Prebuild.Core.Targets
431 ps.WriteLine(" <ConfigurationOverrideFile>"); 435 ps.WriteLine(" <ConfigurationOverrideFile>");
432 ps.WriteLine(" </ConfigurationOverrideFile>"); 436 ps.WriteLine(" </ConfigurationOverrideFile>");
433 ps.WriteLine(" <DefineConstants>{0}</DefineConstants>", conf.Options["CompilerDefines"]); 437 ps.WriteLine(" <DefineConstants>{0}</DefineConstants>", conf.Options["CompilerDefines"]);
434 ps.WriteLine(" <DocumentationFile>{0}</DocumentationFile>", conf.Options["XmlDocFile"]); 438 ps.WriteLine(" <DocumentationFile>{0}</DocumentationFile>", Helper.NormalizePath(conf.Options["XmlDocFile"].ToString()));
435 ps.WriteLine(" <DebugSymbols>{0}</DebugSymbols>", conf.Options["DebugInformation"]); 439 ps.WriteLine(" <DebugSymbols>{0}</DebugSymbols>", conf.Options["DebugInformation"]);
436 ps.WriteLine(" <FileAlignment>{0}</FileAlignment>", conf.Options["FileAlignment"]); 440 ps.WriteLine(" <FileAlignment>{0}</FileAlignment>", conf.Options["FileAlignment"]);
437 // ps.WriteLine(" <IncrementalBuild = \"{0}\"", conf.Options["IncrementalBuild"]); 441 // ps.WriteLine(" <IncrementalBuild = \"{0}\"", conf.Options["IncrementalBuild"]);
@@ -458,7 +462,7 @@ namespace Prebuild.Core.Targets
458 // Assembly References 462 // Assembly References
459 ps.WriteLine(" <ItemGroup>"); 463 ps.WriteLine(" <ItemGroup>");
460 string refPath = ((ReferencePathNode) project.ReferencePaths[0]).Path; 464 string refPath = ((ReferencePathNode) project.ReferencePaths[0]).Path;
461 465
462 foreach (ReferenceNode refr in project.References) 466 foreach (ReferenceNode refr in project.References)
463 { 467 {
464 if (!solution.ProjectsTable.ContainsKey(refr.Name)) 468 if (!solution.ProjectsTable.ContainsKey(refr.Name))
@@ -471,7 +475,7 @@ namespace Prebuild.Core.Targets
471 475
472 string path; 476 string path;
473 477
474 if( refr.Name.EndsWith(".dll", StringComparison.InvariantCultureIgnoreCase )) 478 if (refr.Name.EndsWith(".dll", StringComparison.InvariantCultureIgnoreCase))
475 { 479 {
476 path = Helper.NormalizePath(Path.Combine( refPath, refr.Name), '\\'); 480 path = Helper.NormalizePath(Path.Combine( refPath, refr.Name), '\\');
477 } 481 }
@@ -479,7 +483,7 @@ namespace Prebuild.Core.Targets
479 { 483 {
480 path = refr.Name + ".dll"; 484 path = refr.Name + ".dll";
481 } 485 }
482 486
483 // TODO: Allow reference to *.exe files 487 // TODO: Allow reference to *.exe files
484 ps.WriteLine(" <HintPath>{0}</HintPath>", path ); 488 ps.WriteLine(" <HintPath>{0}</HintPath>", path );
485 ps.WriteLine(" <Private>{0}</Private>", refr.LocalCopy); 489 ps.WriteLine(" <Private>{0}</Private>", refr.LocalCopy);
@@ -602,35 +606,53 @@ namespace Prebuild.Core.Targets
602 { 606 {
603 if (!list.Contains(file)) 607 if (!list.Contains(file))
604 { 608 {
605 ps.Write(" <{0} ", project.Files.GetBuildAction(file)); 609 ps.Write(" <{0} ", project.Files.GetBuildAction(file));
606 ps.WriteLine("Include=\"{0}\">", file);
607 610
611 int startPos = 0;
612 if ( project.Files.GetPreservePath( file ) )
613 {
614 while ( ( @"./\" ).IndexOf( file.Substring( startPos, 1 ) ) != -1 )
615 startPos++;
608 616
609 if (file.Contains("Designer.cs")) 617 }
610 { 618 else
611 ps.WriteLine(" <DependentUpon>{0}</DependentUpon>", file.Substring(0, file.IndexOf(".Designer.cs")) + ".cs"); 619 {
612 } 620 startPos = file.LastIndexOf( Path.GetFileName( file ) );
621 }
622 ps.WriteLine("Include=\"{0}\">", Helper.NormalizePath(file));
613 623
614 if (project.Files.GetIsLink(file)) 624
615 { 625 if (file.Contains("Designer.cs"))
616 ps.WriteLine(" <Link>{0}</Link>", Path.GetFileName(file)); 626 {
617 } 627 string d = ".Designer.cs";
618 else if (project.Files.GetBuildAction(file) != BuildAction.None) 628 int index = file.Contains("\\") ? file.IndexOf("\\") + 1 : 0;
619 { 629 ps.WriteLine(" <DependentUpon>{0}</DependentUpon>", file.Substring(index, file.Length - index - d.Length) + ".cs");
620 if (project.Files.GetBuildAction(file) != BuildAction.EmbeddedResource) 630 }
621 { 631
622 ps.WriteLine(" <SubType>{0}</SubType>", project.Files.GetSubType(file)); 632 if (project.Files.GetIsLink(file))
623 } 633 {
624 } 634 string alias = project.Files.GetLinkPath( file );
625 if (project.Files.GetCopyToOutput(file) != CopyToOutput.Never) 635 alias += file.Substring( startPos );
636 alias = Helper.NormalizePath( alias );
637 ps.WriteLine( " <Link>{0}</Link>", alias );
638 }
639 else if (project.Files.GetBuildAction(file) != BuildAction.None)
640 {
641 if (project.Files.GetBuildAction(file) != BuildAction.EmbeddedResource)
626 { 642 {
627 ps.WriteLine(" <CopyToOutputDirectory>{0}</CopyToOutputDirectory>", project.Files.GetCopyToOutput(file)); 643 ps.WriteLine(" <SubType>{0}</SubType>", project.Files.GetSubType(file));
628 } 644 }
645 }
629 646
630 ps.WriteLine(" </{0}>", project.Files.GetBuildAction(file)); 647 if (project.Files.GetCopyToOutput(file) != CopyToOutput.Never)
648 {
649 ps.WriteLine(" <CopyToOutputDirectory>{0}</CopyToOutputDirectory>", project.Files.GetCopyToOutput(file));
631 } 650 }
651
652 ps.WriteLine(" </{0}>", project.Files.GetBuildAction(file));
632 } 653 }
633 } 654 }
655 }
634 // ps.WriteLine(" </Include>"); 656 // ps.WriteLine(" </Include>");
635 657
636 ps.WriteLine(" </ItemGroup>"); 658 ps.WriteLine(" </ItemGroup>");
@@ -658,15 +680,14 @@ namespace Prebuild.Core.Targets
658 ps.WriteLine(" <PropertyGroup>"); 680 ps.WriteLine(" <PropertyGroup>");
659 //ps.WriteLine(" <Settings ReferencePath=\"{0}\">", MakeRefPath(project)); 681 //ps.WriteLine(" <Settings ReferencePath=\"{0}\">", MakeRefPath(project));
660 682
661
662 ps.WriteLine(" <Configuration Condition=\" '$(Configuration)' == '' \">Debug</Configuration>"); 683 ps.WriteLine(" <Configuration Condition=\" '$(Configuration)' == '' \">Debug</Configuration>");
663 ps.WriteLine(" <Platform Condition=\" '$(Platform)' == '' \">AnyCPU</Platform>");
664 684
665 if (projectFile.Contains( "OpenSim.csproj" )) 685 if (projectFile.Contains( "OpenSim.csproj" ))
666 { 686 {
667 ps.WriteLine(" <StartArguments>-loginserver -sandbox -accounts</StartArguments>"); 687 ps.WriteLine(" <StartArguments>-loginserver -sandbox -accounts</StartArguments>");
668 } 688 }
669 689
690 ps.WriteLine(" <Platform Condition=\" '$(Platform)' == '' \">AnyCPU</Platform>");
670 ps.WriteLine(" <ReferencePath>{0}</ReferencePath>", MakeRefPath(project)); 691 ps.WriteLine(" <ReferencePath>{0}</ReferencePath>", MakeRefPath(project));
671 ps.WriteLine(" <LastOpenVersion>{0}</LastOpenVersion>", this.ProductVersion); 692 ps.WriteLine(" <LastOpenVersion>{0}</LastOpenVersion>", this.ProductVersion);
672 ps.WriteLine(" <ProjectView>ProjectFiles</ProjectView>"); 693 ps.WriteLine(" <ProjectView>ProjectFiles</ProjectView>");
@@ -678,7 +699,7 @@ namespace Prebuild.Core.Targets
678 ps.Write(" Condition = \" '$(Configuration)|$(Platform)' == '{0}|AnyCPU' \"", conf.Name); 699 ps.Write(" Condition = \" '$(Configuration)|$(Platform)' == '{0}|AnyCPU' \"", conf.Name);
679 ps.WriteLine(" />"); 700 ps.WriteLine(" />");
680 } 701 }
681 702
682 ps.WriteLine("</Project>"); 703 ps.WriteLine("</Project>");
683 } 704 }
684 #endregion 705 #endregion
diff --git a/Prebuild/src/Core/Targets/XcodeTarget.cs b/Prebuild/src/Core/Targets/XcodeTarget.cs
new file mode 100644
index 0000000..ee3b241
--- /dev/null
+++ b/Prebuild/src/Core/Targets/XcodeTarget.cs
@@ -0,0 +1,605 @@
1#region BSD License
2/*
3Copyright (c) 2004 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com)
4
5Redistribution and use in source and binary forms, with or without modification, are permitted
6provided that the following conditions are met:
7
8* Redistributions of source code must retain the above copyright notice, this list of conditions
9 and the following disclaimer.
10* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
11 and the following disclaimer in the documentation and/or other materials provided with the
12 distribution.
13* The name of the author may not be used to endorse or promote products derived from this software
14 without specific prior written permission.
15
16THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
17BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
19EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
22IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23*/
24#endregion
25
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
35using System;
36using System.Collections;
37using System.Collections.Specialized;
38using System.IO;
39using System.Reflection;
40using System.Text.RegularExpressions;
41
42using Prebuild.Core.Attributes;
43using Prebuild.Core.Interfaces;
44using Prebuild.Core.Nodes;
45using Prebuild.Core.Utilities;
46
47namespace Prebuild.Core.Targets
48{
49 /// <summary>
50 ///
51 /// </summary>
52 [Target("xcode")]
53 public class XcodeTarget : ITarget
54 {
55 #region Fields
56
57 private Kernel m_Kernel;
58
59 #endregion
60
61 #region Private Methods
62
63 private static string PrependPath(string path)
64 {
65 string tmpPath = Helper.NormalizePath(path, '/');
66 Regex regex = new Regex(@"(\w):/(\w+)");
67 Match match = regex.Match(tmpPath);
68 //if(match.Success || tmpPath[0] == '.' || tmpPath[0] == '/')
69 //{
70 tmpPath = Helper.NormalizePath(tmpPath);
71 //}
72 // else
73 // {
74 // tmpPath = Helper.NormalizePath("./" + tmpPath);
75 // }
76
77 return tmpPath;
78 }
79
80 private static string BuildReference(SolutionNode solution, ReferenceNode refr)
81 {
82 string ret = "";
83 if (solution.ProjectsTable.ContainsKey(refr.Name))
84 {
85 ProjectNode project = (ProjectNode)solution.ProjectsTable[refr.Name];
86 string fileRef = FindFileReference(refr.Name, project);
87 string finalPath = Helper.NormalizePath(Helper.MakeFilePath(project.FullPath + "/${build.dir}/", refr.Name, "dll"), '/');
88 ret += finalPath;
89 return ret;
90 }
91 else
92 {
93 ProjectNode project = (ProjectNode)refr.Parent;
94 string fileRef = FindFileReference(refr.Name, project);
95
96 if (refr.Path != null || fileRef != null)
97 {
98 string finalPath = (refr.Path != null) ? Helper.NormalizePath(refr.Path + "/" + refr.Name + ".dll", '/') : fileRef;
99 ret += finalPath;
100 return ret;
101 }
102
103 try
104 {
105 //Assembly assem = Assembly.Load(refr.Name);
106 //if (assem != null)
107 //{
108 //ret += (refr.Name + ".dll");
109 //}
110 //else
111 //{
112 ret += (refr.Name + ".dll");
113 //}
114 }
115 catch (System.NullReferenceException e)
116 {
117 e.ToString();
118 ret += refr.Name + ".dll";
119 }
120 }
121 return ret;
122 }
123
124 private static string BuildReferencePath(SolutionNode solution, ReferenceNode refr)
125 {
126 string ret = "";
127 if (solution.ProjectsTable.ContainsKey(refr.Name))
128 {
129 ProjectNode project = (ProjectNode)solution.ProjectsTable[refr.Name];
130 string fileRef = FindFileReference(refr.Name, project);
131 string finalPath = Helper.NormalizePath(Helper.MakeReferencePath(project.FullPath + "/${build.dir}/"), '/');
132 ret += finalPath;
133 return ret;
134 }
135 else
136 {
137 ProjectNode project = (ProjectNode)refr.Parent;
138 string fileRef = FindFileReference(refr.Name, project);
139
140 if (refr.Path != null || fileRef != null)
141 {
142 string finalPath = (refr.Path != null) ? Helper.NormalizePath(refr.Path, '/') : fileRef;
143 ret += finalPath;
144 return ret;
145 }
146
147 try
148 {
149 Assembly assem = Assembly.Load(refr.Name);
150 if (assem != null)
151 {
152 ret += "";
153 }
154 else
155 {
156 ret += "";
157 }
158 }
159 catch (System.NullReferenceException e)
160 {
161 e.ToString();
162 ret += "";
163 }
164 }
165 return ret;
166 }
167
168 private static string FindFileReference(string refName, ProjectNode project)
169 {
170 foreach (ReferencePathNode refPath in project.ReferencePaths)
171 {
172 string fullPath = Helper.MakeFilePath(refPath.Path, refName, "dll");
173
174 if (File.Exists(fullPath))
175 {
176 return fullPath;
177 }
178 }
179
180 return null;
181 }
182
183 /// <summary>
184 /// Gets the XML doc file.
185 /// </summary>
186 /// <param name="project">The project.</param>
187 /// <param name="conf">The conf.</param>
188 /// <returns></returns>
189 public static string GetXmlDocFile(ProjectNode project, ConfigurationNode conf)
190 {
191 if (conf == null)
192 {
193 throw new ArgumentNullException("conf");
194 }
195 if (project == null)
196 {
197 throw new ArgumentNullException("project");
198 }
199 string docFile = (string)conf.Options["XmlDocFile"];
200 // if(docFile != null && docFile.Length == 0)//default to assembly name if not specified
201 // {
202 // return Path.GetFileNameWithoutExtension(project.AssemblyName) + ".xml";
203 // }
204 return docFile;
205 }
206
207 private void WriteProject(SolutionNode solution, ProjectNode project)
208 {
209 string projFile = Helper.MakeFilePath(project.FullPath, project.Name + (project.Type == ProjectType.Library ? ".dll" : ".exe"), "build");
210 StreamWriter ss = new StreamWriter(projFile);
211
212 m_Kernel.CurrentWorkingDirectory.Push();
213 Helper.SetCurrentDir(Path.GetDirectoryName(projFile));
214 bool hasDoc = false;
215
216 using (ss)
217 {
218 ss.WriteLine("<?xml version=\"1.0\" ?>");
219 ss.WriteLine("<project name=\"{0}\" default=\"build\">", project.Name);
220 ss.WriteLine(" <target name=\"{0}\">", "build");
221 ss.WriteLine(" <echo message=\"Build Directory is ${project::get-base-directory()}/${build.dir}\" />");
222 ss.WriteLine(" <mkdir dir=\"${project::get-base-directory()}/${build.dir}\" />");
223 ss.WriteLine(" <copy todir=\"${project::get-base-directory()}/${build.dir}\">");
224 ss.WriteLine(" <fileset basedir=\"${project::get-base-directory()}\">");
225 foreach (ReferenceNode refr in project.References)
226 {
227 if (refr.LocalCopy)
228 {
229 ss.WriteLine(" <include name=\"{0}", Helper.NormalizePath(Helper.MakePathRelativeTo(project.FullPath, BuildReference(solution, refr)) + "\" />", '/'));
230 }
231 }
232 ss.WriteLine(" </fileset>");
233 ss.WriteLine(" </copy>");
234 ss.Write(" <csc");
235 ss.Write(" target=\"{0}\"", project.Type.ToString().ToLower());
236 ss.Write(" debug=\"{0}\"", "${build.debug}");
237 foreach (ConfigurationNode conf in project.Configurations)
238 {
239 if (conf.Options.KeyFile != "")
240 {
241 ss.Write(" keyfile=\"{0}\"", conf.Options.KeyFile);
242 break;
243 }
244 }
245 foreach (ConfigurationNode conf in project.Configurations)
246 {
247 ss.Write(" unsafe=\"{0}\"", conf.Options.AllowUnsafe);
248 break;
249 }
250 foreach (ConfigurationNode conf in project.Configurations)
251 {
252 ss.Write(" define=\"{0}\"", conf.Options.CompilerDefines);
253 break;
254 }
255 foreach (ConfigurationNode conf in project.Configurations)
256 {
257 if (GetXmlDocFile(project, conf) != "")
258 {
259 ss.Write(" doc=\"{0}\"", "${project::get-base-directory()}/${build.dir}/" + GetXmlDocFile(project, conf));
260 hasDoc = true;
261 }
262 break;
263 }
264 ss.Write(" output=\"{0}", "${project::get-base-directory()}/${build.dir}/${project::get-name()}");
265 if (project.Type == ProjectType.Library)
266 {
267 ss.Write(".dll\"");
268 }
269 else
270 {
271 ss.Write(".exe\"");
272 }
273 if (project.AppIcon != null && project.AppIcon.Length != 0)
274 {
275 ss.Write(" win32icon=\"{0}\"", Helper.NormalizePath(project.AppIcon, '/'));
276 }
277 ss.WriteLine(">");
278 ss.WriteLine(" <resources prefix=\"{0}\" dynamicprefix=\"true\" >", project.RootNamespace);
279 foreach (string file in project.Files)
280 {
281 switch (project.Files.GetBuildAction(file))
282 {
283 case BuildAction.EmbeddedResource:
284 ss.WriteLine(" {0}", "<include name=\"" + Helper.NormalizePath(PrependPath(file), '/') + "\" />");
285 break;
286 default:
287 if (project.Files.GetSubType(file) != SubType.Code && project.Files.GetSubType(file) != SubType.Settings)
288 {
289 ss.WriteLine(" <include name=\"{0}\" />", file.Substring(0, file.LastIndexOf('.')) + ".resx");
290 }
291 break;
292 }
293 }
294 //if (project.Files.GetSubType(file).ToString() != "Code")
295 //{
296 // ps.WriteLine(" <EmbeddedResource Include=\"{0}\">", file.Substring(0, file.LastIndexOf('.')) + ".resx");
297
298 ss.WriteLine(" </resources>");
299 ss.WriteLine(" <sources failonempty=\"true\">");
300 foreach (string file in project.Files)
301 {
302 switch (project.Files.GetBuildAction(file))
303 {
304 case BuildAction.Compile:
305 ss.WriteLine(" <include name=\"" + Helper.NormalizePath(PrependPath(file), '/') + "\" />");
306 break;
307 default:
308 break;
309 }
310 }
311 ss.WriteLine(" </sources>");
312 ss.WriteLine(" <references basedir=\"${project::get-base-directory()}\">");
313 ss.WriteLine(" <lib>");
314 ss.WriteLine(" <include name=\"${project::get-base-directory()}\" />");
315 ss.WriteLine(" <include name=\"${project::get-base-directory()}/${build.dir}\" />");
316 ss.WriteLine(" </lib>");
317 foreach (ReferenceNode refr in project.References)
318 {
319 ss.WriteLine(" <include name=\"{0}", Helper.NormalizePath(Helper.MakePathRelativeTo(project.FullPath, BuildReference(solution, refr)) + "\" />", '/'));
320 }
321 ss.WriteLine(" </references>");
322
323 ss.WriteLine(" </csc>");
324 ss.WriteLine(" </target>");
325
326 ss.WriteLine(" <target name=\"clean\">");
327 ss.WriteLine(" <delete dir=\"${bin.dir}\" failonerror=\"false\" />");
328 ss.WriteLine(" <delete dir=\"${obj.dir}\" failonerror=\"false\" />");
329 ss.WriteLine(" </target>");
330
331 ss.WriteLine(" <target name=\"doc\" description=\"Creates documentation.\">");
332 if (hasDoc)
333 {
334 ss.WriteLine(" <property name=\"doc.target\" value=\"\" />");
335 ss.WriteLine(" <if test=\"${platform::is-unix()}\">");
336 ss.WriteLine(" <property name=\"doc.target\" value=\"Web\" />");
337 ss.WriteLine(" </if>");
338 ss.WriteLine(" <ndoc failonerror=\"false\" verbose=\"true\">");
339 ss.WriteLine(" <assemblies basedir=\"${project::get-base-directory()}\">");
340 ss.Write(" <include name=\"${build.dir}/${project::get-name()}");
341 if (project.Type == ProjectType.Library)
342 {
343 ss.WriteLine(".dll\" />");
344 }
345 else
346 {
347 ss.WriteLine(".exe\" />");
348 }
349
350 ss.WriteLine(" </assemblies>");
351 ss.WriteLine(" <summaries basedir=\"${project::get-base-directory()}\">");
352 ss.WriteLine(" <include name=\"${build.dir}/${project::get-name()}.xml\"/>");
353 ss.WriteLine(" </summaries>");
354 ss.WriteLine(" <referencepaths basedir=\"${project::get-base-directory()}\">");
355 ss.WriteLine(" <include name=\"${build.dir}\" />");
356 // foreach(ReferenceNode refr in project.References)
357 // {
358 // string path = Helper.NormalizePath(Helper.MakePathRelativeTo(project.FullPath, BuildReferencePath(solution, refr)), '/');
359 // if (path != "")
360 // {
361 // ss.WriteLine(" <include name=\"{0}\" />", path);
362 // }
363 // }
364 ss.WriteLine(" </referencepaths>");
365 ss.WriteLine(" <documenters>");
366 ss.WriteLine(" <documenter name=\"MSDN\">");
367 ss.WriteLine(" <property name=\"OutputDirectory\" value=\"${project::get-base-directory()}/${build.dir}/doc/${project::get-name()}\" />");
368 ss.WriteLine(" <property name=\"OutputTarget\" value=\"${doc.target}\" />");
369 ss.WriteLine(" <property name=\"HtmlHelpName\" value=\"${project::get-name()}\" />");
370 ss.WriteLine(" <property name=\"IncludeFavorites\" value=\"False\" />");
371 ss.WriteLine(" <property name=\"Title\" value=\"${project::get-name()} SDK Documentation\" />");
372 ss.WriteLine(" <property name=\"SplitTOCs\" value=\"False\" />");
373 ss.WriteLine(" <property name=\"DefaulTOC\" value=\"\" />");
374 ss.WriteLine(" <property name=\"ShowVisualBasic\" value=\"True\" />");
375 ss.WriteLine(" <property name=\"AutoDocumentConstructors\" value=\"True\" />");
376 ss.WriteLine(" <property name=\"ShowMissingSummaries\" value=\"${build.debug}\" />");
377 ss.WriteLine(" <property name=\"ShowMissingRemarks\" value=\"${build.debug}\" />");
378 ss.WriteLine(" <property name=\"ShowMissingParams\" value=\"${build.debug}\" />");
379 ss.WriteLine(" <property name=\"ShowMissingReturns\" value=\"${build.debug}\" />");
380 ss.WriteLine(" <property name=\"ShowMissingValues\" value=\"${build.debug}\" />");
381 ss.WriteLine(" <property name=\"DocumentInternals\" value=\"False\" />");
382 ss.WriteLine(" <property name=\"DocumentPrivates\" value=\"False\" />");
383 ss.WriteLine(" <property name=\"DocumentProtected\" value=\"True\" />");
384 ss.WriteLine(" <property name=\"DocumentEmptyNamespaces\" value=\"${build.debug}\" />");
385 ss.WriteLine(" <property name=\"IncludeAssemblyVersion\" value=\"True\" />");
386 ss.WriteLine(" </documenter>");
387 ss.WriteLine(" </documenters>");
388 ss.WriteLine(" </ndoc>");
389 }
390 ss.WriteLine(" </target>");
391 ss.WriteLine("</project>");
392 }
393 m_Kernel.CurrentWorkingDirectory.Pop();
394 }
395
396 private void WriteCombine(SolutionNode solution)
397 {
398 m_Kernel.Log.Write("Creating Xcode build files");
399 foreach (ProjectNode project in solution.Projects)
400 {
401 if (m_Kernel.AllowProject(project.FilterGroups))
402 {
403 m_Kernel.Log.Write("...Creating project: {0}", project.Name);
404 WriteProject(solution, project);
405 }
406 }
407
408 m_Kernel.Log.Write("");
409 DirectoryInfo directoryInfo = new DirectoryInfo(Path.Combine(solution.FullPath, solution.Name + ".xcodeproj"));
410 if (!directoryInfo.Exists)
411 {
412 directoryInfo.Create();
413 }
414 string combFile = Helper.MakeFilePath(Path.Combine(solution.FullPath, solution.Name + ".xcodeproj"), "project", "pbxproj");
415 StreamWriter ss = new StreamWriter(combFile);
416
417 m_Kernel.CurrentWorkingDirectory.Push();
418 Helper.SetCurrentDir(Path.GetDirectoryName(combFile));
419
420 using (ss)
421 {
422 ss.WriteLine("<?xml version=\"1.0\" ?>");
423 ss.WriteLine("<project name=\"{0}\" default=\"build\">", solution.Name);
424 ss.WriteLine(" <echo message=\"Using '${nant.settings.currentframework}' Framework\"/>");
425 ss.WriteLine();
426
427 //ss.WriteLine(" <property name=\"dist.dir\" value=\"dist\" />");
428 //ss.WriteLine(" <property name=\"source.dir\" value=\"source\" />");
429 ss.WriteLine(" <property name=\"bin.dir\" value=\"bin\" />");
430 ss.WriteLine(" <property name=\"obj.dir\" value=\"obj\" />");
431 ss.WriteLine(" <property name=\"doc.dir\" value=\"doc\" />");
432 ss.WriteLine(" <property name=\"project.main.dir\" value=\"${project::get-base-directory()}\" />");
433
434 foreach (ConfigurationNode conf in solution.Configurations)
435 {
436 // Set the project.config to a non-debug configuration
437 if (conf.Options["DebugInformation"].ToString().ToLower() != "true")
438 {
439 ss.WriteLine(" <property name=\"project.config\" value=\"{0}\" />", conf.Name);
440 }
441 ss.WriteLine();
442 ss.WriteLine(" <target name=\"{0}\" description=\"\">", conf.Name);
443 ss.WriteLine(" <property name=\"project.config\" value=\"{0}\" />", conf.Name);
444 ss.WriteLine(" <property name=\"build.debug\" value=\"{0}\" />", conf.Options["DebugInformation"].ToString().ToLower());
445 ss.WriteLine(" </target>");
446 ss.WriteLine();
447 }
448
449 ss.WriteLine(" <target name=\"net-1.1\" description=\"Sets framework to .NET 1.1\">");
450 ss.WriteLine(" <property name=\"nant.settings.currentframework\" value=\"net-1.1\" />");
451 ss.WriteLine(" </target>");
452 ss.WriteLine();
453
454 ss.WriteLine(" <target name=\"net-2.0\" description=\"Sets framework to .NET 2.0\">");
455 ss.WriteLine(" <property name=\"nant.settings.currentframework\" value=\"net-2.0\" />");
456 ss.WriteLine(" </target>");
457 ss.WriteLine();
458
459 ss.WriteLine(" <target name=\"mono-2.0\" description=\"Sets framework to mono 2.0\">");
460 ss.WriteLine(" <property name=\"nant.settings.currentframework\" value=\"mono-2.0\" />");
461 ss.WriteLine(" </target>");
462 ss.WriteLine();
463
464 ss.WriteLine(" <target name=\"mono-1.0\" description=\"Sets framework to mono 1.0\">");
465 ss.WriteLine(" <property name=\"nant.settings.currentframework\" value=\"mono-1.0\" />");
466 ss.WriteLine(" </target>");
467 ss.WriteLine();
468
469 ss.WriteLine(" <target name=\"init\" description=\"\">");
470 ss.WriteLine(" <call target=\"${project.config}\" />");
471 ss.WriteLine(" <sysinfo />");
472 ss.WriteLine(" <echo message=\"Platform ${sys.os.platform}\" />");
473 ss.WriteLine(" <property name=\"build.dir\" value=\"${bin.dir}/${project.config}\" />");
474 ss.WriteLine(" </target>");
475 ss.WriteLine();
476
477 ss.WriteLine(" <target name=\"clean\" description=\"\">");
478 ss.WriteLine(" <echo message=\"Deleting all builds from all configurations\" />");
479 //ss.WriteLine(" <delete dir=\"${dist.dir}\" failonerror=\"false\" />");
480 ss.WriteLine(" <delete dir=\"${bin.dir}\" failonerror=\"false\" />");
481 ss.WriteLine(" <delete dir=\"${obj.dir}\" failonerror=\"false\" />");
482 //foreach(ProjectNode project in solution.Projects)
483 //{
484 // string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath);
485 // ss.Write(" <nant buildfile=\"{0}\"",
486 // Helper.NormalizePath(Helper.MakeFilePath(path, project.Name + (project.Type == ProjectType.Library ? ".dll" : ".exe"), "build"),'/'));
487 // ss.WriteLine(" target=\"clean\" />");
488 //}
489 ss.WriteLine(" </target>");
490 ss.WriteLine();
491
492 ss.WriteLine(" <target name=\"build\" depends=\"init\" description=\"\">");
493
494 foreach (ProjectNode project in solution.ProjectsTableOrder)
495 {
496 string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath);
497 ss.Write(" <nant buildfile=\"{0}\"",
498 Helper.NormalizePath(Helper.MakeFilePath(path, project.Name + (project.Type == ProjectType.Library ? ".dll" : ".exe"), "build"), '/'));
499 ss.WriteLine(" target=\"build\" />");
500 }
501 ss.WriteLine(" </target>");
502 ss.WriteLine();
503
504 ss.WriteLine(" <target name=\"build-release\" depends=\"Release, init, build\" description=\"Builds in Release mode\" />");
505 ss.WriteLine();
506 ss.WriteLine(" <target name=\"build-debug\" depends=\"Debug, init, build\" description=\"Builds in Debug mode\" />");
507 ss.WriteLine();
508 //ss.WriteLine(" <target name=\"package\" depends=\"clean, doc, copyfiles, zip\" description=\"Builds in Release mode\" />");
509 ss.WriteLine(" <target name=\"package\" depends=\"clean, doc\" description=\"Builds all\" />");
510 ss.WriteLine();
511
512 ss.WriteLine(" <target name=\"doc\" depends=\"build-release\">");
513 ss.WriteLine(" <echo message=\"Generating all documentation from all builds\" />");
514 foreach (ProjectNode project in solution.Projects)
515 {
516 string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath);
517 ss.Write(" <nant buildfile=\"{0}\"",
518 Helper.NormalizePath(Helper.MakeFilePath(path, project.Name + (project.Type == ProjectType.Library ? ".dll" : ".exe"), "build"), '/'));
519 ss.WriteLine(" target=\"doc\" />");
520 }
521 ss.WriteLine(" </target>");
522 ss.WriteLine();
523 ss.WriteLine("</project>");
524 }
525
526 m_Kernel.CurrentWorkingDirectory.Pop();
527 }
528
529 private void CleanProject(ProjectNode project)
530 {
531 m_Kernel.Log.Write("...Cleaning project: {0}", project.Name);
532 string projectFile = Helper.MakeFilePath(project.FullPath, project.Name + (project.Type == ProjectType.Library ? ".dll" : ".exe"), "build");
533 Helper.DeleteIfExists(projectFile);
534 }
535
536 private void CleanSolution(SolutionNode solution)
537 {
538 m_Kernel.Log.Write("Cleaning Xcode build files for", solution.Name);
539
540 string slnFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "build");
541 Helper.DeleteIfExists(slnFile);
542
543 foreach (ProjectNode project in solution.Projects)
544 {
545 CleanProject(project);
546 }
547
548 m_Kernel.Log.Write("");
549 }
550
551 #endregion
552
553 #region ITarget Members
554
555 /// <summary>
556 /// Writes the specified kern.
557 /// </summary>
558 /// <param name="kern">The kern.</param>
559 public void Write(Kernel kern)
560 {
561 if (kern == null)
562 {
563 throw new ArgumentNullException("kern");
564 }
565 m_Kernel = kern;
566 foreach (SolutionNode solution in kern.Solutions)
567 {
568 WriteCombine(solution);
569 }
570 m_Kernel = null;
571 }
572
573 /// <summary>
574 /// Cleans the specified kern.
575 /// </summary>
576 /// <param name="kern">The kern.</param>
577 public virtual void Clean(Kernel kern)
578 {
579 if (kern == null)
580 {
581 throw new ArgumentNullException("kern");
582 }
583 m_Kernel = kern;
584 foreach (SolutionNode sol in kern.Solutions)
585 {
586 CleanSolution(sol);
587 }
588 m_Kernel = null;
589 }
590
591 /// <summary>
592 /// Gets the name.
593 /// </summary>
594 /// <value>The name.</value>
595 public string Name
596 {
597 get
598 {
599 return "xcode";
600 }
601 }
602
603 #endregion
604 }
605}
diff --git a/Prebuild/src/Core/Utilities/CommandLineCollection.cs b/Prebuild/src/Core/Utilities/CommandLineCollection.cs
index 62eb18b..5733547 100644
--- a/Prebuild/src/Core/Utilities/CommandLineCollection.cs
+++ b/Prebuild/src/Core/Utilities/CommandLineCollection.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: robloach $ 29 * $Author: robloach $
30 * $Date: 2006-09-26 00:30:53 +0200 (ti, 26 sep 2006) $ 30 * $Date: 2006-09-26 07:30:53 +0900 (Tue, 26 Sep 2006) $
31 * $Revision: 165 $ 31 * $Revision: 165 $
32 */ 32 */
33#endregion 33#endregion
diff --git a/Prebuild/src/Core/Utilities/CurrentDirectory.cs b/Prebuild/src/Core/Utilities/CurrentDirectory.cs
index ff2d159..abbed52 100644
--- a/Prebuild/src/Core/Utilities/CurrentDirectory.cs
+++ b/Prebuild/src/Core/Utilities/CurrentDirectory.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-01-28 01:49:58 +0100 (, 28 jan 2006) $ 30 * $Date: 2006-01-28 09:49:58 +0900 (Sat, 28 Jan 2006) $
31 * $Revision: 71 $ 31 * $Revision: 71 $
32 */ 32 */
33#endregion 33#endregion
diff --git a/Prebuild/src/Core/Utilities/Helper.cs b/Prebuild/src/Core/Utilities/Helper.cs
index 27b9ccf..19093ce 100644
--- a/Prebuild/src/Core/Utilities/Helper.cs
+++ b/Prebuild/src/Core/Utilities/Helper.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: 2007-02-13 21:58:03 +0100 (ti, 13 feb 2007) $ 30 * $Date: 2007-02-14 05:58:03 +0900 (Wed, 14 Feb 2007) $
31 * $Revision: 205 $ 31 * $Revision: 205 $
32 */ 32 */
33#endregion 33#endregion
diff --git a/Prebuild/src/Core/Utilities/Log.cs b/Prebuild/src/Core/Utilities/Log.cs
index 2f26557..e8105ac 100644
--- a/Prebuild/src/Core/Utilities/Log.cs
+++ b/Prebuild/src/Core/Utilities/Log.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-01-28 01:49:58 +0100 (, 28 jan 2006) $ 30 * $Date: 2006-01-28 09:49:58 +0900 (Sat, 28 Jan 2006) $
31 * $Revision: 71 $ 31 * $Revision: 71 $
32 */ 32 */
33#endregion 33#endregion
diff --git a/Prebuild/src/Core/WarningException.cs b/Prebuild/src/Core/WarningException.cs
index ce685cd..df90dc8 100644
--- a/Prebuild/src/Core/WarningException.cs
+++ b/Prebuild/src/Core/WarningException.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 01:49:58 +0100 (lö, 28 jan 2006) $
31 * $Revision: 71 $
32 */
33#endregion
34
35using System; 26using System;
36using System.Runtime.Serialization; 27using System.Runtime.Serialization;
37 28