diff options
Diffstat (limited to 'Prebuild/src/Core/Nodes/SolutionNode.cs')
-rw-r--r-- | Prebuild/src/Core/Nodes/SolutionNode.cs | 516 |
1 files changed, 258 insertions, 258 deletions
diff --git a/Prebuild/src/Core/Nodes/SolutionNode.cs b/Prebuild/src/Core/Nodes/SolutionNode.cs index 10c0223..e1d5b3b 100644 --- a/Prebuild/src/Core/Nodes/SolutionNode.cs +++ b/Prebuild/src/Core/Nodes/SolutionNode.cs | |||
@@ -5,16 +5,16 @@ Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehea | |||
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 |
@@ -34,35 +34,35 @@ using Prebuild.Core.Utilities; | |||
34 | 34 | ||
35 | namespace Prebuild.Core.Nodes | 35 | namespace Prebuild.Core.Nodes |
36 | { | 36 | { |
37 | /// <summary> | 37 | /// <summary> |
38 | /// | 38 | /// |
39 | /// </summary> | 39 | /// </summary> |
40 | [DataNode("Solution")] | 40 | [DataNode("Solution")] |
41 | [DataNode("EmbeddedSolution")] | 41 | [DataNode("EmbeddedSolution")] |
42 | [DebuggerDisplay("{Name}")] | 42 | [DebuggerDisplay("{Name}")] |
43 | public class SolutionNode : DataNode | 43 | public class SolutionNode : DataNode |
44 | { | 44 | { |
45 | #region Fields | 45 | #region Fields |
46 | 46 | ||
47 | private Guid m_Guid = Guid.NewGuid(); | 47 | private Guid m_Guid = Guid.NewGuid(); |
48 | private string m_Name = "unknown"; | 48 | private string m_Name = "unknown"; |
49 | private string m_Path = ""; | 49 | private string m_Path = ""; |
50 | private string m_FullPath = ""; | 50 | private string m_FullPath = ""; |
51 | private string m_ActiveConfig; | 51 | private string m_ActiveConfig; |
52 | private string m_Version = "1.0.0"; | 52 | private string m_Version = "1.0.0"; |
53 | 53 | ||
54 | private OptionsNode m_Options; | 54 | private OptionsNode m_Options; |
55 | private FilesNode m_Files; | 55 | private FilesNode m_Files; |
56 | private readonly ConfigurationNodeCollection m_Configurations = new ConfigurationNodeCollection(); | 56 | private readonly ConfigurationNodeCollection m_Configurations = new ConfigurationNodeCollection(); |
57 | private readonly Dictionary<string, ProjectNode> m_Projects = new Dictionary<string, ProjectNode>(); | 57 | private readonly Dictionary<string, ProjectNode> m_Projects = new Dictionary<string, ProjectNode>(); |
58 | private readonly Dictionary<string, DatabaseProjectNode> m_DatabaseProjects = new Dictionary<string, DatabaseProjectNode>(); | 58 | private readonly Dictionary<string, DatabaseProjectNode> m_DatabaseProjects = new Dictionary<string, DatabaseProjectNode>(); |
59 | private readonly List<ProjectNode> m_ProjectsOrder = new List<ProjectNode>(); | 59 | private readonly List<ProjectNode> m_ProjectsOrder = new List<ProjectNode>(); |
60 | private readonly Dictionary<string, SolutionNode> m_Solutions = new Dictionary<string, SolutionNode>(); | 60 | private readonly Dictionary<string, SolutionNode> m_Solutions = new Dictionary<string, SolutionNode>(); |
61 | private CleanupNode m_Cleanup; | 61 | private CleanupNode m_Cleanup; |
62 | 62 | ||
63 | #endregion | 63 | #endregion |
64 | 64 | ||
65 | #region Properties | 65 | #region Properties |
66 | public override IDataNode Parent | 66 | public override IDataNode Parent |
67 | { | 67 | { |
68 | get | 68 | get |
@@ -84,142 +84,142 @@ namespace Prebuild.Core.Nodes | |||
84 | } | 84 | } |
85 | } | 85 | } |
86 | 86 | ||
87 | public CleanupNode Cleanup | 87 | public CleanupNode Cleanup |
88 | { | 88 | { |
89 | get | 89 | get |
90 | { | 90 | { |
91 | return m_Cleanup; | 91 | return m_Cleanup; |
92 | } | 92 | } |
93 | set | 93 | set |
94 | { | 94 | { |
95 | m_Cleanup = value; | 95 | m_Cleanup = value; |
96 | } | 96 | } |
97 | } | 97 | } |
98 | 98 | ||
99 | public Guid Guid | 99 | public Guid Guid |
100 | { | 100 | { |
101 | get | 101 | get |
102 | { | 102 | { |
103 | return m_Guid; | 103 | return m_Guid; |
104 | } | 104 | } |
105 | set | 105 | set |
106 | { | 106 | { |
107 | m_Guid = value; | 107 | m_Guid = value; |
108 | } | ||
109 | } | ||
110 | /// <summary> | ||
111 | /// Gets or sets the active config. | ||
112 | /// </summary> | ||
113 | /// <value>The active config.</value> | ||
114 | public string ActiveConfig | ||
115 | { | ||
116 | get | ||
117 | { | ||
118 | return m_ActiveConfig; | ||
119 | } | ||
120 | set | ||
121 | { | ||
122 | m_ActiveConfig = value; | ||
123 | } | ||
124 | } | ||
125 | |||
126 | /// <summary> | ||
127 | /// Gets the name. | ||
128 | /// </summary> | ||
129 | /// <value>The name.</value> | ||
130 | public string Name | ||
131 | { | ||
132 | get | ||
133 | { | ||
134 | return m_Name; | ||
135 | } | ||
136 | } | ||
137 | |||
138 | /// <summary> | ||
139 | /// Gets the path. | ||
140 | /// </summary> | ||
141 | /// <value>The path.</value> | ||
142 | public string Path | ||
143 | { | ||
144 | get | ||
145 | { | ||
146 | return m_Path; | ||
147 | } | ||
148 | } | ||
149 | |||
150 | /// <summary> | ||
151 | /// Gets the full path. | ||
152 | /// </summary> | ||
153 | /// <value>The full path.</value> | ||
154 | public string FullPath | ||
155 | { | ||
156 | get | ||
157 | { | ||
158 | return m_FullPath; | ||
159 | } | ||
160 | } | ||
161 | |||
162 | /// <summary> | ||
163 | /// Gets the version. | ||
164 | /// </summary> | ||
165 | /// <value>The version.</value> | ||
166 | public string Version | ||
167 | { | ||
168 | get | ||
169 | { | ||
170 | return m_Version; | ||
171 | } | ||
172 | } | ||
173 | |||
174 | /// <summary> | ||
175 | /// Gets the options. | ||
176 | /// </summary> | ||
177 | /// <value>The options.</value> | ||
178 | public OptionsNode Options | ||
179 | { | ||
180 | get | ||
181 | { | ||
182 | return m_Options; | ||
183 | } | ||
184 | } | ||
185 | |||
186 | /// <summary> | ||
187 | /// Gets the files. | ||
188 | /// </summary> | ||
189 | /// <value>The files.</value> | ||
190 | public FilesNode Files | ||
191 | { | ||
192 | get | ||
193 | { | ||
194 | return m_Files; | ||
195 | } | ||
196 | } | ||
197 | |||
198 | /// <summary> | ||
199 | /// Gets the configurations. | ||
200 | /// </summary> | ||
201 | /// <value>The configurations.</value> | ||
202 | public ConfigurationNodeCollection Configurations | ||
203 | { | ||
204 | get | ||
205 | { | ||
206 | ConfigurationNodeCollection tmp = new ConfigurationNodeCollection(); | ||
207 | tmp.AddRange(ConfigurationsTable); | ||
208 | return tmp; | ||
209 | } | ||
210 | } | ||
211 | |||
212 | /// <summary> | ||
213 | /// Gets the configurations table. | ||
214 | /// </summary> | ||
215 | /// <value>The configurations table.</value> | ||
216 | public ConfigurationNodeCollection ConfigurationsTable | ||
217 | { | ||
218 | get | ||
219 | { | ||
220 | return m_Configurations; | ||
108 | } | 221 | } |
109 | } | 222 | } |
110 | /// <summary> | ||
111 | /// Gets or sets the active config. | ||
112 | /// </summary> | ||
113 | /// <value>The active config.</value> | ||
114 | public string ActiveConfig | ||
115 | { | ||
116 | get | ||
117 | { | ||
118 | return m_ActiveConfig; | ||
119 | } | ||
120 | set | ||
121 | { | ||
122 | m_ActiveConfig = value; | ||
123 | } | ||
124 | } | ||
125 | |||
126 | /// <summary> | ||
127 | /// Gets the name. | ||
128 | /// </summary> | ||
129 | /// <value>The name.</value> | ||
130 | public string Name | ||
131 | { | ||
132 | get | ||
133 | { | ||
134 | return m_Name; | ||
135 | } | ||
136 | } | ||
137 | |||
138 | /// <summary> | ||
139 | /// Gets the path. | ||
140 | /// </summary> | ||
141 | /// <value>The path.</value> | ||
142 | public string Path | ||
143 | { | ||
144 | get | ||
145 | { | ||
146 | return m_Path; | ||
147 | } | ||
148 | } | ||
149 | |||
150 | /// <summary> | ||
151 | /// Gets the full path. | ||
152 | /// </summary> | ||
153 | /// <value>The full path.</value> | ||
154 | public string FullPath | ||
155 | { | ||
156 | get | ||
157 | { | ||
158 | return m_FullPath; | ||
159 | } | ||
160 | } | ||
161 | |||
162 | /// <summary> | ||
163 | /// Gets the version. | ||
164 | /// </summary> | ||
165 | /// <value>The version.</value> | ||
166 | public string Version | ||
167 | { | ||
168 | get | ||
169 | { | ||
170 | return m_Version; | ||
171 | } | ||
172 | } | ||
173 | |||
174 | /// <summary> | ||
175 | /// Gets the options. | ||
176 | /// </summary> | ||
177 | /// <value>The options.</value> | ||
178 | public OptionsNode Options | ||
179 | { | ||
180 | get | ||
181 | { | ||
182 | return m_Options; | ||
183 | } | ||
184 | } | ||
185 | |||
186 | /// <summary> | ||
187 | /// Gets the files. | ||
188 | /// </summary> | ||
189 | /// <value>The files.</value> | ||
190 | public FilesNode Files | ||
191 | { | ||
192 | get | ||
193 | { | ||
194 | return m_Files; | ||
195 | } | ||
196 | } | ||
197 | |||
198 | /// <summary> | ||
199 | /// Gets the configurations. | ||
200 | /// </summary> | ||
201 | /// <value>The configurations.</value> | ||
202 | public ConfigurationNodeCollection Configurations | ||
203 | { | ||
204 | get | ||
205 | { | ||
206 | ConfigurationNodeCollection tmp = new ConfigurationNodeCollection(); | ||
207 | tmp.AddRange(ConfigurationsTable); | ||
208 | return tmp; | ||
209 | } | ||
210 | } | ||
211 | |||
212 | /// <summary> | ||
213 | /// Gets the configurations table. | ||
214 | /// </summary> | ||
215 | /// <value>The configurations table.</value> | ||
216 | public ConfigurationNodeCollection ConfigurationsTable | ||
217 | { | ||
218 | get | ||
219 | { | ||
220 | return m_Configurations; | ||
221 | } | ||
222 | } | ||
223 | /// <summary> | 223 | /// <summary> |
224 | /// Gets the database projects. | 224 | /// Gets the database projects. |
225 | /// </summary> | 225 | /// </summary> |
@@ -250,106 +250,106 @@ namespace Prebuild.Core.Nodes | |||
250 | return m_Solutions; | 250 | return m_Solutions; |
251 | } | 251 | } |
252 | } | 252 | } |
253 | /// <summary> | 253 | /// <summary> |
254 | /// Gets the projects. | 254 | /// Gets the projects. |
255 | /// </summary> | 255 | /// </summary> |
256 | /// <value>The projects.</value> | 256 | /// <value>The projects.</value> |
257 | public ICollection<ProjectNode> Projects | 257 | public ICollection<ProjectNode> Projects |
258 | { | 258 | { |
259 | get | 259 | get |
260 | { | 260 | { |
261 | List<ProjectNode> tmp = new List<ProjectNode>(m_Projects.Values); | 261 | List<ProjectNode> tmp = new List<ProjectNode>(m_Projects.Values); |
262 | tmp.Sort(); | 262 | tmp.Sort(); |
263 | return tmp; | 263 | return tmp; |
264 | } | 264 | } |
265 | } | 265 | } |
266 | 266 | ||
267 | /// <summary> | 267 | /// <summary> |
268 | /// Gets the projects table. | 268 | /// Gets the projects table. |
269 | /// </summary> | 269 | /// </summary> |
270 | /// <value>The projects table.</value> | 270 | /// <value>The projects table.</value> |
271 | public Dictionary<string, ProjectNode> ProjectsTable | 271 | public Dictionary<string, ProjectNode> ProjectsTable |
272 | { | 272 | { |
273 | get | 273 | get |
274 | { | 274 | { |
275 | return m_Projects; | 275 | return m_Projects; |
276 | } | 276 | } |
277 | } | 277 | } |
278 | 278 | ||
279 | /// <summary> | 279 | /// <summary> |
280 | /// Gets the projects table. | 280 | /// Gets the projects table. |
281 | /// </summary> | 281 | /// </summary> |
282 | /// <value>The projects table.</value> | 282 | /// <value>The projects table.</value> |
283 | public List<ProjectNode> ProjectsTableOrder | 283 | public List<ProjectNode> ProjectsTableOrder |
284 | { | 284 | { |
285 | get | 285 | get |
286 | { | 286 | { |
287 | return m_ProjectsOrder; | 287 | return m_ProjectsOrder; |
288 | } | 288 | } |
289 | } | 289 | } |
290 | 290 | ||
291 | #endregion | 291 | #endregion |
292 | 292 | ||
293 | #region Public Methods | 293 | #region Public Methods |
294 | 294 | ||
295 | /// <summary> | 295 | /// <summary> |
296 | /// Parses the specified node. | 296 | /// Parses the specified node. |
297 | /// </summary> | 297 | /// </summary> |
298 | /// <param name="node">The node.</param> | 298 | /// <param name="node">The node.</param> |
299 | public override void Parse(XmlNode node) | 299 | public override void Parse(XmlNode node) |
300 | { | 300 | { |
301 | m_Name = Helper.AttributeValue(node, "name", m_Name); | 301 | m_Name = Helper.AttributeValue(node, "name", m_Name); |
302 | m_ActiveConfig = Helper.AttributeValue(node, "activeConfig", m_ActiveConfig); | 302 | m_ActiveConfig = Helper.AttributeValue(node, "activeConfig", m_ActiveConfig); |
303 | m_Path = Helper.AttributeValue(node, "path", m_Path); | 303 | m_Path = Helper.AttributeValue(node, "path", m_Path); |
304 | m_Version = Helper.AttributeValue(node, "version", m_Version); | 304 | m_Version = Helper.AttributeValue(node, "version", m_Version); |
305 | 305 | ||
306 | m_FullPath = m_Path; | 306 | m_FullPath = m_Path; |
307 | try | 307 | try |
308 | { | 308 | { |
309 | m_FullPath = Helper.ResolvePath(m_FullPath); | 309 | m_FullPath = Helper.ResolvePath(m_FullPath); |
310 | } | 310 | } |
311 | catch | 311 | catch |
312 | { | 312 | { |
313 | throw new WarningException("Could not resolve solution path: {0}", m_Path); | 313 | throw new WarningException("Could not resolve solution path: {0}", m_Path); |
314 | } | 314 | } |
315 | 315 | ||
316 | Kernel.Instance.CurrentWorkingDirectory.Push(); | 316 | Kernel.Instance.CurrentWorkingDirectory.Push(); |
317 | try | 317 | try |
318 | { | 318 | { |
319 | Helper.SetCurrentDir(m_FullPath); | 319 | Helper.SetCurrentDir(m_FullPath); |
320 | 320 | ||
321 | if( node == null ) | 321 | if( node == null ) |
322 | { | 322 | { |
323 | throw new ArgumentNullException("node"); | 323 | throw new ArgumentNullException("node"); |
324 | } | 324 | } |
325 | 325 | ||
326 | foreach(XmlNode child in node.ChildNodes) | 326 | foreach(XmlNode child in node.ChildNodes) |
327 | { | 327 | { |
328 | IDataNode dataNode = Kernel.Instance.ParseNode(child, this); | 328 | IDataNode dataNode = Kernel.Instance.ParseNode(child, this); |
329 | if(dataNode is OptionsNode) | 329 | if(dataNode is OptionsNode) |
330 | { | 330 | { |
331 | m_Options = (OptionsNode)dataNode; | 331 | m_Options = (OptionsNode)dataNode; |
332 | } | 332 | } |
333 | else if(dataNode is FilesNode) | 333 | else if(dataNode is FilesNode) |
334 | { | 334 | { |
335 | m_Files = (FilesNode)dataNode; | 335 | m_Files = (FilesNode)dataNode; |
336 | } | 336 | } |
337 | else if(dataNode is ConfigurationNode) | 337 | else if(dataNode is ConfigurationNode) |
338 | { | 338 | { |
339 | ConfigurationNode configurationNode = (ConfigurationNode) dataNode; | 339 | ConfigurationNode configurationNode = (ConfigurationNode) dataNode; |
340 | m_Configurations[configurationNode.NameAndPlatform] = configurationNode; | 340 | m_Configurations[configurationNode.NameAndPlatform] = configurationNode; |
341 | 341 | ||
342 | // If the active configuration is null, then we populate it. | 342 | // If the active configuration is null, then we populate it. |
343 | if (ActiveConfig == null) | 343 | if (ActiveConfig == null) |
344 | { | 344 | { |
345 | ActiveConfig = configurationNode.Name; | 345 | ActiveConfig = configurationNode.Name; |
346 | } | 346 | } |
347 | } | 347 | } |
348 | else if(dataNode is ProjectNode) | 348 | else if(dataNode is ProjectNode) |
349 | { | 349 | { |
350 | m_Projects[((ProjectNode)dataNode).Name] = (ProjectNode) dataNode; | 350 | m_Projects[((ProjectNode)dataNode).Name] = (ProjectNode) dataNode; |
351 | m_ProjectsOrder.Add((ProjectNode)dataNode); | 351 | m_ProjectsOrder.Add((ProjectNode)dataNode); |
352 | } | 352 | } |
353 | else if(dataNode is SolutionNode) | 353 | else if(dataNode is SolutionNode) |
354 | { | 354 | { |
355 | m_Solutions[((SolutionNode)dataNode).Name] = (SolutionNode) dataNode; | 355 | m_Solutions[((SolutionNode)dataNode).Name] = (SolutionNode) dataNode; |
@@ -369,14 +369,14 @@ namespace Prebuild.Core.Nodes | |||
369 | throw new WarningException("There can only be one Cleanup node."); | 369 | throw new WarningException("There can only be one Cleanup node."); |
370 | m_Cleanup = (CleanupNode)dataNode; | 370 | m_Cleanup = (CleanupNode)dataNode; |
371 | } | 371 | } |
372 | } | 372 | } |
373 | } | 373 | } |
374 | finally | 374 | finally |
375 | { | 375 | { |
376 | Kernel.Instance.CurrentWorkingDirectory.Pop(); | 376 | Kernel.Instance.CurrentWorkingDirectory.Pop(); |
377 | } | 377 | } |
378 | } | 378 | } |
379 | 379 | ||
380 | #endregion | 380 | #endregion |
381 | } | 381 | } |
382 | } | 382 | } |