diff options
Diffstat (limited to '')
-rw-r--r-- | Prebuild/src/Core/Nodes/SolutionNode.cs | 576 |
1 files changed, 288 insertions, 288 deletions
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 | } |