diff options
Diffstat (limited to 'Prebuild/src/Core')
36 files changed, 10429 insertions, 10429 deletions
diff --git a/Prebuild/src/Core/Attributes/DataNodeAttribute.cs b/Prebuild/src/Core/Attributes/DataNodeAttribute.cs index dbdaf0b..0786fe5 100644 --- a/Prebuild/src/Core/Attributes/DataNodeAttribute.cs +++ b/Prebuild/src/Core/Attributes/DataNodeAttribute.cs | |||
@@ -1,81 +1,81 @@ | |||
1 | #region BSD License | 1 | #region BSD License |
2 | /* | 2 | /* |
3 | Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) | 3 | Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) |
4 | 4 | ||
5 | Redistribution and use in source and binary forms, with or without modification, are permitted | 5 | Redistribution and use in source and binary forms, with or without modification, are permitted |
6 | provided that the following conditions are met: | 6 | provided that the following conditions are met: |
7 | 7 | ||
8 | * Redistributions of source code must retain the above copyright notice, this list of conditions | 8 | * Redistributions of source code must retain the above copyright notice, this list of conditions |
9 | and the following disclaimer. | 9 | and the following disclaimer. |
10 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions | 10 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions |
11 | and the following disclaimer in the documentation and/or other materials provided with the | 11 | and the following disclaimer in the documentation and/or other materials provided with the |
12 | distribution. | 12 | distribution. |
13 | * The name of the author may not be used to endorse or promote products derived from this software | 13 | * The name of the author may not be used to endorse or promote products derived from this software |
14 | without specific prior written permission. | 14 | without specific prior written permission. |
15 | 15 | ||
16 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, | 16 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, |
17 | BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | 17 | BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
18 | ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | 18 | ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
19 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | 19 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
20 | OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY | 20 | OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
21 | OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | 21 | OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING |
22 | IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 22 | IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
23 | */ | 23 | */ |
24 | #endregion | 24 | #endregion |
25 | 25 | ||
26 | #region CVS Information | 26 | #region CVS Information |
27 | /* | 27 | /* |
28 | * $Source$ | 28 | * $Source$ |
29 | * $Author: jendave $ | 29 | * $Author: jendave $ |
30 | * $Date: 2006-01-28 01:49:58 +0100 (lö, 28 jan 2006) $ | 30 | * $Date: 2006-01-28 01:49:58 +0100 (lö, 28 jan 2006) $ |
31 | * $Revision: 71 $ | 31 | * $Revision: 71 $ |
32 | */ | 32 | */ |
33 | #endregion | 33 | #endregion |
34 | 34 | ||
35 | using System; | 35 | using System; |
36 | using System.Collections.Specialized; | 36 | using System.Collections.Specialized; |
37 | 37 | ||
38 | namespace Prebuild.Core.Attributes | 38 | namespace Prebuild.Core.Attributes |
39 | { | 39 | { |
40 | /// <summary> | 40 | /// <summary> |
41 | /// | 41 | /// |
42 | /// </summary> | 42 | /// </summary> |
43 | [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct)] | 43 | [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct)] |
44 | public sealed class DataNodeAttribute : Attribute | 44 | public sealed class DataNodeAttribute : Attribute |
45 | { | 45 | { |
46 | #region Fields | 46 | #region Fields |
47 | 47 | ||
48 | private string m_Name = "unknown"; | 48 | private string m_Name = "unknown"; |
49 | 49 | ||
50 | #endregion | 50 | #endregion |
51 | 51 | ||
52 | #region Constructors | 52 | #region Constructors |
53 | 53 | ||
54 | /// <summary> | 54 | /// <summary> |
55 | /// Initializes a new instance of the <see cref="DataNodeAttribute"/> class. | 55 | /// Initializes a new instance of the <see cref="DataNodeAttribute"/> class. |
56 | /// </summary> | 56 | /// </summary> |
57 | /// <param name="name">The name.</param> | 57 | /// <param name="name">The name.</param> |
58 | public DataNodeAttribute(string name) | 58 | public DataNodeAttribute(string name) |
59 | { | 59 | { |
60 | m_Name = name; | 60 | m_Name = name; |
61 | } | 61 | } |
62 | 62 | ||
63 | #endregion | 63 | #endregion |
64 | 64 | ||
65 | #region Properties | 65 | #region Properties |
66 | 66 | ||
67 | /// <summary> | 67 | /// <summary> |
68 | /// Gets the name. | 68 | /// Gets the name. |
69 | /// </summary> | 69 | /// </summary> |
70 | /// <value>The name.</value> | 70 | /// <value>The name.</value> |
71 | public string Name | 71 | public string Name |
72 | { | 72 | { |
73 | get | 73 | get |
74 | { | 74 | { |
75 | return m_Name; | 75 | return m_Name; |
76 | } | 76 | } |
77 | } | 77 | } |
78 | 78 | ||
79 | #endregion | 79 | #endregion |
80 | } | 80 | } |
81 | } | 81 | } |
diff --git a/Prebuild/src/Core/Attributes/OptionNodeAttribute.cs b/Prebuild/src/Core/Attributes/OptionNodeAttribute.cs index edda56d..a63e840 100644 --- a/Prebuild/src/Core/Attributes/OptionNodeAttribute.cs +++ b/Prebuild/src/Core/Attributes/OptionNodeAttribute.cs | |||
@@ -1,80 +1,80 @@ | |||
1 | #region BSD License | 1 | #region BSD License |
2 | /* | 2 | /* |
3 | Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) | 3 | Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) |
4 | 4 | ||
5 | Redistribution and use in source and binary forms, with or without modification, are permitted | 5 | Redistribution and use in source and binary forms, with or without modification, are permitted |
6 | provided that the following conditions are met: | 6 | provided that the following conditions are met: |
7 | 7 | ||
8 | * Redistributions of source code must retain the above copyright notice, this list of conditions | 8 | * Redistributions of source code must retain the above copyright notice, this list of conditions |
9 | and the following disclaimer. | 9 | and the following disclaimer. |
10 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions | 10 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions |
11 | and the following disclaimer in the documentation and/or other materials provided with the | 11 | and the following disclaimer in the documentation and/or other materials provided with the |
12 | distribution. | 12 | distribution. |
13 | * The name of the author may not be used to endorse or promote products derived from this software | 13 | * The name of the author may not be used to endorse or promote products derived from this software |
14 | without specific prior written permission. | 14 | without specific prior written permission. |
15 | 15 | ||
16 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, | 16 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, |
17 | BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | 17 | BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
18 | ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | 18 | ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
19 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | 19 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
20 | OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY | 20 | OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
21 | OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | 21 | OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING |
22 | IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 22 | IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
23 | */ | 23 | */ |
24 | #endregion | 24 | #endregion |
25 | 25 | ||
26 | #region CVS Information | 26 | #region CVS Information |
27 | /* | 27 | /* |
28 | * $Source$ | 28 | * $Source$ |
29 | * $Author: jendave $ | 29 | * $Author: jendave $ |
30 | * $Date: 2006-01-28 01:49:58 +0100 (lö, 28 jan 2006) $ | 30 | * $Date: 2006-01-28 01:49:58 +0100 (lö, 28 jan 2006) $ |
31 | * $Revision: 71 $ | 31 | * $Revision: 71 $ |
32 | */ | 32 | */ |
33 | #endregion | 33 | #endregion |
34 | 34 | ||
35 | using System; | 35 | using System; |
36 | 36 | ||
37 | namespace Prebuild.Core.Attributes | 37 | namespace Prebuild.Core.Attributes |
38 | { | 38 | { |
39 | /// <summary> | 39 | /// <summary> |
40 | /// | 40 | /// |
41 | /// </summary> | 41 | /// </summary> |
42 | [AttributeUsage(AttributeTargets.Field)] | 42 | [AttributeUsage(AttributeTargets.Field)] |
43 | public sealed class OptionNodeAttribute : Attribute | 43 | public sealed class OptionNodeAttribute : Attribute |
44 | { | 44 | { |
45 | #region Fields | 45 | #region Fields |
46 | 46 | ||
47 | private string m_NodeName; | 47 | private string m_NodeName; |
48 | 48 | ||
49 | #endregion | 49 | #endregion |
50 | 50 | ||
51 | #region Constructors | 51 | #region Constructors |
52 | 52 | ||
53 | /// <summary> | 53 | /// <summary> |
54 | /// Initializes a new instance of the <see cref="OptionNodeAttribute"/> class. | 54 | /// Initializes a new instance of the <see cref="OptionNodeAttribute"/> class. |
55 | /// </summary> | 55 | /// </summary> |
56 | /// <param name="nodeName">Name of the node.</param> | 56 | /// <param name="nodeName">Name of the node.</param> |
57 | public OptionNodeAttribute(string nodeName) | 57 | public OptionNodeAttribute(string nodeName) |
58 | { | 58 | { |
59 | m_NodeName = nodeName; | 59 | m_NodeName = nodeName; |
60 | } | 60 | } |
61 | 61 | ||
62 | #endregion | 62 | #endregion |
63 | 63 | ||
64 | #region Properties | 64 | #region Properties |
65 | 65 | ||
66 | /// <summary> | 66 | /// <summary> |
67 | /// Gets the name of the node. | 67 | /// Gets the name of the node. |
68 | /// </summary> | 68 | /// </summary> |
69 | /// <value>The name of the node.</value> | 69 | /// <value>The name of the node.</value> |
70 | public string NodeName | 70 | public string NodeName |
71 | { | 71 | { |
72 | get | 72 | get |
73 | { | 73 | { |
74 | return m_NodeName; | 74 | return m_NodeName; |
75 | } | 75 | } |
76 | } | 76 | } |
77 | 77 | ||
78 | #endregion | 78 | #endregion |
79 | } | 79 | } |
80 | } | 80 | } |
diff --git a/Prebuild/src/Core/Attributes/TargetAttribute.cs b/Prebuild/src/Core/Attributes/TargetAttribute.cs index 985f180..8724d69 100644 --- a/Prebuild/src/Core/Attributes/TargetAttribute.cs +++ b/Prebuild/src/Core/Attributes/TargetAttribute.cs | |||
@@ -1,80 +1,80 @@ | |||
1 | #region BSD License | 1 | #region BSD License |
2 | /* | 2 | /* |
3 | Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) | 3 | Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) |
4 | 4 | ||
5 | Redistribution and use in source and binary forms, with or without modification, are permitted | 5 | Redistribution and use in source and binary forms, with or without modification, are permitted |
6 | provided that the following conditions are met: | 6 | provided that the following conditions are met: |
7 | 7 | ||
8 | * Redistributions of source code must retain the above copyright notice, this list of conditions | 8 | * Redistributions of source code must retain the above copyright notice, this list of conditions |
9 | and the following disclaimer. | 9 | and the following disclaimer. |
10 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions | 10 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions |
11 | and the following disclaimer in the documentation and/or other materials provided with the | 11 | and the following disclaimer in the documentation and/or other materials provided with the |
12 | distribution. | 12 | distribution. |
13 | * The name of the author may not be used to endorse or promote products derived from this software | 13 | * The name of the author may not be used to endorse or promote products derived from this software |
14 | without specific prior written permission. | 14 | without specific prior written permission. |
15 | 15 | ||
16 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, | 16 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, |
17 | BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | 17 | BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
18 | ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | 18 | ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
19 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | 19 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
20 | OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY | 20 | OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
21 | OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | 21 | OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING |
22 | IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 22 | IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
23 | */ | 23 | */ |
24 | #endregion | 24 | #endregion |
25 | 25 | ||
26 | #region CVS Information | 26 | #region CVS Information |
27 | /* | 27 | /* |
28 | * $Source$ | 28 | * $Source$ |
29 | * $Author: jendave $ | 29 | * $Author: jendave $ |
30 | * $Date: 2006-01-28 01:49:58 +0100 (lö, 28 jan 2006) $ | 30 | * $Date: 2006-01-28 01:49:58 +0100 (lö, 28 jan 2006) $ |
31 | * $Revision: 71 $ | 31 | * $Revision: 71 $ |
32 | */ | 32 | */ |
33 | #endregion | 33 | #endregion |
34 | 34 | ||
35 | using System; | 35 | using System; |
36 | 36 | ||
37 | namespace Prebuild.Core.Attributes | 37 | namespace Prebuild.Core.Attributes |
38 | { | 38 | { |
39 | /// <summary> | 39 | /// <summary> |
40 | /// | 40 | /// |
41 | /// </summary> | 41 | /// </summary> |
42 | [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct)] | 42 | [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct)] |
43 | public sealed class TargetAttribute : Attribute | 43 | public sealed class TargetAttribute : Attribute |
44 | { | 44 | { |
45 | #region Fields | 45 | #region Fields |
46 | 46 | ||
47 | private string m_Name; | 47 | private string m_Name; |
48 | 48 | ||
49 | #endregion | 49 | #endregion |
50 | 50 | ||
51 | #region Constructors | 51 | #region Constructors |
52 | 52 | ||
53 | /// <summary> | 53 | /// <summary> |
54 | /// Initializes a new instance of the <see cref="TargetAttribute"/> class. | 54 | /// Initializes a new instance of the <see cref="TargetAttribute"/> class. |
55 | /// </summary> | 55 | /// </summary> |
56 | /// <param name="name">The name.</param> | 56 | /// <param name="name">The name.</param> |
57 | public TargetAttribute(string name) | 57 | public TargetAttribute(string name) |
58 | { | 58 | { |
59 | m_Name = name; | 59 | m_Name = name; |
60 | } | 60 | } |
61 | 61 | ||
62 | #endregion | 62 | #endregion |
63 | 63 | ||
64 | #region Properties | 64 | #region Properties |
65 | 65 | ||
66 | /// <summary> | 66 | /// <summary> |
67 | /// Gets the name. | 67 | /// Gets the name. |
68 | /// </summary> | 68 | /// </summary> |
69 | /// <value>The name.</value> | 69 | /// <value>The name.</value> |
70 | public string Name | 70 | public string Name |
71 | { | 71 | { |
72 | get | 72 | get |
73 | { | 73 | { |
74 | return m_Name; | 74 | return m_Name; |
75 | } | 75 | } |
76 | } | 76 | } |
77 | 77 | ||
78 | #endregion | 78 | #endregion |
79 | } | 79 | } |
80 | } | 80 | } |
diff --git a/Prebuild/src/Core/FatalException.cs b/Prebuild/src/Core/FatalException.cs index 92aad3d..a997c98 100644 --- a/Prebuild/src/Core/FatalException.cs +++ b/Prebuild/src/Core/FatalException.cs | |||
@@ -1,94 +1,94 @@ | |||
1 | #region BSD License | 1 | #region BSD License |
2 | /* | 2 | /* |
3 | Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) | 3 | Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) |
4 | 4 | ||
5 | Redistribution and use in source and binary forms, with or without modification, are permitted | 5 | Redistribution and use in source and binary forms, with or without modification, are permitted |
6 | provided that the following conditions are met: | 6 | provided that the following conditions are met: |
7 | 7 | ||
8 | * Redistributions of source code must retain the above copyright notice, this list of conditions | 8 | * Redistributions of source code must retain the above copyright notice, this list of conditions |
9 | and the following disclaimer. | 9 | and the following disclaimer. |
10 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions | 10 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions |
11 | and the following disclaimer in the documentation and/or other materials provided with the | 11 | and the following disclaimer in the documentation and/or other materials provided with the |
12 | distribution. | 12 | distribution. |
13 | * The name of the author may not be used to endorse or promote products derived from this software | 13 | * The name of the author may not be used to endorse or promote products derived from this software |
14 | without specific prior written permission. | 14 | without specific prior written permission. |
15 | 15 | ||
16 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, | 16 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, |
17 | BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | 17 | BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
18 | ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | 18 | ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
19 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | 19 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
20 | OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY | 20 | OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
21 | OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | 21 | OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING |
22 | IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 22 | IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
23 | */ | 23 | */ |
24 | #endregion | 24 | #endregion |
25 | 25 | ||
26 | #region CVS Information | 26 | #region CVS Information |
27 | /* | 27 | /* |
28 | * $Source$ | 28 | * $Source$ |
29 | * $Author: jendave $ | 29 | * $Author: jendave $ |
30 | * $Date: 2006-01-28 01:49:58 +0100 (lö, 28 jan 2006) $ | 30 | * $Date: 2006-01-28 01:49:58 +0100 (lö, 28 jan 2006) $ |
31 | * $Revision: 71 $ | 31 | * $Revision: 71 $ |
32 | */ | 32 | */ |
33 | #endregion | 33 | #endregion |
34 | 34 | ||
35 | using System; | 35 | using System; |
36 | using System.Runtime.Serialization; | 36 | using System.Runtime.Serialization; |
37 | 37 | ||
38 | namespace Prebuild.Core | 38 | namespace Prebuild.Core |
39 | { | 39 | { |
40 | /// <summary> | 40 | /// <summary> |
41 | /// | 41 | /// |
42 | /// </summary> | 42 | /// </summary> |
43 | [Serializable()] | 43 | [Serializable()] |
44 | public class FatalException : Exception | 44 | public class FatalException : Exception |
45 | { | 45 | { |
46 | #region Constructors | 46 | #region Constructors |
47 | 47 | ||
48 | 48 | ||
49 | /// <summary> | 49 | /// <summary> |
50 | /// Initializes a new instance of the <see cref="FatalException"/> class. | 50 | /// Initializes a new instance of the <see cref="FatalException"/> class. |
51 | /// </summary> | 51 | /// </summary> |
52 | public FatalException() | 52 | public FatalException() |
53 | { | 53 | { |
54 | } | 54 | } |
55 | 55 | ||
56 | /// <summary> | 56 | /// <summary> |
57 | /// Initializes a new instance of the <see cref="FatalException"/> class. | 57 | /// Initializes a new instance of the <see cref="FatalException"/> class. |
58 | /// </summary> | 58 | /// </summary> |
59 | /// <param name="format">The format.</param> | 59 | /// <param name="format">The format.</param> |
60 | /// <param name="args">The args.</param> | 60 | /// <param name="args">The args.</param> |
61 | public FatalException(string format, params object[] args) | 61 | public FatalException(string format, params object[] args) |
62 | : base(String.Format(format, args)) | 62 | : base(String.Format(format, args)) |
63 | { | 63 | { |
64 | } | 64 | } |
65 | 65 | ||
66 | /// <summary> | 66 | /// <summary> |
67 | /// Exception with specified string | 67 | /// Exception with specified string |
68 | /// </summary> | 68 | /// </summary> |
69 | /// <param name="message">Exception message</param> | 69 | /// <param name="message">Exception message</param> |
70 | public FatalException(string message): base(message) | 70 | public FatalException(string message): base(message) |
71 | { | 71 | { |
72 | } | 72 | } |
73 | 73 | ||
74 | /// <summary> | 74 | /// <summary> |
75 | /// | 75 | /// |
76 | /// </summary> | 76 | /// </summary> |
77 | /// <param name="message"></param> | 77 | /// <param name="message"></param> |
78 | /// <param name="exception"></param> | 78 | /// <param name="exception"></param> |
79 | public FatalException(string message, Exception exception) : base(message, exception) | 79 | public FatalException(string message, Exception exception) : base(message, exception) |
80 | { | 80 | { |
81 | } | 81 | } |
82 | 82 | ||
83 | /// <summary> | 83 | /// <summary> |
84 | /// | 84 | /// |
85 | /// </summary> | 85 | /// </summary> |
86 | /// <param name="info"></param> | 86 | /// <param name="info"></param> |
87 | /// <param name="context"></param> | 87 | /// <param name="context"></param> |
88 | protected FatalException(SerializationInfo info, StreamingContext context) : base( info, context ) | 88 | protected FatalException(SerializationInfo info, StreamingContext context) : base( info, context ) |
89 | { | 89 | { |
90 | } | 90 | } |
91 | 91 | ||
92 | #endregion | 92 | #endregion |
93 | } | 93 | } |
94 | } | 94 | } |
diff --git a/Prebuild/src/Core/Interfaces/IDataNode.cs b/Prebuild/src/Core/Interfaces/IDataNode.cs index 0bad97c..2562b1d 100644 --- a/Prebuild/src/Core/Interfaces/IDataNode.cs +++ b/Prebuild/src/Core/Interfaces/IDataNode.cs | |||
@@ -1,56 +1,56 @@ | |||
1 | #region BSD License | 1 | #region BSD License |
2 | /* | 2 | /* |
3 | Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) | 3 | Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) |
4 | 4 | ||
5 | Redistribution and use in source and binary forms, with or without modification, are permitted | 5 | Redistribution and use in source and binary forms, with or without modification, are permitted |
6 | provided that the following conditions are met: | 6 | provided that the following conditions are met: |
7 | 7 | ||
8 | * Redistributions of source code must retain the above copyright notice, this list of conditions | 8 | * Redistributions of source code must retain the above copyright notice, this list of conditions |
9 | and the following disclaimer. | 9 | and the following disclaimer. |
10 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions | 10 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions |
11 | and the following disclaimer in the documentation and/or other materials provided with the | 11 | and the following disclaimer in the documentation and/or other materials provided with the |
12 | distribution. | 12 | distribution. |
13 | * The name of the author may not be used to endorse or promote products derived from this software | 13 | * The name of the author may not be used to endorse or promote products derived from this software |
14 | without specific prior written permission. | 14 | without specific prior written permission. |
15 | 15 | ||
16 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, | 16 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, |
17 | BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | 17 | BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
18 | ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | 18 | ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
19 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | 19 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
20 | OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY | 20 | OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
21 | OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | 21 | OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING |
22 | IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 22 | IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
23 | */ | 23 | */ |
24 | #endregion | 24 | #endregion |
25 | 25 | ||
26 | #region CVS Information | 26 | #region CVS Information |
27 | /* | 27 | /* |
28 | * $Source$ | 28 | * $Source$ |
29 | * $Author: jendave $ | 29 | * $Author: jendave $ |
30 | * $Date: 2006-01-28 01:49:58 +0100 (lö, 28 jan 2006) $ | 30 | * $Date: 2006-01-28 01:49:58 +0100 (lö, 28 jan 2006) $ |
31 | * $Revision: 71 $ | 31 | * $Revision: 71 $ |
32 | */ | 32 | */ |
33 | #endregion | 33 | #endregion |
34 | 34 | ||
35 | using System; | 35 | using System; |
36 | using System.Xml; | 36 | using System.Xml; |
37 | 37 | ||
38 | namespace Prebuild.Core.Interfaces | 38 | namespace Prebuild.Core.Interfaces |
39 | { | 39 | { |
40 | /// <summary> | 40 | /// <summary> |
41 | /// | 41 | /// |
42 | /// </summary> | 42 | /// </summary> |
43 | public interface IDataNode | 43 | public interface IDataNode |
44 | { | 44 | { |
45 | /// <summary> | 45 | /// <summary> |
46 | /// Gets or sets the parent. | 46 | /// Gets or sets the parent. |
47 | /// </summary> | 47 | /// </summary> |
48 | /// <value>The parent.</value> | 48 | /// <value>The parent.</value> |
49 | IDataNode Parent { get; set; } | 49 | IDataNode Parent { get; set; } |
50 | /// <summary> | 50 | /// <summary> |
51 | /// Parses the specified node. | 51 | /// Parses the specified node. |
52 | /// </summary> | 52 | /// </summary> |
53 | /// <param name="node">The node.</param> | 53 | /// <param name="node">The node.</param> |
54 | void Parse(XmlNode node); | 54 | void Parse(XmlNode node); |
55 | } | 55 | } |
56 | } | 56 | } |
diff --git a/Prebuild/src/Core/Interfaces/ITarget.cs b/Prebuild/src/Core/Interfaces/ITarget.cs index dac6cd6..e74ff9a 100644 --- a/Prebuild/src/Core/Interfaces/ITarget.cs +++ b/Prebuild/src/Core/Interfaces/ITarget.cs | |||
@@ -1,60 +1,60 @@ | |||
1 | #region BSD License | 1 | #region BSD License |
2 | /* | 2 | /* |
3 | Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) | 3 | Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) |
4 | 4 | ||
5 | Redistribution and use in source and binary forms, with or without modification, are permitted | 5 | Redistribution and use in source and binary forms, with or without modification, are permitted |
6 | provided that the following conditions are met: | 6 | provided that the following conditions are met: |
7 | 7 | ||
8 | * Redistributions of source code must retain the above copyright notice, this list of conditions | 8 | * Redistributions of source code must retain the above copyright notice, this list of conditions |
9 | and the following disclaimer. | 9 | and the following disclaimer. |
10 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions | 10 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions |
11 | and the following disclaimer in the documentation and/or other materials provided with the | 11 | and the following disclaimer in the documentation and/or other materials provided with the |
12 | distribution. | 12 | distribution. |
13 | * The name of the author may not be used to endorse or promote products derived from this software | 13 | * The name of the author may not be used to endorse or promote products derived from this software |
14 | without specific prior written permission. | 14 | without specific prior written permission. |
15 | 15 | ||
16 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, | 16 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, |
17 | BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | 17 | BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
18 | ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | 18 | ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
19 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | 19 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
20 | OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY | 20 | OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
21 | OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | 21 | OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING |
22 | IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 22 | IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
23 | */ | 23 | */ |
24 | #endregion | 24 | #endregion |
25 | 25 | ||
26 | #region CVS Information | 26 | #region CVS Information |
27 | /* | 27 | /* |
28 | * $Source$ | 28 | * $Source$ |
29 | * $Author: jendave $ | 29 | * $Author: jendave $ |
30 | * $Date: 2006-01-28 01:49:58 +0100 (lö, 28 jan 2006) $ | 30 | * $Date: 2006-01-28 01:49:58 +0100 (lö, 28 jan 2006) $ |
31 | * $Revision: 71 $ | 31 | * $Revision: 71 $ |
32 | */ | 32 | */ |
33 | #endregion | 33 | #endregion |
34 | 34 | ||
35 | using System; | 35 | using System; |
36 | 36 | ||
37 | namespace Prebuild.Core.Interfaces | 37 | namespace Prebuild.Core.Interfaces |
38 | { | 38 | { |
39 | /// <summary> | 39 | /// <summary> |
40 | /// | 40 | /// |
41 | /// </summary> | 41 | /// </summary> |
42 | public interface ITarget | 42 | public interface ITarget |
43 | { | 43 | { |
44 | /// <summary> | 44 | /// <summary> |
45 | /// Writes the specified kern. | 45 | /// Writes the specified kern. |
46 | /// </summary> | 46 | /// </summary> |
47 | /// <param name="kern">The kern.</param> | 47 | /// <param name="kern">The kern.</param> |
48 | void Write(Kernel kern); | 48 | void Write(Kernel kern); |
49 | /// <summary> | 49 | /// <summary> |
50 | /// Cleans the specified kern. | 50 | /// Cleans the specified kern. |
51 | /// </summary> | 51 | /// </summary> |
52 | /// <param name="kern">The kern.</param> | 52 | /// <param name="kern">The kern.</param> |
53 | void Clean(Kernel kern); | 53 | void Clean(Kernel kern); |
54 | /// <summary> | 54 | /// <summary> |
55 | /// Gets the name. | 55 | /// Gets the name. |
56 | /// </summary> | 56 | /// </summary> |
57 | /// <value>The name.</value> | 57 | /// <value>The name.</value> |
58 | string Name { get; } | 58 | string Name { get; } |
59 | } | 59 | } |
60 | } \ No newline at end of file | 60 | } \ No newline at end of file |
diff --git a/Prebuild/src/Core/Kernel.cs b/Prebuild/src/Core/Kernel.cs index 3117e7c..170d0f5 100644 --- a/Prebuild/src/Core/Kernel.cs +++ b/Prebuild/src/Core/Kernel.cs | |||
@@ -1,758 +1,758 @@ | |||
1 | #region BSD License | 1 | #region BSD License |
2 | /* | 2 | /* |
3 | Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) | 3 | Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) |
4 | 4 | ||
5 | Redistribution and use in source and binary forms, with or without modification, are permitted | 5 | Redistribution and use in source and binary forms, with or without modification, are permitted |
6 | provided that the following conditions are met: | 6 | provided that the following conditions are met: |
7 | 7 | ||
8 | * Redistributions of source code must retain the above copyright notice, this list of conditions | 8 | * Redistributions of source code must retain the above copyright notice, this list of conditions |
9 | and the following disclaimer. | 9 | and the following disclaimer. |
10 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions | 10 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions |
11 | and the following disclaimer in the documentation and/or other materials provided with the | 11 | and the following disclaimer in the documentation and/or other materials provided with the |
12 | distribution. | 12 | distribution. |
13 | * The name of the author may not be used to endorse or promote products derived from this software | 13 | * The name of the author may not be used to endorse or promote products derived from this software |
14 | without specific prior written permission. | 14 | without specific prior written permission. |
15 | 15 | ||
16 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, | 16 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, |
17 | BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | 17 | BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
18 | ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | 18 | ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
19 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | 19 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
20 | OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY | 20 | OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
21 | OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | 21 | OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING |
22 | IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 22 | IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
23 | */ | 23 | */ |
24 | #endregion | 24 | #endregion |
25 | 25 | ||
26 | #region CVS Information | 26 | #region CVS Information |
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 00:30:53 +0200 (ti, 26 sep 2006) $ |
31 | * $Revision: 165 $ | 31 | * $Revision: 165 $ |
32 | */ | 32 | */ |
33 | #endregion | 33 | #endregion |
34 | 34 | ||
35 | using System; | 35 | using System; |
36 | using System.Diagnostics; | 36 | using System.Diagnostics; |
37 | using System.Collections; | 37 | using System.Collections; |
38 | using System.Collections.Specialized; | 38 | using System.Collections.Specialized; |
39 | using System.IO; | 39 | using System.IO; |
40 | using System.Reflection; | 40 | using System.Reflection; |
41 | using System.Xml; | 41 | using System.Xml; |
42 | using System.Xml.Schema; | 42 | using System.Xml.Schema; |
43 | using System.Text; | 43 | using System.Text; |
44 | 44 | ||
45 | using Prebuild.Core.Attributes; | 45 | using Prebuild.Core.Attributes; |
46 | using Prebuild.Core.Interfaces; | 46 | using Prebuild.Core.Interfaces; |
47 | using Prebuild.Core.Nodes; | 47 | using Prebuild.Core.Nodes; |
48 | using Prebuild.Core.Parse; | 48 | using Prebuild.Core.Parse; |
49 | using Prebuild.Core.Utilities; | 49 | using Prebuild.Core.Utilities; |
50 | 50 | ||
51 | namespace Prebuild.Core | 51 | namespace Prebuild.Core |
52 | { | 52 | { |
53 | /// <summary> | 53 | /// <summary> |
54 | /// | 54 | /// |
55 | /// </summary> | 55 | /// </summary> |
56 | public class Kernel : IDisposable | 56 | public class Kernel : IDisposable |
57 | { | 57 | { |
58 | #region Inner Classes | 58 | #region Inner Classes |
59 | 59 | ||
60 | private struct NodeEntry | 60 | private struct NodeEntry |
61 | { | 61 | { |
62 | public Type Type; | 62 | public Type Type; |
63 | public DataNodeAttribute Attribute; | 63 | public DataNodeAttribute Attribute; |
64 | } | 64 | } |
65 | 65 | ||
66 | #endregion | 66 | #endregion |
67 | 67 | ||
68 | #region Fields | 68 | #region Fields |
69 | 69 | ||
70 | private static Kernel m_Instance = new Kernel(); | 70 | private static Kernel m_Instance = new Kernel(); |
71 | 71 | ||
72 | /// <summary> | 72 | /// <summary> |
73 | /// This must match the version of the schema that is embeeded | 73 | /// This must match the version of the schema that is embeeded |
74 | /// </summary> | 74 | /// </summary> |
75 | private static string m_SchemaVersion = "1.7"; | 75 | private static string m_SchemaVersion = "1.7"; |
76 | private static string m_Schema = "prebuild-" + m_SchemaVersion + ".xsd"; | 76 | private static string m_Schema = "prebuild-" + m_SchemaVersion + ".xsd"; |
77 | private static string m_SchemaURI = "http://dnpb.sourceforge.net/schemas/" + m_Schema; | 77 | private static string m_SchemaURI = "http://dnpb.sourceforge.net/schemas/" + m_Schema; |
78 | bool disposed; | 78 | bool disposed; |
79 | private Version m_Version; | 79 | private Version m_Version; |
80 | private string m_Revision = ""; | 80 | private string m_Revision = ""; |
81 | private CommandLineCollection m_CommandLine; | 81 | private CommandLineCollection m_CommandLine; |
82 | private Log m_Log; | 82 | private Log m_Log; |
83 | private CurrentDirectory m_CurrentWorkingDirectory; | 83 | private CurrentDirectory m_CurrentWorkingDirectory; |
84 | private XmlSchemaCollection m_Schemas; | 84 | private XmlSchemaCollection m_Schemas; |
85 | 85 | ||
86 | private Hashtable m_Targets; | 86 | private Hashtable m_Targets; |
87 | private Hashtable m_Nodes; | 87 | private Hashtable m_Nodes; |
88 | 88 | ||
89 | ArrayList m_Solutions; | 89 | ArrayList m_Solutions; |
90 | string m_Target; | 90 | string m_Target; |
91 | string m_Clean; | 91 | string m_Clean; |
92 | string[] m_RemoveDirectories; | 92 | string[] m_RemoveDirectories; |
93 | string m_CurrentFile; | 93 | string m_CurrentFile; |
94 | bool m_PauseAfterFinish; | 94 | bool m_PauseAfterFinish; |
95 | string[] m_ProjectGroups; | 95 | string[] m_ProjectGroups; |
96 | StringCollection m_Refs; | 96 | StringCollection m_Refs; |
97 | 97 | ||
98 | 98 | ||
99 | #endregion | 99 | #endregion |
100 | 100 | ||
101 | #region Constructors | 101 | #region Constructors |
102 | 102 | ||
103 | private Kernel() | 103 | private Kernel() |
104 | { | 104 | { |
105 | } | 105 | } |
106 | 106 | ||
107 | #endregion | 107 | #endregion |
108 | 108 | ||
109 | #region Properties | 109 | #region Properties |
110 | 110 | ||
111 | /// <summary> | 111 | /// <summary> |
112 | /// Gets a value indicating whether [pause after finish]. | 112 | /// Gets a value indicating whether [pause after finish]. |
113 | /// </summary> | 113 | /// </summary> |
114 | /// <value><c>true</c> if [pause after finish]; otherwise, <c>false</c>.</value> | 114 | /// <value><c>true</c> if [pause after finish]; otherwise, <c>false</c>.</value> |
115 | public bool PauseAfterFinish | 115 | public bool PauseAfterFinish |
116 | { | 116 | { |
117 | get | 117 | get |
118 | { | 118 | { |
119 | return m_PauseAfterFinish; | 119 | return m_PauseAfterFinish; |
120 | } | 120 | } |
121 | } | 121 | } |
122 | 122 | ||
123 | /// <summary> | 123 | /// <summary> |
124 | /// Gets the instance. | 124 | /// Gets the instance. |
125 | /// </summary> | 125 | /// </summary> |
126 | /// <value>The instance.</value> | 126 | /// <value>The instance.</value> |
127 | public static Kernel Instance | 127 | public static Kernel Instance |
128 | { | 128 | { |
129 | get | 129 | get |
130 | { | 130 | { |
131 | return m_Instance; | 131 | return m_Instance; |
132 | } | 132 | } |
133 | } | 133 | } |
134 | 134 | ||
135 | /// <summary> | 135 | /// <summary> |
136 | /// Gets the version. | 136 | /// Gets the version. |
137 | /// </summary> | 137 | /// </summary> |
138 | /// <value>The version.</value> | 138 | /// <value>The version.</value> |
139 | public string Version | 139 | public string Version |
140 | { | 140 | { |
141 | get | 141 | get |
142 | { | 142 | { |
143 | return String.Format("{0}.{1}.{2}{3}", m_Version.Major, m_Version.Minor, m_Version.Build, m_Revision); | 143 | return String.Format("{0}.{1}.{2}{3}", m_Version.Major, m_Version.Minor, m_Version.Build, m_Revision); |
144 | } | 144 | } |
145 | } | 145 | } |
146 | 146 | ||
147 | /// <summary> | 147 | /// <summary> |
148 | /// Gets the command line. | 148 | /// Gets the command line. |
149 | /// </summary> | 149 | /// </summary> |
150 | /// <value>The command line.</value> | 150 | /// <value>The command line.</value> |
151 | public CommandLineCollection CommandLine | 151 | public CommandLineCollection CommandLine |
152 | { | 152 | { |
153 | get | 153 | get |
154 | { | 154 | { |
155 | return m_CommandLine; | 155 | return m_CommandLine; |
156 | } | 156 | } |
157 | } | 157 | } |
158 | 158 | ||
159 | /// <summary> | 159 | /// <summary> |
160 | /// Gets the targets. | 160 | /// Gets the targets. |
161 | /// </summary> | 161 | /// </summary> |
162 | /// <value>The targets.</value> | 162 | /// <value>The targets.</value> |
163 | public Hashtable Targets | 163 | public Hashtable Targets |
164 | { | 164 | { |
165 | get | 165 | get |
166 | { | 166 | { |
167 | return m_Targets; | 167 | return m_Targets; |
168 | } | 168 | } |
169 | } | 169 | } |
170 | 170 | ||
171 | /// <summary> | 171 | /// <summary> |
172 | /// Gets the log. | 172 | /// Gets the log. |
173 | /// </summary> | 173 | /// </summary> |
174 | /// <value>The log.</value> | 174 | /// <value>The log.</value> |
175 | public Log Log | 175 | public Log Log |
176 | { | 176 | { |
177 | get | 177 | get |
178 | { | 178 | { |
179 | return m_Log; | 179 | return m_Log; |
180 | } | 180 | } |
181 | } | 181 | } |
182 | 182 | ||
183 | /// <summary> | 183 | /// <summary> |
184 | /// Gets the current working directory. | 184 | /// Gets the current working directory. |
185 | /// </summary> | 185 | /// </summary> |
186 | /// <value>The current working directory.</value> | 186 | /// <value>The current working directory.</value> |
187 | public CurrentDirectory CurrentWorkingDirectory | 187 | public CurrentDirectory CurrentWorkingDirectory |
188 | { | 188 | { |
189 | get | 189 | get |
190 | { | 190 | { |
191 | return m_CurrentWorkingDirectory; | 191 | return m_CurrentWorkingDirectory; |
192 | } | 192 | } |
193 | } | 193 | } |
194 | 194 | ||
195 | /// <summary> | 195 | /// <summary> |
196 | /// Gets the solutions. | 196 | /// Gets the solutions. |
197 | /// </summary> | 197 | /// </summary> |
198 | /// <value>The solutions.</value> | 198 | /// <value>The solutions.</value> |
199 | public ArrayList Solutions | 199 | public ArrayList Solutions |
200 | { | 200 | { |
201 | get | 201 | get |
202 | { | 202 | { |
203 | return m_Solutions; | 203 | return m_Solutions; |
204 | } | 204 | } |
205 | } | 205 | } |
206 | 206 | ||
207 | #endregion | 207 | #endregion |
208 | 208 | ||
209 | #region Private Methods | 209 | #region Private Methods |
210 | 210 | ||
211 | private void RemoveDirectories(string rootDir, string[] dirNames) | 211 | private void RemoveDirectories(string rootDir, string[] dirNames) |
212 | { | 212 | { |
213 | foreach(string dir in Directory.GetDirectories(rootDir)) | 213 | foreach(string dir in Directory.GetDirectories(rootDir)) |
214 | { | 214 | { |
215 | string simpleName = Path.GetFileName(dir); | 215 | string simpleName = Path.GetFileName(dir); |
216 | 216 | ||
217 | if(Array.IndexOf(dirNames, simpleName) != -1) | 217 | if(Array.IndexOf(dirNames, simpleName) != -1) |
218 | { | 218 | { |
219 | //delete if the name matches one of the directory names to delete | 219 | //delete if the name matches one of the directory names to delete |
220 | string fullDirPath = Path.GetFullPath(dir); | 220 | string fullDirPath = Path.GetFullPath(dir); |
221 | Directory.Delete(fullDirPath,true); | 221 | Directory.Delete(fullDirPath,true); |
222 | } | 222 | } |
223 | else//not a match, so check children | 223 | else//not a match, so check children |
224 | { | 224 | { |
225 | RemoveDirectories(dir,dirNames); | 225 | RemoveDirectories(dir,dirNames); |
226 | //recurse, checking children for them | 226 | //recurse, checking children for them |
227 | } | 227 | } |
228 | } | 228 | } |
229 | } | 229 | } |
230 | 230 | ||
231 | // private void RemoveDirectoryMatches(string rootDir, string dirPattern) | 231 | // private void RemoveDirectoryMatches(string rootDir, string dirPattern) |
232 | // { | 232 | // { |
233 | // foreach(string dir in Directory.GetDirectories(rootDir)) | 233 | // foreach(string dir in Directory.GetDirectories(rootDir)) |
234 | // { | 234 | // { |
235 | // foreach(string match in Directory.GetDirectories(dir)) | 235 | // foreach(string match in Directory.GetDirectories(dir)) |
236 | // {//delete all child directories that match | 236 | // {//delete all child directories that match |
237 | // Directory.Delete(Path.GetFullPath(match),true); | 237 | // Directory.Delete(Path.GetFullPath(match),true); |
238 | // } | 238 | // } |
239 | // //recure through the rest checking for nested matches to delete | 239 | // //recure through the rest checking for nested matches to delete |
240 | // RemoveDirectoryMatches(dir,dirPattern); | 240 | // RemoveDirectoryMatches(dir,dirPattern); |
241 | // } | 241 | // } |
242 | // } | 242 | // } |
243 | 243 | ||
244 | private void LoadSchema() | 244 | private void LoadSchema() |
245 | { | 245 | { |
246 | Assembly assembly = this.GetType().Assembly; | 246 | Assembly assembly = this.GetType().Assembly; |
247 | Stream stream = assembly.GetManifestResourceStream("Prebuild.data." + m_Schema); | 247 | Stream stream = assembly.GetManifestResourceStream("Prebuild.data." + m_Schema); |
248 | if(stream == null) | 248 | if(stream == null) |
249 | { | 249 | { |
250 | //try without the default namespace prepending to it in case was compiled with SharpDevelop or MonoDevelop instead of Visual Studio .NET | 250 | //try without the default namespace prepending to it in case was compiled with SharpDevelop or MonoDevelop instead of Visual Studio .NET |
251 | stream = assembly.GetManifestResourceStream(m_Schema); | 251 | stream = assembly.GetManifestResourceStream(m_Schema); |
252 | if(stream == null) | 252 | if(stream == null) |
253 | { | 253 | { |
254 | throw new System.Reflection.TargetException(string.Format("Could not find the scheme embedded resource file '{0}'.", m_Schema)); | 254 | throw new System.Reflection.TargetException(string.Format("Could not find the scheme embedded resource file '{0}'.", m_Schema)); |
255 | } | 255 | } |
256 | } | 256 | } |
257 | XmlReader schema = new XmlTextReader(stream); | 257 | XmlReader schema = new XmlTextReader(stream); |
258 | 258 | ||
259 | m_Schemas = new XmlSchemaCollection(); | 259 | m_Schemas = new XmlSchemaCollection(); |
260 | m_Schemas.Add(m_SchemaURI, schema); | 260 | m_Schemas.Add(m_SchemaURI, schema); |
261 | } | 261 | } |
262 | 262 | ||
263 | private void CacheVersion() | 263 | private void CacheVersion() |
264 | { | 264 | { |
265 | m_Version = Assembly.GetEntryAssembly().GetName().Version; | 265 | m_Version = Assembly.GetEntryAssembly().GetName().Version; |
266 | } | 266 | } |
267 | 267 | ||
268 | private void CacheTargets(Assembly assm) | 268 | private void CacheTargets(Assembly assm) |
269 | { | 269 | { |
270 | foreach(Type t in assm.GetTypes()) | 270 | foreach(Type t in assm.GetTypes()) |
271 | { | 271 | { |
272 | TargetAttribute ta = (TargetAttribute)Helper.CheckType(t, typeof(TargetAttribute), typeof(ITarget)); | 272 | TargetAttribute ta = (TargetAttribute)Helper.CheckType(t, typeof(TargetAttribute), typeof(ITarget)); |
273 | if(ta == null) | 273 | if(ta == null) |
274 | { | 274 | { |
275 | continue; | 275 | continue; |
276 | } | 276 | } |
277 | 277 | ||
278 | ITarget target = (ITarget)assm.CreateInstance(t.FullName); | 278 | ITarget target = (ITarget)assm.CreateInstance(t.FullName); |
279 | if(target == null) | 279 | if(target == null) |
280 | { | 280 | { |
281 | throw new MissingMethodException("Could not create ITarget instance"); | 281 | throw new MissingMethodException("Could not create ITarget instance"); |
282 | } | 282 | } |
283 | 283 | ||
284 | m_Targets[ta.Name] = target; | 284 | m_Targets[ta.Name] = target; |
285 | } | 285 | } |
286 | } | 286 | } |
287 | 287 | ||
288 | private void CacheNodeTypes(Assembly assm) | 288 | private void CacheNodeTypes(Assembly assm) |
289 | { | 289 | { |
290 | foreach(Type t in assm.GetTypes()) | 290 | foreach(Type t in assm.GetTypes()) |
291 | { | 291 | { |
292 | DataNodeAttribute dna = (DataNodeAttribute)Helper.CheckType(t, typeof(DataNodeAttribute), typeof(IDataNode)); | 292 | DataNodeAttribute dna = (DataNodeAttribute)Helper.CheckType(t, typeof(DataNodeAttribute), typeof(IDataNode)); |
293 | if(dna == null) | 293 | if(dna == null) |
294 | { | 294 | { |
295 | continue; | 295 | continue; |
296 | } | 296 | } |
297 | 297 | ||
298 | NodeEntry ne = new NodeEntry(); | 298 | NodeEntry ne = new NodeEntry(); |
299 | ne.Type = t; | 299 | ne.Type = t; |
300 | ne.Attribute = dna; | 300 | ne.Attribute = dna; |
301 | m_Nodes[dna.Name] = ne; | 301 | m_Nodes[dna.Name] = ne; |
302 | } | 302 | } |
303 | } | 303 | } |
304 | 304 | ||
305 | private void LogBanner() | 305 | private void LogBanner() |
306 | { | 306 | { |
307 | m_Log.Write("Prebuild v" + this.Version); | 307 | m_Log.Write("Prebuild v" + this.Version); |
308 | m_Log.Write("Copyright (c) Matthew Holmes, Dan Moorehead and David Hudson"); | 308 | m_Log.Write("Copyright (c) Matthew Holmes, Dan Moorehead and David Hudson"); |
309 | m_Log.Write("See 'prebuild /usage' for help"); | 309 | m_Log.Write("See 'prebuild /usage' for help"); |
310 | m_Log.Write(); | 310 | m_Log.Write(); |
311 | } | 311 | } |
312 | 312 | ||
313 | private void ProcessFile(string file) | 313 | private void ProcessFile(string file) |
314 | { | 314 | { |
315 | m_CurrentWorkingDirectory.Push(); | 315 | m_CurrentWorkingDirectory.Push(); |
316 | 316 | ||
317 | string path = file; | 317 | string path = file; |
318 | try | 318 | try |
319 | { | 319 | { |
320 | try | 320 | try |
321 | { | 321 | { |
322 | path = Helper.ResolvePath(path); | 322 | path = Helper.ResolvePath(path); |
323 | } | 323 | } |
324 | catch(ArgumentException) | 324 | catch(ArgumentException) |
325 | { | 325 | { |
326 | m_Log.Write("Could not open Prebuild file: " + path); | 326 | m_Log.Write("Could not open Prebuild file: " + path); |
327 | m_CurrentWorkingDirectory.Pop(); | 327 | m_CurrentWorkingDirectory.Pop(); |
328 | return; | 328 | return; |
329 | } | 329 | } |
330 | 330 | ||
331 | m_CurrentFile = path; | 331 | m_CurrentFile = path; |
332 | Helper.SetCurrentDir(Path.GetDirectoryName(path)); | 332 | Helper.SetCurrentDir(Path.GetDirectoryName(path)); |
333 | 333 | ||
334 | 334 | ||
335 | XmlTextReader reader = new XmlTextReader(path); | 335 | XmlTextReader reader = new XmlTextReader(path); |
336 | 336 | ||
337 | Core.Parse.Preprocessor pre = new Core.Parse.Preprocessor(); | 337 | Core.Parse.Preprocessor pre = new Core.Parse.Preprocessor(); |
338 | 338 | ||
339 | //register command line arguments as XML variables | 339 | //register command line arguments as XML variables |
340 | IDictionaryEnumerator dict = m_CommandLine.GetEnumerator(); | 340 | IDictionaryEnumerator dict = m_CommandLine.GetEnumerator(); |
341 | while (dict.MoveNext()) | 341 | while (dict.MoveNext()) |
342 | { | 342 | { |
343 | string name = dict.Key.ToString().Trim(); | 343 | string name = dict.Key.ToString().Trim(); |
344 | if (name.Length > 0) | 344 | if (name.Length > 0) |
345 | pre.RegisterVariable(name, dict.Value.ToString()); | 345 | pre.RegisterVariable(name, dict.Value.ToString()); |
346 | } | 346 | } |
347 | 347 | ||
348 | string xml = pre.Process(reader);//remove script and evaulate pre-proccessing to get schema-conforming XML | 348 | string xml = pre.Process(reader);//remove script and evaulate pre-proccessing to get schema-conforming XML |
349 | 349 | ||
350 | 350 | ||
351 | XmlDocument doc = new XmlDocument(); | 351 | XmlDocument doc = new XmlDocument(); |
352 | try | 352 | try |
353 | { | 353 | { |
354 | XmlValidatingReader validator = new XmlValidatingReader(new XmlTextReader(new StringReader(xml))); | 354 | XmlValidatingReader validator = new XmlValidatingReader(new XmlTextReader(new StringReader(xml))); |
355 | 355 | ||
356 | //validate while reading from string into XmlDocument DOM structure in memory | 356 | //validate while reading from string into XmlDocument DOM structure in memory |
357 | foreach(XmlSchema schema in m_Schemas) | 357 | foreach(XmlSchema schema in m_Schemas) |
358 | { | 358 | { |
359 | validator.Schemas.Add(schema); | 359 | validator.Schemas.Add(schema); |
360 | } | 360 | } |
361 | doc.Load(validator); | 361 | doc.Load(validator); |
362 | } | 362 | } |
363 | catch(XmlException e) | 363 | catch(XmlException e) |
364 | { | 364 | { |
365 | throw new XmlException(e.ToString()); | 365 | throw new XmlException(e.ToString()); |
366 | } | 366 | } |
367 | 367 | ||
368 | //is there a purpose to writing it? An syntax/schema problem would have been found during pre.Process() and reported with details | 368 | //is there a purpose to writing it? An syntax/schema problem would have been found during pre.Process() and reported with details |
369 | if(m_CommandLine.WasPassed("ppo")) | 369 | if(m_CommandLine.WasPassed("ppo")) |
370 | { | 370 | { |
371 | string ppoFile = m_CommandLine["ppo"]; | 371 | string ppoFile = m_CommandLine["ppo"]; |
372 | if(ppoFile == null || ppoFile.Trim().Length < 1) | 372 | if(ppoFile == null || ppoFile.Trim().Length < 1) |
373 | { | 373 | { |
374 | ppoFile = "preprocessed.xml"; | 374 | ppoFile = "preprocessed.xml"; |
375 | } | 375 | } |
376 | 376 | ||
377 | StreamWriter writer = null; | 377 | StreamWriter writer = null; |
378 | try | 378 | try |
379 | { | 379 | { |
380 | writer = new StreamWriter(ppoFile); | 380 | writer = new StreamWriter(ppoFile); |
381 | writer.Write(xml); | 381 | writer.Write(xml); |
382 | } | 382 | } |
383 | catch(IOException ex) | 383 | catch(IOException ex) |
384 | { | 384 | { |
385 | Console.WriteLine("Could not write PPO file '{0}': {1}", ppoFile, ex.Message); | 385 | Console.WriteLine("Could not write PPO file '{0}': {1}", ppoFile, ex.Message); |
386 | } | 386 | } |
387 | finally | 387 | finally |
388 | { | 388 | { |
389 | if(writer != null) | 389 | if(writer != null) |
390 | { | 390 | { |
391 | writer.Close(); | 391 | writer.Close(); |
392 | } | 392 | } |
393 | } | 393 | } |
394 | return; | 394 | return; |
395 | } | 395 | } |
396 | //start reading the xml config file | 396 | //start reading the xml config file |
397 | XmlElement rootNode = doc.DocumentElement; | 397 | XmlElement rootNode = doc.DocumentElement; |
398 | //string suggestedVersion = Helper.AttributeValue(rootNode,"version","1.0"); | 398 | //string suggestedVersion = Helper.AttributeValue(rootNode,"version","1.0"); |
399 | Helper.CheckForOSVariables = Helper.ParseBoolean(rootNode,"checkOsVars",false); | 399 | Helper.CheckForOSVariables = Helper.ParseBoolean(rootNode,"checkOsVars",false); |
400 | 400 | ||
401 | foreach(XmlNode node in rootNode.ChildNodes)//solutions or if pre-proc instructions | 401 | foreach(XmlNode node in rootNode.ChildNodes)//solutions or if pre-proc instructions |
402 | { | 402 | { |
403 | IDataNode dataNode = ParseNode(node, null); | 403 | IDataNode dataNode = ParseNode(node, null); |
404 | if(dataNode is ProcessNode) | 404 | if(dataNode is ProcessNode) |
405 | { | 405 | { |
406 | ProcessNode proc = (ProcessNode)dataNode; | 406 | ProcessNode proc = (ProcessNode)dataNode; |
407 | if(proc.IsValid) | 407 | if(proc.IsValid) |
408 | { | 408 | { |
409 | ProcessFile(proc.Path); | 409 | ProcessFile(proc.Path); |
410 | } | 410 | } |
411 | } | 411 | } |
412 | else if(dataNode is SolutionNode) | 412 | else if(dataNode is SolutionNode) |
413 | { | 413 | { |
414 | m_Solutions.Add(dataNode); | 414 | m_Solutions.Add(dataNode); |
415 | } | 415 | } |
416 | } | 416 | } |
417 | } | 417 | } |
418 | catch(XmlSchemaException xse) | 418 | catch(XmlSchemaException xse) |
419 | { | 419 | { |
420 | m_Log.Write("XML validation error at line {0} in {1}:\n\n{2}", | 420 | m_Log.Write("XML validation error at line {0} in {1}:\n\n{2}", |
421 | xse.LineNumber, path, xse.Message); | 421 | xse.LineNumber, path, xse.Message); |
422 | } | 422 | } |
423 | finally | 423 | finally |
424 | { | 424 | { |
425 | m_CurrentWorkingDirectory.Pop(); | 425 | m_CurrentWorkingDirectory.Pop(); |
426 | } | 426 | } |
427 | } | 427 | } |
428 | 428 | ||
429 | #endregion | 429 | #endregion |
430 | 430 | ||
431 | #region Public Methods | 431 | #region Public Methods |
432 | 432 | ||
433 | /// <summary> | 433 | /// <summary> |
434 | /// Allows the project. | 434 | /// Allows the project. |
435 | /// </summary> | 435 | /// </summary> |
436 | /// <param name="projectGroupsFlags">The project groups flags.</param> | 436 | /// <param name="projectGroupsFlags">The project groups flags.</param> |
437 | /// <returns></returns> | 437 | /// <returns></returns> |
438 | public bool AllowProject(string projectGroupsFlags) | 438 | public bool AllowProject(string projectGroupsFlags) |
439 | { | 439 | { |
440 | if(m_ProjectGroups != null && m_ProjectGroups.Length > 0) | 440 | if(m_ProjectGroups != null && m_ProjectGroups.Length > 0) |
441 | { | 441 | { |
442 | if(projectGroupsFlags != null && projectGroupsFlags.Length == 0) | 442 | if(projectGroupsFlags != null && projectGroupsFlags.Length == 0) |
443 | { | 443 | { |
444 | foreach(string group in projectGroupsFlags.Split('|')) | 444 | foreach(string group in projectGroupsFlags.Split('|')) |
445 | { | 445 | { |
446 | if(Array.IndexOf(m_ProjectGroups, group) != -1) //if included in the filter list | 446 | if(Array.IndexOf(m_ProjectGroups, group) != -1) //if included in the filter list |
447 | { | 447 | { |
448 | return true; | 448 | return true; |
449 | } | 449 | } |
450 | } | 450 | } |
451 | } | 451 | } |
452 | return false;//not included in the list or no groups specified for the project | 452 | return false;//not included in the list or no groups specified for the project |
453 | } | 453 | } |
454 | return true;//no filter specified in the command line args | 454 | return true;//no filter specified in the command line args |
455 | } | 455 | } |
456 | 456 | ||
457 | /// <summary> | 457 | /// <summary> |
458 | /// Gets the type of the node. | 458 | /// Gets the type of the node. |
459 | /// </summary> | 459 | /// </summary> |
460 | /// <param name="node">The node.</param> | 460 | /// <param name="node">The node.</param> |
461 | /// <returns></returns> | 461 | /// <returns></returns> |
462 | public Type GetNodeType(XmlNode node) | 462 | public Type GetNodeType(XmlNode node) |
463 | { | 463 | { |
464 | if( node == null ) | 464 | if( node == null ) |
465 | { | 465 | { |
466 | throw new ArgumentNullException("node"); | 466 | throw new ArgumentNullException("node"); |
467 | } | 467 | } |
468 | if(!m_Nodes.ContainsKey(node.Name)) | 468 | if(!m_Nodes.ContainsKey(node.Name)) |
469 | { | 469 | { |
470 | return null; | 470 | return null; |
471 | } | 471 | } |
472 | 472 | ||
473 | NodeEntry ne = (NodeEntry)m_Nodes[node.Name]; | 473 | NodeEntry ne = (NodeEntry)m_Nodes[node.Name]; |
474 | return ne.Type; | 474 | return ne.Type; |
475 | } | 475 | } |
476 | 476 | ||
477 | /// <summary> | 477 | /// <summary> |
478 | /// | 478 | /// |
479 | /// </summary> | 479 | /// </summary> |
480 | /// <param name="node"></param> | 480 | /// <param name="node"></param> |
481 | /// <param name="parent"></param> | 481 | /// <param name="parent"></param> |
482 | /// <returns></returns> | 482 | /// <returns></returns> |
483 | public IDataNode ParseNode(XmlNode node, IDataNode parent) | 483 | public IDataNode ParseNode(XmlNode node, IDataNode parent) |
484 | { | 484 | { |
485 | return ParseNode(node, parent, null); | 485 | return ParseNode(node, parent, null); |
486 | } | 486 | } |
487 | 487 | ||
488 | //Create an instance of the data node type that is mapped to the name of the xml DOM node | 488 | //Create an instance of the data node type that is mapped to the name of the xml DOM node |
489 | /// <summary> | 489 | /// <summary> |
490 | /// Parses the node. | 490 | /// Parses the node. |
491 | /// </summary> | 491 | /// </summary> |
492 | /// <param name="node">The node.</param> | 492 | /// <param name="node">The node.</param> |
493 | /// <param name="parent">The parent.</param> | 493 | /// <param name="parent">The parent.</param> |
494 | /// <param name="preNode">The pre node.</param> | 494 | /// <param name="preNode">The pre node.</param> |
495 | /// <returns></returns> | 495 | /// <returns></returns> |
496 | public IDataNode ParseNode(XmlNode node, IDataNode parent, IDataNode preNode) | 496 | public IDataNode ParseNode(XmlNode node, IDataNode parent, IDataNode preNode) |
497 | { | 497 | { |
498 | IDataNode dataNode = null; | 498 | IDataNode dataNode = null; |
499 | 499 | ||
500 | try | 500 | try |
501 | { | 501 | { |
502 | if( node == null ) | 502 | if( node == null ) |
503 | { | 503 | { |
504 | throw new ArgumentNullException("node"); | 504 | throw new ArgumentNullException("node"); |
505 | } | 505 | } |
506 | if(preNode == null) | 506 | if(preNode == null) |
507 | { | 507 | { |
508 | if(!m_Nodes.ContainsKey(node.Name)) | 508 | if(!m_Nodes.ContainsKey(node.Name)) |
509 | { | 509 | { |
510 | //throw new XmlException("Unknown XML node: " + node.Name); | 510 | //throw new XmlException("Unknown XML node: " + node.Name); |
511 | return null; | 511 | return null; |
512 | } | 512 | } |
513 | 513 | ||
514 | NodeEntry ne = (NodeEntry)m_Nodes[node.Name]; | 514 | NodeEntry ne = (NodeEntry)m_Nodes[node.Name]; |
515 | Type type = ne.Type; | 515 | Type type = ne.Type; |
516 | //DataNodeAttribute dna = ne.Attribute; | 516 | //DataNodeAttribute dna = ne.Attribute; |
517 | 517 | ||
518 | dataNode = (IDataNode)type.Assembly.CreateInstance(type.FullName); | 518 | dataNode = (IDataNode)type.Assembly.CreateInstance(type.FullName); |
519 | if(dataNode == null) | 519 | if(dataNode == null) |
520 | { | 520 | { |
521 | throw new System.Reflection.TargetException("Could not create new parser instance: " + type.FullName); | 521 | throw new System.Reflection.TargetException("Could not create new parser instance: " + type.FullName); |
522 | } | 522 | } |
523 | } | 523 | } |
524 | else | 524 | else |
525 | dataNode = preNode; | 525 | dataNode = preNode; |
526 | 526 | ||
527 | dataNode.Parent = parent; | 527 | dataNode.Parent = parent; |
528 | dataNode.Parse(node); | 528 | dataNode.Parse(node); |
529 | } | 529 | } |
530 | catch(WarningException wex) | 530 | catch(WarningException wex) |
531 | { | 531 | { |
532 | m_Log.Write(LogType.Warning, wex.Message); | 532 | m_Log.Write(LogType.Warning, wex.Message); |
533 | return null; | 533 | return null; |
534 | } | 534 | } |
535 | catch(FatalException fex) | 535 | catch(FatalException fex) |
536 | { | 536 | { |
537 | m_Log.WriteException(LogType.Error, fex); | 537 | m_Log.WriteException(LogType.Error, fex); |
538 | throw; | 538 | throw; |
539 | } | 539 | } |
540 | catch(Exception ex) | 540 | catch(Exception ex) |
541 | { | 541 | { |
542 | m_Log.WriteException(LogType.Error, ex); | 542 | m_Log.WriteException(LogType.Error, ex); |
543 | throw; | 543 | throw; |
544 | } | 544 | } |
545 | 545 | ||
546 | return dataNode; | 546 | return dataNode; |
547 | } | 547 | } |
548 | 548 | ||
549 | /// <summary> | 549 | /// <summary> |
550 | /// Initializes the specified target. | 550 | /// Initializes the specified target. |
551 | /// </summary> | 551 | /// </summary> |
552 | /// <param name="target">The target.</param> | 552 | /// <param name="target">The target.</param> |
553 | /// <param name="args">The args.</param> | 553 | /// <param name="args">The args.</param> |
554 | public void Initialize(LogTargets target, string[] args) | 554 | public void Initialize(LogTargets target, string[] args) |
555 | { | 555 | { |
556 | m_Targets = new Hashtable(); | 556 | m_Targets = new Hashtable(); |
557 | CacheTargets(this.GetType().Assembly); | 557 | CacheTargets(this.GetType().Assembly); |
558 | m_Nodes = new Hashtable(); | 558 | m_Nodes = new Hashtable(); |
559 | CacheNodeTypes(this.GetType().Assembly); | 559 | CacheNodeTypes(this.GetType().Assembly); |
560 | CacheVersion(); | 560 | CacheVersion(); |
561 | 561 | ||
562 | m_CommandLine = new CommandLineCollection(args); | 562 | m_CommandLine = new CommandLineCollection(args); |
563 | 563 | ||
564 | string logFile = null; | 564 | string logFile = null; |
565 | if(m_CommandLine.WasPassed("log")) | 565 | if(m_CommandLine.WasPassed("log")) |
566 | { | 566 | { |
567 | logFile = m_CommandLine["log"]; | 567 | logFile = m_CommandLine["log"]; |
568 | 568 | ||
569 | if(logFile != null && logFile.Length == 0) | 569 | if(logFile != null && logFile.Length == 0) |
570 | { | 570 | { |
571 | logFile = "Prebuild.log"; | 571 | logFile = "Prebuild.log"; |
572 | } | 572 | } |
573 | } | 573 | } |
574 | else | 574 | else |
575 | { | 575 | { |
576 | target = target & ~LogTargets.File; //dont output to a file | 576 | target = target & ~LogTargets.File; //dont output to a file |
577 | } | 577 | } |
578 | 578 | ||
579 | m_Log = new Log(target, logFile); | 579 | m_Log = new Log(target, logFile); |
580 | LogBanner(); | 580 | LogBanner(); |
581 | 581 | ||
582 | m_CurrentWorkingDirectory = new CurrentDirectory(); | 582 | m_CurrentWorkingDirectory = new CurrentDirectory(); |
583 | 583 | ||
584 | m_Target = m_CommandLine["target"]; | 584 | m_Target = m_CommandLine["target"]; |
585 | m_Clean = m_CommandLine["clean"]; | 585 | m_Clean = m_CommandLine["clean"]; |
586 | string removeDirs = m_CommandLine["removedir"]; | 586 | string removeDirs = m_CommandLine["removedir"]; |
587 | if(removeDirs != null && removeDirs.Length == 0) | 587 | if(removeDirs != null && removeDirs.Length == 0) |
588 | { | 588 | { |
589 | m_RemoveDirectories = removeDirs.Split('|'); | 589 | m_RemoveDirectories = removeDirs.Split('|'); |
590 | } | 590 | } |
591 | 591 | ||
592 | string flags = m_CommandLine["allowedgroups"];//allows filtering by specifying a pipe-delimited list of groups to include | 592 | string flags = m_CommandLine["allowedgroups"];//allows filtering by specifying a pipe-delimited list of groups to include |
593 | if(flags != null && flags.Length == 0) | 593 | if(flags != null && flags.Length == 0) |
594 | { | 594 | { |
595 | m_ProjectGroups = flags.Split('|'); | 595 | m_ProjectGroups = flags.Split('|'); |
596 | } | 596 | } |
597 | m_PauseAfterFinish = m_CommandLine.WasPassed("pause"); | 597 | m_PauseAfterFinish = m_CommandLine.WasPassed("pause"); |
598 | 598 | ||
599 | LoadSchema(); | 599 | LoadSchema(); |
600 | 600 | ||
601 | m_Solutions = new ArrayList(); | 601 | m_Solutions = new ArrayList(); |
602 | m_Refs = new StringCollection(); | 602 | m_Refs = new StringCollection(); |
603 | } | 603 | } |
604 | 604 | ||
605 | /// <summary> | 605 | /// <summary> |
606 | /// Processes this instance. | 606 | /// Processes this instance. |
607 | /// </summary> | 607 | /// </summary> |
608 | public void Process() | 608 | public void Process() |
609 | { | 609 | { |
610 | bool perfomedOtherTask = false; | 610 | bool perfomedOtherTask = false; |
611 | if(m_RemoveDirectories != null && m_RemoveDirectories.Length > 0) | 611 | if(m_RemoveDirectories != null && m_RemoveDirectories.Length > 0) |
612 | { | 612 | { |
613 | try | 613 | try |
614 | { | 614 | { |
615 | RemoveDirectories(".",m_RemoveDirectories); | 615 | RemoveDirectories(".",m_RemoveDirectories); |
616 | } | 616 | } |
617 | catch(IOException e) | 617 | catch(IOException e) |
618 | { | 618 | { |
619 | m_Log.Write("Failed to remove directories named {0}",m_RemoveDirectories); | 619 | m_Log.Write("Failed to remove directories named {0}",m_RemoveDirectories); |
620 | m_Log.WriteException(LogType.Error,e); | 620 | m_Log.WriteException(LogType.Error,e); |
621 | } | 621 | } |
622 | catch(UnauthorizedAccessException e) | 622 | catch(UnauthorizedAccessException e) |
623 | { | 623 | { |
624 | m_Log.Write("Failed to remove directories named {0}",m_RemoveDirectories); | 624 | m_Log.Write("Failed to remove directories named {0}",m_RemoveDirectories); |
625 | m_Log.WriteException(LogType.Error,e); | 625 | m_Log.WriteException(LogType.Error,e); |
626 | } | 626 | } |
627 | perfomedOtherTask = true; | 627 | perfomedOtherTask = true; |
628 | } | 628 | } |
629 | 629 | ||
630 | if(m_Target != null && m_Clean != null) | 630 | if(m_Target != null && m_Clean != null) |
631 | { | 631 | { |
632 | m_Log.Write(LogType.Error, "The options /target and /clean cannot be passed together"); | 632 | m_Log.Write(LogType.Error, "The options /target and /clean cannot be passed together"); |
633 | return; | 633 | return; |
634 | } | 634 | } |
635 | else if(m_Target == null && m_Clean == null) | 635 | else if(m_Target == null && m_Clean == null) |
636 | { | 636 | { |
637 | if(perfomedOtherTask) //finished | 637 | if(perfomedOtherTask) //finished |
638 | { | 638 | { |
639 | return; | 639 | return; |
640 | } | 640 | } |
641 | m_Log.Write(LogType.Error, "Must pass either /target or /clean to process a Prebuild file"); | 641 | m_Log.Write(LogType.Error, "Must pass either /target or /clean to process a Prebuild file"); |
642 | return; | 642 | return; |
643 | } | 643 | } |
644 | 644 | ||
645 | string file = "./prebuild.xml"; | 645 | string file = "./prebuild.xml"; |
646 | if(m_CommandLine.WasPassed("file")) | 646 | if(m_CommandLine.WasPassed("file")) |
647 | { | 647 | { |
648 | file = m_CommandLine["file"]; | 648 | file = m_CommandLine["file"]; |
649 | } | 649 | } |
650 | 650 | ||
651 | ProcessFile(file); | 651 | ProcessFile(file); |
652 | 652 | ||
653 | string target = (m_Target != null ? m_Target.ToLower() : m_Clean.ToLower()); | 653 | string target = (m_Target != null ? m_Target.ToLower() : m_Clean.ToLower()); |
654 | bool clean = (m_Target == null); | 654 | bool clean = (m_Target == null); |
655 | if(clean && target != null && target.Length == 0) | 655 | if(clean && target != null && target.Length == 0) |
656 | { | 656 | { |
657 | target = "all"; | 657 | target = "all"; |
658 | } | 658 | } |
659 | if(clean && target == "all")//default to all if no target was specified for clean | 659 | if(clean && target == "all")//default to all if no target was specified for clean |
660 | { | 660 | { |
661 | //check if they passed yes | 661 | //check if they passed yes |
662 | if (!m_CommandLine.WasPassed("yes")) | 662 | if (!m_CommandLine.WasPassed("yes")) |
663 | { | 663 | { |
664 | Console.WriteLine("WARNING: This operation will clean ALL project files for all targets, are you sure? (y/n):"); | 664 | Console.WriteLine("WARNING: This operation will clean ALL project files for all targets, are you sure? (y/n):"); |
665 | string ret = Console.ReadLine(); | 665 | string ret = Console.ReadLine(); |
666 | if(ret == null) | 666 | if(ret == null) |
667 | { | 667 | { |
668 | return; | 668 | return; |
669 | } | 669 | } |
670 | ret = ret.Trim().ToLower(); | 670 | ret = ret.Trim().ToLower(); |
671 | if((ret.ToLower() != "y" && ret.ToLower() != "yes")) | 671 | if((ret.ToLower() != "y" && ret.ToLower() != "yes")) |
672 | { | 672 | { |
673 | return; | 673 | return; |
674 | } | 674 | } |
675 | } | 675 | } |
676 | //clean all targets (just cleaning vs2002 target didn't clean nant) | 676 | //clean all targets (just cleaning vs2002 target didn't clean nant) |
677 | foreach(ITarget targ in m_Targets.Values) | 677 | foreach(ITarget targ in m_Targets.Values) |
678 | { | 678 | { |
679 | targ.Clean(this); | 679 | targ.Clean(this); |
680 | } | 680 | } |
681 | } | 681 | } |
682 | else | 682 | else |
683 | { | 683 | { |
684 | ITarget targ = (ITarget)m_Targets[target]; | 684 | ITarget targ = (ITarget)m_Targets[target]; |
685 | 685 | ||
686 | if(clean) | 686 | if(clean) |
687 | { | 687 | { |
688 | targ.Clean(this); | 688 | targ.Clean(this); |
689 | } | 689 | } |
690 | else | 690 | else |
691 | { | 691 | { |
692 | targ.Write(this); | 692 | targ.Write(this); |
693 | } | 693 | } |
694 | } | 694 | } |
695 | 695 | ||
696 | m_Log.Flush(); | 696 | m_Log.Flush(); |
697 | } | 697 | } |
698 | 698 | ||
699 | #endregion | 699 | #endregion |
700 | 700 | ||
701 | #region IDisposable Members | 701 | #region IDisposable Members |
702 | 702 | ||
703 | /// <summary> | 703 | /// <summary> |
704 | /// | 704 | /// |
705 | /// </summary> | 705 | /// </summary> |
706 | public void Dispose() | 706 | public void Dispose() |
707 | { | 707 | { |
708 | Dispose(true); | 708 | Dispose(true); |
709 | GC.SuppressFinalize(this); | 709 | GC.SuppressFinalize(this); |
710 | } | 710 | } |
711 | 711 | ||
712 | /// <summary> | 712 | /// <summary> |
713 | /// Dispose objects | 713 | /// Dispose objects |
714 | /// </summary> | 714 | /// </summary> |
715 | /// <param name="disposing"> | 715 | /// <param name="disposing"> |
716 | /// If true, it will dispose close the handle | 716 | /// If true, it will dispose close the handle |
717 | /// </param> | 717 | /// </param> |
718 | /// <remarks> | 718 | /// <remarks> |
719 | /// Will dispose managed and unmanaged resources. | 719 | /// Will dispose managed and unmanaged resources. |
720 | /// </remarks> | 720 | /// </remarks> |
721 | protected virtual void Dispose(bool disposing) | 721 | protected virtual void Dispose(bool disposing) |
722 | { | 722 | { |
723 | if (!this.disposed) | 723 | if (!this.disposed) |
724 | { | 724 | { |
725 | if (disposing) | 725 | if (disposing) |
726 | { | 726 | { |
727 | if (this.m_Log != null) | 727 | if (this.m_Log != null) |
728 | { | 728 | { |
729 | this.m_Log.Close(); | 729 | this.m_Log.Close(); |
730 | this.m_Log = null; | 730 | this.m_Log = null; |
731 | } | 731 | } |
732 | } | 732 | } |
733 | } | 733 | } |
734 | this.disposed = true; | 734 | this.disposed = true; |
735 | } | 735 | } |
736 | 736 | ||
737 | /// <summary> | 737 | /// <summary> |
738 | /// | 738 | /// |
739 | /// </summary> | 739 | /// </summary> |
740 | ~Kernel() | 740 | ~Kernel() |
741 | { | 741 | { |
742 | this.Dispose(false); | 742 | this.Dispose(false); |
743 | } | 743 | } |
744 | 744 | ||
745 | /// <summary> | 745 | /// <summary> |
746 | /// Closes and destroys this object | 746 | /// Closes and destroys this object |
747 | /// </summary> | 747 | /// </summary> |
748 | /// <remarks> | 748 | /// <remarks> |
749 | /// Same as Dispose(true) | 749 | /// Same as Dispose(true) |
750 | /// </remarks> | 750 | /// </remarks> |
751 | public void Close() | 751 | public void Close() |
752 | { | 752 | { |
753 | Dispose(); | 753 | Dispose(); |
754 | } | 754 | } |
755 | 755 | ||
756 | #endregion | 756 | #endregion |
757 | } | 757 | } |
758 | } \ No newline at end of file | 758 | } \ No newline at end of file |
diff --git a/Prebuild/src/Core/Nodes/ConfigurationNode.cs b/Prebuild/src/Core/Nodes/ConfigurationNode.cs index 390794f..d2a5d20 100644 --- a/Prebuild/src/Core/Nodes/ConfigurationNode.cs +++ b/Prebuild/src/Core/Nodes/ConfigurationNode.cs | |||
@@ -1,187 +1,187 @@ | |||
1 | #region BSD License | 1 | #region BSD License |
2 | /* | 2 | /* |
3 | Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) | 3 | Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) |
4 | 4 | ||
5 | Redistribution and use in source and binary forms, with or without modification, are permitted | 5 | Redistribution and use in source and binary forms, with or without modification, are permitted |
6 | provided that the following conditions are met: | 6 | provided that the following conditions are met: |
7 | 7 | ||
8 | * Redistributions of source code must retain the above copyright notice, this list of conditions | 8 | * Redistributions of source code must retain the above copyright notice, this list of conditions |
9 | and the following disclaimer. | 9 | and the following disclaimer. |
10 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions | 10 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions |
11 | and the following disclaimer in the documentation and/or other materials provided with the | 11 | and the following disclaimer in the documentation and/or other materials provided with the |
12 | distribution. | 12 | distribution. |
13 | * The name of the author may not be used to endorse or promote products derived from this software | 13 | * The name of the author may not be used to endorse or promote products derived from this software |
14 | without specific prior written permission. | 14 | without specific prior written permission. |
15 | 15 | ||
16 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, | 16 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, |
17 | BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | 17 | BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
18 | ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | 18 | ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
19 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | 19 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
20 | OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY | 20 | OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
21 | OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | 21 | OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING |
22 | IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 22 | IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
23 | */ | 23 | */ |
24 | #endregion | 24 | #endregion |
25 | 25 | ||
26 | #region CVS Information | 26 | #region CVS Information |
27 | /* | 27 | /* |
28 | * $Source$ | 28 | * $Source$ |
29 | * $Author: jendave $ | 29 | * $Author: jendave $ |
30 | * $Date: 2006-01-28 01:49:58 +0100 (lö, 28 jan 2006) $ | 30 | * $Date: 2006-01-28 01:49:58 +0100 (lö, 28 jan 2006) $ |
31 | * $Revision: 71 $ | 31 | * $Revision: 71 $ |
32 | */ | 32 | */ |
33 | #endregion | 33 | #endregion |
34 | 34 | ||
35 | using System; | 35 | using System; |
36 | using System.Xml; | 36 | using System.Xml; |
37 | 37 | ||
38 | using Prebuild.Core.Attributes; | 38 | using Prebuild.Core.Attributes; |
39 | using Prebuild.Core.Interfaces; | 39 | using Prebuild.Core.Interfaces; |
40 | using Prebuild.Core.Utilities; | 40 | using Prebuild.Core.Utilities; |
41 | 41 | ||
42 | namespace Prebuild.Core.Nodes | 42 | namespace Prebuild.Core.Nodes |
43 | { | 43 | { |
44 | /// <summary> | 44 | /// <summary> |
45 | /// | 45 | /// |
46 | /// </summary> | 46 | /// </summary> |
47 | [DataNode("Configuration")] | 47 | [DataNode("Configuration")] |
48 | public class ConfigurationNode : DataNode, ICloneable, IComparable | 48 | public class ConfigurationNode : DataNode, ICloneable, IComparable |
49 | { | 49 | { |
50 | #region Fields | 50 | #region Fields |
51 | 51 | ||
52 | private string m_Name = "unknown"; | 52 | private string m_Name = "unknown"; |
53 | private OptionsNode m_Options; | 53 | private OptionsNode m_Options; |
54 | 54 | ||
55 | #endregion | 55 | #endregion |
56 | 56 | ||
57 | #region Constructors | 57 | #region Constructors |
58 | 58 | ||
59 | /// <summary> | 59 | /// <summary> |
60 | /// Initializes a new instance of the <see cref="ConfigurationNode"/> class. | 60 | /// Initializes a new instance of the <see cref="ConfigurationNode"/> class. |
61 | /// </summary> | 61 | /// </summary> |
62 | public ConfigurationNode() | 62 | public ConfigurationNode() |
63 | { | 63 | { |
64 | m_Options = new OptionsNode(); | 64 | m_Options = new OptionsNode(); |
65 | } | 65 | } |
66 | 66 | ||
67 | #endregion | 67 | #endregion |
68 | 68 | ||
69 | #region Properties | 69 | #region Properties |
70 | 70 | ||
71 | /// <summary> | 71 | /// <summary> |
72 | /// Gets or sets the parent. | 72 | /// Gets or sets the parent. |
73 | /// </summary> | 73 | /// </summary> |
74 | /// <value>The parent.</value> | 74 | /// <value>The parent.</value> |
75 | public override IDataNode Parent | 75 | public override IDataNode Parent |
76 | { | 76 | { |
77 | get | 77 | get |
78 | { | 78 | { |
79 | return base.Parent; | 79 | return base.Parent; |
80 | } | 80 | } |
81 | set | 81 | set |
82 | { | 82 | { |
83 | base.Parent = value; | 83 | base.Parent = value; |
84 | if(base.Parent is SolutionNode) | 84 | if(base.Parent is SolutionNode) |
85 | { | 85 | { |
86 | SolutionNode node = (SolutionNode)base.Parent; | 86 | SolutionNode node = (SolutionNode)base.Parent; |
87 | if(node != null && node.Options != null) | 87 | if(node != null && node.Options != null) |
88 | { | 88 | { |
89 | node.Options.CopyTo(m_Options); | 89 | node.Options.CopyTo(m_Options); |
90 | } | 90 | } |
91 | } | 91 | } |
92 | } | 92 | } |
93 | } | 93 | } |
94 | 94 | ||
95 | /// <summary> | 95 | /// <summary> |
96 | /// Gets the name. | 96 | /// Gets the name. |
97 | /// </summary> | 97 | /// </summary> |
98 | /// <value>The name.</value> | 98 | /// <value>The name.</value> |
99 | public string Name | 99 | public string Name |
100 | { | 100 | { |
101 | get | 101 | get |
102 | { | 102 | { |
103 | return m_Name; | 103 | return m_Name; |
104 | } | 104 | } |
105 | } | 105 | } |
106 | 106 | ||
107 | /// <summary> | 107 | /// <summary> |
108 | /// Gets or sets the options. | 108 | /// Gets or sets the options. |
109 | /// </summary> | 109 | /// </summary> |
110 | /// <value>The options.</value> | 110 | /// <value>The options.</value> |
111 | public OptionsNode Options | 111 | public OptionsNode Options |
112 | { | 112 | { |
113 | get | 113 | get |
114 | { | 114 | { |
115 | return m_Options; | 115 | return m_Options; |
116 | } | 116 | } |
117 | set | 117 | set |
118 | { | 118 | { |
119 | m_Options = value; | 119 | m_Options = value; |
120 | } | 120 | } |
121 | } | 121 | } |
122 | 122 | ||
123 | #endregion | 123 | #endregion |
124 | 124 | ||
125 | #region Public Methods | 125 | #region Public Methods |
126 | 126 | ||
127 | /// <summary> | 127 | /// <summary> |
128 | /// Parses the specified node. | 128 | /// Parses the specified node. |
129 | /// </summary> | 129 | /// </summary> |
130 | /// <param name="node">The node.</param> | 130 | /// <param name="node">The node.</param> |
131 | public override void Parse(XmlNode node) | 131 | public override void Parse(XmlNode node) |
132 | { | 132 | { |
133 | m_Name = Helper.AttributeValue(node, "name", m_Name); | 133 | m_Name = Helper.AttributeValue(node, "name", m_Name); |
134 | if( node == null ) | 134 | if( node == null ) |
135 | { | 135 | { |
136 | throw new ArgumentNullException("node"); | 136 | throw new ArgumentNullException("node"); |
137 | } | 137 | } |
138 | foreach(XmlNode child in node.ChildNodes) | 138 | foreach(XmlNode child in node.ChildNodes) |
139 | { | 139 | { |
140 | IDataNode dataNode = Kernel.Instance.ParseNode(child, this); | 140 | IDataNode dataNode = Kernel.Instance.ParseNode(child, this); |
141 | if(dataNode is OptionsNode) | 141 | if(dataNode is OptionsNode) |
142 | { | 142 | { |
143 | ((OptionsNode)dataNode).CopyTo(m_Options); | 143 | ((OptionsNode)dataNode).CopyTo(m_Options); |
144 | } | 144 | } |
145 | } | 145 | } |
146 | } | 146 | } |
147 | 147 | ||
148 | /// <summary> | 148 | /// <summary> |
149 | /// Copies to. | 149 | /// Copies to. |
150 | /// </summary> | 150 | /// </summary> |
151 | /// <param name="conf">The conf.</param> | 151 | /// <param name="conf">The conf.</param> |
152 | public void CopyTo(ConfigurationNode conf) | 152 | public void CopyTo(ConfigurationNode conf) |
153 | { | 153 | { |
154 | m_Options.CopyTo(conf.m_Options); | 154 | m_Options.CopyTo(conf.m_Options); |
155 | } | 155 | } |
156 | 156 | ||
157 | #endregion | 157 | #endregion |
158 | 158 | ||
159 | #region ICloneable Members | 159 | #region ICloneable Members |
160 | 160 | ||
161 | /// <summary> | 161 | /// <summary> |
162 | /// Creates a new object that is a copy of the current instance. | 162 | /// Creates a new object that is a copy of the current instance. |
163 | /// </summary> | 163 | /// </summary> |
164 | /// <returns> | 164 | /// <returns> |
165 | /// A new object that is a copy of this instance. | 165 | /// A new object that is a copy of this instance. |
166 | /// </returns> | 166 | /// </returns> |
167 | public object Clone() | 167 | public object Clone() |
168 | { | 168 | { |
169 | ConfigurationNode ret = new ConfigurationNode(); | 169 | ConfigurationNode ret = new ConfigurationNode(); |
170 | ret.m_Name = m_Name; | 170 | ret.m_Name = m_Name; |
171 | m_Options.CopyTo(ret.m_Options); | 171 | m_Options.CopyTo(ret.m_Options); |
172 | return ret; | 172 | return ret; |
173 | } | 173 | } |
174 | 174 | ||
175 | #endregion | 175 | #endregion |
176 | 176 | ||
177 | #region IComparable Members | 177 | #region IComparable Members |
178 | 178 | ||
179 | public int CompareTo(object obj) | 179 | public int CompareTo(object obj) |
180 | { | 180 | { |
181 | ConfigurationNode that = (ConfigurationNode) obj; | 181 | ConfigurationNode that = (ConfigurationNode) obj; |
182 | return this.m_Name.CompareTo(that.m_Name); | 182 | return this.m_Name.CompareTo(that.m_Name); |
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 ef5f7ee..aa05faa 100644 --- a/Prebuild/src/Core/Nodes/DataNode.cs +++ b/Prebuild/src/Core/Nodes/DataNode.cs | |||
@@ -1,82 +1,82 @@ | |||
1 | #region BSD License | 1 | #region BSD License |
2 | /* | 2 | /* |
3 | Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) | 3 | Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) |
4 | 4 | ||
5 | Redistribution and use in source and binary forms, with or without modification, are permitted | 5 | Redistribution and use in source and binary forms, with or without modification, are permitted |
6 | provided that the following conditions are met: | 6 | provided that the following conditions are met: |
7 | 7 | ||
8 | * Redistributions of source code must retain the above copyright notice, this list of conditions | 8 | * Redistributions of source code must retain the above copyright notice, this list of conditions |
9 | and the following disclaimer. | 9 | and the following disclaimer. |
10 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions | 10 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions |
11 | and the following disclaimer in the documentation and/or other materials provided with the | 11 | and the following disclaimer in the documentation and/or other materials provided with the |
12 | distribution. | 12 | distribution. |
13 | * The name of the author may not be used to endorse or promote products derived from this software | 13 | * The name of the author may not be used to endorse or promote products derived from this software |
14 | without specific prior written permission. | 14 | without specific prior written permission. |
15 | 15 | ||
16 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, | 16 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, |
17 | BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | 17 | BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
18 | ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | 18 | ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
19 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | 19 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
20 | OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY | 20 | OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
21 | OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | 21 | OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING |
22 | IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 22 | IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
23 | */ | 23 | */ |
24 | #endregion | 24 | #endregion |
25 | 25 | ||
26 | #region CVS Information | 26 | #region CVS Information |
27 | /* | 27 | /* |
28 | * $Source$ | 28 | * $Source$ |
29 | * $Author: jendave $ | 29 | * $Author: jendave $ |
30 | * $Date: 2006-01-28 01:49:58 +0100 (lö, 28 jan 2006) $ | 30 | * $Date: 2006-01-28 01:49:58 +0100 (lö, 28 jan 2006) $ |
31 | * $Revision: 71 $ | 31 | * $Revision: 71 $ |
32 | */ | 32 | */ |
33 | #endregion | 33 | #endregion |
34 | 34 | ||
35 | using System; | 35 | using System; |
36 | using System.Xml; | 36 | using System.Xml; |
37 | 37 | ||
38 | using Prebuild.Core.Attributes; | 38 | using Prebuild.Core.Attributes; |
39 | using Prebuild.Core.Interfaces; | 39 | using Prebuild.Core.Interfaces; |
40 | 40 | ||
41 | namespace Prebuild.Core.Nodes | 41 | namespace Prebuild.Core.Nodes |
42 | { | 42 | { |
43 | /// <summary> | 43 | /// <summary> |
44 | /// | 44 | /// |
45 | /// </summary> | 45 | /// </summary> |
46 | public class DataNode : IDataNode | 46 | public class DataNode : IDataNode |
47 | { | 47 | { |
48 | #region Fields | 48 | #region Fields |
49 | 49 | ||
50 | private IDataNode parent; | 50 | private IDataNode parent; |
51 | 51 | ||
52 | #endregion | 52 | #endregion |
53 | 53 | ||
54 | #region IDataNode Members | 54 | #region IDataNode Members |
55 | 55 | ||
56 | /// <summary> | 56 | /// <summary> |
57 | /// Gets or sets the parent. | 57 | /// Gets or sets the parent. |
58 | /// </summary> | 58 | /// </summary> |
59 | /// <value>The parent.</value> | 59 | /// <value>The parent.</value> |
60 | public virtual IDataNode Parent | 60 | public virtual IDataNode Parent |
61 | { | 61 | { |
62 | get | 62 | get |
63 | { | 63 | { |
64 | return parent; | 64 | return parent; |
65 | } | 65 | } |
66 | set | 66 | set |
67 | { | 67 | { |
68 | parent = value; | 68 | parent = value; |
69 | } | 69 | } |
70 | } | 70 | } |
71 | 71 | ||
72 | /// <summary> | 72 | /// <summary> |
73 | /// Parses the specified node. | 73 | /// Parses the specified node. |
74 | /// </summary> | 74 | /// </summary> |
75 | /// <param name="node">The node.</param> | 75 | /// <param name="node">The node.</param> |
76 | public virtual void Parse(XmlNode node) | 76 | public virtual void Parse(XmlNode node) |
77 | { | 77 | { |
78 | } | 78 | } |
79 | 79 | ||
80 | #endregion | 80 | #endregion |
81 | } | 81 | } |
82 | } | 82 | } |
diff --git a/Prebuild/src/Core/Nodes/ExcludeNode.cs b/Prebuild/src/Core/Nodes/ExcludeNode.cs index bfcebca..905626d 100644 --- a/Prebuild/src/Core/Nodes/ExcludeNode.cs +++ b/Prebuild/src/Core/Nodes/ExcludeNode.cs | |||
@@ -1,85 +1,85 @@ | |||
1 | #region BSD License | 1 | #region BSD License |
2 | /* | 2 | /* |
3 | Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) | 3 | Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) |
4 | 4 | ||
5 | Redistribution and use in source and binary forms, with or without modification, are permitted | 5 | Redistribution and use in source and binary forms, with or without modification, are permitted |
6 | provided that the following conditions are met: | 6 | provided that the following conditions are met: |
7 | 7 | ||
8 | * Redistributions of source code must retain the above copyright notice, this list of conditions | 8 | * Redistributions of source code must retain the above copyright notice, this list of conditions |
9 | and the following disclaimer. | 9 | and the following disclaimer. |
10 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions | 10 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions |
11 | and the following disclaimer in the documentation and/or other materials provided with the | 11 | and the following disclaimer in the documentation and/or other materials provided with the |
12 | distribution. | 12 | distribution. |
13 | * The name of the author may not be used to endorse or promote products derived from this software | 13 | * The name of the author may not be used to endorse or promote products derived from this software |
14 | without specific prior written permission. | 14 | without specific prior written permission. |
15 | 15 | ||
16 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, | 16 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, |
17 | BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | 17 | BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
18 | ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | 18 | ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
19 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | 19 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
20 | OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY | 20 | OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
21 | OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | 21 | OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING |
22 | IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 22 | IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
23 | */ | 23 | */ |
24 | #endregion | 24 | #endregion |
25 | 25 | ||
26 | #region CVS Information | 26 | #region CVS Information |
27 | /* | 27 | /* |
28 | * $Source$ | 28 | * $Source$ |
29 | * $Author: jendave $ | 29 | * $Author: jendave $ |
30 | * $Date: 2006-01-31 16:35:39 +0100 (ti, 31 jan 2006) $ | 30 | * $Date: 2006-01-31 16:35:39 +0100 (ti, 31 jan 2006) $ |
31 | * $Revision: 74 $ | 31 | * $Revision: 74 $ |
32 | */ | 32 | */ |
33 | #endregion | 33 | #endregion |
34 | 34 | ||
35 | using System; | 35 | using System; |
36 | using System.Xml; | 36 | using System.Xml; |
37 | 37 | ||
38 | using Prebuild.Core.Attributes; | 38 | using Prebuild.Core.Attributes; |
39 | using Prebuild.Core.Interfaces; | 39 | using Prebuild.Core.Interfaces; |
40 | using Prebuild.Core.Utilities; | 40 | using Prebuild.Core.Utilities; |
41 | 41 | ||
42 | namespace Prebuild.Core.Nodes | 42 | namespace Prebuild.Core.Nodes |
43 | { | 43 | { |
44 | /// <summary> | 44 | /// <summary> |
45 | /// | 45 | /// |
46 | /// </summary> | 46 | /// </summary> |
47 | [DataNode("Exclude")] | 47 | [DataNode("Exclude")] |
48 | public class ExcludeNode : DataNode | 48 | public class ExcludeNode : DataNode |
49 | { | 49 | { |
50 | #region Fields | 50 | #region Fields |
51 | 51 | ||
52 | private string m_Name = "unknown"; | 52 | private string m_Name = "unknown"; |
53 | 53 | ||
54 | #endregion | 54 | #endregion |
55 | 55 | ||
56 | #region Properties | 56 | #region Properties |
57 | 57 | ||
58 | /// <summary> | 58 | /// <summary> |
59 | /// Gets the name. | 59 | /// Gets the name. |
60 | /// </summary> | 60 | /// </summary> |
61 | /// <value>The name.</value> | 61 | /// <value>The name.</value> |
62 | public string Name | 62 | public string Name |
63 | { | 63 | { |
64 | get | 64 | get |
65 | { | 65 | { |
66 | return m_Name; | 66 | return m_Name; |
67 | } | 67 | } |
68 | } | 68 | } |
69 | 69 | ||
70 | #endregion | 70 | #endregion |
71 | 71 | ||
72 | #region Public Methods | 72 | #region Public Methods |
73 | 73 | ||
74 | /// <summary> | 74 | /// <summary> |
75 | /// Parses the specified node. | 75 | /// Parses the specified node. |
76 | /// </summary> | 76 | /// </summary> |
77 | /// <param name="node">The node.</param> | 77 | /// <param name="node">The node.</param> |
78 | public override void Parse(XmlNode node) | 78 | public override void Parse(XmlNode node) |
79 | { | 79 | { |
80 | m_Name = Helper.AttributeValue(node, "name", m_Name); | 80 | m_Name = Helper.AttributeValue(node, "name", m_Name); |
81 | } | 81 | } |
82 | 82 | ||
83 | #endregion | 83 | #endregion |
84 | } | 84 | } |
85 | } | 85 | } |
diff --git a/Prebuild/src/Core/Nodes/FileNode.cs b/Prebuild/src/Core/Nodes/FileNode.cs index de3b69e..ab0a2a3 100644 --- a/Prebuild/src/Core/Nodes/FileNode.cs +++ b/Prebuild/src/Core/Nodes/FileNode.cs | |||
@@ -1,238 +1,238 @@ | |||
1 | #region BSD License | 1 | #region BSD License |
2 | /* | 2 | /* |
3 | Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) | 3 | Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) |
4 | 4 | ||
5 | Redistribution and use in source and binary forms, with or without modification, are permitted | 5 | Redistribution and use in source and binary forms, with or without modification, are permitted |
6 | provided that the following conditions are met: | 6 | provided that the following conditions are met: |
7 | 7 | ||
8 | * Redistributions of source code must retain the above copyright notice, this list of conditions | 8 | * Redistributions of source code must retain the above copyright notice, this list of conditions |
9 | and the following disclaimer. | 9 | and the following disclaimer. |
10 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions | 10 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions |
11 | and the following disclaimer in the documentation and/or other materials provided with the | 11 | and the following disclaimer in the documentation and/or other materials provided with the |
12 | distribution. | 12 | distribution. |
13 | * The name of the author may not be used to endorse or promote products derived from this software | 13 | * The name of the author may not be used to endorse or promote products derived from this software |
14 | without specific prior written permission. | 14 | without specific prior written permission. |
15 | 15 | ||
16 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, | 16 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, |
17 | BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | 17 | BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
18 | ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | 18 | ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
19 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | 19 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
20 | OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY | 20 | OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
21 | OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | 21 | OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING |
22 | IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 22 | IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
23 | */ | 23 | */ |
24 | #endregion | 24 | #endregion |
25 | 25 | ||
26 | #region CVS Information | 26 | #region CVS Information |
27 | /* | 27 | /* |
28 | * $Source$ | 28 | * $Source$ |
29 | * $Author: jendave $ | 29 | * $Author: jendave $ |
30 | * $Date: 2007-01-08 17:55:40 +0100 (må, 08 jan 2007) $ | 30 | * $Date: 2007-01-08 17:55:40 +0100 (må, 08 jan 2007) $ |
31 | * $Revision: 197 $ | 31 | * $Revision: 197 $ |
32 | */ | 32 | */ |
33 | #endregion | 33 | #endregion |
34 | 34 | ||
35 | using System; | 35 | using System; |
36 | using System.IO; | 36 | using System.IO; |
37 | using System.Xml; | 37 | using System.Xml; |
38 | 38 | ||
39 | using Prebuild.Core.Attributes; | 39 | using Prebuild.Core.Attributes; |
40 | using Prebuild.Core.Interfaces; | 40 | using Prebuild.Core.Interfaces; |
41 | using Prebuild.Core.Utilities; | 41 | using Prebuild.Core.Utilities; |
42 | 42 | ||
43 | namespace Prebuild.Core.Nodes | 43 | namespace Prebuild.Core.Nodes |
44 | { | 44 | { |
45 | /// <summary> | 45 | /// <summary> |
46 | /// | 46 | /// |
47 | /// </summary> | 47 | /// </summary> |
48 | public enum BuildAction | 48 | public enum BuildAction |
49 | { | 49 | { |
50 | /// <summary> | 50 | /// <summary> |
51 | /// | 51 | /// |
52 | /// </summary> | 52 | /// </summary> |
53 | None, | 53 | None, |
54 | /// <summary> | 54 | /// <summary> |
55 | /// | 55 | /// |
56 | /// </summary> | 56 | /// </summary> |
57 | Compile, | 57 | Compile, |
58 | /// <summary> | 58 | /// <summary> |
59 | /// | 59 | /// |
60 | /// </summary> | 60 | /// </summary> |
61 | Content, | 61 | Content, |
62 | /// <summary> | 62 | /// <summary> |
63 | /// | 63 | /// |
64 | /// </summary> | 64 | /// </summary> |
65 | EmbeddedResource | 65 | EmbeddedResource |
66 | } | 66 | } |
67 | 67 | ||
68 | /// <summary> | 68 | /// <summary> |
69 | /// | 69 | /// |
70 | /// </summary> | 70 | /// </summary> |
71 | public enum SubType | 71 | public enum SubType |
72 | { | 72 | { |
73 | /// <summary> | 73 | /// <summary> |
74 | /// | 74 | /// |
75 | /// </summary> | 75 | /// </summary> |
76 | Code, | 76 | Code, |
77 | /// <summary> | 77 | /// <summary> |
78 | /// | 78 | /// |
79 | /// </summary> | 79 | /// </summary> |
80 | Component, | 80 | Component, |
81 | /// <summary> | 81 | /// <summary> |
82 | /// | 82 | /// |
83 | /// </summary> | 83 | /// </summary> |
84 | Designer, | 84 | Designer, |
85 | /// <summary> | 85 | /// <summary> |
86 | /// | 86 | /// |
87 | /// </summary> | 87 | /// </summary> |
88 | Form, | 88 | Form, |
89 | /// <summary> | 89 | /// <summary> |
90 | /// | 90 | /// |
91 | /// </summary> | 91 | /// </summary> |
92 | Settings, | 92 | Settings, |
93 | /// <summary> | 93 | /// <summary> |
94 | /// | 94 | /// |
95 | /// </summary> | 95 | /// </summary> |
96 | UserControl | 96 | UserControl |
97 | } | 97 | } |
98 | 98 | ||
99 | public enum CopyToOutput | 99 | public enum CopyToOutput |
100 | { | 100 | { |
101 | Never, | 101 | Never, |
102 | Always, | 102 | Always, |
103 | PreserveNewest | 103 | PreserveNewest |
104 | } | 104 | } |
105 | 105 | ||
106 | /// <summary> | 106 | /// <summary> |
107 | /// | 107 | /// |
108 | /// </summary> | 108 | /// </summary> |
109 | [DataNode("File")] | 109 | [DataNode("File")] |
110 | public class FileNode : DataNode | 110 | public class FileNode : DataNode |
111 | { | 111 | { |
112 | #region Fields | 112 | #region Fields |
113 | 113 | ||
114 | private string m_Path; | 114 | private string m_Path; |
115 | private string m_ResourceName = ""; | 115 | private string m_ResourceName = ""; |
116 | private BuildAction m_BuildAction = BuildAction.Compile; | 116 | private BuildAction m_BuildAction = BuildAction.Compile; |
117 | private bool m_Valid; | 117 | private bool m_Valid; |
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 | 121 | ||
122 | 122 | ||
123 | #endregion | 123 | #endregion |
124 | 124 | ||
125 | #region Properties | 125 | #region Properties |
126 | 126 | ||
127 | /// <summary> | 127 | /// <summary> |
128 | /// | 128 | /// |
129 | /// </summary> | 129 | /// </summary> |
130 | public string Path | 130 | public string Path |
131 | { | 131 | { |
132 | get | 132 | get |
133 | { | 133 | { |
134 | return m_Path; | 134 | return m_Path; |
135 | } | 135 | } |
136 | } | 136 | } |
137 | 137 | ||
138 | /// <summary> | 138 | /// <summary> |
139 | /// | 139 | /// |
140 | /// </summary> | 140 | /// </summary> |
141 | public string ResourceName | 141 | public string ResourceName |
142 | { | 142 | { |
143 | get | 143 | get |
144 | { | 144 | { |
145 | return m_ResourceName; | 145 | return m_ResourceName; |
146 | } | 146 | } |
147 | } | 147 | } |
148 | 148 | ||
149 | /// <summary> | 149 | /// <summary> |
150 | /// | 150 | /// |
151 | /// </summary> | 151 | /// </summary> |
152 | public BuildAction BuildAction | 152 | public BuildAction BuildAction |
153 | { | 153 | { |
154 | get | 154 | get |
155 | { | 155 | { |
156 | return m_BuildAction; | 156 | return m_BuildAction; |
157 | } | 157 | } |
158 | } | 158 | } |
159 | 159 | ||
160 | public CopyToOutput CopyToOutput | 160 | public CopyToOutput CopyToOutput |
161 | { | 161 | { |
162 | get | 162 | get |
163 | { | 163 | { |
164 | return this.m_CopyToOutput; | 164 | return this.m_CopyToOutput; |
165 | } | 165 | } |
166 | } | 166 | } |
167 | 167 | ||
168 | public bool IsLink | 168 | public bool IsLink |
169 | { | 169 | { |
170 | get | 170 | get |
171 | { | 171 | { |
172 | return this.m_Link; | 172 | return this.m_Link; |
173 | } | 173 | } |
174 | } | 174 | } |
175 | 175 | ||
176 | /// <summary> | 176 | /// <summary> |
177 | /// | 177 | /// |
178 | /// </summary> | 178 | /// </summary> |
179 | public SubType SubType | 179 | public SubType SubType |
180 | { | 180 | { |
181 | get | 181 | get |
182 | { | 182 | { |
183 | return m_SubType; | 183 | return m_SubType; |
184 | } | 184 | } |
185 | } | 185 | } |
186 | 186 | ||
187 | /// <summary> | 187 | /// <summary> |
188 | /// | 188 | /// |
189 | /// </summary> | 189 | /// </summary> |
190 | public bool IsValid | 190 | public bool IsValid |
191 | { | 191 | { |
192 | get | 192 | get |
193 | { | 193 | { |
194 | return m_Valid; | 194 | return m_Valid; |
195 | } | 195 | } |
196 | } | 196 | } |
197 | 197 | ||
198 | #endregion | 198 | #endregion |
199 | 199 | ||
200 | #region Public Methods | 200 | #region Public Methods |
201 | 201 | ||
202 | /// <summary> | 202 | /// <summary> |
203 | /// | 203 | /// |
204 | /// </summary> | 204 | /// </summary> |
205 | /// <param name="node"></param> | 205 | /// <param name="node"></param> |
206 | public override void Parse(XmlNode node) | 206 | public override void Parse(XmlNode node) |
207 | { | 207 | { |
208 | m_BuildAction = (BuildAction)Enum.Parse(typeof(BuildAction), | 208 | m_BuildAction = (BuildAction)Enum.Parse(typeof(BuildAction), |
209 | Helper.AttributeValue(node, "buildAction", m_BuildAction.ToString())); | 209 | Helper.AttributeValue(node, "buildAction", m_BuildAction.ToString())); |
210 | m_SubType = (SubType)Enum.Parse(typeof(SubType), | 210 | m_SubType = (SubType)Enum.Parse(typeof(SubType), |
211 | Helper.AttributeValue(node, "subType", m_SubType.ToString())); | 211 | Helper.AttributeValue(node, "subType", m_SubType.ToString())); |
212 | m_ResourceName = Helper.AttributeValue(node, "resourceName", m_ResourceName.ToString()); | 212 | m_ResourceName = Helper.AttributeValue(node, "resourceName", m_ResourceName.ToString()); |
213 | this.m_Link = bool.Parse(Helper.AttributeValue(node, "link", bool.FalseString)); | 213 | this.m_Link = bool.Parse(Helper.AttributeValue(node, "link", bool.FalseString)); |
214 | this.m_CopyToOutput = (CopyToOutput) Enum.Parse(typeof(CopyToOutput), Helper.AttributeValue(node, "copyToOutput", this.m_CopyToOutput.ToString())); | 214 | this.m_CopyToOutput = (CopyToOutput) Enum.Parse(typeof(CopyToOutput), Helper.AttributeValue(node, "copyToOutput", this.m_CopyToOutput.ToString())); |
215 | 215 | ||
216 | if( node == null ) | 216 | if( node == null ) |
217 | { | 217 | { |
218 | throw new ArgumentNullException("node"); | 218 | throw new ArgumentNullException("node"); |
219 | } | 219 | } |
220 | 220 | ||
221 | m_Path = Helper.InterpolateForEnvironmentVariables(node.InnerText); | 221 | m_Path = Helper.InterpolateForEnvironmentVariables(node.InnerText); |
222 | if(m_Path == null) | 222 | if(m_Path == null) |
223 | { | 223 | { |
224 | m_Path = ""; | 224 | m_Path = ""; |
225 | } | 225 | } |
226 | 226 | ||
227 | m_Path = m_Path.Trim(); | 227 | m_Path = m_Path.Trim(); |
228 | m_Valid = true; | 228 | m_Valid = true; |
229 | if(!File.Exists(m_Path)) | 229 | if(!File.Exists(m_Path)) |
230 | { | 230 | { |
231 | m_Valid = false; | 231 | m_Valid = false; |
232 | Kernel.Instance.Log.Write(LogType.Warning, "File does not exist: {0}", m_Path); | 232 | Kernel.Instance.Log.Write(LogType.Warning, "File does not exist: {0}", m_Path); |
233 | } | 233 | } |
234 | } | 234 | } |
235 | 235 | ||
236 | #endregion | 236 | #endregion |
237 | } | 237 | } |
238 | } | 238 | } |
diff --git a/Prebuild/src/Core/Nodes/FilesNode.cs b/Prebuild/src/Core/Nodes/FilesNode.cs index d31307b..05b2255 100644 --- a/Prebuild/src/Core/Nodes/FilesNode.cs +++ b/Prebuild/src/Core/Nodes/FilesNode.cs | |||
@@ -1,223 +1,223 @@ | |||
1 | #region BSD License | 1 | #region BSD License |
2 | /* | 2 | /* |
3 | Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) | 3 | Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) |
4 | 4 | ||
5 | Redistribution and use in source and binary forms, with or without modification, are permitted | 5 | Redistribution and use in source and binary forms, with or without modification, are permitted |
6 | provided that the following conditions are met: | 6 | provided that the following conditions are met: |
7 | 7 | ||
8 | * Redistributions of source code must retain the above copyright notice, this list of conditions | 8 | * Redistributions of source code must retain the above copyright notice, this list of conditions |
9 | and the following disclaimer. | 9 | and the following disclaimer. |
10 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions | 10 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions |
11 | and the following disclaimer in the documentation and/or other materials provided with the | 11 | and the following disclaimer in the documentation and/or other materials provided with the |
12 | distribution. | 12 | distribution. |
13 | * The name of the author may not be used to endorse or promote products derived from this software | 13 | * The name of the author may not be used to endorse or promote products derived from this software |
14 | without specific prior written permission. | 14 | without specific prior written permission. |
15 | 15 | ||
16 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, | 16 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, |
17 | BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | 17 | BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
18 | ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | 18 | ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
19 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | 19 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
20 | OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY | 20 | OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
21 | OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | 21 | OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING |
22 | IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 22 | IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
23 | */ | 23 | */ |
24 | #endregion | 24 | #endregion |
25 | 25 | ||
26 | #region CVS Information | 26 | #region CVS Information |
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 09:42:51 +0200 (on, 20 sep 2006) $ |
31 | * $Revision: 164 $ | 31 | * $Revision: 164 $ |
32 | */ | 32 | */ |
33 | #endregion | 33 | #endregion |
34 | 34 | ||
35 | using System; | 35 | using System; |
36 | using System.Collections; | 36 | using System.Collections; |
37 | using System.Collections.Specialized; | 37 | using System.Collections.Specialized; |
38 | using System.Xml; | 38 | using System.Xml; |
39 | 39 | ||
40 | using Prebuild.Core.Attributes; | 40 | using Prebuild.Core.Attributes; |
41 | using Prebuild.Core.Interfaces; | 41 | using Prebuild.Core.Interfaces; |
42 | 42 | ||
43 | namespace Prebuild.Core.Nodes | 43 | namespace Prebuild.Core.Nodes |
44 | { | 44 | { |
45 | /// <summary> | 45 | /// <summary> |
46 | /// | 46 | /// |
47 | /// </summary> | 47 | /// </summary> |
48 | [DataNode("Files")] | 48 | [DataNode("Files")] |
49 | public class FilesNode : DataNode | 49 | public class FilesNode : DataNode |
50 | { | 50 | { |
51 | #region Fields | 51 | #region Fields |
52 | 52 | ||
53 | private StringCollection m_Files; | 53 | private StringCollection m_Files; |
54 | private Hashtable m_BuildActions; | 54 | private Hashtable m_BuildActions; |
55 | private Hashtable m_SubTypes; | 55 | private Hashtable m_SubTypes; |
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 | ||
60 | 60 | ||
61 | #endregion | 61 | #endregion |
62 | 62 | ||
63 | #region Constructors | 63 | #region Constructors |
64 | 64 | ||
65 | /// <summary> | 65 | /// <summary> |
66 | /// | 66 | /// |
67 | /// </summary> | 67 | /// </summary> |
68 | public FilesNode() | 68 | public FilesNode() |
69 | { | 69 | { |
70 | m_Files = new StringCollection(); | 70 | m_Files = new StringCollection(); |
71 | m_BuildActions = new Hashtable(); | 71 | m_BuildActions = new Hashtable(); |
72 | m_SubTypes = new Hashtable(); | 72 | m_SubTypes = new Hashtable(); |
73 | m_ResourceNames = new Hashtable(); | 73 | m_ResourceNames = new Hashtable(); |
74 | m_CopyToOutputs = new Hashtable(); | 74 | m_CopyToOutputs = new Hashtable(); |
75 | m_Links = new Hashtable(); | 75 | m_Links = new Hashtable(); |
76 | } | 76 | } |
77 | 77 | ||
78 | #endregion | 78 | #endregion |
79 | 79 | ||
80 | #region Properties | 80 | #region Properties |
81 | 81 | ||
82 | /// <summary> | 82 | /// <summary> |
83 | /// | 83 | /// |
84 | /// </summary> | 84 | /// </summary> |
85 | public int Count | 85 | public int Count |
86 | { | 86 | { |
87 | get | 87 | get |
88 | { | 88 | { |
89 | return m_Files.Count; | 89 | return m_Files.Count; |
90 | } | 90 | } |
91 | } | 91 | } |
92 | 92 | ||
93 | #endregion | 93 | #endregion |
94 | 94 | ||
95 | #region Public Methods | 95 | #region Public Methods |
96 | 96 | ||
97 | /// <summary> | 97 | /// <summary> |
98 | /// | 98 | /// |
99 | /// </summary> | 99 | /// </summary> |
100 | /// <param name="file"></param> | 100 | /// <param name="file"></param> |
101 | /// <returns></returns> | 101 | /// <returns></returns> |
102 | public BuildAction GetBuildAction(string file) | 102 | public BuildAction GetBuildAction(string file) |
103 | { | 103 | { |
104 | if(!m_BuildActions.ContainsKey(file)) | 104 | if(!m_BuildActions.ContainsKey(file)) |
105 | { | 105 | { |
106 | return BuildAction.Compile; | 106 | return BuildAction.Compile; |
107 | } | 107 | } |
108 | 108 | ||
109 | return (BuildAction)m_BuildActions[file]; | 109 | return (BuildAction)m_BuildActions[file]; |
110 | } | 110 | } |
111 | 111 | ||
112 | public CopyToOutput GetCopyToOutput(string file) | 112 | public CopyToOutput GetCopyToOutput(string file) |
113 | { | 113 | { |
114 | if (!this.m_CopyToOutputs.ContainsKey(file)) | 114 | if (!this.m_CopyToOutputs.ContainsKey(file)) |
115 | { | 115 | { |
116 | return CopyToOutput.Never; | 116 | return CopyToOutput.Never; |
117 | } | 117 | } |
118 | return (CopyToOutput) this.m_CopyToOutputs[file]; | 118 | return (CopyToOutput) this.m_CopyToOutputs[file]; |
119 | } | 119 | } |
120 | 120 | ||
121 | public bool GetIsLink(string file) | 121 | public bool GetIsLink(string file) |
122 | { | 122 | { |
123 | if (!this.m_Links.ContainsKey(file)) | 123 | if (!this.m_Links.ContainsKey(file)) |
124 | { | 124 | { |
125 | return false; | 125 | return false; |
126 | } | 126 | } |
127 | return (bool) this.m_Links[file]; | 127 | return (bool) this.m_Links[file]; |
128 | } | 128 | } |
129 | 129 | ||
130 | /// <summary> | 130 | /// <summary> |
131 | /// | 131 | /// |
132 | /// </summary> | 132 | /// </summary> |
133 | /// <param name="file"></param> | 133 | /// <param name="file"></param> |
134 | /// <returns></returns> | 134 | /// <returns></returns> |
135 | public SubType GetSubType(string file) | 135 | public SubType GetSubType(string file) |
136 | { | 136 | { |
137 | if(!m_SubTypes.ContainsKey(file)) | 137 | if(!m_SubTypes.ContainsKey(file)) |
138 | { | 138 | { |
139 | return SubType.Code; | 139 | return SubType.Code; |
140 | } | 140 | } |
141 | 141 | ||
142 | return (SubType)m_SubTypes[file]; | 142 | return (SubType)m_SubTypes[file]; |
143 | } | 143 | } |
144 | 144 | ||
145 | /// <summary> | 145 | /// <summary> |
146 | /// | 146 | /// |
147 | /// </summary> | 147 | /// </summary> |
148 | /// <param name="file"></param> | 148 | /// <param name="file"></param> |
149 | /// <returns></returns> | 149 | /// <returns></returns> |
150 | public string GetResourceName(string file) | 150 | public string GetResourceName(string file) |
151 | { | 151 | { |
152 | if(!m_ResourceNames.ContainsKey(file)) | 152 | if(!m_ResourceNames.ContainsKey(file)) |
153 | { | 153 | { |
154 | return ""; | 154 | return ""; |
155 | } | 155 | } |
156 | 156 | ||
157 | return (string)m_ResourceNames[file]; | 157 | return (string)m_ResourceNames[file]; |
158 | } | 158 | } |
159 | 159 | ||
160 | /// <summary> | 160 | /// <summary> |
161 | /// | 161 | /// |
162 | /// </summary> | 162 | /// </summary> |
163 | /// <param name="node"></param> | 163 | /// <param name="node"></param> |
164 | public override void Parse(XmlNode node) | 164 | public override void Parse(XmlNode node) |
165 | { | 165 | { |
166 | if( node == null ) | 166 | if( node == null ) |
167 | { | 167 | { |
168 | throw new ArgumentNullException("node"); | 168 | throw new ArgumentNullException("node"); |
169 | } | 169 | } |
170 | foreach(XmlNode child in node.ChildNodes) | 170 | foreach(XmlNode child in node.ChildNodes) |
171 | { | 171 | { |
172 | IDataNode dataNode = Kernel.Instance.ParseNode(child, this); | 172 | IDataNode dataNode = Kernel.Instance.ParseNode(child, this); |
173 | if(dataNode is FileNode) | 173 | if(dataNode is FileNode) |
174 | { | 174 | { |
175 | FileNode fileNode = (FileNode)dataNode; | 175 | FileNode fileNode = (FileNode)dataNode; |
176 | if(fileNode.IsValid) | 176 | if(fileNode.IsValid) |
177 | { | 177 | { |
178 | if (!m_Files.Contains(fileNode.Path)) | 178 | if (!m_Files.Contains(fileNode.Path)) |
179 | { | 179 | { |
180 | m_Files.Add(fileNode.Path); | 180 | m_Files.Add(fileNode.Path); |
181 | m_BuildActions[fileNode.Path] = fileNode.BuildAction; | 181 | m_BuildActions[fileNode.Path] = fileNode.BuildAction; |
182 | m_SubTypes[fileNode.Path] = fileNode.SubType; | 182 | m_SubTypes[fileNode.Path] = fileNode.SubType; |
183 | m_ResourceNames[fileNode.Path] = fileNode.ResourceName; | 183 | m_ResourceNames[fileNode.Path] = fileNode.ResourceName; |
184 | this.m_Links[fileNode.Path] = fileNode.IsLink; | 184 | this.m_Links[fileNode.Path] = fileNode.IsLink; |
185 | this.m_CopyToOutputs[fileNode.Path] = fileNode.CopyToOutput; | 185 | this.m_CopyToOutputs[fileNode.Path] = fileNode.CopyToOutput; |
186 | 186 | ||
187 | } | 187 | } |
188 | } | 188 | } |
189 | } | 189 | } |
190 | else if(dataNode is MatchNode) | 190 | else if(dataNode is MatchNode) |
191 | { | 191 | { |
192 | foreach(string file in ((MatchNode)dataNode).Files) | 192 | foreach(string file in ((MatchNode)dataNode).Files) |
193 | { | 193 | { |
194 | if (!m_Files.Contains(file)) | 194 | if (!m_Files.Contains(file)) |
195 | { | 195 | { |
196 | m_Files.Add(file); | 196 | m_Files.Add(file); |
197 | m_BuildActions[file] = ((MatchNode)dataNode).BuildAction; | 197 | m_BuildActions[file] = ((MatchNode)dataNode).BuildAction; |
198 | m_SubTypes[file] = ((MatchNode)dataNode).SubType; | 198 | m_SubTypes[file] = ((MatchNode)dataNode).SubType; |
199 | m_ResourceNames[file] = ((MatchNode)dataNode).ResourceName; | 199 | m_ResourceNames[file] = ((MatchNode)dataNode).ResourceName; |
200 | this.m_Links[file] = ((MatchNode) dataNode).IsLink; | 200 | this.m_Links[file] = ((MatchNode) dataNode).IsLink; |
201 | this.m_CopyToOutputs[file] = ((MatchNode) dataNode).CopyToOutput; | 201 | this.m_CopyToOutputs[file] = ((MatchNode) dataNode).CopyToOutput; |
202 | 202 | ||
203 | } | 203 | } |
204 | } | 204 | } |
205 | } | 205 | } |
206 | } | 206 | } |
207 | } | 207 | } |
208 | 208 | ||
209 | // TODO: Check in to why StringCollection's enumerator doesn't implement | 209 | // TODO: Check in to why StringCollection's enumerator doesn't implement |
210 | // IEnumerator? | 210 | // IEnumerator? |
211 | /// <summary> | 211 | /// <summary> |
212 | /// | 212 | /// |
213 | /// </summary> | 213 | /// </summary> |
214 | /// <returns></returns> | 214 | /// <returns></returns> |
215 | public StringEnumerator GetEnumerator() | 215 | public StringEnumerator GetEnumerator() |
216 | { | 216 | { |
217 | return m_Files.GetEnumerator(); | 217 | return m_Files.GetEnumerator(); |
218 | } | 218 | } |
219 | 219 | ||
220 | #endregion | 220 | #endregion |
221 | 221 | ||
222 | } | 222 | } |
223 | } | 223 | } |
diff --git a/Prebuild/src/Core/Nodes/MatchNode.cs b/Prebuild/src/Core/Nodes/MatchNode.cs index e0d2fa8..8d7b467 100644 --- a/Prebuild/src/Core/Nodes/MatchNode.cs +++ b/Prebuild/src/Core/Nodes/MatchNode.cs | |||
@@ -1,299 +1,299 @@ | |||
1 | #region BSD License | 1 | #region BSD License |
2 | /* | 2 | /* |
3 | Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) | 3 | Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) |
4 | 4 | ||
5 | Redistribution and use in source and binary forms, with or without modification, are permitted | 5 | Redistribution and use in source and binary forms, with or without modification, are permitted |
6 | provided that the following conditions are met: | 6 | provided that the following conditions are met: |
7 | 7 | ||
8 | * Redistributions of source code must retain the above copyright notice, this list of conditions | 8 | * Redistributions of source code must retain the above copyright notice, this list of conditions |
9 | and the following disclaimer. | 9 | and the following disclaimer. |
10 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions | 10 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions |
11 | and the following disclaimer in the documentation and/or other materials provided with the | 11 | and the following disclaimer in the documentation and/or other materials provided with the |
12 | distribution. | 12 | distribution. |
13 | * The name of the author may not be used to endorse or promote products derived from this software | 13 | * The name of the author may not be used to endorse or promote products derived from this software |
14 | without specific prior written permission. | 14 | without specific prior written permission. |
15 | 15 | ||
16 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, | 16 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, |
17 | BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | 17 | BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
18 | ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | 18 | ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
19 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | 19 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
20 | OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY | 20 | OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
21 | OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | 21 | OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING |
22 | IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 22 | IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
23 | */ | 23 | */ |
24 | #endregion | 24 | #endregion |
25 | 25 | ||
26 | #region CVS Information | 26 | #region CVS Information |
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 09:42:51 +0200 (on, 20 sep 2006) $ |
31 | * $Revision: 164 $ | 31 | * $Revision: 164 $ |
32 | */ | 32 | */ |
33 | #endregion | 33 | #endregion |
34 | 34 | ||
35 | using System; | 35 | using System; |
36 | using System.Collections.Specialized; | 36 | using System.Collections.Specialized; |
37 | using System.IO; | 37 | using System.IO; |
38 | using System.Text.RegularExpressions; | 38 | using System.Text.RegularExpressions; |
39 | using System.Xml; | 39 | using System.Xml; |
40 | 40 | ||
41 | using Prebuild.Core.Attributes; | 41 | using Prebuild.Core.Attributes; |
42 | using Prebuild.Core.Interfaces; | 42 | using Prebuild.Core.Interfaces; |
43 | using Prebuild.Core.Utilities; | 43 | using Prebuild.Core.Utilities; |
44 | 44 | ||
45 | namespace Prebuild.Core.Nodes | 45 | namespace Prebuild.Core.Nodes |
46 | { | 46 | { |
47 | /// <summary> | 47 | /// <summary> |
48 | /// | 48 | /// |
49 | /// </summary> | 49 | /// </summary> |
50 | [DataNode("Match")] | 50 | [DataNode("Match")] |
51 | public class MatchNode : DataNode | 51 | public class MatchNode : DataNode |
52 | { | 52 | { |
53 | #region Fields | 53 | #region Fields |
54 | 54 | ||
55 | private StringCollection m_Files; | 55 | private StringCollection m_Files; |
56 | private Regex m_Regex; | 56 | private Regex m_Regex; |
57 | private BuildAction m_BuildAction = BuildAction.Compile; | 57 | private BuildAction m_BuildAction = BuildAction.Compile; |
58 | private SubType m_SubType = SubType.Code; | 58 | private SubType m_SubType = SubType.Code; |
59 | string m_ResourceName = ""; | 59 | string m_ResourceName = ""; |
60 | private CopyToOutput m_CopyToOutput; | 60 | private CopyToOutput m_CopyToOutput; |
61 | private bool m_Link; | 61 | private bool m_Link; |
62 | 62 | ||
63 | 63 | ||
64 | #endregion | 64 | #endregion |
65 | 65 | ||
66 | #region Constructors | 66 | #region Constructors |
67 | 67 | ||
68 | /// <summary> | 68 | /// <summary> |
69 | /// | 69 | /// |
70 | /// </summary> | 70 | /// </summary> |
71 | public MatchNode() | 71 | public MatchNode() |
72 | { | 72 | { |
73 | m_Files = new StringCollection(); | 73 | m_Files = new StringCollection(); |
74 | } | 74 | } |
75 | 75 | ||
76 | #endregion | 76 | #endregion |
77 | 77 | ||
78 | #region Properties | 78 | #region Properties |
79 | 79 | ||
80 | /// <summary> | 80 | /// <summary> |
81 | /// | 81 | /// |
82 | /// </summary> | 82 | /// </summary> |
83 | public StringCollection Files | 83 | public StringCollection Files |
84 | { | 84 | { |
85 | get | 85 | get |
86 | { | 86 | { |
87 | return m_Files; | 87 | return m_Files; |
88 | } | 88 | } |
89 | } | 89 | } |
90 | 90 | ||
91 | /// <summary> | 91 | /// <summary> |
92 | /// | 92 | /// |
93 | /// </summary> | 93 | /// </summary> |
94 | public BuildAction BuildAction | 94 | public BuildAction BuildAction |
95 | { | 95 | { |
96 | get | 96 | get |
97 | { | 97 | { |
98 | return m_BuildAction; | 98 | return m_BuildAction; |
99 | } | 99 | } |
100 | } | 100 | } |
101 | 101 | ||
102 | /// <summary> | 102 | /// <summary> |
103 | /// | 103 | /// |
104 | /// </summary> | 104 | /// </summary> |
105 | public SubType SubType | 105 | public SubType SubType |
106 | { | 106 | { |
107 | get | 107 | get |
108 | { | 108 | { |
109 | return m_SubType; | 109 | return m_SubType; |
110 | } | 110 | } |
111 | } | 111 | } |
112 | 112 | ||
113 | public CopyToOutput CopyToOutput | 113 | public CopyToOutput CopyToOutput |
114 | { | 114 | { |
115 | get | 115 | get |
116 | { | 116 | { |
117 | return this.m_CopyToOutput; | 117 | return this.m_CopyToOutput; |
118 | } | 118 | } |
119 | } | 119 | } |
120 | 120 | ||
121 | public bool IsLink | 121 | public bool IsLink |
122 | { | 122 | { |
123 | get | 123 | get |
124 | { | 124 | { |
125 | return this.m_Link; | 125 | return this.m_Link; |
126 | } | 126 | } |
127 | } | 127 | } |
128 | 128 | ||
129 | /// <summary> | 129 | /// <summary> |
130 | /// | 130 | /// |
131 | /// </summary> | 131 | /// </summary> |
132 | public string ResourceName | 132 | public string ResourceName |
133 | { | 133 | { |
134 | get | 134 | get |
135 | { | 135 | { |
136 | return m_ResourceName; | 136 | return m_ResourceName; |
137 | } | 137 | } |
138 | } | 138 | } |
139 | 139 | ||
140 | 140 | ||
141 | #endregion | 141 | #endregion |
142 | 142 | ||
143 | #region Private Methods | 143 | #region Private Methods |
144 | 144 | ||
145 | /// <summary> | 145 | /// <summary> |
146 | /// Recurses the directories. | 146 | /// Recurses the directories. |
147 | /// </summary> | 147 | /// </summary> |
148 | /// <param name="path">The path.</param> | 148 | /// <param name="path">The path.</param> |
149 | /// <param name="pattern">The pattern.</param> | 149 | /// <param name="pattern">The pattern.</param> |
150 | /// <param name="recurse">if set to <c>true</c> [recurse].</param> | 150 | /// <param name="recurse">if set to <c>true</c> [recurse].</param> |
151 | /// <param name="useRegex">if set to <c>true</c> [use regex].</param> | 151 | /// <param name="useRegex">if set to <c>true</c> [use regex].</param> |
152 | private void RecurseDirectories(string path, string pattern, bool recurse, bool useRegex) | 152 | private void RecurseDirectories(string path, string pattern, bool recurse, bool useRegex) |
153 | { | 153 | { |
154 | try | 154 | try |
155 | { | 155 | { |
156 | string[] files; | 156 | string[] files; |
157 | 157 | ||
158 | if(!useRegex) | 158 | if(!useRegex) |
159 | { | 159 | { |
160 | files = Directory.GetFiles(path, pattern); | 160 | files = Directory.GetFiles(path, pattern); |
161 | if(files != null) | 161 | if(files != null) |
162 | { | 162 | { |
163 | string fileTemp; | 163 | string fileTemp; |
164 | foreach (string file in files) | 164 | foreach (string file in files) |
165 | { | 165 | { |
166 | if (file.Substring(0,2) == "./" || file.Substring(0,2) == ".\\") | 166 | if (file.Substring(0,2) == "./" || file.Substring(0,2) == ".\\") |
167 | { | 167 | { |
168 | fileTemp = file.Substring(2); | 168 | fileTemp = file.Substring(2); |
169 | } | 169 | } |
170 | else | 170 | else |
171 | { | 171 | { |
172 | fileTemp = file; | 172 | fileTemp = file; |
173 | } | 173 | } |
174 | 174 | ||
175 | m_Files.Add(fileTemp); | 175 | m_Files.Add(fileTemp); |
176 | } | 176 | } |
177 | } | 177 | } |
178 | else | 178 | else |
179 | { | 179 | { |
180 | return; | 180 | return; |
181 | } | 181 | } |
182 | } | 182 | } |
183 | else | 183 | else |
184 | { | 184 | { |
185 | Match match; | 185 | Match match; |
186 | files = Directory.GetFiles(path); | 186 | files = Directory.GetFiles(path); |
187 | foreach(string file in files) | 187 | foreach(string file in files) |
188 | { | 188 | { |
189 | match = m_Regex.Match(file); | 189 | match = m_Regex.Match(file); |
190 | if(match.Success) | 190 | if(match.Success) |
191 | { | 191 | { |
192 | m_Files.Add(file); | 192 | m_Files.Add(file); |
193 | } | 193 | } |
194 | } | 194 | } |
195 | } | 195 | } |
196 | 196 | ||
197 | if(recurse) | 197 | if(recurse) |
198 | { | 198 | { |
199 | string[] dirs = Directory.GetDirectories(path); | 199 | string[] dirs = Directory.GetDirectories(path); |
200 | if(dirs != null && dirs.Length > 0) | 200 | if(dirs != null && dirs.Length > 0) |
201 | { | 201 | { |
202 | foreach(string str in dirs) | 202 | foreach(string str in dirs) |
203 | { | 203 | { |
204 | RecurseDirectories(Helper.NormalizePath(str), pattern, recurse, useRegex); | 204 | RecurseDirectories(Helper.NormalizePath(str), pattern, recurse, useRegex); |
205 | } | 205 | } |
206 | } | 206 | } |
207 | } | 207 | } |
208 | } | 208 | } |
209 | catch(DirectoryNotFoundException) | 209 | catch(DirectoryNotFoundException) |
210 | { | 210 | { |
211 | return; | 211 | return; |
212 | } | 212 | } |
213 | catch(ArgumentException) | 213 | catch(ArgumentException) |
214 | { | 214 | { |
215 | return; | 215 | return; |
216 | } | 216 | } |
217 | } | 217 | } |
218 | 218 | ||
219 | #endregion | 219 | #endregion |
220 | 220 | ||
221 | #region Public Methods | 221 | #region Public Methods |
222 | 222 | ||
223 | /// <summary> | 223 | /// <summary> |
224 | /// | 224 | /// |
225 | /// </summary> | 225 | /// </summary> |
226 | /// <param name="node"></param> | 226 | /// <param name="node"></param> |
227 | public override void Parse(XmlNode node) | 227 | public override void Parse(XmlNode node) |
228 | { | 228 | { |
229 | if( node == null ) | 229 | if( node == null ) |
230 | { | 230 | { |
231 | throw new ArgumentNullException("node"); | 231 | throw new ArgumentNullException("node"); |
232 | } | 232 | } |
233 | string path = Helper.AttributeValue(node, "path", "."); | 233 | string path = Helper.AttributeValue(node, "path", "."); |
234 | string pattern = Helper.AttributeValue(node, "pattern", "*"); | 234 | string pattern = Helper.AttributeValue(node, "pattern", "*"); |
235 | bool recurse = (bool)Helper.TranslateValue(typeof(bool), Helper.AttributeValue(node, "recurse", "false")); | 235 | bool recurse = (bool)Helper.TranslateValue(typeof(bool), Helper.AttributeValue(node, "recurse", "false")); |
236 | bool useRegex = (bool)Helper.TranslateValue(typeof(bool), Helper.AttributeValue(node, "useRegex", "false")); | 236 | bool useRegex = (bool)Helper.TranslateValue(typeof(bool), Helper.AttributeValue(node, "useRegex", "false")); |
237 | m_BuildAction = (BuildAction)Enum.Parse(typeof(BuildAction), | 237 | m_BuildAction = (BuildAction)Enum.Parse(typeof(BuildAction), |
238 | Helper.AttributeValue(node, "buildAction", m_BuildAction.ToString())); | 238 | Helper.AttributeValue(node, "buildAction", m_BuildAction.ToString())); |
239 | m_SubType = (SubType)Enum.Parse(typeof(SubType), | 239 | m_SubType = (SubType)Enum.Parse(typeof(SubType), |
240 | Helper.AttributeValue(node, "subType", m_SubType.ToString())); | 240 | Helper.AttributeValue(node, "subType", m_SubType.ToString())); |
241 | m_ResourceName = Helper.AttributeValue(node, "resourceName", m_ResourceName.ToString()); | 241 | 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())); | 242 | 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)); | 243 | this.m_Link = bool.Parse(Helper.AttributeValue(node, "link", bool.FalseString)); |
244 | 244 | ||
245 | 245 | ||
246 | if(path != null && path.Length == 0) | 246 | if(path != null && path.Length == 0) |
247 | { | 247 | { |
248 | path = ".";//use current directory | 248 | path = ".";//use current directory |
249 | } | 249 | } |
250 | //throw new WarningException("Match must have a 'path' attribute"); | 250 | //throw new WarningException("Match must have a 'path' attribute"); |
251 | 251 | ||
252 | if(pattern == null) | 252 | if(pattern == null) |
253 | { | 253 | { |
254 | throw new WarningException("Match must have a 'pattern' attribute"); | 254 | throw new WarningException("Match must have a 'pattern' attribute"); |
255 | } | 255 | } |
256 | 256 | ||
257 | path = Helper.NormalizePath(path); | 257 | path = Helper.NormalizePath(path); |
258 | if(!Directory.Exists(path)) | 258 | if(!Directory.Exists(path)) |
259 | { | 259 | { |
260 | throw new WarningException("Match path does not exist: {0}", path); | 260 | throw new WarningException("Match path does not exist: {0}", path); |
261 | } | 261 | } |
262 | 262 | ||
263 | try | 263 | try |
264 | { | 264 | { |
265 | if(useRegex) | 265 | if(useRegex) |
266 | { | 266 | { |
267 | m_Regex = new Regex(pattern); | 267 | m_Regex = new Regex(pattern); |
268 | } | 268 | } |
269 | } | 269 | } |
270 | catch(ArgumentException ex) | 270 | catch(ArgumentException ex) |
271 | { | 271 | { |
272 | throw new WarningException("Could not compile regex pattern: {0}", ex.Message); | 272 | throw new WarningException("Could not compile regex pattern: {0}", ex.Message); |
273 | } | 273 | } |
274 | 274 | ||
275 | RecurseDirectories(path, pattern, recurse, useRegex); | 275 | RecurseDirectories(path, pattern, recurse, useRegex); |
276 | 276 | ||
277 | foreach(XmlNode child in node.ChildNodes) | 277 | foreach(XmlNode child in node.ChildNodes) |
278 | { | 278 | { |
279 | IDataNode dataNode = Kernel.Instance.ParseNode(child, this); | 279 | IDataNode dataNode = Kernel.Instance.ParseNode(child, this); |
280 | if(dataNode is ExcludeNode) | 280 | if(dataNode is ExcludeNode) |
281 | { | 281 | { |
282 | ExcludeNode excludeNode = (ExcludeNode)dataNode; | 282 | ExcludeNode excludeNode = (ExcludeNode)dataNode; |
283 | if (m_Files.Contains(Helper.NormalizePath(excludeNode.Name))) | 283 | if (m_Files.Contains(Helper.NormalizePath(excludeNode.Name))) |
284 | { | 284 | { |
285 | m_Files.Remove(Helper.NormalizePath(excludeNode.Name)); | 285 | m_Files.Remove(Helper.NormalizePath(excludeNode.Name)); |
286 | } | 286 | } |
287 | } | 287 | } |
288 | } | 288 | } |
289 | 289 | ||
290 | if(m_Files.Count < 1) | 290 | if(m_Files.Count < 1) |
291 | { | 291 | { |
292 | throw new WarningException("Match returned no files: {0}{1}", Helper.EndPath(path), pattern); | 292 | throw new WarningException("Match returned no files: {0}{1}", Helper.EndPath(path), pattern); |
293 | } | 293 | } |
294 | m_Regex = null; | 294 | m_Regex = null; |
295 | } | 295 | } |
296 | 296 | ||
297 | #endregion | 297 | #endregion |
298 | } | 298 | } |
299 | } | 299 | } |
diff --git a/Prebuild/src/Core/Nodes/OptionsNode.cs b/Prebuild/src/Core/Nodes/OptionsNode.cs index b5a2f60..b7a784d 100644 --- a/Prebuild/src/Core/Nodes/OptionsNode.cs +++ b/Prebuild/src/Core/Nodes/OptionsNode.cs | |||
@@ -1,655 +1,655 @@ | |||
1 | #region BSD License | 1 | #region BSD License |
2 | /* | 2 | /* |
3 | Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) | 3 | Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) |
4 | 4 | ||
5 | Redistribution and use in source and binary forms, with or without modification, are permitted | 5 | Redistribution and use in source and binary forms, with or without modification, are permitted |
6 | provided that the following conditions are met: | 6 | provided that the following conditions are met: |
7 | 7 | ||
8 | * Redistributions of source code must retain the above copyright notice, this list of conditions | 8 | * Redistributions of source code must retain the above copyright notice, this list of conditions |
9 | and the following disclaimer. | 9 | and the following disclaimer. |
10 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions | 10 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions |
11 | and the following disclaimer in the documentation and/or other materials provided with the | 11 | and the following disclaimer in the documentation and/or other materials provided with the |
12 | distribution. | 12 | distribution. |
13 | * The name of the author may not be used to endorse or promote products derived from this software | 13 | * The name of the author may not be used to endorse or promote products derived from this software |
14 | without specific prior written permission. | 14 | without specific prior written permission. |
15 | 15 | ||
16 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, | 16 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, |
17 | BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | 17 | BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
18 | ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | 18 | ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
19 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | 19 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
20 | OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY | 20 | OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
21 | OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | 21 | OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING |
22 | IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 22 | IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
23 | */ | 23 | */ |
24 | #endregion | 24 | #endregion |
25 | 25 | ||
26 | #region CVS Information | 26 | #region CVS Information |
27 | /* | 27 | /* |
28 | * $Source$ | 28 | * $Source$ |
29 | * $Author: jendave $ | 29 | * $Author: jendave $ |
30 | * $Date: 2007-01-08 17:55:40 +0100 (må, 08 jan 2007) $ | 30 | * $Date: 2007-01-08 17:55:40 +0100 (må, 08 jan 2007) $ |
31 | * $Revision: 197 $ | 31 | * $Revision: 197 $ |
32 | */ | 32 | */ |
33 | #endregion | 33 | #endregion |
34 | 34 | ||
35 | 35 | ||
36 | 36 | ||
37 | using System; | 37 | using System; |
38 | using System.Collections; | 38 | using System.Collections; |
39 | using System.Collections.Specialized; | 39 | using System.Collections.Specialized; |
40 | using System.Reflection; | 40 | using System.Reflection; |
41 | using System.Xml; | 41 | using System.Xml; |
42 | 42 | ||
43 | using Prebuild.Core.Attributes; | 43 | using Prebuild.Core.Attributes; |
44 | using Prebuild.Core.Interfaces; | 44 | using Prebuild.Core.Interfaces; |
45 | using Prebuild.Core.Utilities; | 45 | using Prebuild.Core.Utilities; |
46 | 46 | ||
47 | namespace Prebuild.Core.Nodes | 47 | namespace Prebuild.Core.Nodes |
48 | { | 48 | { |
49 | /// <summary> | 49 | /// <summary> |
50 | /// | 50 | /// |
51 | /// </summary> | 51 | /// </summary> |
52 | [DataNode("Options")] | 52 | [DataNode("Options")] |
53 | public class OptionsNode : DataNode | 53 | public class OptionsNode : DataNode |
54 | { | 54 | { |
55 | #region Fields | 55 | #region Fields |
56 | 56 | ||
57 | private static Hashtable m_OptionFields; | 57 | private static Hashtable m_OptionFields; |
58 | 58 | ||
59 | [OptionNode("CompilerDefines")] | 59 | [OptionNode("CompilerDefines")] |
60 | private string m_CompilerDefines = ""; | 60 | private string m_CompilerDefines = ""; |
61 | 61 | ||
62 | /// <summary> | 62 | /// <summary> |
63 | /// | 63 | /// |
64 | /// </summary> | 64 | /// </summary> |
65 | public string CompilerDefines | 65 | public string CompilerDefines |
66 | { | 66 | { |
67 | get | 67 | get |
68 | { | 68 | { |
69 | return m_CompilerDefines; | 69 | return m_CompilerDefines; |
70 | } | 70 | } |
71 | set | 71 | set |
72 | { | 72 | { |
73 | m_CompilerDefines = value; | 73 | m_CompilerDefines = value; |
74 | } | 74 | } |
75 | } | 75 | } |
76 | 76 | ||
77 | [OptionNode("OptimizeCode")] | 77 | [OptionNode("OptimizeCode")] |
78 | private bool m_OptimizeCode; | 78 | private bool m_OptimizeCode; |
79 | 79 | ||
80 | /// <summary> | 80 | /// <summary> |
81 | /// | 81 | /// |
82 | /// </summary> | 82 | /// </summary> |
83 | public bool OptimizeCode | 83 | public bool OptimizeCode |
84 | { | 84 | { |
85 | get | 85 | get |
86 | { | 86 | { |
87 | return m_OptimizeCode; | 87 | return m_OptimizeCode; |
88 | } | 88 | } |
89 | set | 89 | set |
90 | { | 90 | { |
91 | m_OptimizeCode = value; | 91 | m_OptimizeCode = value; |
92 | } | 92 | } |
93 | } | 93 | } |
94 | 94 | ||
95 | [OptionNode("CheckUnderflowOverflow")] | 95 | [OptionNode("CheckUnderflowOverflow")] |
96 | private bool m_CheckUnderflowOverflow; | 96 | private bool m_CheckUnderflowOverflow; |
97 | 97 | ||
98 | /// <summary> | 98 | /// <summary> |
99 | /// | 99 | /// |
100 | /// </summary> | 100 | /// </summary> |
101 | public bool CheckUnderflowOverflow | 101 | public bool CheckUnderflowOverflow |
102 | { | 102 | { |
103 | get | 103 | get |
104 | { | 104 | { |
105 | return m_CheckUnderflowOverflow; | 105 | return m_CheckUnderflowOverflow; |
106 | } | 106 | } |
107 | set | 107 | set |
108 | { | 108 | { |
109 | m_CheckUnderflowOverflow = value; | 109 | m_CheckUnderflowOverflow = value; |
110 | } | 110 | } |
111 | } | 111 | } |
112 | 112 | ||
113 | [OptionNode("AllowUnsafe")] | 113 | [OptionNode("AllowUnsafe")] |
114 | private bool m_AllowUnsafe; | 114 | private bool m_AllowUnsafe; |
115 | 115 | ||
116 | /// <summary> | 116 | /// <summary> |
117 | /// | 117 | /// |
118 | /// </summary> | 118 | /// </summary> |
119 | public bool AllowUnsafe | 119 | public bool AllowUnsafe |
120 | { | 120 | { |
121 | get | 121 | get |
122 | { | 122 | { |
123 | return m_AllowUnsafe; | 123 | return m_AllowUnsafe; |
124 | } | 124 | } |
125 | set | 125 | set |
126 | { | 126 | { |
127 | m_AllowUnsafe = value; | 127 | m_AllowUnsafe = value; |
128 | } | 128 | } |
129 | } | 129 | } |
130 | 130 | ||
131 | [OptionNode("PreBuildEvent")] | 131 | [OptionNode("PreBuildEvent")] |
132 | private string m_PreBuildEvent; | 132 | private string m_PreBuildEvent; |
133 | 133 | ||
134 | /// <summary> | 134 | /// <summary> |
135 | /// | 135 | /// |
136 | /// </summary> | 136 | /// </summary> |
137 | public string PreBuildEvent | 137 | public string PreBuildEvent |
138 | { | 138 | { |
139 | get | 139 | get |
140 | { | 140 | { |
141 | return m_PreBuildEvent; | 141 | return m_PreBuildEvent; |
142 | } | 142 | } |
143 | set | 143 | set |
144 | { | 144 | { |
145 | m_PreBuildEvent = value; | 145 | m_PreBuildEvent = value; |
146 | } | 146 | } |
147 | } | 147 | } |
148 | 148 | ||
149 | [OptionNode("PostBuildEvent")] | 149 | [OptionNode("PostBuildEvent")] |
150 | private string m_PostBuildEvent; | 150 | private string m_PostBuildEvent; |
151 | 151 | ||
152 | /// <summary> | 152 | /// <summary> |
153 | /// | 153 | /// |
154 | /// </summary> | 154 | /// </summary> |
155 | public string PostBuildEvent | 155 | public string PostBuildEvent |
156 | { | 156 | { |
157 | get | 157 | get |
158 | { | 158 | { |
159 | return m_PostBuildEvent; | 159 | return m_PostBuildEvent; |
160 | } | 160 | } |
161 | set | 161 | set |
162 | { | 162 | { |
163 | m_PostBuildEvent = value; | 163 | m_PostBuildEvent = value; |
164 | } | 164 | } |
165 | } | 165 | } |
166 | 166 | ||
167 | [OptionNode("PreBuildEventArgs")] | 167 | [OptionNode("PreBuildEventArgs")] |
168 | private string m_PreBuildEventArgs; | 168 | private string m_PreBuildEventArgs; |
169 | 169 | ||
170 | /// <summary> | 170 | /// <summary> |
171 | /// | 171 | /// |
172 | /// </summary> | 172 | /// </summary> |
173 | public string PreBuildEventArgs | 173 | public string PreBuildEventArgs |
174 | { | 174 | { |
175 | get | 175 | get |
176 | { | 176 | { |
177 | return m_PreBuildEventArgs; | 177 | return m_PreBuildEventArgs; |
178 | } | 178 | } |
179 | set | 179 | set |
180 | { | 180 | { |
181 | m_PreBuildEventArgs = value; | 181 | m_PreBuildEventArgs = value; |
182 | } | 182 | } |
183 | } | 183 | } |
184 | 184 | ||
185 | [OptionNode("PostBuildEventArgs")] | 185 | [OptionNode("PostBuildEventArgs")] |
186 | private string m_PostBuildEventArgs; | 186 | private string m_PostBuildEventArgs; |
187 | 187 | ||
188 | /// <summary> | 188 | /// <summary> |
189 | /// | 189 | /// |
190 | /// </summary> | 190 | /// </summary> |
191 | public string PostBuildEventArgs | 191 | public string PostBuildEventArgs |
192 | { | 192 | { |
193 | get | 193 | get |
194 | { | 194 | { |
195 | return m_PostBuildEventArgs; | 195 | return m_PostBuildEventArgs; |
196 | } | 196 | } |
197 | set | 197 | set |
198 | { | 198 | { |
199 | m_PostBuildEventArgs = value; | 199 | m_PostBuildEventArgs = value; |
200 | } | 200 | } |
201 | } | 201 | } |
202 | 202 | ||
203 | [OptionNode("RunPostBuildEvent")] | 203 | [OptionNode("RunPostBuildEvent")] |
204 | private string m_RunPostBuildEvent; | 204 | private string m_RunPostBuildEvent; |
205 | 205 | ||
206 | /// <summary> | 206 | /// <summary> |
207 | /// | 207 | /// |
208 | /// </summary> | 208 | /// </summary> |
209 | public string RunPostBuildEvent | 209 | public string RunPostBuildEvent |
210 | { | 210 | { |
211 | get | 211 | get |
212 | { | 212 | { |
213 | return m_RunPostBuildEvent; | 213 | return m_RunPostBuildEvent; |
214 | } | 214 | } |
215 | set | 215 | set |
216 | { | 216 | { |
217 | m_RunPostBuildEvent = value; | 217 | m_RunPostBuildEvent = value; |
218 | } | 218 | } |
219 | } | 219 | } |
220 | 220 | ||
221 | [OptionNode("RunScript")] | 221 | [OptionNode("RunScript")] |
222 | private string m_RunScript; | 222 | private string m_RunScript; |
223 | 223 | ||
224 | /// <summary> | 224 | /// <summary> |
225 | /// | 225 | /// |
226 | /// </summary> | 226 | /// </summary> |
227 | public string RunScript | 227 | public string RunScript |
228 | { | 228 | { |
229 | get | 229 | get |
230 | { | 230 | { |
231 | return m_RunScript; | 231 | return m_RunScript; |
232 | } | 232 | } |
233 | set | 233 | set |
234 | { | 234 | { |
235 | m_RunScript = value; | 235 | m_RunScript = value; |
236 | } | 236 | } |
237 | } | 237 | } |
238 | 238 | ||
239 | [OptionNode("WarningLevel")] | 239 | [OptionNode("WarningLevel")] |
240 | private int m_WarningLevel = 4; | 240 | private int m_WarningLevel = 4; |
241 | 241 | ||
242 | /// <summary> | 242 | /// <summary> |
243 | /// | 243 | /// |
244 | /// </summary> | 244 | /// </summary> |
245 | public int WarningLevel | 245 | public int WarningLevel |
246 | { | 246 | { |
247 | get | 247 | get |
248 | { | 248 | { |
249 | return m_WarningLevel; | 249 | return m_WarningLevel; |
250 | } | 250 | } |
251 | set | 251 | set |
252 | { | 252 | { |
253 | m_WarningLevel = value; | 253 | m_WarningLevel = value; |
254 | } | 254 | } |
255 | } | 255 | } |
256 | 256 | ||
257 | [OptionNode("WarningsAsErrors")] | 257 | [OptionNode("WarningsAsErrors")] |
258 | private bool m_WarningsAsErrors; | 258 | private bool m_WarningsAsErrors; |
259 | 259 | ||
260 | /// <summary> | 260 | /// <summary> |
261 | /// | 261 | /// |
262 | /// </summary> | 262 | /// </summary> |
263 | public bool WarningsAsErrors | 263 | public bool WarningsAsErrors |
264 | { | 264 | { |
265 | get | 265 | get |
266 | { | 266 | { |
267 | return m_WarningsAsErrors; | 267 | return m_WarningsAsErrors; |
268 | } | 268 | } |
269 | set | 269 | set |
270 | { | 270 | { |
271 | m_WarningsAsErrors = value; | 271 | m_WarningsAsErrors = value; |
272 | } | 272 | } |
273 | } | 273 | } |
274 | 274 | ||
275 | [OptionNode("SuppressWarnings")] | 275 | [OptionNode("SuppressWarnings")] |
276 | private string m_SuppressWarnings = ""; | 276 | private string m_SuppressWarnings = ""; |
277 | 277 | ||
278 | /// <summary> | 278 | /// <summary> |
279 | /// | 279 | /// |
280 | /// </summary> | 280 | /// </summary> |
281 | public string SuppressWarnings | 281 | public string SuppressWarnings |
282 | { | 282 | { |
283 | get | 283 | get |
284 | { | 284 | { |
285 | return m_SuppressWarnings; | 285 | return m_SuppressWarnings; |
286 | } | 286 | } |
287 | set | 287 | set |
288 | { | 288 | { |
289 | m_SuppressWarnings = value; | 289 | m_SuppressWarnings = value; |
290 | } | 290 | } |
291 | } | 291 | } |
292 | 292 | ||
293 | [OptionNode("OutputPath")] | 293 | [OptionNode("OutputPath")] |
294 | private string m_OutputPath = "bin/"; | 294 | private string m_OutputPath = "bin/"; |
295 | 295 | ||
296 | /// <summary> | 296 | /// <summary> |
297 | /// | 297 | /// |
298 | /// </summary> | 298 | /// </summary> |
299 | public string OutputPath | 299 | public string OutputPath |
300 | { | 300 | { |
301 | get | 301 | get |
302 | { | 302 | { |
303 | return m_OutputPath; | 303 | return m_OutputPath; |
304 | } | 304 | } |
305 | set | 305 | set |
306 | { | 306 | { |
307 | m_OutputPath = value; | 307 | m_OutputPath = value; |
308 | } | 308 | } |
309 | } | 309 | } |
310 | 310 | ||
311 | [OptionNode("GenerateDocumentation")] | 311 | [OptionNode("GenerateDocumentation")] |
312 | private bool m_GenerateDocumentation; | 312 | private bool m_GenerateDocumentation; |
313 | 313 | ||
314 | /// <summary> | 314 | /// <summary> |
315 | /// | 315 | /// |
316 | /// </summary> | 316 | /// </summary> |
317 | public bool GenerateDocumentation | 317 | public bool GenerateDocumentation |
318 | { | 318 | { |
319 | get | 319 | get |
320 | { | 320 | { |
321 | return m_GenerateDocumentation; | 321 | return m_GenerateDocumentation; |
322 | } | 322 | } |
323 | set | 323 | set |
324 | { | 324 | { |
325 | m_GenerateDocumentation = value; | 325 | m_GenerateDocumentation = value; |
326 | } | 326 | } |
327 | } | 327 | } |
328 | 328 | ||
329 | [OptionNode("GenerateXmlDocFile")] | 329 | [OptionNode("GenerateXmlDocFile")] |
330 | private bool m_GenerateXmlDocFile; | 330 | private bool m_GenerateXmlDocFile; |
331 | 331 | ||
332 | /// <summary> | 332 | /// <summary> |
333 | /// | 333 | /// |
334 | /// </summary> | 334 | /// </summary> |
335 | public bool GenerateXmlDocFile | 335 | public bool GenerateXmlDocFile |
336 | { | 336 | { |
337 | get | 337 | get |
338 | { | 338 | { |
339 | return m_GenerateXmlDocFile; | 339 | return m_GenerateXmlDocFile; |
340 | } | 340 | } |
341 | set | 341 | set |
342 | { | 342 | { |
343 | m_GenerateXmlDocFile = value; | 343 | m_GenerateXmlDocFile = value; |
344 | } | 344 | } |
345 | } | 345 | } |
346 | 346 | ||
347 | [OptionNode("XmlDocFile")] | 347 | [OptionNode("XmlDocFile")] |
348 | private string m_XmlDocFile = ""; | 348 | private string m_XmlDocFile = ""; |
349 | 349 | ||
350 | /// <summary> | 350 | /// <summary> |
351 | /// | 351 | /// |
352 | /// </summary> | 352 | /// </summary> |
353 | public string XmlDocFile | 353 | public string XmlDocFile |
354 | { | 354 | { |
355 | get | 355 | get |
356 | { | 356 | { |
357 | return m_XmlDocFile; | 357 | return m_XmlDocFile; |
358 | } | 358 | } |
359 | set | 359 | set |
360 | { | 360 | { |
361 | m_XmlDocFile = value; | 361 | m_XmlDocFile = value; |
362 | } | 362 | } |
363 | } | 363 | } |
364 | 364 | ||
365 | [OptionNode("KeyFile")] | 365 | [OptionNode("KeyFile")] |
366 | private string m_KeyFile = ""; | 366 | private string m_KeyFile = ""; |
367 | 367 | ||
368 | /// <summary> | 368 | /// <summary> |
369 | /// | 369 | /// |
370 | /// </summary> | 370 | /// </summary> |
371 | public string KeyFile | 371 | public string KeyFile |
372 | { | 372 | { |
373 | get | 373 | get |
374 | { | 374 | { |
375 | return m_KeyFile; | 375 | return m_KeyFile; |
376 | } | 376 | } |
377 | set | 377 | set |
378 | { | 378 | { |
379 | m_KeyFile = value; | 379 | m_KeyFile = value; |
380 | } | 380 | } |
381 | } | 381 | } |
382 | 382 | ||
383 | [OptionNode("DebugInformation")] | 383 | [OptionNode("DebugInformation")] |
384 | private bool m_DebugInformation; | 384 | private bool m_DebugInformation; |
385 | 385 | ||
386 | /// <summary> | 386 | /// <summary> |
387 | /// | 387 | /// |
388 | /// </summary> | 388 | /// </summary> |
389 | public bool DebugInformation | 389 | public bool DebugInformation |
390 | { | 390 | { |
391 | get | 391 | get |
392 | { | 392 | { |
393 | return m_DebugInformation; | 393 | return m_DebugInformation; |
394 | } | 394 | } |
395 | set | 395 | set |
396 | { | 396 | { |
397 | m_DebugInformation = value; | 397 | m_DebugInformation = value; |
398 | } | 398 | } |
399 | } | 399 | } |
400 | 400 | ||
401 | [OptionNode("RegisterComInterop")] | 401 | [OptionNode("RegisterComInterop")] |
402 | private bool m_RegisterComInterop; | 402 | private bool m_RegisterComInterop; |
403 | 403 | ||
404 | /// <summary> | 404 | /// <summary> |
405 | /// | 405 | /// |
406 | /// </summary> | 406 | /// </summary> |
407 | public bool RegisterComInterop | 407 | public bool RegisterComInterop |
408 | { | 408 | { |
409 | get | 409 | get |
410 | { | 410 | { |
411 | return m_RegisterComInterop; | 411 | return m_RegisterComInterop; |
412 | } | 412 | } |
413 | set | 413 | set |
414 | { | 414 | { |
415 | m_RegisterComInterop = value; | 415 | m_RegisterComInterop = value; |
416 | } | 416 | } |
417 | } | 417 | } |
418 | 418 | ||
419 | [OptionNode("RemoveIntegerChecks")] | 419 | [OptionNode("RemoveIntegerChecks")] |
420 | private bool m_RemoveIntegerChecks; | 420 | private bool m_RemoveIntegerChecks; |
421 | 421 | ||
422 | /// <summary> | 422 | /// <summary> |
423 | /// | 423 | /// |
424 | /// </summary> | 424 | /// </summary> |
425 | public bool RemoveIntegerChecks | 425 | public bool RemoveIntegerChecks |
426 | { | 426 | { |
427 | get | 427 | get |
428 | { | 428 | { |
429 | return m_RemoveIntegerChecks; | 429 | return m_RemoveIntegerChecks; |
430 | } | 430 | } |
431 | set | 431 | set |
432 | { | 432 | { |
433 | m_RemoveIntegerChecks = value; | 433 | m_RemoveIntegerChecks = value; |
434 | } | 434 | } |
435 | } | 435 | } |
436 | 436 | ||
437 | [OptionNode("IncrementalBuild")] | 437 | [OptionNode("IncrementalBuild")] |
438 | private bool m_IncrementalBuild; | 438 | private bool m_IncrementalBuild; |
439 | 439 | ||
440 | /// <summary> | 440 | /// <summary> |
441 | /// | 441 | /// |
442 | /// </summary> | 442 | /// </summary> |
443 | public bool IncrementalBuild | 443 | public bool IncrementalBuild |
444 | { | 444 | { |
445 | get | 445 | get |
446 | { | 446 | { |
447 | return m_IncrementalBuild; | 447 | return m_IncrementalBuild; |
448 | } | 448 | } |
449 | set | 449 | set |
450 | { | 450 | { |
451 | m_IncrementalBuild = value; | 451 | m_IncrementalBuild = value; |
452 | } | 452 | } |
453 | } | 453 | } |
454 | 454 | ||
455 | [OptionNode("BaseAddress")] | 455 | [OptionNode("BaseAddress")] |
456 | private string m_BaseAddress = "285212672"; | 456 | private string m_BaseAddress = "285212672"; |
457 | 457 | ||
458 | /// <summary> | 458 | /// <summary> |
459 | /// | 459 | /// |
460 | /// </summary> | 460 | /// </summary> |
461 | public string BaseAddress | 461 | public string BaseAddress |
462 | { | 462 | { |
463 | get | 463 | get |
464 | { | 464 | { |
465 | return m_BaseAddress; | 465 | return m_BaseAddress; |
466 | } | 466 | } |
467 | set | 467 | set |
468 | { | 468 | { |
469 | m_BaseAddress = value; | 469 | m_BaseAddress = value; |
470 | } | 470 | } |
471 | } | 471 | } |
472 | 472 | ||
473 | [OptionNode("FileAlignment")] | 473 | [OptionNode("FileAlignment")] |
474 | private int m_FileAlignment = 4096; | 474 | private int m_FileAlignment = 4096; |
475 | 475 | ||
476 | /// <summary> | 476 | /// <summary> |
477 | /// | 477 | /// |
478 | /// </summary> | 478 | /// </summary> |
479 | public int FileAlignment | 479 | public int FileAlignment |
480 | { | 480 | { |
481 | get | 481 | get |
482 | { | 482 | { |
483 | return m_FileAlignment; | 483 | return m_FileAlignment; |
484 | } | 484 | } |
485 | set | 485 | set |
486 | { | 486 | { |
487 | m_FileAlignment = value; | 487 | m_FileAlignment = value; |
488 | } | 488 | } |
489 | } | 489 | } |
490 | 490 | ||
491 | [OptionNode("NoStdLib")] | 491 | [OptionNode("NoStdLib")] |
492 | private bool m_NoStdLib; | 492 | private bool m_NoStdLib; |
493 | 493 | ||
494 | /// <summary> | 494 | /// <summary> |
495 | /// | 495 | /// |
496 | /// </summary> | 496 | /// </summary> |
497 | public bool NoStdLib | 497 | public bool NoStdLib |
498 | { | 498 | { |
499 | get | 499 | get |
500 | { | 500 | { |
501 | return m_NoStdLib; | 501 | return m_NoStdLib; |
502 | } | 502 | } |
503 | set | 503 | set |
504 | { | 504 | { |
505 | m_NoStdLib = value; | 505 | m_NoStdLib = value; |
506 | } | 506 | } |
507 | } | 507 | } |
508 | 508 | ||
509 | private StringCollection m_FieldsDefined; | 509 | private StringCollection m_FieldsDefined; |
510 | 510 | ||
511 | #endregion | 511 | #endregion |
512 | 512 | ||
513 | #region Constructors | 513 | #region Constructors |
514 | 514 | ||
515 | /// <summary> | 515 | /// <summary> |
516 | /// Initializes the <see cref="OptionsNode"/> class. | 516 | /// Initializes the <see cref="OptionsNode"/> class. |
517 | /// </summary> | 517 | /// </summary> |
518 | static OptionsNode() | 518 | static OptionsNode() |
519 | { | 519 | { |
520 | Type t = typeof(OptionsNode); | 520 | Type t = typeof(OptionsNode); |
521 | 521 | ||
522 | m_OptionFields = new Hashtable(); | 522 | m_OptionFields = new Hashtable(); |
523 | foreach(FieldInfo f in t.GetFields(BindingFlags.NonPublic | BindingFlags.Instance)) | 523 | foreach(FieldInfo f in t.GetFields(BindingFlags.NonPublic | BindingFlags.Instance)) |
524 | { | 524 | { |
525 | object[] attrs = f.GetCustomAttributes(typeof(OptionNodeAttribute), false); | 525 | object[] attrs = f.GetCustomAttributes(typeof(OptionNodeAttribute), false); |
526 | if(attrs == null || attrs.Length < 1) | 526 | if(attrs == null || attrs.Length < 1) |
527 | { | 527 | { |
528 | continue; | 528 | continue; |
529 | } | 529 | } |
530 | 530 | ||
531 | OptionNodeAttribute ona = (OptionNodeAttribute)attrs[0]; | 531 | OptionNodeAttribute ona = (OptionNodeAttribute)attrs[0]; |
532 | m_OptionFields[ona.NodeName] = f; | 532 | m_OptionFields[ona.NodeName] = f; |
533 | } | 533 | } |
534 | } | 534 | } |
535 | 535 | ||
536 | /// <summary> | 536 | /// <summary> |
537 | /// Initializes a new instance of the <see cref="OptionsNode"/> class. | 537 | /// Initializes a new instance of the <see cref="OptionsNode"/> class. |
538 | /// </summary> | 538 | /// </summary> |
539 | public OptionsNode() | 539 | public OptionsNode() |
540 | { | 540 | { |
541 | m_FieldsDefined = new StringCollection(); | 541 | m_FieldsDefined = new StringCollection(); |
542 | } | 542 | } |
543 | 543 | ||
544 | #endregion | 544 | #endregion |
545 | 545 | ||
546 | #region Properties | 546 | #region Properties |
547 | 547 | ||
548 | /// <summary> | 548 | /// <summary> |
549 | /// Gets the <see cref="Object"/> at the specified index. | 549 | /// Gets the <see cref="Object"/> at the specified index. |
550 | /// </summary> | 550 | /// </summary> |
551 | /// <value></value> | 551 | /// <value></value> |
552 | public object this[string index] | 552 | public object this[string index] |
553 | { | 553 | { |
554 | get | 554 | get |
555 | { | 555 | { |
556 | if(!m_OptionFields.ContainsKey(index)) | 556 | if(!m_OptionFields.ContainsKey(index)) |
557 | { | 557 | { |
558 | return null; | 558 | return null; |
559 | } | 559 | } |
560 | 560 | ||
561 | FieldInfo f = (FieldInfo)m_OptionFields[index]; | 561 | FieldInfo f = (FieldInfo)m_OptionFields[index]; |
562 | return f.GetValue(this); | 562 | return f.GetValue(this); |
563 | } | 563 | } |
564 | } | 564 | } |
565 | 565 | ||
566 | /// <summary> | 566 | /// <summary> |
567 | /// Gets the <see cref="Object"/> at the specified index. | 567 | /// Gets the <see cref="Object"/> at the specified index. |
568 | /// </summary> | 568 | /// </summary> |
569 | /// <value></value> | 569 | /// <value></value> |
570 | public object this[string index, object defaultValue] | 570 | public object this[string index, object defaultValue] |
571 | { | 571 | { |
572 | get | 572 | get |
573 | { | 573 | { |
574 | object valueObject = this[index]; | 574 | object valueObject = this[index]; |
575 | if(valueObject != null && valueObject is string && ((string)valueObject).Length == 0) | 575 | if(valueObject != null && valueObject is string && ((string)valueObject).Length == 0) |
576 | { | 576 | { |
577 | return defaultValue; | 577 | return defaultValue; |
578 | } | 578 | } |
579 | return valueObject; | 579 | return valueObject; |
580 | } | 580 | } |
581 | } | 581 | } |
582 | 582 | ||
583 | 583 | ||
584 | #endregion | 584 | #endregion |
585 | 585 | ||
586 | #region Private Methods | 586 | #region Private Methods |
587 | 587 | ||
588 | private void FlagDefined(string name) | 588 | private void FlagDefined(string name) |
589 | { | 589 | { |
590 | if(!m_FieldsDefined.Contains(name)) | 590 | if(!m_FieldsDefined.Contains(name)) |
591 | { | 591 | { |
592 | m_FieldsDefined.Add(name); | 592 | m_FieldsDefined.Add(name); |
593 | } | 593 | } |
594 | } | 594 | } |
595 | 595 | ||
596 | private void SetOption(string nodeName, string val) | 596 | private void SetOption(string nodeName, string val) |
597 | { | 597 | { |
598 | lock(m_OptionFields) | 598 | lock(m_OptionFields) |
599 | { | 599 | { |
600 | if(!m_OptionFields.ContainsKey(nodeName)) | 600 | if(!m_OptionFields.ContainsKey(nodeName)) |
601 | { | 601 | { |
602 | return; | 602 | return; |
603 | } | 603 | } |
604 | 604 | ||
605 | FieldInfo f = (FieldInfo)m_OptionFields[nodeName]; | 605 | FieldInfo f = (FieldInfo)m_OptionFields[nodeName]; |
606 | f.SetValue(this, Helper.TranslateValue(f.FieldType, val)); | 606 | f.SetValue(this, Helper.TranslateValue(f.FieldType, val)); |
607 | FlagDefined(f.Name); | 607 | FlagDefined(f.Name); |
608 | } | 608 | } |
609 | } | 609 | } |
610 | 610 | ||
611 | #endregion | 611 | #endregion |
612 | 612 | ||
613 | #region Public Methods | 613 | #region Public Methods |
614 | 614 | ||
615 | /// <summary> | 615 | /// <summary> |
616 | /// Parses the specified node. | 616 | /// Parses the specified node. |
617 | /// </summary> | 617 | /// </summary> |
618 | /// <param name="node">The node.</param> | 618 | /// <param name="node">The node.</param> |
619 | public override void Parse(XmlNode node) | 619 | public override void Parse(XmlNode node) |
620 | { | 620 | { |
621 | if( node == null ) | 621 | if( node == null ) |
622 | { | 622 | { |
623 | throw new ArgumentNullException("node"); | 623 | throw new ArgumentNullException("node"); |
624 | } | 624 | } |
625 | 625 | ||
626 | foreach(XmlNode child in node.ChildNodes) | 626 | foreach(XmlNode child in node.ChildNodes) |
627 | { | 627 | { |
628 | SetOption(child.Name, Helper.InterpolateForEnvironmentVariables(child.InnerText)); | 628 | SetOption(child.Name, Helper.InterpolateForEnvironmentVariables(child.InnerText)); |
629 | } | 629 | } |
630 | } | 630 | } |
631 | 631 | ||
632 | /// <summary> | 632 | /// <summary> |
633 | /// Copies to. | 633 | /// Copies to. |
634 | /// </summary> | 634 | /// </summary> |
635 | /// <param name="opt">The opt.</param> | 635 | /// <param name="opt">The opt.</param> |
636 | public void CopyTo(OptionsNode opt) | 636 | public void CopyTo(OptionsNode opt) |
637 | { | 637 | { |
638 | if(opt == null) | 638 | if(opt == null) |
639 | { | 639 | { |
640 | return; | 640 | return; |
641 | } | 641 | } |
642 | 642 | ||
643 | foreach(FieldInfo f in m_OptionFields.Values) | 643 | foreach(FieldInfo f in m_OptionFields.Values) |
644 | { | 644 | { |
645 | if(m_FieldsDefined.Contains(f.Name)) | 645 | if(m_FieldsDefined.Contains(f.Name)) |
646 | { | 646 | { |
647 | f.SetValue(opt, f.GetValue(this)); | 647 | f.SetValue(opt, f.GetValue(this)); |
648 | opt.m_FieldsDefined.Add(f.Name); | 648 | opt.m_FieldsDefined.Add(f.Name); |
649 | } | 649 | } |
650 | } | 650 | } |
651 | } | 651 | } |
652 | 652 | ||
653 | #endregion | 653 | #endregion |
654 | } | 654 | } |
655 | } | 655 | } |
diff --git a/Prebuild/src/Core/Nodes/ProcessNode.cs b/Prebuild/src/Core/Nodes/ProcessNode.cs index f546a4b..5f3dbe6 100644 --- a/Prebuild/src/Core/Nodes/ProcessNode.cs +++ b/Prebuild/src/Core/Nodes/ProcessNode.cs | |||
@@ -1,119 +1,119 @@ | |||
1 | #region BSD License | 1 | #region BSD License |
2 | /* | 2 | /* |
3 | Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) | 3 | Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) |
4 | 4 | ||
5 | Redistribution and use in source and binary forms, with or without modification, are permitted | 5 | Redistribution and use in source and binary forms, with or without modification, are permitted |
6 | provided that the following conditions are met: | 6 | provided that the following conditions are met: |
7 | 7 | ||
8 | * Redistributions of source code must retain the above copyright notice, this list of conditions | 8 | * Redistributions of source code must retain the above copyright notice, this list of conditions |
9 | and the following disclaimer. | 9 | and the following disclaimer. |
10 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions | 10 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions |
11 | and the following disclaimer in the documentation and/or other materials provided with the | 11 | and the following disclaimer in the documentation and/or other materials provided with the |
12 | distribution. | 12 | distribution. |
13 | * The name of the author may not be used to endorse or promote products derived from this software | 13 | * The name of the author may not be used to endorse or promote products derived from this software |
14 | without specific prior written permission. | 14 | without specific prior written permission. |
15 | 15 | ||
16 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, | 16 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, |
17 | BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | 17 | BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
18 | ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | 18 | ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
19 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | 19 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
20 | OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY | 20 | OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
21 | OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | 21 | OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING |
22 | IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 22 | IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
23 | */ | 23 | */ |
24 | #endregion | 24 | #endregion |
25 | 25 | ||
26 | #region CVS Information | 26 | #region CVS Information |
27 | /* | 27 | /* |
28 | * $Source$ | 28 | * $Source$ |
29 | * $Author: jendave $ | 29 | * $Author: jendave $ |
30 | * $Date: 2006-01-28 01:49:58 +0100 (lö, 28 jan 2006) $ | 30 | * $Date: 2006-01-28 01:49:58 +0100 (lö, 28 jan 2006) $ |
31 | * $Revision: 71 $ | 31 | * $Revision: 71 $ |
32 | */ | 32 | */ |
33 | #endregion | 33 | #endregion |
34 | 34 | ||
35 | using System; | 35 | using System; |
36 | using System.Collections; | 36 | using System.Collections; |
37 | using System.Collections.Specialized; | 37 | using System.Collections.Specialized; |
38 | using System.Xml; | 38 | using System.Xml; |
39 | 39 | ||
40 | using Prebuild.Core.Attributes; | 40 | using Prebuild.Core.Attributes; |
41 | using Prebuild.Core.Interfaces; | 41 | using Prebuild.Core.Interfaces; |
42 | using Prebuild.Core.Utilities; | 42 | using Prebuild.Core.Utilities; |
43 | 43 | ||
44 | namespace Prebuild.Core.Nodes | 44 | namespace Prebuild.Core.Nodes |
45 | { | 45 | { |
46 | /// <summary> | 46 | /// <summary> |
47 | /// | 47 | /// |
48 | /// </summary> | 48 | /// </summary> |
49 | [DataNode("Process")] | 49 | [DataNode("Process")] |
50 | public class ProcessNode : DataNode | 50 | public class ProcessNode : DataNode |
51 | { | 51 | { |
52 | #region Fields | 52 | #region Fields |
53 | 53 | ||
54 | private string m_Path; | 54 | private string m_Path; |
55 | private bool m_IsValid = true; | 55 | private bool m_IsValid = true; |
56 | 56 | ||
57 | #endregion | 57 | #endregion |
58 | 58 | ||
59 | #region Properties | 59 | #region Properties |
60 | 60 | ||
61 | /// <summary> | 61 | /// <summary> |
62 | /// Gets the path. | 62 | /// Gets the path. |
63 | /// </summary> | 63 | /// </summary> |
64 | /// <value>The path.</value> | 64 | /// <value>The path.</value> |
65 | public string Path | 65 | public string Path |
66 | { | 66 | { |
67 | get | 67 | get |
68 | { | 68 | { |
69 | return m_Path; | 69 | return m_Path; |
70 | } | 70 | } |
71 | } | 71 | } |
72 | 72 | ||
73 | /// <summary> | 73 | /// <summary> |
74 | /// Gets a value indicating whether this instance is valid. | 74 | /// Gets a value indicating whether this instance is valid. |
75 | /// </summary> | 75 | /// </summary> |
76 | /// <value><c>true</c> if this instance is valid; otherwise, <c>false</c>.</value> | 76 | /// <value><c>true</c> if this instance is valid; otherwise, <c>false</c>.</value> |
77 | public bool IsValid | 77 | public bool IsValid |
78 | { | 78 | { |
79 | get | 79 | get |
80 | { | 80 | { |
81 | return m_IsValid; | 81 | return m_IsValid; |
82 | } | 82 | } |
83 | } | 83 | } |
84 | 84 | ||
85 | #endregion | 85 | #endregion |
86 | 86 | ||
87 | #region Public Methods | 87 | #region Public Methods |
88 | 88 | ||
89 | /// <summary> | 89 | /// <summary> |
90 | /// Parses the specified node. | 90 | /// Parses the specified node. |
91 | /// </summary> | 91 | /// </summary> |
92 | /// <param name="node">The node.</param> | 92 | /// <param name="node">The node.</param> |
93 | public override void Parse(XmlNode node) | 93 | public override void Parse(XmlNode node) |
94 | { | 94 | { |
95 | if( node == null ) | 95 | if( node == null ) |
96 | { | 96 | { |
97 | throw new ArgumentNullException("node"); | 97 | throw new ArgumentNullException("node"); |
98 | } | 98 | } |
99 | 99 | ||
100 | m_Path = Helper.InterpolateForEnvironmentVariables(node.InnerText); | 100 | m_Path = Helper.InterpolateForEnvironmentVariables(node.InnerText); |
101 | if(m_Path == null) | 101 | if(m_Path == null) |
102 | { | 102 | { |
103 | m_Path = ""; | 103 | m_Path = ""; |
104 | } | 104 | } |
105 | 105 | ||
106 | try | 106 | try |
107 | { | 107 | { |
108 | m_Path = Helper.ResolvePath(m_Path); | 108 | m_Path = Helper.ResolvePath(m_Path); |
109 | } | 109 | } |
110 | catch(ArgumentException) | 110 | catch(ArgumentException) |
111 | { | 111 | { |
112 | Kernel.Instance.Log.Write(LogType.Warning, "Could not find prebuild file for processing: {0}", m_Path); | 112 | Kernel.Instance.Log.Write(LogType.Warning, "Could not find prebuild file for processing: {0}", m_Path); |
113 | m_IsValid = false; | 113 | m_IsValid = false; |
114 | } | 114 | } |
115 | } | 115 | } |
116 | 116 | ||
117 | #endregion | 117 | #endregion |
118 | } | 118 | } |
119 | } | 119 | } |
diff --git a/Prebuild/src/Core/Nodes/ProjectNode.cs b/Prebuild/src/Core/Nodes/ProjectNode.cs index c56dacc..bddaace 100644 --- a/Prebuild/src/Core/Nodes/ProjectNode.cs +++ b/Prebuild/src/Core/Nodes/ProjectNode.cs | |||
@@ -1,510 +1,510 @@ | |||
1 | #region BSD License | 1 | #region BSD License |
2 | /* | 2 | /* |
3 | Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) | 3 | Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) |
4 | 4 | ||
5 | Redistribution and use in source and binary forms, with or without modification, are permitted | 5 | Redistribution and use in source and binary forms, with or without modification, are permitted |
6 | provided that the following conditions are met: | 6 | provided that the following conditions are met: |
7 | 7 | ||
8 | * Redistributions of source code must retain the above copyright notice, this list of conditions | 8 | * Redistributions of source code must retain the above copyright notice, this list of conditions |
9 | and the following disclaimer. | 9 | and the following disclaimer. |
10 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions | 10 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions |
11 | and the following disclaimer in the documentation and/or other materials provided with the | 11 | and the following disclaimer in the documentation and/or other materials provided with the |
12 | distribution. | 12 | distribution. |
13 | * The name of the author may not be used to endorse or promote products derived from this software | 13 | * The name of the author may not be used to endorse or promote products derived from this software |
14 | without specific prior written permission. | 14 | without specific prior written permission. |
15 | 15 | ||
16 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, | 16 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, |
17 | BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | 17 | BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
18 | ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | 18 | ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
19 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | 19 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
20 | OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY | 20 | OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
21 | OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | 21 | OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING |
22 | IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 22 | IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
23 | */ | 23 | */ |
24 | #endregion | 24 | #endregion |
25 | 25 | ||
26 | #region CVS Information | 26 | #region CVS Information |
27 | /* | 27 | /* |
28 | * $Source$ | 28 | * $Source$ |
29 | * $Author: jendave $ | 29 | * $Author: jendave $ |
30 | * $Date: 2006-11-11 05:43:20 +0100 (lö, 11 nov 2006) $ | 30 | * $Date: 2006-11-11 05:43:20 +0100 (lö, 11 nov 2006) $ |
31 | * $Revision: 192 $ | 31 | * $Revision: 192 $ |
32 | */ | 32 | */ |
33 | #endregion | 33 | #endregion |
34 | 34 | ||
35 | using System; | 35 | using System; |
36 | using System.Collections; | 36 | using System.Collections; |
37 | using System.IO; | 37 | using System.IO; |
38 | using System.Xml; | 38 | using System.Xml; |
39 | 39 | ||
40 | using Prebuild.Core.Attributes; | 40 | using Prebuild.Core.Attributes; |
41 | using Prebuild.Core.Interfaces; | 41 | using Prebuild.Core.Interfaces; |
42 | using Prebuild.Core.Utilities; | 42 | using Prebuild.Core.Utilities; |
43 | 43 | ||
44 | namespace Prebuild.Core.Nodes | 44 | namespace Prebuild.Core.Nodes |
45 | { | 45 | { |
46 | /// <summary> | 46 | /// <summary> |
47 | /// | 47 | /// |
48 | /// </summary> | 48 | /// </summary> |
49 | public enum ProjectType | 49 | public enum ProjectType |
50 | { | 50 | { |
51 | /// <summary> | 51 | /// <summary> |
52 | /// | 52 | /// |
53 | /// </summary> | 53 | /// </summary> |
54 | Exe, | 54 | Exe, |
55 | /// <summary> | 55 | /// <summary> |
56 | /// | 56 | /// |
57 | /// </summary> | 57 | /// </summary> |
58 | WinExe, | 58 | WinExe, |
59 | /// <summary> | 59 | /// <summary> |
60 | /// | 60 | /// |
61 | /// </summary> | 61 | /// </summary> |
62 | Library | 62 | Library |
63 | } | 63 | } |
64 | 64 | ||
65 | /// <summary> | 65 | /// <summary> |
66 | /// | 66 | /// |
67 | /// </summary> | 67 | /// </summary> |
68 | public enum ClrRuntime | 68 | public enum ClrRuntime |
69 | { | 69 | { |
70 | /// <summary> | 70 | /// <summary> |
71 | /// | 71 | /// |
72 | /// </summary> | 72 | /// </summary> |
73 | Microsoft, | 73 | Microsoft, |
74 | /// <summary> | 74 | /// <summary> |
75 | /// | 75 | /// |
76 | /// </summary> | 76 | /// </summary> |
77 | Mono | 77 | Mono |
78 | } | 78 | } |
79 | 79 | ||
80 | /// <summary> | 80 | /// <summary> |
81 | /// | 81 | /// |
82 | /// </summary> | 82 | /// </summary> |
83 | [DataNode("Project")] | 83 | [DataNode("Project")] |
84 | public class ProjectNode : DataNode, IComparable | 84 | public class ProjectNode : DataNode, IComparable |
85 | { | 85 | { |
86 | #region Fields | 86 | #region Fields |
87 | 87 | ||
88 | private string m_Name = "unknown"; | 88 | private string m_Name = "unknown"; |
89 | private string m_Path = ""; | 89 | private string m_Path = ""; |
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_DesignerFolder = ""; | 93 | private string m_DesignerFolder = ""; |
94 | private string m_Language = "C#"; | 94 | private string m_Language = "C#"; |
95 | private ProjectType m_Type = ProjectType.Exe; | 95 | private ProjectType m_Type = ProjectType.Exe; |
96 | private ClrRuntime m_Runtime = ClrRuntime.Microsoft; | 96 | private ClrRuntime m_Runtime = ClrRuntime.Microsoft; |
97 | private string m_StartupObject = ""; | 97 | private string m_StartupObject = ""; |
98 | private string m_RootNamespace; | 98 | private string m_RootNamespace; |
99 | private string m_FilterGroups = ""; | 99 | private string m_FilterGroups = ""; |
100 | private Guid m_Guid; | 100 | private Guid m_Guid; |
101 | 101 | ||
102 | private Hashtable m_Configurations; | 102 | private Hashtable m_Configurations; |
103 | private ArrayList m_ReferencePaths; | 103 | private ArrayList m_ReferencePaths; |
104 | private ArrayList m_References; | 104 | private ArrayList m_References; |
105 | private FilesNode m_Files; | 105 | private FilesNode m_Files; |
106 | 106 | ||
107 | #endregion | 107 | #endregion |
108 | 108 | ||
109 | #region Constructors | 109 | #region Constructors |
110 | 110 | ||
111 | /// <summary> | 111 | /// <summary> |
112 | /// Initializes a new instance of the <see cref="ProjectNode"/> class. | 112 | /// Initializes a new instance of the <see cref="ProjectNode"/> class. |
113 | /// </summary> | 113 | /// </summary> |
114 | public ProjectNode() | 114 | public ProjectNode() |
115 | { | 115 | { |
116 | m_Configurations = new Hashtable(); | 116 | m_Configurations = new Hashtable(); |
117 | m_ReferencePaths = new ArrayList(); | 117 | m_ReferencePaths = new ArrayList(); |
118 | m_References = new ArrayList(); | 118 | m_References = new ArrayList(); |
119 | } | 119 | } |
120 | 120 | ||
121 | #endregion | 121 | #endregion |
122 | 122 | ||
123 | #region Properties | 123 | #region Properties |
124 | 124 | ||
125 | /// <summary> | 125 | /// <summary> |
126 | /// Gets the name. | 126 | /// Gets the name. |
127 | /// </summary> | 127 | /// </summary> |
128 | /// <value>The name.</value> | 128 | /// <value>The name.</value> |
129 | public string Name | 129 | public string Name |
130 | { | 130 | { |
131 | get | 131 | get |
132 | { | 132 | { |
133 | return m_Name; | 133 | return m_Name; |
134 | } | 134 | } |
135 | } | 135 | } |
136 | 136 | ||
137 | /// <summary> | 137 | /// <summary> |
138 | /// Gets the path. | 138 | /// Gets the path. |
139 | /// </summary> | 139 | /// </summary> |
140 | /// <value>The path.</value> | 140 | /// <value>The path.</value> |
141 | public string Path | 141 | public string Path |
142 | { | 142 | { |
143 | get | 143 | get |
144 | { | 144 | { |
145 | return m_Path; | 145 | return m_Path; |
146 | } | 146 | } |
147 | } | 147 | } |
148 | 148 | ||
149 | /// <summary> | 149 | /// <summary> |
150 | /// Gets the filter groups. | 150 | /// Gets the filter groups. |
151 | /// </summary> | 151 | /// </summary> |
152 | /// <value>The filter groups.</value> | 152 | /// <value>The filter groups.</value> |
153 | public string FilterGroups | 153 | public string FilterGroups |
154 | { | 154 | { |
155 | get | 155 | get |
156 | { | 156 | { |
157 | return m_FilterGroups; | 157 | return m_FilterGroups; |
158 | } | 158 | } |
159 | } | 159 | } |
160 | 160 | ||
161 | /// <summary> | 161 | /// <summary> |
162 | /// Gets the full path. | 162 | /// Gets the full path. |
163 | /// </summary> | 163 | /// </summary> |
164 | /// <value>The full path.</value> | 164 | /// <value>The full path.</value> |
165 | public string FullPath | 165 | public string FullPath |
166 | { | 166 | { |
167 | get | 167 | get |
168 | { | 168 | { |
169 | return m_FullPath; | 169 | return m_FullPath; |
170 | } | 170 | } |
171 | } | 171 | } |
172 | 172 | ||
173 | /// <summary> | 173 | /// <summary> |
174 | /// Gets the name of the assembly. | 174 | /// Gets the name of the assembly. |
175 | /// </summary> | 175 | /// </summary> |
176 | /// <value>The name of the assembly.</value> | 176 | /// <value>The name of the assembly.</value> |
177 | public string AssemblyName | 177 | public string AssemblyName |
178 | { | 178 | { |
179 | get | 179 | get |
180 | { | 180 | { |
181 | return m_AssemblyName; | 181 | return m_AssemblyName; |
182 | } | 182 | } |
183 | } | 183 | } |
184 | 184 | ||
185 | /// <summary> | 185 | /// <summary> |
186 | /// Gets the app icon. | 186 | /// Gets the app icon. |
187 | /// </summary> | 187 | /// </summary> |
188 | /// <value>The app icon.</value> | 188 | /// <value>The app icon.</value> |
189 | public string AppIcon | 189 | public string AppIcon |
190 | { | 190 | { |
191 | get | 191 | get |
192 | { | 192 | { |
193 | return m_AppIcon; | 193 | return m_AppIcon; |
194 | } | 194 | } |
195 | } | 195 | } |
196 | 196 | ||
197 | /// <summary> | 197 | /// <summary> |
198 | /// | 198 | /// |
199 | /// </summary> | 199 | /// </summary> |
200 | public string DesignerFolder | 200 | public string DesignerFolder |
201 | { | 201 | { |
202 | get | 202 | get |
203 | { | 203 | { |
204 | return m_DesignerFolder; | 204 | return m_DesignerFolder; |
205 | } | 205 | } |
206 | } | 206 | } |
207 | 207 | ||
208 | /// <summary> | 208 | /// <summary> |
209 | /// Gets the language. | 209 | /// Gets the language. |
210 | /// </summary> | 210 | /// </summary> |
211 | /// <value>The language.</value> | 211 | /// <value>The language.</value> |
212 | public string Language | 212 | public string Language |
213 | { | 213 | { |
214 | get | 214 | get |
215 | { | 215 | { |
216 | return m_Language; | 216 | return m_Language; |
217 | } | 217 | } |
218 | } | 218 | } |
219 | 219 | ||
220 | /// <summary> | 220 | /// <summary> |
221 | /// Gets the type. | 221 | /// Gets the type. |
222 | /// </summary> | 222 | /// </summary> |
223 | /// <value>The type.</value> | 223 | /// <value>The type.</value> |
224 | public ProjectType Type | 224 | public ProjectType Type |
225 | { | 225 | { |
226 | get | 226 | get |
227 | { | 227 | { |
228 | return m_Type; | 228 | return m_Type; |
229 | } | 229 | } |
230 | } | 230 | } |
231 | 231 | ||
232 | /// <summary> | 232 | /// <summary> |
233 | /// Gets the runtime. | 233 | /// Gets the runtime. |
234 | /// </summary> | 234 | /// </summary> |
235 | /// <value>The runtime.</value> | 235 | /// <value>The runtime.</value> |
236 | public ClrRuntime Runtime | 236 | public ClrRuntime Runtime |
237 | { | 237 | { |
238 | get | 238 | get |
239 | { | 239 | { |
240 | return m_Runtime; | 240 | return m_Runtime; |
241 | } | 241 | } |
242 | } | 242 | } |
243 | 243 | ||
244 | private bool m_GenerateAssemblyInfoFile = false; | 244 | private bool m_GenerateAssemblyInfoFile = false; |
245 | 245 | ||
246 | /// <summary> | 246 | /// <summary> |
247 | /// | 247 | /// |
248 | /// </summary> | 248 | /// </summary> |
249 | public bool GenerateAssemblyInfoFile | 249 | public bool GenerateAssemblyInfoFile |
250 | { | 250 | { |
251 | get | 251 | get |
252 | { | 252 | { |
253 | return m_GenerateAssemblyInfoFile; | 253 | return m_GenerateAssemblyInfoFile; |
254 | } | 254 | } |
255 | set | 255 | set |
256 | { | 256 | { |
257 | m_GenerateAssemblyInfoFile = value; | 257 | m_GenerateAssemblyInfoFile = value; |
258 | } | 258 | } |
259 | } | 259 | } |
260 | 260 | ||
261 | /// <summary> | 261 | /// <summary> |
262 | /// Gets the startup object. | 262 | /// Gets the startup object. |
263 | /// </summary> | 263 | /// </summary> |
264 | /// <value>The startup object.</value> | 264 | /// <value>The startup object.</value> |
265 | public string StartupObject | 265 | public string StartupObject |
266 | { | 266 | { |
267 | get | 267 | get |
268 | { | 268 | { |
269 | return m_StartupObject; | 269 | return m_StartupObject; |
270 | } | 270 | } |
271 | } | 271 | } |
272 | 272 | ||
273 | /// <summary> | 273 | /// <summary> |
274 | /// Gets the root namespace. | 274 | /// Gets the root namespace. |
275 | /// </summary> | 275 | /// </summary> |
276 | /// <value>The root namespace.</value> | 276 | /// <value>The root namespace.</value> |
277 | public string RootNamespace | 277 | public string RootNamespace |
278 | { | 278 | { |
279 | get | 279 | get |
280 | { | 280 | { |
281 | return m_RootNamespace; | 281 | return m_RootNamespace; |
282 | } | 282 | } |
283 | } | 283 | } |
284 | 284 | ||
285 | /// <summary> | 285 | /// <summary> |
286 | /// Gets the configurations. | 286 | /// Gets the configurations. |
287 | /// </summary> | 287 | /// </summary> |
288 | /// <value>The configurations.</value> | 288 | /// <value>The configurations.</value> |
289 | public ICollection Configurations | 289 | public ICollection Configurations |
290 | { | 290 | { |
291 | get | 291 | get |
292 | { | 292 | { |
293 | ArrayList tmp = new ArrayList( ConfigurationsTable.Values); | 293 | ArrayList tmp = new ArrayList( ConfigurationsTable.Values); |
294 | tmp.Sort(); | 294 | tmp.Sort(); |
295 | return tmp; | 295 | return tmp; |
296 | } | 296 | } |
297 | } | 297 | } |
298 | 298 | ||
299 | /// <summary> | 299 | /// <summary> |
300 | /// Gets the configurations table. | 300 | /// Gets the configurations table. |
301 | /// </summary> | 301 | /// </summary> |
302 | /// <value>The configurations table.</value> | 302 | /// <value>The configurations table.</value> |
303 | public Hashtable ConfigurationsTable | 303 | public Hashtable ConfigurationsTable |
304 | { | 304 | { |
305 | get | 305 | get |
306 | { | 306 | { |
307 | return m_Configurations; | 307 | return m_Configurations; |
308 | } | 308 | } |
309 | } | 309 | } |
310 | 310 | ||
311 | /// <summary> | 311 | /// <summary> |
312 | /// Gets the reference paths. | 312 | /// Gets the reference paths. |
313 | /// </summary> | 313 | /// </summary> |
314 | /// <value>The reference paths.</value> | 314 | /// <value>The reference paths.</value> |
315 | public ArrayList ReferencePaths | 315 | public ArrayList ReferencePaths |
316 | { | 316 | { |
317 | get | 317 | get |
318 | { | 318 | { |
319 | ArrayList tmp = new ArrayList(m_ReferencePaths); | 319 | ArrayList tmp = new ArrayList(m_ReferencePaths); |
320 | tmp.Sort(); | 320 | tmp.Sort(); |
321 | return tmp; | 321 | return tmp; |
322 | } | 322 | } |
323 | } | 323 | } |
324 | 324 | ||
325 | /// <summary> | 325 | /// <summary> |
326 | /// Gets the references. | 326 | /// Gets the references. |
327 | /// </summary> | 327 | /// </summary> |
328 | /// <value>The references.</value> | 328 | /// <value>The references.</value> |
329 | public ArrayList References | 329 | public ArrayList References |
330 | { | 330 | { |
331 | get | 331 | get |
332 | { | 332 | { |
333 | ArrayList tmp = new ArrayList(m_References); | 333 | ArrayList tmp = new ArrayList(m_References); |
334 | tmp.Sort(); | 334 | tmp.Sort(); |
335 | return tmp; | 335 | return tmp; |
336 | } | 336 | } |
337 | } | 337 | } |
338 | 338 | ||
339 | /// <summary> | 339 | /// <summary> |
340 | /// Gets the files. | 340 | /// Gets the files. |
341 | /// </summary> | 341 | /// </summary> |
342 | /// <value>The files.</value> | 342 | /// <value>The files.</value> |
343 | public FilesNode Files | 343 | public FilesNode Files |
344 | { | 344 | { |
345 | get | 345 | get |
346 | { | 346 | { |
347 | return m_Files; | 347 | return m_Files; |
348 | } | 348 | } |
349 | } | 349 | } |
350 | 350 | ||
351 | /// <summary> | 351 | /// <summary> |
352 | /// Gets or sets the parent. | 352 | /// Gets or sets the parent. |
353 | /// </summary> | 353 | /// </summary> |
354 | /// <value>The parent.</value> | 354 | /// <value>The parent.</value> |
355 | public override IDataNode Parent | 355 | public override IDataNode Parent |
356 | { | 356 | { |
357 | get | 357 | get |
358 | { | 358 | { |
359 | return base.Parent; | 359 | return base.Parent; |
360 | } | 360 | } |
361 | set | 361 | set |
362 | { | 362 | { |
363 | base.Parent = value; | 363 | base.Parent = value; |
364 | if(base.Parent is SolutionNode && m_Configurations.Count < 1) | 364 | if(base.Parent is SolutionNode && m_Configurations.Count < 1) |
365 | { | 365 | { |
366 | SolutionNode parent = (SolutionNode)base.Parent; | 366 | SolutionNode parent = (SolutionNode)base.Parent; |
367 | foreach(ConfigurationNode conf in parent.Configurations) | 367 | foreach(ConfigurationNode conf in parent.Configurations) |
368 | { | 368 | { |
369 | m_Configurations[conf.Name] = conf.Clone(); | 369 | m_Configurations[conf.Name] = conf.Clone(); |
370 | } | 370 | } |
371 | } | 371 | } |
372 | } | 372 | } |
373 | } | 373 | } |
374 | 374 | ||
375 | /// <summary> | 375 | /// <summary> |
376 | /// Gets the GUID. | 376 | /// Gets the GUID. |
377 | /// </summary> | 377 | /// </summary> |
378 | /// <value>The GUID.</value> | 378 | /// <value>The GUID.</value> |
379 | public Guid Guid | 379 | public Guid Guid |
380 | { | 380 | { |
381 | get | 381 | get |
382 | { | 382 | { |
383 | return m_Guid; | 383 | return m_Guid; |
384 | } | 384 | } |
385 | } | 385 | } |
386 | 386 | ||
387 | #endregion | 387 | #endregion |
388 | 388 | ||
389 | #region Private Methods | 389 | #region Private Methods |
390 | 390 | ||
391 | private void HandleConfiguration(ConfigurationNode conf) | 391 | private void HandleConfiguration(ConfigurationNode conf) |
392 | { | 392 | { |
393 | if(String.Compare(conf.Name, "all", true) == 0) //apply changes to all, this may not always be applied first, | 393 | if(String.Compare(conf.Name, "all", true) == 0) //apply changes to all, this may not always be applied first, |
394 | //so it *may* override changes to the same properties for configurations defines at the project level | 394 | //so it *may* override changes to the same properties for configurations defines at the project level |
395 | { | 395 | { |
396 | foreach(ConfigurationNode confNode in this.m_Configurations.Values) | 396 | foreach(ConfigurationNode confNode in this.m_Configurations.Values) |
397 | { | 397 | { |
398 | conf.CopyTo(confNode);//update the config templates defines at the project level with the overrides | 398 | conf.CopyTo(confNode);//update the config templates defines at the project level with the overrides |
399 | } | 399 | } |
400 | } | 400 | } |
401 | if(m_Configurations.ContainsKey(conf.Name)) | 401 | if(m_Configurations.ContainsKey(conf.Name)) |
402 | { | 402 | { |
403 | ConfigurationNode parentConf = (ConfigurationNode)m_Configurations[conf.Name]; | 403 | ConfigurationNode parentConf = (ConfigurationNode)m_Configurations[conf.Name]; |
404 | conf.CopyTo(parentConf);//update the config templates defines at the project level with the overrides | 404 | conf.CopyTo(parentConf);//update the config templates defines at the project level with the overrides |
405 | } | 405 | } |
406 | else | 406 | else |
407 | { | 407 | { |
408 | m_Configurations[conf.Name] = conf; | 408 | m_Configurations[conf.Name] = conf; |
409 | } | 409 | } |
410 | } | 410 | } |
411 | 411 | ||
412 | #endregion | 412 | #endregion |
413 | 413 | ||
414 | #region Public Methods | 414 | #region Public Methods |
415 | 415 | ||
416 | /// <summary> | 416 | /// <summary> |
417 | /// Parses the specified node. | 417 | /// Parses the specified node. |
418 | /// </summary> | 418 | /// </summary> |
419 | /// <param name="node">The node.</param> | 419 | /// <param name="node">The node.</param> |
420 | public override void Parse(XmlNode node) | 420 | public override void Parse(XmlNode node) |
421 | { | 421 | { |
422 | m_Name = Helper.AttributeValue(node, "name", m_Name); | 422 | m_Name = Helper.AttributeValue(node, "name", m_Name); |
423 | m_Path = Helper.AttributeValue(node, "path", m_Path); | 423 | m_Path = Helper.AttributeValue(node, "path", m_Path); |
424 | m_FilterGroups = Helper.AttributeValue(node, "filterGroups", m_FilterGroups); | 424 | m_FilterGroups = Helper.AttributeValue(node, "filterGroups", m_FilterGroups); |
425 | m_AppIcon = Helper.AttributeValue(node, "icon", m_AppIcon); | 425 | m_AppIcon = Helper.AttributeValue(node, "icon", m_AppIcon); |
426 | m_DesignerFolder = Helper.AttributeValue(node, "designerFolder", m_DesignerFolder); | 426 | m_DesignerFolder = Helper.AttributeValue(node, "designerFolder", m_DesignerFolder); |
427 | m_AssemblyName = Helper.AttributeValue(node, "assemblyName", m_AssemblyName); | 427 | m_AssemblyName = Helper.AttributeValue(node, "assemblyName", m_AssemblyName); |
428 | m_Language = Helper.AttributeValue(node, "language", m_Language); | 428 | m_Language = Helper.AttributeValue(node, "language", m_Language); |
429 | m_Type = (ProjectType)Helper.EnumAttributeValue(node, "type", typeof(ProjectType), m_Type); | 429 | m_Type = (ProjectType)Helper.EnumAttributeValue(node, "type", typeof(ProjectType), m_Type); |
430 | m_Runtime = (ClrRuntime)Helper.EnumAttributeValue(node, "runtime", typeof(ClrRuntime), m_Runtime); | 430 | m_Runtime = (ClrRuntime)Helper.EnumAttributeValue(node, "runtime", typeof(ClrRuntime), m_Runtime); |
431 | m_StartupObject = Helper.AttributeValue(node, "startupObject", m_StartupObject); | 431 | m_StartupObject = Helper.AttributeValue(node, "startupObject", m_StartupObject); |
432 | m_RootNamespace = Helper.AttributeValue(node, "rootNamespace", m_RootNamespace); | 432 | m_RootNamespace = Helper.AttributeValue(node, "rootNamespace", m_RootNamespace); |
433 | 433 | ||
434 | int hash = m_Name.GetHashCode(); | 434 | int hash = m_Name.GetHashCode(); |
435 | 435 | ||
436 | m_Guid = new Guid( hash, 0, 0, 0, 0, 0, 0,0,0,0,0 ); | 436 | m_Guid = new Guid( hash, 0, 0, 0, 0, 0, 0,0,0,0,0 ); |
437 | 437 | ||
438 | m_GenerateAssemblyInfoFile = Helper.ParseBoolean(node, "generateAssemblyInfoFile", false); | 438 | m_GenerateAssemblyInfoFile = Helper.ParseBoolean(node, "generateAssemblyInfoFile", false); |
439 | 439 | ||
440 | if(m_AssemblyName == null || m_AssemblyName.Length < 1) | 440 | if(m_AssemblyName == null || m_AssemblyName.Length < 1) |
441 | { | 441 | { |
442 | m_AssemblyName = m_Name; | 442 | m_AssemblyName = m_Name; |
443 | } | 443 | } |
444 | 444 | ||
445 | if(m_RootNamespace == null || m_RootNamespace.Length < 1) | 445 | if(m_RootNamespace == null || m_RootNamespace.Length < 1) |
446 | { | 446 | { |
447 | m_RootNamespace = m_Name; | 447 | m_RootNamespace = m_Name; |
448 | } | 448 | } |
449 | 449 | ||
450 | m_FullPath = m_Path; | 450 | m_FullPath = m_Path; |
451 | try | 451 | try |
452 | { | 452 | { |
453 | m_FullPath = Helper.ResolvePath(m_FullPath); | 453 | m_FullPath = Helper.ResolvePath(m_FullPath); |
454 | } | 454 | } |
455 | catch | 455 | catch |
456 | { | 456 | { |
457 | throw new WarningException("Could not resolve Solution path: {0}", m_Path); | 457 | throw new WarningException("Could not resolve Solution path: {0}", m_Path); |
458 | } | 458 | } |
459 | 459 | ||
460 | Kernel.Instance.CurrentWorkingDirectory.Push(); | 460 | Kernel.Instance.CurrentWorkingDirectory.Push(); |
461 | try | 461 | try |
462 | { | 462 | { |
463 | Helper.SetCurrentDir(m_FullPath); | 463 | Helper.SetCurrentDir(m_FullPath); |
464 | 464 | ||
465 | if( node == null ) | 465 | if( node == null ) |
466 | { | 466 | { |
467 | throw new ArgumentNullException("node"); | 467 | throw new ArgumentNullException("node"); |
468 | } | 468 | } |
469 | 469 | ||
470 | foreach(XmlNode child in node.ChildNodes) | 470 | foreach(XmlNode child in node.ChildNodes) |
471 | { | 471 | { |
472 | IDataNode dataNode = Kernel.Instance.ParseNode(child, this); | 472 | IDataNode dataNode = Kernel.Instance.ParseNode(child, this); |
473 | if(dataNode is ConfigurationNode) | 473 | if(dataNode is ConfigurationNode) |
474 | { | 474 | { |
475 | HandleConfiguration((ConfigurationNode)dataNode); | 475 | HandleConfiguration((ConfigurationNode)dataNode); |
476 | } | 476 | } |
477 | else if(dataNode is ReferencePathNode) | 477 | else if(dataNode is ReferencePathNode) |
478 | { | 478 | { |
479 | m_ReferencePaths.Add(dataNode); | 479 | m_ReferencePaths.Add(dataNode); |
480 | } | 480 | } |
481 | else if(dataNode is ReferenceNode) | 481 | else if(dataNode is ReferenceNode) |
482 | { | 482 | { |
483 | m_References.Add(dataNode); | 483 | m_References.Add(dataNode); |
484 | } | 484 | } |
485 | else if(dataNode is FilesNode) | 485 | else if(dataNode is FilesNode) |
486 | { | 486 | { |
487 | m_Files = (FilesNode)dataNode; | 487 | m_Files = (FilesNode)dataNode; |
488 | } | 488 | } |
489 | } | 489 | } |
490 | } | 490 | } |
491 | finally | 491 | finally |
492 | { | 492 | { |
493 | Kernel.Instance.CurrentWorkingDirectory.Pop(); | 493 | Kernel.Instance.CurrentWorkingDirectory.Pop(); |
494 | } | 494 | } |
495 | } | 495 | } |
496 | 496 | ||
497 | 497 | ||
498 | #endregion | 498 | #endregion |
499 | 499 | ||
500 | #region IComparable Members | 500 | #region IComparable Members |
501 | 501 | ||
502 | public int CompareTo(object obj) | 502 | public int CompareTo(object obj) |
503 | { | 503 | { |
504 | ProjectNode that = (ProjectNode)obj; | 504 | ProjectNode that = (ProjectNode)obj; |
505 | return this.m_Name.CompareTo(that.m_Name); | 505 | return this.m_Name.CompareTo(that.m_Name); |
506 | } | 506 | } |
507 | 507 | ||
508 | #endregion | 508 | #endregion |
509 | } | 509 | } |
510 | } | 510 | } |
diff --git a/Prebuild/src/Core/Nodes/ReferenceNode.cs b/Prebuild/src/Core/Nodes/ReferenceNode.cs index a2880c0..4b8262e 100644 --- a/Prebuild/src/Core/Nodes/ReferenceNode.cs +++ b/Prebuild/src/Core/Nodes/ReferenceNode.cs | |||
@@ -1,153 +1,153 @@ | |||
1 | #region BSD License | 1 | #region BSD License |
2 | /* | 2 | /* |
3 | Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) | 3 | Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) |
4 | 4 | ||
5 | Redistribution and use in source and binary forms, with or without modification, are permitted | 5 | Redistribution and use in source and binary forms, with or without modification, are permitted |
6 | provided that the following conditions are met: | 6 | provided that the following conditions are met: |
7 | 7 | ||
8 | * Redistributions of source code must retain the above copyright notice, this list of conditions | 8 | * Redistributions of source code must retain the above copyright notice, this list of conditions |
9 | and the following disclaimer. | 9 | and the following disclaimer. |
10 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions | 10 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions |
11 | and the following disclaimer in the documentation and/or other materials provided with the | 11 | and the following disclaimer in the documentation and/or other materials provided with the |
12 | distribution. | 12 | distribution. |
13 | * The name of the author may not be used to endorse or promote products derived from this software | 13 | * The name of the author may not be used to endorse or promote products derived from this software |
14 | without specific prior written permission. | 14 | without specific prior written permission. |
15 | 15 | ||
16 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, | 16 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, |
17 | BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | 17 | BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
18 | ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | 18 | ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
19 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | 19 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
20 | OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY | 20 | OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
21 | OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | 21 | OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING |
22 | IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 22 | IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
23 | */ | 23 | */ |
24 | #endregion | 24 | #endregion |
25 | 25 | ||
26 | #region CVS Information | 26 | #region CVS Information |
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-25 18:56:49 +0200 (ti, 25 jul 2006) $ |
31 | * $Revision: 132 $ | 31 | * $Revision: 132 $ |
32 | */ | 32 | */ |
33 | #endregion | 33 | #endregion |
34 | 34 | ||
35 | using System; | 35 | using System; |
36 | using System.Xml; | 36 | using System.Xml; |
37 | 37 | ||
38 | using Prebuild.Core.Attributes; | 38 | using Prebuild.Core.Attributes; |
39 | using Prebuild.Core.Interfaces; | 39 | using Prebuild.Core.Interfaces; |
40 | using Prebuild.Core.Utilities; | 40 | using Prebuild.Core.Utilities; |
41 | 41 | ||
42 | namespace Prebuild.Core.Nodes | 42 | namespace Prebuild.Core.Nodes |
43 | { | 43 | { |
44 | /// <summary> | 44 | /// <summary> |
45 | /// | 45 | /// |
46 | /// </summary> | 46 | /// </summary> |
47 | [DataNode("Reference")] | 47 | [DataNode("Reference")] |
48 | public class ReferenceNode : DataNode, IComparable | 48 | public class ReferenceNode : DataNode, IComparable |
49 | { | 49 | { |
50 | #region Fields | 50 | #region Fields |
51 | 51 | ||
52 | private string m_Name = "unknown"; | 52 | private string m_Name = "unknown"; |
53 | private string m_Path; | 53 | private string m_Path; |
54 | private string m_LocalCopy; | 54 | private string m_LocalCopy; |
55 | private string m_Version; | 55 | private string m_Version; |
56 | 56 | ||
57 | #endregion | 57 | #endregion |
58 | 58 | ||
59 | #region Properties | 59 | #region Properties |
60 | 60 | ||
61 | /// <summary> | 61 | /// <summary> |
62 | /// Gets the name. | 62 | /// Gets the name. |
63 | /// </summary> | 63 | /// </summary> |
64 | /// <value>The name.</value> | 64 | /// <value>The name.</value> |
65 | public string Name | 65 | public string Name |
66 | { | 66 | { |
67 | get | 67 | get |
68 | { | 68 | { |
69 | return m_Name; | 69 | return m_Name; |
70 | } | 70 | } |
71 | } | 71 | } |
72 | 72 | ||
73 | /// <summary> | 73 | /// <summary> |
74 | /// Gets the path. | 74 | /// Gets the path. |
75 | /// </summary> | 75 | /// </summary> |
76 | /// <value>The path.</value> | 76 | /// <value>The path.</value> |
77 | public string Path | 77 | public string Path |
78 | { | 78 | { |
79 | get | 79 | get |
80 | { | 80 | { |
81 | return m_Path; | 81 | return m_Path; |
82 | } | 82 | } |
83 | } | 83 | } |
84 | 84 | ||
85 | /// <summary> | 85 | /// <summary> |
86 | /// Gets a value indicating whether [local copy specified]. | 86 | /// Gets a value indicating whether [local copy specified]. |
87 | /// </summary> | 87 | /// </summary> |
88 | /// <value><c>true</c> if [local copy specified]; otherwise, <c>false</c>.</value> | 88 | /// <value><c>true</c> if [local copy specified]; otherwise, <c>false</c>.</value> |
89 | public bool LocalCopySpecified | 89 | public bool LocalCopySpecified |
90 | { | 90 | { |
91 | get | 91 | get |
92 | { | 92 | { |
93 | return ( m_LocalCopy != null && m_LocalCopy.Length == 0); | 93 | return ( m_LocalCopy != null && m_LocalCopy.Length == 0); |
94 | } | 94 | } |
95 | } | 95 | } |
96 | 96 | ||
97 | /// <summary> | 97 | /// <summary> |
98 | /// Gets a value indicating whether [local copy]. | 98 | /// Gets a value indicating whether [local copy]. |
99 | /// </summary> | 99 | /// </summary> |
100 | /// <value><c>true</c> if [local copy]; otherwise, <c>false</c>.</value> | 100 | /// <value><c>true</c> if [local copy]; otherwise, <c>false</c>.</value> |
101 | public bool LocalCopy | 101 | public bool LocalCopy |
102 | { | 102 | { |
103 | get | 103 | get |
104 | { | 104 | { |
105 | if( m_LocalCopy == null) | 105 | if( m_LocalCopy == null) |
106 | { | 106 | { |
107 | return false; | 107 | return false; |
108 | } | 108 | } |
109 | return bool.Parse(m_LocalCopy); | 109 | return bool.Parse(m_LocalCopy); |
110 | } | 110 | } |
111 | } | 111 | } |
112 | 112 | ||
113 | /// <summary> | 113 | /// <summary> |
114 | /// Gets the version. | 114 | /// Gets the version. |
115 | /// </summary> | 115 | /// </summary> |
116 | /// <value>The version.</value> | 116 | /// <value>The version.</value> |
117 | public string Version | 117 | public string Version |
118 | { | 118 | { |
119 | get | 119 | get |
120 | { | 120 | { |
121 | return m_Version; | 121 | return m_Version; |
122 | } | 122 | } |
123 | } | 123 | } |
124 | 124 | ||
125 | #endregion | 125 | #endregion |
126 | 126 | ||
127 | #region Public Methods | 127 | #region Public Methods |
128 | 128 | ||
129 | /// <summary> | 129 | /// <summary> |
130 | /// Parses the specified node. | 130 | /// Parses the specified node. |
131 | /// </summary> | 131 | /// </summary> |
132 | /// <param name="node">The node.</param> | 132 | /// <param name="node">The node.</param> |
133 | public override void Parse(XmlNode node) | 133 | public override void Parse(XmlNode node) |
134 | { | 134 | { |
135 | m_Name = Helper.AttributeValue(node, "name", m_Name); | 135 | m_Name = Helper.AttributeValue(node, "name", m_Name); |
136 | m_Path = Helper.AttributeValue(node, "path", m_Path); | 136 | m_Path = Helper.AttributeValue(node, "path", m_Path); |
137 | m_LocalCopy = Helper.AttributeValue(node, "localCopy", m_LocalCopy); | 137 | m_LocalCopy = Helper.AttributeValue(node, "localCopy", m_LocalCopy); |
138 | m_Version = Helper.AttributeValue(node, "version", m_Version); | 138 | m_Version = Helper.AttributeValue(node, "version", m_Version); |
139 | } | 139 | } |
140 | 140 | ||
141 | #endregion | 141 | #endregion |
142 | 142 | ||
143 | #region IComparable Members | 143 | #region IComparable Members |
144 | 144 | ||
145 | public int CompareTo(object obj) | 145 | public int CompareTo(object obj) |
146 | { | 146 | { |
147 | ReferenceNode that = (ReferenceNode)obj; | 147 | ReferenceNode that = (ReferenceNode)obj; |
148 | return this.m_Name.CompareTo(that.m_Name); | 148 | return this.m_Name.CompareTo(that.m_Name); |
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 0563c1b..4c981e7 100644 --- a/Prebuild/src/Core/Nodes/ReferencePathNode.cs +++ b/Prebuild/src/Core/Nodes/ReferencePathNode.cs | |||
@@ -1,108 +1,108 @@ | |||
1 | #region BSD License | 1 | #region BSD License |
2 | /* | 2 | /* |
3 | Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) | 3 | Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) |
4 | 4 | ||
5 | Redistribution and use in source and binary forms, with or without modification, are permitted | 5 | Redistribution and use in source and binary forms, with or without modification, are permitted |
6 | provided that the following conditions are met: | 6 | provided that the following conditions are met: |
7 | 7 | ||
8 | * Redistributions of source code must retain the above copyright notice, this list of conditions | 8 | * Redistributions of source code must retain the above copyright notice, this list of conditions |
9 | and the following disclaimer. | 9 | and the following disclaimer. |
10 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions | 10 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions |
11 | and the following disclaimer in the documentation and/or other materials provided with the | 11 | and the following disclaimer in the documentation and/or other materials provided with the |
12 | distribution. | 12 | distribution. |
13 | * The name of the author may not be used to endorse or promote products derived from this software | 13 | * The name of the author may not be used to endorse or promote products derived from this software |
14 | without specific prior written permission. | 14 | without specific prior written permission. |
15 | 15 | ||
16 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, | 16 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, |
17 | BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | 17 | BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
18 | ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | 18 | ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
19 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | 19 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
20 | OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY | 20 | OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
21 | OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | 21 | OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING |
22 | IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 22 | IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
23 | */ | 23 | */ |
24 | #endregion | 24 | #endregion |
25 | 25 | ||
26 | #region CVS Information | 26 | #region CVS Information |
27 | /* | 27 | /* |
28 | * $Source$ | 28 | * $Source$ |
29 | * $Author: jendave $ | 29 | * $Author: jendave $ |
30 | * $Date: 2006-01-28 01:49:58 +0100 (lö, 28 jan 2006) $ | 30 | * $Date: 2006-01-28 01:49:58 +0100 (lö, 28 jan 2006) $ |
31 | * $Revision: 71 $ | 31 | * $Revision: 71 $ |
32 | */ | 32 | */ |
33 | #endregion | 33 | #endregion |
34 | 34 | ||
35 | using System; | 35 | using System; |
36 | using System.Collections; | 36 | using System.Collections; |
37 | using System.Collections.Specialized; | 37 | using System.Collections.Specialized; |
38 | using System.Xml; | 38 | using System.Xml; |
39 | 39 | ||
40 | using Prebuild.Core.Attributes; | 40 | using Prebuild.Core.Attributes; |
41 | using Prebuild.Core.Interfaces; | 41 | using Prebuild.Core.Interfaces; |
42 | using Prebuild.Core.Utilities; | 42 | using Prebuild.Core.Utilities; |
43 | 43 | ||
44 | namespace Prebuild.Core.Nodes | 44 | namespace Prebuild.Core.Nodes |
45 | { | 45 | { |
46 | /// <summary> | 46 | /// <summary> |
47 | /// | 47 | /// |
48 | /// </summary> | 48 | /// </summary> |
49 | [DataNode("ReferencePath")] | 49 | [DataNode("ReferencePath")] |
50 | public class ReferencePathNode : DataNode, IComparable | 50 | public class ReferencePathNode : DataNode, IComparable |
51 | { | 51 | { |
52 | #region Fields | 52 | #region Fields |
53 | 53 | ||
54 | private string m_Path; | 54 | private string m_Path; |
55 | 55 | ||
56 | #endregion | 56 | #endregion |
57 | 57 | ||
58 | #region Properties | 58 | #region Properties |
59 | 59 | ||
60 | /// <summary> | 60 | /// <summary> |
61 | /// Gets the path. | 61 | /// Gets the path. |
62 | /// </summary> | 62 | /// </summary> |
63 | /// <value>The path.</value> | 63 | /// <value>The path.</value> |
64 | public string Path | 64 | public string Path |
65 | { | 65 | { |
66 | get | 66 | get |
67 | { | 67 | { |
68 | return m_Path; | 68 | return m_Path; |
69 | } | 69 | } |
70 | } | 70 | } |
71 | 71 | ||
72 | #endregion | 72 | #endregion |
73 | 73 | ||
74 | #region Public Methods | 74 | #region Public Methods |
75 | 75 | ||
76 | /// <summary> | 76 | /// <summary> |
77 | /// Parses the specified node. | 77 | /// Parses the specified node. |
78 | /// </summary> | 78 | /// </summary> |
79 | /// <param name="node">The node.</param> | 79 | /// <param name="node">The node.</param> |
80 | public override void Parse(XmlNode node) | 80 | public override void Parse(XmlNode node) |
81 | { | 81 | { |
82 | if( node == null ) | 82 | if( node == null ) |
83 | { | 83 | { |
84 | throw new ArgumentNullException("node"); | 84 | throw new ArgumentNullException("node"); |
85 | } | 85 | } |
86 | 86 | ||
87 | m_Path = Helper.InterpolateForEnvironmentVariables(node.InnerText); | 87 | m_Path = Helper.InterpolateForEnvironmentVariables(node.InnerText); |
88 | if(m_Path == null) | 88 | if(m_Path == null) |
89 | { | 89 | { |
90 | m_Path = ""; | 90 | m_Path = ""; |
91 | } | 91 | } |
92 | 92 | ||
93 | m_Path = m_Path.Trim(); | 93 | m_Path = m_Path.Trim(); |
94 | } | 94 | } |
95 | 95 | ||
96 | #endregion | 96 | #endregion |
97 | 97 | ||
98 | #region IComparable Members | 98 | #region IComparable Members |
99 | 99 | ||
100 | public int CompareTo(object obj) | 100 | public int CompareTo(object obj) |
101 | { | 101 | { |
102 | ReferencePathNode that = (ReferencePathNode)obj; | 102 | ReferencePathNode that = (ReferencePathNode)obj; |
103 | return this.m_Path.CompareTo(that.m_Path); | 103 | return this.m_Path.CompareTo(that.m_Path); |
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 c777fa4..bbf867e 100644 --- a/Prebuild/src/Core/Nodes/SolutionNode.cs +++ b/Prebuild/src/Core/Nodes/SolutionNode.cs | |||
@@ -1,288 +1,288 @@ | |||
1 | #region BSD License | 1 | #region BSD License |
2 | /* | 2 | /* |
3 | Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) | 3 | Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) |
4 | 4 | ||
5 | Redistribution and use in source and binary forms, with or without modification, are permitted | 5 | Redistribution and use in source and binary forms, with or without modification, are permitted |
6 | provided that the following conditions are met: | 6 | provided that the following conditions are met: |
7 | 7 | ||
8 | * Redistributions of source code must retain the above copyright notice, this list of conditions | 8 | * Redistributions of source code must retain the above copyright notice, this list of conditions |
9 | and the following disclaimer. | 9 | and the following disclaimer. |
10 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions | 10 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions |
11 | and the following disclaimer in the documentation and/or other materials provided with the | 11 | and the following disclaimer in the documentation and/or other materials provided with the |
12 | distribution. | 12 | distribution. |
13 | * The name of the author may not be used to endorse or promote products derived from this software | 13 | * The name of the author may not be used to endorse or promote products derived from this software |
14 | without specific prior written permission. | 14 | without specific prior written permission. |
15 | 15 | ||
16 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, | 16 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, |
17 | BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | 17 | BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
18 | ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | 18 | ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
19 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | 19 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
20 | OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY | 20 | OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
21 | OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | 21 | OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING |
22 | IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 22 | IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
23 | */ | 23 | */ |
24 | #endregion | 24 | #endregion |
25 | 25 | ||
26 | #region CVS Information | 26 | #region CVS Information |
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-02-28 17:15:42 +0100 (ti, 28 feb 2006) $ |
31 | * $Revision: 92 $ | 31 | * $Revision: 92 $ |
32 | */ | 32 | */ |
33 | #endregion | 33 | #endregion |
34 | 34 | ||
35 | using System; | 35 | using System; |
36 | using System.Collections; | 36 | using System.Collections; |
37 | using System.Diagnostics; | 37 | using System.Diagnostics; |
38 | using System.IO; | 38 | using System.IO; |
39 | using System.Xml; | 39 | using System.Xml; |
40 | 40 | ||
41 | using Prebuild.Core.Attributes; | 41 | using Prebuild.Core.Attributes; |
42 | using Prebuild.Core.Interfaces; | 42 | using Prebuild.Core.Interfaces; |
43 | using Prebuild.Core.Utilities; | 43 | using Prebuild.Core.Utilities; |
44 | 44 | ||
45 | namespace Prebuild.Core.Nodes | 45 | namespace Prebuild.Core.Nodes |
46 | { | 46 | { |
47 | /// <summary> | 47 | /// <summary> |
48 | /// | 48 | /// |
49 | /// </summary> | 49 | /// </summary> |
50 | [DataNode("Solution")] | 50 | [DataNode("Solution")] |
51 | public class SolutionNode : DataNode | 51 | public class SolutionNode : DataNode |
52 | { | 52 | { |
53 | #region Fields | 53 | #region Fields |
54 | 54 | ||
55 | private string m_Name = "unknown"; | 55 | private string m_Name = "unknown"; |
56 | private string m_Path = ""; | 56 | private string m_Path = ""; |
57 | private string m_FullPath = ""; | 57 | private string m_FullPath = ""; |
58 | private string m_ActiveConfig = "Debug"; | 58 | private string m_ActiveConfig = "Debug"; |
59 | 59 | ||
60 | private OptionsNode m_Options; | 60 | private OptionsNode m_Options; |
61 | private FilesNode m_Files; | 61 | private FilesNode m_Files; |
62 | private Hashtable m_Configurations; | 62 | private Hashtable m_Configurations; |
63 | private Hashtable m_Projects; | 63 | private Hashtable m_Projects; |
64 | private ArrayList m_ProjectsOrder; | 64 | private ArrayList m_ProjectsOrder; |
65 | 65 | ||
66 | #endregion | 66 | #endregion |
67 | 67 | ||
68 | #region Constructors | 68 | #region Constructors |
69 | 69 | ||
70 | /// <summary> | 70 | /// <summary> |
71 | /// Initializes a new instance of the <see cref="SolutionNode"/> class. | 71 | /// Initializes a new instance of the <see cref="SolutionNode"/> class. |
72 | /// </summary> | 72 | /// </summary> |
73 | public SolutionNode() | 73 | public SolutionNode() |
74 | { | 74 | { |
75 | m_Configurations = new Hashtable(); | 75 | m_Configurations = new Hashtable(); |
76 | m_Projects = new Hashtable(); | 76 | m_Projects = new Hashtable(); |
77 | m_ProjectsOrder = new ArrayList(); | 77 | m_ProjectsOrder = new ArrayList(); |
78 | } | 78 | } |
79 | 79 | ||
80 | #endregion | 80 | #endregion |
81 | 81 | ||
82 | #region Properties | 82 | #region Properties |
83 | 83 | ||
84 | /// <summary> | 84 | /// <summary> |
85 | /// Gets or sets the active config. | 85 | /// Gets or sets the active config. |
86 | /// </summary> | 86 | /// </summary> |
87 | /// <value>The active config.</value> | 87 | /// <value>The active config.</value> |
88 | public string ActiveConfig | 88 | public string ActiveConfig |
89 | { | 89 | { |
90 | get | 90 | get |
91 | { | 91 | { |
92 | return m_ActiveConfig; | 92 | return m_ActiveConfig; |
93 | } | 93 | } |
94 | set | 94 | set |
95 | { | 95 | { |
96 | m_ActiveConfig = value; | 96 | m_ActiveConfig = value; |
97 | } | 97 | } |
98 | } | 98 | } |
99 | 99 | ||
100 | /// <summary> | 100 | /// <summary> |
101 | /// Gets the name. | 101 | /// Gets the name. |
102 | /// </summary> | 102 | /// </summary> |
103 | /// <value>The name.</value> | 103 | /// <value>The name.</value> |
104 | public string Name | 104 | public string Name |
105 | { | 105 | { |
106 | get | 106 | get |
107 | { | 107 | { |
108 | return m_Name; | 108 | return m_Name; |
109 | } | 109 | } |
110 | } | 110 | } |
111 | 111 | ||
112 | /// <summary> | 112 | /// <summary> |
113 | /// Gets the path. | 113 | /// Gets the path. |
114 | /// </summary> | 114 | /// </summary> |
115 | /// <value>The path.</value> | 115 | /// <value>The path.</value> |
116 | public string Path | 116 | public string Path |
117 | { | 117 | { |
118 | get | 118 | get |
119 | { | 119 | { |
120 | return m_Path; | 120 | return m_Path; |
121 | } | 121 | } |
122 | } | 122 | } |
123 | 123 | ||
124 | /// <summary> | 124 | /// <summary> |
125 | /// Gets the full path. | 125 | /// Gets the full path. |
126 | /// </summary> | 126 | /// </summary> |
127 | /// <value>The full path.</value> | 127 | /// <value>The full path.</value> |
128 | public string FullPath | 128 | public string FullPath |
129 | { | 129 | { |
130 | get | 130 | get |
131 | { | 131 | { |
132 | return m_FullPath; | 132 | return m_FullPath; |
133 | } | 133 | } |
134 | } | 134 | } |
135 | 135 | ||
136 | /// <summary> | 136 | /// <summary> |
137 | /// Gets the options. | 137 | /// Gets the options. |
138 | /// </summary> | 138 | /// </summary> |
139 | /// <value>The options.</value> | 139 | /// <value>The options.</value> |
140 | public OptionsNode Options | 140 | public OptionsNode Options |
141 | { | 141 | { |
142 | get | 142 | get |
143 | { | 143 | { |
144 | return m_Options; | 144 | return m_Options; |
145 | } | 145 | } |
146 | } | 146 | } |
147 | 147 | ||
148 | /// <summary> | 148 | /// <summary> |
149 | /// Gets the files. | 149 | /// Gets the files. |
150 | /// </summary> | 150 | /// </summary> |
151 | /// <value>The files.</value> | 151 | /// <value>The files.</value> |
152 | public FilesNode Files | 152 | public FilesNode Files |
153 | { | 153 | { |
154 | get | 154 | get |
155 | { | 155 | { |
156 | return m_Files; | 156 | return m_Files; |
157 | } | 157 | } |
158 | } | 158 | } |
159 | 159 | ||
160 | /// <summary> | 160 | /// <summary> |
161 | /// Gets the configurations. | 161 | /// Gets the configurations. |
162 | /// </summary> | 162 | /// </summary> |
163 | /// <value>The configurations.</value> | 163 | /// <value>The configurations.</value> |
164 | public ICollection Configurations | 164 | public ICollection Configurations |
165 | { | 165 | { |
166 | get | 166 | get |
167 | { | 167 | { |
168 | ArrayList tmp = new ArrayList(ConfigurationsTable.Values); | 168 | ArrayList tmp = new ArrayList(ConfigurationsTable.Values); |
169 | tmp.Sort(); | 169 | tmp.Sort(); |
170 | return tmp; | 170 | return tmp; |
171 | } | 171 | } |
172 | } | 172 | } |
173 | 173 | ||
174 | /// <summary> | 174 | /// <summary> |
175 | /// Gets the configurations table. | 175 | /// Gets the configurations table. |
176 | /// </summary> | 176 | /// </summary> |
177 | /// <value>The configurations table.</value> | 177 | /// <value>The configurations table.</value> |
178 | public Hashtable ConfigurationsTable | 178 | public Hashtable ConfigurationsTable |
179 | { | 179 | { |
180 | get | 180 | get |
181 | { | 181 | { |
182 | return m_Configurations; | 182 | return m_Configurations; |
183 | } | 183 | } |
184 | } | 184 | } |
185 | 185 | ||
186 | /// <summary> | 186 | /// <summary> |
187 | /// Gets the projects. | 187 | /// Gets the projects. |
188 | /// </summary> | 188 | /// </summary> |
189 | /// <value>The projects.</value> | 189 | /// <value>The projects.</value> |
190 | public ICollection Projects | 190 | public ICollection Projects |
191 | { | 191 | { |
192 | get | 192 | get |
193 | { | 193 | { |
194 | ArrayList tmp = new ArrayList(m_Projects.Values); | 194 | ArrayList tmp = new ArrayList(m_Projects.Values); |
195 | tmp.Sort(); | 195 | tmp.Sort(); |
196 | return tmp; | 196 | return tmp; |
197 | } | 197 | } |
198 | } | 198 | } |
199 | 199 | ||
200 | /// <summary> | 200 | /// <summary> |
201 | /// Gets the projects table. | 201 | /// Gets the projects table. |
202 | /// </summary> | 202 | /// </summary> |
203 | /// <value>The projects table.</value> | 203 | /// <value>The projects table.</value> |
204 | public Hashtable ProjectsTable | 204 | public Hashtable ProjectsTable |
205 | { | 205 | { |
206 | get | 206 | get |
207 | { | 207 | { |
208 | return m_Projects; | 208 | return m_Projects; |
209 | } | 209 | } |
210 | } | 210 | } |
211 | 211 | ||
212 | /// <summary> | 212 | /// <summary> |
213 | /// Gets the projects table. | 213 | /// Gets the projects table. |
214 | /// </summary> | 214 | /// </summary> |
215 | /// <value>The projects table.</value> | 215 | /// <value>The projects table.</value> |
216 | public ArrayList ProjectsTableOrder | 216 | public ArrayList ProjectsTableOrder |
217 | { | 217 | { |
218 | get | 218 | get |
219 | { | 219 | { |
220 | return m_ProjectsOrder; | 220 | return m_ProjectsOrder; |
221 | } | 221 | } |
222 | } | 222 | } |
223 | 223 | ||
224 | #endregion | 224 | #endregion |
225 | 225 | ||
226 | #region Public Methods | 226 | #region Public Methods |
227 | 227 | ||
228 | /// <summary> | 228 | /// <summary> |
229 | /// Parses the specified node. | 229 | /// Parses the specified node. |
230 | /// </summary> | 230 | /// </summary> |
231 | /// <param name="node">The node.</param> | 231 | /// <param name="node">The node.</param> |
232 | public override void Parse(XmlNode node) | 232 | public override void Parse(XmlNode node) |
233 | { | 233 | { |
234 | m_Name = Helper.AttributeValue(node, "name", m_Name); | 234 | m_Name = Helper.AttributeValue(node, "name", m_Name); |
235 | m_ActiveConfig = Helper.AttributeValue(node, "activeConfig", m_ActiveConfig); | 235 | m_ActiveConfig = Helper.AttributeValue(node, "activeConfig", m_ActiveConfig); |
236 | m_Path = Helper.AttributeValue(node, "path", m_Path); | 236 | m_Path = Helper.AttributeValue(node, "path", m_Path); |
237 | 237 | ||
238 | m_FullPath = m_Path; | 238 | m_FullPath = m_Path; |
239 | try | 239 | try |
240 | { | 240 | { |
241 | m_FullPath = Helper.ResolvePath(m_FullPath); | 241 | m_FullPath = Helper.ResolvePath(m_FullPath); |
242 | } | 242 | } |
243 | catch | 243 | catch |
244 | { | 244 | { |
245 | throw new WarningException("Could not resolve solution path: {0}", m_Path); | 245 | throw new WarningException("Could not resolve solution path: {0}", m_Path); |
246 | } | 246 | } |
247 | 247 | ||
248 | Kernel.Instance.CurrentWorkingDirectory.Push(); | 248 | Kernel.Instance.CurrentWorkingDirectory.Push(); |
249 | try | 249 | try |
250 | { | 250 | { |
251 | Helper.SetCurrentDir(m_FullPath); | 251 | Helper.SetCurrentDir(m_FullPath); |
252 | 252 | ||
253 | if( node == null ) | 253 | if( node == null ) |
254 | { | 254 | { |
255 | throw new ArgumentNullException("node"); | 255 | throw new ArgumentNullException("node"); |
256 | } | 256 | } |
257 | 257 | ||
258 | foreach(XmlNode child in node.ChildNodes) | 258 | foreach(XmlNode child in node.ChildNodes) |
259 | { | 259 | { |
260 | IDataNode dataNode = Kernel.Instance.ParseNode(child, this); | 260 | IDataNode dataNode = Kernel.Instance.ParseNode(child, this); |
261 | if(dataNode is OptionsNode) | 261 | if(dataNode is OptionsNode) |
262 | { | 262 | { |
263 | m_Options = (OptionsNode)dataNode; | 263 | m_Options = (OptionsNode)dataNode; |
264 | } | 264 | } |
265 | else if(dataNode is FilesNode) | 265 | else if(dataNode is FilesNode) |
266 | { | 266 | { |
267 | m_Files = (FilesNode)dataNode; | 267 | m_Files = (FilesNode)dataNode; |
268 | } | 268 | } |
269 | else if(dataNode is ConfigurationNode) | 269 | else if(dataNode is ConfigurationNode) |
270 | { | 270 | { |
271 | m_Configurations[((ConfigurationNode)dataNode).Name] = dataNode; | 271 | m_Configurations[((ConfigurationNode)dataNode).Name] = dataNode; |
272 | } | 272 | } |
273 | else if(dataNode is ProjectNode) | 273 | else if(dataNode is ProjectNode) |
274 | { | 274 | { |
275 | m_Projects[((ProjectNode)dataNode).Name] = dataNode; | 275 | m_Projects[((ProjectNode)dataNode).Name] = dataNode; |
276 | m_ProjectsOrder.Add(dataNode); | 276 | m_ProjectsOrder.Add(dataNode); |
277 | } | 277 | } |
278 | } | 278 | } |
279 | } | 279 | } |
280 | finally | 280 | finally |
281 | { | 281 | { |
282 | Kernel.Instance.CurrentWorkingDirectory.Pop(); | 282 | Kernel.Instance.CurrentWorkingDirectory.Pop(); |
283 | } | 283 | } |
284 | } | 284 | } |
285 | 285 | ||
286 | #endregion | 286 | #endregion |
287 | } | 287 | } |
288 | } | 288 | } |
diff --git a/Prebuild/src/Core/Parse/IfContext.cs b/Prebuild/src/Core/Parse/IfContext.cs index 383049d..6311f47 100644 --- a/Prebuild/src/Core/Parse/IfContext.cs +++ b/Prebuild/src/Core/Parse/IfContext.cs | |||
@@ -1,163 +1,163 @@ | |||
1 | #region BSD License | 1 | #region BSD License |
2 | /* | 2 | /* |
3 | Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) | 3 | Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) |
4 | 4 | ||
5 | Redistribution and use in source and binary forms, with or without modification, are permitted | 5 | Redistribution and use in source and binary forms, with or without modification, are permitted |
6 | provided that the following conditions are met: | 6 | provided that the following conditions are met: |
7 | 7 | ||
8 | * Redistributions of source code must retain the above copyright notice, this list of conditions | 8 | * Redistributions of source code must retain the above copyright notice, this list of conditions |
9 | and the following disclaimer. | 9 | and the following disclaimer. |
10 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions | 10 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions |
11 | and the following disclaimer in the documentation and/or other materials provided with the | 11 | and the following disclaimer in the documentation and/or other materials provided with the |
12 | distribution. | 12 | distribution. |
13 | * The name of the author may not be used to endorse or promote products derived from this software | 13 | * The name of the author may not be used to endorse or promote products derived from this software |
14 | without specific prior written permission. | 14 | without specific prior written permission. |
15 | 15 | ||
16 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, | 16 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, |
17 | BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | 17 | BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
18 | ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | 18 | ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
19 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | 19 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
20 | OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY | 20 | OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
21 | OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | 21 | OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING |
22 | IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 22 | IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
23 | */ | 23 | */ |
24 | #endregion | 24 | #endregion |
25 | 25 | ||
26 | #region CVS Information | 26 | #region CVS Information |
27 | /* | 27 | /* |
28 | * $Source$ | 28 | * $Source$ |
29 | * $Author: jendave $ | 29 | * $Author: jendave $ |
30 | * $Date: 2006-01-28 01:49:58 +0100 (lö, 28 jan 2006) $ | 30 | * $Date: 2006-01-28 01:49:58 +0100 (lö, 28 jan 2006) $ |
31 | * $Revision: 71 $ | 31 | * $Revision: 71 $ |
32 | */ | 32 | */ |
33 | #endregion | 33 | #endregion |
34 | 34 | ||
35 | using System; | 35 | using System; |
36 | 36 | ||
37 | namespace Prebuild.Core.Parse | 37 | namespace Prebuild.Core.Parse |
38 | { | 38 | { |
39 | /// <summary> | 39 | /// <summary> |
40 | /// | 40 | /// |
41 | /// </summary> | 41 | /// </summary> |
42 | public enum IfState | 42 | public enum IfState |
43 | { | 43 | { |
44 | /// <summary> | 44 | /// <summary> |
45 | /// | 45 | /// |
46 | /// </summary> | 46 | /// </summary> |
47 | None, | 47 | None, |
48 | /// <summary> | 48 | /// <summary> |
49 | /// | 49 | /// |
50 | /// </summary> | 50 | /// </summary> |
51 | If, | 51 | If, |
52 | /// <summary> | 52 | /// <summary> |
53 | /// | 53 | /// |
54 | /// </summary> | 54 | /// </summary> |
55 | ElseIf, | 55 | ElseIf, |
56 | /// <summary> | 56 | /// <summary> |
57 | /// | 57 | /// |
58 | /// </summary> | 58 | /// </summary> |
59 | Else | 59 | Else |
60 | } | 60 | } |
61 | 61 | ||
62 | /// <summary> | 62 | /// <summary> |
63 | /// Summary description for IfContext. | 63 | /// Summary description for IfContext. |
64 | /// </summary> | 64 | /// </summary> |
65 | // Inspired by the equivalent WiX class (see www.sourceforge.net/projects/wix/) | 65 | // Inspired by the equivalent WiX class (see www.sourceforge.net/projects/wix/) |
66 | public class IfContext | 66 | public class IfContext |
67 | { | 67 | { |
68 | #region Properties | 68 | #region Properties |
69 | 69 | ||
70 | bool m_Active; | 70 | bool m_Active; |
71 | bool m_Keep; | 71 | bool m_Keep; |
72 | bool m_EverKept; | 72 | bool m_EverKept; |
73 | IfState m_State = IfState.None; | 73 | IfState m_State = IfState.None; |
74 | 74 | ||
75 | #endregion | 75 | #endregion |
76 | 76 | ||
77 | #region Constructors | 77 | #region Constructors |
78 | 78 | ||
79 | /// <summary> | 79 | /// <summary> |
80 | /// Initializes a new instance of the <see cref="IfContext"/> class. | 80 | /// Initializes a new instance of the <see cref="IfContext"/> class. |
81 | /// </summary> | 81 | /// </summary> |
82 | /// <param name="active">if set to <c>true</c> [active].</param> | 82 | /// <param name="active">if set to <c>true</c> [active].</param> |
83 | /// <param name="keep">if set to <c>true</c> [keep].</param> | 83 | /// <param name="keep">if set to <c>true</c> [keep].</param> |
84 | /// <param name="state">The state.</param> | 84 | /// <param name="state">The state.</param> |
85 | public IfContext(bool active, bool keep, IfState state) | 85 | public IfContext(bool active, bool keep, IfState state) |
86 | { | 86 | { |
87 | m_Active = active; | 87 | m_Active = active; |
88 | m_Keep = keep; | 88 | m_Keep = keep; |
89 | m_EverKept = keep; | 89 | m_EverKept = keep; |
90 | m_State = state; | 90 | m_State = state; |
91 | } | 91 | } |
92 | 92 | ||
93 | #endregion | 93 | #endregion |
94 | 94 | ||
95 | #region Properties | 95 | #region Properties |
96 | 96 | ||
97 | /// <summary> | 97 | /// <summary> |
98 | /// Gets or sets a value indicating whether this <see cref="IfContext"/> is active. | 98 | /// Gets or sets a value indicating whether this <see cref="IfContext"/> is active. |
99 | /// </summary> | 99 | /// </summary> |
100 | /// <value><c>true</c> if active; otherwise, <c>false</c>.</value> | 100 | /// <value><c>true</c> if active; otherwise, <c>false</c>.</value> |
101 | public bool Active | 101 | public bool Active |
102 | { | 102 | { |
103 | get | 103 | get |
104 | { | 104 | { |
105 | return m_Active; | 105 | return m_Active; |
106 | } | 106 | } |
107 | set | 107 | set |
108 | { | 108 | { |
109 | m_Active = value; | 109 | m_Active = value; |
110 | } | 110 | } |
111 | } | 111 | } |
112 | 112 | ||
113 | /// <summary> | 113 | /// <summary> |
114 | /// Gets or sets a value indicating whether this <see cref="IfContext"/> is keep. | 114 | /// Gets or sets a value indicating whether this <see cref="IfContext"/> is keep. |
115 | /// </summary> | 115 | /// </summary> |
116 | /// <value><c>true</c> if keep; otherwise, <c>false</c>.</value> | 116 | /// <value><c>true</c> if keep; otherwise, <c>false</c>.</value> |
117 | public bool Keep | 117 | public bool Keep |
118 | { | 118 | { |
119 | get | 119 | get |
120 | { | 120 | { |
121 | return m_Keep; | 121 | return m_Keep; |
122 | } | 122 | } |
123 | set | 123 | set |
124 | { | 124 | { |
125 | m_Keep = value; | 125 | m_Keep = value; |
126 | if(m_Keep) | 126 | if(m_Keep) |
127 | { | 127 | { |
128 | m_EverKept = true; | 128 | m_EverKept = true; |
129 | } | 129 | } |
130 | } | 130 | } |
131 | } | 131 | } |
132 | 132 | ||
133 | /// <summary> | 133 | /// <summary> |
134 | /// Gets a value indicating whether [ever kept]. | 134 | /// Gets a value indicating whether [ever kept]. |
135 | /// </summary> | 135 | /// </summary> |
136 | /// <value><c>true</c> if [ever kept]; otherwise, <c>false</c>.</value> | 136 | /// <value><c>true</c> if [ever kept]; otherwise, <c>false</c>.</value> |
137 | public bool EverKept | 137 | public bool EverKept |
138 | { | 138 | { |
139 | get | 139 | get |
140 | { | 140 | { |
141 | return m_EverKept; | 141 | return m_EverKept; |
142 | } | 142 | } |
143 | } | 143 | } |
144 | 144 | ||
145 | /// <summary> | 145 | /// <summary> |
146 | /// Gets or sets the state. | 146 | /// Gets or sets the state. |
147 | /// </summary> | 147 | /// </summary> |
148 | /// <value>The state.</value> | 148 | /// <value>The state.</value> |
149 | public IfState State | 149 | public IfState State |
150 | { | 150 | { |
151 | get | 151 | get |
152 | { | 152 | { |
153 | return m_State; | 153 | return m_State; |
154 | } | 154 | } |
155 | set | 155 | set |
156 | { | 156 | { |
157 | m_State = value; | 157 | m_State = value; |
158 | } | 158 | } |
159 | } | 159 | } |
160 | 160 | ||
161 | #endregion | 161 | #endregion |
162 | } | 162 | } |
163 | } | 163 | } |
diff --git a/Prebuild/src/Core/Parse/Preprocessor.cs b/Prebuild/src/Core/Parse/Preprocessor.cs index 85e92c3..c4e1e61 100644 --- a/Prebuild/src/Core/Parse/Preprocessor.cs +++ b/Prebuild/src/Core/Parse/Preprocessor.cs | |||
@@ -1,519 +1,519 @@ | |||
1 | #region BSD License | 1 | #region BSD License |
2 | /* | 2 | /* |
3 | Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) | 3 | Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) |
4 | 4 | ||
5 | Redistribution and use in source and binary forms, with or without modification, are permitted | 5 | Redistribution and use in source and binary forms, with or without modification, are permitted |
6 | provided that the following conditions are met: | 6 | provided that the following conditions are met: |
7 | 7 | ||
8 | * Redistributions of source code must retain the above copyright notice, this list of conditions | 8 | * Redistributions of source code must retain the above copyright notice, this list of conditions |
9 | and the following disclaimer. | 9 | and the following disclaimer. |
10 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions | 10 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions |
11 | and the following disclaimer in the documentation and/or other materials provided with the | 11 | and the following disclaimer in the documentation and/or other materials provided with the |
12 | distribution. | 12 | distribution. |
13 | * The name of the author may not be used to endorse or promote products derived from this software | 13 | * The name of the author may not be used to endorse or promote products derived from this software |
14 | without specific prior written permission. | 14 | without specific prior written permission. |
15 | 15 | ||
16 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, | 16 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, |
17 | BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | 17 | BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
18 | ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | 18 | ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
19 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | 19 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
20 | OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY | 20 | OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
21 | OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | 21 | OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING |
22 | IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 22 | IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
23 | */ | 23 | */ |
24 | #endregion | 24 | #endregion |
25 | 25 | ||
26 | #region CVS Information | 26 | #region CVS Information |
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: 2006-09-01 19:55:06 +0200 (fr, 01 sep 2006) $ |
31 | * $Revision: 147 $ | 31 | * $Revision: 147 $ |
32 | */ | 32 | */ |
33 | #endregion | 33 | #endregion |
34 | 34 | ||
35 | using System; | 35 | using System; |
36 | using System.Collections; | 36 | using System.Collections; |
37 | using System.IO; | 37 | using System.IO; |
38 | using System.Xml; | 38 | using System.Xml; |
39 | 39 | ||
40 | namespace Prebuild.Core.Parse | 40 | namespace Prebuild.Core.Parse |
41 | { | 41 | { |
42 | /// <summary> | 42 | /// <summary> |
43 | /// | 43 | /// |
44 | /// </summary> | 44 | /// </summary> |
45 | public enum OperatorSymbol | 45 | public enum OperatorSymbol |
46 | { | 46 | { |
47 | /// <summary> | 47 | /// <summary> |
48 | /// | 48 | /// |
49 | /// </summary> | 49 | /// </summary> |
50 | None, | 50 | None, |
51 | /// <summary> | 51 | /// <summary> |
52 | /// | 52 | /// |
53 | /// </summary> | 53 | /// </summary> |
54 | Equal, | 54 | Equal, |
55 | /// <summary> | 55 | /// <summary> |
56 | /// | 56 | /// |
57 | /// </summary> | 57 | /// </summary> |
58 | NotEqual, | 58 | NotEqual, |
59 | /// <summary> | 59 | /// <summary> |
60 | /// | 60 | /// |
61 | /// </summary> | 61 | /// </summary> |
62 | LessThan, | 62 | LessThan, |
63 | /// <summary> | 63 | /// <summary> |
64 | /// | 64 | /// |
65 | /// </summary> | 65 | /// </summary> |
66 | GreaterThan, | 66 | GreaterThan, |
67 | /// <summary> | 67 | /// <summary> |
68 | /// | 68 | /// |
69 | /// </summary> | 69 | /// </summary> |
70 | LessThanEqual, | 70 | LessThanEqual, |
71 | /// <summary> | 71 | /// <summary> |
72 | /// | 72 | /// |
73 | /// </summary> | 73 | /// </summary> |
74 | GreaterThanEqual | 74 | GreaterThanEqual |
75 | } | 75 | } |
76 | 76 | ||
77 | /// <summary> | 77 | /// <summary> |
78 | /// | 78 | /// |
79 | /// </summary> | 79 | /// </summary> |
80 | public class Preprocessor | 80 | public class Preprocessor |
81 | { | 81 | { |
82 | #region Fields | 82 | #region Fields |
83 | 83 | ||
84 | XmlDocument m_OutDoc; | 84 | XmlDocument m_OutDoc; |
85 | Stack m_IfStack; | 85 | Stack m_IfStack; |
86 | Hashtable m_Variables; | 86 | Hashtable m_Variables; |
87 | 87 | ||
88 | #endregion | 88 | #endregion |
89 | 89 | ||
90 | #region Constructors | 90 | #region Constructors |
91 | 91 | ||
92 | /// <summary> | 92 | /// <summary> |
93 | /// Initializes a new instance of the <see cref="Preprocessor"/> class. | 93 | /// Initializes a new instance of the <see cref="Preprocessor"/> class. |
94 | /// </summary> | 94 | /// </summary> |
95 | public Preprocessor() | 95 | public Preprocessor() |
96 | { | 96 | { |
97 | m_OutDoc = new XmlDocument(); | 97 | m_OutDoc = new XmlDocument(); |
98 | m_IfStack = new Stack(); | 98 | m_IfStack = new Stack(); |
99 | m_Variables = new Hashtable(); | 99 | m_Variables = new Hashtable(); |
100 | 100 | ||
101 | RegisterVariable("OS", GetOS()); | 101 | RegisterVariable("OS", GetOS()); |
102 | RegisterVariable("RuntimeVersion", Environment.Version.Major); | 102 | RegisterVariable("RuntimeVersion", Environment.Version.Major); |
103 | RegisterVariable("RuntimeMajor", Environment.Version.Major); | 103 | RegisterVariable("RuntimeMajor", Environment.Version.Major); |
104 | RegisterVariable("RuntimeMinor", Environment.Version.Minor); | 104 | RegisterVariable("RuntimeMinor", Environment.Version.Minor); |
105 | RegisterVariable("RuntimeRevision", Environment.Version.Revision); | 105 | RegisterVariable("RuntimeRevision", Environment.Version.Revision); |
106 | } | 106 | } |
107 | 107 | ||
108 | #endregion | 108 | #endregion |
109 | 109 | ||
110 | #region Properties | 110 | #region Properties |
111 | 111 | ||
112 | /// <summary> | 112 | /// <summary> |
113 | /// Gets the processed doc. | 113 | /// Gets the processed doc. |
114 | /// </summary> | 114 | /// </summary> |
115 | /// <value>The processed doc.</value> | 115 | /// <value>The processed doc.</value> |
116 | public XmlDocument ProcessedDoc | 116 | public XmlDocument ProcessedDoc |
117 | { | 117 | { |
118 | get | 118 | get |
119 | { | 119 | { |
120 | return m_OutDoc; | 120 | return m_OutDoc; |
121 | } | 121 | } |
122 | } | 122 | } |
123 | 123 | ||
124 | #endregion | 124 | #endregion |
125 | 125 | ||
126 | #region Private Methods | 126 | #region Private Methods |
127 | 127 | ||
128 | /// <summary> | 128 | /// <summary> |
129 | /// Parts of this code were taken from NAnt and is subject to the GPL | 129 | /// Parts of this code were taken from NAnt and is subject to the GPL |
130 | /// as per NAnt's license. Thanks to the NAnt guys for this little gem. | 130 | /// as per NAnt's license. Thanks to the NAnt guys for this little gem. |
131 | /// </summary> | 131 | /// </summary> |
132 | /// <returns></returns> | 132 | /// <returns></returns> |
133 | public static string GetOS() | 133 | public static string GetOS() |
134 | { | 134 | { |
135 | PlatformID platId = Environment.OSVersion.Platform; | 135 | PlatformID platId = Environment.OSVersion.Platform; |
136 | if(platId == PlatformID.Win32NT || platId == PlatformID.Win32Windows) | 136 | if(platId == PlatformID.Win32NT || platId == PlatformID.Win32Windows) |
137 | { | 137 | { |
138 | return "Win32"; | 138 | return "Win32"; |
139 | } | 139 | } |
140 | 140 | ||
141 | /* | 141 | /* |
142 | * .NET 1.x, under Mono, the UNIX code is 128. Under | 142 | * .NET 1.x, under Mono, the UNIX code is 128. Under |
143 | * .NET 2.x, Mono or MS, the UNIX code is 4 | 143 | * .NET 2.x, Mono or MS, the UNIX code is 4 |
144 | */ | 144 | */ |
145 | if(Environment.Version.Major == 1) | 145 | if(Environment.Version.Major == 1) |
146 | { | 146 | { |
147 | if((int)platId == 128) | 147 | if((int)platId == 128) |
148 | { | 148 | { |
149 | return "UNIX"; | 149 | return "UNIX"; |
150 | } | 150 | } |
151 | } | 151 | } |
152 | else if((int)platId == 4) | 152 | else if((int)platId == 4) |
153 | { | 153 | { |
154 | return "UNIX"; | 154 | return "UNIX"; |
155 | } | 155 | } |
156 | 156 | ||
157 | return "Unknown"; | 157 | return "Unknown"; |
158 | } | 158 | } |
159 | 159 | ||
160 | private static bool CompareNum(OperatorSymbol oper, int val1, int val2) | 160 | private static bool CompareNum(OperatorSymbol oper, int val1, int val2) |
161 | { | 161 | { |
162 | switch(oper) | 162 | switch(oper) |
163 | { | 163 | { |
164 | case OperatorSymbol.Equal: | 164 | case OperatorSymbol.Equal: |
165 | return (val1 == val2); | 165 | return (val1 == val2); |
166 | case OperatorSymbol.NotEqual: | 166 | case OperatorSymbol.NotEqual: |
167 | return (val1 != val2); | 167 | return (val1 != val2); |
168 | case OperatorSymbol.LessThan: | 168 | case OperatorSymbol.LessThan: |
169 | return (val1 < val2); | 169 | return (val1 < val2); |
170 | case OperatorSymbol.LessThanEqual: | 170 | case OperatorSymbol.LessThanEqual: |
171 | return (val1 <= val2); | 171 | return (val1 <= val2); |
172 | case OperatorSymbol.GreaterThan: | 172 | case OperatorSymbol.GreaterThan: |
173 | return (val1 > val2); | 173 | return (val1 > val2); |
174 | case OperatorSymbol.GreaterThanEqual: | 174 | case OperatorSymbol.GreaterThanEqual: |
175 | return (val1 >= val2); | 175 | return (val1 >= val2); |
176 | } | 176 | } |
177 | 177 | ||
178 | throw new WarningException("Unknown operator type"); | 178 | throw new WarningException("Unknown operator type"); |
179 | } | 179 | } |
180 | 180 | ||
181 | private static bool CompareStr(OperatorSymbol oper, string val1, string val2) | 181 | private static bool CompareStr(OperatorSymbol oper, string val1, string val2) |
182 | { | 182 | { |
183 | switch(oper) | 183 | switch(oper) |
184 | { | 184 | { |
185 | case OperatorSymbol.Equal: | 185 | case OperatorSymbol.Equal: |
186 | return (val1 == val2); | 186 | return (val1 == val2); |
187 | case OperatorSymbol.NotEqual: | 187 | case OperatorSymbol.NotEqual: |
188 | return (val1 != val2); | 188 | return (val1 != val2); |
189 | case OperatorSymbol.LessThan: | 189 | case OperatorSymbol.LessThan: |
190 | return (val1.CompareTo(val2) < 0); | 190 | return (val1.CompareTo(val2) < 0); |
191 | case OperatorSymbol.LessThanEqual: | 191 | case OperatorSymbol.LessThanEqual: |
192 | return (val1.CompareTo(val2) <= 0); | 192 | return (val1.CompareTo(val2) <= 0); |
193 | case OperatorSymbol.GreaterThan: | 193 | case OperatorSymbol.GreaterThan: |
194 | return (val1.CompareTo(val2) > 0); | 194 | return (val1.CompareTo(val2) > 0); |
195 | case OperatorSymbol.GreaterThanEqual: | 195 | case OperatorSymbol.GreaterThanEqual: |
196 | return (val1.CompareTo(val2) >= 0); | 196 | return (val1.CompareTo(val2) >= 0); |
197 | } | 197 | } |
198 | 198 | ||
199 | throw new WarningException("Unknown operator type"); | 199 | throw new WarningException("Unknown operator type"); |
200 | } | 200 | } |
201 | 201 | ||
202 | private static char NextChar(int idx, string str) | 202 | private static char NextChar(int idx, string str) |
203 | { | 203 | { |
204 | if((idx + 1) >= str.Length) | 204 | if((idx + 1) >= str.Length) |
205 | { | 205 | { |
206 | return Char.MaxValue; | 206 | return Char.MaxValue; |
207 | } | 207 | } |
208 | 208 | ||
209 | return str[idx + 1]; | 209 | return str[idx + 1]; |
210 | } | 210 | } |
211 | // Very very simple expression parser. Can only match expressions of the form | 211 | // Very very simple expression parser. Can only match expressions of the form |
212 | // <var> <op> <value>: | 212 | // <var> <op> <value>: |
213 | // OS = Windows | 213 | // OS = Windows |
214 | // OS != Linux | 214 | // OS != Linux |
215 | // RuntimeMinor > 0 | 215 | // RuntimeMinor > 0 |
216 | private bool ParseExpression(string exp) | 216 | private bool ParseExpression(string exp) |
217 | { | 217 | { |
218 | if(exp == null) | 218 | if(exp == null) |
219 | { | 219 | { |
220 | throw new ArgumentException("Invalid expression, cannot be null"); | 220 | throw new ArgumentException("Invalid expression, cannot be null"); |
221 | } | 221 | } |
222 | 222 | ||
223 | exp = exp.Trim(); | 223 | exp = exp.Trim(); |
224 | if(exp.Length < 1) | 224 | if(exp.Length < 1) |
225 | { | 225 | { |
226 | throw new ArgumentException("Invalid expression, cannot be 0 length"); | 226 | throw new ArgumentException("Invalid expression, cannot be 0 length"); |
227 | } | 227 | } |
228 | 228 | ||
229 | string id = ""; | 229 | string id = ""; |
230 | string str = ""; | 230 | string str = ""; |
231 | OperatorSymbol oper = OperatorSymbol.None; | 231 | OperatorSymbol oper = OperatorSymbol.None; |
232 | bool inStr = false; | 232 | bool inStr = false; |
233 | char c; | 233 | char c; |
234 | 234 | ||
235 | for(int i = 0; i < exp.Length; i++) | 235 | for(int i = 0; i < exp.Length; i++) |
236 | { | 236 | { |
237 | c = exp[i]; | 237 | c = exp[i]; |
238 | if(Char.IsWhiteSpace(c)) | 238 | if(Char.IsWhiteSpace(c)) |
239 | { | 239 | { |
240 | continue; | 240 | continue; |
241 | } | 241 | } |
242 | 242 | ||
243 | if(Char.IsLetterOrDigit(c) || c == '_') | 243 | if(Char.IsLetterOrDigit(c) || c == '_') |
244 | { | 244 | { |
245 | if(inStr) | 245 | if(inStr) |
246 | { | 246 | { |
247 | str += c; | 247 | str += c; |
248 | } | 248 | } |
249 | else | 249 | else |
250 | { | 250 | { |
251 | id += c; | 251 | id += c; |
252 | } | 252 | } |
253 | } | 253 | } |
254 | else if(c == '\"') | 254 | else if(c == '\"') |
255 | { | 255 | { |
256 | inStr = !inStr; | 256 | inStr = !inStr; |
257 | if(inStr) | 257 | if(inStr) |
258 | { | 258 | { |
259 | str = ""; | 259 | str = ""; |
260 | } | 260 | } |
261 | } | 261 | } |
262 | else | 262 | else |
263 | { | 263 | { |
264 | if(inStr) | 264 | if(inStr) |
265 | { | 265 | { |
266 | str += c; | 266 | str += c; |
267 | } | 267 | } |
268 | else | 268 | else |
269 | { | 269 | { |
270 | switch(c) | 270 | switch(c) |
271 | { | 271 | { |
272 | case '=': | 272 | case '=': |
273 | oper = OperatorSymbol.Equal; | 273 | oper = OperatorSymbol.Equal; |
274 | break; | 274 | break; |
275 | 275 | ||
276 | case '!': | 276 | case '!': |
277 | if(NextChar(i, exp) == '=') | 277 | if(NextChar(i, exp) == '=') |
278 | { | 278 | { |
279 | oper = OperatorSymbol.NotEqual; | 279 | oper = OperatorSymbol.NotEqual; |
280 | } | 280 | } |
281 | 281 | ||
282 | break; | 282 | break; |
283 | 283 | ||
284 | case '<': | 284 | case '<': |
285 | if(NextChar(i, exp) == '=') | 285 | if(NextChar(i, exp) == '=') |
286 | { | 286 | { |
287 | oper = OperatorSymbol.LessThanEqual; | 287 | oper = OperatorSymbol.LessThanEqual; |
288 | } | 288 | } |
289 | else | 289 | else |
290 | { | 290 | { |
291 | oper = OperatorSymbol.LessThan; | 291 | oper = OperatorSymbol.LessThan; |
292 | } | 292 | } |
293 | 293 | ||
294 | break; | 294 | break; |
295 | 295 | ||
296 | case '>': | 296 | case '>': |
297 | if(NextChar(i, exp) == '=') | 297 | if(NextChar(i, exp) == '=') |
298 | { | 298 | { |
299 | oper = OperatorSymbol.GreaterThanEqual; | 299 | oper = OperatorSymbol.GreaterThanEqual; |
300 | } | 300 | } |
301 | else | 301 | else |
302 | { | 302 | { |
303 | oper = OperatorSymbol.GreaterThan; | 303 | oper = OperatorSymbol.GreaterThan; |
304 | } | 304 | } |
305 | 305 | ||
306 | break; | 306 | break; |
307 | } | 307 | } |
308 | } | 308 | } |
309 | } | 309 | } |
310 | } | 310 | } |
311 | 311 | ||
312 | 312 | ||
313 | if(inStr) | 313 | if(inStr) |
314 | { | 314 | { |
315 | throw new WarningException("Expected end of string in expression"); | 315 | throw new WarningException("Expected end of string in expression"); |
316 | } | 316 | } |
317 | 317 | ||
318 | if(oper == OperatorSymbol.None) | 318 | if(oper == OperatorSymbol.None) |
319 | { | 319 | { |
320 | throw new WarningException("Expected operator in expression"); | 320 | throw new WarningException("Expected operator in expression"); |
321 | } | 321 | } |
322 | else if(id.Length < 1) | 322 | else if(id.Length < 1) |
323 | { | 323 | { |
324 | throw new WarningException("Expected identifier in expression"); | 324 | throw new WarningException("Expected identifier in expression"); |
325 | } | 325 | } |
326 | else if(str.Length < 1) | 326 | else if(str.Length < 1) |
327 | { | 327 | { |
328 | throw new WarningException("Expected value in expression"); | 328 | throw new WarningException("Expected value in expression"); |
329 | } | 329 | } |
330 | 330 | ||
331 | bool ret = false; | 331 | bool ret = false; |
332 | try | 332 | try |
333 | { | 333 | { |
334 | object val = m_Variables[id.ToLower()]; | 334 | object val = m_Variables[id.ToLower()]; |
335 | if(val == null) | 335 | if(val == null) |
336 | { | 336 | { |
337 | throw new WarningException("Unknown identifier '{0}'", id); | 337 | throw new WarningException("Unknown identifier '{0}'", id); |
338 | } | 338 | } |
339 | 339 | ||
340 | int numVal, numVal2; | 340 | int numVal, numVal2; |
341 | string strVal, strVal2; | 341 | string strVal, strVal2; |
342 | Type t = val.GetType(); | 342 | Type t = val.GetType(); |
343 | if(t.IsAssignableFrom(typeof(int))) | 343 | if(t.IsAssignableFrom(typeof(int))) |
344 | { | 344 | { |
345 | numVal = (int)val; | 345 | numVal = (int)val; |
346 | numVal2 = Int32.Parse(str); | 346 | numVal2 = Int32.Parse(str); |
347 | ret = CompareNum(oper, numVal, numVal2); | 347 | ret = CompareNum(oper, numVal, numVal2); |
348 | } | 348 | } |
349 | else | 349 | else |
350 | { | 350 | { |
351 | strVal = val.ToString(); | 351 | strVal = val.ToString(); |
352 | strVal2 = str; | 352 | strVal2 = str; |
353 | ret = CompareStr(oper, strVal, strVal2); | 353 | ret = CompareStr(oper, strVal, strVal2); |
354 | } | 354 | } |
355 | } | 355 | } |
356 | catch(ArgumentException ex) | 356 | catch(ArgumentException ex) |
357 | { | 357 | { |
358 | ex.ToString(); | 358 | ex.ToString(); |
359 | throw new WarningException("Invalid value type for system variable '{0}', expected int", id); | 359 | throw new WarningException("Invalid value type for system variable '{0}', expected int", id); |
360 | } | 360 | } |
361 | 361 | ||
362 | return ret; | 362 | return ret; |
363 | } | 363 | } |
364 | 364 | ||
365 | #endregion | 365 | #endregion |
366 | 366 | ||
367 | #region Public Methods | 367 | #region Public Methods |
368 | 368 | ||
369 | /// <summary> | 369 | /// <summary> |
370 | /// | 370 | /// |
371 | /// </summary> | 371 | /// </summary> |
372 | /// <param name="name"></param> | 372 | /// <param name="name"></param> |
373 | /// <param name="variableValue"></param> | 373 | /// <param name="variableValue"></param> |
374 | public void RegisterVariable(string name, object variableValue) | 374 | public void RegisterVariable(string name, object variableValue) |
375 | { | 375 | { |
376 | if(name == null || variableValue == null) | 376 | if(name == null || variableValue == null) |
377 | { | 377 | { |
378 | return; | 378 | return; |
379 | } | 379 | } |
380 | 380 | ||
381 | m_Variables[name.ToLower()] = variableValue; | 381 | m_Variables[name.ToLower()] = variableValue; |
382 | } | 382 | } |
383 | 383 | ||
384 | /// <summary> | 384 | /// <summary> |
385 | /// Performs validation on the xml source as well as evaluates conditional and flow expresions | 385 | /// Performs validation on the xml source as well as evaluates conditional and flow expresions |
386 | /// </summary> | 386 | /// </summary> |
387 | /// <exception cref="ArgumentException">For invalid use of conditional expressions or for invalid XML syntax. If a XmlValidatingReader is passed, then will also throw exceptions for non-schema-conforming xml</exception> | 387 | /// <exception cref="ArgumentException">For invalid use of conditional expressions or for invalid XML syntax. If a XmlValidatingReader is passed, then will also throw exceptions for non-schema-conforming xml</exception> |
388 | /// <param name="reader"></param> | 388 | /// <param name="reader"></param> |
389 | /// <returns>the output xml </returns> | 389 | /// <returns>the output xml </returns> |
390 | public string Process(XmlReader reader) | 390 | public string Process(XmlReader reader) |
391 | { | 391 | { |
392 | if(reader == null) | 392 | if(reader == null) |
393 | { | 393 | { |
394 | throw new ArgumentException("Invalid XML reader to pre-process"); | 394 | throw new ArgumentException("Invalid XML reader to pre-process"); |
395 | } | 395 | } |
396 | 396 | ||
397 | IfContext context = new IfContext(true, true, IfState.None); | 397 | IfContext context = new IfContext(true, true, IfState.None); |
398 | StringWriter xmlText = new StringWriter(); | 398 | StringWriter xmlText = new StringWriter(); |
399 | XmlTextWriter writer = new XmlTextWriter(xmlText); | 399 | XmlTextWriter writer = new XmlTextWriter(xmlText); |
400 | writer.Formatting = Formatting.Indented; | 400 | writer.Formatting = Formatting.Indented; |
401 | while(reader.Read()) | 401 | while(reader.Read()) |
402 | { | 402 | { |
403 | if(reader.NodeType == XmlNodeType.ProcessingInstruction) | 403 | if(reader.NodeType == XmlNodeType.ProcessingInstruction) |
404 | { | 404 | { |
405 | bool ignore = false; | 405 | bool ignore = false; |
406 | switch(reader.LocalName) | 406 | switch(reader.LocalName) |
407 | { | 407 | { |
408 | case "if": | 408 | case "if": |
409 | m_IfStack.Push(context); | 409 | m_IfStack.Push(context); |
410 | context = new IfContext(context.Keep & context.Active, ParseExpression(reader.Value), IfState.If); | 410 | context = new IfContext(context.Keep & context.Active, ParseExpression(reader.Value), IfState.If); |
411 | ignore = true; | 411 | ignore = true; |
412 | break; | 412 | break; |
413 | 413 | ||
414 | case "elseif": | 414 | case "elseif": |
415 | if(m_IfStack.Count == 0) | 415 | if(m_IfStack.Count == 0) |
416 | { | 416 | { |
417 | throw new WarningException("Unexpected 'elseif' outside of 'if'"); | 417 | throw new WarningException("Unexpected 'elseif' outside of 'if'"); |
418 | } | 418 | } |
419 | else if(context.State != IfState.If && context.State != IfState.ElseIf) | 419 | else if(context.State != IfState.If && context.State != IfState.ElseIf) |
420 | { | 420 | { |
421 | throw new WarningException("Unexpected 'elseif' outside of 'if'"); | 421 | throw new WarningException("Unexpected 'elseif' outside of 'if'"); |
422 | } | 422 | } |
423 | 423 | ||
424 | context.State = IfState.ElseIf; | 424 | context.State = IfState.ElseIf; |
425 | if(!context.EverKept) | 425 | if(!context.EverKept) |
426 | { | 426 | { |
427 | context.Keep = ParseExpression(reader.Value); | 427 | context.Keep = ParseExpression(reader.Value); |
428 | } | 428 | } |
429 | else | 429 | else |
430 | { | 430 | { |
431 | context.Keep = false; | 431 | context.Keep = false; |
432 | } | 432 | } |
433 | 433 | ||
434 | ignore = true; | 434 | ignore = true; |
435 | break; | 435 | break; |
436 | 436 | ||
437 | case "else": | 437 | case "else": |
438 | if(m_IfStack.Count == 0) | 438 | if(m_IfStack.Count == 0) |
439 | { | 439 | { |
440 | throw new WarningException("Unexpected 'else' outside of 'if'"); | 440 | throw new WarningException("Unexpected 'else' outside of 'if'"); |
441 | } | 441 | } |
442 | else if(context.State != IfState.If && context.State != IfState.ElseIf) | 442 | else if(context.State != IfState.If && context.State != IfState.ElseIf) |
443 | { | 443 | { |
444 | throw new WarningException("Unexpected 'else' outside of 'if'"); | 444 | throw new WarningException("Unexpected 'else' outside of 'if'"); |
445 | } | 445 | } |
446 | 446 | ||
447 | context.State = IfState.Else; | 447 | context.State = IfState.Else; |
448 | context.Keep = !context.EverKept; | 448 | context.Keep = !context.EverKept; |
449 | ignore = true; | 449 | ignore = true; |
450 | break; | 450 | break; |
451 | 451 | ||
452 | case "endif": | 452 | case "endif": |
453 | if(m_IfStack.Count == 0) | 453 | if(m_IfStack.Count == 0) |
454 | { | 454 | { |
455 | throw new WarningException("Unexpected 'endif' outside of 'if'"); | 455 | throw new WarningException("Unexpected 'endif' outside of 'if'"); |
456 | } | 456 | } |
457 | 457 | ||
458 | context = (IfContext)m_IfStack.Pop(); | 458 | context = (IfContext)m_IfStack.Pop(); |
459 | ignore = true; | 459 | ignore = true; |
460 | break; | 460 | break; |
461 | } | 461 | } |
462 | 462 | ||
463 | if(ignore) | 463 | if(ignore) |
464 | { | 464 | { |
465 | continue; | 465 | continue; |
466 | } | 466 | } |
467 | }//end pre-proc instruction | 467 | }//end pre-proc instruction |
468 | 468 | ||
469 | if(!context.Active || !context.Keep) | 469 | if(!context.Active || !context.Keep) |
470 | { | 470 | { |
471 | continue; | 471 | continue; |
472 | } | 472 | } |
473 | 473 | ||
474 | switch(reader.NodeType) | 474 | switch(reader.NodeType) |
475 | { | 475 | { |
476 | case XmlNodeType.Element: | 476 | case XmlNodeType.Element: |
477 | bool empty = reader.IsEmptyElement; | 477 | bool empty = reader.IsEmptyElement; |
478 | writer.WriteStartElement(reader.Name); | 478 | writer.WriteStartElement(reader.Name); |
479 | 479 | ||
480 | while (reader.MoveToNextAttribute()) | 480 | while (reader.MoveToNextAttribute()) |
481 | { | 481 | { |
482 | writer.WriteAttributeString(reader.Name, reader.Value); | 482 | writer.WriteAttributeString(reader.Name, reader.Value); |
483 | } | 483 | } |
484 | 484 | ||
485 | if(empty) | 485 | if(empty) |
486 | { | 486 | { |
487 | writer.WriteEndElement(); | 487 | writer.WriteEndElement(); |
488 | } | 488 | } |
489 | 489 | ||
490 | break; | 490 | break; |
491 | 491 | ||
492 | case XmlNodeType.EndElement: | 492 | case XmlNodeType.EndElement: |
493 | writer.WriteEndElement(); | 493 | writer.WriteEndElement(); |
494 | break; | 494 | break; |
495 | 495 | ||
496 | case XmlNodeType.Text: | 496 | case XmlNodeType.Text: |
497 | writer.WriteString(reader.Value); | 497 | writer.WriteString(reader.Value); |
498 | break; | 498 | break; |
499 | 499 | ||
500 | case XmlNodeType.CDATA: | 500 | case XmlNodeType.CDATA: |
501 | writer.WriteCData(reader.Value); | 501 | writer.WriteCData(reader.Value); |
502 | break; | 502 | break; |
503 | 503 | ||
504 | default: | 504 | default: |
505 | break; | 505 | break; |
506 | } | 506 | } |
507 | } | 507 | } |
508 | 508 | ||
509 | if(m_IfStack.Count != 0) | 509 | if(m_IfStack.Count != 0) |
510 | { | 510 | { |
511 | throw new WarningException("Mismatched 'if', 'endif' pair"); | 511 | throw new WarningException("Mismatched 'if', 'endif' pair"); |
512 | } | 512 | } |
513 | 513 | ||
514 | return xmlText.ToString(); | 514 | return xmlText.ToString(); |
515 | } | 515 | } |
516 | 516 | ||
517 | #endregion | 517 | #endregion |
518 | } | 518 | } |
519 | } | 519 | } |
diff --git a/Prebuild/src/Core/Targets/AutotoolsTarget.cs b/Prebuild/src/Core/Targets/AutotoolsTarget.cs index 2b4a678..cf575e3 100644 --- a/Prebuild/src/Core/Targets/AutotoolsTarget.cs +++ b/Prebuild/src/Core/Targets/AutotoolsTarget.cs | |||
@@ -1,926 +1,926 @@ | |||
1 | #region BSD License | 1 | #region BSD License |
2 | /* | 2 | /* |
3 | 3 | ||
4 | Copyright (c) 2004 - 2006 | 4 | Copyright (c) 2004 - 2006 |
5 | Matthew Holmes (matthew@wildfiregames.com), | 5 | Matthew Holmes (matthew@wildfiregames.com), |
6 | Dan Moorehead (dan05a@gmail.com), | 6 | Dan Moorehead (dan05a@gmail.com), |
7 | Dave Hudson (jendave@yahoo.com), | 7 | Dave Hudson (jendave@yahoo.com), |
8 | C.J. Adams-Collier (cjcollier@colliertech.org), | 8 | C.J. Adams-Collier (cjcollier@colliertech.org), |
9 | 9 | ||
10 | Redistribution and use in source and binary forms, with or without | 10 | Redistribution and use in source and binary forms, with or without |
11 | modification, are permitted provided that the following conditions are | 11 | modification, are permitted provided that the following conditions are |
12 | met: | 12 | met: |
13 | 13 | ||
14 | * Redistributions of source code must retain the above copyright | 14 | * Redistributions of source code must retain the above copyright |
15 | notice, this list of conditions and the following disclaimer. | 15 | notice, this list of conditions and the following disclaimer. |
16 | 16 | ||
17 | * Redistributions in binary form must reproduce the above copyright | 17 | * Redistributions in binary form must reproduce the above copyright |
18 | notice, this list of conditions and the following disclaimer in the | 18 | notice, this list of conditions and the following disclaimer in the |
19 | documentation and/or other materials provided with the distribution. | 19 | documentation and/or other materials provided with the distribution. |
20 | 20 | ||
21 | * The name of the author may not be used to endorse or promote | 21 | * The name of the author may not be used to endorse or promote |
22 | products derived from this software without specific prior written | 22 | products derived from this software without specific prior written |
23 | permission. | 23 | permission. |
24 | 24 | ||
25 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | 25 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
26 | IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 26 | IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
27 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 27 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
28 | DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, | 28 | DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, |
29 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 29 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
30 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | 30 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
31 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | 31 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
32 | HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | 32 | HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, |
33 | STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | 33 | STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING |
34 | IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | 34 | IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
35 | POSSIBILITY OF SUCH DAMAGE. | 35 | POSSIBILITY OF SUCH DAMAGE. |
36 | 36 | ||
37 | */ | 37 | */ |
38 | #endregion | 38 | #endregion |
39 | 39 | ||
40 | #region CVS Information | 40 | #region CVS Information |
41 | /* | 41 | /* |
42 | * $Source$ | 42 | * $Source$ |
43 | * $Author: jendave $ | 43 | * $Author: jendave $ |
44 | * $Date: 2006-07-28 22:43:24 -0700 (Fri, 28 Jul 2006) $ | 44 | * $Date: 2006-07-28 22:43:24 -0700 (Fri, 28 Jul 2006) $ |
45 | * $Revision: 136 $ | 45 | * $Revision: 136 $ |
46 | */ | 46 | */ |
47 | #endregion | 47 | #endregion |
48 | 48 | ||
49 | using System; | 49 | using System; |
50 | using System.Collections; | 50 | using System.Collections; |
51 | using System.Collections.Specialized; | 51 | using System.Collections.Specialized; |
52 | using System.IO; | 52 | using System.IO; |
53 | using System.Reflection; | 53 | using System.Reflection; |
54 | using System.Text; | 54 | using System.Text; |
55 | using System.Text.RegularExpressions; | 55 | using System.Text.RegularExpressions; |
56 | 56 | ||
57 | using Prebuild.Core.Attributes; | 57 | using Prebuild.Core.Attributes; |
58 | using Prebuild.Core.Interfaces; | 58 | using Prebuild.Core.Interfaces; |
59 | using Prebuild.Core.Nodes; | 59 | using Prebuild.Core.Nodes; |
60 | using Prebuild.Core.Parse; | 60 | using Prebuild.Core.Parse; |
61 | using Prebuild.Core.Utilities; | 61 | using Prebuild.Core.Utilities; |
62 | 62 | ||
63 | namespace Prebuild.Core.Targets | 63 | namespace Prebuild.Core.Targets |
64 | { | 64 | { |
65 | /// <summary> | 65 | /// <summary> |
66 | /// | 66 | /// |
67 | /// </summary> | 67 | /// </summary> |
68 | [Target("autotools")] | 68 | [Target("autotools")] |
69 | public class AutotoolsTarget : ITarget | 69 | public class AutotoolsTarget : ITarget |
70 | { | 70 | { |
71 | #region Fields | 71 | #region Fields |
72 | 72 | ||
73 | private Kernel m_Kernel; | 73 | private Kernel m_Kernel; |
74 | 74 | ||
75 | #endregion | 75 | #endregion |
76 | 76 | ||
77 | #region Private Methods | 77 | #region Private Methods |
78 | 78 | ||
79 | private static string PrependPath(string path) | 79 | private static string PrependPath(string path) |
80 | { | 80 | { |
81 | string tmpPath = Helper.NormalizePath(path, '/'); | 81 | string tmpPath = Helper.NormalizePath(path, '/'); |
82 | Regex regex = new Regex(@"(\w):/(\w+)"); | 82 | Regex regex = new Regex(@"(\w):/(\w+)"); |
83 | Match match = regex.Match(tmpPath); | 83 | Match match = regex.Match(tmpPath); |
84 | if(match.Success || tmpPath[0] == '.' || tmpPath[0] == '/') | 84 | if(match.Success || tmpPath[0] == '.' || tmpPath[0] == '/') |
85 | { | 85 | { |
86 | tmpPath = Helper.NormalizePath(tmpPath); | 86 | tmpPath = Helper.NormalizePath(tmpPath); |
87 | } | 87 | } |
88 | else | 88 | else |
89 | { | 89 | { |
90 | tmpPath = Helper.NormalizePath("./" + tmpPath); | 90 | tmpPath = Helper.NormalizePath("./" + tmpPath); |
91 | } | 91 | } |
92 | 92 | ||
93 | return tmpPath; | 93 | return tmpPath; |
94 | } | 94 | } |
95 | 95 | ||
96 | private static string BuildReference(SolutionNode solution, ReferenceNode refr) | 96 | private static string BuildReference(SolutionNode solution, ReferenceNode refr) |
97 | { | 97 | { |
98 | string ret = ""; | 98 | string ret = ""; |
99 | if(solution.ProjectsTable.ContainsKey(refr.Name)) | 99 | if(solution.ProjectsTable.ContainsKey(refr.Name)) |
100 | { | 100 | { |
101 | ProjectNode project = (ProjectNode)solution.ProjectsTable[refr.Name]; | 101 | ProjectNode project = (ProjectNode)solution.ProjectsTable[refr.Name]; |
102 | string fileRef = FindFileReference(refr.Name, project); | 102 | string fileRef = FindFileReference(refr.Name, project); |
103 | string finalPath = Helper.NormalizePath(Helper.MakeFilePath(project.FullPath + "/$(BUILD_DIR)/$(CONFIG)/", refr.Name, "dll"), '/'); | 103 | string finalPath = Helper.NormalizePath(Helper.MakeFilePath(project.FullPath + "/$(BUILD_DIR)/$(CONFIG)/", refr.Name, "dll"), '/'); |
104 | ret += finalPath; | 104 | ret += finalPath; |
105 | return ret; | 105 | return ret; |
106 | } | 106 | } |
107 | else | 107 | else |
108 | { | 108 | { |
109 | ProjectNode project = (ProjectNode)refr.Parent; | 109 | ProjectNode project = (ProjectNode)refr.Parent; |
110 | string fileRef = FindFileReference(refr.Name, project); | 110 | string fileRef = FindFileReference(refr.Name, project); |
111 | 111 | ||
112 | if(refr.Path != null || fileRef != null) | 112 | if(refr.Path != null || fileRef != null) |
113 | { | 113 | { |
114 | string finalPath = (refr.Path != null) ? Helper.NormalizePath(refr.Path + "/" + refr.Name + ".dll", '/') : fileRef; | 114 | string finalPath = (refr.Path != null) ? Helper.NormalizePath(refr.Path + "/" + refr.Name + ".dll", '/') : fileRef; |
115 | ret += Path.Combine(project.Path, finalPath); | 115 | ret += Path.Combine(project.Path, finalPath); |
116 | return ret; | 116 | return ret; |
117 | } | 117 | } |
118 | 118 | ||
119 | try | 119 | try |
120 | { | 120 | { |
121 | //Assembly assem = Assembly.Load(refr.Name); | 121 | //Assembly assem = Assembly.Load(refr.Name); |
122 | //if (assem != null) | 122 | //if (assem != null) |
123 | //{ | 123 | //{ |
124 | // int index = refr.Name.IndexOf(","); | 124 | // int index = refr.Name.IndexOf(","); |
125 | // if ( index > 0) | 125 | // if ( index > 0) |
126 | // { | 126 | // { |
127 | // ret += assem.Location; | 127 | // ret += assem.Location; |
128 | // //Console.WriteLine("Location1: " + assem.Location); | 128 | // //Console.WriteLine("Location1: " + assem.Location); |
129 | // } | 129 | // } |
130 | // else | 130 | // else |
131 | // { | 131 | // { |
132 | // ret += (refr.Name + ".dll"); | 132 | // ret += (refr.Name + ".dll"); |
133 | // //Console.WriteLine("Location2: " + assem.Location); | 133 | // //Console.WriteLine("Location2: " + assem.Location); |
134 | // } | 134 | // } |
135 | //} | 135 | //} |
136 | //else | 136 | //else |
137 | //{ | 137 | //{ |
138 | int index = refr.Name.IndexOf(","); | 138 | int index = refr.Name.IndexOf(","); |
139 | if ( index > 0) | 139 | if ( index > 0) |
140 | { | 140 | { |
141 | ret += refr.Name.Substring(0, index) + ".dll"; | 141 | ret += refr.Name.Substring(0, index) + ".dll"; |
142 | //Console.WriteLine("Location3: " + assem.Location); | 142 | //Console.WriteLine("Location3: " + assem.Location); |
143 | } | 143 | } |
144 | else | 144 | else |
145 | { | 145 | { |
146 | ret += (refr.Name + ".dll"); | 146 | ret += (refr.Name + ".dll"); |
147 | //Console.WriteLine("Location4: " + assem.Location); | 147 | //Console.WriteLine("Location4: " + assem.Location); |
148 | } | 148 | } |
149 | //} | 149 | //} |
150 | } | 150 | } |
151 | catch (System.NullReferenceException e) | 151 | catch (System.NullReferenceException e) |
152 | { | 152 | { |
153 | e.ToString(); | 153 | e.ToString(); |
154 | int index = refr.Name.IndexOf(","); | 154 | int index = refr.Name.IndexOf(","); |
155 | if ( index > 0) | 155 | if ( index > 0) |
156 | { | 156 | { |
157 | ret += refr.Name.Substring(0, index) + ".dll"; | 157 | ret += refr.Name.Substring(0, index) + ".dll"; |
158 | //Console.WriteLine("Location5: " + assem.Location); | 158 | //Console.WriteLine("Location5: " + assem.Location); |
159 | } | 159 | } |
160 | else | 160 | else |
161 | { | 161 | { |
162 | ret += (refr.Name + ".dll"); | 162 | ret += (refr.Name + ".dll"); |
163 | //Console.WriteLine("Location6: " + assem.Location); | 163 | //Console.WriteLine("Location6: " + assem.Location); |
164 | } | 164 | } |
165 | } | 165 | } |
166 | } | 166 | } |
167 | return ret; | 167 | return ret; |
168 | } | 168 | } |
169 | 169 | ||
170 | private static string BuildReferencePath(SolutionNode solution, ReferenceNode refr) | 170 | private static string BuildReferencePath(SolutionNode solution, ReferenceNode refr) |
171 | { | 171 | { |
172 | string ret = ""; | 172 | string ret = ""; |
173 | if(solution.ProjectsTable.ContainsKey(refr.Name)) | 173 | if(solution.ProjectsTable.ContainsKey(refr.Name)) |
174 | { | 174 | { |
175 | ProjectNode project = (ProjectNode)solution.ProjectsTable[refr.Name]; | 175 | ProjectNode project = (ProjectNode)solution.ProjectsTable[refr.Name]; |
176 | string finalPath = Helper.NormalizePath(Helper.MakeReferencePath(project.FullPath + "/${build.dir}/"), '/'); | 176 | string finalPath = Helper.NormalizePath(Helper.MakeReferencePath(project.FullPath + "/${build.dir}/"), '/'); |
177 | ret += finalPath; | 177 | ret += finalPath; |
178 | return ret; | 178 | return ret; |
179 | } | 179 | } |
180 | else | 180 | else |
181 | { | 181 | { |
182 | ProjectNode project = (ProjectNode)refr.Parent; | 182 | ProjectNode project = (ProjectNode)refr.Parent; |
183 | string fileRef = FindFileReference(refr.Name, project); | 183 | string fileRef = FindFileReference(refr.Name, project); |
184 | 184 | ||
185 | 185 | ||
186 | if(refr.Path != null || fileRef != null) | 186 | if(refr.Path != null || fileRef != null) |
187 | { | 187 | { |
188 | string finalPath = (refr.Path != null) ? Helper.NormalizePath(refr.Path, '/') : fileRef; | 188 | string finalPath = (refr.Path != null) ? Helper.NormalizePath(refr.Path, '/') : fileRef; |
189 | ret += finalPath; | 189 | ret += finalPath; |
190 | return ret; | 190 | return ret; |
191 | } | 191 | } |
192 | 192 | ||
193 | try | 193 | try |
194 | { | 194 | { |
195 | Assembly assem = Assembly.Load(refr.Name); | 195 | Assembly assem = Assembly.Load(refr.Name); |
196 | if (assem != null) | 196 | if (assem != null) |
197 | { | 197 | { |
198 | ret += ""; | 198 | ret += ""; |
199 | } | 199 | } |
200 | else | 200 | else |
201 | { | 201 | { |
202 | ret += ""; | 202 | ret += ""; |
203 | } | 203 | } |
204 | } | 204 | } |
205 | catch (System.NullReferenceException e) | 205 | catch (System.NullReferenceException e) |
206 | { | 206 | { |
207 | e.ToString(); | 207 | e.ToString(); |
208 | ret += ""; | 208 | ret += ""; |
209 | } | 209 | } |
210 | } | 210 | } |
211 | return ret; | 211 | return ret; |
212 | } | 212 | } |
213 | 213 | ||
214 | private static string FindFileReference(string refName, ProjectNode project) | 214 | private static string FindFileReference(string refName, ProjectNode project) |
215 | { | 215 | { |
216 | foreach(ReferencePathNode refPath in project.ReferencePaths) | 216 | foreach(ReferencePathNode refPath in project.ReferencePaths) |
217 | { | 217 | { |
218 | string fullPath = Helper.MakeFilePath(refPath.Path, refName, "dll"); | 218 | string fullPath = Helper.MakeFilePath(refPath.Path, refName, "dll"); |
219 | 219 | ||
220 | if(File.Exists(fullPath)) | 220 | if(File.Exists(fullPath)) |
221 | { | 221 | { |
222 | return fullPath; | 222 | return fullPath; |
223 | } | 223 | } |
224 | } | 224 | } |
225 | 225 | ||
226 | return null; | 226 | return null; |
227 | } | 227 | } |
228 | 228 | ||
229 | /// <summary> | 229 | /// <summary> |
230 | /// Gets the XML doc file. | 230 | /// Gets the XML doc file. |
231 | /// </summary> | 231 | /// </summary> |
232 | /// <param name="project">The project.</param> | 232 | /// <param name="project">The project.</param> |
233 | /// <param name="conf">The conf.</param> | 233 | /// <param name="conf">The conf.</param> |
234 | /// <returns></returns> | 234 | /// <returns></returns> |
235 | public static string GetXmlDocFile(ProjectNode project, ConfigurationNode conf) | 235 | public static string GetXmlDocFile(ProjectNode project, ConfigurationNode conf) |
236 | { | 236 | { |
237 | if( conf == null ) | 237 | if( conf == null ) |
238 | { | 238 | { |
239 | throw new ArgumentNullException("conf"); | 239 | throw new ArgumentNullException("conf"); |
240 | } | 240 | } |
241 | if( project == null ) | 241 | if( project == null ) |
242 | { | 242 | { |
243 | throw new ArgumentNullException("project"); | 243 | throw new ArgumentNullException("project"); |
244 | } | 244 | } |
245 | string docFile = (string)conf.Options["XmlDocFile"]; | 245 | string docFile = (string)conf.Options["XmlDocFile"]; |
246 | // if(docFile != null && docFile.Length == 0)//default to assembly name if not specified | 246 | // if(docFile != null && docFile.Length == 0)//default to assembly name if not specified |
247 | // { | 247 | // { |
248 | // return Path.GetFileNameWithoutExtension(project.AssemblyName) + ".xml"; | 248 | // return Path.GetFileNameWithoutExtension(project.AssemblyName) + ".xml"; |
249 | // } | 249 | // } |
250 | return docFile; | 250 | return docFile; |
251 | } | 251 | } |
252 | 252 | ||
253 | /// <summary> | 253 | /// <summary> |
254 | /// Normalizes the path. | 254 | /// Normalizes the path. |
255 | /// </summary> | 255 | /// </summary> |
256 | /// <param name="path">The path.</param> | 256 | /// <param name="path">The path.</param> |
257 | /// <returns></returns> | 257 | /// <returns></returns> |
258 | public static string NormalizePath(string path) | 258 | public static string NormalizePath(string path) |
259 | { | 259 | { |
260 | if(path == null) | 260 | if(path == null) |
261 | { | 261 | { |
262 | return ""; | 262 | return ""; |
263 | } | 263 | } |
264 | 264 | ||
265 | StringBuilder tmpPath; | 265 | StringBuilder tmpPath; |
266 | 266 | ||
267 | if (Core.Parse.Preprocessor.GetOS() == "Win32") | 267 | if (Core.Parse.Preprocessor.GetOS() == "Win32") |
268 | { | 268 | { |
269 | tmpPath = new StringBuilder(path.Replace('\\', '/')); | 269 | tmpPath = new StringBuilder(path.Replace('\\', '/')); |
270 | tmpPath.Replace("/", @"\\"); | 270 | tmpPath.Replace("/", @"\\"); |
271 | } | 271 | } |
272 | else | 272 | else |
273 | { | 273 | { |
274 | tmpPath = new StringBuilder(path.Replace('\\', '/')); | 274 | tmpPath = new StringBuilder(path.Replace('\\', '/')); |
275 | tmpPath = tmpPath.Replace('/', Path.DirectorySeparatorChar); | 275 | tmpPath = tmpPath.Replace('/', Path.DirectorySeparatorChar); |
276 | } | 276 | } |
277 | return tmpPath.ToString(); | 277 | return tmpPath.ToString(); |
278 | } | 278 | } |
279 | 279 | ||
280 | private void WriteProject(SolutionNode solution, ProjectNode project) | 280 | private void WriteProject(SolutionNode solution, ProjectNode project) |
281 | { | 281 | { |
282 | string projFile = Helper.MakeFilePath(project.FullPath, "Include", "am"); | 282 | string projFile = Helper.MakeFilePath(project.FullPath, "Include", "am"); |
283 | StreamWriter ss = new StreamWriter(projFile); | 283 | StreamWriter ss = new StreamWriter(projFile); |
284 | ss.NewLine = "\n"; | 284 | ss.NewLine = "\n"; |
285 | 285 | ||
286 | m_Kernel.CurrentWorkingDirectory.Push(); | 286 | m_Kernel.CurrentWorkingDirectory.Push(); |
287 | Helper.SetCurrentDir(Path.GetDirectoryName(projFile)); | 287 | Helper.SetCurrentDir(Path.GetDirectoryName(projFile)); |
288 | 288 | ||
289 | using(ss) | 289 | using(ss) |
290 | { | 290 | { |
291 | ss.WriteLine(Helper.AssemblyFullName(project.AssemblyName, project.Type) + ":"); | 291 | ss.WriteLine(Helper.AssemblyFullName(project.AssemblyName, project.Type) + ":"); |
292 | ss.WriteLine("\tmkdir -p " + Helper.MakePathRelativeTo(solution.FullPath, project.Path) + "/$(BUILD_DIR)/$(CONFIG)/"); | 292 | ss.WriteLine("\tmkdir -p " + Helper.MakePathRelativeTo(solution.FullPath, project.Path) + "/$(BUILD_DIR)/$(CONFIG)/"); |
293 | foreach(string file in project.Files) | 293 | foreach(string file in project.Files) |
294 | { | 294 | { |
295 | if (project.Files.GetSubType(file) != SubType.Code && project.Files.GetSubType(file) != SubType.Settings) | 295 | if (project.Files.GetSubType(file) != SubType.Code && project.Files.GetSubType(file) != SubType.Settings) |
296 | { | 296 | { |
297 | ss.Write("\tresgen "); | 297 | ss.Write("\tresgen "); |
298 | ss.Write(Helper.NormalizePath(Path.Combine(project.Path, file.Substring(0, file.LastIndexOf('.')) + ".resx "), '/')); | 298 | ss.Write(Helper.NormalizePath(Path.Combine(project.Path, file.Substring(0, file.LastIndexOf('.')) + ".resx "), '/')); |
299 | if (project.Files.GetResourceName(file) != "") | 299 | if (project.Files.GetResourceName(file) != "") |
300 | { | 300 | { |
301 | ss.WriteLine(Helper.NormalizePath(Path.Combine(project.Path, project.RootNamespace + "." + project.Files.GetResourceName(file) + ".resources"), '/')); | 301 | ss.WriteLine(Helper.NormalizePath(Path.Combine(project.Path, project.RootNamespace + "." + project.Files.GetResourceName(file) + ".resources"), '/')); |
302 | } | 302 | } |
303 | else | 303 | else |
304 | { | 304 | { |
305 | ss.WriteLine(Helper.NormalizePath(Path.Combine(project.Path, project.RootNamespace + "." + file.Substring(0, file.LastIndexOf('.')) + ".resources"), '/')); | 305 | ss.WriteLine(Helper.NormalizePath(Path.Combine(project.Path, project.RootNamespace + "." + file.Substring(0, file.LastIndexOf('.')) + ".resources"), '/')); |
306 | } | 306 | } |
307 | } | 307 | } |
308 | } | 308 | } |
309 | ss.WriteLine("\t$(CSC)\t/out:" + Helper.MakePathRelativeTo(solution.FullPath, project.Path) + "/$(BUILD_DIR)/$(CONFIG)/" + Helper.AssemblyFullName(project.AssemblyName, project.Type) + " \\"); | 309 | ss.WriteLine("\t$(CSC)\t/out:" + Helper.MakePathRelativeTo(solution.FullPath, project.Path) + "/$(BUILD_DIR)/$(CONFIG)/" + Helper.AssemblyFullName(project.AssemblyName, project.Type) + " \\"); |
310 | ss.WriteLine("\t\t/target:" + project.Type.ToString().ToLower() + " \\"); | 310 | ss.WriteLine("\t\t/target:" + project.Type.ToString().ToLower() + " \\"); |
311 | if (project.References.Count > 0) | 311 | if (project.References.Count > 0) |
312 | { | 312 | { |
313 | ss.Write("\t\t/reference:"); | 313 | ss.Write("\t\t/reference:"); |
314 | bool firstref = true; | 314 | bool firstref = true; |
315 | foreach(ReferenceNode refr in project.References) | 315 | foreach(ReferenceNode refr in project.References) |
316 | { | 316 | { |
317 | if (firstref) | 317 | if (firstref) |
318 | { | 318 | { |
319 | firstref = false; | 319 | firstref = false; |
320 | } | 320 | } |
321 | else | 321 | else |
322 | { | 322 | { |
323 | ss.Write(","); | 323 | ss.Write(","); |
324 | } | 324 | } |
325 | ss.Write("{0}", Helper.NormalizePath(Helper.MakePathRelativeTo(solution.FullPath, BuildReference(solution, refr)), '/')); | 325 | ss.Write("{0}", Helper.NormalizePath(Helper.MakePathRelativeTo(solution.FullPath, BuildReference(solution, refr)), '/')); |
326 | } | 326 | } |
327 | ss.WriteLine(" \\"); | 327 | ss.WriteLine(" \\"); |
328 | } | 328 | } |
329 | //ss.WriteLine("\t\tProperties/AssemblyInfo.cs \\"); | 329 | //ss.WriteLine("\t\tProperties/AssemblyInfo.cs \\"); |
330 | 330 | ||
331 | foreach(string file in project.Files) | 331 | foreach(string file in project.Files) |
332 | { | 332 | { |
333 | switch(project.Files.GetBuildAction(file)) | 333 | switch(project.Files.GetBuildAction(file)) |
334 | { | 334 | { |
335 | case BuildAction.EmbeddedResource: | 335 | case BuildAction.EmbeddedResource: |
336 | ss.Write("\t\t/resource:"); | 336 | ss.Write("\t\t/resource:"); |
337 | ss.WriteLine(Helper.NormalizePath(Path.Combine(project.Path, file), '/') + " \\"); | 337 | ss.WriteLine(Helper.NormalizePath(Path.Combine(project.Path, file), '/') + " \\"); |
338 | break; | 338 | break; |
339 | default: | 339 | default: |
340 | if (project.Files.GetSubType(file) != SubType.Code && project.Files.GetSubType(file) != SubType.Settings) | 340 | if (project.Files.GetSubType(file) != SubType.Code && project.Files.GetSubType(file) != SubType.Settings) |
341 | { | 341 | { |
342 | ss.Write("\t\t/resource:"); | 342 | ss.Write("\t\t/resource:"); |
343 | if (project.Files.GetResourceName(file) != "") | 343 | if (project.Files.GetResourceName(file) != "") |
344 | { | 344 | { |
345 | ss.WriteLine(Helper.NormalizePath(Path.Combine(project.Path, project.RootNamespace + "." + project.Files.GetResourceName(file) + ".resources"), '/') + "," + project.RootNamespace + "." + project.Files.GetResourceName(file) + ".resources" + " \\"); | 345 | ss.WriteLine(Helper.NormalizePath(Path.Combine(project.Path, project.RootNamespace + "." + project.Files.GetResourceName(file) + ".resources"), '/') + "," + project.RootNamespace + "." + project.Files.GetResourceName(file) + ".resources" + " \\"); |
346 | } | 346 | } |
347 | else | 347 | else |
348 | { | 348 | { |
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" + " \\"); | 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" + " \\"); |
350 | } | 350 | } |
351 | } | 351 | } |
352 | break; | 352 | break; |
353 | } | 353 | } |
354 | } | 354 | } |
355 | 355 | ||
356 | foreach(ConfigurationNode conf in project.Configurations) | 356 | foreach(ConfigurationNode conf in project.Configurations) |
357 | { | 357 | { |
358 | if (conf.Options.KeyFile !="") | 358 | if (conf.Options.KeyFile !="") |
359 | { | 359 | { |
360 | ss.WriteLine("\t\t/keyfile:" + Helper.NormalizePath(Path.Combine(project.Path, conf.Options.KeyFile), '/') + " \\"); | 360 | ss.WriteLine("\t\t/keyfile:" + Helper.NormalizePath(Path.Combine(project.Path, conf.Options.KeyFile), '/') + " \\"); |
361 | break; | 361 | break; |
362 | } | 362 | } |
363 | } | 363 | } |
364 | foreach(ConfigurationNode conf in project.Configurations) | 364 | foreach(ConfigurationNode conf in project.Configurations) |
365 | { | 365 | { |
366 | if (conf.Options.AllowUnsafe) | 366 | if (conf.Options.AllowUnsafe) |
367 | { | 367 | { |
368 | ss.WriteLine("\t\t/unsafe \\"); | 368 | ss.WriteLine("\t\t/unsafe \\"); |
369 | break; | 369 | break; |
370 | } | 370 | } |
371 | } | 371 | } |
372 | if (project.AppIcon != "") | 372 | if (project.AppIcon != "") |
373 | { | 373 | { |
374 | ss.WriteLine("\t\t/win32icon:" + Helper.NormalizePath(Path.Combine(project.Path, project.AppIcon), '/') + " \\"); | 374 | ss.WriteLine("\t\t/win32icon:" + Helper.NormalizePath(Path.Combine(project.Path, project.AppIcon), '/') + " \\"); |
375 | } | 375 | } |
376 | 376 | ||
377 | foreach(ConfigurationNode conf in project.Configurations) | 377 | foreach(ConfigurationNode conf in project.Configurations) |
378 | { | 378 | { |
379 | ss.WriteLine("\t\t/define:{0}", conf.Options.CompilerDefines.Replace(';', ',') + " \\"); | 379 | ss.WriteLine("\t\t/define:{0}", conf.Options.CompilerDefines.Replace(';', ',') + " \\"); |
380 | break; | 380 | break; |
381 | } | 381 | } |
382 | 382 | ||
383 | foreach(ConfigurationNode conf in project.Configurations) | 383 | foreach(ConfigurationNode conf in project.Configurations) |
384 | { | 384 | { |
385 | if (GetXmlDocFile(project, conf) !="") | 385 | if (GetXmlDocFile(project, conf) !="") |
386 | { | 386 | { |
387 | ss.WriteLine("\t\t/doc:" + Helper.MakePathRelativeTo(solution.FullPath, project.Path) + "/$(BUILD_DIR)/$(CONFIG)/" + project.Name + ".xml \\"); | 387 | ss.WriteLine("\t\t/doc:" + Helper.MakePathRelativeTo(solution.FullPath, project.Path) + "/$(BUILD_DIR)/$(CONFIG)/" + project.Name + ".xml \\"); |
388 | break; | 388 | break; |
389 | } | 389 | } |
390 | } | 390 | } |
391 | foreach(string file in project.Files) | 391 | foreach(string file in project.Files) |
392 | { | 392 | { |
393 | switch(project.Files.GetBuildAction(file)) | 393 | switch(project.Files.GetBuildAction(file)) |
394 | { | 394 | { |
395 | case BuildAction.Compile: | 395 | case BuildAction.Compile: |
396 | ss.WriteLine("\t\t\\"); | 396 | ss.WriteLine("\t\t\\"); |
397 | ss.Write("\t\t" + NormalizePath(Path.Combine(Helper.MakePathRelativeTo(solution.FullPath, project.Path), file))); | 397 | ss.Write("\t\t" + NormalizePath(Path.Combine(Helper.MakePathRelativeTo(solution.FullPath, project.Path), file))); |
398 | break; | 398 | break; |
399 | default: | 399 | default: |
400 | break; | 400 | break; |
401 | } | 401 | } |
402 | } | 402 | } |
403 | ss.WriteLine(); | 403 | ss.WriteLine(); |
404 | ss.WriteLine(); | 404 | ss.WriteLine(); |
405 | 405 | ||
406 | if (project.Type == ProjectType.Library) | 406 | if (project.Type == ProjectType.Library) |
407 | { | 407 | { |
408 | ss.WriteLine("install-data-local:"); | 408 | ss.WriteLine("install-data-local:"); |
409 | ss.WriteLine(" echo \"$(GACUTIL) /i bin/Release/" + project.Name + ".dll /f $(GACUTIL_FLAGS)\"; \\"); | 409 | ss.WriteLine(" echo \"$(GACUTIL) /i bin/Release/" + project.Name + ".dll /f $(GACUTIL_FLAGS)\"; \\"); |
410 | ss.WriteLine(" $(GACUTIL) /i bin/Release/" + project.Name + ".dll /f $(GACUTIL_FLAGS) || exit 1;"); | 410 | ss.WriteLine(" $(GACUTIL) /i bin/Release/" + project.Name + ".dll /f $(GACUTIL_FLAGS) || exit 1;"); |
411 | ss.WriteLine(); | 411 | ss.WriteLine(); |
412 | ss.WriteLine("uninstall-local:"); | 412 | ss.WriteLine("uninstall-local:"); |
413 | ss.WriteLine(" echo \"$(GACUTIL) /u " + project.Name + " $(GACUTIL_FLAGS)\"; \\"); | 413 | ss.WriteLine(" echo \"$(GACUTIL) /u " + project.Name + " $(GACUTIL_FLAGS)\"; \\"); |
414 | ss.WriteLine(" $(GACUTIL) /u " + project.Name + " $(GACUTIL_FLAGS) || exit 1;"); | 414 | ss.WriteLine(" $(GACUTIL) /u " + project.Name + " $(GACUTIL_FLAGS) || exit 1;"); |
415 | ss.WriteLine(); | 415 | ss.WriteLine(); |
416 | } | 416 | } |
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"); | 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"); |
418 | ss.WriteLine("EXTRA_DIST = \\"); | 418 | ss.WriteLine("EXTRA_DIST = \\"); |
419 | ss.Write(" $(FILES)"); | 419 | ss.Write(" $(FILES)"); |
420 | foreach(ConfigurationNode conf in project.Configurations) | 420 | foreach(ConfigurationNode conf in project.Configurations) |
421 | { | 421 | { |
422 | if (conf.Options.KeyFile != "") | 422 | if (conf.Options.KeyFile != "") |
423 | { | 423 | { |
424 | ss.Write(" \\"); | 424 | ss.Write(" \\"); |
425 | ss.WriteLine("\t" + conf.Options.KeyFile); | 425 | ss.WriteLine("\t" + conf.Options.KeyFile); |
426 | } | 426 | } |
427 | break; | 427 | break; |
428 | } | 428 | } |
429 | } | 429 | } |
430 | m_Kernel.CurrentWorkingDirectory.Pop(); | 430 | m_Kernel.CurrentWorkingDirectory.Pop(); |
431 | } | 431 | } |
432 | bool hasLibrary = false; | 432 | bool hasLibrary = false; |
433 | 433 | ||
434 | private void WriteCombine(SolutionNode solution) | 434 | private void WriteCombine(SolutionNode solution) |
435 | { | 435 | { |
436 | 436 | ||
437 | /* TODO: These vars should be pulled from the prebuild.xml file */ | 437 | /* TODO: These vars should be pulled from the prebuild.xml file */ |
438 | string releaseVersion = "2.0.0"; | 438 | string releaseVersion = "2.0.0"; |
439 | string assemblyVersion = "2.1.0.0"; | 439 | string assemblyVersion = "2.1.0.0"; |
440 | string description = | 440 | string description = |
441 | "Tao Framework " + solution.Name + " Binding For .NET"; | 441 | "Tao Framework " + solution.Name + " Binding For .NET"; |
442 | 442 | ||
443 | hasLibrary = false; | 443 | hasLibrary = false; |
444 | m_Kernel.Log.Write("Creating Autotools make files"); | 444 | m_Kernel.Log.Write("Creating Autotools make files"); |
445 | foreach(ProjectNode project in solution.Projects) | 445 | foreach(ProjectNode project in solution.Projects) |
446 | { | 446 | { |
447 | if(m_Kernel.AllowProject(project.FilterGroups)) | 447 | if(m_Kernel.AllowProject(project.FilterGroups)) |
448 | { | 448 | { |
449 | m_Kernel.Log.Write("...Creating makefile: {0}", project.Name); | 449 | m_Kernel.Log.Write("...Creating makefile: {0}", project.Name); |
450 | WriteProject(solution, project); | 450 | WriteProject(solution, project); |
451 | } | 451 | } |
452 | } | 452 | } |
453 | 453 | ||
454 | m_Kernel.Log.Write(""); | 454 | m_Kernel.Log.Write(""); |
455 | string combFile = Helper.MakeFilePath(solution.FullPath, "Makefile", "am"); | 455 | string combFile = Helper.MakeFilePath(solution.FullPath, "Makefile", "am"); |
456 | StreamWriter ss = new StreamWriter(combFile); | 456 | StreamWriter ss = new StreamWriter(combFile); |
457 | ss.NewLine = "\n"; | 457 | ss.NewLine = "\n"; |
458 | 458 | ||
459 | m_Kernel.CurrentWorkingDirectory.Push(); | 459 | m_Kernel.CurrentWorkingDirectory.Push(); |
460 | Helper.SetCurrentDir(Path.GetDirectoryName(combFile)); | 460 | Helper.SetCurrentDir(Path.GetDirectoryName(combFile)); |
461 | 461 | ||
462 | using(ss) | 462 | using(ss) |
463 | { | 463 | { |
464 | foreach(ProjectNode project in solution.ProjectsTableOrder) | 464 | foreach(ProjectNode project in solution.ProjectsTableOrder) |
465 | { | 465 | { |
466 | if (project.Type == ProjectType.Library) | 466 | if (project.Type == ProjectType.Library) |
467 | { | 467 | { |
468 | hasLibrary = true; | 468 | hasLibrary = true; |
469 | break; | 469 | break; |
470 | } | 470 | } |
471 | } | 471 | } |
472 | 472 | ||
473 | if (hasLibrary) | 473 | if (hasLibrary) |
474 | { | 474 | { |
475 | ss.Write("pkgconfig_in_files = "); | 475 | ss.Write("pkgconfig_in_files = "); |
476 | foreach(ProjectNode project in solution.ProjectsTableOrder) | 476 | foreach(ProjectNode project in solution.ProjectsTableOrder) |
477 | { | 477 | { |
478 | if (project.Type == ProjectType.Library) | 478 | if (project.Type == ProjectType.Library) |
479 | { | 479 | { |
480 | string combFilepc = Helper.MakeFilePath(solution.FullPath, project.Name, "pc.in"); | 480 | string combFilepc = Helper.MakeFilePath(solution.FullPath, project.Name, "pc.in"); |
481 | ss.Write(" " + project.Name + ".pc.in "); | 481 | ss.Write(" " + project.Name + ".pc.in "); |
482 | StreamWriter sspc = new StreamWriter(combFilepc); | 482 | StreamWriter sspc = new StreamWriter(combFilepc); |
483 | sspc.NewLine = "\n"; | 483 | sspc.NewLine = "\n"; |
484 | using(sspc) | 484 | using(sspc) |
485 | { | 485 | { |
486 | sspc.WriteLine("prefix=@prefix@"); | 486 | sspc.WriteLine("prefix=@prefix@"); |
487 | sspc.WriteLine("exec_prefix=${prefix}"); | 487 | sspc.WriteLine("exec_prefix=${prefix}"); |
488 | sspc.WriteLine("libdir=${exec_prefix}/lib"); | 488 | sspc.WriteLine("libdir=${exec_prefix}/lib"); |
489 | sspc.WriteLine(); | 489 | sspc.WriteLine(); |
490 | sspc.WriteLine("Name: @PACKAGE_NAME@"); | 490 | sspc.WriteLine("Name: @PACKAGE_NAME@"); |
491 | sspc.WriteLine("Description: @DESCRIPTION@"); | 491 | sspc.WriteLine("Description: @DESCRIPTION@"); |
492 | sspc.WriteLine("Version: @ASSEMBLY_VERSION@"); | 492 | sspc.WriteLine("Version: @ASSEMBLY_VERSION@"); |
493 | sspc.WriteLine("Libs: -r:${libdir}/mono/gac/@PACKAGE_NAME@/@ASSEMBLY_VERSION@__@PUBKEY@/@PACKAGE_NAME@.dll"); | 493 | sspc.WriteLine("Libs: -r:${libdir}/mono/gac/@PACKAGE_NAME@/@ASSEMBLY_VERSION@__@PUBKEY@/@PACKAGE_NAME@.dll"); |
494 | } | 494 | } |
495 | } | 495 | } |
496 | } | 496 | } |
497 | 497 | ||
498 | ss.WriteLine(); | 498 | ss.WriteLine(); |
499 | ss.WriteLine("pkgconfigdir=$(prefix)/lib/pkgconfig"); | 499 | ss.WriteLine("pkgconfigdir=$(prefix)/lib/pkgconfig"); |
500 | ss.WriteLine("pkgconfig_DATA=$(pkgconfig_in_files:.pc.in=.pc)"); | 500 | ss.WriteLine("pkgconfig_DATA=$(pkgconfig_in_files:.pc.in=.pc)"); |
501 | } | 501 | } |
502 | ss.WriteLine(); | 502 | ss.WriteLine(); |
503 | foreach(ProjectNode project in solution.ProjectsTableOrder) | 503 | foreach(ProjectNode project in solution.ProjectsTableOrder) |
504 | { | 504 | { |
505 | string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath); | 505 | string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath); |
506 | ss.WriteLine("-include x {0}", | 506 | ss.WriteLine("-include x {0}", |
507 | Helper.NormalizePath(Helper.MakeFilePath(path, "Include", "am"),'/')); | 507 | Helper.NormalizePath(Helper.MakeFilePath(path, "Include", "am"),'/')); |
508 | } | 508 | } |
509 | ss.WriteLine(); | 509 | ss.WriteLine(); |
510 | ss.WriteLine("all: \\"); | 510 | ss.WriteLine("all: \\"); |
511 | ss.Write("\t"); | 511 | ss.Write("\t"); |
512 | foreach(ProjectNode project in solution.ProjectsTableOrder) | 512 | foreach(ProjectNode project in solution.ProjectsTableOrder) |
513 | { | 513 | { |
514 | string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath); | 514 | string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath); |
515 | ss.Write(Helper.AssemblyFullName(project.AssemblyName, project.Type) + " "); | 515 | ss.Write(Helper.AssemblyFullName(project.AssemblyName, project.Type) + " "); |
516 | 516 | ||
517 | } | 517 | } |
518 | ss.WriteLine(); | 518 | ss.WriteLine(); |
519 | if (hasLibrary) | 519 | if (hasLibrary) |
520 | { | 520 | { |
521 | ss.WriteLine("EXTRA_DIST = \\"); | 521 | ss.WriteLine("EXTRA_DIST = \\"); |
522 | ss.WriteLine("\t$(pkgconfig_in_files)"); | 522 | ss.WriteLine("\t$(pkgconfig_in_files)"); |
523 | } | 523 | } |
524 | else | 524 | else |
525 | { | 525 | { |
526 | ss.WriteLine("EXTRA_DIST = "); | 526 | ss.WriteLine("EXTRA_DIST = "); |
527 | } | 527 | } |
528 | ss.WriteLine(); | 528 | ss.WriteLine(); |
529 | ss.WriteLine("DISTCLEANFILES = \\"); | 529 | ss.WriteLine("DISTCLEANFILES = \\"); |
530 | ss.WriteLine("\tconfigure \\"); | 530 | ss.WriteLine("\tconfigure \\"); |
531 | ss.WriteLine("\tMakefile.in \\"); | 531 | ss.WriteLine("\tMakefile.in \\"); |
532 | ss.WriteLine("\taclocal.m4"); | 532 | ss.WriteLine("\taclocal.m4"); |
533 | } | 533 | } |
534 | combFile = Helper.MakeFilePath(solution.FullPath, "configure", "ac"); | 534 | combFile = Helper.MakeFilePath(solution.FullPath, "configure", "ac"); |
535 | StreamWriter ts = new StreamWriter(combFile); | 535 | StreamWriter ts = new StreamWriter(combFile); |
536 | ts.NewLine = "\n"; | 536 | ts.NewLine = "\n"; |
537 | using(ts) | 537 | using(ts) |
538 | { | 538 | { |
539 | if (this.hasLibrary) | 539 | if (this.hasLibrary) |
540 | { | 540 | { |
541 | foreach(ProjectNode project in solution.ProjectsTableOrder) | 541 | foreach(ProjectNode project in solution.ProjectsTableOrder) |
542 | { | 542 | { |
543 | if (project.Type == ProjectType.Library) | 543 | if (project.Type == ProjectType.Library) |
544 | { | 544 | { |
545 | ts.WriteLine("AC_INIT(" + project.Name + ".pc.in)"); | 545 | ts.WriteLine("AC_INIT(" + project.Name + ".pc.in)"); |
546 | break; | 546 | break; |
547 | } | 547 | } |
548 | } | 548 | } |
549 | } | 549 | } |
550 | else | 550 | else |
551 | { | 551 | { |
552 | ts.WriteLine("AC_INIT(Makefile.am)"); | 552 | ts.WriteLine("AC_INIT(Makefile.am)"); |
553 | } | 553 | } |
554 | ts.WriteLine("AC_PREREQ(2.53)"); | 554 | ts.WriteLine("AC_PREREQ(2.53)"); |
555 | ts.WriteLine("AC_CANONICAL_SYSTEM"); | 555 | ts.WriteLine("AC_CANONICAL_SYSTEM"); |
556 | 556 | ||
557 | ts.WriteLine("PACKAGE_NAME={0}", solution.Name); | 557 | ts.WriteLine("PACKAGE_NAME={0}", solution.Name); |
558 | ts.WriteLine("PACKAGE_VERSION={0}", releaseVersion); | 558 | ts.WriteLine("PACKAGE_VERSION={0}", releaseVersion); |
559 | ts.WriteLine("DESCRIPTION=\"{0}\"", description); | 559 | ts.WriteLine("DESCRIPTION=\"{0}\"", description); |
560 | ts.WriteLine("AC_SUBST(DESCRIPTION)"); | 560 | ts.WriteLine("AC_SUBST(DESCRIPTION)"); |
561 | ts.WriteLine("AM_INIT_AUTOMAKE([$PACKAGE_NAME],[$PACKAGE_VERSION],[$DESCRIPTION])"); | 561 | ts.WriteLine("AM_INIT_AUTOMAKE([$PACKAGE_NAME],[$PACKAGE_VERSION],[$DESCRIPTION])"); |
562 | 562 | ||
563 | ts.WriteLine("ASSEMBLY_VERSION={0}", assemblyVersion); | 563 | ts.WriteLine("ASSEMBLY_VERSION={0}", assemblyVersion); |
564 | ts.WriteLine("AC_SUBST(ASSEMBLY_VERSION)"); | 564 | ts.WriteLine("AC_SUBST(ASSEMBLY_VERSION)"); |
565 | 565 | ||
566 | ts.WriteLine("PUBKEY=`sn -t $PACKAGE_NAME.snk | grep 'Public Key Token' | awk -F: '{print $2}' | sed -e 's/^ //'`"); | 566 | ts.WriteLine("PUBKEY=`sn -t $PACKAGE_NAME.snk | grep 'Public Key Token' | awk -F: '{print $2}' | sed -e 's/^ //'`"); |
567 | ts.WriteLine("AC_SUBST(PUBKEY)"); | 567 | ts.WriteLine("AC_SUBST(PUBKEY)"); |
568 | 568 | ||
569 | ts.WriteLine(); | 569 | ts.WriteLine(); |
570 | ts.WriteLine("AM_MAINTAINER_MODE"); | 570 | ts.WriteLine("AM_MAINTAINER_MODE"); |
571 | ts.WriteLine(); | 571 | ts.WriteLine(); |
572 | ts.WriteLine("dnl AC_PROG_INTLTOOL([0.25])"); | 572 | ts.WriteLine("dnl AC_PROG_INTLTOOL([0.25])"); |
573 | ts.WriteLine(); | 573 | ts.WriteLine(); |
574 | ts.WriteLine("AC_PROG_INSTALL"); | 574 | ts.WriteLine("AC_PROG_INSTALL"); |
575 | ts.WriteLine(); | 575 | ts.WriteLine(); |
576 | ts.WriteLine("MONO_REQUIRED_VERSION=1.1"); | 576 | ts.WriteLine("MONO_REQUIRED_VERSION=1.1"); |
577 | ts.WriteLine(); | 577 | ts.WriteLine(); |
578 | ts.WriteLine("AC_MSG_CHECKING([whether we're compiling from CVS])"); | 578 | ts.WriteLine("AC_MSG_CHECKING([whether we're compiling from CVS])"); |
579 | ts.WriteLine("if test -f \"$srcdir/.cvs_version\" ; then"); | 579 | ts.WriteLine("if test -f \"$srcdir/.cvs_version\" ; then"); |
580 | ts.WriteLine(" from_cvs=yes"); | 580 | ts.WriteLine(" from_cvs=yes"); |
581 | ts.WriteLine("else"); | 581 | ts.WriteLine("else"); |
582 | ts.WriteLine(" if test -f \"$srcdir/.svn\" ; then"); | 582 | ts.WriteLine(" if test -f \"$srcdir/.svn\" ; then"); |
583 | ts.WriteLine(" from_cvs=yes"); | 583 | ts.WriteLine(" from_cvs=yes"); |
584 | ts.WriteLine(" else"); | 584 | ts.WriteLine(" else"); |
585 | ts.WriteLine(" from_cvs=no"); | 585 | ts.WriteLine(" from_cvs=no"); |
586 | ts.WriteLine(" fi"); | 586 | ts.WriteLine(" fi"); |
587 | ts.WriteLine("fi"); | 587 | ts.WriteLine("fi"); |
588 | ts.WriteLine(); | 588 | ts.WriteLine(); |
589 | ts.WriteLine("AC_MSG_RESULT($from_cvs)"); | 589 | ts.WriteLine("AC_MSG_RESULT($from_cvs)"); |
590 | ts.WriteLine(); | 590 | ts.WriteLine(); |
591 | ts.WriteLine("AC_PATH_PROG(MONO, mono)"); | 591 | ts.WriteLine("AC_PATH_PROG(MONO, mono)"); |
592 | ts.WriteLine("AC_PATH_PROG(GMCS, gmcs)"); | 592 | ts.WriteLine("AC_PATH_PROG(GMCS, gmcs)"); |
593 | ts.WriteLine("AC_PATH_PROG(GACUTIL, gacutil)"); | 593 | ts.WriteLine("AC_PATH_PROG(GACUTIL, gacutil)"); |
594 | ts.WriteLine(); | 594 | ts.WriteLine(); |
595 | ts.WriteLine("AC_MSG_CHECKING([for mono])"); | 595 | ts.WriteLine("AC_MSG_CHECKING([for mono])"); |
596 | ts.WriteLine("dnl if test \"x$MONO\" = \"x\" ; then"); | 596 | ts.WriteLine("dnl if test \"x$MONO\" = \"x\" ; then"); |
597 | ts.WriteLine("dnl AC_MSG_ERROR([Can't find \"mono\" in your PATH])"); | 597 | ts.WriteLine("dnl AC_MSG_ERROR([Can't find \"mono\" in your PATH])"); |
598 | ts.WriteLine("dnl else"); | 598 | ts.WriteLine("dnl else"); |
599 | ts.WriteLine(" AC_MSG_RESULT([found])"); | 599 | ts.WriteLine(" AC_MSG_RESULT([found])"); |
600 | ts.WriteLine("dnl fi"); | 600 | ts.WriteLine("dnl fi"); |
601 | ts.WriteLine(); | 601 | ts.WriteLine(); |
602 | ts.WriteLine("AC_MSG_CHECKING([for gmcs])"); | 602 | ts.WriteLine("AC_MSG_CHECKING([for gmcs])"); |
603 | ts.WriteLine("dnl if test \"x$GMCS\" = \"x\" ; then"); | 603 | ts.WriteLine("dnl if test \"x$GMCS\" = \"x\" ; then"); |
604 | ts.WriteLine("dnl AC_MSG_ERROR([Can't find \"gmcs\" in your PATH])"); | 604 | ts.WriteLine("dnl AC_MSG_ERROR([Can't find \"gmcs\" in your PATH])"); |
605 | ts.WriteLine("dnl else"); | 605 | ts.WriteLine("dnl else"); |
606 | ts.WriteLine(" AC_MSG_RESULT([found])"); | 606 | ts.WriteLine(" AC_MSG_RESULT([found])"); |
607 | ts.WriteLine("dnl fi"); | 607 | ts.WriteLine("dnl fi"); |
608 | ts.WriteLine(); | 608 | ts.WriteLine(); |
609 | //ts.WriteLine("AC_MSG_CHECKING([for gacutil])"); | 609 | //ts.WriteLine("AC_MSG_CHECKING([for gacutil])"); |
610 | //ts.WriteLine("if test \"x$GACUTIL\" = \"x\" ; then"); | 610 | //ts.WriteLine("if test \"x$GACUTIL\" = \"x\" ; then"); |
611 | //ts.WriteLine(" AC_MSG_ERROR([Can't find \"gacutil\" in your PATH])"); | 611 | //ts.WriteLine(" AC_MSG_ERROR([Can't find \"gacutil\" in your PATH])"); |
612 | //ts.WriteLine("else"); | 612 | //ts.WriteLine("else"); |
613 | //ts.WriteLine(" AC_MSG_RESULT([found])"); | 613 | //ts.WriteLine(" AC_MSG_RESULT([found])"); |
614 | //ts.WriteLine("fi"); | 614 | //ts.WriteLine("fi"); |
615 | ts.WriteLine(); | 615 | ts.WriteLine(); |
616 | ts.WriteLine("AC_SUBST(PATH)"); | 616 | ts.WriteLine("AC_SUBST(PATH)"); |
617 | ts.WriteLine("AC_SUBST(LD_LIBRARY_PATH)"); | 617 | ts.WriteLine("AC_SUBST(LD_LIBRARY_PATH)"); |
618 | ts.WriteLine(); | 618 | ts.WriteLine(); |
619 | ts.WriteLine("dnl CSFLAGS=\"-debug -nowarn:1574\""); | 619 | ts.WriteLine("dnl CSFLAGS=\"-debug -nowarn:1574\""); |
620 | ts.WriteLine("CSFLAGS=\"\""); | 620 | ts.WriteLine("CSFLAGS=\"\""); |
621 | ts.WriteLine("AC_SUBST(CSFLAGS)"); | 621 | ts.WriteLine("AC_SUBST(CSFLAGS)"); |
622 | ts.WriteLine(); | 622 | ts.WriteLine(); |
623 | // ts.WriteLine("AC_MSG_CHECKING(--disable-sdl argument)"); | 623 | // ts.WriteLine("AC_MSG_CHECKING(--disable-sdl argument)"); |
624 | // ts.WriteLine("AC_ARG_ENABLE(sdl,"); | 624 | // ts.WriteLine("AC_ARG_ENABLE(sdl,"); |
625 | // ts.WriteLine(" [ --disable-sdl Disable Sdl interface.],"); | 625 | // ts.WriteLine(" [ --disable-sdl Disable Sdl interface.],"); |
626 | // ts.WriteLine(" [disable_sdl=$disableval],"); | 626 | // ts.WriteLine(" [disable_sdl=$disableval],"); |
627 | // ts.WriteLine(" [disable_sdl=\"no\"])"); | 627 | // ts.WriteLine(" [disable_sdl=\"no\"])"); |
628 | // ts.WriteLine("AC_MSG_RESULT($disable_sdl)"); | 628 | // ts.WriteLine("AC_MSG_RESULT($disable_sdl)"); |
629 | // ts.WriteLine("if test \"$disable_sdl\" = \"yes\"; then"); | 629 | // ts.WriteLine("if test \"$disable_sdl\" = \"yes\"; then"); |
630 | // ts.WriteLine(" AC_DEFINE(FEAT_SDL)"); | 630 | // ts.WriteLine(" AC_DEFINE(FEAT_SDL)"); |
631 | // ts.WriteLine("fi"); | 631 | // ts.WriteLine("fi"); |
632 | ts.WriteLine(); | 632 | ts.WriteLine(); |
633 | ts.WriteLine("dnl Find pkg-config"); | 633 | ts.WriteLine("dnl Find pkg-config"); |
634 | ts.WriteLine("AC_PATH_PROG(PKGCONFIG, pkg-config, no)"); | 634 | ts.WriteLine("AC_PATH_PROG(PKGCONFIG, pkg-config, no)"); |
635 | ts.WriteLine("if test \"x$PKG_CONFIG\" = \"xno\"; then"); | 635 | ts.WriteLine("if test \"x$PKG_CONFIG\" = \"xno\"; then"); |
636 | ts.WriteLine(" AC_MSG_ERROR([You need to install pkg-config])"); | 636 | ts.WriteLine(" AC_MSG_ERROR([You need to install pkg-config])"); |
637 | ts.WriteLine("fi"); | 637 | ts.WriteLine("fi"); |
638 | ts.WriteLine(); | 638 | ts.WriteLine(); |
639 | ts.WriteLine("PKG_CHECK_MODULES(MONO_DEPENDENCY, mono >= $MONO_REQUIRED_VERSION, has_mono=true, has_mono=false)"); | 639 | ts.WriteLine("PKG_CHECK_MODULES(MONO_DEPENDENCY, mono >= $MONO_REQUIRED_VERSION, has_mono=true, has_mono=false)"); |
640 | ts.WriteLine("BUILD_DIR=\"bin\""); | 640 | ts.WriteLine("BUILD_DIR=\"bin\""); |
641 | ts.WriteLine("AC_SUBST(BUILD_DIR)"); | 641 | ts.WriteLine("AC_SUBST(BUILD_DIR)"); |
642 | ts.WriteLine("CONFIG=\"Release\""); | 642 | ts.WriteLine("CONFIG=\"Release\""); |
643 | ts.WriteLine("AC_SUBST(CONFIG)"); | 643 | ts.WriteLine("AC_SUBST(CONFIG)"); |
644 | ts.WriteLine(); | 644 | ts.WriteLine(); |
645 | ts.WriteLine("if test \"x$has_mono\" = \"xtrue\"; then"); | 645 | ts.WriteLine("if test \"x$has_mono\" = \"xtrue\"; then"); |
646 | ts.WriteLine(" AC_PATH_PROG(RUNTIME, mono, no)"); | 646 | ts.WriteLine(" AC_PATH_PROG(RUNTIME, mono, no)"); |
647 | ts.WriteLine(" AC_PATH_PROG(CSC, gmcs, no)"); | 647 | ts.WriteLine(" AC_PATH_PROG(CSC, gmcs, no)"); |
648 | ts.WriteLine(" if test `uname -s` = \"Darwin\"; then"); | 648 | ts.WriteLine(" if test `uname -s` = \"Darwin\"; then"); |
649 | ts.WriteLine(" LIB_PREFIX="); | 649 | ts.WriteLine(" LIB_PREFIX="); |
650 | ts.WriteLine(" LIB_SUFFIX=.dylib"); | 650 | ts.WriteLine(" LIB_SUFFIX=.dylib"); |
651 | ts.WriteLine(" else"); | 651 | ts.WriteLine(" else"); |
652 | ts.WriteLine(" LIB_PREFIX=.so"); | 652 | ts.WriteLine(" LIB_PREFIX=.so"); |
653 | ts.WriteLine(" LIB_SUFFIX="); | 653 | ts.WriteLine(" LIB_SUFFIX="); |
654 | ts.WriteLine(" fi"); | 654 | ts.WriteLine(" fi"); |
655 | ts.WriteLine("else"); | 655 | ts.WriteLine("else"); |
656 | ts.WriteLine(" AC_PATH_PROG(CSC, csc.exe, no)"); | 656 | ts.WriteLine(" AC_PATH_PROG(CSC, csc.exe, no)"); |
657 | ts.WriteLine(" if test x$CSC = \"xno\"; then"); | 657 | ts.WriteLine(" if test x$CSC = \"xno\"; then"); |
658 | ts.WriteLine(" AC_MSG_ERROR([You need to install either mono or .Net])"); | 658 | ts.WriteLine(" AC_MSG_ERROR([You need to install either mono or .Net])"); |
659 | ts.WriteLine(" else"); | 659 | ts.WriteLine(" else"); |
660 | ts.WriteLine(" RUNTIME="); | 660 | ts.WriteLine(" RUNTIME="); |
661 | ts.WriteLine(" LIB_PREFIX="); | 661 | ts.WriteLine(" LIB_PREFIX="); |
662 | ts.WriteLine(" LIB_SUFFIX=.dylib"); | 662 | ts.WriteLine(" LIB_SUFFIX=.dylib"); |
663 | ts.WriteLine(" fi"); | 663 | ts.WriteLine(" fi"); |
664 | ts.WriteLine("fi"); | 664 | ts.WriteLine("fi"); |
665 | ts.WriteLine(); | 665 | ts.WriteLine(); |
666 | ts.WriteLine("AC_SUBST(LIB_PREFIX)"); | 666 | ts.WriteLine("AC_SUBST(LIB_PREFIX)"); |
667 | ts.WriteLine("AC_SUBST(LIB_SUFFIX)"); | 667 | ts.WriteLine("AC_SUBST(LIB_SUFFIX)"); |
668 | ts.WriteLine(); | 668 | ts.WriteLine(); |
669 | ts.WriteLine("AC_SUBST(BASE_DEPENDENCIES_CFLAGS)"); | 669 | ts.WriteLine("AC_SUBST(BASE_DEPENDENCIES_CFLAGS)"); |
670 | ts.WriteLine("AC_SUBST(BASE_DEPENDENCIES_LIBS)"); | 670 | ts.WriteLine("AC_SUBST(BASE_DEPENDENCIES_LIBS)"); |
671 | ts.WriteLine(); | 671 | ts.WriteLine(); |
672 | ts.WriteLine("dnl Find monodoc"); | 672 | ts.WriteLine("dnl Find monodoc"); |
673 | ts.WriteLine("MONODOC_REQUIRED_VERSION=1.0"); | 673 | ts.WriteLine("MONODOC_REQUIRED_VERSION=1.0"); |
674 | ts.WriteLine("AC_SUBST(MONODOC_REQUIRED_VERSION)"); | 674 | 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)"); | 675 | ts.WriteLine("PKG_CHECK_MODULES(MONODOC_DEPENDENCY, monodoc >= $MONODOC_REQUIRED_VERSION, enable_monodoc=yes, enable_monodoc=no)"); |
676 | ts.WriteLine(); | 676 | ts.WriteLine(); |
677 | ts.WriteLine("if test \"x$enable_monodoc\" = \"xyes\"; then"); | 677 | ts.WriteLine("if test \"x$enable_monodoc\" = \"xyes\"; then"); |
678 | ts.WriteLine(" AC_PATH_PROG(MONODOC, monodoc, no)"); | 678 | ts.WriteLine(" AC_PATH_PROG(MONODOC, monodoc, no)"); |
679 | ts.WriteLine(" if test x$MONODOC = xno; then"); | 679 | ts.WriteLine(" if test x$MONODOC = xno; then"); |
680 | ts.WriteLine(" enable_monodoc=no"); | 680 | ts.WriteLine(" enable_monodoc=no"); |
681 | ts.WriteLine(" fi"); | 681 | ts.WriteLine(" fi"); |
682 | ts.WriteLine("else"); | 682 | ts.WriteLine("else"); |
683 | ts.WriteLine(" MONODOC="); | 683 | ts.WriteLine(" MONODOC="); |
684 | ts.WriteLine("fi"); | 684 | ts.WriteLine("fi"); |
685 | ts.WriteLine(); | 685 | ts.WriteLine(); |
686 | ts.WriteLine("AC_SUBST(MONODOC)"); | 686 | ts.WriteLine("AC_SUBST(MONODOC)"); |
687 | ts.WriteLine("AM_CONDITIONAL(ENABLE_MONODOC, test \"x$enable_monodoc\" = \"xyes\")"); | 687 | ts.WriteLine("AM_CONDITIONAL(ENABLE_MONODOC, test \"x$enable_monodoc\" = \"xyes\")"); |
688 | ts.WriteLine(); | 688 | ts.WriteLine(); |
689 | ts.WriteLine("AC_PATH_PROG(GACUTIL, gacutil, no)"); | 689 | ts.WriteLine("AC_PATH_PROG(GACUTIL, gacutil, no)"); |
690 | ts.WriteLine("if test \"x$GACUTIL\" = \"xno\" ; then"); | 690 | ts.WriteLine("if test \"x$GACUTIL\" = \"xno\" ; then"); |
691 | ts.WriteLine(" AC_MSG_ERROR([No gacutil tool found])"); | 691 | ts.WriteLine(" AC_MSG_ERROR([No gacutil tool found])"); |
692 | ts.WriteLine("fi"); | 692 | ts.WriteLine("fi"); |
693 | ts.WriteLine(); | 693 | ts.WriteLine(); |
694 | // foreach(ProjectNode project in solution.ProjectsTableOrder) | 694 | // foreach(ProjectNode project in solution.ProjectsTableOrder) |
695 | // { | 695 | // { |
696 | // if (project.Type == ProjectType.Library) | 696 | // if (project.Type == ProjectType.Library) |
697 | // { | 697 | // { |
698 | // } | 698 | // } |
699 | // } | 699 | // } |
700 | ts.WriteLine("GACUTIL_FLAGS='/package $(PACKAGE_NAME) /gacdir $(DESTDIR)$(prefix)'"); | 700 | ts.WriteLine("GACUTIL_FLAGS='/package $(PACKAGE_NAME) /gacdir $(DESTDIR)$(prefix)'"); |
701 | ts.WriteLine("AC_SUBST(GACUTIL_FLAGS)"); | 701 | ts.WriteLine("AC_SUBST(GACUTIL_FLAGS)"); |
702 | ts.WriteLine(); | 702 | ts.WriteLine(); |
703 | ts.WriteLine("winbuild=no"); | 703 | ts.WriteLine("winbuild=no"); |
704 | ts.WriteLine("case \"$host\" in"); | 704 | ts.WriteLine("case \"$host\" in"); |
705 | ts.WriteLine(" *-*-mingw*|*-*-cygwin*)"); | 705 | ts.WriteLine(" *-*-mingw*|*-*-cygwin*)"); |
706 | ts.WriteLine(" winbuild=yes"); | 706 | ts.WriteLine(" winbuild=yes"); |
707 | ts.WriteLine(" ;;"); | 707 | ts.WriteLine(" ;;"); |
708 | ts.WriteLine("esac"); | 708 | ts.WriteLine("esac"); |
709 | ts.WriteLine("AM_CONDITIONAL(WINBUILD, test x$winbuild = xyes)"); | 709 | ts.WriteLine("AM_CONDITIONAL(WINBUILD, test x$winbuild = xyes)"); |
710 | ts.WriteLine(); | 710 | ts.WriteLine(); |
711 | // ts.WriteLine("dnl Check for SDL"); | 711 | // ts.WriteLine("dnl Check for SDL"); |
712 | // ts.WriteLine(); | 712 | // ts.WriteLine(); |
713 | // ts.WriteLine("AC_PATH_PROG([SDL_CONFIG], [sdl-config])"); | 713 | // ts.WriteLine("AC_PATH_PROG([SDL_CONFIG], [sdl-config])"); |
714 | // ts.WriteLine("have_sdl=no"); | 714 | // ts.WriteLine("have_sdl=no"); |
715 | // ts.WriteLine("if test -n \"${SDL_CONFIG}\"; then"); | 715 | // ts.WriteLine("if test -n \"${SDL_CONFIG}\"; then"); |
716 | // ts.WriteLine(" have_sdl=yes"); | 716 | // ts.WriteLine(" have_sdl=yes"); |
717 | // ts.WriteLine(" SDL_CFLAGS=`$SDL_CONFIG --cflags`"); | 717 | // ts.WriteLine(" SDL_CFLAGS=`$SDL_CONFIG --cflags`"); |
718 | // ts.WriteLine(" SDL_LIBS=`$SDL_CONFIG --libs`"); | 718 | // ts.WriteLine(" SDL_LIBS=`$SDL_CONFIG --libs`"); |
719 | // ts.WriteLine(" #"); | 719 | // ts.WriteLine(" #"); |
720 | // ts.WriteLine(" # sdl-config sometimes emits an rpath flag pointing at its library"); | 720 | // 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"); | 721 | // 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"); | 722 | // 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"); | 723 | // ts.WriteLine(" # version of the library also exists in SDL's library installation"); |
724 | // ts.WriteLine(" # directory, typically /usr/lib."); | 724 | // ts.WriteLine(" # directory, typically /usr/lib."); |
725 | // ts.WriteLine(" #"); | 725 | // ts.WriteLine(" #"); |
726 | // ts.WriteLine(" SDL_LIBS=`echo $SDL_LIBS | sed 's/-Wl,-rpath,[[^ ]]* //'`"); | 726 | // ts.WriteLine(" SDL_LIBS=`echo $SDL_LIBS | sed 's/-Wl,-rpath,[[^ ]]* //'`"); |
727 | // ts.WriteLine("fi"); | 727 | // ts.WriteLine("fi"); |
728 | // ts.WriteLine("AC_SUBST([SDL_CFLAGS])"); | 728 | // ts.WriteLine("AC_SUBST([SDL_CFLAGS])"); |
729 | // ts.WriteLine("AC_SUBST([SDL_LIBS])"); | 729 | // ts.WriteLine("AC_SUBST([SDL_LIBS])"); |
730 | ts.WriteLine(); | 730 | ts.WriteLine(); |
731 | ts.WriteLine("AC_OUTPUT(["); | 731 | ts.WriteLine("AC_OUTPUT(["); |
732 | ts.WriteLine("Makefile"); | 732 | ts.WriteLine("Makefile"); |
733 | // TODO: this does not work quite right. | 733 | // TODO: this does not work quite right. |
734 | //ts.WriteLine("Properties/AssemblyInfo.cs"); | 734 | //ts.WriteLine("Properties/AssemblyInfo.cs"); |
735 | foreach(ProjectNode project in solution.ProjectsTableOrder) | 735 | foreach(ProjectNode project in solution.ProjectsTableOrder) |
736 | { | 736 | { |
737 | if (project.Type == ProjectType.Library) | 737 | if (project.Type == ProjectType.Library) |
738 | { | 738 | { |
739 | ts.WriteLine(project.Name + ".pc"); | 739 | ts.WriteLine(project.Name + ".pc"); |
740 | } | 740 | } |
741 | // string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath); | 741 | // string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath); |
742 | // ts.WriteLine(Helper.NormalizePath(Helper.MakeFilePath(path, "Include"),'/')); | 742 | // ts.WriteLine(Helper.NormalizePath(Helper.MakeFilePath(path, "Include"),'/')); |
743 | } | 743 | } |
744 | ts.WriteLine("])"); | 744 | ts.WriteLine("])"); |
745 | ts.WriteLine(); | 745 | ts.WriteLine(); |
746 | ts.WriteLine("#po/Makefile.in"); | 746 | ts.WriteLine("#po/Makefile.in"); |
747 | ts.WriteLine(); | 747 | ts.WriteLine(); |
748 | ts.WriteLine("echo \"---\""); | 748 | ts.WriteLine("echo \"---\""); |
749 | ts.WriteLine("echo \"Configuration summary\""); | 749 | ts.WriteLine("echo \"Configuration summary\""); |
750 | ts.WriteLine("echo \"\""); | 750 | ts.WriteLine("echo \"\""); |
751 | ts.WriteLine("echo \" * Installation prefix: $prefix\""); | 751 | ts.WriteLine("echo \" * Installation prefix: $prefix\""); |
752 | ts.WriteLine("echo \" * compiler: $CSC\""); | 752 | ts.WriteLine("echo \" * compiler: $CSC\""); |
753 | ts.WriteLine("echo \" * Documentation: $enable_monodoc ($MONODOC)\""); | 753 | ts.WriteLine("echo \" * Documentation: $enable_monodoc ($MONODOC)\""); |
754 | ts.WriteLine("echo \" * Package Name: $PACKAGE_NAME\""); | 754 | ts.WriteLine("echo \" * Package Name: $PACKAGE_NAME\""); |
755 | ts.WriteLine("echo \" * Version: $PACKAGE_VERSION\""); | 755 | ts.WriteLine("echo \" * Version: $PACKAGE_VERSION\""); |
756 | ts.WriteLine("echo \" * Public Key: $PUBKEY\""); | 756 | ts.WriteLine("echo \" * Public Key: $PUBKEY\""); |
757 | ts.WriteLine("echo \"\""); | 757 | ts.WriteLine("echo \"\""); |
758 | ts.WriteLine("echo \"---\""); | 758 | ts.WriteLine("echo \"---\""); |
759 | ts.WriteLine(); | 759 | ts.WriteLine(); |
760 | } | 760 | } |
761 | 761 | ||
762 | ts.NewLine = "\n"; | 762 | ts.NewLine = "\n"; |
763 | foreach (ProjectNode project in solution.ProjectsTableOrder) | 763 | foreach (ProjectNode project in solution.ProjectsTableOrder) |
764 | { | 764 | { |
765 | if (project.GenerateAssemblyInfoFile) | 765 | if (project.GenerateAssemblyInfoFile) |
766 | { | 766 | { |
767 | GenerateAssemblyInfoFile(solution, combFile); | 767 | GenerateAssemblyInfoFile(solution, combFile); |
768 | } | 768 | } |
769 | } | 769 | } |
770 | } | 770 | } |
771 | 771 | ||
772 | private static void GenerateAssemblyInfoFile(SolutionNode solution, string combFile) | 772 | private static void GenerateAssemblyInfoFile(SolutionNode solution, string combFile) |
773 | { | 773 | { |
774 | System.IO.Directory.CreateDirectory(Helper.MakePathRelativeTo(solution.FullPath, "Properties")); | 774 | System.IO.Directory.CreateDirectory(Helper.MakePathRelativeTo(solution.FullPath, "Properties")); |
775 | combFile = Helper.MakeFilePath(solution.FullPath + "/Properties/", "AssemblyInfo.cs", "in"); | 775 | combFile = Helper.MakeFilePath(solution.FullPath + "/Properties/", "AssemblyInfo.cs", "in"); |
776 | StreamWriter ai = new StreamWriter(combFile); | 776 | StreamWriter ai = new StreamWriter(combFile); |
777 | 777 | ||
778 | using (ai) | 778 | using (ai) |
779 | { | 779 | { |
780 | ai.WriteLine("#region License"); | 780 | ai.WriteLine("#region License"); |
781 | ai.WriteLine("/*"); | 781 | ai.WriteLine("/*"); |
782 | ai.WriteLine("MIT License"); | 782 | ai.WriteLine("MIT License"); |
783 | ai.WriteLine("Copyright (c)2003-2006 Tao Framework Team"); | 783 | ai.WriteLine("Copyright (c)2003-2006 Tao Framework Team"); |
784 | ai.WriteLine("http://www.taoframework.com"); | 784 | ai.WriteLine("http://www.taoframework.com"); |
785 | ai.WriteLine("All rights reserved."); | 785 | ai.WriteLine("All rights reserved."); |
786 | ai.WriteLine(""); | 786 | ai.WriteLine(""); |
787 | ai.WriteLine("Permission is hereby granted, free of charge, to any person obtaining a copy"); | 787 | ai.WriteLine("Permission is hereby granted, free of charge, to any person obtaining a copy"); |
788 | ai.WriteLine("of this software and associated documentation files (the \"Software\"), to deal"); | 788 | ai.WriteLine("of this software and associated documentation files (the \"Software\"), to deal"); |
789 | ai.WriteLine("in the Software without restriction, including without limitation the rights"); | 789 | ai.WriteLine("in the Software without restriction, including without limitation the rights"); |
790 | ai.WriteLine("to use, copy, modify, merge, publish, distribute, sublicense, and/or sell"); | 790 | ai.WriteLine("to use, copy, modify, merge, publish, distribute, sublicense, and/or sell"); |
791 | ai.WriteLine("copies of the Software, and to permit persons to whom the Software is"); | 791 | ai.WriteLine("copies of the Software, and to permit persons to whom the Software is"); |
792 | ai.WriteLine("furnished to do so, subject to the following conditions:"); | 792 | ai.WriteLine("furnished to do so, subject to the following conditions:"); |
793 | ai.WriteLine(""); | 793 | ai.WriteLine(""); |
794 | ai.WriteLine("The above copyright notice and this permission notice shall be included in all"); | 794 | ai.WriteLine("The above copyright notice and this permission notice shall be included in all"); |
795 | ai.WriteLine("copies or substantial portions of the Software."); | 795 | ai.WriteLine("copies or substantial portions of the Software."); |
796 | ai.WriteLine(""); | 796 | ai.WriteLine(""); |
797 | ai.WriteLine("THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR"); | 797 | ai.WriteLine("THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR"); |
798 | ai.WriteLine("IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,"); | 798 | ai.WriteLine("IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,"); |
799 | ai.WriteLine("FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE"); | 799 | ai.WriteLine("FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE"); |
800 | ai.WriteLine("AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER"); | 800 | ai.WriteLine("AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER"); |
801 | ai.WriteLine("LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,"); | 801 | ai.WriteLine("LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,"); |
802 | ai.WriteLine("OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE"); | 802 | ai.WriteLine("OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE"); |
803 | ai.WriteLine("SOFTWARE."); | 803 | ai.WriteLine("SOFTWARE."); |
804 | ai.WriteLine("*/"); | 804 | ai.WriteLine("*/"); |
805 | ai.WriteLine("#endregion License"); | 805 | ai.WriteLine("#endregion License"); |
806 | ai.WriteLine(""); | 806 | ai.WriteLine(""); |
807 | ai.WriteLine("using System;"); | 807 | ai.WriteLine("using System;"); |
808 | ai.WriteLine("using System.Reflection;"); | 808 | ai.WriteLine("using System.Reflection;"); |
809 | ai.WriteLine("using System.Runtime.InteropServices;"); | 809 | ai.WriteLine("using System.Runtime.InteropServices;"); |
810 | ai.WriteLine("using System.Security;"); | 810 | ai.WriteLine("using System.Security;"); |
811 | ai.WriteLine("using System.Security.Permissions;"); | 811 | ai.WriteLine("using System.Security.Permissions;"); |
812 | ai.WriteLine(""); | 812 | ai.WriteLine(""); |
813 | ai.WriteLine("[assembly: AllowPartiallyTrustedCallers]"); | 813 | ai.WriteLine("[assembly: AllowPartiallyTrustedCallers]"); |
814 | ai.WriteLine("[assembly: AssemblyCompany(\"Tao Framework -- http://www.taoframework.com\")]"); | 814 | ai.WriteLine("[assembly: AssemblyCompany(\"Tao Framework -- http://www.taoframework.com\")]"); |
815 | ai.WriteLine("[assembly: AssemblyConfiguration(\"Retail\")]"); | 815 | ai.WriteLine("[assembly: AssemblyConfiguration(\"Retail\")]"); |
816 | ai.WriteLine("[assembly: AssemblyCopyright(\"Copyright (c)2003-2006 Tao Framework Team. All rights reserved.\")]"); | 816 | ai.WriteLine("[assembly: AssemblyCopyright(\"Copyright (c)2003-2006 Tao Framework Team. All rights reserved.\")]"); |
817 | ai.WriteLine("[assembly: AssemblyCulture(\"\")]"); | 817 | ai.WriteLine("[assembly: AssemblyCulture(\"\")]"); |
818 | ai.WriteLine("[assembly: AssemblyDefaultAlias(\"@PACKAGE_NAME@\")]"); | 818 | ai.WriteLine("[assembly: AssemblyDefaultAlias(\"@PACKAGE_NAME@\")]"); |
819 | ai.WriteLine("[assembly: AssemblyDelaySign(false)]"); | 819 | ai.WriteLine("[assembly: AssemblyDelaySign(false)]"); |
820 | ai.WriteLine("[assembly: AssemblyDescription(\"@DESCRIPTION@\")]"); | 820 | ai.WriteLine("[assembly: AssemblyDescription(\"@DESCRIPTION@\")]"); |
821 | ai.WriteLine("[assembly: AssemblyFileVersion(\"@ASSEMBLY_VERSION@\")]"); | 821 | ai.WriteLine("[assembly: AssemblyFileVersion(\"@ASSEMBLY_VERSION@\")]"); |
822 | ai.WriteLine("[assembly: AssemblyInformationalVersion(\"@ASSEMBLY_VERSION@\")]"); | 822 | ai.WriteLine("[assembly: AssemblyInformationalVersion(\"@ASSEMBLY_VERSION@\")]"); |
823 | ai.WriteLine("[assembly: AssemblyKeyName(\"\")]"); | 823 | ai.WriteLine("[assembly: AssemblyKeyName(\"\")]"); |
824 | ai.WriteLine("[assembly: AssemblyProduct(\"@PACKAGE_NAME@.dll\")]"); | 824 | ai.WriteLine("[assembly: AssemblyProduct(\"@PACKAGE_NAME@.dll\")]"); |
825 | ai.WriteLine("[assembly: AssemblyTitle(\"@DESCRIPTION@\")]"); | 825 | ai.WriteLine("[assembly: AssemblyTitle(\"@DESCRIPTION@\")]"); |
826 | ai.WriteLine("[assembly: AssemblyTrademark(\"Tao Framework -- http://www.taoframework.com\")]"); | 826 | ai.WriteLine("[assembly: AssemblyTrademark(\"Tao Framework -- http://www.taoframework.com\")]"); |
827 | ai.WriteLine("[assembly: AssemblyVersion(\"@ASSEMBLY_VERSION@\")]"); | 827 | ai.WriteLine("[assembly: AssemblyVersion(\"@ASSEMBLY_VERSION@\")]"); |
828 | ai.WriteLine("[assembly: CLSCompliant(true)]"); | 828 | ai.WriteLine("[assembly: CLSCompliant(true)]"); |
829 | ai.WriteLine("[assembly: ComVisible(false)]"); | 829 | ai.WriteLine("[assembly: ComVisible(false)]"); |
830 | ai.WriteLine("[assembly: SecurityPermission(SecurityAction.RequestMinimum, Flags = SecurityPermissionFlag.Execution)]"); | 830 | ai.WriteLine("[assembly: SecurityPermission(SecurityAction.RequestMinimum, Flags = SecurityPermissionFlag.Execution)]"); |
831 | ai.WriteLine("[assembly: SecurityPermission(SecurityAction.RequestMinimum, Flags = SecurityPermissionFlag.SkipVerification)]"); | 831 | ai.WriteLine("[assembly: SecurityPermission(SecurityAction.RequestMinimum, Flags = SecurityPermissionFlag.SkipVerification)]"); |
832 | ai.WriteLine("[assembly: SecurityPermission(SecurityAction.RequestMinimum, Flags = SecurityPermissionFlag.UnmanagedCode)]"); | 832 | ai.WriteLine("[assembly: SecurityPermission(SecurityAction.RequestMinimum, Flags = SecurityPermissionFlag.UnmanagedCode)]"); |
833 | 833 | ||
834 | } | 834 | } |
835 | //return combFile; | 835 | //return combFile; |
836 | } | 836 | } |
837 | 837 | ||
838 | private void CleanProject(ProjectNode project) | 838 | private void CleanProject(ProjectNode project) |
839 | { | 839 | { |
840 | m_Kernel.Log.Write("...Cleaning project: {0}", project.Name); | 840 | m_Kernel.Log.Write("...Cleaning project: {0}", project.Name); |
841 | string projectFile = Helper.MakeFilePath(project.FullPath, "Include", "am"); | 841 | string projectFile = Helper.MakeFilePath(project.FullPath, "Include", "am"); |
842 | Helper.DeleteIfExists(projectFile); | 842 | Helper.DeleteIfExists(projectFile); |
843 | } | 843 | } |
844 | 844 | ||
845 | private void CleanSolution(SolutionNode solution) | 845 | private void CleanSolution(SolutionNode solution) |
846 | { | 846 | { |
847 | m_Kernel.Log.Write("Cleaning Autotools make files for", solution.Name); | 847 | m_Kernel.Log.Write("Cleaning Autotools make files for", solution.Name); |
848 | 848 | ||
849 | string slnFile = Helper.MakeFilePath(solution.FullPath, "Makefile", "am"); | 849 | string slnFile = Helper.MakeFilePath(solution.FullPath, "Makefile", "am"); |
850 | Helper.DeleteIfExists(slnFile); | 850 | Helper.DeleteIfExists(slnFile); |
851 | 851 | ||
852 | slnFile = Helper.MakeFilePath(solution.FullPath, "Makefile", "in"); | 852 | slnFile = Helper.MakeFilePath(solution.FullPath, "Makefile", "in"); |
853 | Helper.DeleteIfExists(slnFile); | 853 | Helper.DeleteIfExists(slnFile); |
854 | 854 | ||
855 | slnFile = Helper.MakeFilePath(solution.FullPath, "configure", "ac"); | 855 | slnFile = Helper.MakeFilePath(solution.FullPath, "configure", "ac"); |
856 | Helper.DeleteIfExists(slnFile); | 856 | Helper.DeleteIfExists(slnFile); |
857 | 857 | ||
858 | slnFile = Helper.MakeFilePath(solution.FullPath, "configure"); | 858 | slnFile = Helper.MakeFilePath(solution.FullPath, "configure"); |
859 | Helper.DeleteIfExists(slnFile); | 859 | Helper.DeleteIfExists(slnFile); |
860 | 860 | ||
861 | slnFile = Helper.MakeFilePath(solution.FullPath, "Makefile"); | 861 | slnFile = Helper.MakeFilePath(solution.FullPath, "Makefile"); |
862 | Helper.DeleteIfExists(slnFile); | 862 | Helper.DeleteIfExists(slnFile); |
863 | 863 | ||
864 | foreach(ProjectNode project in solution.Projects) | 864 | foreach(ProjectNode project in solution.Projects) |
865 | { | 865 | { |
866 | CleanProject(project); | 866 | CleanProject(project); |
867 | } | 867 | } |
868 | 868 | ||
869 | m_Kernel.Log.Write(""); | 869 | m_Kernel.Log.Write(""); |
870 | } | 870 | } |
871 | 871 | ||
872 | #endregion | 872 | #endregion |
873 | 873 | ||
874 | #region ITarget Members | 874 | #region ITarget Members |
875 | 875 | ||
876 | /// <summary> | 876 | /// <summary> |
877 | /// Writes the specified kern. | 877 | /// Writes the specified kern. |
878 | /// </summary> | 878 | /// </summary> |
879 | /// <param name="kern">The kern.</param> | 879 | /// <param name="kern">The kern.</param> |
880 | public void Write(Kernel kern) | 880 | public void Write(Kernel kern) |
881 | { | 881 | { |
882 | if( kern == null ) | 882 | if( kern == null ) |
883 | { | 883 | { |
884 | throw new ArgumentNullException("kern"); | 884 | throw new ArgumentNullException("kern"); |
885 | } | 885 | } |
886 | m_Kernel = kern; | 886 | m_Kernel = kern; |
887 | foreach(SolutionNode solution in kern.Solutions) | 887 | foreach(SolutionNode solution in kern.Solutions) |
888 | { | 888 | { |
889 | WriteCombine(solution); | 889 | WriteCombine(solution); |
890 | } | 890 | } |
891 | m_Kernel = null; | 891 | m_Kernel = null; |
892 | } | 892 | } |
893 | 893 | ||
894 | /// <summary> | 894 | /// <summary> |
895 | /// Cleans the specified kern. | 895 | /// Cleans the specified kern. |
896 | /// </summary> | 896 | /// </summary> |
897 | /// <param name="kern">The kern.</param> | 897 | /// <param name="kern">The kern.</param> |
898 | public virtual void Clean(Kernel kern) | 898 | public virtual void Clean(Kernel kern) |
899 | { | 899 | { |
900 | if( kern == null ) | 900 | if( kern == null ) |
901 | { | 901 | { |
902 | throw new ArgumentNullException("kern"); | 902 | throw new ArgumentNullException("kern"); |
903 | } | 903 | } |
904 | m_Kernel = kern; | 904 | m_Kernel = kern; |
905 | foreach(SolutionNode sol in kern.Solutions) | 905 | foreach(SolutionNode sol in kern.Solutions) |
906 | { | 906 | { |
907 | CleanSolution(sol); | 907 | CleanSolution(sol); |
908 | } | 908 | } |
909 | m_Kernel = null; | 909 | m_Kernel = null; |
910 | } | 910 | } |
911 | 911 | ||
912 | /// <summary> | 912 | /// <summary> |
913 | /// Gets the name. | 913 | /// Gets the name. |
914 | /// </summary> | 914 | /// </summary> |
915 | /// <value>The name.</value> | 915 | /// <value>The name.</value> |
916 | public string Name | 916 | public string Name |
917 | { | 917 | { |
918 | get | 918 | get |
919 | { | 919 | { |
920 | return "autotools"; | 920 | return "autotools"; |
921 | } | 921 | } |
922 | } | 922 | } |
923 | 923 | ||
924 | #endregion | 924 | #endregion |
925 | } | 925 | } |
926 | } | 926 | } |
diff --git a/Prebuild/src/Core/Targets/DebugTarget.cs b/Prebuild/src/Core/Targets/DebugTarget.cs index 6baa623..dc4e666 100644 --- a/Prebuild/src/Core/Targets/DebugTarget.cs +++ b/Prebuild/src/Core/Targets/DebugTarget.cs | |||
@@ -1,102 +1,102 @@ | |||
1 | #region BSD License | 1 | #region BSD License |
2 | /* | 2 | /* |
3 | Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) | 3 | Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) |
4 | 4 | ||
5 | Redistribution and use in source and binary forms, with or without modification, are permitted | 5 | Redistribution and use in source and binary forms, with or without modification, are permitted |
6 | provided that the following conditions are met: | 6 | provided that the following conditions are met: |
7 | 7 | ||
8 | * Redistributions of source code must retain the above copyright notice, this list of conditions | 8 | * Redistributions of source code must retain the above copyright notice, this list of conditions |
9 | and the following disclaimer. | 9 | and the following disclaimer. |
10 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions | 10 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions |
11 | and the following disclaimer in the documentation and/or other materials provided with the | 11 | and the following disclaimer in the documentation and/or other materials provided with the |
12 | distribution. | 12 | distribution. |
13 | * The name of the author may not be used to endorse or promote products derived from this software | 13 | * The name of the author may not be used to endorse or promote products derived from this software |
14 | without specific prior written permission. | 14 | without specific prior written permission. |
15 | 15 | ||
16 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, | 16 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, |
17 | BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | 17 | BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
18 | ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | 18 | ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
19 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | 19 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
20 | OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY | 20 | OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
21 | OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | 21 | OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING |
22 | IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 22 | IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
23 | */ | 23 | */ |
24 | #endregion | 24 | #endregion |
25 | 25 | ||
26 | #region CVS Information | 26 | #region CVS Information |
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 09:42:51 +0200 (on, 20 sep 2006) $ |
31 | * $Revision: 164 $ | 31 | * $Revision: 164 $ |
32 | */ | 32 | */ |
33 | #endregion | 33 | #endregion |
34 | 34 | ||
35 | using System; | 35 | using System; |
36 | 36 | ||
37 | using Prebuild.Core.Attributes; | 37 | using Prebuild.Core.Attributes; |
38 | using Prebuild.Core.Interfaces; | 38 | using Prebuild.Core.Interfaces; |
39 | using Prebuild.Core.Nodes; | 39 | using Prebuild.Core.Nodes; |
40 | 40 | ||
41 | #if (DEBUG && _DEBUG_TARGET) | 41 | #if (DEBUG && _DEBUG_TARGET) |
42 | namespace Prebuild.Core.Targets | 42 | namespace Prebuild.Core.Targets |
43 | { | 43 | { |
44 | [Target("debug")] | 44 | [Target("debug")] |
45 | public class DebugTarget : ITarget | 45 | public class DebugTarget : ITarget |
46 | { | 46 | { |
47 | #region Fields | 47 | #region Fields |
48 | 48 | ||
49 | private Kernel m_Kernel = null; | 49 | private Kernel m_Kernel = null; |
50 | 50 | ||
51 | #endregion | 51 | #endregion |
52 | 52 | ||
53 | #region ITarget Members | 53 | #region ITarget Members |
54 | 54 | ||
55 | public void Write() | 55 | public void Write() |
56 | { | 56 | { |
57 | foreach(SolutionNode s in m_Kernel.Solutions) | 57 | foreach(SolutionNode s in m_Kernel.Solutions) |
58 | { | 58 | { |
59 | Console.WriteLine("Solution [ {0}, {1} ]", s.Name, s.Path); | 59 | Console.WriteLine("Solution [ {0}, {1} ]", s.Name, s.Path); |
60 | foreach(string file in s.Files) | 60 | foreach(string file in s.Files) |
61 | { | 61 | { |
62 | Console.WriteLine("\tFile [ {0} ]", file); | 62 | Console.WriteLine("\tFile [ {0} ]", file); |
63 | } | 63 | } |
64 | 64 | ||
65 | foreach(ProjectNode proj in s.Projects) | 65 | foreach(ProjectNode proj in s.Projects) |
66 | { | 66 | { |
67 | Console.WriteLine("\tProject [ {0}, {1}. {2} ]", proj.Name, proj.Path, proj.Language); | 67 | Console.WriteLine("\tProject [ {0}, {1}. {2} ]", proj.Name, proj.Path, proj.Language); |
68 | foreach(string file in proj.Files) | 68 | foreach(string file in proj.Files) |
69 | Console.WriteLine("\t\tFile [ {0} ]", file); | 69 | Console.WriteLine("\t\tFile [ {0} ]", file); |
70 | } | 70 | } |
71 | } | 71 | } |
72 | } | 72 | } |
73 | 73 | ||
74 | public void Clean() | 74 | public void Clean() |
75 | { | 75 | { |
76 | Console.WriteLine("Not implemented"); | 76 | Console.WriteLine("Not implemented"); |
77 | } | 77 | } |
78 | 78 | ||
79 | public string Name | 79 | public string Name |
80 | { | 80 | { |
81 | get | 81 | get |
82 | { | 82 | { |
83 | return "debug"; | 83 | return "debug"; |
84 | } | 84 | } |
85 | } | 85 | } |
86 | 86 | ||
87 | public Kernel Kernel | 87 | public Kernel Kernel |
88 | { | 88 | { |
89 | get | 89 | get |
90 | { | 90 | { |
91 | return m_Kernel; | 91 | return m_Kernel; |
92 | } | 92 | } |
93 | set | 93 | set |
94 | { | 94 | { |
95 | m_Kernel = value; | 95 | m_Kernel = value; |
96 | } | 96 | } |
97 | } | 97 | } |
98 | 98 | ||
99 | #endregion | 99 | #endregion |
100 | } | 100 | } |
101 | } | 101 | } |
102 | #endif | 102 | #endif |
diff --git a/Prebuild/src/Core/Targets/MonoDevelopTarget.cs b/Prebuild/src/Core/Targets/MonoDevelopTarget.cs index 8620e4b..7c0a1e2 100644 --- a/Prebuild/src/Core/Targets/MonoDevelopTarget.cs +++ b/Prebuild/src/Core/Targets/MonoDevelopTarget.cs | |||
@@ -1,458 +1,458 @@ | |||
1 | #region BSD License | 1 | #region BSD License |
2 | /* | 2 | /* |
3 | Copyright (c) 2004 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) | 3 | Copyright (c) 2004 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) |
4 | 4 | ||
5 | Redistribution and use in source and binary forms, with or without modification, are permitted | 5 | Redistribution and use in source and binary forms, with or without modification, are permitted |
6 | provided that the following conditions are met: | 6 | provided that the following conditions are met: |
7 | 7 | ||
8 | * Redistributions of source code must retain the above copyright notice, this list of conditions | 8 | * Redistributions of source code must retain the above copyright notice, this list of conditions |
9 | and the following disclaimer. | 9 | and the following disclaimer. |
10 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions | 10 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions |
11 | and the following disclaimer in the documentation and/or other materials provided with the | 11 | and the following disclaimer in the documentation and/or other materials provided with the |
12 | distribution. | 12 | distribution. |
13 | * The name of the author may not be used to endorse or promote products derived from this software | 13 | * The name of the author may not be used to endorse or promote products derived from this software |
14 | without specific prior written permission. | 14 | without specific prior written permission. |
15 | 15 | ||
16 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, | 16 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, |
17 | BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | 17 | BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
18 | ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | 18 | ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
19 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | 19 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
20 | OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY | 20 | OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
21 | OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | 21 | OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING |
22 | IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 22 | IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
23 | */ | 23 | */ |
24 | #endregion | 24 | #endregion |
25 | 25 | ||
26 | #region CVS Information | 26 | #region CVS Information |
27 | /* | 27 | /* |
28 | * $Source$ | 28 | * $Source$ |
29 | * $Author: jendave $ | 29 | * $Author: jendave $ |
30 | * $Date: 2007-02-13 22:07:07 +0100 (ti, 13 feb 2007) $ | 30 | * $Date: 2007-02-13 22:07:07 +0100 (ti, 13 feb 2007) $ |
31 | * $Revision: 206 $ | 31 | * $Revision: 206 $ |
32 | */ | 32 | */ |
33 | #endregion | 33 | #endregion |
34 | 34 | ||
35 | using System; | 35 | using System; |
36 | using System.Collections; | 36 | using System.Collections; |
37 | using System.Collections.Specialized; | 37 | using System.Collections.Specialized; |
38 | using System.IO; | 38 | using System.IO; |
39 | using System.Reflection; | 39 | using System.Reflection; |
40 | using System.Text.RegularExpressions; | 40 | using System.Text.RegularExpressions; |
41 | 41 | ||
42 | using Prebuild.Core.Attributes; | 42 | using Prebuild.Core.Attributes; |
43 | using Prebuild.Core.Interfaces; | 43 | using Prebuild.Core.Interfaces; |
44 | using Prebuild.Core.Nodes; | 44 | using Prebuild.Core.Nodes; |
45 | using Prebuild.Core.Utilities; | 45 | using Prebuild.Core.Utilities; |
46 | 46 | ||
47 | namespace Prebuild.Core.Targets | 47 | namespace Prebuild.Core.Targets |
48 | { | 48 | { |
49 | /// <summary> | 49 | /// <summary> |
50 | /// | 50 | /// |
51 | /// </summary> | 51 | /// </summary> |
52 | [Target("monodev")] | 52 | [Target("monodev")] |
53 | public class MonoDevelopTarget : ITarget | 53 | public class MonoDevelopTarget : ITarget |
54 | { | 54 | { |
55 | #region Fields | 55 | #region Fields |
56 | 56 | ||
57 | private Kernel m_Kernel; | 57 | private Kernel m_Kernel; |
58 | 58 | ||
59 | #endregion | 59 | #endregion |
60 | 60 | ||
61 | #region Private Methods | 61 | #region Private Methods |
62 | 62 | ||
63 | private static string PrependPath(string path) | 63 | private static string PrependPath(string path) |
64 | { | 64 | { |
65 | string tmpPath = Helper.NormalizePath(path, '/'); | 65 | string tmpPath = Helper.NormalizePath(path, '/'); |
66 | Regex regex = new Regex(@"(\w):/(\w+)"); | 66 | Regex regex = new Regex(@"(\w):/(\w+)"); |
67 | Match match = regex.Match(tmpPath); | 67 | Match match = regex.Match(tmpPath); |
68 | if(match.Success || tmpPath[0] == '.' || tmpPath[0] == '/') | 68 | if(match.Success || tmpPath[0] == '.' || tmpPath[0] == '/') |
69 | { | 69 | { |
70 | tmpPath = Helper.NormalizePath(tmpPath); | 70 | tmpPath = Helper.NormalizePath(tmpPath); |
71 | } | 71 | } |
72 | else | 72 | else |
73 | { | 73 | { |
74 | tmpPath = Helper.NormalizePath("./" + tmpPath); | 74 | tmpPath = Helper.NormalizePath("./" + tmpPath); |
75 | } | 75 | } |
76 | 76 | ||
77 | return tmpPath; | 77 | return tmpPath; |
78 | } | 78 | } |
79 | 79 | ||
80 | private static string BuildReference(SolutionNode solution, ReferenceNode refr) | 80 | private static string BuildReference(SolutionNode solution, ReferenceNode refr) |
81 | { | 81 | { |
82 | string ret = "<ProjectReference type=\""; | 82 | string ret = "<ProjectReference type=\""; |
83 | if(solution.ProjectsTable.ContainsKey(refr.Name)) | 83 | if(solution.ProjectsTable.ContainsKey(refr.Name)) |
84 | { | 84 | { |
85 | ret += "Project\""; | 85 | ret += "Project\""; |
86 | ret += " localcopy=\"" + refr.LocalCopy.ToString() + "\" refto=\"" + refr.Name + "\" />"; | 86 | ret += " localcopy=\"" + refr.LocalCopy.ToString() + "\" refto=\"" + refr.Name + "\" />"; |
87 | } | 87 | } |
88 | else | 88 | else |
89 | { | 89 | { |
90 | ProjectNode project = (ProjectNode)refr.Parent; | 90 | ProjectNode project = (ProjectNode)refr.Parent; |
91 | string fileRef = FindFileReference(refr.Name, project); | 91 | string fileRef = FindFileReference(refr.Name, project); |
92 | 92 | ||
93 | if(refr.Path != null || fileRef != null) | 93 | if(refr.Path != null || fileRef != null) |
94 | { | 94 | { |
95 | ret += "Assembly\" refto=\""; | 95 | ret += "Assembly\" refto=\""; |
96 | 96 | ||
97 | string finalPath = (refr.Path != null) ? Helper.MakeFilePath(refr.Path, refr.Name, "dll") : fileRef; | 97 | string finalPath = (refr.Path != null) ? Helper.MakeFilePath(refr.Path, refr.Name, "dll") : fileRef; |
98 | 98 | ||
99 | ret += finalPath; | 99 | ret += finalPath; |
100 | ret += "\" localcopy=\"" + refr.LocalCopy.ToString() + "\" />"; | 100 | ret += "\" localcopy=\"" + refr.LocalCopy.ToString() + "\" />"; |
101 | return ret; | 101 | return ret; |
102 | } | 102 | } |
103 | 103 | ||
104 | ret += "Gac\""; | 104 | ret += "Gac\""; |
105 | ret += " localcopy=\"" + refr.LocalCopy.ToString() + "\""; | 105 | ret += " localcopy=\"" + refr.LocalCopy.ToString() + "\""; |
106 | ret += " refto=\""; | 106 | ret += " refto=\""; |
107 | try | 107 | try |
108 | { | 108 | { |
109 | //Assembly assem = Assembly.Load(refr.Name); | 109 | //Assembly assem = Assembly.Load(refr.Name); |
110 | //ret += assem.FullName; | 110 | //ret += assem.FullName; |
111 | ret += refr.Name; | 111 | ret += refr.Name; |
112 | } | 112 | } |
113 | catch (System.NullReferenceException e) | 113 | catch (System.NullReferenceException e) |
114 | { | 114 | { |
115 | e.ToString(); | 115 | e.ToString(); |
116 | ret += refr.Name; | 116 | ret += refr.Name; |
117 | } | 117 | } |
118 | ret += "\" />"; | 118 | ret += "\" />"; |
119 | } | 119 | } |
120 | 120 | ||
121 | return ret; | 121 | return ret; |
122 | } | 122 | } |
123 | 123 | ||
124 | private static string FindFileReference(string refName, ProjectNode project) | 124 | private static string FindFileReference(string refName, ProjectNode project) |
125 | { | 125 | { |
126 | foreach(ReferencePathNode refPath in project.ReferencePaths) | 126 | foreach(ReferencePathNode refPath in project.ReferencePaths) |
127 | { | 127 | { |
128 | string fullPath = Helper.MakeFilePath(refPath.Path, refName, "dll"); | 128 | string fullPath = Helper.MakeFilePath(refPath.Path, refName, "dll"); |
129 | 129 | ||
130 | if(File.Exists(fullPath)) | 130 | if(File.Exists(fullPath)) |
131 | { | 131 | { |
132 | return fullPath; | 132 | return fullPath; |
133 | } | 133 | } |
134 | } | 134 | } |
135 | 135 | ||
136 | return null; | 136 | return null; |
137 | } | 137 | } |
138 | 138 | ||
139 | /// <summary> | 139 | /// <summary> |
140 | /// Gets the XML doc file. | 140 | /// Gets the XML doc file. |
141 | /// </summary> | 141 | /// </summary> |
142 | /// <param name="project">The project.</param> | 142 | /// <param name="project">The project.</param> |
143 | /// <param name="conf">The conf.</param> | 143 | /// <param name="conf">The conf.</param> |
144 | /// <returns></returns> | 144 | /// <returns></returns> |
145 | public static string GenerateXmlDocFile(ProjectNode project, ConfigurationNode conf) | 145 | public static string GenerateXmlDocFile(ProjectNode project, ConfigurationNode conf) |
146 | { | 146 | { |
147 | if( conf == null ) | 147 | if( conf == null ) |
148 | { | 148 | { |
149 | throw new ArgumentNullException("conf"); | 149 | throw new ArgumentNullException("conf"); |
150 | } | 150 | } |
151 | if( project == null ) | 151 | if( project == null ) |
152 | { | 152 | { |
153 | throw new ArgumentNullException("project"); | 153 | throw new ArgumentNullException("project"); |
154 | } | 154 | } |
155 | string docFile = (string)conf.Options["XmlDocFile"]; | 155 | string docFile = (string)conf.Options["XmlDocFile"]; |
156 | if(docFile != null && docFile.Length == 0)//default to assembly name if not specified | 156 | if(docFile != null && docFile.Length == 0)//default to assembly name if not specified |
157 | { | 157 | { |
158 | return "False"; | 158 | return "False"; |
159 | } | 159 | } |
160 | return "True"; | 160 | return "True"; |
161 | } | 161 | } |
162 | 162 | ||
163 | private void WriteProject(SolutionNode solution, ProjectNode project) | 163 | private void WriteProject(SolutionNode solution, ProjectNode project) |
164 | { | 164 | { |
165 | string csComp = "Mcs"; | 165 | string csComp = "Mcs"; |
166 | string netRuntime = "Mono"; | 166 | string netRuntime = "Mono"; |
167 | if(project.Runtime == ClrRuntime.Microsoft) | 167 | if(project.Runtime == ClrRuntime.Microsoft) |
168 | { | 168 | { |
169 | csComp = "Csc"; | 169 | csComp = "Csc"; |
170 | netRuntime = "MsNet"; | 170 | netRuntime = "MsNet"; |
171 | } | 171 | } |
172 | 172 | ||
173 | string projFile = Helper.MakeFilePath(project.FullPath, project.Name, "mdp"); | 173 | string projFile = Helper.MakeFilePath(project.FullPath, project.Name, "mdp"); |
174 | StreamWriter ss = new StreamWriter(projFile); | 174 | StreamWriter ss = new StreamWriter(projFile); |
175 | 175 | ||
176 | m_Kernel.CurrentWorkingDirectory.Push(); | 176 | m_Kernel.CurrentWorkingDirectory.Push(); |
177 | Helper.SetCurrentDir(Path.GetDirectoryName(projFile)); | 177 | Helper.SetCurrentDir(Path.GetDirectoryName(projFile)); |
178 | 178 | ||
179 | using(ss) | 179 | using(ss) |
180 | { | 180 | { |
181 | ss.WriteLine( | 181 | ss.WriteLine( |
182 | "<Project name=\"{0}\" description=\"\" standardNamespace=\"{1}\" newfilesearch=\"None\" enableviewstate=\"True\" fileversion=\"2.0\" language=\"C#\" clr-version=\"Net_2_0\" ctype=\"DotNetProject\">", | 182 | "<Project name=\"{0}\" description=\"\" standardNamespace=\"{1}\" newfilesearch=\"None\" enableviewstate=\"True\" fileversion=\"2.0\" language=\"C#\" clr-version=\"Net_2_0\" ctype=\"DotNetProject\">", |
183 | project.Name, | 183 | project.Name, |
184 | project.RootNamespace | 184 | project.RootNamespace |
185 | ); | 185 | ); |
186 | 186 | ||
187 | int count = 0; | 187 | int count = 0; |
188 | 188 | ||
189 | ss.WriteLine(" <Configurations active=\"{0}\">", solution.ActiveConfig); | 189 | ss.WriteLine(" <Configurations active=\"{0}\">", solution.ActiveConfig); |
190 | 190 | ||
191 | foreach(ConfigurationNode conf in project.Configurations) | 191 | foreach(ConfigurationNode conf in project.Configurations) |
192 | { | 192 | { |
193 | ss.WriteLine(" <Configuration name=\"{0}\" ctype=\"DotNetProjectConfiguration\">", conf.Name); | 193 | ss.WriteLine(" <Configuration name=\"{0}\" ctype=\"DotNetProjectConfiguration\">", conf.Name); |
194 | ss.Write(" <Output"); | 194 | ss.Write(" <Output"); |
195 | ss.Write(" directory=\"{0}\"", Helper.EndPath(Helper.NormalizePath(".\\" + conf.Options["OutputPath"].ToString()))); | 195 | ss.Write(" directory=\"{0}\"", Helper.EndPath(Helper.NormalizePath(".\\" + conf.Options["OutputPath"].ToString()))); |
196 | ss.Write(" assembly=\"{0}\"", project.AssemblyName); | 196 | ss.Write(" assembly=\"{0}\"", project.AssemblyName); |
197 | ss.Write(" executeScript=\"{0}\"", conf.Options["RunScript"]); | 197 | ss.Write(" executeScript=\"{0}\"", conf.Options["RunScript"]); |
198 | //ss.Write(" executeBeforeBuild=\"{0}\"", conf.Options["PreBuildEvent"]); | 198 | //ss.Write(" executeBeforeBuild=\"{0}\"", conf.Options["PreBuildEvent"]); |
199 | //ss.Write(" executeAfterBuild=\"{0}\"", conf.Options["PostBuildEvent"]); | 199 | //ss.Write(" executeAfterBuild=\"{0}\"", conf.Options["PostBuildEvent"]); |
200 | if (conf.Options["PreBuildEvent"] != null && conf.Options["PreBuildEvent"].ToString().Length != 0) | 200 | if (conf.Options["PreBuildEvent"] != null && conf.Options["PreBuildEvent"].ToString().Length != 0) |
201 | { | 201 | { |
202 | ss.Write(" executeBeforeBuild=\"{0}\"", Helper.NormalizePath(conf.Options["PreBuildEvent"].ToString())); | 202 | ss.Write(" executeBeforeBuild=\"{0}\"", Helper.NormalizePath(conf.Options["PreBuildEvent"].ToString())); |
203 | } | 203 | } |
204 | else | 204 | else |
205 | { | 205 | { |
206 | ss.Write(" executeBeforeBuild=\"{0}\"", conf.Options["PreBuildEvent"]); | 206 | ss.Write(" executeBeforeBuild=\"{0}\"", conf.Options["PreBuildEvent"]); |
207 | } | 207 | } |
208 | if (conf.Options["PostBuildEvent"] != null && conf.Options["PostBuildEvent"].ToString().Length != 0) | 208 | if (conf.Options["PostBuildEvent"] != null && conf.Options["PostBuildEvent"].ToString().Length != 0) |
209 | { | 209 | { |
210 | ss.Write(" executeAfterBuild=\"{0}\"", Helper.NormalizePath(conf.Options["PostBuildEvent"].ToString())); | 210 | ss.Write(" executeAfterBuild=\"{0}\"", Helper.NormalizePath(conf.Options["PostBuildEvent"].ToString())); |
211 | } | 211 | } |
212 | else | 212 | else |
213 | { | 213 | { |
214 | ss.Write(" executeAfterBuild=\"{0}\"", conf.Options["PostBuildEvent"]); | 214 | ss.Write(" executeAfterBuild=\"{0}\"", conf.Options["PostBuildEvent"]); |
215 | } | 215 | } |
216 | ss.Write(" executeBeforeBuildArguments=\"{0}\"", conf.Options["PreBuildEventArgs"]); | 216 | ss.Write(" executeBeforeBuildArguments=\"{0}\"", conf.Options["PreBuildEventArgs"]); |
217 | ss.Write(" executeAfterBuildArguments=\"{0}\"", conf.Options["PreBuildEventArgs"]); | 217 | ss.Write(" executeAfterBuildArguments=\"{0}\"", conf.Options["PreBuildEventArgs"]); |
218 | ss.WriteLine(" />"); | 218 | ss.WriteLine(" />"); |
219 | 219 | ||
220 | ss.Write(" <Build"); | 220 | ss.Write(" <Build"); |
221 | ss.Write(" debugmode=\"True\""); | 221 | ss.Write(" debugmode=\"True\""); |
222 | if (project.Type == ProjectType.WinExe) | 222 | if (project.Type == ProjectType.WinExe) |
223 | { | 223 | { |
224 | ss.Write(" target=\"{0}\"", ProjectType.Exe.ToString()); | 224 | ss.Write(" target=\"{0}\"", ProjectType.Exe.ToString()); |
225 | } | 225 | } |
226 | else | 226 | else |
227 | { | 227 | { |
228 | ss.Write(" target=\"{0}\"", project.Type); | 228 | ss.Write(" target=\"{0}\"", project.Type); |
229 | } | 229 | } |
230 | ss.WriteLine(" />"); | 230 | ss.WriteLine(" />"); |
231 | 231 | ||
232 | ss.Write(" <Execution"); | 232 | ss.Write(" <Execution"); |
233 | ss.Write(" runwithwarnings=\"True\""); | 233 | ss.Write(" runwithwarnings=\"True\""); |
234 | ss.Write(" consolepause=\"True\""); | 234 | ss.Write(" consolepause=\"True\""); |
235 | ss.Write(" runtime=\"{0}\"", netRuntime); | 235 | ss.Write(" runtime=\"{0}\"", netRuntime); |
236 | ss.Write(" clr-version=\"Net_2_0\""); | 236 | ss.Write(" clr-version=\"Net_2_0\""); |
237 | ss.WriteLine(" />"); | 237 | ss.WriteLine(" />"); |
238 | 238 | ||
239 | ss.Write(" <CodeGeneration"); | 239 | ss.Write(" <CodeGeneration"); |
240 | ss.Write(" compiler=\"{0}\"", csComp); | 240 | ss.Write(" compiler=\"{0}\"", csComp); |
241 | ss.Write(" warninglevel=\"{0}\"", conf.Options["WarningLevel"]); | 241 | ss.Write(" warninglevel=\"{0}\"", conf.Options["WarningLevel"]); |
242 | ss.Write(" nowarn=\"{0}\"", conf.Options["SuppressWarnings"]); | 242 | ss.Write(" nowarn=\"{0}\"", conf.Options["SuppressWarnings"]); |
243 | ss.Write(" includedebuginformation=\"{0}\"", conf.Options["DebugInformation"]); | 243 | ss.Write(" includedebuginformation=\"{0}\"", conf.Options["DebugInformation"]); |
244 | ss.Write(" optimize=\"{0}\"", conf.Options["OptimizeCode"]); | 244 | ss.Write(" optimize=\"{0}\"", conf.Options["OptimizeCode"]); |
245 | ss.Write(" unsafecodeallowed=\"{0}\"", conf.Options["AllowUnsafe"]); | 245 | ss.Write(" unsafecodeallowed=\"{0}\"", conf.Options["AllowUnsafe"]); |
246 | ss.Write(" generateoverflowchecks=\"{0}\"", conf.Options["CheckUnderflowOverflow"]); | 246 | ss.Write(" generateoverflowchecks=\"{0}\"", conf.Options["CheckUnderflowOverflow"]); |
247 | ss.Write(" mainclass=\"{0}\"", project.StartupObject); | 247 | ss.Write(" mainclass=\"{0}\"", project.StartupObject); |
248 | ss.Write(" target=\"{0}\"", project.Type); | 248 | ss.Write(" target=\"{0}\"", project.Type); |
249 | ss.Write(" definesymbols=\"{0}\"", conf.Options["CompilerDefines"]); | 249 | ss.Write(" definesymbols=\"{0}\"", conf.Options["CompilerDefines"]); |
250 | ss.Write(" generatexmldocumentation=\"{0}\"", GenerateXmlDocFile(project, conf)); | 250 | ss.Write(" generatexmldocumentation=\"{0}\"", GenerateXmlDocFile(project, conf)); |
251 | ss.Write(" win32Icon=\"{0}\"", project.AppIcon); | 251 | ss.Write(" win32Icon=\"{0}\"", project.AppIcon); |
252 | ss.Write(" ctype=\"CSharpCompilerParameters\""); | 252 | ss.Write(" ctype=\"CSharpCompilerParameters\""); |
253 | ss.WriteLine(" />"); | 253 | ss.WriteLine(" />"); |
254 | ss.WriteLine(" </Configuration>"); | 254 | ss.WriteLine(" </Configuration>"); |
255 | 255 | ||
256 | count++; | 256 | count++; |
257 | } | 257 | } |
258 | ss.WriteLine(" </Configurations>"); | 258 | ss.WriteLine(" </Configurations>"); |
259 | 259 | ||
260 | ss.Write(" <DeploymentInformation"); | 260 | ss.Write(" <DeploymentInformation"); |
261 | ss.Write(" target=\"\""); | 261 | ss.Write(" target=\"\""); |
262 | ss.Write(" script=\"\""); | 262 | ss.Write(" script=\"\""); |
263 | ss.Write(" strategy=\"File\""); | 263 | ss.Write(" strategy=\"File\""); |
264 | ss.WriteLine(">"); | 264 | ss.WriteLine(">"); |
265 | ss.WriteLine(" <excludeFiles />"); | 265 | ss.WriteLine(" <excludeFiles />"); |
266 | ss.WriteLine(" </DeploymentInformation>"); | 266 | ss.WriteLine(" </DeploymentInformation>"); |
267 | 267 | ||
268 | ss.WriteLine(" <Contents>"); | 268 | ss.WriteLine(" <Contents>"); |
269 | foreach(string file in project.Files) | 269 | foreach(string file in project.Files) |
270 | { | 270 | { |
271 | string buildAction = "Compile"; | 271 | string buildAction = "Compile"; |
272 | switch(project.Files.GetBuildAction(file)) | 272 | switch(project.Files.GetBuildAction(file)) |
273 | { | 273 | { |
274 | case BuildAction.None: | 274 | case BuildAction.None: |
275 | buildAction = "Nothing"; | 275 | buildAction = "Nothing"; |
276 | break; | 276 | break; |
277 | 277 | ||
278 | case BuildAction.Content: | 278 | case BuildAction.Content: |
279 | buildAction = "Exclude"; | 279 | buildAction = "Exclude"; |
280 | break; | 280 | break; |
281 | 281 | ||
282 | case BuildAction.EmbeddedResource: | 282 | case BuildAction.EmbeddedResource: |
283 | buildAction = "EmbedAsResource"; | 283 | buildAction = "EmbedAsResource"; |
284 | break; | 284 | break; |
285 | 285 | ||
286 | default: | 286 | default: |
287 | buildAction = "Compile"; | 287 | buildAction = "Compile"; |
288 | break; | 288 | break; |
289 | } | 289 | } |
290 | 290 | ||
291 | // Sort of a hack, we try and resolve the path and make it relative, if we can. | 291 | // Sort of a hack, we try and resolve the path and make it relative, if we can. |
292 | string filePath = PrependPath(file); | 292 | string filePath = PrependPath(file); |
293 | ss.WriteLine(" <File name=\"{0}\" subtype=\"Code\" buildaction=\"{1}\" dependson=\"\" data=\"\" />", filePath, buildAction); | 293 | ss.WriteLine(" <File name=\"{0}\" subtype=\"Code\" buildaction=\"{1}\" dependson=\"\" data=\"\" />", filePath, buildAction); |
294 | } | 294 | } |
295 | ss.WriteLine(" </Contents>"); | 295 | ss.WriteLine(" </Contents>"); |
296 | 296 | ||
297 | ss.WriteLine(" <References>"); | 297 | ss.WriteLine(" <References>"); |
298 | foreach(ReferenceNode refr in project.References) | 298 | foreach(ReferenceNode refr in project.References) |
299 | { | 299 | { |
300 | ss.WriteLine(" {0}", BuildReference(solution, refr)); | 300 | ss.WriteLine(" {0}", BuildReference(solution, refr)); |
301 | } | 301 | } |
302 | ss.WriteLine(" </References>"); | 302 | ss.WriteLine(" </References>"); |
303 | 303 | ||
304 | 304 | ||
305 | ss.WriteLine("</Project>"); | 305 | ss.WriteLine("</Project>"); |
306 | } | 306 | } |
307 | 307 | ||
308 | m_Kernel.CurrentWorkingDirectory.Pop(); | 308 | m_Kernel.CurrentWorkingDirectory.Pop(); |
309 | } | 309 | } |
310 | 310 | ||
311 | private void WriteCombine(SolutionNode solution) | 311 | private void WriteCombine(SolutionNode solution) |
312 | { | 312 | { |
313 | m_Kernel.Log.Write("Creating MonoDevelop combine and project files"); | 313 | m_Kernel.Log.Write("Creating MonoDevelop combine and project files"); |
314 | foreach(ProjectNode project in solution.Projects) | 314 | foreach(ProjectNode project in solution.Projects) |
315 | { | 315 | { |
316 | if(m_Kernel.AllowProject(project.FilterGroups)) | 316 | if(m_Kernel.AllowProject(project.FilterGroups)) |
317 | { | 317 | { |
318 | m_Kernel.Log.Write("...Creating project: {0}", project.Name); | 318 | m_Kernel.Log.Write("...Creating project: {0}", project.Name); |
319 | WriteProject(solution, project); | 319 | WriteProject(solution, project); |
320 | } | 320 | } |
321 | } | 321 | } |
322 | 322 | ||
323 | m_Kernel.Log.Write(""); | 323 | m_Kernel.Log.Write(""); |
324 | string combFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "mds"); | 324 | string combFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "mds"); |
325 | StreamWriter ss = new StreamWriter(combFile); | 325 | StreamWriter ss = new StreamWriter(combFile); |
326 | 326 | ||
327 | m_Kernel.CurrentWorkingDirectory.Push(); | 327 | m_Kernel.CurrentWorkingDirectory.Push(); |
328 | Helper.SetCurrentDir(Path.GetDirectoryName(combFile)); | 328 | Helper.SetCurrentDir(Path.GetDirectoryName(combFile)); |
329 | 329 | ||
330 | int count = 0; | 330 | int count = 0; |
331 | 331 | ||
332 | using(ss) | 332 | using(ss) |
333 | { | 333 | { |
334 | ss.WriteLine("<Combine name=\"{0}\" fileversion=\"2.0\" description=\"\">", solution.Name); | 334 | ss.WriteLine("<Combine name=\"{0}\" fileversion=\"2.0\" description=\"\">", solution.Name); |
335 | 335 | ||
336 | count = 0; | 336 | count = 0; |
337 | foreach(ConfigurationNode conf in solution.Configurations) | 337 | foreach(ConfigurationNode conf in solution.Configurations) |
338 | { | 338 | { |
339 | if(count == 0) | 339 | if(count == 0) |
340 | { | 340 | { |
341 | ss.WriteLine(" <Configurations active=\"{0}\">", conf.Name); | 341 | ss.WriteLine(" <Configurations active=\"{0}\">", conf.Name); |
342 | } | 342 | } |
343 | 343 | ||
344 | ss.WriteLine(" <Configuration name=\"{0}\" ctype=\"CombineConfiguration\">", conf.Name); | 344 | ss.WriteLine(" <Configuration name=\"{0}\" ctype=\"CombineConfiguration\">", conf.Name); |
345 | foreach(ProjectNode project in solution.Projects) | 345 | foreach(ProjectNode project in solution.Projects) |
346 | { | 346 | { |
347 | ss.WriteLine(" <Entry configuration=\"{1}\" build=\"True\" name=\"{0}\" />", project.Name, conf.Name); | 347 | ss.WriteLine(" <Entry configuration=\"{1}\" build=\"True\" name=\"{0}\" />", project.Name, conf.Name); |
348 | } | 348 | } |
349 | ss.WriteLine(" </Configuration>"); | 349 | ss.WriteLine(" </Configuration>"); |
350 | 350 | ||
351 | count++; | 351 | count++; |
352 | } | 352 | } |
353 | ss.WriteLine(" </Configurations>"); | 353 | ss.WriteLine(" </Configurations>"); |
354 | 354 | ||
355 | count = 0; | 355 | count = 0; |
356 | 356 | ||
357 | foreach(ProjectNode project in solution.Projects) | 357 | foreach(ProjectNode project in solution.Projects) |
358 | { | 358 | { |
359 | if(count == 0) | 359 | if(count == 0) |
360 | ss.WriteLine(" <StartMode startupentry=\"{0}\" single=\"True\">", project.Name); | 360 | ss.WriteLine(" <StartMode startupentry=\"{0}\" single=\"True\">", project.Name); |
361 | 361 | ||
362 | ss.WriteLine(" <Execute type=\"None\" entry=\"{0}\" />", project.Name); | 362 | ss.WriteLine(" <Execute type=\"None\" entry=\"{0}\" />", project.Name); |
363 | count++; | 363 | count++; |
364 | } | 364 | } |
365 | ss.WriteLine(" </StartMode>"); | 365 | ss.WriteLine(" </StartMode>"); |
366 | 366 | ||
367 | ss.WriteLine(" <Entries>"); | 367 | ss.WriteLine(" <Entries>"); |
368 | foreach(ProjectNode project in solution.Projects) | 368 | foreach(ProjectNode project in solution.Projects) |
369 | { | 369 | { |
370 | string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath); | 370 | string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath); |
371 | ss.WriteLine(" <Entry filename=\"{0}\" />", | 371 | ss.WriteLine(" <Entry filename=\"{0}\" />", |
372 | Helper.MakeFilePath(path, project.Name, "mdp")); | 372 | Helper.MakeFilePath(path, project.Name, "mdp")); |
373 | } | 373 | } |
374 | ss.WriteLine(" </Entries>"); | 374 | ss.WriteLine(" </Entries>"); |
375 | 375 | ||
376 | ss.WriteLine("</Combine>"); | 376 | ss.WriteLine("</Combine>"); |
377 | } | 377 | } |
378 | 378 | ||
379 | m_Kernel.CurrentWorkingDirectory.Pop(); | 379 | m_Kernel.CurrentWorkingDirectory.Pop(); |
380 | } | 380 | } |
381 | 381 | ||
382 | private void CleanProject(ProjectNode project) | 382 | private void CleanProject(ProjectNode project) |
383 | { | 383 | { |
384 | m_Kernel.Log.Write("...Cleaning project: {0}", project.Name); | 384 | m_Kernel.Log.Write("...Cleaning project: {0}", project.Name); |
385 | string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, "mdp"); | 385 | string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, "mdp"); |
386 | Helper.DeleteIfExists(projectFile); | 386 | Helper.DeleteIfExists(projectFile); |
387 | } | 387 | } |
388 | 388 | ||
389 | private void CleanSolution(SolutionNode solution) | 389 | private void CleanSolution(SolutionNode solution) |
390 | { | 390 | { |
391 | m_Kernel.Log.Write("Cleaning MonoDevelop combine and project files for", solution.Name); | 391 | m_Kernel.Log.Write("Cleaning MonoDevelop combine and project files for", solution.Name); |
392 | 392 | ||
393 | string slnFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "mds"); | 393 | string slnFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "mds"); |
394 | Helper.DeleteIfExists(slnFile); | 394 | Helper.DeleteIfExists(slnFile); |
395 | 395 | ||
396 | foreach(ProjectNode project in solution.Projects) | 396 | foreach(ProjectNode project in solution.Projects) |
397 | { | 397 | { |
398 | CleanProject(project); | 398 | CleanProject(project); |
399 | } | 399 | } |
400 | 400 | ||
401 | m_Kernel.Log.Write(""); | 401 | m_Kernel.Log.Write(""); |
402 | } | 402 | } |
403 | 403 | ||
404 | #endregion | 404 | #endregion |
405 | 405 | ||
406 | #region ITarget Members | 406 | #region ITarget Members |
407 | 407 | ||
408 | /// <summary> | 408 | /// <summary> |
409 | /// Writes the specified kern. | 409 | /// Writes the specified kern. |
410 | /// </summary> | 410 | /// </summary> |
411 | /// <param name="kern">The kern.</param> | 411 | /// <param name="kern">The kern.</param> |
412 | public void Write(Kernel kern) | 412 | public void Write(Kernel kern) |
413 | { | 413 | { |
414 | if( kern == null ) | 414 | if( kern == null ) |
415 | { | 415 | { |
416 | throw new ArgumentNullException("kern"); | 416 | throw new ArgumentNullException("kern"); |
417 | } | 417 | } |
418 | m_Kernel = kern; | 418 | m_Kernel = kern; |
419 | foreach(SolutionNode solution in kern.Solutions) | 419 | foreach(SolutionNode solution in kern.Solutions) |
420 | { | 420 | { |
421 | WriteCombine(solution); | 421 | WriteCombine(solution); |
422 | } | 422 | } |
423 | m_Kernel = null; | 423 | m_Kernel = null; |
424 | } | 424 | } |
425 | 425 | ||
426 | /// <summary> | 426 | /// <summary> |
427 | /// Cleans the specified kern. | 427 | /// Cleans the specified kern. |
428 | /// </summary> | 428 | /// </summary> |
429 | /// <param name="kern">The kern.</param> | 429 | /// <param name="kern">The kern.</param> |
430 | public virtual void Clean(Kernel kern) | 430 | public virtual void Clean(Kernel kern) |
431 | { | 431 | { |
432 | if( kern == null ) | 432 | if( kern == null ) |
433 | { | 433 | { |
434 | throw new ArgumentNullException("kern"); | 434 | throw new ArgumentNullException("kern"); |
435 | } | 435 | } |
436 | m_Kernel = kern; | 436 | m_Kernel = kern; |
437 | foreach(SolutionNode sol in kern.Solutions) | 437 | foreach(SolutionNode sol in kern.Solutions) |
438 | { | 438 | { |
439 | CleanSolution(sol); | 439 | CleanSolution(sol); |
440 | } | 440 | } |
441 | m_Kernel = null; | 441 | m_Kernel = null; |
442 | } | 442 | } |
443 | 443 | ||
444 | /// <summary> | 444 | /// <summary> |
445 | /// Gets the name. | 445 | /// Gets the name. |
446 | /// </summary> | 446 | /// </summary> |
447 | /// <value>The name.</value> | 447 | /// <value>The name.</value> |
448 | public string Name | 448 | public string Name |
449 | { | 449 | { |
450 | get | 450 | get |
451 | { | 451 | { |
452 | return "sharpdev"; | 452 | return "sharpdev"; |
453 | } | 453 | } |
454 | } | 454 | } |
455 | 455 | ||
456 | #endregion | 456 | #endregion |
457 | } | 457 | } |
458 | } | 458 | } |
diff --git a/Prebuild/src/Core/Targets/NAntTarget.cs b/Prebuild/src/Core/Targets/NAntTarget.cs index 0f0deb2..4669cfd 100644 --- a/Prebuild/src/Core/Targets/NAntTarget.cs +++ b/Prebuild/src/Core/Targets/NAntTarget.cs | |||
@@ -1,621 +1,621 @@ | |||
1 | #region BSD License | 1 | #region BSD License |
2 | /* | 2 | /* |
3 | Copyright (c) 2004 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) | 3 | Copyright (c) 2004 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) |
4 | 4 | ||
5 | Redistribution and use in source and binary forms, with or without modification, are permitted | 5 | Redistribution and use in source and binary forms, with or without modification, are permitted |
6 | provided that the following conditions are met: | 6 | provided that the following conditions are met: |
7 | 7 | ||
8 | * Redistributions of source code must retain the above copyright notice, this list of conditions | 8 | * Redistributions of source code must retain the above copyright notice, this list of conditions |
9 | and the following disclaimer. | 9 | and the following disclaimer. |
10 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions | 10 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions |
11 | and the following disclaimer in the documentation and/or other materials provided with the | 11 | and the following disclaimer in the documentation and/or other materials provided with the |
12 | distribution. | 12 | distribution. |
13 | * The name of the author may not be used to endorse or promote products derived from this software | 13 | * The name of the author may not be used to endorse or promote products derived from this software |
14 | without specific prior written permission. | 14 | without specific prior written permission. |
15 | 15 | ||
16 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, | 16 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, |
17 | BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | 17 | BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
18 | ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | 18 | ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
19 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | 19 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
20 | OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY | 20 | OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
21 | OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | 21 | OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING |
22 | IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 22 | IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
23 | */ | 23 | */ |
24 | #endregion | 24 | #endregion |
25 | 25 | ||
26 | #region CVS Information | 26 | #region CVS Information |
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-13 21:58:03 +0100 (ti, 13 feb 2007) $ |
31 | * $Revision: 205 $ | 31 | * $Revision: 205 $ |
32 | */ | 32 | */ |
33 | #endregion | 33 | #endregion |
34 | 34 | ||
35 | using System; | 35 | using System; |
36 | using System.Collections; | 36 | using System.Collections; |
37 | using System.Collections.Specialized; | 37 | using System.Collections.Specialized; |
38 | using System.IO; | 38 | using System.IO; |
39 | using System.Reflection; | 39 | using System.Reflection; |
40 | using System.Text.RegularExpressions; | 40 | using System.Text.RegularExpressions; |
41 | 41 | ||
42 | using Prebuild.Core.Attributes; | 42 | using Prebuild.Core.Attributes; |
43 | using Prebuild.Core.Interfaces; | 43 | using Prebuild.Core.Interfaces; |
44 | using Prebuild.Core.Nodes; | 44 | using Prebuild.Core.Nodes; |
45 | using Prebuild.Core.Utilities; | 45 | using Prebuild.Core.Utilities; |
46 | 46 | ||
47 | namespace Prebuild.Core.Targets | 47 | namespace Prebuild.Core.Targets |
48 | { | 48 | { |
49 | /// <summary> | 49 | /// <summary> |
50 | /// | 50 | /// |
51 | /// </summary> | 51 | /// </summary> |
52 | [Target("nant")] | 52 | [Target("nant")] |
53 | public class NAntTarget : ITarget | 53 | public class NAntTarget : ITarget |
54 | { | 54 | { |
55 | #region Fields | 55 | #region Fields |
56 | 56 | ||
57 | private Kernel m_Kernel; | 57 | private Kernel m_Kernel; |
58 | 58 | ||
59 | #endregion | 59 | #endregion |
60 | 60 | ||
61 | #region Private Methods | 61 | #region Private Methods |
62 | 62 | ||
63 | private static string PrependPath(string path) | 63 | private static string PrependPath(string path) |
64 | { | 64 | { |
65 | string tmpPath = Helper.NormalizePath(path, '/'); | 65 | string tmpPath = Helper.NormalizePath(path, '/'); |
66 | Regex regex = new Regex(@"(\w):/(\w+)"); | 66 | Regex regex = new Regex(@"(\w):/(\w+)"); |
67 | Match match = regex.Match(tmpPath); | 67 | Match match = regex.Match(tmpPath); |
68 | //if(match.Success || tmpPath[0] == '.' || tmpPath[0] == '/') | 68 | //if(match.Success || tmpPath[0] == '.' || tmpPath[0] == '/') |
69 | //{ | 69 | //{ |
70 | tmpPath = Helper.NormalizePath(tmpPath); | 70 | tmpPath = Helper.NormalizePath(tmpPath); |
71 | //} | 71 | //} |
72 | // else | 72 | // else |
73 | // { | 73 | // { |
74 | // tmpPath = Helper.NormalizePath("./" + tmpPath); | 74 | // tmpPath = Helper.NormalizePath("./" + tmpPath); |
75 | // } | 75 | // } |
76 | 76 | ||
77 | return tmpPath; | 77 | return tmpPath; |
78 | } | 78 | } |
79 | 79 | ||
80 | private static string BuildReference(SolutionNode solution, ProjectNode currentProject, ReferenceNode refr) | 80 | private static string BuildReference(SolutionNode solution, ProjectNode currentProject, ReferenceNode refr) |
81 | { | 81 | { |
82 | string ret = ""; | 82 | string ret = ""; |
83 | if(solution.ProjectsTable.ContainsKey(refr.Name)) | 83 | if(solution.ProjectsTable.ContainsKey(refr.Name)) |
84 | { | 84 | { |
85 | ProjectNode project = (ProjectNode)solution.ProjectsTable[refr.Name]; | 85 | ProjectNode project = (ProjectNode)solution.ProjectsTable[refr.Name]; |
86 | 86 | ||
87 | string finalPath = Helper.NormalizePath(((ReferencePathNode)currentProject.ReferencePaths[0]).Path + refr.Name + ".dll", '/'); | 87 | string finalPath = Helper.NormalizePath(((ReferencePathNode)currentProject.ReferencePaths[0]).Path + refr.Name + ".dll", '/'); |
88 | 88 | ||
89 | return finalPath; | 89 | return finalPath; |
90 | } | 90 | } |
91 | else | 91 | else |
92 | { | 92 | { |
93 | ProjectNode project = (ProjectNode)refr.Parent; | 93 | ProjectNode project = (ProjectNode)refr.Parent; |
94 | string fileRef = FindFileReference(refr.Name, project); | 94 | string fileRef = FindFileReference(refr.Name, project); |
95 | 95 | ||
96 | if(refr.Path != null || fileRef != null) | 96 | if(refr.Path != null || fileRef != null) |
97 | { | 97 | { |
98 | string finalPath = (refr.Path != null) ? Helper.NormalizePath(refr.Path + "/" + refr.Name + ".dll", '/') : fileRef; | 98 | string finalPath = (refr.Path != null) ? Helper.NormalizePath(refr.Path + "/" + refr.Name + ".dll", '/') : fileRef; |
99 | ret += finalPath; | 99 | ret += finalPath; |
100 | return ret; | 100 | return ret; |
101 | } | 101 | } |
102 | 102 | ||
103 | try | 103 | try |
104 | { | 104 | { |
105 | //Assembly assem = Assembly.Load(refr.Name); | 105 | //Assembly assem = Assembly.Load(refr.Name); |
106 | //if (assem != null) | 106 | //if (assem != null) |
107 | //{ | 107 | //{ |
108 | //ret += (refr.Name + ".dll"); | 108 | //ret += (refr.Name + ".dll"); |
109 | //} | 109 | //} |
110 | //else | 110 | //else |
111 | //{ | 111 | //{ |
112 | ret += (refr.Name + ".dll"); | 112 | ret += (refr.Name + ".dll"); |
113 | //} | 113 | //} |
114 | } | 114 | } |
115 | catch (System.NullReferenceException e) | 115 | catch (System.NullReferenceException e) |
116 | { | 116 | { |
117 | e.ToString(); | 117 | e.ToString(); |
118 | ret += refr.Name + ".dll"; | 118 | ret += refr.Name + ".dll"; |
119 | } | 119 | } |
120 | } | 120 | } |
121 | return ret; | 121 | return ret; |
122 | } | 122 | } |
123 | 123 | ||
124 | private static string BuildReferencePath(SolutionNode solution, ReferenceNode refr) | 124 | private static string BuildReferencePath(SolutionNode solution, ReferenceNode refr) |
125 | { | 125 | { |
126 | string ret = ""; | 126 | string ret = ""; |
127 | if(solution.ProjectsTable.ContainsKey(refr.Name)) | 127 | if(solution.ProjectsTable.ContainsKey(refr.Name)) |
128 | { | 128 | { |
129 | ProjectNode project = (ProjectNode)solution.ProjectsTable[refr.Name]; | 129 | ProjectNode project = (ProjectNode)solution.ProjectsTable[refr.Name]; |
130 | string finalPath = Helper.NormalizePath(((ReferencePathNode)project.ReferencePaths[0]).Path, '/'); | 130 | string finalPath = Helper.NormalizePath(((ReferencePathNode)project.ReferencePaths[0]).Path, '/'); |
131 | 131 | ||
132 | return finalPath; | 132 | return finalPath; |
133 | } | 133 | } |
134 | else | 134 | else |
135 | { | 135 | { |
136 | ProjectNode project = (ProjectNode)refr.Parent; | 136 | ProjectNode project = (ProjectNode)refr.Parent; |
137 | string fileRef = FindFileReference(refr.Name, project); | 137 | string fileRef = FindFileReference(refr.Name, project); |
138 | 138 | ||
139 | if(refr.Path != null || fileRef != null) | 139 | if(refr.Path != null || fileRef != null) |
140 | { | 140 | { |
141 | string finalPath = (refr.Path != null) ? Helper.NormalizePath(refr.Path, '/') : fileRef; | 141 | string finalPath = (refr.Path != null) ? Helper.NormalizePath(refr.Path, '/') : fileRef; |
142 | ret += finalPath; | 142 | ret += finalPath; |
143 | return ret; | 143 | return ret; |
144 | } | 144 | } |
145 | 145 | ||
146 | try | 146 | try |
147 | { | 147 | { |
148 | Assembly assem = Assembly.Load(refr.Name); | 148 | Assembly assem = Assembly.Load(refr.Name); |
149 | if (assem != null) | 149 | if (assem != null) |
150 | { | 150 | { |
151 | ret += ""; | 151 | ret += ""; |
152 | } | 152 | } |
153 | else | 153 | else |
154 | { | 154 | { |
155 | ret += ""; | 155 | ret += ""; |
156 | } | 156 | } |
157 | } | 157 | } |
158 | catch (System.NullReferenceException e) | 158 | catch (System.NullReferenceException e) |
159 | { | 159 | { |
160 | e.ToString(); | 160 | e.ToString(); |
161 | ret += ""; | 161 | ret += ""; |
162 | } | 162 | } |
163 | } | 163 | } |
164 | return ret; | 164 | return ret; |
165 | } | 165 | } |
166 | 166 | ||
167 | private static string FindFileReference(string refName, ProjectNode project) | 167 | private static string FindFileReference(string refName, ProjectNode project) |
168 | { | 168 | { |
169 | foreach(ReferencePathNode refPath in project.ReferencePaths) | 169 | foreach(ReferencePathNode refPath in project.ReferencePaths) |
170 | { | 170 | { |
171 | string fullPath = Helper.MakeFilePath(refPath.Path, refName, "dll"); | 171 | string fullPath = Helper.MakeFilePath(refPath.Path, refName, "dll"); |
172 | 172 | ||
173 | if(File.Exists(fullPath)) | 173 | if(File.Exists(fullPath)) |
174 | { | 174 | { |
175 | return fullPath; | 175 | return fullPath; |
176 | } | 176 | } |
177 | } | 177 | } |
178 | 178 | ||
179 | return null; | 179 | return null; |
180 | } | 180 | } |
181 | 181 | ||
182 | /// <summary> | 182 | /// <summary> |
183 | /// Gets the XML doc file. | 183 | /// Gets the XML doc file. |
184 | /// </summary> | 184 | /// </summary> |
185 | /// <param name="project">The project.</param> | 185 | /// <param name="project">The project.</param> |
186 | /// <param name="conf">The conf.</param> | 186 | /// <param name="conf">The conf.</param> |
187 | /// <returns></returns> | 187 | /// <returns></returns> |
188 | public static string GetXmlDocFile(ProjectNode project, ConfigurationNode conf) | 188 | public static string GetXmlDocFile(ProjectNode project, ConfigurationNode conf) |
189 | { | 189 | { |
190 | if( conf == null ) | 190 | if( conf == null ) |
191 | { | 191 | { |
192 | throw new ArgumentNullException("conf"); | 192 | throw new ArgumentNullException("conf"); |
193 | } | 193 | } |
194 | if( project == null ) | 194 | if( project == null ) |
195 | { | 195 | { |
196 | throw new ArgumentNullException("project"); | 196 | throw new ArgumentNullException("project"); |
197 | } | 197 | } |
198 | string docFile = (string)conf.Options["XmlDocFile"]; | 198 | string docFile = (string)conf.Options["XmlDocFile"]; |
199 | // if(docFile != null && docFile.Length == 0)//default to assembly name if not specified | 199 | // if(docFile != null && docFile.Length == 0)//default to assembly name if not specified |
200 | // { | 200 | // { |
201 | // return Path.GetFileNameWithoutExtension(project.AssemblyName) + ".xml"; | 201 | // return Path.GetFileNameWithoutExtension(project.AssemblyName) + ".xml"; |
202 | // } | 202 | // } |
203 | return docFile; | 203 | return docFile; |
204 | } | 204 | } |
205 | 205 | ||
206 | private void WriteProject(SolutionNode solution, ProjectNode project) | 206 | private void WriteProject(SolutionNode solution, ProjectNode project) |
207 | { | 207 | { |
208 | string projFile = Helper.MakeFilePath(project.FullPath, project.Name + (project.Type == ProjectType.Library ? ".dll" : ".exe"), "build"); | 208 | string projFile = Helper.MakeFilePath(project.FullPath, project.Name + (project.Type == ProjectType.Library ? ".dll" : ".exe"), "build"); |
209 | StreamWriter ss = new StreamWriter(projFile); | 209 | StreamWriter ss = new StreamWriter(projFile); |
210 | 210 | ||
211 | m_Kernel.CurrentWorkingDirectory.Push(); | 211 | m_Kernel.CurrentWorkingDirectory.Push(); |
212 | Helper.SetCurrentDir(Path.GetDirectoryName(projFile)); | 212 | Helper.SetCurrentDir(Path.GetDirectoryName(projFile)); |
213 | bool hasDoc = false; | 213 | bool hasDoc = false; |
214 | 214 | ||
215 | using(ss) | 215 | using(ss) |
216 | { | 216 | { |
217 | ss.WriteLine("<?xml version=\"1.0\" ?>"); | 217 | ss.WriteLine("<?xml version=\"1.0\" ?>"); |
218 | ss.WriteLine("<project name=\"{0}\" default=\"build\">", project.Name); | 218 | ss.WriteLine("<project name=\"{0}\" default=\"build\">", project.Name); |
219 | ss.WriteLine(" <target name=\"{0}\">", "build"); | 219 | ss.WriteLine(" <target name=\"{0}\">", "build"); |
220 | ss.WriteLine(" <echo message=\"Build Directory is ${project::get-base-directory()}/${build.dir}\" />"); | 220 | ss.WriteLine(" <echo message=\"Build Directory is ${project::get-base-directory()}/${build.dir}\" />"); |
221 | ss.WriteLine(" <mkdir dir=\"${project::get-base-directory()}/${build.dir}\" />"); | 221 | ss.WriteLine(" <mkdir dir=\"${project::get-base-directory()}/${build.dir}\" />"); |
222 | ss.WriteLine(" <copy todir=\"${project::get-base-directory()}/${build.dir}\">"); | 222 | ss.WriteLine(" <copy todir=\"${project::get-base-directory()}/${build.dir}\">"); |
223 | ss.WriteLine(" <fileset basedir=\"${project::get-base-directory()}\">"); | 223 | ss.WriteLine(" <fileset basedir=\"${project::get-base-directory()}\">"); |
224 | foreach(ReferenceNode refr in project.References) | 224 | foreach(ReferenceNode refr in project.References) |
225 | { | 225 | { |
226 | if (refr.LocalCopy) | 226 | if (refr.LocalCopy) |
227 | { | 227 | { |
228 | ss.WriteLine(" <include name=\"{0}", Helper.NormalizePath(Helper.MakePathRelativeTo(project.FullPath, BuildReference(solution, project, refr))+"\" />", '/')); | 228 | ss.WriteLine(" <include name=\"{0}", Helper.NormalizePath(Helper.MakePathRelativeTo(project.FullPath, BuildReference(solution, project, refr))+"\" />", '/')); |
229 | } | 229 | } |
230 | } | 230 | } |
231 | ss.WriteLine(" </fileset>"); | 231 | ss.WriteLine(" </fileset>"); |
232 | ss.WriteLine(" </copy>"); | 232 | ss.WriteLine(" </copy>"); |
233 | ss.Write(" <csc"); | 233 | ss.Write(" <csc"); |
234 | ss.Write(" target=\"{0}\"", project.Type.ToString().ToLower()); | 234 | ss.Write(" target=\"{0}\"", project.Type.ToString().ToLower()); |
235 | ss.Write(" debug=\"{0}\"", "${build.debug}"); | 235 | ss.Write(" debug=\"{0}\"", "${build.debug}"); |
236 | foreach(ConfigurationNode conf in project.Configurations) | 236 | foreach(ConfigurationNode conf in project.Configurations) |
237 | { | 237 | { |
238 | if (conf.Options.KeyFile !="") | 238 | if (conf.Options.KeyFile !="") |
239 | { | 239 | { |
240 | ss.Write(" keyfile=\"{0}\"", conf.Options.KeyFile); | 240 | ss.Write(" keyfile=\"{0}\"", conf.Options.KeyFile); |
241 | break; | 241 | break; |
242 | } | 242 | } |
243 | } | 243 | } |
244 | foreach(ConfigurationNode conf in project.Configurations) | 244 | foreach(ConfigurationNode conf in project.Configurations) |
245 | { | 245 | { |
246 | ss.Write(" unsafe=\"{0}\"", conf.Options.AllowUnsafe); | 246 | ss.Write(" unsafe=\"{0}\"", conf.Options.AllowUnsafe); |
247 | break; | 247 | break; |
248 | } | 248 | } |
249 | foreach(ConfigurationNode conf in project.Configurations) | 249 | foreach(ConfigurationNode conf in project.Configurations) |
250 | { | 250 | { |
251 | ss.Write(" define=\"{0}\"", conf.Options.CompilerDefines); | 251 | ss.Write(" define=\"{0}\"", conf.Options.CompilerDefines); |
252 | break; | 252 | break; |
253 | } | 253 | } |
254 | foreach(ConfigurationNode conf in project.Configurations) | 254 | foreach(ConfigurationNode conf in project.Configurations) |
255 | { | 255 | { |
256 | if (GetXmlDocFile(project, conf) !="") | 256 | if (GetXmlDocFile(project, conf) !="") |
257 | { | 257 | { |
258 | ss.Write(" doc=\"{0}\"", "${project::get-base-directory()}/${build.dir}/" + GetXmlDocFile(project, conf)); | 258 | ss.Write(" doc=\"{0}\"", "${project::get-base-directory()}/${build.dir}/" + GetXmlDocFile(project, conf)); |
259 | hasDoc = true; | 259 | hasDoc = true; |
260 | } | 260 | } |
261 | break; | 261 | break; |
262 | } | 262 | } |
263 | ss.Write(" output=\"{0}", "${project::get-base-directory()}/${build.dir}/${project::get-name()}"); | 263 | ss.Write(" output=\"{0}", "${project::get-base-directory()}/${build.dir}/${project::get-name()}"); |
264 | if (project.Type == ProjectType.Library) | 264 | if (project.Type == ProjectType.Library) |
265 | { | 265 | { |
266 | ss.Write(".dll\""); | 266 | ss.Write(".dll\""); |
267 | } | 267 | } |
268 | else | 268 | else |
269 | { | 269 | { |
270 | ss.Write(".exe\""); | 270 | ss.Write(".exe\""); |
271 | } | 271 | } |
272 | if(project.AppIcon != null && project.AppIcon.Length != 0) | 272 | if(project.AppIcon != null && project.AppIcon.Length != 0) |
273 | { | 273 | { |
274 | ss.Write(" win32icon=\"{0}\"", Helper.NormalizePath(project.AppIcon,'/')); | 274 | ss.Write(" win32icon=\"{0}\"", Helper.NormalizePath(project.AppIcon,'/')); |
275 | } | 275 | } |
276 | ss.WriteLine(">"); | 276 | ss.WriteLine(">"); |
277 | ss.WriteLine(" <resources prefix=\"{0}\" dynamicprefix=\"true\" >", project.RootNamespace); | 277 | ss.WriteLine(" <resources prefix=\"{0}\" dynamicprefix=\"true\" >", project.RootNamespace); |
278 | foreach (string file in project.Files) | 278 | foreach (string file in project.Files) |
279 | { | 279 | { |
280 | switch (project.Files.GetBuildAction(file)) | 280 | switch (project.Files.GetBuildAction(file)) |
281 | { | 281 | { |
282 | case BuildAction.EmbeddedResource: | 282 | case BuildAction.EmbeddedResource: |
283 | ss.WriteLine(" {0}", "<include name=\"" + Helper.NormalizePath(PrependPath(file), '/') + "\" />"); | 283 | ss.WriteLine(" {0}", "<include name=\"" + Helper.NormalizePath(PrependPath(file), '/') + "\" />"); |
284 | break; | 284 | break; |
285 | default: | 285 | default: |
286 | if (project.Files.GetSubType(file) != SubType.Code && project.Files.GetSubType(file) != SubType.Settings) | 286 | if (project.Files.GetSubType(file) != SubType.Code && project.Files.GetSubType(file) != SubType.Settings) |
287 | { | 287 | { |
288 | ss.WriteLine(" <include name=\"{0}\" />", file.Substring(0, file.LastIndexOf('.')) + ".resx"); | 288 | ss.WriteLine(" <include name=\"{0}\" />", file.Substring(0, file.LastIndexOf('.')) + ".resx"); |
289 | } | 289 | } |
290 | break; | 290 | break; |
291 | } | 291 | } |
292 | } | 292 | } |
293 | //if (project.Files.GetSubType(file).ToString() != "Code") | 293 | //if (project.Files.GetSubType(file).ToString() != "Code") |
294 | //{ | 294 | //{ |
295 | // ps.WriteLine(" <EmbeddedResource Include=\"{0}\">", file.Substring(0, file.LastIndexOf('.')) + ".resx"); | 295 | // ps.WriteLine(" <EmbeddedResource Include=\"{0}\">", file.Substring(0, file.LastIndexOf('.')) + ".resx"); |
296 | 296 | ||
297 | ss.WriteLine(" </resources>"); | 297 | ss.WriteLine(" </resources>"); |
298 | ss.WriteLine(" <sources failonempty=\"true\">"); | 298 | ss.WriteLine(" <sources failonempty=\"true\">"); |
299 | foreach(string file in project.Files) | 299 | foreach(string file in project.Files) |
300 | { | 300 | { |
301 | switch(project.Files.GetBuildAction(file)) | 301 | switch(project.Files.GetBuildAction(file)) |
302 | { | 302 | { |
303 | case BuildAction.Compile: | 303 | case BuildAction.Compile: |
304 | ss.WriteLine(" <include name=\"" + Helper.NormalizePath(PrependPath(file), '/') + "\" />"); | 304 | ss.WriteLine(" <include name=\"" + Helper.NormalizePath(PrependPath(file), '/') + "\" />"); |
305 | break; | 305 | break; |
306 | default: | 306 | default: |
307 | break; | 307 | break; |
308 | } | 308 | } |
309 | } | 309 | } |
310 | ss.WriteLine(" </sources>"); | 310 | ss.WriteLine(" </sources>"); |
311 | ss.WriteLine(" <references basedir=\"${project::get-base-directory()}\">"); | 311 | ss.WriteLine(" <references basedir=\"${project::get-base-directory()}\">"); |
312 | ss.WriteLine(" <lib>"); | 312 | ss.WriteLine(" <lib>"); |
313 | ss.WriteLine(" <include name=\"${project::get-base-directory()}\" />"); | 313 | ss.WriteLine(" <include name=\"${project::get-base-directory()}\" />"); |
314 | ss.WriteLine(" <include name=\"${project::get-base-directory()}/${build.dir}\" />"); | 314 | ss.WriteLine(" <include name=\"${project::get-base-directory()}/${build.dir}\" />"); |
315 | ss.WriteLine(" </lib>"); | 315 | ss.WriteLine(" </lib>"); |
316 | foreach(ReferenceNode refr in project.References) | 316 | foreach(ReferenceNode refr in project.References) |
317 | { | 317 | { |
318 | string path = Helper.NormalizePath(Helper.MakePathRelativeTo(project.FullPath, BuildReference(solution, project, refr)), '/'); | 318 | string path = Helper.NormalizePath(Helper.MakePathRelativeTo(project.FullPath, BuildReference(solution, project, refr)), '/'); |
319 | ss.WriteLine(" <include name=\""+ path + "\" />" ); | 319 | ss.WriteLine(" <include name=\""+ path + "\" />" ); |
320 | } | 320 | } |
321 | ss.WriteLine(" </references>"); | 321 | ss.WriteLine(" </references>"); |
322 | 322 | ||
323 | ss.WriteLine(" </csc>"); | 323 | ss.WriteLine(" </csc>"); |
324 | 324 | ||
325 | foreach (ConfigurationNode conf in project.Configurations) | 325 | foreach (ConfigurationNode conf in project.Configurations) |
326 | { | 326 | { |
327 | if (!String.IsNullOrEmpty(conf.Options.OutputPath)) | 327 | if (!String.IsNullOrEmpty(conf.Options.OutputPath)) |
328 | { | 328 | { |
329 | string targetDir = Helper.NormalizePath(conf.Options.OutputPath, '/'); | 329 | string targetDir = Helper.NormalizePath(conf.Options.OutputPath, '/'); |
330 | 330 | ||
331 | ss.WriteLine(" <echo message=\"Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/" + targetDir + "\" />"); | 331 | ss.WriteLine(" <echo message=\"Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/" + targetDir + "\" />"); |
332 | 332 | ||
333 | ss.WriteLine(" <mkdir dir=\"${project::get-base-directory()}/" + targetDir + "\"/>"); | 333 | ss.WriteLine(" <mkdir dir=\"${project::get-base-directory()}/" + targetDir + "\"/>"); |
334 | 334 | ||
335 | ss.WriteLine(" <copy todir=\"${project::get-base-directory()}/" + targetDir + "\">"); | 335 | ss.WriteLine(" <copy todir=\"${project::get-base-directory()}/" + targetDir + "\">"); |
336 | ss.WriteLine(" <fileset basedir=\"${project::get-base-directory()}/${build.dir}/\" >"); | 336 | ss.WriteLine(" <fileset basedir=\"${project::get-base-directory()}/${build.dir}/\" >"); |
337 | ss.WriteLine(" <include name=\"*.dll\"/>"); | 337 | ss.WriteLine(" <include name=\"*.dll\"/>"); |
338 | ss.WriteLine(" <include name=\"*.exe\"/>"); | 338 | ss.WriteLine(" <include name=\"*.exe\"/>"); |
339 | ss.WriteLine(" </fileset>"); | 339 | ss.WriteLine(" </fileset>"); |
340 | ss.WriteLine(" </copy>"); | 340 | ss.WriteLine(" </copy>"); |
341 | break; | 341 | break; |
342 | } | 342 | } |
343 | } | 343 | } |
344 | 344 | ||
345 | ss.WriteLine(" </target>"); | 345 | ss.WriteLine(" </target>"); |
346 | 346 | ||
347 | ss.WriteLine(" <target name=\"clean\">"); | 347 | ss.WriteLine(" <target name=\"clean\">"); |
348 | ss.WriteLine(" <delete dir=\"${bin.dir}\" failonerror=\"false\" />"); | 348 | ss.WriteLine(" <delete dir=\"${bin.dir}\" failonerror=\"false\" />"); |
349 | ss.WriteLine(" <delete dir=\"${obj.dir}\" failonerror=\"false\" />"); | 349 | ss.WriteLine(" <delete dir=\"${obj.dir}\" failonerror=\"false\" />"); |
350 | ss.WriteLine(" </target>"); | 350 | ss.WriteLine(" </target>"); |
351 | 351 | ||
352 | ss.WriteLine(" <target name=\"doc\" description=\"Creates documentation.\">"); | 352 | ss.WriteLine(" <target name=\"doc\" description=\"Creates documentation.\">"); |
353 | if (hasDoc) | 353 | if (hasDoc) |
354 | { | 354 | { |
355 | ss.WriteLine(" <property name=\"doc.target\" value=\"\" />"); | 355 | ss.WriteLine(" <property name=\"doc.target\" value=\"\" />"); |
356 | ss.WriteLine(" <if test=\"${platform::is-unix()}\">"); | 356 | ss.WriteLine(" <if test=\"${platform::is-unix()}\">"); |
357 | ss.WriteLine(" <property name=\"doc.target\" value=\"Web\" />"); | 357 | ss.WriteLine(" <property name=\"doc.target\" value=\"Web\" />"); |
358 | ss.WriteLine(" </if>"); | 358 | ss.WriteLine(" </if>"); |
359 | ss.WriteLine(" <ndoc failonerror=\"false\" verbose=\"true\">"); | 359 | ss.WriteLine(" <ndoc failonerror=\"false\" verbose=\"true\">"); |
360 | ss.WriteLine(" <assemblies basedir=\"${project::get-base-directory()}\">"); | 360 | ss.WriteLine(" <assemblies basedir=\"${project::get-base-directory()}\">"); |
361 | ss.Write(" <include name=\"${build.dir}/${project::get-name()}"); | 361 | ss.Write(" <include name=\"${build.dir}/${project::get-name()}"); |
362 | if (project.Type == ProjectType.Library) | 362 | if (project.Type == ProjectType.Library) |
363 | { | 363 | { |
364 | ss.WriteLine(".dll\" />"); | 364 | ss.WriteLine(".dll\" />"); |
365 | } | 365 | } |
366 | else | 366 | else |
367 | { | 367 | { |
368 | ss.WriteLine(".exe\" />"); | 368 | ss.WriteLine(".exe\" />"); |
369 | } | 369 | } |
370 | 370 | ||
371 | ss.WriteLine(" </assemblies>"); | 371 | ss.WriteLine(" </assemblies>"); |
372 | ss.WriteLine(" <summaries basedir=\"${project::get-base-directory()}\">"); | 372 | ss.WriteLine(" <summaries basedir=\"${project::get-base-directory()}\">"); |
373 | ss.WriteLine(" <include name=\"${build.dir}/${project::get-name()}.xml\"/>"); | 373 | ss.WriteLine(" <include name=\"${build.dir}/${project::get-name()}.xml\"/>"); |
374 | ss.WriteLine(" </summaries>"); | 374 | ss.WriteLine(" </summaries>"); |
375 | ss.WriteLine(" <referencepaths basedir=\"${project::get-base-directory()}\">"); | 375 | ss.WriteLine(" <referencepaths basedir=\"${project::get-base-directory()}\">"); |
376 | ss.WriteLine(" <include name=\"${build.dir}\" />"); | 376 | ss.WriteLine(" <include name=\"${build.dir}\" />"); |
377 | // foreach(ReferenceNode refr in project.References) | 377 | // foreach(ReferenceNode refr in project.References) |
378 | // { | 378 | // { |
379 | // string path = Helper.NormalizePath(Helper.MakePathRelativeTo(project.FullPath, BuildReferencePath(solution, refr)), '/'); | 379 | // string path = Helper.NormalizePath(Helper.MakePathRelativeTo(project.FullPath, BuildReferencePath(solution, refr)), '/'); |
380 | // if (path != "") | 380 | // if (path != "") |
381 | // { | 381 | // { |
382 | // ss.WriteLine(" <include name=\"{0}\" />", path); | 382 | // ss.WriteLine(" <include name=\"{0}\" />", path); |
383 | // } | 383 | // } |
384 | // } | 384 | // } |
385 | ss.WriteLine(" </referencepaths>"); | 385 | ss.WriteLine(" </referencepaths>"); |
386 | ss.WriteLine(" <documenters>"); | 386 | ss.WriteLine(" <documenters>"); |
387 | ss.WriteLine(" <documenter name=\"MSDN\">"); | 387 | ss.WriteLine(" <documenter name=\"MSDN\">"); |
388 | ss.WriteLine(" <property name=\"OutputDirectory\" value=\"${project::get-base-directory()}/${build.dir}/doc/${project::get-name()}\" />"); | 388 | ss.WriteLine(" <property name=\"OutputDirectory\" value=\"${project::get-base-directory()}/${build.dir}/doc/${project::get-name()}\" />"); |
389 | ss.WriteLine(" <property name=\"OutputTarget\" value=\"${doc.target}\" />"); | 389 | ss.WriteLine(" <property name=\"OutputTarget\" value=\"${doc.target}\" />"); |
390 | ss.WriteLine(" <property name=\"HtmlHelpName\" value=\"${project::get-name()}\" />"); | 390 | ss.WriteLine(" <property name=\"HtmlHelpName\" value=\"${project::get-name()}\" />"); |
391 | ss.WriteLine(" <property name=\"IncludeFavorites\" value=\"False\" />"); | 391 | ss.WriteLine(" <property name=\"IncludeFavorites\" value=\"False\" />"); |
392 | ss.WriteLine(" <property name=\"Title\" value=\"${project::get-name()} SDK Documentation\" />"); | 392 | ss.WriteLine(" <property name=\"Title\" value=\"${project::get-name()} SDK Documentation\" />"); |
393 | ss.WriteLine(" <property name=\"SplitTOCs\" value=\"False\" />"); | 393 | ss.WriteLine(" <property name=\"SplitTOCs\" value=\"False\" />"); |
394 | ss.WriteLine(" <property name=\"DefaulTOC\" value=\"\" />"); | 394 | ss.WriteLine(" <property name=\"DefaulTOC\" value=\"\" />"); |
395 | ss.WriteLine(" <property name=\"ShowVisualBasic\" value=\"True\" />"); | 395 | ss.WriteLine(" <property name=\"ShowVisualBasic\" value=\"True\" />"); |
396 | ss.WriteLine(" <property name=\"AutoDocumentConstructors\" value=\"True\" />"); | 396 | ss.WriteLine(" <property name=\"AutoDocumentConstructors\" value=\"True\" />"); |
397 | ss.WriteLine(" <property name=\"ShowMissingSummaries\" value=\"${build.debug}\" />"); | 397 | ss.WriteLine(" <property name=\"ShowMissingSummaries\" value=\"${build.debug}\" />"); |
398 | ss.WriteLine(" <property name=\"ShowMissingRemarks\" value=\"${build.debug}\" />"); | 398 | ss.WriteLine(" <property name=\"ShowMissingRemarks\" value=\"${build.debug}\" />"); |
399 | ss.WriteLine(" <property name=\"ShowMissingParams\" value=\"${build.debug}\" />"); | 399 | ss.WriteLine(" <property name=\"ShowMissingParams\" value=\"${build.debug}\" />"); |
400 | ss.WriteLine(" <property name=\"ShowMissingReturns\" value=\"${build.debug}\" />"); | 400 | ss.WriteLine(" <property name=\"ShowMissingReturns\" value=\"${build.debug}\" />"); |
401 | ss.WriteLine(" <property name=\"ShowMissingValues\" value=\"${build.debug}\" />"); | 401 | ss.WriteLine(" <property name=\"ShowMissingValues\" value=\"${build.debug}\" />"); |
402 | ss.WriteLine(" <property name=\"DocumentInternals\" value=\"False\" />"); | 402 | ss.WriteLine(" <property name=\"DocumentInternals\" value=\"False\" />"); |
403 | ss.WriteLine(" <property name=\"DocumentPrivates\" value=\"False\" />"); | 403 | ss.WriteLine(" <property name=\"DocumentPrivates\" value=\"False\" />"); |
404 | ss.WriteLine(" <property name=\"DocumentProtected\" value=\"True\" />"); | 404 | ss.WriteLine(" <property name=\"DocumentProtected\" value=\"True\" />"); |
405 | ss.WriteLine(" <property name=\"DocumentEmptyNamespaces\" value=\"${build.debug}\" />"); | 405 | ss.WriteLine(" <property name=\"DocumentEmptyNamespaces\" value=\"${build.debug}\" />"); |
406 | ss.WriteLine(" <property name=\"IncludeAssemblyVersion\" value=\"True\" />"); | 406 | ss.WriteLine(" <property name=\"IncludeAssemblyVersion\" value=\"True\" />"); |
407 | ss.WriteLine(" </documenter>"); | 407 | ss.WriteLine(" </documenter>"); |
408 | ss.WriteLine(" </documenters>"); | 408 | ss.WriteLine(" </documenters>"); |
409 | ss.WriteLine(" </ndoc>"); | 409 | ss.WriteLine(" </ndoc>"); |
410 | } | 410 | } |
411 | ss.WriteLine(" </target>"); | 411 | ss.WriteLine(" </target>"); |
412 | ss.WriteLine("</project>"); | 412 | ss.WriteLine("</project>"); |
413 | } | 413 | } |
414 | m_Kernel.CurrentWorkingDirectory.Pop(); | 414 | m_Kernel.CurrentWorkingDirectory.Pop(); |
415 | } | 415 | } |
416 | 416 | ||
417 | private void WriteCombine(SolutionNode solution) | 417 | private void WriteCombine(SolutionNode solution) |
418 | { | 418 | { |
419 | m_Kernel.Log.Write("Creating NAnt build files"); | 419 | m_Kernel.Log.Write("Creating NAnt build files"); |
420 | foreach(ProjectNode project in solution.Projects) | 420 | foreach(ProjectNode project in solution.Projects) |
421 | { | 421 | { |
422 | if(m_Kernel.AllowProject(project.FilterGroups)) | 422 | if(m_Kernel.AllowProject(project.FilterGroups)) |
423 | { | 423 | { |
424 | m_Kernel.Log.Write("...Creating project: {0}", project.Name); | 424 | m_Kernel.Log.Write("...Creating project: {0}", project.Name); |
425 | WriteProject(solution, project); | 425 | WriteProject(solution, project); |
426 | } | 426 | } |
427 | } | 427 | } |
428 | 428 | ||
429 | m_Kernel.Log.Write(""); | 429 | m_Kernel.Log.Write(""); |
430 | string combFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "build"); | 430 | string combFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "build"); |
431 | StreamWriter ss = new StreamWriter(combFile); | 431 | StreamWriter ss = new StreamWriter(combFile); |
432 | 432 | ||
433 | m_Kernel.CurrentWorkingDirectory.Push(); | 433 | m_Kernel.CurrentWorkingDirectory.Push(); |
434 | Helper.SetCurrentDir(Path.GetDirectoryName(combFile)); | 434 | Helper.SetCurrentDir(Path.GetDirectoryName(combFile)); |
435 | 435 | ||
436 | using(ss) | 436 | using(ss) |
437 | { | 437 | { |
438 | ss.WriteLine("<?xml version=\"1.0\" ?>"); | 438 | ss.WriteLine("<?xml version=\"1.0\" ?>"); |
439 | ss.WriteLine("<project name=\"{0}\" default=\"build\">", solution.Name); | 439 | ss.WriteLine("<project name=\"{0}\" default=\"build\">", solution.Name); |
440 | ss.WriteLine(" <echo message=\"Using '${nant.settings.currentframework}' Framework\"/>"); | 440 | ss.WriteLine(" <echo message=\"Using '${nant.settings.currentframework}' Framework\"/>"); |
441 | ss.WriteLine(); | 441 | ss.WriteLine(); |
442 | 442 | ||
443 | //ss.WriteLine(" <property name=\"dist.dir\" value=\"dist\" />"); | 443 | //ss.WriteLine(" <property name=\"dist.dir\" value=\"dist\" />"); |
444 | //ss.WriteLine(" <property name=\"source.dir\" value=\"source\" />"); | 444 | //ss.WriteLine(" <property name=\"source.dir\" value=\"source\" />"); |
445 | ss.WriteLine(" <property name=\"bin.dir\" value=\"bin\" />"); | 445 | ss.WriteLine(" <property name=\"bin.dir\" value=\"bin\" />"); |
446 | ss.WriteLine(" <property name=\"obj.dir\" value=\"obj\" />"); | 446 | ss.WriteLine(" <property name=\"obj.dir\" value=\"obj\" />"); |
447 | ss.WriteLine(" <property name=\"doc.dir\" value=\"doc\" />"); | 447 | ss.WriteLine(" <property name=\"doc.dir\" value=\"doc\" />"); |
448 | ss.WriteLine(" <property name=\"project.main.dir\" value=\"${project::get-base-directory()}\" />"); | 448 | ss.WriteLine(" <property name=\"project.main.dir\" value=\"${project::get-base-directory()}\" />"); |
449 | 449 | ||
450 | foreach(ConfigurationNode conf in solution.Configurations) | 450 | foreach(ConfigurationNode conf in solution.Configurations) |
451 | { | 451 | { |
452 | // Set the project.config to a non-debug configuration | 452 | // Set the project.config to a non-debug configuration |
453 | if( conf.Options["DebugInformation"].ToString().ToLower() != "true" ) | 453 | if( conf.Options["DebugInformation"].ToString().ToLower() != "true" ) |
454 | { | 454 | { |
455 | ss.WriteLine(" <property name=\"project.config\" value=\"{0}\" />", conf.Name); | 455 | ss.WriteLine(" <property name=\"project.config\" value=\"{0}\" />", conf.Name); |
456 | } | 456 | } |
457 | ss.WriteLine(); | 457 | ss.WriteLine(); |
458 | ss.WriteLine(" <target name=\"{0}\" description=\"\">", conf.Name); | 458 | ss.WriteLine(" <target name=\"{0}\" description=\"\">", conf.Name); |
459 | ss.WriteLine(" <property name=\"project.config\" value=\"{0}\" />", conf.Name); | 459 | ss.WriteLine(" <property name=\"project.config\" value=\"{0}\" />", conf.Name); |
460 | ss.WriteLine(" <property name=\"build.debug\" value=\"{0}\" />", conf.Options["DebugInformation"].ToString().ToLower()); | 460 | ss.WriteLine(" <property name=\"build.debug\" value=\"{0}\" />", conf.Options["DebugInformation"].ToString().ToLower()); |
461 | ss.WriteLine(" </target>"); | 461 | ss.WriteLine(" </target>"); |
462 | ss.WriteLine(); | 462 | ss.WriteLine(); |
463 | } | 463 | } |
464 | 464 | ||
465 | ss.WriteLine(" <target name=\"net-1.1\" description=\"Sets framework to .NET 1.1\">"); | 465 | ss.WriteLine(" <target name=\"net-1.1\" description=\"Sets framework to .NET 1.1\">"); |
466 | ss.WriteLine(" <property name=\"nant.settings.currentframework\" value=\"net-1.1\" />"); | 466 | ss.WriteLine(" <property name=\"nant.settings.currentframework\" value=\"net-1.1\" />"); |
467 | ss.WriteLine(" </target>"); | 467 | ss.WriteLine(" </target>"); |
468 | ss.WriteLine(); | 468 | ss.WriteLine(); |
469 | 469 | ||
470 | ss.WriteLine(" <target name=\"net-2.0\" description=\"Sets framework to .NET 2.0\">"); | 470 | ss.WriteLine(" <target name=\"net-2.0\" description=\"Sets framework to .NET 2.0\">"); |
471 | ss.WriteLine(" <property name=\"nant.settings.currentframework\" value=\"net-2.0\" />"); | 471 | ss.WriteLine(" <property name=\"nant.settings.currentframework\" value=\"net-2.0\" />"); |
472 | ss.WriteLine(" </target>"); | 472 | ss.WriteLine(" </target>"); |
473 | ss.WriteLine(); | 473 | ss.WriteLine(); |
474 | 474 | ||
475 | ss.WriteLine(" <target name=\"mono-2.0\" description=\"Sets framework to mono 2.0\">"); | 475 | ss.WriteLine(" <target name=\"mono-2.0\" description=\"Sets framework to mono 2.0\">"); |
476 | ss.WriteLine(" <property name=\"nant.settings.currentframework\" value=\"mono-2.0\" />"); | 476 | ss.WriteLine(" <property name=\"nant.settings.currentframework\" value=\"mono-2.0\" />"); |
477 | ss.WriteLine(" </target>"); | 477 | ss.WriteLine(" </target>"); |
478 | ss.WriteLine(); | 478 | ss.WriteLine(); |
479 | 479 | ||
480 | ss.WriteLine(" <target name=\"mono-1.0\" description=\"Sets framework to mono 1.0\">"); | 480 | ss.WriteLine(" <target name=\"mono-1.0\" description=\"Sets framework to mono 1.0\">"); |
481 | ss.WriteLine(" <property name=\"nant.settings.currentframework\" value=\"mono-1.0\" />"); | 481 | ss.WriteLine(" <property name=\"nant.settings.currentframework\" value=\"mono-1.0\" />"); |
482 | ss.WriteLine(" </target>"); | 482 | ss.WriteLine(" </target>"); |
483 | ss.WriteLine(); | 483 | ss.WriteLine(); |
484 | 484 | ||
485 | ss.WriteLine(" <target name=\"init\" description=\"\">"); | 485 | ss.WriteLine(" <target name=\"init\" description=\"\">"); |
486 | ss.WriteLine(" <call target=\"${project.config}\" />"); | 486 | ss.WriteLine(" <call target=\"${project.config}\" />"); |
487 | ss.WriteLine(" <sysinfo />"); | 487 | ss.WriteLine(" <sysinfo />"); |
488 | ss.WriteLine(" <echo message=\"Platform ${sys.os.platform}\" />"); | 488 | ss.WriteLine(" <echo message=\"Platform ${sys.os.platform}\" />"); |
489 | ss.WriteLine(" <property name=\"build.dir\" value=\"${bin.dir}/${project.config}\" />"); | 489 | ss.WriteLine(" <property name=\"build.dir\" value=\"${bin.dir}/${project.config}\" />"); |
490 | ss.WriteLine(" </target>"); | 490 | ss.WriteLine(" </target>"); |
491 | ss.WriteLine(); | 491 | ss.WriteLine(); |
492 | 492 | ||
493 | ss.WriteLine(" <target name=\"clean\" description=\"\">"); | 493 | ss.WriteLine(" <target name=\"clean\" description=\"\">"); |
494 | ss.WriteLine(" <echo message=\"Deleting all builds from all configurations\" />"); | 494 | ss.WriteLine(" <echo message=\"Deleting all builds from all configurations\" />"); |
495 | //ss.WriteLine(" <delete dir=\"${dist.dir}\" failonerror=\"false\" />"); | 495 | //ss.WriteLine(" <delete dir=\"${dist.dir}\" failonerror=\"false\" />"); |
496 | ss.WriteLine(" <delete dir=\"${bin.dir}\" failonerror=\"false\" />"); | 496 | ss.WriteLine(" <delete dir=\"${bin.dir}\" failonerror=\"false\" />"); |
497 | ss.WriteLine(" <delete dir=\"${obj.dir}\" failonerror=\"false\" />"); | 497 | ss.WriteLine(" <delete dir=\"${obj.dir}\" failonerror=\"false\" />"); |
498 | foreach(ProjectNode project in solution.Projects) | 498 | foreach(ProjectNode project in solution.Projects) |
499 | { | 499 | { |
500 | string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath); | 500 | string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath); |
501 | ss.Write(" <nant buildfile=\"{0}\"", | 501 | ss.Write(" <nant buildfile=\"{0}\"", |
502 | Helper.NormalizePath(Helper.MakeFilePath(path, project.Name + (project.Type == ProjectType.Library ? ".dll" : ".exe"), "build"),'/')); | 502 | Helper.NormalizePath(Helper.MakeFilePath(path, project.Name + (project.Type == ProjectType.Library ? ".dll" : ".exe"), "build"),'/')); |
503 | ss.WriteLine(" target=\"clean\" />"); | 503 | ss.WriteLine(" target=\"clean\" />"); |
504 | } | 504 | } |
505 | ss.WriteLine(" </target>"); | 505 | ss.WriteLine(" </target>"); |
506 | ss.WriteLine(); | 506 | ss.WriteLine(); |
507 | 507 | ||
508 | ss.WriteLine(" <target name=\"build\" depends=\"init\" description=\"\">"); | 508 | ss.WriteLine(" <target name=\"build\" depends=\"init\" description=\"\">"); |
509 | 509 | ||
510 | foreach(ProjectNode project in solution.ProjectsTableOrder) | 510 | foreach(ProjectNode project in solution.ProjectsTableOrder) |
511 | { | 511 | { |
512 | string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath); | 512 | string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath); |
513 | ss.Write(" <nant buildfile=\"{0}\"", | 513 | ss.Write(" <nant buildfile=\"{0}\"", |
514 | Helper.NormalizePath(Helper.MakeFilePath(path, project.Name + (project.Type == ProjectType.Library ? ".dll" : ".exe"), "build"),'/')); | 514 | Helper.NormalizePath(Helper.MakeFilePath(path, project.Name + (project.Type == ProjectType.Library ? ".dll" : ".exe"), "build"),'/')); |
515 | ss.WriteLine(" target=\"build\" />"); | 515 | ss.WriteLine(" target=\"build\" />"); |
516 | } | 516 | } |
517 | ss.WriteLine(" </target>"); | 517 | ss.WriteLine(" </target>"); |
518 | ss.WriteLine(); | 518 | ss.WriteLine(); |
519 | 519 | ||
520 | ss.WriteLine(" <target name=\"build-release\" depends=\"Release, init, build\" description=\"Builds in Release mode\" />"); | 520 | ss.WriteLine(" <target name=\"build-release\" depends=\"Release, init, build\" description=\"Builds in Release mode\" />"); |
521 | ss.WriteLine(); | 521 | ss.WriteLine(); |
522 | ss.WriteLine(" <target name=\"build-debug\" depends=\"Debug, init, build\" description=\"Builds in Debug mode\" />"); | 522 | ss.WriteLine(" <target name=\"build-debug\" depends=\"Debug, init, build\" description=\"Builds in Debug mode\" />"); |
523 | ss.WriteLine(); | 523 | ss.WriteLine(); |
524 | //ss.WriteLine(" <target name=\"package\" depends=\"clean, doc, copyfiles, zip\" description=\"Builds in Release mode\" />"); | 524 | //ss.WriteLine(" <target name=\"package\" depends=\"clean, doc, copyfiles, zip\" description=\"Builds in Release mode\" />"); |
525 | ss.WriteLine(" <target name=\"package\" depends=\"clean, doc\" description=\"Builds all\" />"); | 525 | ss.WriteLine(" <target name=\"package\" depends=\"clean, doc\" description=\"Builds all\" />"); |
526 | ss.WriteLine(); | 526 | ss.WriteLine(); |
527 | 527 | ||
528 | ss.WriteLine(" <target name=\"doc\" depends=\"build-release\">"); | 528 | ss.WriteLine(" <target name=\"doc\" depends=\"build-release\">"); |
529 | ss.WriteLine(" <echo message=\"Generating all documentation from all builds\" />"); | 529 | ss.WriteLine(" <echo message=\"Generating all documentation from all builds\" />"); |
530 | foreach (ProjectNode project in solution.Projects) | 530 | foreach (ProjectNode project in solution.Projects) |
531 | { | 531 | { |
532 | string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath); | 532 | string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath); |
533 | ss.Write(" <nant buildfile=\"{0}\"", | 533 | ss.Write(" <nant buildfile=\"{0}\"", |
534 | Helper.NormalizePath(Helper.MakeFilePath(path, project.Name + (project.Type == ProjectType.Library ? ".dll" : ".exe"), "build"), '/')); | 534 | Helper.NormalizePath(Helper.MakeFilePath(path, project.Name + (project.Type == ProjectType.Library ? ".dll" : ".exe"), "build"), '/')); |
535 | ss.WriteLine(" target=\"doc\" />"); | 535 | ss.WriteLine(" target=\"doc\" />"); |
536 | } | 536 | } |
537 | ss.WriteLine(" </target>"); | 537 | ss.WriteLine(" </target>"); |
538 | ss.WriteLine(); | 538 | ss.WriteLine(); |
539 | ss.WriteLine("</project>"); | 539 | ss.WriteLine("</project>"); |
540 | } | 540 | } |
541 | 541 | ||
542 | m_Kernel.CurrentWorkingDirectory.Pop(); | 542 | m_Kernel.CurrentWorkingDirectory.Pop(); |
543 | } | 543 | } |
544 | 544 | ||
545 | private void CleanProject(ProjectNode project) | 545 | private void CleanProject(ProjectNode project) |
546 | { | 546 | { |
547 | m_Kernel.Log.Write("...Cleaning project: {0}", project.Name); | 547 | m_Kernel.Log.Write("...Cleaning project: {0}", project.Name); |
548 | string projectFile = Helper.MakeFilePath(project.FullPath, project.Name + (project.Type == ProjectType.Library ? ".dll" : ".exe"), "build"); | 548 | string projectFile = Helper.MakeFilePath(project.FullPath, project.Name + (project.Type == ProjectType.Library ? ".dll" : ".exe"), "build"); |
549 | Helper.DeleteIfExists(projectFile); | 549 | Helper.DeleteIfExists(projectFile); |
550 | } | 550 | } |
551 | 551 | ||
552 | private void CleanSolution(SolutionNode solution) | 552 | private void CleanSolution(SolutionNode solution) |
553 | { | 553 | { |
554 | m_Kernel.Log.Write("Cleaning NAnt build files for", solution.Name); | 554 | m_Kernel.Log.Write("Cleaning NAnt build files for", solution.Name); |
555 | 555 | ||
556 | string slnFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "build"); | 556 | string slnFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "build"); |
557 | Helper.DeleteIfExists(slnFile); | 557 | Helper.DeleteIfExists(slnFile); |
558 | 558 | ||
559 | foreach(ProjectNode project in solution.Projects) | 559 | foreach(ProjectNode project in solution.Projects) |
560 | { | 560 | { |
561 | CleanProject(project); | 561 | CleanProject(project); |
562 | } | 562 | } |
563 | 563 | ||
564 | m_Kernel.Log.Write(""); | 564 | m_Kernel.Log.Write(""); |
565 | } | 565 | } |
566 | 566 | ||
567 | #endregion | 567 | #endregion |
568 | 568 | ||
569 | #region ITarget Members | 569 | #region ITarget Members |
570 | 570 | ||
571 | /// <summary> | 571 | /// <summary> |
572 | /// Writes the specified kern. | 572 | /// Writes the specified kern. |
573 | /// </summary> | 573 | /// </summary> |
574 | /// <param name="kern">The kern.</param> | 574 | /// <param name="kern">The kern.</param> |
575 | public void Write(Kernel kern) | 575 | public void Write(Kernel kern) |
576 | { | 576 | { |
577 | if( kern == null ) | 577 | if( kern == null ) |
578 | { | 578 | { |
579 | throw new ArgumentNullException("kern"); | 579 | throw new ArgumentNullException("kern"); |
580 | } | 580 | } |
581 | m_Kernel = kern; | 581 | m_Kernel = kern; |
582 | foreach(SolutionNode solution in kern.Solutions) | 582 | foreach(SolutionNode solution in kern.Solutions) |
583 | { | 583 | { |
584 | WriteCombine(solution); | 584 | WriteCombine(solution); |
585 | } | 585 | } |
586 | m_Kernel = null; | 586 | m_Kernel = null; |
587 | } | 587 | } |
588 | 588 | ||
589 | /// <summary> | 589 | /// <summary> |
590 | /// Cleans the specified kern. | 590 | /// Cleans the specified kern. |
591 | /// </summary> | 591 | /// </summary> |
592 | /// <param name="kern">The kern.</param> | 592 | /// <param name="kern">The kern.</param> |
593 | public virtual void Clean(Kernel kern) | 593 | public virtual void Clean(Kernel kern) |
594 | { | 594 | { |
595 | if( kern == null ) | 595 | if( kern == null ) |
596 | { | 596 | { |
597 | throw new ArgumentNullException("kern"); | 597 | throw new ArgumentNullException("kern"); |
598 | } | 598 | } |
599 | m_Kernel = kern; | 599 | m_Kernel = kern; |
600 | foreach(SolutionNode sol in kern.Solutions) | 600 | foreach(SolutionNode sol in kern.Solutions) |
601 | { | 601 | { |
602 | CleanSolution(sol); | 602 | CleanSolution(sol); |
603 | } | 603 | } |
604 | m_Kernel = null; | 604 | m_Kernel = null; |
605 | } | 605 | } |
606 | 606 | ||
607 | /// <summary> | 607 | /// <summary> |
608 | /// Gets the name. | 608 | /// Gets the name. |
609 | /// </summary> | 609 | /// </summary> |
610 | /// <value>The name.</value> | 610 | /// <value>The name.</value> |
611 | public string Name | 611 | public string Name |
612 | { | 612 | { |
613 | get | 613 | get |
614 | { | 614 | { |
615 | return "nant"; | 615 | return "nant"; |
616 | } | 616 | } |
617 | } | 617 | } |
618 | 618 | ||
619 | #endregion | 619 | #endregion |
620 | } | 620 | } |
621 | } | 621 | } |
diff --git a/Prebuild/src/Core/Targets/SharpDevelop2Target.cs b/Prebuild/src/Core/Targets/SharpDevelop2Target.cs index bc84b96..7109ceb 100644 --- a/Prebuild/src/Core/Targets/SharpDevelop2Target.cs +++ b/Prebuild/src/Core/Targets/SharpDevelop2Target.cs | |||
@@ -1,90 +1,90 @@ | |||
1 | #region BSD License | 1 | #region BSD License |
2 | /* | 2 | /* |
3 | Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) | 3 | Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) |
4 | 4 | ||
5 | Redistribution and use in source and binary forms, with or without modification, are permitted | 5 | Redistribution and use in source and binary forms, with or without modification, are permitted |
6 | provided that the following conditions are met: | 6 | provided that the following conditions are met: |
7 | 7 | ||
8 | * Redistributions of source code must retain the above copyright notice, this list of conditions | 8 | * Redistributions of source code must retain the above copyright notice, this list of conditions |
9 | and the following disclaimer. | 9 | and the following disclaimer. |
10 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions | 10 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions |
11 | and the following disclaimer in the documentation and/or other materials provided with the | 11 | and the following disclaimer in the documentation and/or other materials provided with the |
12 | distribution. | 12 | distribution. |
13 | * The name of the author may not be used to endorse or promote products derived from this software | 13 | * The name of the author may not be used to endorse or promote products derived from this software |
14 | without specific prior written permission. | 14 | without specific prior written permission. |
15 | 15 | ||
16 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, | 16 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, |
17 | BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | 17 | BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
18 | ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | 18 | ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
19 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | 19 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
20 | OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY | 20 | OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
21 | OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | 21 | OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING |
22 | IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 22 | IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
23 | */ | 23 | */ |
24 | #endregion | 24 | #endregion |
25 | 25 | ||
26 | #region CVS Information | 26 | #region CVS Information |
27 | /* | 27 | /* |
28 | * $Source$ | 28 | * $Source$ |
29 | * $Author: jendave $ | 29 | * $Author: jendave $ |
30 | * $Date: 2006-01-27 16:49:58 -0800 (Fri, 27 Jan 2006) $ | 30 | * $Date: 2006-01-27 16:49:58 -0800 (Fri, 27 Jan 2006) $ |
31 | * $Revision: 71 $ | 31 | * $Revision: 71 $ |
32 | */ | 32 | */ |
33 | #endregion | 33 | #endregion |
34 | 34 | ||
35 | using System; | 35 | using System; |
36 | 36 | ||
37 | using Prebuild.Core.Attributes; | 37 | using Prebuild.Core.Attributes; |
38 | 38 | ||
39 | namespace Prebuild.Core.Targets | 39 | namespace Prebuild.Core.Targets |
40 | { | 40 | { |
41 | /// <summary> | 41 | /// <summary> |
42 | /// | 42 | /// |
43 | /// </summary> | 43 | /// </summary> |
44 | [Target("sharpdev2")] | 44 | [Target("sharpdev2")] |
45 | public class SharpDevelop2Target : VS2005Target | 45 | public class SharpDevelop2Target : VS2005Target |
46 | { | 46 | { |
47 | #region Private Methods | 47 | #region Private Methods |
48 | private void SetSharpDevelop2() | 48 | private void SetSharpDevelop2() |
49 | { | 49 | { |
50 | this.VersionName = "SharpDevelop2"; | 50 | this.VersionName = "SharpDevelop2"; |
51 | } | 51 | } |
52 | #endregion | 52 | #endregion |
53 | 53 | ||
54 | #region Public Methods | 54 | #region Public Methods |
55 | 55 | ||
56 | /// <summary> | 56 | /// <summary> |
57 | /// Writes the specified kern. | 57 | /// Writes the specified kern. |
58 | /// </summary> | 58 | /// </summary> |
59 | /// <param name="kern">The kern.</param> | 59 | /// <param name="kern">The kern.</param> |
60 | public override void Write(Kernel kern) | 60 | public override void Write(Kernel kern) |
61 | { | 61 | { |
62 | SetSharpDevelop2(); | 62 | SetSharpDevelop2(); |
63 | base.Write(kern); | 63 | base.Write(kern); |
64 | } | 64 | } |
65 | 65 | ||
66 | /// <summary> | 66 | /// <summary> |
67 | /// Cleans the specified kern. | 67 | /// Cleans the specified kern. |
68 | /// </summary> | 68 | /// </summary> |
69 | /// <param name="kern">The kern.</param> | 69 | /// <param name="kern">The kern.</param> |
70 | public override void Clean(Kernel kern) | 70 | public override void Clean(Kernel kern) |
71 | { | 71 | { |
72 | SetSharpDevelop2(); | 72 | SetSharpDevelop2(); |
73 | base.Clean(kern); | 73 | base.Clean(kern); |
74 | } | 74 | } |
75 | 75 | ||
76 | /// <summary> | 76 | /// <summary> |
77 | /// Gets the name. | 77 | /// Gets the name. |
78 | /// </summary> | 78 | /// </summary> |
79 | /// <value>The name.</value> | 79 | /// <value>The name.</value> |
80 | public override string Name | 80 | public override string Name |
81 | { | 81 | { |
82 | get | 82 | get |
83 | { | 83 | { |
84 | return "sharpdev2"; | 84 | return "sharpdev2"; |
85 | } | 85 | } |
86 | } | 86 | } |
87 | 87 | ||
88 | #endregion | 88 | #endregion |
89 | } | 89 | } |
90 | } | 90 | } |
diff --git a/Prebuild/src/Core/Targets/SharpDevelopTarget.cs b/Prebuild/src/Core/Targets/SharpDevelopTarget.cs index c725730..ededadb 100644 --- a/Prebuild/src/Core/Targets/SharpDevelopTarget.cs +++ b/Prebuild/src/Core/Targets/SharpDevelopTarget.cs | |||
@@ -1,437 +1,437 @@ | |||
1 | #region BSD License | 1 | #region BSD License |
2 | /* | 2 | /* |
3 | Copyright (c) 2004 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) | 3 | Copyright (c) 2004 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) |
4 | 4 | ||
5 | Redistribution and use in source and binary forms, with or without modification, are permitted | 5 | Redistribution and use in source and binary forms, with or without modification, are permitted |
6 | provided that the following conditions are met: | 6 | provided that the following conditions are met: |
7 | 7 | ||
8 | * Redistributions of source code must retain the above copyright notice, this list of conditions | 8 | * Redistributions of source code must retain the above copyright notice, this list of conditions |
9 | and the following disclaimer. | 9 | and the following disclaimer. |
10 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions | 10 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions |
11 | and the following disclaimer in the documentation and/or other materials provided with the | 11 | and the following disclaimer in the documentation and/or other materials provided with the |
12 | distribution. | 12 | distribution. |
13 | * The name of the author may not be used to endorse or promote products derived from this software | 13 | * The name of the author may not be used to endorse or promote products derived from this software |
14 | without specific prior written permission. | 14 | without specific prior written permission. |
15 | 15 | ||
16 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, | 16 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, |
17 | BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | 17 | BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
18 | ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | 18 | ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
19 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | 19 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
20 | OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY | 20 | OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
21 | OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | 21 | OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING |
22 | IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 22 | IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
23 | */ | 23 | */ |
24 | #endregion | 24 | #endregion |
25 | 25 | ||
26 | #region CVS Information | 26 | #region CVS Information |
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-13 21:58:03 +0100 (ti, 13 feb 2007) $ |
31 | * $Revision: 205 $ | 31 | * $Revision: 205 $ |
32 | */ | 32 | */ |
33 | #endregion | 33 | #endregion |
34 | 34 | ||
35 | using System; | 35 | using System; |
36 | using System.Collections; | 36 | using System.Collections; |
37 | using System.Collections.Specialized; | 37 | using System.Collections.Specialized; |
38 | using System.IO; | 38 | using System.IO; |
39 | using System.Text.RegularExpressions; | 39 | using System.Text.RegularExpressions; |
40 | using System.Reflection; | 40 | using System.Reflection; |
41 | 41 | ||
42 | using Prebuild.Core.Attributes; | 42 | using Prebuild.Core.Attributes; |
43 | using Prebuild.Core.Interfaces; | 43 | using Prebuild.Core.Interfaces; |
44 | using Prebuild.Core.Nodes; | 44 | using Prebuild.Core.Nodes; |
45 | using Prebuild.Core.Utilities; | 45 | using Prebuild.Core.Utilities; |
46 | 46 | ||
47 | namespace Prebuild.Core.Targets | 47 | namespace Prebuild.Core.Targets |
48 | { | 48 | { |
49 | /// <summary> | 49 | /// <summary> |
50 | /// | 50 | /// |
51 | /// </summary> | 51 | /// </summary> |
52 | [Target("sharpdev")] | 52 | [Target("sharpdev")] |
53 | public class SharpDevelopTarget : ITarget | 53 | public class SharpDevelopTarget : ITarget |
54 | { | 54 | { |
55 | #region Fields | 55 | #region Fields |
56 | 56 | ||
57 | private Kernel m_Kernel; | 57 | private Kernel m_Kernel; |
58 | 58 | ||
59 | #endregion | 59 | #endregion |
60 | 60 | ||
61 | #region Private Methods | 61 | #region Private Methods |
62 | 62 | ||
63 | private static string PrependPath(string path) | 63 | private static string PrependPath(string path) |
64 | { | 64 | { |
65 | string tmpPath = Helper.NormalizePath(path, '/'); | 65 | string tmpPath = Helper.NormalizePath(path, '/'); |
66 | Regex regex = new Regex(@"(\w):/(\w+)"); | 66 | Regex regex = new Regex(@"(\w):/(\w+)"); |
67 | Match match = regex.Match(tmpPath); | 67 | Match match = regex.Match(tmpPath); |
68 | if(match.Success || tmpPath[0] == '.' || tmpPath[0] == '/') | 68 | if(match.Success || tmpPath[0] == '.' || tmpPath[0] == '/') |
69 | { | 69 | { |
70 | tmpPath = Helper.NormalizePath(tmpPath); | 70 | tmpPath = Helper.NormalizePath(tmpPath); |
71 | } | 71 | } |
72 | else | 72 | else |
73 | { | 73 | { |
74 | tmpPath = Helper.NormalizePath("./" + tmpPath); | 74 | tmpPath = Helper.NormalizePath("./" + tmpPath); |
75 | } | 75 | } |
76 | 76 | ||
77 | return tmpPath; | 77 | return tmpPath; |
78 | } | 78 | } |
79 | 79 | ||
80 | private static string BuildReference(SolutionNode solution, ReferenceNode refr) | 80 | private static string BuildReference(SolutionNode solution, ReferenceNode refr) |
81 | { | 81 | { |
82 | string ret = "<Reference type=\""; | 82 | string ret = "<Reference type=\""; |
83 | if(solution.ProjectsTable.ContainsKey(refr.Name)) | 83 | if(solution.ProjectsTable.ContainsKey(refr.Name)) |
84 | { | 84 | { |
85 | ret += "Project\" refto=\"" + refr.Name; | 85 | ret += "Project\" refto=\"" + refr.Name; |
86 | ret += "\" localcopy=\"" + refr.LocalCopy.ToString() + "\" />"; | 86 | ret += "\" localcopy=\"" + refr.LocalCopy.ToString() + "\" />"; |
87 | } | 87 | } |
88 | else | 88 | else |
89 | { | 89 | { |
90 | ProjectNode project = (ProjectNode)refr.Parent; | 90 | ProjectNode project = (ProjectNode)refr.Parent; |
91 | string fileRef = FindFileReference(refr.Name, project); | 91 | string fileRef = FindFileReference(refr.Name, project); |
92 | 92 | ||
93 | if(refr.Path != null || fileRef != null) | 93 | if(refr.Path != null || fileRef != null) |
94 | { | 94 | { |
95 | ret += "Assembly\" refto=\""; | 95 | ret += "Assembly\" refto=\""; |
96 | 96 | ||
97 | string finalPath = (refr.Path != null) ? Helper.MakeFilePath(refr.Path, refr.Name, "dll") : fileRef; | 97 | string finalPath = (refr.Path != null) ? Helper.MakeFilePath(refr.Path, refr.Name, "dll") : fileRef; |
98 | 98 | ||
99 | ret += finalPath; | 99 | ret += finalPath; |
100 | ret += "\" localcopy=\"" + refr.LocalCopy.ToString() + "\" />"; | 100 | ret += "\" localcopy=\"" + refr.LocalCopy.ToString() + "\" />"; |
101 | return ret; | 101 | return ret; |
102 | } | 102 | } |
103 | 103 | ||
104 | ret += "Gac\" refto=\""; | 104 | ret += "Gac\" refto=\""; |
105 | try | 105 | try |
106 | { | 106 | { |
107 | //Assembly assem = Assembly.Load(refr.Name); | 107 | //Assembly assem = Assembly.Load(refr.Name); |
108 | ret += refr.Name;// assem.FullName; | 108 | ret += refr.Name;// assem.FullName; |
109 | } | 109 | } |
110 | catch (System.NullReferenceException e) | 110 | catch (System.NullReferenceException e) |
111 | { | 111 | { |
112 | e.ToString(); | 112 | e.ToString(); |
113 | ret += refr.Name; | 113 | ret += refr.Name; |
114 | } | 114 | } |
115 | ret += "\" localcopy=\"" + refr.LocalCopy.ToString() + "\" />"; | 115 | ret += "\" localcopy=\"" + refr.LocalCopy.ToString() + "\" />"; |
116 | } | 116 | } |
117 | 117 | ||
118 | return ret; | 118 | return ret; |
119 | } | 119 | } |
120 | 120 | ||
121 | private static string FindFileReference(string refName, ProjectNode project) | 121 | private static string FindFileReference(string refName, ProjectNode project) |
122 | { | 122 | { |
123 | foreach(ReferencePathNode refPath in project.ReferencePaths) | 123 | foreach(ReferencePathNode refPath in project.ReferencePaths) |
124 | { | 124 | { |
125 | string fullPath = Helper.MakeFilePath(refPath.Path, refName, "dll"); | 125 | string fullPath = Helper.MakeFilePath(refPath.Path, refName, "dll"); |
126 | 126 | ||
127 | if(File.Exists(fullPath)) | 127 | if(File.Exists(fullPath)) |
128 | { | 128 | { |
129 | return fullPath; | 129 | return fullPath; |
130 | } | 130 | } |
131 | } | 131 | } |
132 | 132 | ||
133 | return null; | 133 | return null; |
134 | } | 134 | } |
135 | 135 | ||
136 | /// <summary> | 136 | /// <summary> |
137 | /// Gets the XML doc file. | 137 | /// Gets the XML doc file. |
138 | /// </summary> | 138 | /// </summary> |
139 | /// <param name="project">The project.</param> | 139 | /// <param name="project">The project.</param> |
140 | /// <param name="conf">The conf.</param> | 140 | /// <param name="conf">The conf.</param> |
141 | /// <returns></returns> | 141 | /// <returns></returns> |
142 | public static string GenerateXmlDocFile(ProjectNode project, ConfigurationNode conf) | 142 | public static string GenerateXmlDocFile(ProjectNode project, ConfigurationNode conf) |
143 | { | 143 | { |
144 | if( conf == null ) | 144 | if( conf == null ) |
145 | { | 145 | { |
146 | throw new ArgumentNullException("conf"); | 146 | throw new ArgumentNullException("conf"); |
147 | } | 147 | } |
148 | if( project == null ) | 148 | if( project == null ) |
149 | { | 149 | { |
150 | throw new ArgumentNullException("project"); | 150 | throw new ArgumentNullException("project"); |
151 | } | 151 | } |
152 | string docFile = (string)conf.Options["XmlDocFile"]; | 152 | string docFile = (string)conf.Options["XmlDocFile"]; |
153 | if(docFile != null && docFile.Length == 0)//default to assembly name if not specified | 153 | if(docFile != null && docFile.Length == 0)//default to assembly name if not specified |
154 | { | 154 | { |
155 | return "False"; | 155 | return "False"; |
156 | } | 156 | } |
157 | return "True"; | 157 | return "True"; |
158 | } | 158 | } |
159 | 159 | ||
160 | private void WriteProject(SolutionNode solution, ProjectNode project) | 160 | private void WriteProject(SolutionNode solution, ProjectNode project) |
161 | { | 161 | { |
162 | string csComp = "Csc"; | 162 | string csComp = "Csc"; |
163 | string netRuntime = "MsNet"; | 163 | string netRuntime = "MsNet"; |
164 | if(project.Runtime == ClrRuntime.Mono) | 164 | if(project.Runtime == ClrRuntime.Mono) |
165 | { | 165 | { |
166 | csComp = "Mcs"; | 166 | csComp = "Mcs"; |
167 | netRuntime = "Mono"; | 167 | netRuntime = "Mono"; |
168 | } | 168 | } |
169 | 169 | ||
170 | string projFile = Helper.MakeFilePath(project.FullPath, project.Name, "prjx"); | 170 | string projFile = Helper.MakeFilePath(project.FullPath, project.Name, "prjx"); |
171 | StreamWriter ss = new StreamWriter(projFile); | 171 | StreamWriter ss = new StreamWriter(projFile); |
172 | 172 | ||
173 | m_Kernel.CurrentWorkingDirectory.Push(); | 173 | m_Kernel.CurrentWorkingDirectory.Push(); |
174 | Helper.SetCurrentDir(Path.GetDirectoryName(projFile)); | 174 | Helper.SetCurrentDir(Path.GetDirectoryName(projFile)); |
175 | 175 | ||
176 | using(ss) | 176 | using(ss) |
177 | { | 177 | { |
178 | ss.WriteLine( | 178 | ss.WriteLine( |
179 | "<Project name=\"{0}\" standardNamespace=\"{1}\" description=\"\" newfilesearch=\"None\" enableviewstate=\"True\" version=\"1.1\" projecttype=\"C#\">", | 179 | "<Project name=\"{0}\" standardNamespace=\"{1}\" description=\"\" newfilesearch=\"None\" enableviewstate=\"True\" version=\"1.1\" projecttype=\"C#\">", |
180 | project.Name, | 180 | project.Name, |
181 | project.RootNamespace | 181 | project.RootNamespace |
182 | ); | 182 | ); |
183 | 183 | ||
184 | ss.WriteLine(" <Contents>"); | 184 | ss.WriteLine(" <Contents>"); |
185 | foreach(string file in project.Files) | 185 | foreach(string file in project.Files) |
186 | { | 186 | { |
187 | string buildAction = "Compile"; | 187 | string buildAction = "Compile"; |
188 | switch(project.Files.GetBuildAction(file)) | 188 | switch(project.Files.GetBuildAction(file)) |
189 | { | 189 | { |
190 | case BuildAction.None: | 190 | case BuildAction.None: |
191 | buildAction = "Nothing"; | 191 | buildAction = "Nothing"; |
192 | break; | 192 | break; |
193 | 193 | ||
194 | case BuildAction.Content: | 194 | case BuildAction.Content: |
195 | buildAction = "Exclude"; | 195 | buildAction = "Exclude"; |
196 | break; | 196 | break; |
197 | 197 | ||
198 | case BuildAction.EmbeddedResource: | 198 | case BuildAction.EmbeddedResource: |
199 | buildAction = "EmbedAsResource"; | 199 | buildAction = "EmbedAsResource"; |
200 | break; | 200 | break; |
201 | 201 | ||
202 | default: | 202 | default: |
203 | buildAction = "Compile"; | 203 | buildAction = "Compile"; |
204 | break; | 204 | break; |
205 | } | 205 | } |
206 | 206 | ||
207 | // Sort of a hack, we try and resolve the path and make it relative, if we can. | 207 | // Sort of a hack, we try and resolve the path and make it relative, if we can. |
208 | string filePath = PrependPath(file); | 208 | string filePath = PrependPath(file); |
209 | ss.WriteLine(" <File name=\"{0}\" subtype=\"Code\" buildaction=\"{1}\" dependson=\"\" data=\"\" />", filePath, buildAction); | 209 | ss.WriteLine(" <File name=\"{0}\" subtype=\"Code\" buildaction=\"{1}\" dependson=\"\" data=\"\" />", filePath, buildAction); |
210 | } | 210 | } |
211 | ss.WriteLine(" </Contents>"); | 211 | ss.WriteLine(" </Contents>"); |
212 | 212 | ||
213 | ss.WriteLine(" <References>"); | 213 | ss.WriteLine(" <References>"); |
214 | foreach(ReferenceNode refr in project.References) | 214 | foreach(ReferenceNode refr in project.References) |
215 | { | 215 | { |
216 | ss.WriteLine(" {0}", BuildReference(solution, refr)); | 216 | ss.WriteLine(" {0}", BuildReference(solution, refr)); |
217 | } | 217 | } |
218 | ss.WriteLine(" </References>"); | 218 | ss.WriteLine(" </References>"); |
219 | 219 | ||
220 | ss.Write(" <DeploymentInformation"); | 220 | ss.Write(" <DeploymentInformation"); |
221 | ss.Write(" target=\"\""); | 221 | ss.Write(" target=\"\""); |
222 | ss.Write(" script=\"\""); | 222 | ss.Write(" script=\"\""); |
223 | ss.Write(" strategy=\"File\""); | 223 | ss.Write(" strategy=\"File\""); |
224 | ss.WriteLine(" />"); | 224 | ss.WriteLine(" />"); |
225 | 225 | ||
226 | int count = 0; | 226 | int count = 0; |
227 | 227 | ||
228 | ss.WriteLine(" <Configurations active=\"{0}\">", solution.ActiveConfig); | 228 | ss.WriteLine(" <Configurations active=\"{0}\">", solution.ActiveConfig); |
229 | 229 | ||
230 | foreach(ConfigurationNode conf in project.Configurations) | 230 | foreach(ConfigurationNode conf in project.Configurations) |
231 | { | 231 | { |
232 | ss.Write(" <Configuration"); | 232 | ss.Write(" <Configuration"); |
233 | ss.Write(" runwithwarnings=\"True\""); | 233 | ss.Write(" runwithwarnings=\"True\""); |
234 | ss.Write(" name=\"{0}\"", conf.Name); | 234 | ss.Write(" name=\"{0}\"", conf.Name); |
235 | ss.WriteLine(">"); | 235 | ss.WriteLine(">"); |
236 | ss.Write(" <CodeGeneration"); | 236 | ss.Write(" <CodeGeneration"); |
237 | ss.Write(" runtime=\"{0}\"", netRuntime); | 237 | ss.Write(" runtime=\"{0}\"", netRuntime); |
238 | ss.Write(" compiler=\"{0}\"", csComp); | 238 | ss.Write(" compiler=\"{0}\"", csComp); |
239 | ss.Write(" compilerversion=\"\""); | 239 | ss.Write(" compilerversion=\"\""); |
240 | ss.Write(" warninglevel=\"{0}\"", conf.Options["WarningLevel"]); | 240 | ss.Write(" warninglevel=\"{0}\"", conf.Options["WarningLevel"]); |
241 | ss.Write(" nowarn=\"{0}\"", conf.Options["SuppressWarnings"]); | 241 | ss.Write(" nowarn=\"{0}\"", conf.Options["SuppressWarnings"]); |
242 | ss.Write(" includedebuginformation=\"{0}\"", conf.Options["DebugInformation"]); | 242 | ss.Write(" includedebuginformation=\"{0}\"", conf.Options["DebugInformation"]); |
243 | ss.Write(" optimize=\"{0}\"", conf.Options["OptimizeCode"]); | 243 | ss.Write(" optimize=\"{0}\"", conf.Options["OptimizeCode"]); |
244 | ss.Write(" unsafecodeallowed=\"{0}\"", conf.Options["AllowUnsafe"]); | 244 | ss.Write(" unsafecodeallowed=\"{0}\"", conf.Options["AllowUnsafe"]); |
245 | ss.Write(" generateoverflowchecks=\"{0}\"", conf.Options["CheckUnderflowOverflow"]); | 245 | ss.Write(" generateoverflowchecks=\"{0}\"", conf.Options["CheckUnderflowOverflow"]); |
246 | ss.Write(" mainclass=\"{0}\"", project.StartupObject); | 246 | ss.Write(" mainclass=\"{0}\"", project.StartupObject); |
247 | ss.Write(" target=\"{0}\"", project.Type); | 247 | ss.Write(" target=\"{0}\"", project.Type); |
248 | ss.Write(" definesymbols=\"{0}\"", conf.Options["CompilerDefines"]); | 248 | ss.Write(" definesymbols=\"{0}\"", conf.Options["CompilerDefines"]); |
249 | ss.Write(" generatexmldocumentation=\"{0}\"", GenerateXmlDocFile(project, conf)); | 249 | ss.Write(" generatexmldocumentation=\"{0}\"", GenerateXmlDocFile(project, conf)); |
250 | ss.Write(" win32Icon=\"{0}\"", Helper.NormalizePath(".\\" + project.AppIcon)); | 250 | ss.Write(" win32Icon=\"{0}\"", Helper.NormalizePath(".\\" + project.AppIcon)); |
251 | ss.Write(" noconfig=\"{0}\"", "False"); | 251 | ss.Write(" noconfig=\"{0}\"", "False"); |
252 | ss.Write(" nostdlib=\"{0}\"", conf.Options["NoStdLib"]); | 252 | ss.Write(" nostdlib=\"{0}\"", conf.Options["NoStdLib"]); |
253 | ss.WriteLine(" />"); | 253 | ss.WriteLine(" />"); |
254 | 254 | ||
255 | ss.Write(" <Execution"); | 255 | ss.Write(" <Execution"); |
256 | ss.Write(" commandlineparameters=\"\""); | 256 | ss.Write(" commandlineparameters=\"\""); |
257 | ss.Write(" consolepause=\"True\""); | 257 | ss.Write(" consolepause=\"True\""); |
258 | ss.WriteLine(" />"); | 258 | ss.WriteLine(" />"); |
259 | 259 | ||
260 | ss.Write(" <Output"); | 260 | ss.Write(" <Output"); |
261 | ss.Write(" directory=\".\\{0}\"", Helper.NormalizePath(conf.Options["OutputPath"].ToString())); | 261 | ss.Write(" directory=\".\\{0}\"", Helper.NormalizePath(conf.Options["OutputPath"].ToString())); |
262 | ss.Write(" assembly=\"{0}\"", project.AssemblyName); | 262 | ss.Write(" assembly=\"{0}\"", project.AssemblyName); |
263 | ss.Write(" executeScript=\"{0}\"", conf.Options["RunScript"]); | 263 | ss.Write(" executeScript=\"{0}\"", conf.Options["RunScript"]); |
264 | if (conf.Options["PreBuildEvent"] != null && conf.Options["PreBuildEvent"].ToString().Length != 0) | 264 | if (conf.Options["PreBuildEvent"] != null && conf.Options["PreBuildEvent"].ToString().Length != 0) |
265 | { | 265 | { |
266 | ss.Write(" executeBeforeBuild=\"{0}\"", Helper.NormalizePath(conf.Options["PreBuildEvent"].ToString())); | 266 | ss.Write(" executeBeforeBuild=\"{0}\"", Helper.NormalizePath(conf.Options["PreBuildEvent"].ToString())); |
267 | } | 267 | } |
268 | else | 268 | else |
269 | { | 269 | { |
270 | ss.Write(" executeBeforeBuild=\"{0}\"", conf.Options["PreBuildEvent"]); | 270 | ss.Write(" executeBeforeBuild=\"{0}\"", conf.Options["PreBuildEvent"]); |
271 | } | 271 | } |
272 | if (conf.Options["PostBuildEvent"] != null && conf.Options["PostBuildEvent"].ToString().Length != 0) | 272 | if (conf.Options["PostBuildEvent"] != null && conf.Options["PostBuildEvent"].ToString().Length != 0) |
273 | { | 273 | { |
274 | ss.Write(" executeAfterBuild=\"{0}\"", Helper.NormalizePath(conf.Options["PostBuildEvent"].ToString())); | 274 | ss.Write(" executeAfterBuild=\"{0}\"", Helper.NormalizePath(conf.Options["PostBuildEvent"].ToString())); |
275 | } | 275 | } |
276 | else | 276 | else |
277 | { | 277 | { |
278 | ss.Write(" executeAfterBuild=\"{0}\"", conf.Options["PostBuildEvent"]); | 278 | ss.Write(" executeAfterBuild=\"{0}\"", conf.Options["PostBuildEvent"]); |
279 | } | 279 | } |
280 | ss.Write(" executeBeforeBuildArguments=\"{0}\"", conf.Options["PreBuildEventArgs"]); | 280 | ss.Write(" executeBeforeBuildArguments=\"{0}\"", conf.Options["PreBuildEventArgs"]); |
281 | ss.Write(" executeAfterBuildArguments=\"{0}\"", conf.Options["PreBuildEventArgs"]); | 281 | ss.Write(" executeAfterBuildArguments=\"{0}\"", conf.Options["PreBuildEventArgs"]); |
282 | ss.WriteLine(" />"); | 282 | ss.WriteLine(" />"); |
283 | ss.WriteLine(" </Configuration>"); | 283 | ss.WriteLine(" </Configuration>"); |
284 | 284 | ||
285 | count++; | 285 | count++; |
286 | } | 286 | } |
287 | ss.WriteLine(" </Configurations>"); | 287 | ss.WriteLine(" </Configurations>"); |
288 | ss.WriteLine("</Project>"); | 288 | ss.WriteLine("</Project>"); |
289 | } | 289 | } |
290 | 290 | ||
291 | m_Kernel.CurrentWorkingDirectory.Pop(); | 291 | m_Kernel.CurrentWorkingDirectory.Pop(); |
292 | } | 292 | } |
293 | 293 | ||
294 | private void WriteCombine(SolutionNode solution) | 294 | private void WriteCombine(SolutionNode solution) |
295 | { | 295 | { |
296 | m_Kernel.Log.Write("Creating SharpDevelop combine and project files"); | 296 | m_Kernel.Log.Write("Creating SharpDevelop combine and project files"); |
297 | foreach(ProjectNode project in solution.Projects) | 297 | foreach(ProjectNode project in solution.Projects) |
298 | { | 298 | { |
299 | if(m_Kernel.AllowProject(project.FilterGroups)) | 299 | if(m_Kernel.AllowProject(project.FilterGroups)) |
300 | { | 300 | { |
301 | m_Kernel.Log.Write("...Creating project: {0}", project.Name); | 301 | m_Kernel.Log.Write("...Creating project: {0}", project.Name); |
302 | WriteProject(solution, project); | 302 | WriteProject(solution, project); |
303 | } | 303 | } |
304 | } | 304 | } |
305 | 305 | ||
306 | m_Kernel.Log.Write(""); | 306 | m_Kernel.Log.Write(""); |
307 | string combFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "cmbx"); | 307 | string combFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "cmbx"); |
308 | StreamWriter ss = new StreamWriter(combFile); | 308 | StreamWriter ss = new StreamWriter(combFile); |
309 | 309 | ||
310 | m_Kernel.CurrentWorkingDirectory.Push(); | 310 | m_Kernel.CurrentWorkingDirectory.Push(); |
311 | Helper.SetCurrentDir(Path.GetDirectoryName(combFile)); | 311 | Helper.SetCurrentDir(Path.GetDirectoryName(combFile)); |
312 | 312 | ||
313 | using(ss) | 313 | using(ss) |
314 | { | 314 | { |
315 | ss.WriteLine("<Combine fileversion=\"1.0\" name=\"{0}\" description=\"\">", solution.Name); | 315 | ss.WriteLine("<Combine fileversion=\"1.0\" name=\"{0}\" description=\"\">", solution.Name); |
316 | 316 | ||
317 | int count = 0; | 317 | int count = 0; |
318 | foreach(ProjectNode project in solution.Projects) | 318 | foreach(ProjectNode project in solution.Projects) |
319 | { | 319 | { |
320 | if(count == 0) | 320 | if(count == 0) |
321 | ss.WriteLine(" <StartMode startupentry=\"{0}\" single=\"True\">", project.Name); | 321 | ss.WriteLine(" <StartMode startupentry=\"{0}\" single=\"True\">", project.Name); |
322 | 322 | ||
323 | ss.WriteLine(" <Execute entry=\"{0}\" type=\"None\" />", project.Name); | 323 | ss.WriteLine(" <Execute entry=\"{0}\" type=\"None\" />", project.Name); |
324 | count++; | 324 | count++; |
325 | } | 325 | } |
326 | ss.WriteLine(" </StartMode>"); | 326 | ss.WriteLine(" </StartMode>"); |
327 | 327 | ||
328 | ss.WriteLine(" <Entries>"); | 328 | ss.WriteLine(" <Entries>"); |
329 | foreach(ProjectNode project in solution.Projects) | 329 | foreach(ProjectNode project in solution.Projects) |
330 | { | 330 | { |
331 | string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath); | 331 | string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath); |
332 | ss.WriteLine(" <Entry filename=\"{0}\" />", | 332 | ss.WriteLine(" <Entry filename=\"{0}\" />", |
333 | Helper.MakeFilePath(path, project.Name, "prjx")); | 333 | Helper.MakeFilePath(path, project.Name, "prjx")); |
334 | } | 334 | } |
335 | ss.WriteLine(" </Entries>"); | 335 | ss.WriteLine(" </Entries>"); |
336 | 336 | ||
337 | count = 0; | 337 | count = 0; |
338 | foreach(ConfigurationNode conf in solution.Configurations) | 338 | foreach(ConfigurationNode conf in solution.Configurations) |
339 | { | 339 | { |
340 | if(count == 0) | 340 | if(count == 0) |
341 | { | 341 | { |
342 | ss.WriteLine(" <Configurations active=\"{0}\">", conf.Name); | 342 | ss.WriteLine(" <Configurations active=\"{0}\">", conf.Name); |
343 | } | 343 | } |
344 | 344 | ||
345 | ss.WriteLine(" <Configuration name=\"{0}\">", conf.Name); | 345 | ss.WriteLine(" <Configuration name=\"{0}\">", conf.Name); |
346 | foreach(ProjectNode project in solution.Projects) | 346 | foreach(ProjectNode project in solution.Projects) |
347 | { | 347 | { |
348 | ss.WriteLine(" <Entry name=\"{0}\" configurationname=\"{1}\" build=\"True\" />", project.Name, conf.Name); | 348 | ss.WriteLine(" <Entry name=\"{0}\" configurationname=\"{1}\" build=\"True\" />", project.Name, conf.Name); |
349 | } | 349 | } |
350 | ss.WriteLine(" </Configuration>"); | 350 | ss.WriteLine(" </Configuration>"); |
351 | 351 | ||
352 | count++; | 352 | count++; |
353 | } | 353 | } |
354 | ss.WriteLine(" </Configurations>"); | 354 | ss.WriteLine(" </Configurations>"); |
355 | ss.WriteLine("</Combine>"); | 355 | ss.WriteLine("</Combine>"); |
356 | } | 356 | } |
357 | 357 | ||
358 | m_Kernel.CurrentWorkingDirectory.Pop(); | 358 | m_Kernel.CurrentWorkingDirectory.Pop(); |
359 | } | 359 | } |
360 | 360 | ||
361 | private void CleanProject(ProjectNode project) | 361 | private void CleanProject(ProjectNode project) |
362 | { | 362 | { |
363 | m_Kernel.Log.Write("...Cleaning project: {0}", project.Name); | 363 | m_Kernel.Log.Write("...Cleaning project: {0}", project.Name); |
364 | string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, "prjx"); | 364 | string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, "prjx"); |
365 | Helper.DeleteIfExists(projectFile); | 365 | Helper.DeleteIfExists(projectFile); |
366 | } | 366 | } |
367 | 367 | ||
368 | private void CleanSolution(SolutionNode solution) | 368 | private void CleanSolution(SolutionNode solution) |
369 | { | 369 | { |
370 | m_Kernel.Log.Write("Cleaning SharpDevelop combine and project files for", solution.Name); | 370 | m_Kernel.Log.Write("Cleaning SharpDevelop combine and project files for", solution.Name); |
371 | 371 | ||
372 | string slnFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "cmbx"); | 372 | string slnFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "cmbx"); |
373 | Helper.DeleteIfExists(slnFile); | 373 | Helper.DeleteIfExists(slnFile); |
374 | 374 | ||
375 | foreach(ProjectNode project in solution.Projects) | 375 | foreach(ProjectNode project in solution.Projects) |
376 | { | 376 | { |
377 | CleanProject(project); | 377 | CleanProject(project); |
378 | } | 378 | } |
379 | 379 | ||
380 | m_Kernel.Log.Write(""); | 380 | m_Kernel.Log.Write(""); |
381 | } | 381 | } |
382 | 382 | ||
383 | #endregion | 383 | #endregion |
384 | 384 | ||
385 | #region ITarget Members | 385 | #region ITarget Members |
386 | 386 | ||
387 | /// <summary> | 387 | /// <summary> |
388 | /// Writes the specified kern. | 388 | /// Writes the specified kern. |
389 | /// </summary> | 389 | /// </summary> |
390 | /// <param name="kern">The kern.</param> | 390 | /// <param name="kern">The kern.</param> |
391 | public void Write(Kernel kern) | 391 | public void Write(Kernel kern) |
392 | { | 392 | { |
393 | if( kern == null ) | 393 | if( kern == null ) |
394 | { | 394 | { |
395 | throw new ArgumentNullException("kern"); | 395 | throw new ArgumentNullException("kern"); |
396 | } | 396 | } |
397 | m_Kernel = kern; | 397 | m_Kernel = kern; |
398 | foreach(SolutionNode solution in kern.Solutions) | 398 | foreach(SolutionNode solution in kern.Solutions) |
399 | { | 399 | { |
400 | WriteCombine(solution); | 400 | WriteCombine(solution); |
401 | } | 401 | } |
402 | m_Kernel = null; | 402 | m_Kernel = null; |
403 | } | 403 | } |
404 | 404 | ||
405 | /// <summary> | 405 | /// <summary> |
406 | /// Cleans the specified kern. | 406 | /// Cleans the specified kern. |
407 | /// </summary> | 407 | /// </summary> |
408 | /// <param name="kern">The kern.</param> | 408 | /// <param name="kern">The kern.</param> |
409 | public virtual void Clean(Kernel kern) | 409 | public virtual void Clean(Kernel kern) |
410 | { | 410 | { |
411 | if( kern == null ) | 411 | if( kern == null ) |
412 | { | 412 | { |
413 | throw new ArgumentNullException("kern"); | 413 | throw new ArgumentNullException("kern"); |
414 | } | 414 | } |
415 | m_Kernel = kern; | 415 | m_Kernel = kern; |
416 | foreach(SolutionNode sol in kern.Solutions) | 416 | foreach(SolutionNode sol in kern.Solutions) |
417 | { | 417 | { |
418 | CleanSolution(sol); | 418 | CleanSolution(sol); |
419 | } | 419 | } |
420 | m_Kernel = null; | 420 | m_Kernel = null; |
421 | } | 421 | } |
422 | 422 | ||
423 | /// <summary> | 423 | /// <summary> |
424 | /// Gets the name. | 424 | /// Gets the name. |
425 | /// </summary> | 425 | /// </summary> |
426 | /// <value>The name.</value> | 426 | /// <value>The name.</value> |
427 | public string Name | 427 | public string Name |
428 | { | 428 | { |
429 | get | 429 | get |
430 | { | 430 | { |
431 | return "sharpdev"; | 431 | return "sharpdev"; |
432 | } | 432 | } |
433 | } | 433 | } |
434 | 434 | ||
435 | #endregion | 435 | #endregion |
436 | } | 436 | } |
437 | } | 437 | } |
diff --git a/Prebuild/src/Core/Targets/VS2002Target.cs b/Prebuild/src/Core/Targets/VS2002Target.cs index 66216dc..b380f36 100644 --- a/Prebuild/src/Core/Targets/VS2002Target.cs +++ b/Prebuild/src/Core/Targets/VS2002Target.cs | |||
@@ -1,96 +1,96 @@ | |||
1 | #region BSD License | 1 | #region BSD License |
2 | /* | 2 | /* |
3 | Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) | 3 | Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) |
4 | 4 | ||
5 | Redistribution and use in source and binary forms, with or without modification, are permitted | 5 | Redistribution and use in source and binary forms, with or without modification, are permitted |
6 | provided that the following conditions are met: | 6 | provided that the following conditions are met: |
7 | 7 | ||
8 | * Redistributions of source code must retain the above copyright notice, this list of conditions | 8 | * Redistributions of source code must retain the above copyright notice, this list of conditions |
9 | and the following disclaimer. | 9 | and the following disclaimer. |
10 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions | 10 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions |
11 | and the following disclaimer in the documentation and/or other materials provided with the | 11 | and the following disclaimer in the documentation and/or other materials provided with the |
12 | distribution. | 12 | distribution. |
13 | * The name of the author may not be used to endorse or promote products derived from this software | 13 | * The name of the author may not be used to endorse or promote products derived from this software |
14 | without specific prior written permission. | 14 | without specific prior written permission. |
15 | 15 | ||
16 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, | 16 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, |
17 | BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | 17 | BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
18 | ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | 18 | ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
19 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | 19 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
20 | OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY | 20 | OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
21 | OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | 21 | OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING |
22 | IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 22 | IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
23 | */ | 23 | */ |
24 | #endregion | 24 | #endregion |
25 | 25 | ||
26 | #region CVS Information | 26 | #region CVS Information |
27 | /* | 27 | /* |
28 | * $Source$ | 28 | * $Source$ |
29 | * $Author: jendave $ | 29 | * $Author: jendave $ |
30 | * $Date: 2006-01-28 01:49:58 +0100 (lö, 28 jan 2006) $ | 30 | * $Date: 2006-01-28 01:49:58 +0100 (lö, 28 jan 2006) $ |
31 | * $Revision: 71 $ | 31 | * $Revision: 71 $ |
32 | */ | 32 | */ |
33 | #endregion | 33 | #endregion |
34 | 34 | ||
35 | using System; | 35 | using System; |
36 | 36 | ||
37 | using Prebuild.Core.Attributes; | 37 | using Prebuild.Core.Attributes; |
38 | 38 | ||
39 | namespace Prebuild.Core.Targets | 39 | namespace Prebuild.Core.Targets |
40 | { | 40 | { |
41 | /// <summary> | 41 | /// <summary> |
42 | /// | 42 | /// |
43 | /// </summary> | 43 | /// </summary> |
44 | [Target("vs2002")] | 44 | [Target("vs2002")] |
45 | public class VS2002Target : VS2003Target | 45 | public class VS2002Target : VS2003Target |
46 | { | 46 | { |
47 | #region Private Methods | 47 | #region Private Methods |
48 | 48 | ||
49 | private void SetVS2002() | 49 | private void SetVS2002() |
50 | { | 50 | { |
51 | this.SolutionVersion = "7.00"; | 51 | this.SolutionVersion = "7.00"; |
52 | this.ProductVersion = "7.0.9254"; | 52 | this.ProductVersion = "7.0.9254"; |
53 | this.SchemaVersion = "1.0"; | 53 | this.SchemaVersion = "1.0"; |
54 | this.VersionName = "2002"; | 54 | this.VersionName = "2002"; |
55 | this.Version = VSVersion.VS70; | 55 | this.Version = VSVersion.VS70; |
56 | } | 56 | } |
57 | 57 | ||
58 | #endregion | 58 | #endregion |
59 | 59 | ||
60 | #region Public Methods | 60 | #region Public Methods |
61 | 61 | ||
62 | /// <summary> | 62 | /// <summary> |
63 | /// Writes the specified kern. | 63 | /// Writes the specified kern. |
64 | /// </summary> | 64 | /// </summary> |
65 | /// <param name="kern">The kern.</param> | 65 | /// <param name="kern">The kern.</param> |
66 | public override void Write(Kernel kern) | 66 | public override void Write(Kernel kern) |
67 | { | 67 | { |
68 | SetVS2002(); | 68 | SetVS2002(); |
69 | base.Write(kern); | 69 | base.Write(kern); |
70 | } | 70 | } |
71 | 71 | ||
72 | /// <summary> | 72 | /// <summary> |
73 | /// Cleans the specified kern. | 73 | /// Cleans the specified kern. |
74 | /// </summary> | 74 | /// </summary> |
75 | /// <param name="kern">The kern.</param> | 75 | /// <param name="kern">The kern.</param> |
76 | public override void Clean(Kernel kern) | 76 | public override void Clean(Kernel kern) |
77 | { | 77 | { |
78 | SetVS2002(); | 78 | SetVS2002(); |
79 | base.Clean(kern); | 79 | base.Clean(kern); |
80 | } | 80 | } |
81 | 81 | ||
82 | /// <summary> | 82 | /// <summary> |
83 | /// Gets the name. | 83 | /// Gets the name. |
84 | /// </summary> | 84 | /// </summary> |
85 | /// <value>The name.</value> | 85 | /// <value>The name.</value> |
86 | public override string Name | 86 | public override string Name |
87 | { | 87 | { |
88 | get | 88 | get |
89 | { | 89 | { |
90 | return "vs2002"; | 90 | return "vs2002"; |
91 | } | 91 | } |
92 | } | 92 | } |
93 | 93 | ||
94 | #endregion | 94 | #endregion |
95 | } | 95 | } |
96 | } | 96 | } |
diff --git a/Prebuild/src/Core/Targets/VS2003Target.cs b/Prebuild/src/Core/Targets/VS2003Target.cs index b3236a8..c3ca930 100644 --- a/Prebuild/src/Core/Targets/VS2003Target.cs +++ b/Prebuild/src/Core/Targets/VS2003Target.cs | |||
@@ -1,633 +1,633 @@ | |||
1 | #region BSD License | 1 | #region BSD License |
2 | /* | 2 | /* |
3 | Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) | 3 | Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) |
4 | 4 | ||
5 | Redistribution and use in source and binary forms, with or without modification, are permitted | 5 | Redistribution and use in source and binary forms, with or without modification, are permitted |
6 | provided that the following conditions are met: | 6 | provided that the following conditions are met: |
7 | 7 | ||
8 | * Redistributions of source code must retain the above copyright notice, this list of conditions | 8 | * Redistributions of source code must retain the above copyright notice, this list of conditions |
9 | and the following disclaimer. | 9 | and the following disclaimer. |
10 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions | 10 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions |
11 | and the following disclaimer in the documentation and/or other materials provided with the | 11 | and the following disclaimer in the documentation and/or other materials provided with the |
12 | distribution. | 12 | distribution. |
13 | * The name of the author may not be used to endorse or promote products derived from this software | 13 | * The name of the author may not be used to endorse or promote products derived from this software |
14 | without specific prior written permission. | 14 | without specific prior written permission. |
15 | 15 | ||
16 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, | 16 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, |
17 | BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | 17 | BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
18 | ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | 18 | ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
19 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | 19 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
20 | OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY | 20 | OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
21 | OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | 21 | OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING |
22 | IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 22 | IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
23 | */ | 23 | */ |
24 | #endregion | 24 | #endregion |
25 | 25 | ||
26 | #region CVS Information | 26 | #region CVS Information |
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-29 21:11:40 +0200 (fr, 29 sep 2006) $ |
31 | * $Revision: 177 $ | 31 | * $Revision: 177 $ |
32 | */ | 32 | */ |
33 | #endregion | 33 | #endregion |
34 | 34 | ||
35 | using System; | 35 | using System; |
36 | using System.Collections; | 36 | using System.Collections; |
37 | using System.Collections.Specialized; | 37 | using System.Collections.Specialized; |
38 | using System.IO; | 38 | using System.IO; |
39 | 39 | ||
40 | using Prebuild.Core.Attributes; | 40 | using Prebuild.Core.Attributes; |
41 | using Prebuild.Core.Interfaces; | 41 | using Prebuild.Core.Interfaces; |
42 | using Prebuild.Core.Nodes; | 42 | using Prebuild.Core.Nodes; |
43 | using Prebuild.Core.Utilities; | 43 | using Prebuild.Core.Utilities; |
44 | 44 | ||
45 | namespace Prebuild.Core.Targets | 45 | namespace Prebuild.Core.Targets |
46 | { | 46 | { |
47 | /// <summary> | 47 | /// <summary> |
48 | /// | 48 | /// |
49 | /// </summary> | 49 | /// </summary> |
50 | public enum VSVersion | 50 | public enum VSVersion |
51 | { | 51 | { |
52 | /// <summary> | 52 | /// <summary> |
53 | /// | 53 | /// |
54 | /// </summary> | 54 | /// </summary> |
55 | VS70, | 55 | VS70, |
56 | /// <summary> | 56 | /// <summary> |
57 | /// | 57 | /// |
58 | /// </summary> | 58 | /// </summary> |
59 | VS71, | 59 | VS71, |
60 | /// <summary> | 60 | /// <summary> |
61 | /// | 61 | /// |
62 | /// </summary> | 62 | /// </summary> |
63 | VS80 | 63 | VS80 |
64 | } | 64 | } |
65 | 65 | ||
66 | /// <summary> | 66 | /// <summary> |
67 | /// | 67 | /// |
68 | /// </summary> | 68 | /// </summary> |
69 | [Target("vs2003")] | 69 | [Target("vs2003")] |
70 | public class VS2003Target : ITarget | 70 | public class VS2003Target : ITarget |
71 | { | 71 | { |
72 | 72 | ||
73 | #region Fields | 73 | #region Fields |
74 | 74 | ||
75 | string solutionVersion = "8.00"; | 75 | string solutionVersion = "8.00"; |
76 | string productVersion = "7.10.3077"; | 76 | string productVersion = "7.10.3077"; |
77 | string schemaVersion = "2.0"; | 77 | string schemaVersion = "2.0"; |
78 | string versionName = "2003"; | 78 | string versionName = "2003"; |
79 | VSVersion version = VSVersion.VS71; | 79 | VSVersion version = VSVersion.VS71; |
80 | 80 | ||
81 | Hashtable m_Tools; | 81 | Hashtable m_Tools; |
82 | Kernel m_Kernel; | 82 | Kernel m_Kernel; |
83 | 83 | ||
84 | /// <summary> | 84 | /// <summary> |
85 | /// Gets or sets the solution version. | 85 | /// Gets or sets the solution version. |
86 | /// </summary> | 86 | /// </summary> |
87 | /// <value>The solution version.</value> | 87 | /// <value>The solution version.</value> |
88 | protected string SolutionVersion | 88 | protected string SolutionVersion |
89 | { | 89 | { |
90 | get | 90 | get |
91 | { | 91 | { |
92 | return this.solutionVersion; | 92 | return this.solutionVersion; |
93 | } | 93 | } |
94 | set | 94 | set |
95 | { | 95 | { |
96 | this.solutionVersion = value; | 96 | this.solutionVersion = value; |
97 | } | 97 | } |
98 | } | 98 | } |
99 | /// <summary> | 99 | /// <summary> |
100 | /// Gets or sets the product version. | 100 | /// Gets or sets the product version. |
101 | /// </summary> | 101 | /// </summary> |
102 | /// <value>The product version.</value> | 102 | /// <value>The product version.</value> |
103 | protected string ProductVersion | 103 | protected string ProductVersion |
104 | { | 104 | { |
105 | get | 105 | get |
106 | { | 106 | { |
107 | return this.productVersion; | 107 | return this.productVersion; |
108 | } | 108 | } |
109 | set | 109 | set |
110 | { | 110 | { |
111 | this.productVersion = value; | 111 | this.productVersion = value; |
112 | } | 112 | } |
113 | } | 113 | } |
114 | /// <summary> | 114 | /// <summary> |
115 | /// Gets or sets the schema version. | 115 | /// Gets or sets the schema version. |
116 | /// </summary> | 116 | /// </summary> |
117 | /// <value>The schema version.</value> | 117 | /// <value>The schema version.</value> |
118 | protected string SchemaVersion | 118 | protected string SchemaVersion |
119 | { | 119 | { |
120 | get | 120 | get |
121 | { | 121 | { |
122 | return this.schemaVersion; | 122 | return this.schemaVersion; |
123 | } | 123 | } |
124 | set | 124 | set |
125 | { | 125 | { |
126 | this.schemaVersion = value; | 126 | this.schemaVersion = value; |
127 | } | 127 | } |
128 | } | 128 | } |
129 | /// <summary> | 129 | /// <summary> |
130 | /// Gets or sets the name of the version. | 130 | /// Gets or sets the name of the version. |
131 | /// </summary> | 131 | /// </summary> |
132 | /// <value>The name of the version.</value> | 132 | /// <value>The name of the version.</value> |
133 | protected string VersionName | 133 | protected string VersionName |
134 | { | 134 | { |
135 | get | 135 | get |
136 | { | 136 | { |
137 | return this.versionName; | 137 | return this.versionName; |
138 | } | 138 | } |
139 | set | 139 | set |
140 | { | 140 | { |
141 | this.versionName = value; | 141 | this.versionName = value; |
142 | } | 142 | } |
143 | } | 143 | } |
144 | /// <summary> | 144 | /// <summary> |
145 | /// Gets or sets the version. | 145 | /// Gets or sets the version. |
146 | /// </summary> | 146 | /// </summary> |
147 | /// <value>The version.</value> | 147 | /// <value>The version.</value> |
148 | protected VSVersion Version | 148 | protected VSVersion Version |
149 | { | 149 | { |
150 | get | 150 | get |
151 | { | 151 | { |
152 | return this.version; | 152 | return this.version; |
153 | } | 153 | } |
154 | set | 154 | set |
155 | { | 155 | { |
156 | this.version = value; | 156 | this.version = value; |
157 | } | 157 | } |
158 | } | 158 | } |
159 | 159 | ||
160 | #endregion | 160 | #endregion |
161 | 161 | ||
162 | #region Constructors | 162 | #region Constructors |
163 | 163 | ||
164 | /// <summary> | 164 | /// <summary> |
165 | /// Initializes a new instance of the <see cref="VS2003Target"/> class. | 165 | /// Initializes a new instance of the <see cref="VS2003Target"/> class. |
166 | /// </summary> | 166 | /// </summary> |
167 | public VS2003Target() | 167 | public VS2003Target() |
168 | { | 168 | { |
169 | m_Tools = new Hashtable(); | 169 | m_Tools = new Hashtable(); |
170 | 170 | ||
171 | m_Tools["C#"] = new ToolInfo("C#", "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}", "csproj", "CSHARP"); | 171 | m_Tools["C#"] = new ToolInfo("C#", "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}", "csproj", "CSHARP"); |
172 | m_Tools["VB.NET"] = new ToolInfo("VB.NET", "{F184B08F-C81C-45F6-A57F-5ABD9991F28F}", "vbproj", "VisualBasic"); | 172 | m_Tools["VB.NET"] = new ToolInfo("VB.NET", "{F184B08F-C81C-45F6-A57F-5ABD9991F28F}", "vbproj", "VisualBasic"); |
173 | } | 173 | } |
174 | 174 | ||
175 | #endregion | 175 | #endregion |
176 | 176 | ||
177 | #region Private Methods | 177 | #region Private Methods |
178 | 178 | ||
179 | private string MakeRefPath(ProjectNode project) | 179 | private string MakeRefPath(ProjectNode project) |
180 | { | 180 | { |
181 | string ret = ""; | 181 | string ret = ""; |
182 | foreach(ReferencePathNode node in project.ReferencePaths) | 182 | foreach(ReferencePathNode node in project.ReferencePaths) |
183 | { | 183 | { |
184 | try | 184 | try |
185 | { | 185 | { |
186 | string fullPath = Helper.ResolvePath(node.Path); | 186 | string fullPath = Helper.ResolvePath(node.Path); |
187 | if(ret.Length < 1) | 187 | if(ret.Length < 1) |
188 | { | 188 | { |
189 | ret = fullPath; | 189 | ret = fullPath; |
190 | } | 190 | } |
191 | else | 191 | else |
192 | { | 192 | { |
193 | ret += ";" + fullPath; | 193 | ret += ";" + fullPath; |
194 | } | 194 | } |
195 | } | 195 | } |
196 | catch(ArgumentException) | 196 | catch(ArgumentException) |
197 | { | 197 | { |
198 | m_Kernel.Log.Write(LogType.Warning, "Could not resolve reference path: {0}", node.Path); | 198 | m_Kernel.Log.Write(LogType.Warning, "Could not resolve reference path: {0}", node.Path); |
199 | } | 199 | } |
200 | } | 200 | } |
201 | 201 | ||
202 | return ret; | 202 | return ret; |
203 | } | 203 | } |
204 | 204 | ||
205 | private void WriteProject(SolutionNode solution, ProjectNode project) | 205 | private void WriteProject(SolutionNode solution, ProjectNode project) |
206 | { | 206 | { |
207 | if(!m_Tools.ContainsKey(project.Language)) | 207 | if(!m_Tools.ContainsKey(project.Language)) |
208 | { | 208 | { |
209 | throw new UnknownLanguageException("Unknown .NET language: " + project.Language); | 209 | throw new UnknownLanguageException("Unknown .NET language: " + project.Language); |
210 | } | 210 | } |
211 | 211 | ||
212 | ToolInfo toolInfo = (ToolInfo)m_Tools[project.Language]; | 212 | ToolInfo toolInfo = (ToolInfo)m_Tools[project.Language]; |
213 | string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, toolInfo.FileExtension); | 213 | string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, toolInfo.FileExtension); |
214 | StreamWriter ps = new StreamWriter(projectFile); | 214 | StreamWriter ps = new StreamWriter(projectFile); |
215 | 215 | ||
216 | m_Kernel.CurrentWorkingDirectory.Push(); | 216 | m_Kernel.CurrentWorkingDirectory.Push(); |
217 | Helper.SetCurrentDir(Path.GetDirectoryName(projectFile)); | 217 | Helper.SetCurrentDir(Path.GetDirectoryName(projectFile)); |
218 | 218 | ||
219 | IEnumerator enumerator; | 219 | IEnumerator enumerator; |
220 | //ConfigurationNode scripts; | 220 | //ConfigurationNode scripts; |
221 | 221 | ||
222 | using(ps) | 222 | using(ps) |
223 | { | 223 | { |
224 | ps.WriteLine("<VisualStudioProject>"); | 224 | ps.WriteLine("<VisualStudioProject>"); |
225 | ps.WriteLine(" <{0}", toolInfo.XmlTag); | 225 | ps.WriteLine(" <{0}", toolInfo.XmlTag); |
226 | ps.WriteLine("\t\t\t\tProjectType = \"Local\""); | 226 | ps.WriteLine("\t\t\t\tProjectType = \"Local\""); |
227 | ps.WriteLine("\t\t\t\tProductVersion = \"{0}\"", this.ProductVersion); | 227 | ps.WriteLine("\t\t\t\tProductVersion = \"{0}\"", this.ProductVersion); |
228 | ps.WriteLine("\t\t\t\tSchemaVersion = \"{0}\"", this.SchemaVersion); | 228 | ps.WriteLine("\t\t\t\tSchemaVersion = \"{0}\"", this.SchemaVersion); |
229 | ps.WriteLine("\t\t\t\tProjectGuid = \"{{{0}}}\"", project.Guid.ToString().ToUpper()); | 229 | ps.WriteLine("\t\t\t\tProjectGuid = \"{{{0}}}\"", project.Guid.ToString().ToUpper()); |
230 | ps.WriteLine("\t\t>"); | 230 | ps.WriteLine("\t\t>"); |
231 | 231 | ||
232 | ps.WriteLine("\t\t\t\t<Build>"); | 232 | ps.WriteLine("\t\t\t\t<Build>"); |
233 | ps.WriteLine(" <Settings"); | 233 | ps.WriteLine(" <Settings"); |
234 | ps.WriteLine("\t\t\t\t ApplicationIcon = \"{0}\"",project.AppIcon); | 234 | ps.WriteLine("\t\t\t\t ApplicationIcon = \"{0}\"",project.AppIcon); |
235 | ps.WriteLine("\t\t\t\t AssemblyKeyContainerName = \"\""); | 235 | ps.WriteLine("\t\t\t\t AssemblyKeyContainerName = \"\""); |
236 | ps.WriteLine("\t\t\t\t AssemblyName = \"{0}\"", project.AssemblyName); | 236 | ps.WriteLine("\t\t\t\t AssemblyName = \"{0}\"", project.AssemblyName); |
237 | ps.WriteLine("\t\t\t\t AssemblyOriginatorKeyFile = \"\""); | 237 | ps.WriteLine("\t\t\t\t AssemblyOriginatorKeyFile = \"\""); |
238 | ps.WriteLine("\t\t\t\t DefaultClientScript = \"JScript\""); | 238 | ps.WriteLine("\t\t\t\t DefaultClientScript = \"JScript\""); |
239 | ps.WriteLine("\t\t\t\t DefaultHTMLPageLayout = \"Grid\""); | 239 | ps.WriteLine("\t\t\t\t DefaultHTMLPageLayout = \"Grid\""); |
240 | ps.WriteLine("\t\t\t\t DefaultTargetSchema = \"IE50\""); | 240 | ps.WriteLine("\t\t\t\t DefaultTargetSchema = \"IE50\""); |
241 | ps.WriteLine("\t\t\t\t DelaySign = \"false\""); | 241 | ps.WriteLine("\t\t\t\t DelaySign = \"false\""); |
242 | 242 | ||
243 | if(this.Version == VSVersion.VS70) | 243 | if(this.Version == VSVersion.VS70) |
244 | { | 244 | { |
245 | ps.WriteLine("\t\t\t\t NoStandardLibraries = \"false\""); | 245 | ps.WriteLine("\t\t\t\t NoStandardLibraries = \"false\""); |
246 | } | 246 | } |
247 | 247 | ||
248 | ps.WriteLine("\t\t\t\t OutputType = \"{0}\"", project.Type.ToString()); | 248 | ps.WriteLine("\t\t\t\t OutputType = \"{0}\"", project.Type.ToString()); |
249 | 249 | ||
250 | enumerator = project.Configurations.GetEnumerator(); | 250 | enumerator = project.Configurations.GetEnumerator(); |
251 | enumerator.Reset(); | 251 | enumerator.Reset(); |
252 | enumerator.MoveNext(); | 252 | enumerator.MoveNext(); |
253 | foreach(ConfigurationNode conf in project.Configurations) | 253 | foreach(ConfigurationNode conf in project.Configurations) |
254 | { | 254 | { |
255 | if (conf.Options["PreBuildEvent"] != null && conf.Options["PreBuildEvent"].ToString().Length != 0) | 255 | if (conf.Options["PreBuildEvent"] != null && conf.Options["PreBuildEvent"].ToString().Length != 0) |
256 | { | 256 | { |
257 | ps.WriteLine("\t\t\t\t PreBuildEvent = \"{0}\"", Helper.NormalizePath(conf.Options["PreBuildEvent"].ToString())); | 257 | ps.WriteLine("\t\t\t\t PreBuildEvent = \"{0}\"", Helper.NormalizePath(conf.Options["PreBuildEvent"].ToString())); |
258 | } | 258 | } |
259 | else | 259 | else |
260 | { | 260 | { |
261 | ps.WriteLine("\t\t\t\t PreBuildEvent = \"{0}\"", conf.Options["PreBuildEvent"]); | 261 | ps.WriteLine("\t\t\t\t PreBuildEvent = \"{0}\"", conf.Options["PreBuildEvent"]); |
262 | } | 262 | } |
263 | if (conf.Options["PostBuildEvent"] != null && conf.Options["PostBuildEvent"].ToString().Length != 0) | 263 | if (conf.Options["PostBuildEvent"] != null && conf.Options["PostBuildEvent"].ToString().Length != 0) |
264 | { | 264 | { |
265 | ps.WriteLine("\t\t\t\t PostBuildEvent = \"{0}\"", Helper.NormalizePath(conf.Options["PostBuildEvent"].ToString())); | 265 | ps.WriteLine("\t\t\t\t PostBuildEvent = \"{0}\"", Helper.NormalizePath(conf.Options["PostBuildEvent"].ToString())); |
266 | } | 266 | } |
267 | else | 267 | else |
268 | { | 268 | { |
269 | ps.WriteLine("\t\t\t\t PostBuildEvent = \"{0}\"", conf.Options["PostBuildEvent"]); | 269 | ps.WriteLine("\t\t\t\t PostBuildEvent = \"{0}\"", conf.Options["PostBuildEvent"]); |
270 | } | 270 | } |
271 | if (conf.Options["RunPostBuildEvent"] == null) | 271 | if (conf.Options["RunPostBuildEvent"] == null) |
272 | { | 272 | { |
273 | ps.WriteLine("\t\t\t\t RunPostBuildEvent = \"{0}\"", "OnBuildSuccess"); | 273 | ps.WriteLine("\t\t\t\t RunPostBuildEvent = \"{0}\"", "OnBuildSuccess"); |
274 | } | 274 | } |
275 | else | 275 | else |
276 | { | 276 | { |
277 | ps.WriteLine("\t\t\t\t RunPostBuildEvent = \"{0}\"", conf.Options["RunPostBuildEvent"]); | 277 | ps.WriteLine("\t\t\t\t RunPostBuildEvent = \"{0}\"", conf.Options["RunPostBuildEvent"]); |
278 | } | 278 | } |
279 | break; | 279 | break; |
280 | } | 280 | } |
281 | 281 | ||
282 | ps.WriteLine("\t\t\t\t RootNamespace = \"{0}\"", project.RootNamespace); | 282 | ps.WriteLine("\t\t\t\t RootNamespace = \"{0}\"", project.RootNamespace); |
283 | ps.WriteLine("\t\t\t\t StartupObject = \"{0}\"", project.StartupObject); | 283 | ps.WriteLine("\t\t\t\t StartupObject = \"{0}\"", project.StartupObject); |
284 | ps.WriteLine("\t\t >"); | 284 | ps.WriteLine("\t\t >"); |
285 | 285 | ||
286 | foreach(ConfigurationNode conf in project.Configurations) | 286 | foreach(ConfigurationNode conf in project.Configurations) |
287 | { | 287 | { |
288 | ps.WriteLine("\t\t\t\t <Config"); | 288 | ps.WriteLine("\t\t\t\t <Config"); |
289 | ps.WriteLine("\t\t\t\t Name = \"{0}\"", conf.Name); | 289 | ps.WriteLine("\t\t\t\t Name = \"{0}\"", conf.Name); |
290 | ps.WriteLine("\t\t\t\t AllowUnsafeBlocks = \"{0}\"", conf.Options["AllowUnsafe"].ToString().ToLower()); | 290 | ps.WriteLine("\t\t\t\t AllowUnsafeBlocks = \"{0}\"", conf.Options["AllowUnsafe"].ToString().ToLower()); |
291 | ps.WriteLine("\t\t\t\t BaseAddress = \"{0}\"", conf.Options["BaseAddress"]); | 291 | ps.WriteLine("\t\t\t\t BaseAddress = \"{0}\"", conf.Options["BaseAddress"]); |
292 | ps.WriteLine("\t\t\t\t CheckForOverflowUnderflow = \"{0}\"", conf.Options["CheckUnderflowOverflow"].ToString().ToLower()); | 292 | ps.WriteLine("\t\t\t\t CheckForOverflowUnderflow = \"{0}\"", conf.Options["CheckUnderflowOverflow"].ToString().ToLower()); |
293 | ps.WriteLine("\t\t\t\t ConfigurationOverrideFile = \"\""); | 293 | ps.WriteLine("\t\t\t\t ConfigurationOverrideFile = \"\""); |
294 | ps.WriteLine("\t\t\t\t DefineConstants = \"{0}\"", conf.Options["CompilerDefines"]); | 294 | ps.WriteLine("\t\t\t\t DefineConstants = \"{0}\"", conf.Options["CompilerDefines"]); |
295 | ps.WriteLine("\t\t\t\t DocumentationFile = \"{0}\"", GetXmlDocFile(project, conf));//default to the assembly name | 295 | ps.WriteLine("\t\t\t\t DocumentationFile = \"{0}\"", GetXmlDocFile(project, conf));//default to the assembly name |
296 | ps.WriteLine("\t\t\t\t DebugSymbols = \"{0}\"", conf.Options["DebugInformation"].ToString().ToLower()); | 296 | ps.WriteLine("\t\t\t\t DebugSymbols = \"{0}\"", conf.Options["DebugInformation"].ToString().ToLower()); |
297 | ps.WriteLine("\t\t\t\t FileAlignment = \"{0}\"", conf.Options["FileAlignment"]); | 297 | ps.WriteLine("\t\t\t\t FileAlignment = \"{0}\"", conf.Options["FileAlignment"]); |
298 | ps.WriteLine("\t\t\t\t IncrementalBuild = \"{0}\"", conf.Options["IncrementalBuild"].ToString().ToLower()); | 298 | ps.WriteLine("\t\t\t\t IncrementalBuild = \"{0}\"", conf.Options["IncrementalBuild"].ToString().ToLower()); |
299 | 299 | ||
300 | if(this.Version == VSVersion.VS71) | 300 | if(this.Version == VSVersion.VS71) |
301 | { | 301 | { |
302 | ps.WriteLine("\t\t\t\t NoStdLib = \"{0}\"", conf.Options["NoStdLib"].ToString().ToLower()); | 302 | ps.WriteLine("\t\t\t\t NoStdLib = \"{0}\"", conf.Options["NoStdLib"].ToString().ToLower()); |
303 | ps.WriteLine("\t\t\t\t NoWarn = \"{0}\"", conf.Options["SuppressWarnings"].ToString().ToLower()); | 303 | ps.WriteLine("\t\t\t\t NoWarn = \"{0}\"", conf.Options["SuppressWarnings"].ToString().ToLower()); |
304 | } | 304 | } |
305 | 305 | ||
306 | ps.WriteLine("\t\t\t\t Optimize = \"{0}\"", conf.Options["OptimizeCode"].ToString().ToLower()); | 306 | ps.WriteLine("\t\t\t\t Optimize = \"{0}\"", conf.Options["OptimizeCode"].ToString().ToLower()); |
307 | ps.WriteLine(" OutputPath = \"{0}\"", | 307 | ps.WriteLine(" OutputPath = \"{0}\"", |
308 | Helper.EndPath(Helper.NormalizePath(conf.Options["OutputPath"].ToString()))); | 308 | Helper.EndPath(Helper.NormalizePath(conf.Options["OutputPath"].ToString()))); |
309 | ps.WriteLine(" RegisterForComInterop = \"{0}\"", conf.Options["RegisterComInterop"].ToString().ToLower()); | 309 | ps.WriteLine(" RegisterForComInterop = \"{0}\"", conf.Options["RegisterComInterop"].ToString().ToLower()); |
310 | ps.WriteLine(" RemoveIntegerChecks = \"{0}\"", conf.Options["RemoveIntegerChecks"].ToString().ToLower()); | 310 | ps.WriteLine(" RemoveIntegerChecks = \"{0}\"", conf.Options["RemoveIntegerChecks"].ToString().ToLower()); |
311 | ps.WriteLine(" TreatWarningsAsErrors = \"{0}\"", conf.Options["WarningsAsErrors"].ToString().ToLower()); | 311 | ps.WriteLine(" TreatWarningsAsErrors = \"{0}\"", conf.Options["WarningsAsErrors"].ToString().ToLower()); |
312 | ps.WriteLine(" WarningLevel = \"{0}\"", conf.Options["WarningLevel"]); | 312 | ps.WriteLine(" WarningLevel = \"{0}\"", conf.Options["WarningLevel"]); |
313 | ps.WriteLine(" />"); | 313 | ps.WriteLine(" />"); |
314 | } | 314 | } |
315 | 315 | ||
316 | ps.WriteLine(" </Settings>"); | 316 | ps.WriteLine(" </Settings>"); |
317 | 317 | ||
318 | ps.WriteLine(" <References>"); | 318 | ps.WriteLine(" <References>"); |
319 | foreach(ReferenceNode refr in project.References) | 319 | foreach(ReferenceNode refr in project.References) |
320 | { | 320 | { |
321 | ps.WriteLine(" <Reference"); | 321 | ps.WriteLine(" <Reference"); |
322 | ps.WriteLine(" Name = \"{0}\"", refr.Name); | 322 | ps.WriteLine(" Name = \"{0}\"", refr.Name); |
323 | ps.WriteLine(" AssemblyName = \"{0}\"", refr.Name); | 323 | ps.WriteLine(" AssemblyName = \"{0}\"", refr.Name); |
324 | 324 | ||
325 | if(solution.ProjectsTable.ContainsKey(refr.Name)) | 325 | if(solution.ProjectsTable.ContainsKey(refr.Name)) |
326 | { | 326 | { |
327 | ProjectNode refProject = (ProjectNode)solution.ProjectsTable[refr.Name]; | 327 | ProjectNode refProject = (ProjectNode)solution.ProjectsTable[refr.Name]; |
328 | ps.WriteLine(" Project = \"{{{0}}}\"", refProject.Guid.ToString().ToUpper()); | 328 | ps.WriteLine(" Project = \"{{{0}}}\"", refProject.Guid.ToString().ToUpper()); |
329 | ps.WriteLine(" Package = \"{0}\"", toolInfo.Guid.ToString().ToUpper()); | 329 | ps.WriteLine(" Package = \"{0}\"", toolInfo.Guid.ToString().ToUpper()); |
330 | } | 330 | } |
331 | else | 331 | else |
332 | { | 332 | { |
333 | if(refr.Path != null) | 333 | if(refr.Path != null) |
334 | { | 334 | { |
335 | ps.WriteLine(" HintPath = \"{0}\"", Helper.MakeFilePath(refr.Path, refr.Name, "dll")); | 335 | ps.WriteLine(" HintPath = \"{0}\"", Helper.MakeFilePath(refr.Path, refr.Name, "dll")); |
336 | } | 336 | } |
337 | 337 | ||
338 | } | 338 | } |
339 | 339 | ||
340 | if(refr.LocalCopySpecified) | 340 | if(refr.LocalCopySpecified) |
341 | { | 341 | { |
342 | ps.WriteLine(" Private = \"{0}\"",refr.LocalCopy); | 342 | ps.WriteLine(" Private = \"{0}\"",refr.LocalCopy); |
343 | } | 343 | } |
344 | 344 | ||
345 | ps.WriteLine(" />"); | 345 | ps.WriteLine(" />"); |
346 | } | 346 | } |
347 | ps.WriteLine(" </References>"); | 347 | ps.WriteLine(" </References>"); |
348 | 348 | ||
349 | ps.WriteLine(" </Build>"); | 349 | ps.WriteLine(" </Build>"); |
350 | ps.WriteLine(" <Files>"); | 350 | ps.WriteLine(" <Files>"); |
351 | 351 | ||
352 | ps.WriteLine(" <Include>"); | 352 | ps.WriteLine(" <Include>"); |
353 | 353 | ||
354 | foreach(string file in project.Files) | 354 | foreach(string file in project.Files) |
355 | { | 355 | { |
356 | string fileName = file.Replace(".\\", ""); | 356 | string fileName = file.Replace(".\\", ""); |
357 | ps.WriteLine(" <File"); | 357 | ps.WriteLine(" <File"); |
358 | ps.WriteLine(" RelPath = \"{0}\"", fileName); | 358 | ps.WriteLine(" RelPath = \"{0}\"", fileName); |
359 | ps.WriteLine(" SubType = \"{0}\"", project.Files.GetSubType(file)); | 359 | ps.WriteLine(" SubType = \"{0}\"", project.Files.GetSubType(file)); |
360 | ps.WriteLine(" BuildAction = \"{0}\"", project.Files.GetBuildAction(file)); | 360 | ps.WriteLine(" BuildAction = \"{0}\"", project.Files.GetBuildAction(file)); |
361 | ps.WriteLine(" />"); | 361 | ps.WriteLine(" />"); |
362 | 362 | ||
363 | if (project.Files.GetSubType(file) != SubType.Code && project.Files.GetSubType(file) != SubType.Settings) | 363 | if (project.Files.GetSubType(file) != SubType.Code && project.Files.GetSubType(file) != SubType.Settings) |
364 | { | 364 | { |
365 | ps.WriteLine(" <File"); | 365 | ps.WriteLine(" <File"); |
366 | ps.WriteLine(" RelPath = \"{0}\"", fileName.Substring(0, fileName.LastIndexOf('.')) + ".resx"); | 366 | ps.WriteLine(" RelPath = \"{0}\"", fileName.Substring(0, fileName.LastIndexOf('.')) + ".resx"); |
367 | int slash = fileName.LastIndexOf('\\'); | 367 | int slash = fileName.LastIndexOf('\\'); |
368 | if (slash == -1) | 368 | if (slash == -1) |
369 | { | 369 | { |
370 | ps.WriteLine(" DependentUpon = \"{0}\"", fileName); | 370 | ps.WriteLine(" DependentUpon = \"{0}\"", fileName); |
371 | } | 371 | } |
372 | else | 372 | else |
373 | { | 373 | { |
374 | ps.WriteLine(" DependentUpon = \"{0}\"", fileName.Substring(slash + 1, fileName.Length - slash - 1)); | 374 | ps.WriteLine(" DependentUpon = \"{0}\"", fileName.Substring(slash + 1, fileName.Length - slash - 1)); |
375 | } | 375 | } |
376 | ps.WriteLine(" BuildAction = \"{0}\"", "EmbeddedResource"); | 376 | ps.WriteLine(" BuildAction = \"{0}\"", "EmbeddedResource"); |
377 | ps.WriteLine(" />"); | 377 | ps.WriteLine(" />"); |
378 | 378 | ||
379 | } | 379 | } |
380 | } | 380 | } |
381 | ps.WriteLine(" </Include>"); | 381 | ps.WriteLine(" </Include>"); |
382 | 382 | ||
383 | ps.WriteLine(" </Files>"); | 383 | ps.WriteLine(" </Files>"); |
384 | ps.WriteLine(" </{0}>", toolInfo.XmlTag); | 384 | ps.WriteLine(" </{0}>", toolInfo.XmlTag); |
385 | ps.WriteLine("</VisualStudioProject>"); | 385 | ps.WriteLine("</VisualStudioProject>"); |
386 | } | 386 | } |
387 | 387 | ||
388 | ps = new StreamWriter(projectFile + ".user"); | 388 | ps = new StreamWriter(projectFile + ".user"); |
389 | using(ps) | 389 | using(ps) |
390 | { | 390 | { |
391 | ps.WriteLine("<VisualStudioProject>"); | 391 | ps.WriteLine("<VisualStudioProject>"); |
392 | ps.WriteLine(" <{0}>", toolInfo.XmlTag); | 392 | ps.WriteLine(" <{0}>", toolInfo.XmlTag); |
393 | ps.WriteLine(" <Build>"); | 393 | ps.WriteLine(" <Build>"); |
394 | 394 | ||
395 | ps.WriteLine(" <Settings ReferencePath=\"{0}\">", MakeRefPath(project)); | 395 | ps.WriteLine(" <Settings ReferencePath=\"{0}\">", MakeRefPath(project)); |
396 | foreach(ConfigurationNode conf in project.Configurations) | 396 | foreach(ConfigurationNode conf in project.Configurations) |
397 | { | 397 | { |
398 | ps.WriteLine(" <Config"); | 398 | ps.WriteLine(" <Config"); |
399 | ps.WriteLine(" Name = \"{0}\"", conf.Name); | 399 | ps.WriteLine(" Name = \"{0}\"", conf.Name); |
400 | ps.WriteLine(" />"); | 400 | ps.WriteLine(" />"); |
401 | } | 401 | } |
402 | ps.WriteLine(" </Settings>"); | 402 | ps.WriteLine(" </Settings>"); |
403 | 403 | ||
404 | ps.WriteLine(" </Build>"); | 404 | ps.WriteLine(" </Build>"); |
405 | ps.WriteLine(" </{0}>", toolInfo.XmlTag); | 405 | ps.WriteLine(" </{0}>", toolInfo.XmlTag); |
406 | ps.WriteLine("</VisualStudioProject>"); | 406 | ps.WriteLine("</VisualStudioProject>"); |
407 | } | 407 | } |
408 | 408 | ||
409 | m_Kernel.CurrentWorkingDirectory.Pop(); | 409 | m_Kernel.CurrentWorkingDirectory.Pop(); |
410 | } | 410 | } |
411 | 411 | ||
412 | /// <summary> | 412 | /// <summary> |
413 | /// Gets the XML doc file. | 413 | /// Gets the XML doc file. |
414 | /// </summary> | 414 | /// </summary> |
415 | /// <param name="project">The project.</param> | 415 | /// <param name="project">The project.</param> |
416 | /// <param name="conf">The conf.</param> | 416 | /// <param name="conf">The conf.</param> |
417 | /// <returns></returns> | 417 | /// <returns></returns> |
418 | public static string GetXmlDocFile(ProjectNode project, ConfigurationNode conf) | 418 | public static string GetXmlDocFile(ProjectNode project, ConfigurationNode conf) |
419 | { | 419 | { |
420 | if( conf == null ) | 420 | if( conf == null ) |
421 | { | 421 | { |
422 | throw new ArgumentNullException("conf"); | 422 | throw new ArgumentNullException("conf"); |
423 | } | 423 | } |
424 | if( project == null ) | 424 | if( project == null ) |
425 | { | 425 | { |
426 | throw new ArgumentNullException("project"); | 426 | throw new ArgumentNullException("project"); |
427 | } | 427 | } |
428 | // if(!(bool)conf.Options["GenerateXmlDocFile"]) //default to none, if the generate option is false | 428 | // if(!(bool)conf.Options["GenerateXmlDocFile"]) //default to none, if the generate option is false |
429 | // { | 429 | // { |
430 | // return string.Empty; | 430 | // return string.Empty; |
431 | // } | 431 | // } |
432 | 432 | ||
433 | //default to "AssemblyName.xml" | 433 | //default to "AssemblyName.xml" |
434 | //string defaultValue = Path.GetFileNameWithoutExtension(project.AssemblyName) + ".xml"; | 434 | //string defaultValue = Path.GetFileNameWithoutExtension(project.AssemblyName) + ".xml"; |
435 | //return (string)conf.Options["XmlDocFile", defaultValue]; | 435 | //return (string)conf.Options["XmlDocFile", defaultValue]; |
436 | 436 | ||
437 | //default to no XmlDocFile file | 437 | //default to no XmlDocFile file |
438 | return (string)conf.Options["XmlDocFile", ""]; | 438 | return (string)conf.Options["XmlDocFile", ""]; |
439 | } | 439 | } |
440 | 440 | ||
441 | private void WriteSolution(SolutionNode solution) | 441 | private void WriteSolution(SolutionNode solution) |
442 | { | 442 | { |
443 | m_Kernel.Log.Write("Creating Visual Studio {0} solution and project files", this.VersionName); | 443 | m_Kernel.Log.Write("Creating Visual Studio {0} solution and project files", this.VersionName); |
444 | 444 | ||
445 | foreach(ProjectNode project in solution.Projects) | 445 | foreach(ProjectNode project in solution.Projects) |
446 | { | 446 | { |
447 | if(m_Kernel.AllowProject(project.FilterGroups)) | 447 | if(m_Kernel.AllowProject(project.FilterGroups)) |
448 | { | 448 | { |
449 | m_Kernel.Log.Write("...Creating project: {0}", project.Name); | 449 | m_Kernel.Log.Write("...Creating project: {0}", project.Name); |
450 | WriteProject(solution, project); | 450 | WriteProject(solution, project); |
451 | } | 451 | } |
452 | } | 452 | } |
453 | 453 | ||
454 | m_Kernel.Log.Write(""); | 454 | m_Kernel.Log.Write(""); |
455 | string solutionFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "sln"); | 455 | string solutionFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "sln"); |
456 | StreamWriter ss = new StreamWriter(solutionFile); | 456 | StreamWriter ss = new StreamWriter(solutionFile); |
457 | 457 | ||
458 | m_Kernel.CurrentWorkingDirectory.Push(); | 458 | m_Kernel.CurrentWorkingDirectory.Push(); |
459 | Helper.SetCurrentDir(Path.GetDirectoryName(solutionFile)); | 459 | Helper.SetCurrentDir(Path.GetDirectoryName(solutionFile)); |
460 | 460 | ||
461 | using(ss) | 461 | using(ss) |
462 | { | 462 | { |
463 | ss.WriteLine("Microsoft Visual Studio Solution File, Format Version {0}", this.SolutionVersion); | 463 | ss.WriteLine("Microsoft Visual Studio Solution File, Format Version {0}", this.SolutionVersion); |
464 | foreach(ProjectNode project in solution.Projects) | 464 | foreach(ProjectNode project in solution.Projects) |
465 | { | 465 | { |
466 | if(!m_Tools.ContainsKey(project.Language)) | 466 | if(!m_Tools.ContainsKey(project.Language)) |
467 | { | 467 | { |
468 | throw new UnknownLanguageException("Unknown .NET language: " + project.Language); | 468 | throw new UnknownLanguageException("Unknown .NET language: " + project.Language); |
469 | } | 469 | } |
470 | 470 | ||
471 | ToolInfo toolInfo = (ToolInfo)m_Tools[project.Language]; | 471 | ToolInfo toolInfo = (ToolInfo)m_Tools[project.Language]; |
472 | 472 | ||
473 | string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath); | 473 | string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath); |
474 | ss.WriteLine("Project(\"{0}\") = \"{1}\", \"{2}\", \"{{{3}}}\"", | 474 | ss.WriteLine("Project(\"{0}\") = \"{1}\", \"{2}\", \"{{{3}}}\"", |
475 | toolInfo.Guid, project.Name, Helper.MakeFilePath(path, project.Name, | 475 | toolInfo.Guid, project.Name, Helper.MakeFilePath(path, project.Name, |
476 | toolInfo.FileExtension), project.Guid.ToString().ToUpper()); | 476 | toolInfo.FileExtension), project.Guid.ToString().ToUpper()); |
477 | 477 | ||
478 | ss.WriteLine("\tProjectSection(ProjectDependencies) = postProject"); | 478 | ss.WriteLine("\tProjectSection(ProjectDependencies) = postProject"); |
479 | ss.WriteLine("\tEndProjectSection"); | 479 | ss.WriteLine("\tEndProjectSection"); |
480 | 480 | ||
481 | ss.WriteLine("EndProject"); | 481 | ss.WriteLine("EndProject"); |
482 | } | 482 | } |
483 | 483 | ||
484 | ss.WriteLine("Global"); | 484 | ss.WriteLine("Global"); |
485 | 485 | ||
486 | ss.WriteLine("\tGlobalSection(SolutionConfiguration) = preSolution"); | 486 | ss.WriteLine("\tGlobalSection(SolutionConfiguration) = preSolution"); |
487 | foreach(ConfigurationNode conf in solution.Configurations) | 487 | foreach(ConfigurationNode conf in solution.Configurations) |
488 | { | 488 | { |
489 | ss.WriteLine("\t\t{0} = {0}", conf.Name); | 489 | ss.WriteLine("\t\t{0} = {0}", conf.Name); |
490 | } | 490 | } |
491 | ss.WriteLine("\tEndGlobalSection"); | 491 | ss.WriteLine("\tEndGlobalSection"); |
492 | 492 | ||
493 | ss.WriteLine("\tGlobalSection(ProjectDependencies) = postSolution"); | 493 | ss.WriteLine("\tGlobalSection(ProjectDependencies) = postSolution"); |
494 | foreach(ProjectNode project in solution.Projects) | 494 | foreach(ProjectNode project in solution.Projects) |
495 | { | 495 | { |
496 | for(int i = 0; i < project.References.Count; i++) | 496 | for(int i = 0; i < project.References.Count; i++) |
497 | { | 497 | { |
498 | ReferenceNode refr = (ReferenceNode)project.References[i]; | 498 | ReferenceNode refr = (ReferenceNode)project.References[i]; |
499 | if(solution.ProjectsTable.ContainsKey(refr.Name)) | 499 | if(solution.ProjectsTable.ContainsKey(refr.Name)) |
500 | { | 500 | { |
501 | ProjectNode refProject = (ProjectNode)solution.ProjectsTable[refr.Name]; | 501 | ProjectNode refProject = (ProjectNode)solution.ProjectsTable[refr.Name]; |
502 | ss.WriteLine("\t\t({{{0}}}).{1} = ({{{2}}})", | 502 | ss.WriteLine("\t\t({{{0}}}).{1} = ({{{2}}})", |
503 | project.Guid.ToString().ToUpper() | 503 | project.Guid.ToString().ToUpper() |
504 | , i, | 504 | , i, |
505 | refProject.Guid.ToString().ToUpper() | 505 | refProject.Guid.ToString().ToUpper() |
506 | ); | 506 | ); |
507 | } | 507 | } |
508 | } | 508 | } |
509 | } | 509 | } |
510 | ss.WriteLine("\tEndGlobalSection"); | 510 | ss.WriteLine("\tEndGlobalSection"); |
511 | 511 | ||
512 | ss.WriteLine("\tGlobalSection(ProjectConfiguration) = postSolution"); | 512 | ss.WriteLine("\tGlobalSection(ProjectConfiguration) = postSolution"); |
513 | foreach(ProjectNode project in solution.Projects) | 513 | foreach(ProjectNode project in solution.Projects) |
514 | { | 514 | { |
515 | foreach(ConfigurationNode conf in solution.Configurations) | 515 | foreach(ConfigurationNode conf in solution.Configurations) |
516 | { | 516 | { |
517 | ss.WriteLine("\t\t{{{0}}}.{1}.ActiveCfg = {1}|.NET", | 517 | ss.WriteLine("\t\t{{{0}}}.{1}.ActiveCfg = {1}|.NET", |
518 | project.Guid.ToString().ToUpper(), | 518 | project.Guid.ToString().ToUpper(), |
519 | conf.Name); | 519 | conf.Name); |
520 | 520 | ||
521 | ss.WriteLine("\t\t{{{0}}}.{1}.Build.0 = {1}|.NET", | 521 | ss.WriteLine("\t\t{{{0}}}.{1}.Build.0 = {1}|.NET", |
522 | project.Guid.ToString().ToUpper(), | 522 | project.Guid.ToString().ToUpper(), |
523 | conf.Name); | 523 | conf.Name); |
524 | } | 524 | } |
525 | } | 525 | } |
526 | ss.WriteLine("\tEndGlobalSection"); | 526 | ss.WriteLine("\tEndGlobalSection"); |
527 | 527 | ||
528 | if(solution.Files != null) | 528 | if(solution.Files != null) |
529 | { | 529 | { |
530 | ss.WriteLine("\tGlobalSection(SolutionItems) = postSolution"); | 530 | ss.WriteLine("\tGlobalSection(SolutionItems) = postSolution"); |
531 | foreach(string file in solution.Files) | 531 | foreach(string file in solution.Files) |
532 | { | 532 | { |
533 | ss.WriteLine("\t\t{0} = {0}", file); | 533 | ss.WriteLine("\t\t{0} = {0}", file); |
534 | } | 534 | } |
535 | ss.WriteLine("\tEndGlobalSection"); | 535 | ss.WriteLine("\tEndGlobalSection"); |
536 | } | 536 | } |
537 | 537 | ||
538 | ss.WriteLine("\tGlobalSection(ExtensibilityGlobals) = postSolution"); | 538 | ss.WriteLine("\tGlobalSection(ExtensibilityGlobals) = postSolution"); |
539 | ss.WriteLine("\tEndGlobalSection"); | 539 | ss.WriteLine("\tEndGlobalSection"); |
540 | ss.WriteLine("\tGlobalSection(ExtensibilityAddIns) = postSolution"); | 540 | ss.WriteLine("\tGlobalSection(ExtensibilityAddIns) = postSolution"); |
541 | ss.WriteLine("\tEndGlobalSection"); | 541 | ss.WriteLine("\tEndGlobalSection"); |
542 | 542 | ||
543 | ss.WriteLine("EndGlobal"); | 543 | ss.WriteLine("EndGlobal"); |
544 | } | 544 | } |
545 | 545 | ||
546 | m_Kernel.CurrentWorkingDirectory.Pop(); | 546 | m_Kernel.CurrentWorkingDirectory.Pop(); |
547 | } | 547 | } |
548 | 548 | ||
549 | private void CleanProject(ProjectNode project) | 549 | private void CleanProject(ProjectNode project) |
550 | { | 550 | { |
551 | m_Kernel.Log.Write("...Cleaning project: {0}", project.Name); | 551 | m_Kernel.Log.Write("...Cleaning project: {0}", project.Name); |
552 | 552 | ||
553 | ToolInfo toolInfo = (ToolInfo)m_Tools[project.Language]; | 553 | ToolInfo toolInfo = (ToolInfo)m_Tools[project.Language]; |
554 | string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, toolInfo.FileExtension); | 554 | string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, toolInfo.FileExtension); |
555 | string userFile = projectFile + ".user"; | 555 | string userFile = projectFile + ".user"; |
556 | 556 | ||
557 | Helper.DeleteIfExists(projectFile); | 557 | Helper.DeleteIfExists(projectFile); |
558 | Helper.DeleteIfExists(userFile); | 558 | Helper.DeleteIfExists(userFile); |
559 | } | 559 | } |
560 | 560 | ||
561 | private void CleanSolution(SolutionNode solution) | 561 | private void CleanSolution(SolutionNode solution) |
562 | { | 562 | { |
563 | m_Kernel.Log.Write("Cleaning Visual Studio {0} solution and project files", this.VersionName, solution.Name); | 563 | m_Kernel.Log.Write("Cleaning Visual Studio {0} solution and project files", this.VersionName, solution.Name); |
564 | 564 | ||
565 | string slnFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "sln"); | 565 | string slnFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "sln"); |
566 | string suoFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "suo"); | 566 | string suoFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "suo"); |
567 | 567 | ||
568 | Helper.DeleteIfExists(slnFile); | 568 | Helper.DeleteIfExists(slnFile); |
569 | Helper.DeleteIfExists(suoFile); | 569 | Helper.DeleteIfExists(suoFile); |
570 | 570 | ||
571 | foreach(ProjectNode project in solution.Projects) | 571 | foreach(ProjectNode project in solution.Projects) |
572 | { | 572 | { |
573 | CleanProject(project); | 573 | CleanProject(project); |
574 | } | 574 | } |
575 | 575 | ||
576 | m_Kernel.Log.Write(""); | 576 | m_Kernel.Log.Write(""); |
577 | } | 577 | } |
578 | 578 | ||
579 | #endregion | 579 | #endregion |
580 | 580 | ||
581 | #region ITarget Members | 581 | #region ITarget Members |
582 | 582 | ||
583 | /// <summary> | 583 | /// <summary> |
584 | /// Writes the specified kern. | 584 | /// Writes the specified kern. |
585 | /// </summary> | 585 | /// </summary> |
586 | /// <param name="kern">The kern.</param> | 586 | /// <param name="kern">The kern.</param> |
587 | public virtual void Write(Kernel kern) | 587 | public virtual void Write(Kernel kern) |
588 | { | 588 | { |
589 | if( kern == null ) | 589 | if( kern == null ) |
590 | { | 590 | { |
591 | throw new ArgumentNullException("kern"); | 591 | throw new ArgumentNullException("kern"); |
592 | } | 592 | } |
593 | m_Kernel = kern; | 593 | m_Kernel = kern; |
594 | foreach(SolutionNode sol in m_Kernel.Solutions) | 594 | foreach(SolutionNode sol in m_Kernel.Solutions) |
595 | { | 595 | { |
596 | WriteSolution(sol); | 596 | WriteSolution(sol); |
597 | } | 597 | } |
598 | m_Kernel = null; | 598 | m_Kernel = null; |
599 | } | 599 | } |
600 | 600 | ||
601 | /// <summary> | 601 | /// <summary> |
602 | /// Cleans the specified kern. | 602 | /// Cleans the specified kern. |
603 | /// </summary> | 603 | /// </summary> |
604 | /// <param name="kern">The kern.</param> | 604 | /// <param name="kern">The kern.</param> |
605 | public virtual void Clean(Kernel kern) | 605 | public virtual void Clean(Kernel kern) |
606 | { | 606 | { |
607 | if( kern == null ) | 607 | if( kern == null ) |
608 | { | 608 | { |
609 | throw new ArgumentNullException("kern"); | 609 | throw new ArgumentNullException("kern"); |
610 | } | 610 | } |
611 | m_Kernel = kern; | 611 | m_Kernel = kern; |
612 | foreach(SolutionNode sol in m_Kernel.Solutions) | 612 | foreach(SolutionNode sol in m_Kernel.Solutions) |
613 | { | 613 | { |
614 | CleanSolution(sol); | 614 | CleanSolution(sol); |
615 | } | 615 | } |
616 | m_Kernel = null; | 616 | m_Kernel = null; |
617 | } | 617 | } |
618 | 618 | ||
619 | /// <summary> | 619 | /// <summary> |
620 | /// Gets the name. | 620 | /// Gets the name. |
621 | /// </summary> | 621 | /// </summary> |
622 | /// <value>The name.</value> | 622 | /// <value>The name.</value> |
623 | public virtual string Name | 623 | public virtual string Name |
624 | { | 624 | { |
625 | get | 625 | get |
626 | { | 626 | { |
627 | return "vs2003"; | 627 | return "vs2003"; |
628 | } | 628 | } |
629 | } | 629 | } |
630 | 630 | ||
631 | #endregion | 631 | #endregion |
632 | } | 632 | } |
633 | } | 633 | } |
diff --git a/Prebuild/src/Core/Targets/VS2005Target.cs b/Prebuild/src/Core/Targets/VS2005Target.cs index 23b6116..f01906b 100644 --- a/Prebuild/src/Core/Targets/VS2005Target.cs +++ b/Prebuild/src/Core/Targets/VS2005Target.cs | |||
@@ -1,883 +1,883 @@ | |||
1 | #region BSD License | 1 | #region BSD License |
2 | /* | 2 | /* |
3 | Copyright (c) 2004 Matthew Holmes (matthew@wildfiregames.com) | 3 | Copyright (c) 2004 Matthew Holmes (matthew@wildfiregames.com) |
4 | 4 | ||
5 | Redistribution and use in source and binary forms, with or without modification, are permitted | 5 | Redistribution and use in source and binary forms, with or without modification, are permitted |
6 | provided that the following conditions are met: | 6 | provided that the following conditions are met: |
7 | 7 | ||
8 | * Redistributions of source code must retain the above copyright notice, this list of conditions | 8 | * Redistributions of source code must retain the above copyright notice, this list of conditions |
9 | and the following disclaimer. | 9 | and the following disclaimer. |
10 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions | 10 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions |
11 | and the following disclaimer in the documentation and/or other materials provided with the | 11 | and the following disclaimer in the documentation and/or other materials provided with the |
12 | distribution. | 12 | distribution. |
13 | * The name of the author may not be used to endorse or promote products derived from this software | 13 | * The name of the author may not be used to endorse or promote products derived from this software |
14 | without specific prior written permission. | 14 | without specific prior written permission. |
15 | 15 | ||
16 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, | 16 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, |
17 | BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | 17 | BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
18 | ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | 18 | ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
19 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | 19 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
20 | OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY | 20 | OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
21 | OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | 21 | OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING |
22 | IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 22 | IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
23 | */ | 23 | */ |
24 | #endregion | 24 | #endregion |
25 | 25 | ||
26 | #region CVS Information | 26 | #region CVS Information |
27 | /* | 27 | /* |
28 | * $Source$ | 28 | * $Source$ |
29 | * $Author: robloach $ | 29 | * $Author: robloach $ |
30 | * $Date: 2007-02-27 19:52:34 +0100 (ti, 27 feb 2007) $ | 30 | * $Date: 2007-02-27 19:52:34 +0100 (ti, 27 feb 2007) $ |
31 | * $Revision: 207 $ | 31 | * $Revision: 207 $ |
32 | */ | 32 | */ |
33 | #endregion | 33 | #endregion |
34 | 34 | ||
35 | using System; | 35 | using System; |
36 | using System.Collections; | 36 | using System.Collections; |
37 | using System.Collections.Specialized; | 37 | using System.Collections.Specialized; |
38 | using System.IO; | 38 | using System.IO; |
39 | 39 | ||
40 | using Prebuild.Core.Attributes; | 40 | using Prebuild.Core.Attributes; |
41 | using Prebuild.Core.Interfaces; | 41 | using Prebuild.Core.Interfaces; |
42 | using Prebuild.Core.Nodes; | 42 | using Prebuild.Core.Nodes; |
43 | using Prebuild.Core.Utilities; | 43 | using Prebuild.Core.Utilities; |
44 | 44 | ||
45 | namespace Prebuild.Core.Targets | 45 | namespace Prebuild.Core.Targets |
46 | { | 46 | { |
47 | /// <summary> | 47 | /// <summary> |
48 | /// | 48 | /// |
49 | /// </summary> | 49 | /// </summary> |
50 | public struct ToolInfo | 50 | public struct ToolInfo |
51 | { | 51 | { |
52 | string name; | 52 | string name; |
53 | string guid; | 53 | string guid; |
54 | string fileExtension; | 54 | string fileExtension; |
55 | string xmlTag; | 55 | string xmlTag; |
56 | string importProject; | 56 | string importProject; |
57 | 57 | ||
58 | /// <summary> | 58 | /// <summary> |
59 | /// Gets or sets the name. | 59 | /// Gets or sets the name. |
60 | /// </summary> | 60 | /// </summary> |
61 | /// <value>The name.</value> | 61 | /// <value>The name.</value> |
62 | public string Name | 62 | public string Name |
63 | { | 63 | { |
64 | get | 64 | get |
65 | { | 65 | { |
66 | return name; | 66 | return name; |
67 | } | 67 | } |
68 | set | 68 | set |
69 | { | 69 | { |
70 | name = value; | 70 | name = value; |
71 | } | 71 | } |
72 | } | 72 | } |
73 | 73 | ||
74 | /// <summary> | 74 | /// <summary> |
75 | /// Gets or sets the GUID. | 75 | /// Gets or sets the GUID. |
76 | /// </summary> | 76 | /// </summary> |
77 | /// <value>The GUID.</value> | 77 | /// <value>The GUID.</value> |
78 | public string Guid | 78 | public string Guid |
79 | { | 79 | { |
80 | get | 80 | get |
81 | { | 81 | { |
82 | return guid; | 82 | return guid; |
83 | } | 83 | } |
84 | set | 84 | set |
85 | { | 85 | { |
86 | guid = value; | 86 | guid = value; |
87 | } | 87 | } |
88 | } | 88 | } |
89 | 89 | ||
90 | /// <summary> | 90 | /// <summary> |
91 | /// Gets or sets the file extension. | 91 | /// Gets or sets the file extension. |
92 | /// </summary> | 92 | /// </summary> |
93 | /// <value>The file extension.</value> | 93 | /// <value>The file extension.</value> |
94 | public string FileExtension | 94 | public string FileExtension |
95 | { | 95 | { |
96 | get | 96 | get |
97 | { | 97 | { |
98 | return fileExtension; | 98 | return fileExtension; |
99 | } | 99 | } |
100 | set | 100 | set |
101 | { | 101 | { |
102 | fileExtension = value; | 102 | fileExtension = value; |
103 | } | 103 | } |
104 | } | 104 | } |
105 | /// <summary> | 105 | /// <summary> |
106 | /// Gets or sets the XML tag. | 106 | /// Gets or sets the XML tag. |
107 | /// </summary> | 107 | /// </summary> |
108 | /// <value>The XML tag.</value> | 108 | /// <value>The XML tag.</value> |
109 | public string XmlTag | 109 | public string XmlTag |
110 | { | 110 | { |
111 | get | 111 | get |
112 | { | 112 | { |
113 | return xmlTag; | 113 | return xmlTag; |
114 | } | 114 | } |
115 | set | 115 | set |
116 | { | 116 | { |
117 | xmlTag = value; | 117 | xmlTag = value; |
118 | } | 118 | } |
119 | } | 119 | } |
120 | 120 | ||
121 | /// <summary> | 121 | /// <summary> |
122 | /// Gets or sets the import project property. | 122 | /// Gets or sets the import project property. |
123 | /// </summary> | 123 | /// </summary> |
124 | /// <value>The ImportProject tag.</value> | 124 | /// <value>The ImportProject tag.</value> |
125 | public string ImportProject | 125 | public string ImportProject |
126 | { | 126 | { |
127 | get | 127 | get |
128 | { | 128 | { |
129 | return importProject; | 129 | return importProject; |
130 | } | 130 | } |
131 | set | 131 | set |
132 | { | 132 | { |
133 | importProject = value; | 133 | importProject = value; |
134 | } | 134 | } |
135 | } | 135 | } |
136 | 136 | ||
137 | /// <summary> | 137 | /// <summary> |
138 | /// Initializes a new instance of the <see cref="ToolInfo"/> class. | 138 | /// Initializes a new instance of the <see cref="ToolInfo"/> class. |
139 | /// </summary> | 139 | /// </summary> |
140 | /// <param name="name">The name.</param> | 140 | /// <param name="name">The name.</param> |
141 | /// <param name="guid">The GUID.</param> | 141 | /// <param name="guid">The GUID.</param> |
142 | /// <param name="fileExtension">The file extension.</param> | 142 | /// <param name="fileExtension">The file extension.</param> |
143 | /// <param name="xml">The XML.</param> | 143 | /// <param name="xml">The XML.</param> |
144 | /// <param name="importProject">The import project.</param> | 144 | /// <param name="importProject">The import project.</param> |
145 | public ToolInfo(string name, string guid, string fileExtension, string xml, string importProject) | 145 | public ToolInfo(string name, string guid, string fileExtension, string xml, string importProject) |
146 | { | 146 | { |
147 | this.name = name; | 147 | this.name = name; |
148 | this.guid = guid; | 148 | this.guid = guid; |
149 | this.fileExtension = fileExtension; | 149 | this.fileExtension = fileExtension; |
150 | this.xmlTag = xml; | 150 | this.xmlTag = xml; |
151 | this.importProject = importProject; | 151 | this.importProject = importProject; |
152 | } | 152 | } |
153 | 153 | ||
154 | /// <summary> | 154 | /// <summary> |
155 | /// Initializes a new instance of the <see cref="ToolInfo"/> class. | 155 | /// Initializes a new instance of the <see cref="ToolInfo"/> class. |
156 | /// </summary> | 156 | /// </summary> |
157 | /// <param name="name">The name.</param> | 157 | /// <param name="name">The name.</param> |
158 | /// <param name="guid">The GUID.</param> | 158 | /// <param name="guid">The GUID.</param> |
159 | /// <param name="fileExtension">The file extension.</param> | 159 | /// <param name="fileExtension">The file extension.</param> |
160 | /// <param name="xml">The XML.</param> | 160 | /// <param name="xml">The XML.</param> |
161 | public ToolInfo(string name, string guid, string fileExtension, string xml) | 161 | public ToolInfo(string name, string guid, string fileExtension, string xml) |
162 | { | 162 | { |
163 | this.name = name; | 163 | this.name = name; |
164 | this.guid = guid; | 164 | this.guid = guid; |
165 | this.fileExtension = fileExtension; | 165 | this.fileExtension = fileExtension; |
166 | this.xmlTag = xml; | 166 | this.xmlTag = xml; |
167 | this.importProject = "$(MSBuildBinPath)\\Microsoft." + xml + ".Targets"; | 167 | this.importProject = "$(MSBuildBinPath)\\Microsoft." + xml + ".Targets"; |
168 | } | 168 | } |
169 | 169 | ||
170 | /// <summary> | 170 | /// <summary> |
171 | /// Equals operator | 171 | /// Equals operator |
172 | /// </summary> | 172 | /// </summary> |
173 | /// <param name="obj">ToolInfo to compare</param> | 173 | /// <param name="obj">ToolInfo to compare</param> |
174 | /// <returns>true if toolInfos are equal</returns> | 174 | /// <returns>true if toolInfos are equal</returns> |
175 | public override bool Equals(object obj) | 175 | public override bool Equals(object obj) |
176 | { | 176 | { |
177 | if (obj == null) | 177 | if (obj == null) |
178 | { | 178 | { |
179 | throw new ArgumentNullException("obj"); | 179 | throw new ArgumentNullException("obj"); |
180 | } | 180 | } |
181 | if (obj.GetType() != typeof(ToolInfo)) | 181 | if (obj.GetType() != typeof(ToolInfo)) |
182 | return false; | 182 | return false; |
183 | 183 | ||
184 | ToolInfo c = (ToolInfo)obj; | 184 | ToolInfo c = (ToolInfo)obj; |
185 | return ((this.name == c.name) && (this.guid == c.guid) && (this.fileExtension == c.fileExtension) && (this.importProject == c.importProject)); | 185 | return ((this.name == c.name) && (this.guid == c.guid) && (this.fileExtension == c.fileExtension) && (this.importProject == c.importProject)); |
186 | } | 186 | } |
187 | 187 | ||
188 | /// <summary> | 188 | /// <summary> |
189 | /// Equals operator | 189 | /// Equals operator |
190 | /// </summary> | 190 | /// </summary> |
191 | /// <param name="c1">ToolInfo to compare</param> | 191 | /// <param name="c1">ToolInfo to compare</param> |
192 | /// <param name="c2">ToolInfo to compare</param> | 192 | /// <param name="c2">ToolInfo to compare</param> |
193 | /// <returns>True if toolInfos are equal</returns> | 193 | /// <returns>True if toolInfos are equal</returns> |
194 | public static bool operator ==(ToolInfo c1, ToolInfo c2) | 194 | public static bool operator ==(ToolInfo c1, ToolInfo c2) |
195 | { | 195 | { |
196 | return ((c1.name == c2.name) && (c1.guid == c2.guid) && (c1.fileExtension == c2.fileExtension) && (c1.importProject == c2.importProject) && (c1.xmlTag == c2.xmlTag)); | 196 | return ((c1.name == c2.name) && (c1.guid == c2.guid) && (c1.fileExtension == c2.fileExtension) && (c1.importProject == c2.importProject) && (c1.xmlTag == c2.xmlTag)); |
197 | } | 197 | } |
198 | 198 | ||
199 | /// <summary> | 199 | /// <summary> |
200 | /// Not equals operator | 200 | /// Not equals operator |
201 | /// </summary> | 201 | /// </summary> |
202 | /// <param name="c1">ToolInfo to compare</param> | 202 | /// <param name="c1">ToolInfo to compare</param> |
203 | /// <param name="c2">ToolInfo to compare</param> | 203 | /// <param name="c2">ToolInfo to compare</param> |
204 | /// <returns>True if toolInfos are not equal</returns> | 204 | /// <returns>True if toolInfos are not equal</returns> |
205 | public static bool operator !=(ToolInfo c1, ToolInfo c2) | 205 | public static bool operator !=(ToolInfo c1, ToolInfo c2) |
206 | { | 206 | { |
207 | return !(c1 == c2); | 207 | return !(c1 == c2); |
208 | } | 208 | } |
209 | 209 | ||
210 | /// <summary> | 210 | /// <summary> |
211 | /// Hash Code | 211 | /// Hash Code |
212 | /// </summary> | 212 | /// </summary> |
213 | /// <returns>Hash code</returns> | 213 | /// <returns>Hash code</returns> |
214 | public override int GetHashCode() | 214 | public override int GetHashCode() |
215 | { | 215 | { |
216 | return name.GetHashCode() ^ guid.GetHashCode() ^ this.fileExtension.GetHashCode() ^ this.importProject.GetHashCode() ^ this.xmlTag.GetHashCode(); | 216 | return name.GetHashCode() ^ guid.GetHashCode() ^ this.fileExtension.GetHashCode() ^ this.importProject.GetHashCode() ^ this.xmlTag.GetHashCode(); |
217 | 217 | ||
218 | } | 218 | } |
219 | } | 219 | } |
220 | 220 | ||
221 | /// <summary> | 221 | /// <summary> |
222 | /// | 222 | /// |
223 | /// </summary> | 223 | /// </summary> |
224 | [Target("vs2005")] | 224 | [Target("vs2005")] |
225 | public class VS2005Target : ITarget | 225 | public class VS2005Target : ITarget |
226 | { | 226 | { |
227 | #region Inner Classes | 227 | #region Inner Classes |
228 | 228 | ||
229 | #endregion | 229 | #endregion |
230 | 230 | ||
231 | #region Fields | 231 | #region Fields |
232 | 232 | ||
233 | string solutionVersion = "9.00"; | 233 | string solutionVersion = "9.00"; |
234 | string productVersion = "8.0.50727"; | 234 | string productVersion = "8.0.50727"; |
235 | string schemaVersion = "2.0"; | 235 | string schemaVersion = "2.0"; |
236 | string versionName = "Visual C# 2005"; | 236 | string versionName = "Visual C# 2005"; |
237 | VSVersion version = VSVersion.VS80; | 237 | VSVersion version = VSVersion.VS80; |
238 | 238 | ||
239 | Hashtable tools; | 239 | Hashtable tools; |
240 | Kernel kernel; | 240 | Kernel kernel; |
241 | 241 | ||
242 | /// <summary> | 242 | /// <summary> |
243 | /// Gets or sets the solution version. | 243 | /// Gets or sets the solution version. |
244 | /// </summary> | 244 | /// </summary> |
245 | /// <value>The solution version.</value> | 245 | /// <value>The solution version.</value> |
246 | protected string SolutionVersion | 246 | protected string SolutionVersion |
247 | { | 247 | { |
248 | get | 248 | get |
249 | { | 249 | { |
250 | return this.solutionVersion; | 250 | return this.solutionVersion; |
251 | } | 251 | } |
252 | set | 252 | set |
253 | { | 253 | { |
254 | this.solutionVersion = value; | 254 | this.solutionVersion = value; |
255 | } | 255 | } |
256 | } | 256 | } |
257 | /// <summary> | 257 | /// <summary> |
258 | /// Gets or sets the product version. | 258 | /// Gets or sets the product version. |
259 | /// </summary> | 259 | /// </summary> |
260 | /// <value>The product version.</value> | 260 | /// <value>The product version.</value> |
261 | protected string ProductVersion | 261 | protected string ProductVersion |
262 | { | 262 | { |
263 | get | 263 | get |
264 | { | 264 | { |
265 | return this.productVersion; | 265 | return this.productVersion; |
266 | } | 266 | } |
267 | set | 267 | set |
268 | { | 268 | { |
269 | this.productVersion = value; | 269 | this.productVersion = value; |
270 | } | 270 | } |
271 | } | 271 | } |
272 | /// <summary> | 272 | /// <summary> |
273 | /// Gets or sets the schema version. | 273 | /// Gets or sets the schema version. |
274 | /// </summary> | 274 | /// </summary> |
275 | /// <value>The schema version.</value> | 275 | /// <value>The schema version.</value> |
276 | protected string SchemaVersion | 276 | protected string SchemaVersion |
277 | { | 277 | { |
278 | get | 278 | get |
279 | { | 279 | { |
280 | return this.schemaVersion; | 280 | return this.schemaVersion; |
281 | } | 281 | } |
282 | set | 282 | set |
283 | { | 283 | { |
284 | this.schemaVersion = value; | 284 | this.schemaVersion = value; |
285 | } | 285 | } |
286 | } | 286 | } |
287 | /// <summary> | 287 | /// <summary> |
288 | /// Gets or sets the name of the version. | 288 | /// Gets or sets the name of the version. |
289 | /// </summary> | 289 | /// </summary> |
290 | /// <value>The name of the version.</value> | 290 | /// <value>The name of the version.</value> |
291 | protected string VersionName | 291 | protected string VersionName |
292 | { | 292 | { |
293 | get | 293 | get |
294 | { | 294 | { |
295 | return this.versionName; | 295 | return this.versionName; |
296 | } | 296 | } |
297 | set | 297 | set |
298 | { | 298 | { |
299 | this.versionName = value; | 299 | this.versionName = value; |
300 | } | 300 | } |
301 | } | 301 | } |
302 | /// <summary> | 302 | /// <summary> |
303 | /// Gets or sets the version. | 303 | /// Gets or sets the version. |
304 | /// </summary> | 304 | /// </summary> |
305 | /// <value>The version.</value> | 305 | /// <value>The version.</value> |
306 | protected VSVersion Version | 306 | protected VSVersion Version |
307 | { | 307 | { |
308 | get | 308 | get |
309 | { | 309 | { |
310 | return this.version; | 310 | return this.version; |
311 | } | 311 | } |
312 | set | 312 | set |
313 | { | 313 | { |
314 | this.version = value; | 314 | this.version = value; |
315 | } | 315 | } |
316 | } | 316 | } |
317 | 317 | ||
318 | #endregion | 318 | #endregion |
319 | 319 | ||
320 | #region Constructors | 320 | #region Constructors |
321 | 321 | ||
322 | /// <summary> | 322 | /// <summary> |
323 | /// Initializes a new instance of the <see cref="VS2005Target"/> class. | 323 | /// Initializes a new instance of the <see cref="VS2005Target"/> class. |
324 | /// </summary> | 324 | /// </summary> |
325 | public VS2005Target() | 325 | public VS2005Target() |
326 | { | 326 | { |
327 | this.tools = new Hashtable(); | 327 | this.tools = new Hashtable(); |
328 | 328 | ||
329 | this.tools["C#"] = new ToolInfo("C#", "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}", "csproj", "CSHARP", "$(MSBuildBinPath)\\Microsoft.CSHARP.Targets"); | 329 | this.tools["C#"] = new ToolInfo("C#", "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}", "csproj", "CSHARP", "$(MSBuildBinPath)\\Microsoft.CSHARP.Targets"); |
330 | this.tools["Boo"] = new ToolInfo("Boo", "{45CEA7DC-C2ED-48A6-ACE0-E16144C02365}", "booproj", "Boo", "$(BooBinPath)\\Boo.Microsoft.Build.targets"); | 330 | this.tools["Boo"] = new ToolInfo("Boo", "{45CEA7DC-C2ED-48A6-ACE0-E16144C02365}", "booproj", "Boo", "$(BooBinPath)\\Boo.Microsoft.Build.targets"); |
331 | this.tools["VisualBasic"] = new ToolInfo("VisualBasic", "{F184B08F-C81C-45F6-A57F-5ABD9991F28F}", "vbproj", "VisualBasic", "$(MSBuildBinPath)\\Microsoft.VisualBasic.Targets"); | 331 | this.tools["VisualBasic"] = new ToolInfo("VisualBasic", "{F184B08F-C81C-45F6-A57F-5ABD9991F28F}", "vbproj", "VisualBasic", "$(MSBuildBinPath)\\Microsoft.VisualBasic.Targets"); |
332 | } | 332 | } |
333 | 333 | ||
334 | #endregion | 334 | #endregion |
335 | 335 | ||
336 | #region Private Methods | 336 | #region Private Methods |
337 | 337 | ||
338 | private string MakeRefPath(ProjectNode project) | 338 | private string MakeRefPath(ProjectNode project) |
339 | { | 339 | { |
340 | string ret = ""; | 340 | string ret = ""; |
341 | foreach (ReferencePathNode node in project.ReferencePaths) | 341 | foreach (ReferencePathNode node in project.ReferencePaths) |
342 | { | 342 | { |
343 | try | 343 | try |
344 | { | 344 | { |
345 | string fullPath = Helper.ResolvePath(node.Path); | 345 | string fullPath = Helper.ResolvePath(node.Path); |
346 | if (ret.Length < 1) | 346 | if (ret.Length < 1) |
347 | { | 347 | { |
348 | ret = fullPath; | 348 | ret = fullPath; |
349 | } | 349 | } |
350 | else | 350 | else |
351 | { | 351 | { |
352 | ret += ";" + fullPath; | 352 | ret += ";" + fullPath; |
353 | } | 353 | } |
354 | } | 354 | } |
355 | catch (ArgumentException) | 355 | catch (ArgumentException) |
356 | { | 356 | { |
357 | this.kernel.Log.Write(LogType.Warning, "Could not resolve reference path: {0}", node.Path); | 357 | this.kernel.Log.Write(LogType.Warning, "Could not resolve reference path: {0}", node.Path); |
358 | } | 358 | } |
359 | } | 359 | } |
360 | 360 | ||
361 | return ret; | 361 | return ret; |
362 | } | 362 | } |
363 | 363 | ||
364 | private void WriteProject(SolutionNode solution, ProjectNode project) | 364 | private void WriteProject(SolutionNode solution, ProjectNode project) |
365 | { | 365 | { |
366 | if (!tools.ContainsKey(project.Language)) | 366 | if (!tools.ContainsKey(project.Language)) |
367 | { | 367 | { |
368 | throw new UnknownLanguageException("Unknown .NET language: " + project.Language); | 368 | throw new UnknownLanguageException("Unknown .NET language: " + project.Language); |
369 | } | 369 | } |
370 | 370 | ||
371 | ToolInfo toolInfo = (ToolInfo)tools[project.Language]; | 371 | ToolInfo toolInfo = (ToolInfo)tools[project.Language]; |
372 | string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, toolInfo.FileExtension); | 372 | string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, toolInfo.FileExtension); |
373 | StreamWriter ps = new StreamWriter(projectFile); | 373 | StreamWriter ps = new StreamWriter(projectFile); |
374 | 374 | ||
375 | kernel.CurrentWorkingDirectory.Push(); | 375 | kernel.CurrentWorkingDirectory.Push(); |
376 | Helper.SetCurrentDir(Path.GetDirectoryName(projectFile)); | 376 | Helper.SetCurrentDir(Path.GetDirectoryName(projectFile)); |
377 | 377 | ||
378 | #region Project File | 378 | #region Project File |
379 | using (ps) | 379 | using (ps) |
380 | { | 380 | { |
381 | ps.WriteLine("<Project DefaultTargets=\"Build\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">"); | 381 | ps.WriteLine("<Project DefaultTargets=\"Build\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">"); |
382 | //ps.WriteLine(" <{0}", toolInfo.XMLTag); | 382 | //ps.WriteLine(" <{0}", toolInfo.XMLTag); |
383 | ps.WriteLine(" <PropertyGroup>"); | 383 | ps.WriteLine(" <PropertyGroup>"); |
384 | ps.WriteLine(" <ProjectType>Local</ProjectType>"); | 384 | ps.WriteLine(" <ProjectType>Local</ProjectType>"); |
385 | ps.WriteLine(" <ProductVersion>{0}</ProductVersion>", this.ProductVersion); | 385 | ps.WriteLine(" <ProductVersion>{0}</ProductVersion>", this.ProductVersion); |
386 | ps.WriteLine(" <SchemaVersion>{0}</SchemaVersion>", this.SchemaVersion); | 386 | ps.WriteLine(" <SchemaVersion>{0}</SchemaVersion>", this.SchemaVersion); |
387 | ps.WriteLine(" <ProjectGuid>{{{0}}}</ProjectGuid>", project.Guid.ToString().ToUpper()); | 387 | ps.WriteLine(" <ProjectGuid>{{{0}}}</ProjectGuid>", project.Guid.ToString().ToUpper()); |
388 | 388 | ||
389 | ps.WriteLine(" <Configuration Condition=\" '$(Configuration)' == '' \">Debug</Configuration>"); | 389 | ps.WriteLine(" <Configuration Condition=\" '$(Configuration)' == '' \">Debug</Configuration>"); |
390 | ps.WriteLine(" <Platform Condition=\" '$(Platform)' == '' \">AnyCPU</Platform>"); | 390 | ps.WriteLine(" <Platform Condition=\" '$(Platform)' == '' \">AnyCPU</Platform>"); |
391 | //ps.WriteLine(" <Build>"); | 391 | //ps.WriteLine(" <Build>"); |
392 | 392 | ||
393 | //ps.WriteLine(" <Settings"); | 393 | //ps.WriteLine(" <Settings"); |
394 | ps.WriteLine(" <ApplicationIcon>{0}</ApplicationIcon>", project.AppIcon); | 394 | ps.WriteLine(" <ApplicationIcon>{0}</ApplicationIcon>", project.AppIcon); |
395 | ps.WriteLine(" <AssemblyKeyContainerName>"); | 395 | ps.WriteLine(" <AssemblyKeyContainerName>"); |
396 | ps.WriteLine(" </AssemblyKeyContainerName>"); | 396 | ps.WriteLine(" </AssemblyKeyContainerName>"); |
397 | ps.WriteLine(" <AssemblyName>{0}</AssemblyName>", project.AssemblyName); | 397 | ps.WriteLine(" <AssemblyName>{0}</AssemblyName>", project.AssemblyName); |
398 | foreach (ConfigurationNode conf in project.Configurations) | 398 | foreach (ConfigurationNode conf in project.Configurations) |
399 | { | 399 | { |
400 | if (conf.Options.KeyFile != "") | 400 | if (conf.Options.KeyFile != "") |
401 | { | 401 | { |
402 | ps.WriteLine(" <AssemblyOriginatorKeyFile>{0}</AssemblyOriginatorKeyFile>", conf.Options.KeyFile); | 402 | ps.WriteLine(" <AssemblyOriginatorKeyFile>{0}</AssemblyOriginatorKeyFile>", conf.Options.KeyFile); |
403 | ps.WriteLine(" <SignAssembly>true</SignAssembly>"); | 403 | ps.WriteLine(" <SignAssembly>true</SignAssembly>"); |
404 | break; | 404 | break; |
405 | } | 405 | } |
406 | } | 406 | } |
407 | ps.WriteLine(" <DefaultClientScript>JScript</DefaultClientScript>"); | 407 | ps.WriteLine(" <DefaultClientScript>JScript</DefaultClientScript>"); |
408 | ps.WriteLine(" <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>"); | 408 | ps.WriteLine(" <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>"); |
409 | ps.WriteLine(" <DefaultTargetSchema>IE50</DefaultTargetSchema>"); | 409 | ps.WriteLine(" <DefaultTargetSchema>IE50</DefaultTargetSchema>"); |
410 | ps.WriteLine(" <DelaySign>false</DelaySign>"); | 410 | ps.WriteLine(" <DelaySign>false</DelaySign>"); |
411 | 411 | ||
412 | //if(m_Version == VSVersion.VS70) | 412 | //if(m_Version == VSVersion.VS70) |
413 | // ps.WriteLine(" NoStandardLibraries = \"false\""); | 413 | // ps.WriteLine(" NoStandardLibraries = \"false\""); |
414 | 414 | ||
415 | ps.WriteLine(" <OutputType>{0}</OutputType>", project.Type.ToString()); | 415 | ps.WriteLine(" <OutputType>{0}</OutputType>", project.Type.ToString()); |
416 | ps.WriteLine(" <AppDesignerFolder>{0}</AppDesignerFolder>", project.DesignerFolder); | 416 | ps.WriteLine(" <AppDesignerFolder>{0}</AppDesignerFolder>", project.DesignerFolder); |
417 | ps.WriteLine(" <RootNamespace>{0}</RootNamespace>", project.RootNamespace); | 417 | ps.WriteLine(" <RootNamespace>{0}</RootNamespace>", project.RootNamespace); |
418 | ps.WriteLine(" <StartupObject>{0}</StartupObject>", project.StartupObject); | 418 | ps.WriteLine(" <StartupObject>{0}</StartupObject>", project.StartupObject); |
419 | //ps.WriteLine(" >"); | 419 | //ps.WriteLine(" >"); |
420 | ps.WriteLine(" <FileUpgradeFlags>"); | 420 | ps.WriteLine(" <FileUpgradeFlags>"); |
421 | ps.WriteLine(" </FileUpgradeFlags>"); | 421 | ps.WriteLine(" </FileUpgradeFlags>"); |
422 | 422 | ||
423 | ps.WriteLine(" </PropertyGroup>"); | 423 | ps.WriteLine(" </PropertyGroup>"); |
424 | 424 | ||
425 | foreach (ConfigurationNode conf in project.Configurations) | 425 | foreach (ConfigurationNode conf in project.Configurations) |
426 | { | 426 | { |
427 | ps.Write(" <PropertyGroup "); | 427 | ps.Write(" <PropertyGroup "); |
428 | ps.WriteLine("Condition=\" '$(Configuration)|$(Platform)' == '{0}|AnyCPU' \">", conf.Name); | 428 | ps.WriteLine("Condition=\" '$(Configuration)|$(Platform)' == '{0}|AnyCPU' \">", conf.Name); |
429 | ps.WriteLine(" <AllowUnsafeBlocks>{0}</AllowUnsafeBlocks>", conf.Options["AllowUnsafe"]); | 429 | ps.WriteLine(" <AllowUnsafeBlocks>{0}</AllowUnsafeBlocks>", conf.Options["AllowUnsafe"]); |
430 | ps.WriteLine(" <BaseAddress>{0}</BaseAddress>", conf.Options["BaseAddress"]); | 430 | ps.WriteLine(" <BaseAddress>{0}</BaseAddress>", conf.Options["BaseAddress"]); |
431 | ps.WriteLine(" <CheckForOverflowUnderflow>{0}</CheckForOverflowUnderflow>", conf.Options["CheckUnderflowOverflow"]); | 431 | ps.WriteLine(" <CheckForOverflowUnderflow>{0}</CheckForOverflowUnderflow>", conf.Options["CheckUnderflowOverflow"]); |
432 | ps.WriteLine(" <ConfigurationOverrideFile>"); | 432 | ps.WriteLine(" <ConfigurationOverrideFile>"); |
433 | ps.WriteLine(" </ConfigurationOverrideFile>"); | 433 | ps.WriteLine(" </ConfigurationOverrideFile>"); |
434 | ps.WriteLine(" <DefineConstants>{0}</DefineConstants>", conf.Options["CompilerDefines"]); | 434 | ps.WriteLine(" <DefineConstants>{0}</DefineConstants>", conf.Options["CompilerDefines"]); |
435 | ps.WriteLine(" <DocumentationFile>{0}</DocumentationFile>", conf.Options["XmlDocFile"]); | 435 | ps.WriteLine(" <DocumentationFile>{0}</DocumentationFile>", conf.Options["XmlDocFile"]); |
436 | ps.WriteLine(" <DebugSymbols>{0}</DebugSymbols>", conf.Options["DebugInformation"]); | 436 | ps.WriteLine(" <DebugSymbols>{0}</DebugSymbols>", conf.Options["DebugInformation"]); |
437 | ps.WriteLine(" <FileAlignment>{0}</FileAlignment>", conf.Options["FileAlignment"]); | 437 | ps.WriteLine(" <FileAlignment>{0}</FileAlignment>", conf.Options["FileAlignment"]); |
438 | // ps.WriteLine(" <IncrementalBuild = \"{0}\"", conf.Options["IncrementalBuild"]); | 438 | // ps.WriteLine(" <IncrementalBuild = \"{0}\"", conf.Options["IncrementalBuild"]); |
439 | 439 | ||
440 | // if(m_Version == VSVersion.VS71) | 440 | // if(m_Version == VSVersion.VS71) |
441 | // { | 441 | // { |
442 | // ps.WriteLine(" NoStdLib = \"{0}\"", conf.Options["NoStdLib"]); | 442 | // ps.WriteLine(" NoStdLib = \"{0}\"", conf.Options["NoStdLib"]); |
443 | // ps.WriteLine(" NoWarn = \"{0}\"", conf.Options["SuppressWarnings"]); | 443 | // ps.WriteLine(" NoWarn = \"{0}\"", conf.Options["SuppressWarnings"]); |
444 | // } | 444 | // } |
445 | 445 | ||
446 | ps.WriteLine(" <Optimize>{0}</Optimize>", conf.Options["OptimizeCode"]); | 446 | ps.WriteLine(" <Optimize>{0}</Optimize>", conf.Options["OptimizeCode"]); |
447 | ps.WriteLine(" <OutputPath>{0}</OutputPath>", | 447 | ps.WriteLine(" <OutputPath>{0}</OutputPath>", |
448 | Helper.EndPath(Helper.NormalizePath(conf.Options["OutputPath"].ToString()))); | 448 | Helper.EndPath(Helper.NormalizePath(conf.Options["OutputPath"].ToString()))); |
449 | ps.WriteLine(" <RegisterForComInterop>{0}</RegisterForComInterop>", conf.Options["RegisterComInterop"]); | 449 | ps.WriteLine(" <RegisterForComInterop>{0}</RegisterForComInterop>", conf.Options["RegisterComInterop"]); |
450 | ps.WriteLine(" <RemoveIntegerChecks>{0}</RemoveIntegerChecks>", conf.Options["RemoveIntegerChecks"]); | 450 | ps.WriteLine(" <RemoveIntegerChecks>{0}</RemoveIntegerChecks>", conf.Options["RemoveIntegerChecks"]); |
451 | ps.WriteLine(" <TreatWarningsAsErrors>{0}</TreatWarningsAsErrors>", conf.Options["WarningsAsErrors"]); | 451 | ps.WriteLine(" <TreatWarningsAsErrors>{0}</TreatWarningsAsErrors>", conf.Options["WarningsAsErrors"]); |
452 | ps.WriteLine(" <WarningLevel>{0}</WarningLevel>", conf.Options["WarningLevel"]); | 452 | ps.WriteLine(" <WarningLevel>{0}</WarningLevel>", conf.Options["WarningLevel"]); |
453 | ps.WriteLine(" <NoWarn>{0}</NoWarn>", conf.Options["SuppressWarnings"]); | 453 | ps.WriteLine(" <NoWarn>{0}</NoWarn>", conf.Options["SuppressWarnings"]); |
454 | ps.WriteLine(" </PropertyGroup>"); | 454 | ps.WriteLine(" </PropertyGroup>"); |
455 | } | 455 | } |
456 | 456 | ||
457 | //ps.WriteLine(" </Settings>"); | 457 | //ps.WriteLine(" </Settings>"); |
458 | 458 | ||
459 | // Assembly References | 459 | // Assembly References |
460 | ps.WriteLine(" <ItemGroup>"); | 460 | ps.WriteLine(" <ItemGroup>"); |
461 | string refPath = ((ReferencePathNode) project.ReferencePaths[0]).Path; | 461 | string refPath = ((ReferencePathNode) project.ReferencePaths[0]).Path; |
462 | 462 | ||
463 | foreach (ReferenceNode refr in project.References) | 463 | foreach (ReferenceNode refr in project.References) |
464 | { | 464 | { |
465 | if (!solution.ProjectsTable.ContainsKey(refr.Name)) | 465 | if (!solution.ProjectsTable.ContainsKey(refr.Name)) |
466 | { | 466 | { |
467 | ps.Write(" <Reference"); | 467 | ps.Write(" <Reference"); |
468 | ps.Write(" Include=\""); | 468 | ps.Write(" Include=\""); |
469 | ps.Write(refr.Name); | 469 | ps.Write(refr.Name); |
470 | 470 | ||
471 | ps.WriteLine("\" >"); | 471 | ps.WriteLine("\" >"); |
472 | 472 | ||
473 | string path; | 473 | string path; |
474 | 474 | ||
475 | if( refr.Name.EndsWith(".dll", StringComparison.InvariantCultureIgnoreCase )) | 475 | if( refr.Name.EndsWith(".dll", StringComparison.InvariantCultureIgnoreCase )) |
476 | { | 476 | { |
477 | path = Helper.NormalizePath(Path.Combine( refPath, refr.Name), '\\'); | 477 | path = Helper.NormalizePath(Path.Combine( refPath, refr.Name), '\\'); |
478 | } | 478 | } |
479 | else | 479 | else |
480 | { | 480 | { |
481 | path = refr.Name + ".dll"; | 481 | path = refr.Name + ".dll"; |
482 | } | 482 | } |
483 | 483 | ||
484 | // TODO: Allow reference to *.exe files | 484 | // TODO: Allow reference to *.exe files |
485 | ps.WriteLine(" <HintPath>{0}</HintPath>", path ); | 485 | ps.WriteLine(" <HintPath>{0}</HintPath>", path ); |
486 | ps.WriteLine(" <Private>{0}</Private>", refr.LocalCopy); | 486 | ps.WriteLine(" <Private>{0}</Private>", refr.LocalCopy); |
487 | ps.WriteLine(" </Reference>"); | 487 | ps.WriteLine(" </Reference>"); |
488 | } | 488 | } |
489 | } | 489 | } |
490 | ps.WriteLine(" </ItemGroup>"); | 490 | ps.WriteLine(" </ItemGroup>"); |
491 | 491 | ||
492 | //Project References | 492 | //Project References |
493 | ps.WriteLine(" <ItemGroup>"); | 493 | ps.WriteLine(" <ItemGroup>"); |
494 | foreach (ReferenceNode refr in project.References) | 494 | foreach (ReferenceNode refr in project.References) |
495 | { | 495 | { |
496 | if (solution.ProjectsTable.ContainsKey(refr.Name)) | 496 | if (solution.ProjectsTable.ContainsKey(refr.Name)) |
497 | { | 497 | { |
498 | ProjectNode refProject = (ProjectNode)solution.ProjectsTable[refr.Name]; | 498 | ProjectNode refProject = (ProjectNode)solution.ProjectsTable[refr.Name]; |
499 | // TODO: Allow reference to visual basic projects | 499 | // TODO: Allow reference to visual basic projects |
500 | string path = | 500 | string path = |
501 | Helper.MakePathRelativeTo(project.FullPath, | 501 | Helper.MakePathRelativeTo(project.FullPath, |
502 | Helper.MakeFilePath(refProject.FullPath, refProject.Name, "csproj")); | 502 | Helper.MakeFilePath(refProject.FullPath, refProject.Name, "csproj")); |
503 | ps.WriteLine(" <ProjectReference Include=\"{0}\">", path ); | 503 | ps.WriteLine(" <ProjectReference Include=\"{0}\">", path ); |
504 | //<ProjectReference Include="..\..\RealmForge\Utility\RealmForge.Utility.csproj"> | 504 | //<ProjectReference Include="..\..\RealmForge\Utility\RealmForge.Utility.csproj"> |
505 | ps.WriteLine(" <Name>{0}</Name>", refProject.Name); | 505 | ps.WriteLine(" <Name>{0}</Name>", refProject.Name); |
506 | // <Name>RealmForge.Utility</Name> | 506 | // <Name>RealmForge.Utility</Name> |
507 | ps.WriteLine(" <Project>{{{0}}}</Project>", refProject.Guid.ToString().ToUpper()); | 507 | ps.WriteLine(" <Project>{{{0}}}</Project>", refProject.Guid.ToString().ToUpper()); |
508 | // <Project>{6880D1D3-69EE-461B-B841-5319845B20D3}</Project> | 508 | // <Project>{6880D1D3-69EE-461B-B841-5319845B20D3}</Project> |
509 | ps.WriteLine(" <Package>{0}</Package>", toolInfo.Guid.ToString().ToUpper()); | 509 | ps.WriteLine(" <Package>{0}</Package>", toolInfo.Guid.ToString().ToUpper()); |
510 | // <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> | 510 | // <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> |
511 | ps.WriteLine("\t\t\t<Private>{0}</Private>", refr.LocalCopy); | 511 | ps.WriteLine("\t\t\t<Private>{0}</Private>", refr.LocalCopy); |
512 | ps.WriteLine(" </ProjectReference>"); | 512 | ps.WriteLine(" </ProjectReference>"); |
513 | //</ProjectReference> | 513 | //</ProjectReference> |
514 | } | 514 | } |
515 | else | 515 | else |
516 | { | 516 | { |
517 | } | 517 | } |
518 | } | 518 | } |
519 | ps.WriteLine(" </ItemGroup>"); | 519 | ps.WriteLine(" </ItemGroup>"); |
520 | 520 | ||
521 | // ps.WriteLine(" </Build>"); | 521 | // ps.WriteLine(" </Build>"); |
522 | ps.WriteLine(" <ItemGroup>"); | 522 | ps.WriteLine(" <ItemGroup>"); |
523 | 523 | ||
524 | // ps.WriteLine(" <Include>"); | 524 | // ps.WriteLine(" <Include>"); |
525 | ArrayList list = new ArrayList(); | 525 | ArrayList list = new ArrayList(); |
526 | foreach (string file in project.Files) | 526 | foreach (string file in project.Files) |
527 | { | 527 | { |
528 | // if (file == "Properties\\Bind.Designer.cs") | 528 | // if (file == "Properties\\Bind.Designer.cs") |
529 | // { | 529 | // { |
530 | // Console.WriteLine("Wait a minute!"); | 530 | // Console.WriteLine("Wait a minute!"); |
531 | // Console.WriteLine(project.Files.GetSubType(file).ToString()); | 531 | // Console.WriteLine(project.Files.GetSubType(file).ToString()); |
532 | // } | 532 | // } |
533 | 533 | ||
534 | if (project.Files.GetSubType(file) != SubType.Code && project.Files.GetSubType(file) != SubType.Settings && project.Files.GetSubType(file) != SubType.Designer) | 534 | if (project.Files.GetSubType(file) != SubType.Code && project.Files.GetSubType(file) != SubType.Settings && project.Files.GetSubType(file) != SubType.Designer) |
535 | { | 535 | { |
536 | ps.WriteLine(" <EmbeddedResource Include=\"{0}\">", file.Substring(0, file.LastIndexOf('.')) + ".resx"); | 536 | ps.WriteLine(" <EmbeddedResource Include=\"{0}\">", file.Substring(0, file.LastIndexOf('.')) + ".resx"); |
537 | 537 | ||
538 | int slash = file.LastIndexOf('\\'); | 538 | int slash = file.LastIndexOf('\\'); |
539 | if (slash == -1) | 539 | if (slash == -1) |
540 | { | 540 | { |
541 | ps.WriteLine(" <DependentUpon>{0}</DependentUpon>", file); | 541 | ps.WriteLine(" <DependentUpon>{0}</DependentUpon>", file); |
542 | } | 542 | } |
543 | else | 543 | else |
544 | { | 544 | { |
545 | ps.WriteLine(" <DependentUpon>{0}</DependentUpon>", file.Substring(slash + 1, file.Length - slash - 1)); | 545 | ps.WriteLine(" <DependentUpon>{0}</DependentUpon>", file.Substring(slash + 1, file.Length - slash - 1)); |
546 | } | 546 | } |
547 | ps.WriteLine(" <SubType>Designer</SubType>"); | 547 | ps.WriteLine(" <SubType>Designer</SubType>"); |
548 | ps.WriteLine(" </EmbeddedResource>"); | 548 | ps.WriteLine(" </EmbeddedResource>"); |
549 | // | 549 | // |
550 | } | 550 | } |
551 | 551 | ||
552 | if (project.Files.GetSubType(file) != SubType.Code && project.Files.GetSubType(file) == SubType.Designer) | 552 | if (project.Files.GetSubType(file) != SubType.Code && project.Files.GetSubType(file) == SubType.Designer) |
553 | { | 553 | { |
554 | ps.WriteLine(" <EmbeddedResource Include=\"{0}\">", file.Substring(0, file.LastIndexOf('.')) + ".resx"); | 554 | ps.WriteLine(" <EmbeddedResource Include=\"{0}\">", file.Substring(0, file.LastIndexOf('.')) + ".resx"); |
555 | ps.WriteLine(" <SubType>" + project.Files.GetSubType(file) + "</SubType>"); | 555 | ps.WriteLine(" <SubType>" + project.Files.GetSubType(file) + "</SubType>"); |
556 | ps.WriteLine(" <Generator>ResXFileCodeGenerator</Generator>"); | 556 | ps.WriteLine(" <Generator>ResXFileCodeGenerator</Generator>"); |
557 | ps.WriteLine(" <LastGenOutput>Resources.Designer.cs</LastGenOutput>"); | 557 | ps.WriteLine(" <LastGenOutput>Resources.Designer.cs</LastGenOutput>"); |
558 | ps.WriteLine(" </EmbeddedResource>"); | 558 | ps.WriteLine(" </EmbeddedResource>"); |
559 | ps.WriteLine(" <Compile Include=\"{0}\">", file.Substring(0, file.LastIndexOf('.')) + ".Designer.cs"); | 559 | ps.WriteLine(" <Compile Include=\"{0}\">", file.Substring(0, file.LastIndexOf('.')) + ".Designer.cs"); |
560 | ps.WriteLine(" <AutoGen>True</AutoGen>"); | 560 | ps.WriteLine(" <AutoGen>True</AutoGen>"); |
561 | ps.WriteLine(" <DesignTime>True</DesignTime>"); | 561 | ps.WriteLine(" <DesignTime>True</DesignTime>"); |
562 | ps.WriteLine(" <DependentUpon>Resources.resx</DependentUpon>"); | 562 | ps.WriteLine(" <DependentUpon>Resources.resx</DependentUpon>"); |
563 | ps.WriteLine(" </Compile>"); | 563 | ps.WriteLine(" </Compile>"); |
564 | list.Add(file.Substring(0, file.LastIndexOf('.')) + ".Designer.cs"); | 564 | list.Add(file.Substring(0, file.LastIndexOf('.')) + ".Designer.cs"); |
565 | } | 565 | } |
566 | if (project.Files.GetSubType(file).ToString() == "Settings") | 566 | if (project.Files.GetSubType(file).ToString() == "Settings") |
567 | { | 567 | { |
568 | //Console.WriteLine("File: " + file); | 568 | //Console.WriteLine("File: " + file); |
569 | //Console.WriteLine("Last index: " + file.LastIndexOf('.')); | 569 | //Console.WriteLine("Last index: " + file.LastIndexOf('.')); |
570 | //Console.WriteLine("Length: " + file.Length); | 570 | //Console.WriteLine("Length: " + file.Length); |
571 | ps.Write(" <{0} ", project.Files.GetBuildAction(file)); | 571 | ps.Write(" <{0} ", project.Files.GetBuildAction(file)); |
572 | ps.WriteLine("Include=\"{0}\">", file); | 572 | ps.WriteLine("Include=\"{0}\">", file); |
573 | int slash = file.LastIndexOf('\\'); | 573 | int slash = file.LastIndexOf('\\'); |
574 | string fileName = file.Substring(slash + 1, file.Length - slash - 1); | 574 | string fileName = file.Substring(slash + 1, file.Length - slash - 1); |
575 | if (project.Files.GetBuildAction(file) == BuildAction.None) | 575 | if (project.Files.GetBuildAction(file) == BuildAction.None) |
576 | { | 576 | { |
577 | ps.WriteLine(" <Generator>SettingsSingleFileGenerator</Generator>"); | 577 | ps.WriteLine(" <Generator>SettingsSingleFileGenerator</Generator>"); |
578 | 578 | ||
579 | //Console.WriteLine("FileName: " + fileName); | 579 | //Console.WriteLine("FileName: " + fileName); |
580 | //Console.WriteLine("FileNameMain: " + fileName.Substring(0, fileName.LastIndexOf('.'))); | 580 | //Console.WriteLine("FileNameMain: " + fileName.Substring(0, fileName.LastIndexOf('.'))); |
581 | //Console.WriteLine("FileNameExt: " + fileName.Substring(fileName.LastIndexOf('.'), fileName.Length - fileName.LastIndexOf('.'))); | 581 | //Console.WriteLine("FileNameExt: " + fileName.Substring(fileName.LastIndexOf('.'), fileName.Length - fileName.LastIndexOf('.'))); |
582 | if (slash == -1) | 582 | if (slash == -1) |
583 | { | 583 | { |
584 | ps.WriteLine(" <LastGenOutput>{0}</LastGenOutput>", fileName.Substring(0, fileName.LastIndexOf('.')) + ".Designer.cs"); | 584 | ps.WriteLine(" <LastGenOutput>{0}</LastGenOutput>", fileName.Substring(0, fileName.LastIndexOf('.')) + ".Designer.cs"); |
585 | } | 585 | } |
586 | else | 586 | else |
587 | { | 587 | { |
588 | ps.WriteLine(" <LastGenOutput>{0}</LastGenOutput>", fileName.Substring(0, fileName.LastIndexOf('.')) + ".Designer.cs"); | 588 | ps.WriteLine(" <LastGenOutput>{0}</LastGenOutput>", fileName.Substring(0, fileName.LastIndexOf('.')) + ".Designer.cs"); |
589 | } | 589 | } |
590 | } | 590 | } |
591 | else | 591 | else |
592 | { | 592 | { |
593 | ps.WriteLine(" <SubType>Code</SubType>"); | 593 | ps.WriteLine(" <SubType>Code</SubType>"); |
594 | ps.WriteLine(" <AutoGen>True</AutoGen>"); | 594 | ps.WriteLine(" <AutoGen>True</AutoGen>"); |
595 | ps.WriteLine(" <DesignTimeSharedInput>True</DesignTimeSharedInput>"); | 595 | ps.WriteLine(" <DesignTimeSharedInput>True</DesignTimeSharedInput>"); |
596 | string fileNameShort = fileName.Substring(0, fileName.LastIndexOf('.')); | 596 | string fileNameShort = fileName.Substring(0, fileName.LastIndexOf('.')); |
597 | string fileNameShorter = fileNameShort.Substring(0, fileNameShort.LastIndexOf('.')); | 597 | string fileNameShorter = fileNameShort.Substring(0, fileNameShort.LastIndexOf('.')); |
598 | ps.WriteLine(" <DependentUpon>{0}</DependentUpon>", fileNameShorter + ".settings"); | 598 | ps.WriteLine(" <DependentUpon>{0}</DependentUpon>", fileNameShorter + ".settings"); |
599 | } | 599 | } |
600 | ps.WriteLine(" </{0}>", project.Files.GetBuildAction(file)); | 600 | ps.WriteLine(" </{0}>", project.Files.GetBuildAction(file)); |
601 | } | 601 | } |
602 | else if (project.Files.GetSubType(file) != SubType.Designer) | 602 | else if (project.Files.GetSubType(file) != SubType.Designer) |
603 | { | 603 | { |
604 | if (!list.Contains(file)) | 604 | if (!list.Contains(file)) |
605 | { | 605 | { |
606 | ps.Write(" <{0} ", project.Files.GetBuildAction(file)); | 606 | ps.Write(" <{0} ", project.Files.GetBuildAction(file)); |
607 | ps.WriteLine("Include=\"{0}\">", file); | 607 | ps.WriteLine("Include=\"{0}\">", file); |
608 | 608 | ||
609 | 609 | ||
610 | if (file.Contains("Designer.cs")) | 610 | if (file.Contains("Designer.cs")) |
611 | { | 611 | { |
612 | ps.WriteLine(" <DependentUpon>{0}</DependentUpon>", file.Substring(0, file.IndexOf(".Designer.cs")) + ".cs"); | 612 | ps.WriteLine(" <DependentUpon>{0}</DependentUpon>", file.Substring(0, file.IndexOf(".Designer.cs")) + ".cs"); |
613 | } | 613 | } |
614 | 614 | ||
615 | if (project.Files.GetIsLink(file)) | 615 | if (project.Files.GetIsLink(file)) |
616 | { | 616 | { |
617 | ps.WriteLine(" <Link>{0}</Link>", Path.GetFileName(file)); | 617 | ps.WriteLine(" <Link>{0}</Link>", Path.GetFileName(file)); |
618 | } | 618 | } |
619 | else if (project.Files.GetBuildAction(file) != BuildAction.None) | 619 | else if (project.Files.GetBuildAction(file) != BuildAction.None) |
620 | { | 620 | { |
621 | if (project.Files.GetBuildAction(file) != BuildAction.EmbeddedResource) | 621 | if (project.Files.GetBuildAction(file) != BuildAction.EmbeddedResource) |
622 | { | 622 | { |
623 | ps.WriteLine(" <SubType>{0}</SubType>", project.Files.GetSubType(file)); | 623 | ps.WriteLine(" <SubType>{0}</SubType>", project.Files.GetSubType(file)); |
624 | } | 624 | } |
625 | } | 625 | } |
626 | if (project.Files.GetCopyToOutput(file) != CopyToOutput.Never) | 626 | if (project.Files.GetCopyToOutput(file) != CopyToOutput.Never) |
627 | { | 627 | { |
628 | ps.WriteLine(" <CopyToOutputDirectory>{0}</CopyToOutputDirectory>", project.Files.GetCopyToOutput(file)); | 628 | ps.WriteLine(" <CopyToOutputDirectory>{0}</CopyToOutputDirectory>", project.Files.GetCopyToOutput(file)); |
629 | } | 629 | } |
630 | 630 | ||
631 | ps.WriteLine(" </{0}>", project.Files.GetBuildAction(file)); | 631 | ps.WriteLine(" </{0}>", project.Files.GetBuildAction(file)); |
632 | } | 632 | } |
633 | } | 633 | } |
634 | } | 634 | } |
635 | // ps.WriteLine(" </Include>"); | 635 | // ps.WriteLine(" </Include>"); |
636 | 636 | ||
637 | ps.WriteLine(" </ItemGroup>"); | 637 | ps.WriteLine(" </ItemGroup>"); |
638 | ps.WriteLine(" <Import Project=\"" + toolInfo.ImportProject + "\" />"); | 638 | ps.WriteLine(" <Import Project=\"" + toolInfo.ImportProject + "\" />"); |
639 | ps.WriteLine(" <PropertyGroup>"); | 639 | ps.WriteLine(" <PropertyGroup>"); |
640 | ps.WriteLine(" <PreBuildEvent>"); | 640 | ps.WriteLine(" <PreBuildEvent>"); |
641 | ps.WriteLine(" </PreBuildEvent>"); | 641 | ps.WriteLine(" </PreBuildEvent>"); |
642 | ps.WriteLine(" <PostBuildEvent>"); | 642 | ps.WriteLine(" <PostBuildEvent>"); |
643 | ps.WriteLine(" </PostBuildEvent>"); | 643 | ps.WriteLine(" </PostBuildEvent>"); |
644 | ps.WriteLine(" </PropertyGroup>"); | 644 | ps.WriteLine(" </PropertyGroup>"); |
645 | // ps.WriteLine(" </{0}>", toolInfo.XMLTag); | 645 | // ps.WriteLine(" </{0}>", toolInfo.XMLTag); |
646 | ps.WriteLine("</Project>"); | 646 | ps.WriteLine("</Project>"); |
647 | } | 647 | } |
648 | #endregion | 648 | #endregion |
649 | 649 | ||
650 | #region User File | 650 | #region User File |
651 | 651 | ||
652 | ps = new StreamWriter(projectFile + ".user"); | 652 | ps = new StreamWriter(projectFile + ".user"); |
653 | using (ps) | 653 | using (ps) |
654 | { | 654 | { |
655 | ps.WriteLine("<Project xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">"); | 655 | ps.WriteLine("<Project xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">"); |
656 | //ps.WriteLine( "<VisualStudioProject>" ); | 656 | //ps.WriteLine( "<VisualStudioProject>" ); |
657 | //ps.WriteLine(" <{0}>", toolInfo.XMLTag); | 657 | //ps.WriteLine(" <{0}>", toolInfo.XMLTag); |
658 | //ps.WriteLine(" <Build>"); | 658 | //ps.WriteLine(" <Build>"); |
659 | ps.WriteLine(" <PropertyGroup>"); | 659 | ps.WriteLine(" <PropertyGroup>"); |
660 | //ps.WriteLine(" <Settings ReferencePath=\"{0}\">", MakeRefPath(project)); | 660 | //ps.WriteLine(" <Settings ReferencePath=\"{0}\">", MakeRefPath(project)); |
661 | 661 | ||
662 | 662 | ||
663 | ps.WriteLine(" <Configuration Condition=\" '$(Configuration)' == '' \">Debug</Configuration>"); | 663 | ps.WriteLine(" <Configuration Condition=\" '$(Configuration)' == '' \">Debug</Configuration>"); |
664 | ps.WriteLine(" <Platform Condition=\" '$(Platform)' == '' \">AnyCPU</Platform>"); | 664 | ps.WriteLine(" <Platform Condition=\" '$(Platform)' == '' \">AnyCPU</Platform>"); |
665 | 665 | ||
666 | if (projectFile.Contains( "OpenSim.csproj" )) | 666 | if (projectFile.Contains( "OpenSim.csproj" )) |
667 | { | 667 | { |
668 | ps.WriteLine(" <StartArguments>-loginserver -sandbox -accounts</StartArguments>"); | 668 | ps.WriteLine(" <StartArguments>-loginserver -sandbox -accounts</StartArguments>"); |
669 | } | 669 | } |
670 | 670 | ||
671 | ps.WriteLine(" <ReferencePath>{0}</ReferencePath>", MakeRefPath(project)); | 671 | ps.WriteLine(" <ReferencePath>{0}</ReferencePath>", MakeRefPath(project)); |
672 | ps.WriteLine(" <LastOpenVersion>{0}</LastOpenVersion>", this.ProductVersion); | 672 | ps.WriteLine(" <LastOpenVersion>{0}</LastOpenVersion>", this.ProductVersion); |
673 | ps.WriteLine(" <ProjectView>ProjectFiles</ProjectView>"); | 673 | ps.WriteLine(" <ProjectView>ProjectFiles</ProjectView>"); |
674 | ps.WriteLine(" <ProjectTrust>0</ProjectTrust>"); | 674 | ps.WriteLine(" <ProjectTrust>0</ProjectTrust>"); |
675 | ps.WriteLine(" </PropertyGroup>"); | 675 | ps.WriteLine(" </PropertyGroup>"); |
676 | foreach (ConfigurationNode conf in project.Configurations) | 676 | foreach (ConfigurationNode conf in project.Configurations) |
677 | { | 677 | { |
678 | ps.Write(" <PropertyGroup"); | 678 | ps.Write(" <PropertyGroup"); |
679 | ps.Write(" Condition = \" '$(Configuration)|$(Platform)' == '{0}|AnyCPU' \"", conf.Name); | 679 | ps.Write(" Condition = \" '$(Configuration)|$(Platform)' == '{0}|AnyCPU' \"", conf.Name); |
680 | ps.WriteLine(" />"); | 680 | ps.WriteLine(" />"); |
681 | } | 681 | } |
682 | 682 | ||
683 | ps.WriteLine("</Project>"); | 683 | ps.WriteLine("</Project>"); |
684 | } | 684 | } |
685 | #endregion | 685 | #endregion |
686 | 686 | ||
687 | kernel.CurrentWorkingDirectory.Pop(); | 687 | kernel.CurrentWorkingDirectory.Pop(); |
688 | } | 688 | } |
689 | 689 | ||
690 | private void WriteSolution(SolutionNode solution) | 690 | private void WriteSolution(SolutionNode solution) |
691 | { | 691 | { |
692 | kernel.Log.Write("Creating {0} solution and project files", this.VersionName); | 692 | kernel.Log.Write("Creating {0} solution and project files", this.VersionName); |
693 | 693 | ||
694 | foreach (ProjectNode project in solution.Projects) | 694 | foreach (ProjectNode project in solution.Projects) |
695 | { | 695 | { |
696 | kernel.Log.Write("...Creating project: {0}", project.Name); | 696 | kernel.Log.Write("...Creating project: {0}", project.Name); |
697 | WriteProject(solution, project); | 697 | WriteProject(solution, project); |
698 | } | 698 | } |
699 | 699 | ||
700 | kernel.Log.Write(""); | 700 | kernel.Log.Write(""); |
701 | string solutionFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "sln"); | 701 | string solutionFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "sln"); |
702 | StreamWriter ss = new StreamWriter(solutionFile); | 702 | StreamWriter ss = new StreamWriter(solutionFile); |
703 | 703 | ||
704 | kernel.CurrentWorkingDirectory.Push(); | 704 | kernel.CurrentWorkingDirectory.Push(); |
705 | Helper.SetCurrentDir(Path.GetDirectoryName(solutionFile)); | 705 | Helper.SetCurrentDir(Path.GetDirectoryName(solutionFile)); |
706 | 706 | ||
707 | using (ss) | 707 | using (ss) |
708 | { | 708 | { |
709 | ss.WriteLine("Microsoft Visual Studio Solution File, Format Version {0}", this.SolutionVersion); | 709 | ss.WriteLine("Microsoft Visual Studio Solution File, Format Version {0}", this.SolutionVersion); |
710 | ss.WriteLine("# Visual Studio 2005"); | 710 | ss.WriteLine("# Visual Studio 2005"); |
711 | foreach (ProjectNode project in solution.Projects) | 711 | foreach (ProjectNode project in solution.Projects) |
712 | { | 712 | { |
713 | if (!tools.ContainsKey(project.Language)) | 713 | if (!tools.ContainsKey(project.Language)) |
714 | { | 714 | { |
715 | throw new UnknownLanguageException("Unknown .NET language: " + project.Language); | 715 | throw new UnknownLanguageException("Unknown .NET language: " + project.Language); |
716 | } | 716 | } |
717 | 717 | ||
718 | ToolInfo toolInfo = (ToolInfo)tools[project.Language]; | 718 | ToolInfo toolInfo = (ToolInfo)tools[project.Language]; |
719 | 719 | ||
720 | string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath); | 720 | string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath); |
721 | ss.WriteLine("Project(\"{0}\") = \"{1}\", \"{2}\", \"{{{3}}}\"", | 721 | ss.WriteLine("Project(\"{0}\") = \"{1}\", \"{2}\", \"{{{3}}}\"", |
722 | toolInfo.Guid, project.Name, Helper.MakeFilePath(path, project.Name, | 722 | toolInfo.Guid, project.Name, Helper.MakeFilePath(path, project.Name, |
723 | toolInfo.FileExtension), project.Guid.ToString().ToUpper()); | 723 | toolInfo.FileExtension), project.Guid.ToString().ToUpper()); |
724 | 724 | ||
725 | //ss.WriteLine(" ProjectSection(ProjectDependencies) = postProject"); | 725 | //ss.WriteLine(" ProjectSection(ProjectDependencies) = postProject"); |
726 | //ss.WriteLine(" EndProjectSection"); | 726 | //ss.WriteLine(" EndProjectSection"); |
727 | 727 | ||
728 | ss.WriteLine("EndProject"); | 728 | ss.WriteLine("EndProject"); |
729 | } | 729 | } |
730 | 730 | ||
731 | if (solution.Files != null) | 731 | if (solution.Files != null) |
732 | { | 732 | { |
733 | ss.WriteLine("Project(\"{0}\") = \"Solution Items\", \"Solution Items\", \"{1}\"", "{2150E333-8FDC-42A3-9474-1A3956D46DE8}", "{468F1D07-AD17-4CC3-ABD0-2CA268E4E1A6}"); | 733 | ss.WriteLine("Project(\"{0}\") = \"Solution Items\", \"Solution Items\", \"{1}\"", "{2150E333-8FDC-42A3-9474-1A3956D46DE8}", "{468F1D07-AD17-4CC3-ABD0-2CA268E4E1A6}"); |
734 | ss.WriteLine("\tProjectSection(SolutionItems) = preProject"); | 734 | ss.WriteLine("\tProjectSection(SolutionItems) = preProject"); |
735 | foreach (string file in solution.Files) | 735 | foreach (string file in solution.Files) |
736 | ss.WriteLine("\t\t{0} = {0}", file); | 736 | ss.WriteLine("\t\t{0} = {0}", file); |
737 | ss.WriteLine("\tEndProjectSection"); | 737 | ss.WriteLine("\tEndProjectSection"); |
738 | ss.WriteLine("EndProject"); | 738 | ss.WriteLine("EndProject"); |
739 | } | 739 | } |
740 | 740 | ||
741 | ss.WriteLine("Global"); | 741 | ss.WriteLine("Global"); |
742 | 742 | ||
743 | ss.WriteLine(" GlobalSection(SolutionConfigurationPlatforms) = preSolution"); | 743 | ss.WriteLine(" GlobalSection(SolutionConfigurationPlatforms) = preSolution"); |
744 | foreach (ConfigurationNode conf in solution.Configurations) | 744 | foreach (ConfigurationNode conf in solution.Configurations) |
745 | { | 745 | { |
746 | ss.WriteLine(" {0}|Any CPU = {0}|Any CPU", conf.Name); | 746 | ss.WriteLine(" {0}|Any CPU = {0}|Any CPU", conf.Name); |
747 | } | 747 | } |
748 | ss.WriteLine(" EndGlobalSection"); | 748 | ss.WriteLine(" EndGlobalSection"); |
749 | 749 | ||
750 | if (solution.Projects.Count > 1) | 750 | if (solution.Projects.Count > 1) |
751 | { | 751 | { |
752 | ss.WriteLine(" GlobalSection(ProjectDependencies) = postSolution"); | 752 | ss.WriteLine(" GlobalSection(ProjectDependencies) = postSolution"); |
753 | } | 753 | } |
754 | foreach (ProjectNode project in solution.Projects) | 754 | foreach (ProjectNode project in solution.Projects) |
755 | { | 755 | { |
756 | for (int i = 0; i < project.References.Count; i++) | 756 | for (int i = 0; i < project.References.Count; i++) |
757 | { | 757 | { |
758 | ReferenceNode refr = (ReferenceNode)project.References[i]; | 758 | ReferenceNode refr = (ReferenceNode)project.References[i]; |
759 | if (solution.ProjectsTable.ContainsKey(refr.Name)) | 759 | if (solution.ProjectsTable.ContainsKey(refr.Name)) |
760 | { | 760 | { |
761 | ProjectNode refProject = (ProjectNode)solution.ProjectsTable[refr.Name]; | 761 | ProjectNode refProject = (ProjectNode)solution.ProjectsTable[refr.Name]; |
762 | ss.WriteLine(" ({{{0}}}).{1} = ({{{2}}})", | 762 | ss.WriteLine(" ({{{0}}}).{1} = ({{{2}}})", |
763 | project.Guid.ToString().ToUpper() | 763 | project.Guid.ToString().ToUpper() |
764 | , i, | 764 | , i, |
765 | refProject.Guid.ToString().ToUpper() | 765 | refProject.Guid.ToString().ToUpper() |
766 | ); | 766 | ); |
767 | } | 767 | } |
768 | } | 768 | } |
769 | } | 769 | } |
770 | if (solution.Projects.Count > 1) | 770 | if (solution.Projects.Count > 1) |
771 | { | 771 | { |
772 | ss.WriteLine(" EndGlobalSection"); | 772 | ss.WriteLine(" EndGlobalSection"); |
773 | } | 773 | } |
774 | ss.WriteLine(" GlobalSection(ProjectConfigurationPlatforms) = postSolution"); | 774 | ss.WriteLine(" GlobalSection(ProjectConfigurationPlatforms) = postSolution"); |
775 | foreach (ProjectNode project in solution.Projects) | 775 | foreach (ProjectNode project in solution.Projects) |
776 | { | 776 | { |
777 | foreach (ConfigurationNode conf in solution.Configurations) | 777 | foreach (ConfigurationNode conf in solution.Configurations) |
778 | { | 778 | { |
779 | ss.WriteLine(" {{{0}}}.{1}|Any CPU.ActiveCfg = {1}|Any CPU", | 779 | ss.WriteLine(" {{{0}}}.{1}|Any CPU.ActiveCfg = {1}|Any CPU", |
780 | project.Guid.ToString().ToUpper(), | 780 | project.Guid.ToString().ToUpper(), |
781 | conf.Name); | 781 | conf.Name); |
782 | 782 | ||
783 | ss.WriteLine(" {{{0}}}.{1}|Any CPU.Build.0 = {1}|Any CPU", | 783 | ss.WriteLine(" {{{0}}}.{1}|Any CPU.Build.0 = {1}|Any CPU", |
784 | project.Guid.ToString().ToUpper(), | 784 | project.Guid.ToString().ToUpper(), |
785 | conf.Name); | 785 | conf.Name); |
786 | } | 786 | } |
787 | } | 787 | } |
788 | ss.WriteLine(" EndGlobalSection"); | 788 | ss.WriteLine(" EndGlobalSection"); |
789 | ss.WriteLine(" GlobalSection(SolutionProperties) = preSolution"); | 789 | ss.WriteLine(" GlobalSection(SolutionProperties) = preSolution"); |
790 | ss.WriteLine(" HideSolutionNode = FALSE"); | 790 | ss.WriteLine(" HideSolutionNode = FALSE"); |
791 | ss.WriteLine(" EndGlobalSection"); | 791 | ss.WriteLine(" EndGlobalSection"); |
792 | 792 | ||
793 | ss.WriteLine("EndGlobal"); | 793 | ss.WriteLine("EndGlobal"); |
794 | } | 794 | } |
795 | 795 | ||
796 | kernel.CurrentWorkingDirectory.Pop(); | 796 | kernel.CurrentWorkingDirectory.Pop(); |
797 | } | 797 | } |
798 | 798 | ||
799 | private void CleanProject(ProjectNode project) | 799 | private void CleanProject(ProjectNode project) |
800 | { | 800 | { |
801 | kernel.Log.Write("...Cleaning project: {0}", project.Name); | 801 | kernel.Log.Write("...Cleaning project: {0}", project.Name); |
802 | 802 | ||
803 | ToolInfo toolInfo = (ToolInfo)tools[project.Language]; | 803 | ToolInfo toolInfo = (ToolInfo)tools[project.Language]; |
804 | string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, toolInfo.FileExtension); | 804 | string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, toolInfo.FileExtension); |
805 | string userFile = projectFile + ".user"; | 805 | string userFile = projectFile + ".user"; |
806 | 806 | ||
807 | Helper.DeleteIfExists(projectFile); | 807 | Helper.DeleteIfExists(projectFile); |
808 | Helper.DeleteIfExists(userFile); | 808 | Helper.DeleteIfExists(userFile); |
809 | } | 809 | } |
810 | 810 | ||
811 | private void CleanSolution(SolutionNode solution) | 811 | private void CleanSolution(SolutionNode solution) |
812 | { | 812 | { |
813 | kernel.Log.Write("Cleaning {0} solution and project files", this.VersionName, solution.Name); | 813 | kernel.Log.Write("Cleaning {0} solution and project files", this.VersionName, solution.Name); |
814 | 814 | ||
815 | string slnFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "sln"); | 815 | string slnFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "sln"); |
816 | string suoFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "suo"); | 816 | string suoFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "suo"); |
817 | 817 | ||
818 | Helper.DeleteIfExists(slnFile); | 818 | Helper.DeleteIfExists(slnFile); |
819 | Helper.DeleteIfExists(suoFile); | 819 | Helper.DeleteIfExists(suoFile); |
820 | 820 | ||
821 | foreach (ProjectNode project in solution.Projects) | 821 | foreach (ProjectNode project in solution.Projects) |
822 | { | 822 | { |
823 | CleanProject(project); | 823 | CleanProject(project); |
824 | } | 824 | } |
825 | 825 | ||
826 | kernel.Log.Write(""); | 826 | kernel.Log.Write(""); |
827 | } | 827 | } |
828 | 828 | ||
829 | #endregion | 829 | #endregion |
830 | 830 | ||
831 | #region ITarget Members | 831 | #region ITarget Members |
832 | 832 | ||
833 | /// <summary> | 833 | /// <summary> |
834 | /// Writes the specified kern. | 834 | /// Writes the specified kern. |
835 | /// </summary> | 835 | /// </summary> |
836 | /// <param name="kern">The kern.</param> | 836 | /// <param name="kern">The kern.</param> |
837 | public virtual void Write(Kernel kern) | 837 | public virtual void Write(Kernel kern) |
838 | { | 838 | { |
839 | if (kern == null) | 839 | if (kern == null) |
840 | { | 840 | { |
841 | throw new ArgumentNullException("kern"); | 841 | throw new ArgumentNullException("kern"); |
842 | } | 842 | } |
843 | kernel = kern; | 843 | kernel = kern; |
844 | foreach (SolutionNode sol in kernel.Solutions) | 844 | foreach (SolutionNode sol in kernel.Solutions) |
845 | { | 845 | { |
846 | WriteSolution(sol); | 846 | WriteSolution(sol); |
847 | } | 847 | } |
848 | kernel = null; | 848 | kernel = null; |
849 | } | 849 | } |
850 | 850 | ||
851 | /// <summary> | 851 | /// <summary> |
852 | /// Cleans the specified kern. | 852 | /// Cleans the specified kern. |
853 | /// </summary> | 853 | /// </summary> |
854 | /// <param name="kern">The kern.</param> | 854 | /// <param name="kern">The kern.</param> |
855 | public virtual void Clean(Kernel kern) | 855 | public virtual void Clean(Kernel kern) |
856 | { | 856 | { |
857 | if (kern == null) | 857 | if (kern == null) |
858 | { | 858 | { |
859 | throw new ArgumentNullException("kern"); | 859 | throw new ArgumentNullException("kern"); |
860 | } | 860 | } |
861 | kernel = kern; | 861 | kernel = kern; |
862 | foreach (SolutionNode sol in kernel.Solutions) | 862 | foreach (SolutionNode sol in kernel.Solutions) |
863 | { | 863 | { |
864 | CleanSolution(sol); | 864 | CleanSolution(sol); |
865 | } | 865 | } |
866 | kernel = null; | 866 | kernel = null; |
867 | } | 867 | } |
868 | 868 | ||
869 | /// <summary> | 869 | /// <summary> |
870 | /// Gets the name. | 870 | /// Gets the name. |
871 | /// </summary> | 871 | /// </summary> |
872 | /// <value>The name.</value> | 872 | /// <value>The name.</value> |
873 | public virtual string Name | 873 | public virtual string Name |
874 | { | 874 | { |
875 | get | 875 | get |
876 | { | 876 | { |
877 | return "vs2005"; | 877 | return "vs2005"; |
878 | } | 878 | } |
879 | } | 879 | } |
880 | 880 | ||
881 | #endregion | 881 | #endregion |
882 | } | 882 | } |
883 | } | 883 | } |
diff --git a/Prebuild/src/Core/UnknownLanguageException.cs b/Prebuild/src/Core/UnknownLanguageException.cs index cbd1dc1..607b66c 100644 --- a/Prebuild/src/Core/UnknownLanguageException.cs +++ b/Prebuild/src/Core/UnknownLanguageException.cs | |||
@@ -1,63 +1,63 @@ | |||
1 | /* | 1 | /* |
2 | * $RCSfile$ | 2 | * $RCSfile$ |
3 | * Copyright (C) 2004, 2005 David Hudson (jendave@yahoo.com) | 3 | * Copyright (C) 2004, 2005 David Hudson (jendave@yahoo.com) |
4 | * | 4 | * |
5 | * This library is free software; you can redistribute it and/or | 5 | * This library is free software; you can redistribute it and/or |
6 | * modify it under the terms of the GNU Lesser General Public | 6 | * modify it under the terms of the GNU Lesser General Public |
7 | * License as published by the Free Software Foundation; either | 7 | * License as published by the Free Software Foundation; either |
8 | * version 2.1 of the License, or (at your option) any later version. | 8 | * version 2.1 of the License, or (at your option) any later version. |
9 | * | 9 | * |
10 | * This library is distributed in the hope that it will be useful, | 10 | * This library is distributed in the hope that it will be useful, |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | * Lesser General Public License for more details. | 13 | * Lesser General Public License for more details. |
14 | * | 14 | * |
15 | * You should have received a copy of the GNU Lesser General Public | 15 | * You should have received a copy of the GNU Lesser General Public |
16 | * License along with this library; if not, write to the Free Software | 16 | * License along with this library; if not, write to the Free Software |
17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
18 | */ | 18 | */ |
19 | 19 | ||
20 | using System; | 20 | using System; |
21 | using System.Runtime.Serialization; | 21 | using System.Runtime.Serialization; |
22 | 22 | ||
23 | namespace Prebuild.Core | 23 | namespace Prebuild.Core |
24 | { | 24 | { |
25 | /// <summary> | 25 | /// <summary> |
26 | /// </summary> | 26 | /// </summary> |
27 | [Serializable()] | 27 | [Serializable()] |
28 | public class UnknownLanguageException : Exception | 28 | public class UnknownLanguageException : Exception |
29 | { | 29 | { |
30 | /// <summary> | 30 | /// <summary> |
31 | /// Basic exception. | 31 | /// Basic exception. |
32 | /// </summary> | 32 | /// </summary> |
33 | public UnknownLanguageException() | 33 | public UnknownLanguageException() |
34 | { | 34 | { |
35 | } | 35 | } |
36 | 36 | ||
37 | /// <summary> | 37 | /// <summary> |
38 | /// Exception with specified string | 38 | /// Exception with specified string |
39 | /// </summary> | 39 | /// </summary> |
40 | /// <param name="message">Exception message</param> | 40 | /// <param name="message">Exception message</param> |
41 | public UnknownLanguageException(string message): base(message) | 41 | public UnknownLanguageException(string message): base(message) |
42 | { | 42 | { |
43 | } | 43 | } |
44 | 44 | ||
45 | /// <summary> | 45 | /// <summary> |
46 | /// | 46 | /// |
47 | /// </summary> | 47 | /// </summary> |
48 | /// <param name="message"></param> | 48 | /// <param name="message"></param> |
49 | /// <param name="exception"></param> | 49 | /// <param name="exception"></param> |
50 | public UnknownLanguageException(string message, Exception exception) : base(message, exception) | 50 | public UnknownLanguageException(string message, Exception exception) : base(message, exception) |
51 | { | 51 | { |
52 | } | 52 | } |
53 | 53 | ||
54 | /// <summary> | 54 | /// <summary> |
55 | /// | 55 | /// |
56 | /// </summary> | 56 | /// </summary> |
57 | /// <param name="info"></param> | 57 | /// <param name="info"></param> |
58 | /// <param name="context"></param> | 58 | /// <param name="context"></param> |
59 | protected UnknownLanguageException(SerializationInfo info, StreamingContext context) : base( info, context ) | 59 | protected UnknownLanguageException(SerializationInfo info, StreamingContext context) : base( info, context ) |
60 | { | 60 | { |
61 | } | 61 | } |
62 | } | 62 | } |
63 | } | 63 | } |
diff --git a/Prebuild/src/Core/Utilities/CommandLineCollection.cs b/Prebuild/src/Core/Utilities/CommandLineCollection.cs index 496731f..62eb18b 100644 --- a/Prebuild/src/Core/Utilities/CommandLineCollection.cs +++ b/Prebuild/src/Core/Utilities/CommandLineCollection.cs | |||
@@ -1,162 +1,162 @@ | |||
1 | #region BSD License | 1 | #region BSD License |
2 | /* | 2 | /* |
3 | Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) | 3 | Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) |
4 | 4 | ||
5 | Redistribution and use in source and binary forms, with or without modification, are permitted | 5 | Redistribution and use in source and binary forms, with or without modification, are permitted |
6 | provided that the following conditions are met: | 6 | provided that the following conditions are met: |
7 | 7 | ||
8 | * Redistributions of source code must retain the above copyright notice, this list of conditions | 8 | * Redistributions of source code must retain the above copyright notice, this list of conditions |
9 | and the following disclaimer. | 9 | and the following disclaimer. |
10 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions | 10 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions |
11 | and the following disclaimer in the documentation and/or other materials provided with the | 11 | and the following disclaimer in the documentation and/or other materials provided with the |
12 | distribution. | 12 | distribution. |
13 | * The name of the author may not be used to endorse or promote products derived from this software | 13 | * The name of the author may not be used to endorse or promote products derived from this software |
14 | without specific prior written permission. | 14 | without specific prior written permission. |
15 | 15 | ||
16 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, | 16 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, |
17 | BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | 17 | BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
18 | ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | 18 | ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
19 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | 19 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
20 | OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY | 20 | OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
21 | OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | 21 | OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING |
22 | IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 22 | IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
23 | */ | 23 | */ |
24 | #endregion | 24 | #endregion |
25 | 25 | ||
26 | #region CVS Information | 26 | #region CVS Information |
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 00:30:53 +0200 (ti, 26 sep 2006) $ |
31 | * $Revision: 165 $ | 31 | * $Revision: 165 $ |
32 | */ | 32 | */ |
33 | #endregion | 33 | #endregion |
34 | 34 | ||
35 | using System; | 35 | using System; |
36 | using System.Collections; | 36 | using System.Collections; |
37 | using System.Collections.Specialized; | 37 | using System.Collections.Specialized; |
38 | using System.Diagnostics; | 38 | using System.Diagnostics; |
39 | 39 | ||
40 | namespace Prebuild.Core.Utilities | 40 | namespace Prebuild.Core.Utilities |
41 | { | 41 | { |
42 | /// <summary> | 42 | /// <summary> |
43 | /// The CommandLine class parses and interprets the command-line arguments passed to | 43 | /// The CommandLine class parses and interprets the command-line arguments passed to |
44 | /// prebuild. | 44 | /// prebuild. |
45 | /// </summary> | 45 | /// </summary> |
46 | public class CommandLineCollection | 46 | public class CommandLineCollection |
47 | { | 47 | { |
48 | #region Fields | 48 | #region Fields |
49 | 49 | ||
50 | // The raw OS arguments | 50 | // The raw OS arguments |
51 | private string[] m_RawArgs; | 51 | private string[] m_RawArgs; |
52 | 52 | ||
53 | // Command-line argument storage | 53 | // Command-line argument storage |
54 | private Hashtable m_Arguments; | 54 | private Hashtable m_Arguments; |
55 | 55 | ||
56 | #endregion | 56 | #endregion |
57 | 57 | ||
58 | #region Constructors | 58 | #region Constructors |
59 | 59 | ||
60 | /// <summary> | 60 | /// <summary> |
61 | /// Create a new CommandLine instance and set some internal variables. | 61 | /// Create a new CommandLine instance and set some internal variables. |
62 | /// </summary> | 62 | /// </summary> |
63 | public CommandLineCollection(string[] args) | 63 | public CommandLineCollection(string[] args) |
64 | { | 64 | { |
65 | m_RawArgs = args; | 65 | m_RawArgs = args; |
66 | m_Arguments = new Hashtable(); | 66 | m_Arguments = new Hashtable(); |
67 | 67 | ||
68 | Parse(); | 68 | Parse(); |
69 | } | 69 | } |
70 | 70 | ||
71 | #endregion | 71 | #endregion |
72 | 72 | ||
73 | #region Private Methods | 73 | #region Private Methods |
74 | 74 | ||
75 | private void Parse() | 75 | private void Parse() |
76 | { | 76 | { |
77 | if(m_RawArgs.Length < 1) | 77 | if(m_RawArgs.Length < 1) |
78 | return; | 78 | return; |
79 | 79 | ||
80 | int idx = 0; | 80 | int idx = 0; |
81 | string arg = null, lastArg = null; | 81 | string arg = null, lastArg = null; |
82 | 82 | ||
83 | while(idx <m_RawArgs.Length) | 83 | while(idx <m_RawArgs.Length) |
84 | { | 84 | { |
85 | arg = m_RawArgs[idx]; | 85 | arg = m_RawArgs[idx]; |
86 | 86 | ||
87 | if(arg.Length > 2 && arg[0] == '/') | 87 | if(arg.Length > 2 && arg[0] == '/') |
88 | { | 88 | { |
89 | arg = arg.Substring(1); | 89 | arg = arg.Substring(1); |
90 | lastArg = arg; | 90 | lastArg = arg; |
91 | m_Arguments[arg] = ""; | 91 | m_Arguments[arg] = ""; |
92 | } | 92 | } |
93 | else | 93 | else |
94 | { | 94 | { |
95 | if(lastArg != null) | 95 | if(lastArg != null) |
96 | { | 96 | { |
97 | m_Arguments[lastArg] = arg; | 97 | m_Arguments[lastArg] = arg; |
98 | lastArg = null; | 98 | lastArg = null; |
99 | } | 99 | } |
100 | } | 100 | } |
101 | 101 | ||
102 | idx++; | 102 | idx++; |
103 | } | 103 | } |
104 | } | 104 | } |
105 | 105 | ||
106 | #endregion | 106 | #endregion |
107 | 107 | ||
108 | #region Public Methods | 108 | #region Public Methods |
109 | 109 | ||
110 | /// <summary> | 110 | /// <summary> |
111 | /// Wases the passed. | 111 | /// Wases the passed. |
112 | /// </summary> | 112 | /// </summary> |
113 | /// <param name="arg">The arg.</param> | 113 | /// <param name="arg">The arg.</param> |
114 | /// <returns></returns> | 114 | /// <returns></returns> |
115 | public bool WasPassed(string arg) | 115 | public bool WasPassed(string arg) |
116 | { | 116 | { |
117 | return (m_Arguments.ContainsKey(arg)); | 117 | return (m_Arguments.ContainsKey(arg)); |
118 | } | 118 | } |
119 | 119 | ||
120 | #endregion | 120 | #endregion |
121 | 121 | ||
122 | #region Properties | 122 | #region Properties |
123 | 123 | ||
124 | /// <summary> | 124 | /// <summary> |
125 | /// Gets the parameter associated with the command line option | 125 | /// Gets the parameter associated with the command line option |
126 | /// </summary> | 126 | /// </summary> |
127 | /// <remarks>Returns null if option was not specified, | 127 | /// <remarks>Returns null if option was not specified, |
128 | /// null string if no parameter was specified, and the value if a parameter was specified</remarks> | 128 | /// null string if no parameter was specified, and the value if a parameter was specified</remarks> |
129 | public string this[string index] | 129 | public string this[string index] |
130 | { | 130 | { |
131 | get | 131 | get |
132 | { | 132 | { |
133 | if(m_Arguments.ContainsKey(index)) | 133 | if(m_Arguments.ContainsKey(index)) |
134 | { | 134 | { |
135 | return (string)(m_Arguments[index]); | 135 | return (string)(m_Arguments[index]); |
136 | } | 136 | } |
137 | else | 137 | else |
138 | { | 138 | { |
139 | return null; | 139 | return null; |
140 | } | 140 | } |
141 | } | 141 | } |
142 | } | 142 | } |
143 | 143 | ||
144 | #endregion | 144 | #endregion |
145 | 145 | ||
146 | #region IEnumerable Members | 146 | #region IEnumerable Members |
147 | 147 | ||
148 | /// <summary> | 148 | /// <summary> |
149 | /// Returns an enumerator that can iterate through a collection. | 149 | /// Returns an enumerator that can iterate through a collection. |
150 | /// </summary> | 150 | /// </summary> |
151 | /// <returns> | 151 | /// <returns> |
152 | /// An <see cref="T:System.Collections.IDictionaryEnumerator"/> | 152 | /// An <see cref="T:System.Collections.IDictionaryEnumerator"/> |
153 | /// that can be used to iterate through the collection. | 153 | /// that can be used to iterate through the collection. |
154 | /// </returns> | 154 | /// </returns> |
155 | public IDictionaryEnumerator GetEnumerator() | 155 | public IDictionaryEnumerator GetEnumerator() |
156 | { | 156 | { |
157 | return m_Arguments.GetEnumerator(); | 157 | return m_Arguments.GetEnumerator(); |
158 | } | 158 | } |
159 | 159 | ||
160 | #endregion | 160 | #endregion |
161 | } | 161 | } |
162 | } | 162 | } |
diff --git a/Prebuild/src/Core/Utilities/CurrentDirectory.cs b/Prebuild/src/Core/Utilities/CurrentDirectory.cs index a76d844..ff2d159 100644 --- a/Prebuild/src/Core/Utilities/CurrentDirectory.cs +++ b/Prebuild/src/Core/Utilities/CurrentDirectory.cs | |||
@@ -1,89 +1,89 @@ | |||
1 | #region BSD License | 1 | #region BSD License |
2 | /* | 2 | /* |
3 | Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) | 3 | Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) |
4 | 4 | ||
5 | Redistribution and use in source and binary forms, with or without modification, are permitted | 5 | Redistribution and use in source and binary forms, with or without modification, are permitted |
6 | provided that the following conditions are met: | 6 | provided that the following conditions are met: |
7 | 7 | ||
8 | * Redistributions of source code must retain the above copyright notice, this list of conditions | 8 | * Redistributions of source code must retain the above copyright notice, this list of conditions |
9 | and the following disclaimer. | 9 | and the following disclaimer. |
10 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions | 10 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions |
11 | and the following disclaimer in the documentation and/or other materials provided with the | 11 | and the following disclaimer in the documentation and/or other materials provided with the |
12 | distribution. | 12 | distribution. |
13 | * The name of the author may not be used to endorse or promote products derived from this software | 13 | * The name of the author may not be used to endorse or promote products derived from this software |
14 | without specific prior written permission. | 14 | without specific prior written permission. |
15 | 15 | ||
16 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, | 16 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, |
17 | BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | 17 | BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
18 | ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | 18 | ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
19 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | 19 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
20 | OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY | 20 | OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
21 | OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | 21 | OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING |
22 | IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 22 | IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
23 | */ | 23 | */ |
24 | #endregion | 24 | #endregion |
25 | 25 | ||
26 | #region CVS Information | 26 | #region CVS Information |
27 | /* | 27 | /* |
28 | * $Source$ | 28 | * $Source$ |
29 | * $Author: jendave $ | 29 | * $Author: jendave $ |
30 | * $Date: 2006-01-28 01:49:58 +0100 (lö, 28 jan 2006) $ | 30 | * $Date: 2006-01-28 01:49:58 +0100 (lö, 28 jan 2006) $ |
31 | * $Revision: 71 $ | 31 | * $Revision: 71 $ |
32 | */ | 32 | */ |
33 | #endregion | 33 | #endregion |
34 | 34 | ||
35 | using System; | 35 | using System; |
36 | using System.Collections; | 36 | using System.Collections; |
37 | 37 | ||
38 | namespace Prebuild.Core.Utilities | 38 | namespace Prebuild.Core.Utilities |
39 | { | 39 | { |
40 | /// <summary> | 40 | /// <summary> |
41 | /// | 41 | /// |
42 | /// </summary> | 42 | /// </summary> |
43 | public class CurrentDirectory | 43 | public class CurrentDirectory |
44 | { | 44 | { |
45 | #region Fields | 45 | #region Fields |
46 | 46 | ||
47 | private Stack m_Stack; | 47 | private Stack m_Stack; |
48 | 48 | ||
49 | #endregion | 49 | #endregion |
50 | 50 | ||
51 | #region Constructors | 51 | #region Constructors |
52 | 52 | ||
53 | /// <summary> | 53 | /// <summary> |
54 | /// Initializes a new instance of the <see cref="CurrentDirectory"/> class. | 54 | /// Initializes a new instance of the <see cref="CurrentDirectory"/> class. |
55 | /// </summary> | 55 | /// </summary> |
56 | public CurrentDirectory() | 56 | public CurrentDirectory() |
57 | { | 57 | { |
58 | m_Stack = new Stack(); | 58 | m_Stack = new Stack(); |
59 | } | 59 | } |
60 | 60 | ||
61 | #endregion | 61 | #endregion |
62 | 62 | ||
63 | #region Public Methods | 63 | #region Public Methods |
64 | 64 | ||
65 | /// <summary> | 65 | /// <summary> |
66 | /// Pushes this instance. | 66 | /// Pushes this instance. |
67 | /// </summary> | 67 | /// </summary> |
68 | public void Push() | 68 | public void Push() |
69 | { | 69 | { |
70 | m_Stack.Push(Environment.CurrentDirectory); | 70 | m_Stack.Push(Environment.CurrentDirectory); |
71 | } | 71 | } |
72 | 72 | ||
73 | /// <summary> | 73 | /// <summary> |
74 | /// Pops this instance. | 74 | /// Pops this instance. |
75 | /// </summary> | 75 | /// </summary> |
76 | public void Pop() | 76 | public void Pop() |
77 | { | 77 | { |
78 | if(m_Stack.Count < 1) | 78 | if(m_Stack.Count < 1) |
79 | { | 79 | { |
80 | return; | 80 | return; |
81 | } | 81 | } |
82 | 82 | ||
83 | string cwd = (string)m_Stack.Pop(); | 83 | string cwd = (string)m_Stack.Pop(); |
84 | Helper.SetCurrentDir(cwd); | 84 | Helper.SetCurrentDir(cwd); |
85 | } | 85 | } |
86 | 86 | ||
87 | #endregion | 87 | #endregion |
88 | } | 88 | } |
89 | } | 89 | } |
diff --git a/Prebuild/src/Core/Utilities/Helper.cs b/Prebuild/src/Core/Utilities/Helper.cs index 33c9618..27b9ccf 100644 --- a/Prebuild/src/Core/Utilities/Helper.cs +++ b/Prebuild/src/Core/Utilities/Helper.cs | |||
@@ -1,661 +1,661 @@ | |||
1 | #region BSD License | 1 | #region BSD License |
2 | /* | 2 | /* |
3 | Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) | 3 | Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) |
4 | 4 | ||
5 | Redistribution and use in source and binary forms, with or without modification, are permitted | 5 | Redistribution and use in source and binary forms, with or without modification, are permitted |
6 | provided that the following conditions are met: | 6 | provided that the following conditions are met: |
7 | 7 | ||
8 | * Redistributions of source code must retain the above copyright notice, this list of conditions | 8 | * Redistributions of source code must retain the above copyright notice, this list of conditions |
9 | and the following disclaimer. | 9 | and the following disclaimer. |
10 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions | 10 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions |
11 | and the following disclaimer in the documentation and/or other materials provided with the | 11 | and the following disclaimer in the documentation and/or other materials provided with the |
12 | distribution. | 12 | distribution. |
13 | * The name of the author may not be used to endorse or promote products derived from this software | 13 | * The name of the author may not be used to endorse or promote products derived from this software |
14 | without specific prior written permission. | 14 | without specific prior written permission. |
15 | 15 | ||
16 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, | 16 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, |
17 | BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | 17 | BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
18 | ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | 18 | ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
19 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | 19 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
20 | OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY | 20 | OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
21 | OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | 21 | OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING |
22 | IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 22 | IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
23 | */ | 23 | */ |
24 | #endregion | 24 | #endregion |
25 | 25 | ||
26 | #region CVS Information | 26 | #region CVS Information |
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-13 21:58:03 +0100 (ti, 13 feb 2007) $ |
31 | * $Revision: 205 $ | 31 | * $Revision: 205 $ |
32 | */ | 32 | */ |
33 | #endregion | 33 | #endregion |
34 | 34 | ||
35 | using System; | 35 | using System; |
36 | using System.Collections; | 36 | using System.Collections; |
37 | using System.Diagnostics; | 37 | using System.Diagnostics; |
38 | using System.IO; | 38 | using System.IO; |
39 | using System.Runtime.InteropServices; | 39 | using System.Runtime.InteropServices; |
40 | using System.Text.RegularExpressions; | 40 | using System.Text.RegularExpressions; |
41 | using System.Collections.Specialized; | 41 | using System.Collections.Specialized; |
42 | using System.Xml; | 42 | using System.Xml; |
43 | using Prebuild.Core.Nodes; | 43 | using Prebuild.Core.Nodes; |
44 | 44 | ||
45 | namespace Prebuild.Core.Utilities | 45 | namespace Prebuild.Core.Utilities |
46 | { | 46 | { |
47 | /// <summary> | 47 | /// <summary> |
48 | /// | 48 | /// |
49 | /// </summary> | 49 | /// </summary> |
50 | public class Helper | 50 | public class Helper |
51 | { | 51 | { |
52 | #region Fields | 52 | #region Fields |
53 | 53 | ||
54 | private static Stack dirStack; | 54 | private static Stack dirStack; |
55 | private static Regex varRegex; | 55 | private static Regex varRegex; |
56 | static bool checkForOSVariables; | 56 | static bool checkForOSVariables; |
57 | 57 | ||
58 | /// <summary> | 58 | /// <summary> |
59 | /// | 59 | /// |
60 | /// </summary> | 60 | /// </summary> |
61 | public static bool CheckForOSVariables | 61 | public static bool CheckForOSVariables |
62 | { | 62 | { |
63 | get | 63 | get |
64 | { | 64 | { |
65 | return checkForOSVariables; | 65 | return checkForOSVariables; |
66 | } | 66 | } |
67 | set | 67 | set |
68 | { | 68 | { |
69 | checkForOSVariables = value; | 69 | checkForOSVariables = value; |
70 | } | 70 | } |
71 | } | 71 | } |
72 | 72 | ||
73 | #endregion | 73 | #endregion |
74 | 74 | ||
75 | #region Constructors | 75 | #region Constructors |
76 | 76 | ||
77 | /// <summary> | 77 | /// <summary> |
78 | /// Initializes the <see cref="Helper"/> class. | 78 | /// Initializes the <see cref="Helper"/> class. |
79 | /// </summary> | 79 | /// </summary> |
80 | static Helper() | 80 | static Helper() |
81 | { | 81 | { |
82 | dirStack = new Stack(); | 82 | dirStack = new Stack(); |
83 | //m_VarRegex = new Regex(@"\${(?<var>[\w|_]+)}"); | 83 | //m_VarRegex = new Regex(@"\${(?<var>[\w|_]+)}"); |
84 | } | 84 | } |
85 | 85 | ||
86 | #endregion | 86 | #endregion |
87 | 87 | ||
88 | #region Properties | 88 | #region Properties |
89 | 89 | ||
90 | /// <summary> | 90 | /// <summary> |
91 | /// | 91 | /// |
92 | /// </summary> | 92 | /// </summary> |
93 | public static Stack DirStack | 93 | public static Stack DirStack |
94 | { | 94 | { |
95 | get | 95 | get |
96 | { | 96 | { |
97 | return dirStack; | 97 | return dirStack; |
98 | } | 98 | } |
99 | } | 99 | } |
100 | 100 | ||
101 | /// <summary> | 101 | /// <summary> |
102 | /// | 102 | /// |
103 | /// </summary> | 103 | /// </summary> |
104 | public static Regex VarRegex | 104 | public static Regex VarRegex |
105 | { | 105 | { |
106 | get | 106 | get |
107 | { | 107 | { |
108 | return varRegex; | 108 | return varRegex; |
109 | } | 109 | } |
110 | set | 110 | set |
111 | { | 111 | { |
112 | varRegex = value; | 112 | varRegex = value; |
113 | } | 113 | } |
114 | } | 114 | } |
115 | 115 | ||
116 | #endregion | 116 | #endregion |
117 | 117 | ||
118 | #region Public Methods | 118 | #region Public Methods |
119 | 119 | ||
120 | #region String Parsing | 120 | #region String Parsing |
121 | #region Inner Classes and Delegates | 121 | #region Inner Classes and Delegates |
122 | /// <summary> | 122 | /// <summary> |
123 | /// | 123 | /// |
124 | /// </summary> | 124 | /// </summary> |
125 | public delegate string StringLookup(string key); | 125 | public delegate string StringLookup(string key); |
126 | 126 | ||
127 | #endregion | 127 | #endregion |
128 | 128 | ||
129 | /// <summary> | 129 | /// <summary> |
130 | /// Gets a collection of StringLocationPair objects that represent the matches | 130 | /// Gets a collection of StringLocationPair objects that represent the matches |
131 | /// </summary> | 131 | /// </summary> |
132 | /// <param name="target">The target.</param> | 132 | /// <param name="target">The target.</param> |
133 | /// <param name="beforeGroup">The before group.</param> | 133 | /// <param name="beforeGroup">The before group.</param> |
134 | /// <param name="afterGroup">The after group.</param> | 134 | /// <param name="afterGroup">The after group.</param> |
135 | /// <param name="includeDelimitersInSubstrings">if set to <c>true</c> [include delimiters in substrings].</param> | 135 | /// <param name="includeDelimitersInSubstrings">if set to <c>true</c> [include delimiters in substrings].</param> |
136 | /// <returns></returns> | 136 | /// <returns></returns> |
137 | public static StringCollection FindGroups(string target, string beforeGroup, string afterGroup, bool includeDelimitersInSubstrings) | 137 | public static StringCollection FindGroups(string target, string beforeGroup, string afterGroup, bool includeDelimitersInSubstrings) |
138 | { | 138 | { |
139 | if( beforeGroup == null ) | 139 | if( beforeGroup == null ) |
140 | { | 140 | { |
141 | throw new ArgumentNullException("beforeGroup"); | 141 | throw new ArgumentNullException("beforeGroup"); |
142 | } | 142 | } |
143 | if( afterGroup == null ) | 143 | if( afterGroup == null ) |
144 | { | 144 | { |
145 | throw new ArgumentNullException("afterGroup"); | 145 | throw new ArgumentNullException("afterGroup"); |
146 | } | 146 | } |
147 | StringCollection results = new StringCollection(); | 147 | StringCollection results = new StringCollection(); |
148 | if(target == null || target.Length == 0) | 148 | if(target == null || target.Length == 0) |
149 | { | 149 | { |
150 | return results; | 150 | return results; |
151 | } | 151 | } |
152 | 152 | ||
153 | int beforeMod = 0; | 153 | int beforeMod = 0; |
154 | int afterMod = 0; | 154 | int afterMod = 0; |
155 | if(includeDelimitersInSubstrings) | 155 | if(includeDelimitersInSubstrings) |
156 | { | 156 | { |
157 | //be sure to not exlude the delims | 157 | //be sure to not exlude the delims |
158 | beforeMod = beforeGroup.Length; | 158 | beforeMod = beforeGroup.Length; |
159 | afterMod = afterGroup.Length; | 159 | afterMod = afterGroup.Length; |
160 | } | 160 | } |
161 | int startIndex = 0; | 161 | int startIndex = 0; |
162 | while((startIndex = target.IndexOf(beforeGroup,startIndex)) != -1) { | 162 | while((startIndex = target.IndexOf(beforeGroup,startIndex)) != -1) { |
163 | int endIndex = target.IndexOf(afterGroup,startIndex);//the index of the char after it | 163 | int endIndex = target.IndexOf(afterGroup,startIndex);//the index of the char after it |
164 | if(endIndex == -1) | 164 | if(endIndex == -1) |
165 | { | 165 | { |
166 | break; | 166 | break; |
167 | } | 167 | } |
168 | int length = endIndex - startIndex - beforeGroup.Length;//move to the first char in the string | 168 | int length = endIndex - startIndex - beforeGroup.Length;//move to the first char in the string |
169 | string substring = substring = target.Substring(startIndex + beforeGroup.Length - beforeMod, | 169 | string substring = substring = target.Substring(startIndex + beforeGroup.Length - beforeMod, |
170 | length - afterMod); | 170 | length - afterMod); |
171 | 171 | ||
172 | results.Add(substring); | 172 | results.Add(substring); |
173 | //results.Add(new StringLocationPair(substring,startIndex)); | 173 | //results.Add(new StringLocationPair(substring,startIndex)); |
174 | startIndex = endIndex + 1; | 174 | startIndex = endIndex + 1; |
175 | //the Interpolate*() methods will not work if expressions are expandded inside expression due to an optimization | 175 | //the Interpolate*() methods will not work if expressions are expandded inside expression due to an optimization |
176 | //so start after endIndex | 176 | //so start after endIndex |
177 | 177 | ||
178 | } | 178 | } |
179 | return results; | 179 | return results; |
180 | } | 180 | } |
181 | 181 | ||
182 | /// <summary> | 182 | /// <summary> |
183 | /// Replaces the groups. | 183 | /// Replaces the groups. |
184 | /// </summary> | 184 | /// </summary> |
185 | /// <param name="target">The target.</param> | 185 | /// <param name="target">The target.</param> |
186 | /// <param name="beforeGroup">The before group.</param> | 186 | /// <param name="beforeGroup">The before group.</param> |
187 | /// <param name="afterGroup">The after group.</param> | 187 | /// <param name="afterGroup">The after group.</param> |
188 | /// <param name="lookup">The lookup.</param> | 188 | /// <param name="lookup">The lookup.</param> |
189 | /// <returns></returns> | 189 | /// <returns></returns> |
190 | public static string ReplaceGroups(string target, string beforeGroup, string afterGroup, StringLookup lookup) { | 190 | public static string ReplaceGroups(string target, string beforeGroup, string afterGroup, StringLookup lookup) { |
191 | if( target == null ) | 191 | if( target == null ) |
192 | { | 192 | { |
193 | throw new ArgumentNullException("target"); | 193 | throw new ArgumentNullException("target"); |
194 | } | 194 | } |
195 | //int targetLength = target.Length; | 195 | //int targetLength = target.Length; |
196 | StringCollection strings = FindGroups(target,beforeGroup,afterGroup,false); | 196 | StringCollection strings = FindGroups(target,beforeGroup,afterGroup,false); |
197 | if( lookup == null ) | 197 | if( lookup == null ) |
198 | { | 198 | { |
199 | throw new ArgumentNullException("lookup"); | 199 | throw new ArgumentNullException("lookup"); |
200 | } | 200 | } |
201 | foreach(string substring in strings) | 201 | foreach(string substring in strings) |
202 | { | 202 | { |
203 | target = target.Replace(beforeGroup + substring + afterGroup, lookup(substring) ); | 203 | target = target.Replace(beforeGroup + substring + afterGroup, lookup(substring) ); |
204 | } | 204 | } |
205 | return target; | 205 | return target; |
206 | } | 206 | } |
207 | 207 | ||
208 | /// <summary> | 208 | /// <summary> |
209 | /// Replaces ${var} statements in a string with the corresonding values as detirmined by the lookup delegate | 209 | /// Replaces ${var} statements in a string with the corresonding values as detirmined by the lookup delegate |
210 | /// </summary> | 210 | /// </summary> |
211 | /// <param name="target">The target.</param> | 211 | /// <param name="target">The target.</param> |
212 | /// <param name="lookup">The lookup.</param> | 212 | /// <param name="lookup">The lookup.</param> |
213 | /// <returns></returns> | 213 | /// <returns></returns> |
214 | public static string InterpolateForVariables(string target, StringLookup lookup) | 214 | public static string InterpolateForVariables(string target, StringLookup lookup) |
215 | { | 215 | { |
216 | return ReplaceGroups(target, "${" , "}" , lookup); | 216 | return ReplaceGroups(target, "${" , "}" , lookup); |
217 | } | 217 | } |
218 | 218 | ||
219 | /// <summary> | 219 | /// <summary> |
220 | /// Replaces ${var} statements in a string with the corresonding environment variable with name var | 220 | /// Replaces ${var} statements in a string with the corresonding environment variable with name var |
221 | /// </summary> | 221 | /// </summary> |
222 | /// <param name="target"></param> | 222 | /// <param name="target"></param> |
223 | /// <returns></returns> | 223 | /// <returns></returns> |
224 | public static string InterpolateForEnvironmentVariables(string target) | 224 | public static string InterpolateForEnvironmentVariables(string target) |
225 | { | 225 | { |
226 | return InterpolateForVariables(target, new StringLookup(Environment.GetEnvironmentVariable)); | 226 | return InterpolateForVariables(target, new StringLookup(Environment.GetEnvironmentVariable)); |
227 | } | 227 | } |
228 | 228 | ||
229 | #endregion | 229 | #endregion |
230 | 230 | ||
231 | /// <summary> | 231 | /// <summary> |
232 | /// Translates the value. | 232 | /// Translates the value. |
233 | /// </summary> | 233 | /// </summary> |
234 | /// <param name="translateType">Type of the translate.</param> | 234 | /// <param name="translateType">Type of the translate.</param> |
235 | /// <param name="translationItem">The translation item.</param> | 235 | /// <param name="translationItem">The translation item.</param> |
236 | /// <returns></returns> | 236 | /// <returns></returns> |
237 | public static object TranslateValue(Type translateType, string translationItem) | 237 | public static object TranslateValue(Type translateType, string translationItem) |
238 | { | 238 | { |
239 | if(translationItem == null) | 239 | if(translationItem == null) |
240 | { | 240 | { |
241 | return null; | 241 | return null; |
242 | } | 242 | } |
243 | 243 | ||
244 | try | 244 | try |
245 | { | 245 | { |
246 | string lowerVal = translationItem.ToLower(); | 246 | string lowerVal = translationItem.ToLower(); |
247 | if(translateType == typeof(bool)) | 247 | if(translateType == typeof(bool)) |
248 | { | 248 | { |
249 | return (lowerVal == "true" || lowerVal == "1" || lowerVal == "y" || lowerVal == "yes" || lowerVal == "on"); | 249 | return (lowerVal == "true" || lowerVal == "1" || lowerVal == "y" || lowerVal == "yes" || lowerVal == "on"); |
250 | } | 250 | } |
251 | else if(translateType == typeof(int)) | 251 | else if(translateType == typeof(int)) |
252 | { | 252 | { |
253 | return (Int32.Parse(translationItem)); | 253 | return (Int32.Parse(translationItem)); |
254 | } | 254 | } |
255 | else | 255 | else |
256 | { | 256 | { |
257 | return translationItem; | 257 | return translationItem; |
258 | } | 258 | } |
259 | } | 259 | } |
260 | catch(FormatException) | 260 | catch(FormatException) |
261 | { | 261 | { |
262 | return null; | 262 | return null; |
263 | } | 263 | } |
264 | } | 264 | } |
265 | 265 | ||
266 | /// <summary> | 266 | /// <summary> |
267 | /// Deletes if exists. | 267 | /// Deletes if exists. |
268 | /// </summary> | 268 | /// </summary> |
269 | /// <param name="file">The file.</param> | 269 | /// <param name="file">The file.</param> |
270 | /// <returns></returns> | 270 | /// <returns></returns> |
271 | public static bool DeleteIfExists(string file) | 271 | public static bool DeleteIfExists(string file) |
272 | { | 272 | { |
273 | string resFile = null; | 273 | string resFile = null; |
274 | try | 274 | try |
275 | { | 275 | { |
276 | resFile = ResolvePath(file); | 276 | resFile = ResolvePath(file); |
277 | } | 277 | } |
278 | catch(ArgumentException) | 278 | catch(ArgumentException) |
279 | { | 279 | { |
280 | return false; | 280 | return false; |
281 | } | 281 | } |
282 | 282 | ||
283 | if(!File.Exists(resFile)) | 283 | if(!File.Exists(resFile)) |
284 | { | 284 | { |
285 | return false; | 285 | return false; |
286 | } | 286 | } |
287 | 287 | ||
288 | File.Delete(resFile); | 288 | File.Delete(resFile); |
289 | return true; | 289 | return true; |
290 | } | 290 | } |
291 | 291 | ||
292 | // This little gem was taken from the NeL source, thanks guys! | 292 | // This little gem was taken from the NeL source, thanks guys! |
293 | /// <summary> | 293 | /// <summary> |
294 | /// Makes a relative path | 294 | /// Makes a relative path |
295 | /// </summary> | 295 | /// </summary> |
296 | /// <param name="startPath">Path to start from</param> | 296 | /// <param name="startPath">Path to start from</param> |
297 | /// <param name="endPath">Path to end at</param> | 297 | /// <param name="endPath">Path to end at</param> |
298 | /// <returns>Path that will get from startPath to endPath</returns> | 298 | /// <returns>Path that will get from startPath to endPath</returns> |
299 | public static string MakePathRelativeTo(string startPath, string endPath) | 299 | public static string MakePathRelativeTo(string startPath, string endPath) |
300 | { | 300 | { |
301 | string tmp = NormalizePath(startPath, '/'); | 301 | string tmp = NormalizePath(startPath, '/'); |
302 | string src = NormalizePath(endPath, '/'); | 302 | string src = NormalizePath(endPath, '/'); |
303 | string prefix = ""; | 303 | string prefix = ""; |
304 | 304 | ||
305 | while(true) | 305 | while(true) |
306 | { | 306 | { |
307 | if((String.Compare(tmp, 0, src, 0, tmp.Length) == 0)) | 307 | if((String.Compare(tmp, 0, src, 0, tmp.Length) == 0)) |
308 | { | 308 | { |
309 | string ret; | 309 | string ret; |
310 | int size = tmp.Length; | 310 | int size = tmp.Length; |
311 | if(size == src.Length) | 311 | if(size == src.Length) |
312 | { | 312 | { |
313 | return "./"; | 313 | return "./"; |
314 | } | 314 | } |
315 | if ((src.Length > tmp.Length) && src[tmp.Length-1] != '/' && src[tmp.Length-1] != '\\') | 315 | if ((src.Length > tmp.Length) && src[tmp.Length-1] != '/' && src[tmp.Length-1] != '\\') |
316 | { | 316 | { |
317 | } | 317 | } |
318 | else | 318 | else |
319 | { | 319 | { |
320 | ret = prefix + endPath.Substring(size, endPath.Length - size); | 320 | ret = prefix + endPath.Substring(size, endPath.Length - size); |
321 | ret = ret.Trim(); | 321 | ret = ret.Trim(); |
322 | if(ret[0] == '/' || ret[0] == '\\') | 322 | if(ret[0] == '/' || ret[0] == '\\') |
323 | { | 323 | { |
324 | ret = "." + ret; | 324 | ret = "." + ret; |
325 | } | 325 | } |
326 | 326 | ||
327 | return NormalizePath(ret); | 327 | return NormalizePath(ret); |
328 | } | 328 | } |
329 | 329 | ||
330 | } | 330 | } |
331 | 331 | ||
332 | if(tmp.Length < 2) | 332 | if(tmp.Length < 2) |
333 | { | 333 | { |
334 | break; | 334 | break; |
335 | } | 335 | } |
336 | 336 | ||
337 | int lastPos = tmp.LastIndexOf('/', tmp.Length - 2); | 337 | int lastPos = tmp.LastIndexOf('/', tmp.Length - 2); |
338 | int prevPos = tmp.IndexOf('/'); | 338 | int prevPos = tmp.IndexOf('/'); |
339 | 339 | ||
340 | if((lastPos == prevPos) || (lastPos == -1)) | 340 | if((lastPos == prevPos) || (lastPos == -1)) |
341 | { | 341 | { |
342 | break; | 342 | break; |
343 | } | 343 | } |
344 | 344 | ||
345 | tmp = tmp.Substring(0, lastPos + 1); | 345 | tmp = tmp.Substring(0, lastPos + 1); |
346 | prefix += "../"; | 346 | prefix += "../"; |
347 | } | 347 | } |
348 | 348 | ||
349 | return endPath; | 349 | return endPath; |
350 | } | 350 | } |
351 | 351 | ||
352 | /// <summary> | 352 | /// <summary> |
353 | /// Resolves the path. | 353 | /// Resolves the path. |
354 | /// </summary> | 354 | /// </summary> |
355 | /// <param name="path">The path.</param> | 355 | /// <param name="path">The path.</param> |
356 | /// <returns></returns> | 356 | /// <returns></returns> |
357 | public static string ResolvePath(string path) | 357 | public static string ResolvePath(string path) |
358 | { | 358 | { |
359 | string tmpPath = NormalizePath(path); | 359 | string tmpPath = NormalizePath(path); |
360 | if(tmpPath.Length < 1) | 360 | if(tmpPath.Length < 1) |
361 | { | 361 | { |
362 | tmpPath = "."; | 362 | tmpPath = "."; |
363 | } | 363 | } |
364 | 364 | ||
365 | tmpPath = Path.GetFullPath(tmpPath); | 365 | tmpPath = Path.GetFullPath(tmpPath); |
366 | if(!File.Exists(tmpPath) && !Directory.Exists(tmpPath)) | 366 | if(!File.Exists(tmpPath) && !Directory.Exists(tmpPath)) |
367 | { | 367 | { |
368 | throw new ArgumentException("Path could not be resolved: " + tmpPath); | 368 | throw new ArgumentException("Path could not be resolved: " + tmpPath); |
369 | } | 369 | } |
370 | 370 | ||
371 | return tmpPath; | 371 | return tmpPath; |
372 | } | 372 | } |
373 | 373 | ||
374 | /// <summary> | 374 | /// <summary> |
375 | /// Normalizes the path. | 375 | /// Normalizes the path. |
376 | /// </summary> | 376 | /// </summary> |
377 | /// <param name="path">The path.</param> | 377 | /// <param name="path">The path.</param> |
378 | /// <param name="separatorCharacter">The separator character.</param> | 378 | /// <param name="separatorCharacter">The separator character.</param> |
379 | /// <returns></returns> | 379 | /// <returns></returns> |
380 | public static string NormalizePath(string path, char separatorCharacter) | 380 | public static string NormalizePath(string path, char separatorCharacter) |
381 | { | 381 | { |
382 | if(path == null || path == "" || path.Length < 1) | 382 | if(path == null || path == "" || path.Length < 1) |
383 | { | 383 | { |
384 | return ""; | 384 | return ""; |
385 | } | 385 | } |
386 | 386 | ||
387 | string tmpPath = path.Replace('\\', '/'); | 387 | string tmpPath = path.Replace('\\', '/'); |
388 | tmpPath = tmpPath.Replace('/', separatorCharacter); | 388 | tmpPath = tmpPath.Replace('/', separatorCharacter); |
389 | return tmpPath; | 389 | return tmpPath; |
390 | } | 390 | } |
391 | 391 | ||
392 | /// <summary> | 392 | /// <summary> |
393 | /// Normalizes the path. | 393 | /// Normalizes the path. |
394 | /// </summary> | 394 | /// </summary> |
395 | /// <param name="path">The path.</param> | 395 | /// <param name="path">The path.</param> |
396 | /// <returns></returns> | 396 | /// <returns></returns> |
397 | public static string NormalizePath(string path) | 397 | public static string NormalizePath(string path) |
398 | { | 398 | { |
399 | return NormalizePath(path, Path.DirectorySeparatorChar); | 399 | return NormalizePath(path, Path.DirectorySeparatorChar); |
400 | } | 400 | } |
401 | 401 | ||
402 | /// <summary> | 402 | /// <summary> |
403 | /// Ends the path. | 403 | /// Ends the path. |
404 | /// </summary> | 404 | /// </summary> |
405 | /// <param name="path">The path.</param> | 405 | /// <param name="path">The path.</param> |
406 | /// <param name="separatorCharacter">The separator character.</param> | 406 | /// <param name="separatorCharacter">The separator character.</param> |
407 | /// <returns></returns> | 407 | /// <returns></returns> |
408 | public static string EndPath(string path, char separatorCharacter) | 408 | public static string EndPath(string path, char separatorCharacter) |
409 | { | 409 | { |
410 | if(path == null || path == "" || path.Length < 1) | 410 | if(path == null || path == "" || path.Length < 1) |
411 | { | 411 | { |
412 | return ""; | 412 | return ""; |
413 | } | 413 | } |
414 | 414 | ||
415 | if(!path.EndsWith(separatorCharacter.ToString())) | 415 | if(!path.EndsWith(separatorCharacter.ToString())) |
416 | { | 416 | { |
417 | return (path + separatorCharacter); | 417 | return (path + separatorCharacter); |
418 | } | 418 | } |
419 | 419 | ||
420 | return path; | 420 | return path; |
421 | } | 421 | } |
422 | 422 | ||
423 | /// <summary> | 423 | /// <summary> |
424 | /// Ends the path. | 424 | /// Ends the path. |
425 | /// </summary> | 425 | /// </summary> |
426 | /// <param name="path">The path.</param> | 426 | /// <param name="path">The path.</param> |
427 | /// <returns></returns> | 427 | /// <returns></returns> |
428 | public static string EndPath(string path) | 428 | public static string EndPath(string path) |
429 | { | 429 | { |
430 | return EndPath(path, Path.DirectorySeparatorChar); | 430 | return EndPath(path, Path.DirectorySeparatorChar); |
431 | } | 431 | } |
432 | 432 | ||
433 | /// <summary> | 433 | /// <summary> |
434 | /// Makes the file path. | 434 | /// Makes the file path. |
435 | /// </summary> | 435 | /// </summary> |
436 | /// <param name="path">The path.</param> | 436 | /// <param name="path">The path.</param> |
437 | /// <param name="name">The name.</param> | 437 | /// <param name="name">The name.</param> |
438 | /// <param name="ext">The ext.</param> | 438 | /// <param name="ext">The ext.</param> |
439 | /// <returns></returns> | 439 | /// <returns></returns> |
440 | public static string MakeFilePath(string path, string name, string ext) | 440 | public static string MakeFilePath(string path, string name, string ext) |
441 | { | 441 | { |
442 | string ret = EndPath(NormalizePath(path)); | 442 | string ret = EndPath(NormalizePath(path)); |
443 | 443 | ||
444 | if( name == null ) | 444 | if( name == null ) |
445 | { | 445 | { |
446 | throw new ArgumentNullException("name"); | 446 | throw new ArgumentNullException("name"); |
447 | } | 447 | } |
448 | 448 | ||
449 | ret += name; | 449 | ret += name; |
450 | if(!name.EndsWith("." + ext)) | 450 | if(!name.EndsWith("." + ext)) |
451 | { | 451 | { |
452 | ret += "." + ext; | 452 | ret += "." + ext; |
453 | } | 453 | } |
454 | 454 | ||
455 | //foreach(char c in Path.GetInvalidPathChars()) | 455 | //foreach(char c in Path.GetInvalidPathChars()) |
456 | //{ | 456 | //{ |
457 | // ret = ret.Replace(c, '_'); | 457 | // ret = ret.Replace(c, '_'); |
458 | //} | 458 | //} |
459 | 459 | ||
460 | return ret; | 460 | return ret; |
461 | } | 461 | } |
462 | 462 | ||
463 | /// <summary> | 463 | /// <summary> |
464 | /// Makes the file path. | 464 | /// Makes the file path. |
465 | /// </summary> | 465 | /// </summary> |
466 | /// <param name="path">The path.</param> | 466 | /// <param name="path">The path.</param> |
467 | /// <param name="name">The name.</param> | 467 | /// <param name="name">The name.</param> |
468 | /// <returns></returns> | 468 | /// <returns></returns> |
469 | public static string MakeFilePath(string path, string name) | 469 | public static string MakeFilePath(string path, string name) |
470 | { | 470 | { |
471 | string ret = EndPath(NormalizePath(path)); | 471 | string ret = EndPath(NormalizePath(path)); |
472 | 472 | ||
473 | if( name == null ) | 473 | if( name == null ) |
474 | { | 474 | { |
475 | throw new ArgumentNullException("name"); | 475 | throw new ArgumentNullException("name"); |
476 | } | 476 | } |
477 | 477 | ||
478 | ret += name; | 478 | ret += name; |
479 | 479 | ||
480 | //foreach (char c in Path.GetInvalidPathChars()) | 480 | //foreach (char c in Path.GetInvalidPathChars()) |
481 | //{ | 481 | //{ |
482 | // ret = ret.Replace(c, '_'); | 482 | // ret = ret.Replace(c, '_'); |
483 | //} | 483 | //} |
484 | 484 | ||
485 | return ret; | 485 | return ret; |
486 | } | 486 | } |
487 | 487 | ||
488 | /// <summary> | 488 | /// <summary> |
489 | /// | 489 | /// |
490 | /// </summary> | 490 | /// </summary> |
491 | /// <param name="path"></param> | 491 | /// <param name="path"></param> |
492 | /// <returns></returns> | 492 | /// <returns></returns> |
493 | public static string MakeReferencePath(string path) | 493 | public static string MakeReferencePath(string path) |
494 | { | 494 | { |
495 | string ret = EndPath(NormalizePath(path)); | 495 | string ret = EndPath(NormalizePath(path)); |
496 | 496 | ||
497 | //foreach (char c in Path.GetInvalidPathChars()) | 497 | //foreach (char c in Path.GetInvalidPathChars()) |
498 | //{ | 498 | //{ |
499 | // ret = ret.Replace(c, '_'); | 499 | // ret = ret.Replace(c, '_'); |
500 | //} | 500 | //} |
501 | 501 | ||
502 | return ret; | 502 | return ret; |
503 | } | 503 | } |
504 | 504 | ||
505 | /// <summary> | 505 | /// <summary> |
506 | /// Sets the current dir. | 506 | /// Sets the current dir. |
507 | /// </summary> | 507 | /// </summary> |
508 | /// <param name="path">The path.</param> | 508 | /// <param name="path">The path.</param> |
509 | public static void SetCurrentDir(string path) | 509 | public static void SetCurrentDir(string path) |
510 | { | 510 | { |
511 | if( path == null ) | 511 | if( path == null ) |
512 | { | 512 | { |
513 | throw new ArgumentNullException("path"); | 513 | throw new ArgumentNullException("path"); |
514 | } | 514 | } |
515 | if(path.Length < 1) | 515 | if(path.Length < 1) |
516 | { | 516 | { |
517 | return; | 517 | return; |
518 | } | 518 | } |
519 | 519 | ||
520 | Environment.CurrentDirectory = path; | 520 | Environment.CurrentDirectory = path; |
521 | } | 521 | } |
522 | 522 | ||
523 | /// <summary> | 523 | /// <summary> |
524 | /// Checks the type. | 524 | /// Checks the type. |
525 | /// </summary> | 525 | /// </summary> |
526 | /// <param name="typeToCheck">The type to check.</param> | 526 | /// <param name="typeToCheck">The type to check.</param> |
527 | /// <param name="attr">The attr.</param> | 527 | /// <param name="attr">The attr.</param> |
528 | /// <param name="inter">The inter.</param> | 528 | /// <param name="inter">The inter.</param> |
529 | /// <returns></returns> | 529 | /// <returns></returns> |
530 | public static object CheckType(Type typeToCheck, Type attr, Type inter) | 530 | public static object CheckType(Type typeToCheck, Type attr, Type inter) |
531 | { | 531 | { |
532 | if(typeToCheck == null || attr == null) | 532 | if(typeToCheck == null || attr == null) |
533 | { | 533 | { |
534 | return null; | 534 | return null; |
535 | } | 535 | } |
536 | 536 | ||
537 | object[] attrs = typeToCheck.GetCustomAttributes(attr, false); | 537 | object[] attrs = typeToCheck.GetCustomAttributes(attr, false); |
538 | if(attrs == null || attrs.Length < 1) | 538 | if(attrs == null || attrs.Length < 1) |
539 | { | 539 | { |
540 | return null; | 540 | return null; |
541 | } | 541 | } |
542 | if( inter == null ) | 542 | if( inter == null ) |
543 | { | 543 | { |
544 | throw new ArgumentNullException("inter"); | 544 | throw new ArgumentNullException("inter"); |
545 | } | 545 | } |
546 | 546 | ||
547 | if(typeToCheck.GetInterface(inter.FullName) == null) | 547 | if(typeToCheck.GetInterface(inter.FullName) == null) |
548 | { | 548 | { |
549 | return null; | 549 | return null; |
550 | } | 550 | } |
551 | 551 | ||
552 | return attrs[0]; | 552 | return attrs[0]; |
553 | } | 553 | } |
554 | 554 | ||
555 | /* A bit of overhead for simple group parsing, there are problems with Regex in Mono | 555 | /* A bit of overhead for simple group parsing, there are problems with Regex in Mono |
556 | public static string ParseValue(string val) | 556 | public static string ParseValue(string val) |
557 | { | 557 | { |
558 | if(val == null || val.Length < 1 || !CheckForOSVariables) | 558 | if(val == null || val.Length < 1 || !CheckForOSVariables) |
559 | return val; | 559 | return val; |
560 | 560 | ||
561 | string tmp = val; | 561 | string tmp = val; |
562 | Match m = m_VarRegex.Match(val); | 562 | Match m = m_VarRegex.Match(val); |
563 | while(m.Success) | 563 | while(m.Success) |
564 | { | 564 | { |
565 | if(m.Groups["var"] == null) | 565 | if(m.Groups["var"] == null) |
566 | continue; | 566 | continue; |
567 | 567 | ||
568 | Capture c = m.Groups["var"].Captures[0]; | 568 | Capture c = m.Groups["var"].Captures[0]; |
569 | if(c == null) | 569 | if(c == null) |
570 | continue; | 570 | continue; |
571 | 571 | ||
572 | string var = c.Value; | 572 | string var = c.Value; |
573 | string envVal = Environment.GetEnvironmentVariable(var); | 573 | string envVal = Environment.GetEnvironmentVariable(var); |
574 | if(envVal == null) | 574 | if(envVal == null) |
575 | envVal = ""; | 575 | envVal = ""; |
576 | 576 | ||
577 | tmp = tmp.Replace("${" + var + "}", envVal); | 577 | tmp = tmp.Replace("${" + var + "}", envVal); |
578 | m = m.NextMatch(); | 578 | m = m.NextMatch(); |
579 | } | 579 | } |
580 | 580 | ||
581 | return tmp; | 581 | return tmp; |
582 | }*/ | 582 | }*/ |
583 | 583 | ||
584 | /// <summary> | 584 | /// <summary> |
585 | /// Attributes the value. | 585 | /// Attributes the value. |
586 | /// </summary> | 586 | /// </summary> |
587 | /// <param name="node">The node.</param> | 587 | /// <param name="node">The node.</param> |
588 | /// <param name="attr">The attr.</param> | 588 | /// <param name="attr">The attr.</param> |
589 | /// <param name="def">The def.</param> | 589 | /// <param name="def">The def.</param> |
590 | /// <returns></returns> | 590 | /// <returns></returns> |
591 | public static string AttributeValue(XmlNode node, string attr, string def) | 591 | public static string AttributeValue(XmlNode node, string attr, string def) |
592 | { | 592 | { |
593 | if( node == null ) | 593 | if( node == null ) |
594 | { | 594 | { |
595 | throw new ArgumentNullException("node"); | 595 | throw new ArgumentNullException("node"); |
596 | } | 596 | } |
597 | if(node.Attributes[attr] == null) | 597 | if(node.Attributes[attr] == null) |
598 | { | 598 | { |
599 | return def; | 599 | return def; |
600 | } | 600 | } |
601 | string val = node.Attributes[attr].Value; | 601 | string val = node.Attributes[attr].Value; |
602 | if(!CheckForOSVariables) | 602 | if(!CheckForOSVariables) |
603 | { | 603 | { |
604 | return val; | 604 | return val; |
605 | } | 605 | } |
606 | 606 | ||
607 | return InterpolateForEnvironmentVariables(val); | 607 | return InterpolateForEnvironmentVariables(val); |
608 | } | 608 | } |
609 | 609 | ||
610 | /// <summary> | 610 | /// <summary> |
611 | /// Parses the boolean. | 611 | /// Parses the boolean. |
612 | /// </summary> | 612 | /// </summary> |
613 | /// <param name="node">The node.</param> | 613 | /// <param name="node">The node.</param> |
614 | /// <param name="attr">The attr.</param> | 614 | /// <param name="attr">The attr.</param> |
615 | /// <param name="defaultValue">if set to <c>true</c> [default value].</param> | 615 | /// <param name="defaultValue">if set to <c>true</c> [default value].</param> |
616 | /// <returns></returns> | 616 | /// <returns></returns> |
617 | public static bool ParseBoolean(XmlNode node, string attr, bool defaultValue) | 617 | public static bool ParseBoolean(XmlNode node, string attr, bool defaultValue) |
618 | { | 618 | { |
619 | if( node == null ) | 619 | if( node == null ) |
620 | { | 620 | { |
621 | throw new ArgumentNullException("node"); | 621 | throw new ArgumentNullException("node"); |
622 | } | 622 | } |
623 | if(node.Attributes[attr] == null) | 623 | if(node.Attributes[attr] == null) |
624 | { | 624 | { |
625 | return defaultValue; | 625 | return defaultValue; |
626 | } | 626 | } |
627 | return bool.Parse(node.Attributes[attr].Value); | 627 | return bool.Parse(node.Attributes[attr].Value); |
628 | } | 628 | } |
629 | 629 | ||
630 | /// <summary> | 630 | /// <summary> |
631 | /// Enums the attribute value. | 631 | /// Enums the attribute value. |
632 | /// </summary> | 632 | /// </summary> |
633 | /// <param name="node">The node.</param> | 633 | /// <param name="node">The node.</param> |
634 | /// <param name="attr">The attr.</param> | 634 | /// <param name="attr">The attr.</param> |
635 | /// <param name="enumType">Type of the enum.</param> | 635 | /// <param name="enumType">Type of the enum.</param> |
636 | /// <param name="def">The def.</param> | 636 | /// <param name="def">The def.</param> |
637 | /// <returns></returns> | 637 | /// <returns></returns> |
638 | public static object EnumAttributeValue(XmlNode node, string attr, Type enumType, object def) | 638 | public static object EnumAttributeValue(XmlNode node, string attr, Type enumType, object def) |
639 | { | 639 | { |
640 | if( def == null ) | 640 | if( def == null ) |
641 | { | 641 | { |
642 | throw new ArgumentNullException("def"); | 642 | throw new ArgumentNullException("def"); |
643 | } | 643 | } |
644 | string val = AttributeValue(node, attr, def.ToString()); | 644 | string val = AttributeValue(node, attr, def.ToString()); |
645 | return Enum.Parse(enumType, val, true); | 645 | return Enum.Parse(enumType, val, true); |
646 | } | 646 | } |
647 | 647 | ||
648 | /// <summary> | 648 | /// <summary> |
649 | /// | 649 | /// |
650 | /// </summary> | 650 | /// </summary> |
651 | /// <param name="assemblyName"></param> | 651 | /// <param name="assemblyName"></param> |
652 | /// <param name="projectType"></param> | 652 | /// <param name="projectType"></param> |
653 | /// <returns></returns> | 653 | /// <returns></returns> |
654 | public static string AssemblyFullName(string assemblyName, ProjectType projectType) | 654 | public static string AssemblyFullName(string assemblyName, ProjectType projectType) |
655 | { | 655 | { |
656 | return assemblyName + (projectType == ProjectType.Library ? ".dll" : ".exe"); | 656 | return assemblyName + (projectType == ProjectType.Library ? ".dll" : ".exe"); |
657 | } | 657 | } |
658 | 658 | ||
659 | #endregion | 659 | #endregion |
660 | } | 660 | } |
661 | } | 661 | } |
diff --git a/Prebuild/src/Core/Utilities/Log.cs b/Prebuild/src/Core/Utilities/Log.cs index da2cc96..2f26557 100644 --- a/Prebuild/src/Core/Utilities/Log.cs +++ b/Prebuild/src/Core/Utilities/Log.cs | |||
@@ -1,279 +1,279 @@ | |||
1 | #region BSD License | 1 | #region BSD License |
2 | /* | 2 | /* |
3 | Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) | 3 | Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) |
4 | 4 | ||
5 | Redistribution and use in source and binary forms, with or without modification, are permitted | 5 | Redistribution and use in source and binary forms, with or without modification, are permitted |
6 | provided that the following conditions are met: | 6 | provided that the following conditions are met: |
7 | 7 | ||
8 | * Redistributions of source code must retain the above copyright notice, this list of conditions | 8 | * Redistributions of source code must retain the above copyright notice, this list of conditions |
9 | and the following disclaimer. | 9 | and the following disclaimer. |
10 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions | 10 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions |
11 | and the following disclaimer in the documentation and/or other materials provided with the | 11 | and the following disclaimer in the documentation and/or other materials provided with the |
12 | distribution. | 12 | distribution. |
13 | * The name of the author may not be used to endorse or promote products derived from this software | 13 | * The name of the author may not be used to endorse or promote products derived from this software |
14 | without specific prior written permission. | 14 | without specific prior written permission. |
15 | 15 | ||
16 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, | 16 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, |
17 | BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | 17 | BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
18 | ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | 18 | ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
19 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | 19 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
20 | OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY | 20 | OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
21 | OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | 21 | OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING |
22 | IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 22 | IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
23 | */ | 23 | */ |
24 | #endregion | 24 | #endregion |
25 | 25 | ||
26 | #region CVS Information | 26 | #region CVS Information |
27 | /* | 27 | /* |
28 | * $Source$ | 28 | * $Source$ |
29 | * $Author: jendave $ | 29 | * $Author: jendave $ |
30 | * $Date: 2006-01-28 01:49:58 +0100 (lö, 28 jan 2006) $ | 30 | * $Date: 2006-01-28 01:49:58 +0100 (lö, 28 jan 2006) $ |
31 | * $Revision: 71 $ | 31 | * $Revision: 71 $ |
32 | */ | 32 | */ |
33 | #endregion | 33 | #endregion |
34 | 34 | ||
35 | using System; | 35 | using System; |
36 | using System.IO; | 36 | using System.IO; |
37 | 37 | ||
38 | namespace Prebuild.Core.Utilities | 38 | namespace Prebuild.Core.Utilities |
39 | { | 39 | { |
40 | /// <summary> | 40 | /// <summary> |
41 | /// | 41 | /// |
42 | /// </summary> | 42 | /// </summary> |
43 | public enum LogType | 43 | public enum LogType |
44 | { | 44 | { |
45 | /// <summary> | 45 | /// <summary> |
46 | /// | 46 | /// |
47 | /// </summary> | 47 | /// </summary> |
48 | None, | 48 | None, |
49 | /// <summary> | 49 | /// <summary> |
50 | /// | 50 | /// |
51 | /// </summary> | 51 | /// </summary> |
52 | Info, | 52 | Info, |
53 | /// <summary> | 53 | /// <summary> |
54 | /// | 54 | /// |
55 | /// </summary> | 55 | /// </summary> |
56 | Warning, | 56 | Warning, |
57 | /// <summary> | 57 | /// <summary> |
58 | /// | 58 | /// |
59 | /// </summary> | 59 | /// </summary> |
60 | Error | 60 | Error |
61 | } | 61 | } |
62 | 62 | ||
63 | /// <summary> | 63 | /// <summary> |
64 | /// | 64 | /// |
65 | /// </summary> | 65 | /// </summary> |
66 | [Flags] | 66 | [Flags] |
67 | public enum LogTargets | 67 | public enum LogTargets |
68 | { | 68 | { |
69 | /// <summary> | 69 | /// <summary> |
70 | /// | 70 | /// |
71 | /// </summary> | 71 | /// </summary> |
72 | None = 0, | 72 | None = 0, |
73 | /// <summary> | 73 | /// <summary> |
74 | /// | 74 | /// |
75 | /// </summary> | 75 | /// </summary> |
76 | Null = 1, | 76 | Null = 1, |
77 | /// <summary> | 77 | /// <summary> |
78 | /// | 78 | /// |
79 | /// </summary> | 79 | /// </summary> |
80 | File = 2, | 80 | File = 2, |
81 | /// <summary> | 81 | /// <summary> |
82 | /// | 82 | /// |
83 | /// </summary> | 83 | /// </summary> |
84 | Console = 4 | 84 | Console = 4 |
85 | } | 85 | } |
86 | 86 | ||
87 | /// <summary> | 87 | /// <summary> |
88 | /// Summary description for Log. | 88 | /// Summary description for Log. |
89 | /// </summary> | 89 | /// </summary> |
90 | public class Log : IDisposable | 90 | public class Log : IDisposable |
91 | { | 91 | { |
92 | #region Fields | 92 | #region Fields |
93 | 93 | ||
94 | private StreamWriter m_Writer; | 94 | private StreamWriter m_Writer; |
95 | private LogTargets m_Target = LogTargets.Null; | 95 | private LogTargets m_Target = LogTargets.Null; |
96 | bool disposed; | 96 | bool disposed; |
97 | 97 | ||
98 | #endregion | 98 | #endregion |
99 | 99 | ||
100 | #region Constructors | 100 | #region Constructors |
101 | 101 | ||
102 | /// <summary> | 102 | /// <summary> |
103 | /// Initializes a new instance of the <see cref="Log"/> class. | 103 | /// Initializes a new instance of the <see cref="Log"/> class. |
104 | /// </summary> | 104 | /// </summary> |
105 | /// <param name="target">The target.</param> | 105 | /// <param name="target">The target.</param> |
106 | /// <param name="fileName">Name of the file.</param> | 106 | /// <param name="fileName">Name of the file.</param> |
107 | public Log(LogTargets target, string fileName) | 107 | public Log(LogTargets target, string fileName) |
108 | { | 108 | { |
109 | m_Target = target; | 109 | m_Target = target; |
110 | 110 | ||
111 | if((m_Target & LogTargets.File) != 0) | 111 | if((m_Target & LogTargets.File) != 0) |
112 | { | 112 | { |
113 | m_Writer = new StreamWriter(fileName, false); | 113 | m_Writer = new StreamWriter(fileName, false); |
114 | } | 114 | } |
115 | } | 115 | } |
116 | 116 | ||
117 | #endregion | 117 | #endregion |
118 | 118 | ||
119 | #region Public Methods | 119 | #region Public Methods |
120 | 120 | ||
121 | /// <summary> | 121 | /// <summary> |
122 | /// Writes this instance. | 122 | /// Writes this instance. |
123 | /// </summary> | 123 | /// </summary> |
124 | public void Write() | 124 | public void Write() |
125 | { | 125 | { |
126 | Write(string.Empty); | 126 | Write(string.Empty); |
127 | } | 127 | } |
128 | 128 | ||
129 | /// <summary> | 129 | /// <summary> |
130 | /// Writes the specified MSG. | 130 | /// Writes the specified MSG. |
131 | /// </summary> | 131 | /// </summary> |
132 | /// <param name="msg">The MSG.</param> | 132 | /// <param name="msg">The MSG.</param> |
133 | public void Write(string msg) | 133 | public void Write(string msg) |
134 | { | 134 | { |
135 | if((m_Target & LogTargets.Null) != 0) | 135 | if((m_Target & LogTargets.Null) != 0) |
136 | { | 136 | { |
137 | return; | 137 | return; |
138 | } | 138 | } |
139 | 139 | ||
140 | if((m_Target & LogTargets.Console) != 0) | 140 | if((m_Target & LogTargets.Console) != 0) |
141 | { | 141 | { |
142 | Console.WriteLine(msg); | 142 | Console.WriteLine(msg); |
143 | } | 143 | } |
144 | if((m_Target & LogTargets.File) != 0 && m_Writer != null) | 144 | if((m_Target & LogTargets.File) != 0 && m_Writer != null) |
145 | { | 145 | { |
146 | m_Writer.WriteLine(msg); | 146 | m_Writer.WriteLine(msg); |
147 | } | 147 | } |
148 | } | 148 | } |
149 | 149 | ||
150 | /// <summary> | 150 | /// <summary> |
151 | /// Writes the specified format. | 151 | /// Writes the specified format. |
152 | /// </summary> | 152 | /// </summary> |
153 | /// <param name="format">The format.</param> | 153 | /// <param name="format">The format.</param> |
154 | /// <param name="args">The args.</param> | 154 | /// <param name="args">The args.</param> |
155 | public void Write(string format, params object[] args) | 155 | public void Write(string format, params object[] args) |
156 | { | 156 | { |
157 | Write(string.Format(format,args)); | 157 | Write(string.Format(format,args)); |
158 | } | 158 | } |
159 | 159 | ||
160 | /// <summary> | 160 | /// <summary> |
161 | /// Writes the specified type. | 161 | /// Writes the specified type. |
162 | /// </summary> | 162 | /// </summary> |
163 | /// <param name="type">The type.</param> | 163 | /// <param name="type">The type.</param> |
164 | /// <param name="format">The format.</param> | 164 | /// <param name="format">The format.</param> |
165 | /// <param name="args">The args.</param> | 165 | /// <param name="args">The args.</param> |
166 | public void Write(LogType type, string format, params object[] args) | 166 | public void Write(LogType type, string format, params object[] args) |
167 | { | 167 | { |
168 | if((m_Target & LogTargets.Null) != 0) | 168 | if((m_Target & LogTargets.Null) != 0) |
169 | { | 169 | { |
170 | return; | 170 | return; |
171 | } | 171 | } |
172 | 172 | ||
173 | string str = ""; | 173 | string str = ""; |
174 | switch(type) | 174 | switch(type) |
175 | { | 175 | { |
176 | case LogType.Info: | 176 | case LogType.Info: |
177 | str = "[I] "; | 177 | str = "[I] "; |
178 | break; | 178 | break; |
179 | case LogType.Warning: | 179 | case LogType.Warning: |
180 | str = "[!] "; | 180 | str = "[!] "; |
181 | break; | 181 | break; |
182 | case LogType.Error: | 182 | case LogType.Error: |
183 | str = "[X] "; | 183 | str = "[X] "; |
184 | break; | 184 | break; |
185 | } | 185 | } |
186 | 186 | ||
187 | Write(str + format,args); | 187 | Write(str + format,args); |
188 | } | 188 | } |
189 | 189 | ||
190 | /// <summary> | 190 | /// <summary> |
191 | /// Writes the exception. | 191 | /// Writes the exception. |
192 | /// </summary> | 192 | /// </summary> |
193 | /// <param name="type">The type.</param> | 193 | /// <param name="type">The type.</param> |
194 | /// <param name="ex">The ex.</param> | 194 | /// <param name="ex">The ex.</param> |
195 | public void WriteException(LogType type, Exception ex) | 195 | public void WriteException(LogType type, Exception ex) |
196 | { | 196 | { |
197 | if(ex != null) | 197 | if(ex != null) |
198 | { | 198 | { |
199 | Write(type, ex.Message); | 199 | Write(type, ex.Message); |
200 | //#if DEBUG | 200 | //#if DEBUG |
201 | m_Writer.WriteLine("Exception @{0} stack trace [[", ex.TargetSite.Name); | 201 | m_Writer.WriteLine("Exception @{0} stack trace [[", ex.TargetSite.Name); |
202 | m_Writer.WriteLine(ex.StackTrace); | 202 | m_Writer.WriteLine(ex.StackTrace); |
203 | m_Writer.WriteLine("]]"); | 203 | m_Writer.WriteLine("]]"); |
204 | //#endif | 204 | //#endif |
205 | } | 205 | } |
206 | } | 206 | } |
207 | 207 | ||
208 | /// <summary> | 208 | /// <summary> |
209 | /// Flushes this instance. | 209 | /// Flushes this instance. |
210 | /// </summary> | 210 | /// </summary> |
211 | public void Flush() | 211 | public void Flush() |
212 | { | 212 | { |
213 | if(m_Writer != null) | 213 | if(m_Writer != null) |
214 | { | 214 | { |
215 | m_Writer.Flush(); | 215 | m_Writer.Flush(); |
216 | } | 216 | } |
217 | } | 217 | } |
218 | 218 | ||
219 | #endregion | 219 | #endregion |
220 | 220 | ||
221 | #region IDisposable Members | 221 | #region IDisposable Members |
222 | 222 | ||
223 | /// <summary> | 223 | /// <summary> |
224 | /// Performs application-defined tasks associated with freeing, releasing, or | 224 | /// Performs application-defined tasks associated with freeing, releasing, or |
225 | /// resetting unmanaged resources. | 225 | /// resetting unmanaged resources. |
226 | /// </summary> | 226 | /// </summary> |
227 | public void Dispose() | 227 | public void Dispose() |
228 | { | 228 | { |
229 | Dispose(true); | 229 | Dispose(true); |
230 | GC.SuppressFinalize(this); | 230 | GC.SuppressFinalize(this); |
231 | } | 231 | } |
232 | 232 | ||
233 | /// <summary> | 233 | /// <summary> |
234 | /// Dispose objects | 234 | /// Dispose objects |
235 | /// </summary> | 235 | /// </summary> |
236 | /// <param name="disposing"> | 236 | /// <param name="disposing"> |
237 | /// If true, it will dispose close the handle | 237 | /// If true, it will dispose close the handle |
238 | /// </param> | 238 | /// </param> |
239 | /// <remarks> | 239 | /// <remarks> |
240 | /// Will dispose managed and unmanaged resources. | 240 | /// Will dispose managed and unmanaged resources. |
241 | /// </remarks> | 241 | /// </remarks> |
242 | protected virtual void Dispose(bool disposing) | 242 | protected virtual void Dispose(bool disposing) |
243 | { | 243 | { |
244 | if (!this.disposed) | 244 | if (!this.disposed) |
245 | { | 245 | { |
246 | if (disposing) | 246 | if (disposing) |
247 | { | 247 | { |
248 | if (m_Writer != null) | 248 | if (m_Writer != null) |
249 | { | 249 | { |
250 | m_Writer.Close(); | 250 | m_Writer.Close(); |
251 | m_Writer = null; | 251 | m_Writer = null; |
252 | } | 252 | } |
253 | } | 253 | } |
254 | } | 254 | } |
255 | this.disposed = true; | 255 | this.disposed = true; |
256 | } | 256 | } |
257 | 257 | ||
258 | /// <summary> | 258 | /// <summary> |
259 | /// | 259 | /// |
260 | /// </summary> | 260 | /// </summary> |
261 | ~Log() | 261 | ~Log() |
262 | { | 262 | { |
263 | this.Dispose(false); | 263 | this.Dispose(false); |
264 | } | 264 | } |
265 | 265 | ||
266 | /// <summary> | 266 | /// <summary> |
267 | /// Closes and destroys this object | 267 | /// Closes and destroys this object |
268 | /// </summary> | 268 | /// </summary> |
269 | /// <remarks> | 269 | /// <remarks> |
270 | /// Same as Dispose(true) | 270 | /// Same as Dispose(true) |
271 | /// </remarks> | 271 | /// </remarks> |
272 | public void Close() | 272 | public void Close() |
273 | { | 273 | { |
274 | Dispose(); | 274 | Dispose(); |
275 | } | 275 | } |
276 | 276 | ||
277 | #endregion | 277 | #endregion |
278 | } | 278 | } |
279 | } | 279 | } |
diff --git a/Prebuild/src/Core/WarningException.cs b/Prebuild/src/Core/WarningException.cs index a200bdc..ce685cd 100644 --- a/Prebuild/src/Core/WarningException.cs +++ b/Prebuild/src/Core/WarningException.cs | |||
@@ -1,93 +1,93 @@ | |||
1 | #region BSD License | 1 | #region BSD License |
2 | /* | 2 | /* |
3 | Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) | 3 | Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) |
4 | 4 | ||
5 | Redistribution and use in source and binary forms, with or without modification, are permitted | 5 | Redistribution and use in source and binary forms, with or without modification, are permitted |
6 | provided that the following conditions are met: | 6 | provided that the following conditions are met: |
7 | 7 | ||
8 | * Redistributions of source code must retain the above copyright notice, this list of conditions | 8 | * Redistributions of source code must retain the above copyright notice, this list of conditions |
9 | and the following disclaimer. | 9 | and the following disclaimer. |
10 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions | 10 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions |
11 | and the following disclaimer in the documentation and/or other materials provided with the | 11 | and the following disclaimer in the documentation and/or other materials provided with the |
12 | distribution. | 12 | distribution. |
13 | * The name of the author may not be used to endorse or promote products derived from this software | 13 | * The name of the author may not be used to endorse or promote products derived from this software |
14 | without specific prior written permission. | 14 | without specific prior written permission. |
15 | 15 | ||
16 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, | 16 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, |
17 | BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | 17 | BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
18 | ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | 18 | ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
19 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | 19 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
20 | OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY | 20 | OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
21 | OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | 21 | OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING |
22 | IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 22 | IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
23 | */ | 23 | */ |
24 | #endregion | 24 | #endregion |
25 | 25 | ||
26 | #region CVS Information | 26 | #region CVS Information |
27 | /* | 27 | /* |
28 | * $Source$ | 28 | * $Source$ |
29 | * $Author: jendave $ | 29 | * $Author: jendave $ |
30 | * $Date: 2006-01-28 01:49:58 +0100 (lö, 28 jan 2006) $ | 30 | * $Date: 2006-01-28 01:49:58 +0100 (lö, 28 jan 2006) $ |
31 | * $Revision: 71 $ | 31 | * $Revision: 71 $ |
32 | */ | 32 | */ |
33 | #endregion | 33 | #endregion |
34 | 34 | ||
35 | using System; | 35 | using System; |
36 | using System.Runtime.Serialization; | 36 | using System.Runtime.Serialization; |
37 | 37 | ||
38 | namespace Prebuild.Core | 38 | namespace Prebuild.Core |
39 | { | 39 | { |
40 | /// <summary> | 40 | /// <summary> |
41 | /// | 41 | /// |
42 | /// </summary> | 42 | /// </summary> |
43 | [Serializable()] | 43 | [Serializable()] |
44 | public class WarningException : Exception | 44 | public class WarningException : Exception |
45 | { | 45 | { |
46 | #region Constructors | 46 | #region Constructors |
47 | 47 | ||
48 | /// <summary> | 48 | /// <summary> |
49 | /// | 49 | /// |
50 | /// </summary> | 50 | /// </summary> |
51 | public WarningException() | 51 | public WarningException() |
52 | { | 52 | { |
53 | } | 53 | } |
54 | 54 | ||
55 | /// <summary> | 55 | /// <summary> |
56 | /// | 56 | /// |
57 | /// </summary> | 57 | /// </summary> |
58 | /// <param name="format"></param> | 58 | /// <param name="format"></param> |
59 | /// <param name="args"></param> | 59 | /// <param name="args"></param> |
60 | public WarningException(string format, params object[] args) | 60 | public WarningException(string format, params object[] args) |
61 | : base(String.Format(format, args)) | 61 | : base(String.Format(format, args)) |
62 | { | 62 | { |
63 | } | 63 | } |
64 | 64 | ||
65 | /// <summary> | 65 | /// <summary> |
66 | /// Exception with specified string | 66 | /// Exception with specified string |
67 | /// </summary> | 67 | /// </summary> |
68 | /// <param name="message">Exception message</param> | 68 | /// <param name="message">Exception message</param> |
69 | public WarningException(string message): base(message) | 69 | public WarningException(string message): base(message) |
70 | { | 70 | { |
71 | } | 71 | } |
72 | 72 | ||
73 | /// <summary> | 73 | /// <summary> |
74 | /// | 74 | /// |
75 | /// </summary> | 75 | /// </summary> |
76 | /// <param name="message"></param> | 76 | /// <param name="message"></param> |
77 | /// <param name="exception"></param> | 77 | /// <param name="exception"></param> |
78 | public WarningException(string message, Exception exception) : base(message, exception) | 78 | public WarningException(string message, Exception exception) : base(message, exception) |
79 | { | 79 | { |
80 | } | 80 | } |
81 | 81 | ||
82 | /// <summary> | 82 | /// <summary> |
83 | /// | 83 | /// |
84 | /// </summary> | 84 | /// </summary> |
85 | /// <param name="info"></param> | 85 | /// <param name="info"></param> |
86 | /// <param name="context"></param> | 86 | /// <param name="context"></param> |
87 | protected WarningException(SerializationInfo info, StreamingContext context) : base( info, context ) | 87 | protected WarningException(SerializationInfo info, StreamingContext context) : base( info, context ) |
88 | { | 88 | { |
89 | } | 89 | } |
90 | 90 | ||
91 | #endregion | 91 | #endregion |
92 | } | 92 | } |
93 | } | 93 | } |