diff options
Merge branch 'master' into careminster-presence-refactor
The modules will need to be updated for this to compile and run again. Please
don't use until I do the companion commit to modules later on.
Diffstat (limited to 'Prebuild/src/Core/Nodes')
-rw-r--r-- | Prebuild/src/Core/Nodes/AuthorNode.cs | 2 | ||||
-rw-r--r-- | Prebuild/src/Core/Nodes/CleanFilesNode.cs | 80 | ||||
-rw-r--r-- | Prebuild/src/Core/Nodes/CleanupNode.cs | 85 | ||||
-rw-r--r-- | Prebuild/src/Core/Nodes/ConfigurationNode.cs | 49 | ||||
-rw-r--r-- | Prebuild/src/Core/Nodes/ConfigurationNodeCollection.cs | 71 | ||||
-rw-r--r-- | Prebuild/src/Core/Nodes/DataNode.cs | 2 | ||||
-rw-r--r-- | Prebuild/src/Core/Nodes/DatabaseProjectNode.cs | 1 | ||||
-rw-r--r-- | Prebuild/src/Core/Nodes/DescriptionNode.cs | 2 | ||||
-rw-r--r-- | Prebuild/src/Core/Nodes/FileNode.cs | 16 | ||||
-rw-r--r-- | Prebuild/src/Core/Nodes/FilesNode.cs | 121 | ||||
-rw-r--r-- | Prebuild/src/Core/Nodes/MatchNode.cs | 145 | ||||
-rw-r--r-- | Prebuild/src/Core/Nodes/OptionsNode.cs | 20 | ||||
-rw-r--r-- | Prebuild/src/Core/Nodes/ProcessNode.cs | 2 | ||||
-rw-r--r-- | Prebuild/src/Core/Nodes/ProjectNode.cs | 37 | ||||
-rw-r--r-- | Prebuild/src/Core/Nodes/ReferencePathNode.cs | 2 | ||||
-rw-r--r-- | Prebuild/src/Core/Nodes/SolutionNode.cs | 74 |
16 files changed, 502 insertions, 207 deletions
diff --git a/Prebuild/src/Core/Nodes/AuthorNode.cs b/Prebuild/src/Core/Nodes/AuthorNode.cs index 20e72c0..4c415bb 100644 --- a/Prebuild/src/Core/Nodes/AuthorNode.cs +++ b/Prebuild/src/Core/Nodes/AuthorNode.cs | |||
@@ -24,8 +24,6 @@ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY O | |||
24 | #endregion | 24 | #endregion |
25 | 25 | ||
26 | using System; | 26 | using System; |
27 | using System.Collections; | ||
28 | using System.Collections.Specialized; | ||
29 | using System.Xml; | 27 | using System.Xml; |
30 | 28 | ||
31 | using Prebuild.Core.Attributes; | 29 | using Prebuild.Core.Attributes; |
diff --git a/Prebuild/src/Core/Nodes/CleanFilesNode.cs b/Prebuild/src/Core/Nodes/CleanFilesNode.cs new file mode 100644 index 0000000..71405f9 --- /dev/null +++ b/Prebuild/src/Core/Nodes/CleanFilesNode.cs | |||
@@ -0,0 +1,80 @@ | |||
1 | #region BSD License | ||
2 | /* | ||
3 | Copyright (c) 2007 C.J. Adams-Collier (cjac@colliertech.org) | ||
4 | |||
5 | Redistribution and use in source and binary forms, with or without modification, are permitted | ||
6 | provided that the following conditions are met: | ||
7 | |||
8 | * Redistributions of source code must retain the above copyright notice, this list of conditions | ||
9 | and the following disclaimer. | ||
10 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions | ||
11 | and the following disclaimer in the documentation and/or other materials provided with the | ||
12 | distribution. | ||
13 | * The name of the author may not be used to endorse or promote products derived from this software | ||
14 | without specific prior written permission. | ||
15 | |||
16 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, | ||
17 | BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
18 | ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | ||
19 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
20 | OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY | ||
21 | OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | ||
22 | IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
23 | */ | ||
24 | #endregion | ||
25 | |||
26 | using System; | ||
27 | using System.Collections.Generic; | ||
28 | using System.Xml; | ||
29 | |||
30 | using Prebuild.Core.Attributes; | ||
31 | using Prebuild.Core.Interfaces; | ||
32 | using Prebuild.Core.Utilities; | ||
33 | |||
34 | namespace Prebuild.Core.Nodes | ||
35 | { | ||
36 | [DataNode("CleanFiles")] | ||
37 | public class CleanFilesNode : DataNode | ||
38 | { | ||
39 | #region Fields | ||
40 | |||
41 | private string m_Pattern; | ||
42 | |||
43 | #endregion | ||
44 | |||
45 | #region Properties | ||
46 | |||
47 | /// <summary> | ||
48 | /// Gets the signature. | ||
49 | /// </summary> | ||
50 | /// <value>The signature.</value> | ||
51 | public string Pattern | ||
52 | { | ||
53 | get | ||
54 | { | ||
55 | return m_Pattern; | ||
56 | } | ||
57 | } | ||
58 | |||
59 | #endregion | ||
60 | |||
61 | #region Public Methods | ||
62 | |||
63 | /// <summary> | ||
64 | /// Parses the specified node. | ||
65 | /// </summary> | ||
66 | /// <param name="node">The node.</param> | ||
67 | public override void Parse(XmlNode node) | ||
68 | { | ||
69 | if (node == null) | ||
70 | { | ||
71 | throw new ArgumentNullException("node"); | ||
72 | } | ||
73 | |||
74 | m_Pattern = Helper.AttributeValue(node, "pattern", String.Empty); ; | ||
75 | m_Pattern = m_Pattern.Trim(); | ||
76 | } | ||
77 | |||
78 | #endregion | ||
79 | } | ||
80 | } \ No newline at end of file | ||
diff --git a/Prebuild/src/Core/Nodes/CleanupNode.cs b/Prebuild/src/Core/Nodes/CleanupNode.cs new file mode 100644 index 0000000..b8131b0 --- /dev/null +++ b/Prebuild/src/Core/Nodes/CleanupNode.cs | |||
@@ -0,0 +1,85 @@ | |||
1 | #region BSD License | ||
2 | /* | ||
3 | Copyright (c) 2007 C.J. Adams-Collier (cjac@colliertech.org) | ||
4 | |||
5 | Redistribution and use in source and binary forms, with or without modification, are permitted | ||
6 | provided that the following conditions are met: | ||
7 | |||
8 | * Redistributions of source code must retain the above copyright notice, this list of conditions | ||
9 | and the following disclaimer. | ||
10 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions | ||
11 | and the following disclaimer in the documentation and/or other materials provided with the | ||
12 | distribution. | ||
13 | * The name of the author may not be used to endorse or promote products derived from this software | ||
14 | without specific prior written permission. | ||
15 | |||
16 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, | ||
17 | BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
18 | ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | ||
19 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
20 | OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY | ||
21 | OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | ||
22 | IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
23 | */ | ||
24 | #endregion | ||
25 | |||
26 | using System; | ||
27 | using System.Collections.Generic; | ||
28 | using System.Xml; | ||
29 | |||
30 | using Prebuild.Core.Attributes; | ||
31 | using Prebuild.Core.Interfaces; | ||
32 | |||
33 | namespace Prebuild.Core.Nodes | ||
34 | { | ||
35 | [DataNode("Cleanup")] | ||
36 | public class CleanupNode : DataNode | ||
37 | { | ||
38 | #region Fields | ||
39 | |||
40 | private List<CleanFilesNode> m_CleanFiles = new List<CleanFilesNode>(); | ||
41 | |||
42 | #endregion | ||
43 | |||
44 | #region Properties | ||
45 | |||
46 | /// <summary> | ||
47 | /// Gets the signature. | ||
48 | /// </summary> | ||
49 | /// <value>The signature.</value> | ||
50 | public List<CleanFilesNode> CleanFiles | ||
51 | { | ||
52 | get | ||
53 | { | ||
54 | return m_CleanFiles; | ||
55 | } | ||
56 | } | ||
57 | |||
58 | #endregion | ||
59 | |||
60 | #region Public Methods | ||
61 | |||
62 | /// <summary> | ||
63 | /// Parses the specified node. | ||
64 | /// </summary> | ||
65 | /// <param name="node">The node.</param> | ||
66 | public override void Parse(XmlNode node) | ||
67 | { | ||
68 | if( node == null ) | ||
69 | { | ||
70 | throw new ArgumentNullException("node"); | ||
71 | } | ||
72 | |||
73 | foreach (XmlNode child in node.ChildNodes) | ||
74 | { | ||
75 | IDataNode dataNode = Kernel.Instance.ParseNode(child, this); | ||
76 | if (dataNode is CleanFilesNode) | ||
77 | { | ||
78 | m_CleanFiles.Add((CleanFilesNode)dataNode); | ||
79 | } | ||
80 | } | ||
81 | } | ||
82 | |||
83 | #endregion | ||
84 | } | ||
85 | } \ No newline at end of file | ||
diff --git a/Prebuild/src/Core/Nodes/ConfigurationNode.cs b/Prebuild/src/Core/Nodes/ConfigurationNode.cs index 67d78d5..cd2f740 100644 --- a/Prebuild/src/Core/Nodes/ConfigurationNode.cs +++ b/Prebuild/src/Core/Nodes/ConfigurationNode.cs | |||
@@ -41,6 +41,7 @@ namespace Prebuild.Core.Nodes | |||
41 | #region Fields | 41 | #region Fields |
42 | 42 | ||
43 | private string m_Name = "unknown"; | 43 | private string m_Name = "unknown"; |
44 | private string m_Platform = "AnyCPU"; | ||
44 | private OptionsNode m_Options; | 45 | private OptionsNode m_Options; |
45 | 46 | ||
46 | #endregion | 47 | #endregion |
@@ -84,6 +85,33 @@ namespace Prebuild.Core.Nodes | |||
84 | } | 85 | } |
85 | 86 | ||
86 | /// <summary> | 87 | /// <summary> |
88 | /// Identifies the platform for this specific configuration. | ||
89 | /// </summary> | ||
90 | public string Platform | ||
91 | { | ||
92 | get | ||
93 | { | ||
94 | return m_Platform; | ||
95 | } | ||
96 | set | ||
97 | { | ||
98 | switch ((value + "").ToLower()) | ||
99 | { | ||
100 | case "x86": | ||
101 | case "x64": | ||
102 | m_Platform = value; | ||
103 | break; | ||
104 | case "itanium": | ||
105 | m_Platform = "Itanium"; | ||
106 | break; | ||
107 | default: | ||
108 | m_Platform = "AnyCPU"; | ||
109 | break; | ||
110 | } | ||
111 | } | ||
112 | } | ||
113 | |||
114 | /// <summary> | ||
87 | /// Gets the name. | 115 | /// Gets the name. |
88 | /// </summary> | 116 | /// </summary> |
89 | /// <value>The name.</value> | 117 | /// <value>The name.</value> |
@@ -96,6 +124,22 @@ namespace Prebuild.Core.Nodes | |||
96 | } | 124 | } |
97 | 125 | ||
98 | /// <summary> | 126 | /// <summary> |
127 | /// Gets the name and platform for the configuration. | ||
128 | /// </summary> | ||
129 | /// <value>The name and platform.</value> | ||
130 | public string NameAndPlatform | ||
131 | { | ||
132 | get | ||
133 | { | ||
134 | string platform = m_Platform; | ||
135 | if (platform == "AnyCPU") | ||
136 | platform = "Any CPU"; | ||
137 | |||
138 | return String.Format("{0}|{1}", m_Name, platform); | ||
139 | } | ||
140 | } | ||
141 | |||
142 | /// <summary> | ||
99 | /// Gets or sets the options. | 143 | /// Gets or sets the options. |
100 | /// </summary> | 144 | /// </summary> |
101 | /// <value>The options.</value> | 145 | /// <value>The options.</value> |
@@ -122,7 +166,9 @@ namespace Prebuild.Core.Nodes | |||
122 | public override void Parse(XmlNode node) | 166 | public override void Parse(XmlNode node) |
123 | { | 167 | { |
124 | m_Name = Helper.AttributeValue(node, "name", m_Name); | 168 | m_Name = Helper.AttributeValue(node, "name", m_Name); |
125 | if( node == null ) | 169 | Platform = Helper.AttributeValue(node, "platform", m_Platform); |
170 | |||
171 | if (node == null) | ||
126 | { | 172 | { |
127 | throw new ArgumentNullException("node"); | 173 | throw new ArgumentNullException("node"); |
128 | } | 174 | } |
@@ -159,6 +205,7 @@ namespace Prebuild.Core.Nodes | |||
159 | { | 205 | { |
160 | ConfigurationNode ret = new ConfigurationNode(); | 206 | ConfigurationNode ret = new ConfigurationNode(); |
161 | ret.m_Name = m_Name; | 207 | ret.m_Name = m_Name; |
208 | ret.m_Platform = m_Platform; | ||
162 | m_Options.CopyTo(ret.m_Options); | 209 | m_Options.CopyTo(ret.m_Options); |
163 | return ret; | 210 | return ret; |
164 | } | 211 | } |
diff --git a/Prebuild/src/Core/Nodes/ConfigurationNodeCollection.cs b/Prebuild/src/Core/Nodes/ConfigurationNodeCollection.cs new file mode 100644 index 0000000..1c38d9e --- /dev/null +++ b/Prebuild/src/Core/Nodes/ConfigurationNodeCollection.cs | |||
@@ -0,0 +1,71 @@ | |||
1 | #region BSD License | ||
2 | /* | ||
3 | Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) | ||
4 | |||
5 | Redistribution and use in source and binary forms, with or without modification, are permitted | ||
6 | provided that the following conditions are met: | ||
7 | |||
8 | * Redistributions of source code must retain the above copyright notice, this list of conditions | ||
9 | and the following disclaimer. | ||
10 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions | ||
11 | and the following disclaimer in the documentation and/or other materials provided with the | ||
12 | distribution. | ||
13 | * The name of the author may not be used to endorse or promote products derived from this software | ||
14 | without specific prior written permission. | ||
15 | |||
16 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, | ||
17 | BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
18 | ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | ||
19 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
20 | OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY | ||
21 | OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | ||
22 | IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
23 | */ | ||
24 | #endregion | ||
25 | |||
26 | using System.Collections.Generic; | ||
27 | |||
28 | namespace Prebuild.Core.Nodes | ||
29 | { | ||
30 | /// <summary> | ||
31 | /// Implements a specialized list of configuration nodes which allows for lookup via | ||
32 | /// configuration name and platform. | ||
33 | /// </summary> | ||
34 | public class ConfigurationNodeCollection : List<ConfigurationNode> | ||
35 | { | ||
36 | #region Properties | ||
37 | |||
38 | public ConfigurationNode this[string nameAndPlatform] | ||
39 | { | ||
40 | get | ||
41 | { | ||
42 | foreach (ConfigurationNode configurationNode in this) | ||
43 | { | ||
44 | if (configurationNode.NameAndPlatform == nameAndPlatform) | ||
45 | { | ||
46 | return configurationNode; | ||
47 | } | ||
48 | } | ||
49 | |||
50 | return null; | ||
51 | } | ||
52 | |||
53 | set | ||
54 | { | ||
55 | // See if the node | ||
56 | ConfigurationNode configurationNode = this[nameAndPlatform]; | ||
57 | |||
58 | if (configurationNode != null) | ||
59 | { | ||
60 | this[IndexOf(configurationNode)] = value; | ||
61 | } | ||
62 | else | ||
63 | { | ||
64 | Add(value); | ||
65 | } | ||
66 | } | ||
67 | } | ||
68 | |||
69 | #endregion | ||
70 | } | ||
71 | } | ||
diff --git a/Prebuild/src/Core/Nodes/DataNode.cs b/Prebuild/src/Core/Nodes/DataNode.cs index 763e6c3..318b13c 100644 --- a/Prebuild/src/Core/Nodes/DataNode.cs +++ b/Prebuild/src/Core/Nodes/DataNode.cs | |||
@@ -104,7 +104,7 @@ namespace Prebuild.Core.Nodes | |||
104 | 104 | ||
105 | foreach (string type in WebTypes) | 105 | foreach (string type in WebTypes) |
106 | { | 106 | { |
107 | if (path.EndsWith(string.Format("{0}{1}", type, extension))) | 107 | if (path.EndsWith(type)) |
108 | { | 108 | { |
109 | return SubType.CodeBehind; | 109 | return SubType.CodeBehind; |
110 | } | 110 | } |
diff --git a/Prebuild/src/Core/Nodes/DatabaseProjectNode.cs b/Prebuild/src/Core/Nodes/DatabaseProjectNode.cs index 27c2051..278ecd8 100644 --- a/Prebuild/src/Core/Nodes/DatabaseProjectNode.cs +++ b/Prebuild/src/Core/Nodes/DatabaseProjectNode.cs | |||
@@ -1,5 +1,4 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Collections; | ||
3 | using System.Collections.Generic; | 2 | using System.Collections.Generic; |
4 | using System.Text; | 3 | using System.Text; |
5 | using System.Xml; | 4 | using System.Xml; |
diff --git a/Prebuild/src/Core/Nodes/DescriptionNode.cs b/Prebuild/src/Core/Nodes/DescriptionNode.cs index 353a5ae..d1293a0 100644 --- a/Prebuild/src/Core/Nodes/DescriptionNode.cs +++ b/Prebuild/src/Core/Nodes/DescriptionNode.cs | |||
@@ -24,8 +24,6 @@ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY O | |||
24 | #endregion | 24 | #endregion |
25 | 25 | ||
26 | using System; | 26 | using System; |
27 | using System.Collections; | ||
28 | using System.Collections.Specialized; | ||
29 | using System.Xml; | 27 | using System.Xml; |
30 | 28 | ||
31 | using Prebuild.Core.Attributes; | 29 | using Prebuild.Core.Attributes; |
diff --git a/Prebuild/src/Core/Nodes/FileNode.cs b/Prebuild/src/Core/Nodes/FileNode.cs index 1520fcb..01cea1e 100644 --- a/Prebuild/src/Core/Nodes/FileNode.cs +++ b/Prebuild/src/Core/Nodes/FileNode.cs | |||
@@ -54,7 +54,15 @@ namespace Prebuild.Core.Nodes | |||
54 | /// <summary> | 54 | /// <summary> |
55 | /// | 55 | /// |
56 | /// </summary> | 56 | /// </summary> |
57 | EmbeddedResource | 57 | EmbeddedResource, |
58 | /// <summary> | ||
59 | /// | ||
60 | /// </summary> | ||
61 | ApplicationDefinition, | ||
62 | /// <summary> | ||
63 | /// | ||
64 | /// </summary> | ||
65 | Page | ||
58 | } | 66 | } |
59 | 67 | ||
60 | /// <summary> | 68 | /// <summary> |
@@ -264,6 +272,12 @@ namespace Prebuild.Core.Nodes | |||
264 | m_Valid = false; | 272 | m_Valid = false; |
265 | Kernel.Instance.Log.Write(LogType.Warning, "File does not exist: {0}", m_Path); | 273 | Kernel.Instance.Log.Write(LogType.Warning, "File does not exist: {0}", m_Path); |
266 | } | 274 | } |
275 | |||
276 | if (System.IO.Path.GetExtension(m_Path) == ".settings") | ||
277 | { | ||
278 | m_SubType = SubType.Settings; | ||
279 | m_BuildAction = BuildAction.None; | ||
280 | } | ||
267 | } | 281 | } |
268 | 282 | ||
269 | #endregion | 283 | #endregion |
diff --git a/Prebuild/src/Core/Nodes/FilesNode.cs b/Prebuild/src/Core/Nodes/FilesNode.cs index dc306c2..23a716c 100644 --- a/Prebuild/src/Core/Nodes/FilesNode.cs +++ b/Prebuild/src/Core/Nodes/FilesNode.cs | |||
@@ -24,8 +24,7 @@ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY O | |||
24 | #endregion | 24 | #endregion |
25 | 25 | ||
26 | using System; | 26 | using System; |
27 | using System.Collections; | 27 | using System.Collections.Generic; |
28 | using System.Collections.Specialized; | ||
29 | using System.Xml; | 28 | using System.Xml; |
30 | 29 | ||
31 | using Prebuild.Core.Attributes; | 30 | using Prebuild.Core.Attributes; |
@@ -42,41 +41,19 @@ namespace Prebuild.Core.Nodes | |||
42 | { | 41 | { |
43 | #region Fields | 42 | #region Fields |
44 | 43 | ||
45 | private StringCollection m_Files; | 44 | private readonly List<string> m_Files = new List<string>(); |
46 | private Hashtable m_BuildActions; | 45 | private readonly Dictionary<string,BuildAction> m_BuildActions = new Dictionary<string, BuildAction>(); |
47 | private Hashtable m_SubTypes; | 46 | private readonly Dictionary<string, SubType> m_SubTypes = new Dictionary<string, SubType>(); |
48 | private Hashtable m_ResourceNames; | 47 | private readonly Dictionary<string, string> m_ResourceNames = new Dictionary<string, string>(); |
49 | private Hashtable m_CopyToOutputs; | 48 | private readonly Dictionary<string, CopyToOutput> m_CopyToOutputs = new Dictionary<string, CopyToOutput>(); |
50 | private Hashtable m_Links; | 49 | private readonly Dictionary<string, bool> m_Links = new Dictionary<string, bool>(); |
51 | private Hashtable m_LinkPaths; | 50 | private readonly Dictionary<string, string> m_LinkPaths = new Dictionary<string, string>(); |
52 | private Hashtable m_PreservePaths; | 51 | private readonly Dictionary<string, bool> m_PreservePaths = new Dictionary<string, bool>(); |
53 | |||
54 | #endregion | ||
55 | |||
56 | #region Constructors | ||
57 | |||
58 | /// <summary> | ||
59 | /// | ||
60 | /// </summary> | ||
61 | public FilesNode() | ||
62 | { | ||
63 | m_Files = new StringCollection(); | ||
64 | m_BuildActions = new Hashtable(); | ||
65 | m_SubTypes = new Hashtable(); | ||
66 | m_ResourceNames = new Hashtable(); | ||
67 | m_CopyToOutputs = new Hashtable(); | ||
68 | m_Links = new Hashtable(); | ||
69 | m_LinkPaths = new Hashtable(); | ||
70 | m_PreservePaths = new Hashtable(); | ||
71 | } | ||
72 | 52 | ||
73 | #endregion | 53 | #endregion |
74 | 54 | ||
75 | #region Properties | 55 | #region Properties |
76 | 56 | ||
77 | /// <summary> | ||
78 | /// | ||
79 | /// </summary> | ||
80 | public int Count | 57 | public int Count |
81 | { | 58 | { |
82 | get | 59 | get |
@@ -89,11 +66,6 @@ namespace Prebuild.Core.Nodes | |||
89 | 66 | ||
90 | #region Public Methods | 67 | #region Public Methods |
91 | 68 | ||
92 | /// <summary> | ||
93 | /// | ||
94 | /// </summary> | ||
95 | /// <param name="file"></param> | ||
96 | /// <returns></returns> | ||
97 | public BuildAction GetBuildAction(string file) | 69 | public BuildAction GetBuildAction(string file) |
98 | { | 70 | { |
99 | if(!m_BuildActions.ContainsKey(file)) | 71 | if(!m_BuildActions.ContainsKey(file)) |
@@ -101,41 +73,41 @@ namespace Prebuild.Core.Nodes | |||
101 | return BuildAction.Compile; | 73 | return BuildAction.Compile; |
102 | } | 74 | } |
103 | 75 | ||
104 | return (BuildAction)m_BuildActions[file]; | 76 | return m_BuildActions[file]; |
105 | } | 77 | } |
106 | 78 | ||
107 | public CopyToOutput GetCopyToOutput(string file) | 79 | public CopyToOutput GetCopyToOutput(string file) |
108 | { | 80 | { |
109 | if (!this.m_CopyToOutputs.ContainsKey(file)) | 81 | if (!m_CopyToOutputs.ContainsKey(file)) |
110 | { | 82 | { |
111 | return CopyToOutput.Never; | 83 | return CopyToOutput.Never; |
112 | } | 84 | } |
113 | return (CopyToOutput) this.m_CopyToOutputs[file]; | 85 | return m_CopyToOutputs[file]; |
114 | } | 86 | } |
115 | 87 | ||
116 | public bool GetIsLink(string file) | 88 | public bool GetIsLink(string file) |
117 | { | 89 | { |
118 | if (!this.m_Links.ContainsKey(file)) | 90 | if (!m_Links.ContainsKey(file)) |
119 | { | 91 | { |
120 | return false; | 92 | return false; |
121 | } | 93 | } |
122 | return (bool) this.m_Links[file]; | 94 | return m_Links[file]; |
123 | } | 95 | } |
124 | 96 | ||
97 | public bool Contains(string file) | ||
98 | { | ||
99 | return m_Files.Contains(file); | ||
100 | } | ||
101 | |||
125 | public string GetLinkPath( string file ) | 102 | public string GetLinkPath( string file ) |
126 | { | 103 | { |
127 | if ( !this.m_LinkPaths.ContainsKey( file ) ) | 104 | if ( !m_LinkPaths.ContainsKey( file ) ) |
128 | { | 105 | { |
129 | return string.Empty; | 106 | return string.Empty; |
130 | } | 107 | } |
131 | return (string)this.m_LinkPaths[ file ]; | 108 | return m_LinkPaths[ file ]; |
132 | } | 109 | } |
133 | 110 | ||
134 | /// <summary> | ||
135 | /// | ||
136 | /// </summary> | ||
137 | /// <param name="file"></param> | ||
138 | /// <returns></returns> | ||
139 | public SubType GetSubType(string file) | 111 | public SubType GetSubType(string file) |
140 | { | 112 | { |
141 | if(!m_SubTypes.ContainsKey(file)) | 113 | if(!m_SubTypes.ContainsKey(file)) |
@@ -143,29 +115,19 @@ namespace Prebuild.Core.Nodes | |||
143 | return SubType.Code; | 115 | return SubType.Code; |
144 | } | 116 | } |
145 | 117 | ||
146 | return (SubType)m_SubTypes[file]; | 118 | return m_SubTypes[file]; |
147 | } | 119 | } |
148 | 120 | ||
149 | /// <summary> | ||
150 | /// | ||
151 | /// </summary> | ||
152 | /// <param name="file"></param> | ||
153 | /// <returns></returns> | ||
154 | public string GetResourceName(string file) | 121 | public string GetResourceName(string file) |
155 | { | 122 | { |
156 | if(!m_ResourceNames.ContainsKey(file)) | 123 | if(!m_ResourceNames.ContainsKey(file)) |
157 | { | 124 | { |
158 | return ""; | 125 | return string.Empty; |
159 | } | 126 | } |
160 | 127 | ||
161 | return (string)m_ResourceNames[file]; | 128 | return m_ResourceNames[file]; |
162 | } | 129 | } |
163 | 130 | ||
164 | /// <summary> | ||
165 | /// | ||
166 | /// </summary> | ||
167 | /// <param name="file"></param> | ||
168 | /// <returns></returns> | ||
169 | public bool GetPreservePath( string file ) | 131 | public bool GetPreservePath( string file ) |
170 | { | 132 | { |
171 | if ( !m_PreservePaths.ContainsKey( file ) ) | 133 | if ( !m_PreservePaths.ContainsKey( file ) ) |
@@ -173,13 +135,9 @@ namespace Prebuild.Core.Nodes | |||
173 | return false; | 135 | return false; |
174 | } | 136 | } |
175 | 137 | ||
176 | return (bool)m_PreservePaths[ file ]; | 138 | return m_PreservePaths[ file ]; |
177 | } | 139 | } |
178 | 140 | ||
179 | /// <summary> | ||
180 | /// | ||
181 | /// </summary> | ||
182 | /// <param name="node"></param> | ||
183 | public override void Parse(XmlNode node) | 141 | public override void Parse(XmlNode node) |
184 | { | 142 | { |
185 | if( node == null ) | 143 | if( node == null ) |
@@ -200,10 +158,10 @@ namespace Prebuild.Core.Nodes | |||
200 | m_BuildActions[fileNode.Path] = fileNode.BuildAction; | 158 | m_BuildActions[fileNode.Path] = fileNode.BuildAction; |
201 | m_SubTypes[fileNode.Path] = fileNode.SubType; | 159 | m_SubTypes[fileNode.Path] = fileNode.SubType; |
202 | m_ResourceNames[fileNode.Path] = fileNode.ResourceName; | 160 | m_ResourceNames[fileNode.Path] = fileNode.ResourceName; |
203 | this.m_PreservePaths[ fileNode.Path ] = fileNode.PreservePath; | 161 | m_PreservePaths[ fileNode.Path ] = fileNode.PreservePath; |
204 | this.m_Links[ fileNode.Path ] = fileNode.IsLink; | 162 | m_Links[ fileNode.Path ] = fileNode.IsLink; |
205 | this.m_LinkPaths[ fileNode.Path ] = fileNode.LinkPath; | 163 | m_LinkPaths[ fileNode.Path ] = fileNode.LinkPath; |
206 | this.m_CopyToOutputs[ fileNode.Path ] = fileNode.CopyToOutput; | 164 | m_CopyToOutputs[ fileNode.Path ] = fileNode.CopyToOutput; |
207 | 165 | ||
208 | } | 166 | } |
209 | } | 167 | } |
@@ -216,13 +174,16 @@ namespace Prebuild.Core.Nodes | |||
216 | if (!m_Files.Contains(file)) | 174 | if (!m_Files.Contains(file)) |
217 | { | 175 | { |
218 | m_Files.Add(file); | 176 | m_Files.Add(file); |
219 | m_BuildActions[ file ] = matchNode.BuildAction == null ? GetBuildActionByFileName(file) : matchNode.BuildAction; | 177 | if (matchNode.BuildAction == null) |
220 | m_SubTypes[file] = matchNode.SubType == null ? GetSubTypeByFileName(file) : matchNode.SubType.Value; | 178 | m_BuildActions[file] = GetBuildActionByFileName(file); |
179 | else | ||
180 | m_BuildActions[file] = matchNode.BuildAction.Value; | ||
181 | m_SubTypes[file] = matchNode.SubType == null ? GetSubTypeByFileName(file) : matchNode.SubType.Value; | ||
221 | m_ResourceNames[ file ] = matchNode.ResourceName; | 182 | m_ResourceNames[ file ] = matchNode.ResourceName; |
222 | this.m_PreservePaths[ file ] = matchNode.PreservePath; | 183 | m_PreservePaths[ file ] = matchNode.PreservePath; |
223 | this.m_Links[ file ] = matchNode.IsLink; | 184 | m_Links[ file ] = matchNode.IsLink; |
224 | this.m_LinkPaths[ file ] = matchNode.LinkPath; | 185 | m_LinkPaths[ file ] = matchNode.LinkPath; |
225 | this.m_CopyToOutputs[ file ] = matchNode.CopyToOutput; | 186 | m_CopyToOutputs[ file ] = matchNode.CopyToOutput; |
226 | 187 | ||
227 | } | 188 | } |
228 | } | 189 | } |
@@ -232,11 +193,7 @@ namespace Prebuild.Core.Nodes | |||
232 | 193 | ||
233 | // TODO: Check in to why StringCollection's enumerator doesn't implement | 194 | // TODO: Check in to why StringCollection's enumerator doesn't implement |
234 | // IEnumerator? | 195 | // IEnumerator? |
235 | /// <summary> | 196 | public IEnumerator<string> GetEnumerator() |
236 | /// | ||
237 | /// </summary> | ||
238 | /// <returns></returns> | ||
239 | public StringEnumerator GetEnumerator() | ||
240 | { | 197 | { |
241 | return m_Files.GetEnumerator(); | 198 | return m_Files.GetEnumerator(); |
242 | } | 199 | } |
diff --git a/Prebuild/src/Core/Nodes/MatchNode.cs b/Prebuild/src/Core/Nodes/MatchNode.cs index 656d7d0..9735265 100644 --- a/Prebuild/src/Core/Nodes/MatchNode.cs +++ b/Prebuild/src/Core/Nodes/MatchNode.cs | |||
@@ -25,7 +25,6 @@ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY O | |||
25 | 25 | ||
26 | using System; | 26 | using System; |
27 | using System.Collections.Generic; | 27 | using System.Collections.Generic; |
28 | using System.Collections.Specialized; | ||
29 | using System.IO; | 28 | using System.IO; |
30 | using System.Text.RegularExpressions; | 29 | using System.Text.RegularExpressions; |
31 | using System.Xml; | 30 | using System.Xml; |
@@ -33,7 +32,6 @@ using System.Xml; | |||
33 | using Prebuild.Core.Attributes; | 32 | using Prebuild.Core.Attributes; |
34 | using Prebuild.Core.Interfaces; | 33 | using Prebuild.Core.Interfaces; |
35 | using Prebuild.Core.Utilities; | 34 | using Prebuild.Core.Utilities; |
36 | using System.Collections; | ||
37 | 35 | ||
38 | namespace Prebuild.Core.Nodes | 36 | namespace Prebuild.Core.Nodes |
39 | { | 37 | { |
@@ -45,7 +43,7 @@ namespace Prebuild.Core.Nodes | |||
45 | { | 43 | { |
46 | #region Fields | 44 | #region Fields |
47 | 45 | ||
48 | private readonly StringCollection m_Files = new StringCollection(); | 46 | private readonly List<string> m_Files = new List<string>(); |
49 | private Regex m_Regex; | 47 | private Regex m_Regex; |
50 | private BuildAction? m_BuildAction; | 48 | private BuildAction? m_BuildAction; |
51 | private SubType? m_SubType; | 49 | private SubType? m_SubType; |
@@ -63,7 +61,7 @@ namespace Prebuild.Core.Nodes | |||
63 | /// <summary> | 61 | /// <summary> |
64 | /// | 62 | /// |
65 | /// </summary> | 63 | /// </summary> |
66 | public StringCollection Files | 64 | public IEnumerable<string> Files |
67 | { | 65 | { |
68 | get | 66 | get |
69 | { | 67 | { |
@@ -97,7 +95,7 @@ namespace Prebuild.Core.Nodes | |||
97 | { | 95 | { |
98 | get | 96 | get |
99 | { | 97 | { |
100 | return this.m_CopyToOutput; | 98 | return m_CopyToOutput; |
101 | } | 99 | } |
102 | } | 100 | } |
103 | 101 | ||
@@ -105,7 +103,7 @@ namespace Prebuild.Core.Nodes | |||
105 | { | 103 | { |
106 | get | 104 | get |
107 | { | 105 | { |
108 | return this.m_Link; | 106 | return m_Link; |
109 | } | 107 | } |
110 | } | 108 | } |
111 | 109 | ||
@@ -113,7 +111,7 @@ namespace Prebuild.Core.Nodes | |||
113 | { | 111 | { |
114 | get | 112 | get |
115 | { | 113 | { |
116 | return this.m_LinkPath; | 114 | return m_LinkPath; |
117 | } | 115 | } |
118 | } | 116 | } |
119 | /// <summary> | 117 | /// <summary> |
@@ -149,21 +147,35 @@ namespace Prebuild.Core.Nodes | |||
149 | private void RecurseDirectories(string path, string pattern, bool recurse, bool useRegex, List<ExcludeNode> exclusions) | 147 | private void RecurseDirectories(string path, string pattern, bool recurse, bool useRegex, List<ExcludeNode> exclusions) |
150 | { | 148 | { |
151 | Match match; | 149 | Match match; |
152 | Boolean excludeFile; | 150 | try |
153 | try | ||
154 | { | 151 | { |
155 | string[] files; | 152 | string[] files; |
156 | 153 | ||
157 | if(!useRegex) | 154 | Boolean excludeFile; |
155 | if(!useRegex) | ||
158 | { | 156 | { |
159 | files = Directory.GetFiles(path, pattern); | 157 | try |
158 | { | ||
159 | files = Directory.GetFiles(path, pattern); | ||
160 | } | ||
161 | catch (IOException) | ||
162 | { | ||
163 | // swallow weird IOException error when running in a virtual box | ||
164 | // guest OS on a network share when the host OS is not Windows. | ||
165 | // This seems to happen on network shares | ||
166 | // when no files match, and may be related to this report: | ||
167 | // http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=254546 | ||
168 | |||
169 | files = null; | ||
170 | } | ||
171 | |||
160 | if(files != null) | 172 | if(files != null) |
161 | { | 173 | { |
162 | string fileTemp; | 174 | foreach (string file in files) |
163 | foreach (string file in files) | ||
164 | { | 175 | { |
165 | excludeFile = false; | 176 | excludeFile = false; |
166 | if (file.Substring(0,2) == "./" || file.Substring(0,2) == ".\\") | 177 | string fileTemp; |
178 | if (file.Substring(0,2) == "./" || file.Substring(0,2) == ".\\") | ||
167 | { | 179 | { |
168 | fileTemp = file.Substring(2); | 180 | fileTemp = file.Substring(2); |
169 | } | 181 | } |
@@ -187,47 +199,64 @@ namespace Prebuild.Core.Nodes | |||
187 | 199 | ||
188 | } | 200 | } |
189 | } | 201 | } |
190 | else | 202 | |
191 | { | 203 | // don't call return here, because we may need to recursively search directories below |
192 | return; | 204 | // this one, even if no matches were found in this directory. |
193 | } | ||
194 | } | 205 | } |
195 | else | 206 | else |
196 | { | 207 | { |
197 | files = Directory.GetFiles(path); | 208 | try |
198 | foreach(string file in files) | 209 | { |
199 | { | 210 | files = Directory.GetFiles(path); |
200 | excludeFile = false; | 211 | } |
201 | 212 | catch (IOException) | |
202 | match = m_Regex.Match(file); | 213 | { |
203 | if(match.Success) | 214 | // swallow weird IOException error when running in a virtual box |
204 | { | 215 | // guest OS on a network share. |
205 | // Check all excludions and set flag if there are any hits. | 216 | files = null; |
206 | foreach ( ExcludeNode exclude in exclusions ) | 217 | } |
207 | { | 218 | |
208 | Regex exRegEx = new Regex( exclude.Pattern ); | 219 | if (files != null) |
209 | match = exRegEx.Match( file ); | 220 | { |
210 | excludeFile |= !match.Success; | 221 | foreach (string file in files) |
211 | } | 222 | { |
223 | excludeFile = false; | ||
212 | 224 | ||
213 | if ( !excludeFile ) | 225 | match = m_Regex.Match(file); |
226 | if (match.Success) | ||
214 | { | 227 | { |
215 | m_Files.Add( file ); | 228 | // Check all excludions and set flag if there are any hits. |
229 | foreach (ExcludeNode exclude in exclusions) | ||
230 | { | ||
231 | Regex exRegEx = new Regex(exclude.Pattern); | ||
232 | match = exRegEx.Match(file); | ||
233 | excludeFile |= !match.Success; | ||
234 | } | ||
235 | |||
236 | if (!excludeFile) | ||
237 | { | ||
238 | m_Files.Add(file); | ||
239 | } | ||
216 | } | 240 | } |
217 | } | 241 | } |
218 | } | 242 | } |
219 | } | 243 | } |
220 | 244 | ||
221 | if(recurse) | 245 | if(recurse) |
222 | { | 246 | { |
223 | string[] dirs = Directory.GetDirectories(path); | 247 | string[] dirs = Directory.GetDirectories(path); |
224 | if(dirs != null && dirs.Length > 0) | 248 | if(dirs != null && dirs.Length > 0) |
225 | { | 249 | { |
226 | foreach(string str in dirs) | 250 | foreach (string str in dirs) |
227 | { | 251 | { |
228 | RecurseDirectories(Helper.NormalizePath(str), pattern, recurse, useRegex, exclusions); | 252 | // hack to skip subversion folders. Not having this can cause |
229 | } | 253 | // a significant performance hit when running on a network drive. |
230 | } | 254 | if (str.EndsWith(".svn")) |
255 | continue; | ||
256 | |||
257 | RecurseDirectories(Helper.NormalizePath(str), pattern, recurse, useRegex, exclusions); | ||
258 | } | ||
259 | } | ||
231 | } | 260 | } |
232 | } | 261 | } |
233 | catch(DirectoryNotFoundException) | 262 | catch(DirectoryNotFoundException) |
@@ -266,14 +295,14 @@ namespace Prebuild.Core.Nodes | |||
266 | //string subType = Helper.AttributeValue(node, "subType", string.Empty); | 295 | //string subType = Helper.AttributeValue(node, "subType", string.Empty); |
267 | //if (subType != String.Empty) | 296 | //if (subType != String.Empty) |
268 | // m_SubType = (SubType)Enum.Parse(typeof(SubType), subType); | 297 | // m_SubType = (SubType)Enum.Parse(typeof(SubType), subType); |
269 | m_ResourceName = Helper.AttributeValue(node, "resourceName", m_ResourceName.ToString()); | 298 | m_ResourceName = Helper.AttributeValue(node, "resourceName", m_ResourceName); |
270 | this.m_CopyToOutput = (CopyToOutput) Enum.Parse(typeof(CopyToOutput), Helper.AttributeValue(node, "copyToOutput", this.m_CopyToOutput.ToString())); | 299 | m_CopyToOutput = (CopyToOutput) Enum.Parse(typeof(CopyToOutput), Helper.AttributeValue(node, "copyToOutput", m_CopyToOutput.ToString())); |
271 | this.m_Link = bool.Parse(Helper.AttributeValue(node, "link", bool.FalseString)); | 300 | m_Link = bool.Parse(Helper.AttributeValue(node, "link", bool.FalseString)); |
272 | if ( this.m_Link == true ) | 301 | if ( m_Link ) |
273 | { | 302 | { |
274 | this.m_LinkPath = Helper.AttributeValue( node, "linkPath", string.Empty ); | 303 | m_LinkPath = Helper.AttributeValue( node, "linkPath", string.Empty ); |
275 | } | 304 | } |
276 | this.m_PreservePath = bool.Parse( Helper.AttributeValue( node, "preservePath", bool.FalseString ) ); | 305 | m_PreservePath = bool.Parse( Helper.AttributeValue( node, "preservePath", bool.FalseString ) ); |
277 | 306 | ||
278 | 307 | ||
279 | if(path != null && path.Length == 0) | 308 | if(path != null && path.Length == 0) |
@@ -318,11 +347,19 @@ namespace Prebuild.Core.Nodes | |||
318 | 347 | ||
319 | RecurseDirectories( path, pattern, recurse, useRegex, m_Exclusions ); | 348 | RecurseDirectories( path, pattern, recurse, useRegex, m_Exclusions ); |
320 | 349 | ||
321 | if(m_Files.Count < 1) | 350 | if (m_Files.Count < 1) |
322 | { | 351 | { |
323 | throw new WarningException("Match returned no files: {0}{1}", Helper.EndPath(path), pattern); | 352 | // Include the project name when the match node returns no matches to provide extra |
324 | } | 353 | // debug info. |
325 | m_Regex = null; | 354 | ProjectNode project = Parent.Parent as ProjectNode; |
355 | string projectName = ""; | ||
356 | |||
357 | if (project != null) | ||
358 | projectName = " in project " + project.AssemblyName; | ||
359 | |||
360 | throw new WarningException("Match" + projectName + " returned no files: {0}{1}", Helper.EndPath(path), pattern); | ||
361 | } | ||
362 | m_Regex = null; | ||
326 | } | 363 | } |
327 | 364 | ||
328 | #endregion | 365 | #endregion |
diff --git a/Prebuild/src/Core/Nodes/OptionsNode.cs b/Prebuild/src/Core/Nodes/OptionsNode.cs index b63034b..577de71 100644 --- a/Prebuild/src/Core/Nodes/OptionsNode.cs +++ b/Prebuild/src/Core/Nodes/OptionsNode.cs | |||
@@ -24,8 +24,7 @@ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY O | |||
24 | #endregion | 24 | #endregion |
25 | 25 | ||
26 | using System; | 26 | using System; |
27 | using System.Collections; | 27 | using System.Collections.Generic; |
28 | using System.Collections.Specialized; | ||
29 | using System.Reflection; | 28 | using System.Reflection; |
30 | using System.Xml; | 29 | using System.Xml; |
31 | 30 | ||
@@ -43,7 +42,7 @@ namespace Prebuild.Core.Nodes | |||
43 | { | 42 | { |
44 | #region Fields | 43 | #region Fields |
45 | 44 | ||
46 | private static Hashtable m_OptionFields; | 45 | private static readonly Dictionary<string,FieldInfo> m_OptionFields = new Dictionary<string, FieldInfo>(); |
47 | 46 | ||
48 | [OptionNode("CompilerDefines")] | 47 | [OptionNode("CompilerDefines")] |
49 | private string m_CompilerDefines = ""; | 48 | private string m_CompilerDefines = ""; |
@@ -495,7 +494,7 @@ namespace Prebuild.Core.Nodes | |||
495 | } | 494 | } |
496 | } | 495 | } |
497 | 496 | ||
498 | private StringCollection m_FieldsDefined; | 497 | private readonly List<string> m_FieldsDefined = new List<string>(); |
499 | 498 | ||
500 | #endregion | 499 | #endregion |
501 | 500 | ||
@@ -508,7 +507,6 @@ namespace Prebuild.Core.Nodes | |||
508 | { | 507 | { |
509 | Type t = typeof(OptionsNode); | 508 | Type t = typeof(OptionsNode); |
510 | 509 | ||
511 | m_OptionFields = new Hashtable(); | ||
512 | foreach(FieldInfo f in t.GetFields(BindingFlags.NonPublic | BindingFlags.Instance)) | 510 | foreach(FieldInfo f in t.GetFields(BindingFlags.NonPublic | BindingFlags.Instance)) |
513 | { | 511 | { |
514 | object[] attrs = f.GetCustomAttributes(typeof(OptionNodeAttribute), false); | 512 | object[] attrs = f.GetCustomAttributes(typeof(OptionNodeAttribute), false); |
@@ -522,14 +520,6 @@ namespace Prebuild.Core.Nodes | |||
522 | } | 520 | } |
523 | } | 521 | } |
524 | 522 | ||
525 | /// <summary> | ||
526 | /// Initializes a new instance of the <see cref="OptionsNode"/> class. | ||
527 | /// </summary> | ||
528 | public OptionsNode() | ||
529 | { | ||
530 | m_FieldsDefined = new StringCollection(); | ||
531 | } | ||
532 | |||
533 | #endregion | 523 | #endregion |
534 | 524 | ||
535 | #region Properties | 525 | #region Properties |
@@ -547,7 +537,7 @@ namespace Prebuild.Core.Nodes | |||
547 | return null; | 537 | return null; |
548 | } | 538 | } |
549 | 539 | ||
550 | FieldInfo f = (FieldInfo)m_OptionFields[index]; | 540 | FieldInfo f = m_OptionFields[index]; |
551 | return f.GetValue(this); | 541 | return f.GetValue(this); |
552 | } | 542 | } |
553 | } | 543 | } |
@@ -591,7 +581,7 @@ namespace Prebuild.Core.Nodes | |||
591 | return; | 581 | return; |
592 | } | 582 | } |
593 | 583 | ||
594 | FieldInfo f = (FieldInfo)m_OptionFields[nodeName]; | 584 | FieldInfo f = m_OptionFields[nodeName]; |
595 | f.SetValue(this, Helper.TranslateValue(f.FieldType, val)); | 585 | f.SetValue(this, Helper.TranslateValue(f.FieldType, val)); |
596 | FlagDefined(f.Name); | 586 | FlagDefined(f.Name); |
597 | } | 587 | } |
diff --git a/Prebuild/src/Core/Nodes/ProcessNode.cs b/Prebuild/src/Core/Nodes/ProcessNode.cs index 6bfbe16..8ca8e49 100644 --- a/Prebuild/src/Core/Nodes/ProcessNode.cs +++ b/Prebuild/src/Core/Nodes/ProcessNode.cs | |||
@@ -24,8 +24,6 @@ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY O | |||
24 | #endregion | 24 | #endregion |
25 | 25 | ||
26 | using System; | 26 | using System; |
27 | using System.Collections; | ||
28 | using System.Collections.Specialized; | ||
29 | using System.Xml; | 27 | using System.Xml; |
30 | 28 | ||
31 | using Prebuild.Core.Attributes; | 29 | using Prebuild.Core.Attributes; |
diff --git a/Prebuild/src/Core/Nodes/ProjectNode.cs b/Prebuild/src/Core/Nodes/ProjectNode.cs index 04af7a3..fb92b32 100644 --- a/Prebuild/src/Core/Nodes/ProjectNode.cs +++ b/Prebuild/src/Core/Nodes/ProjectNode.cs | |||
@@ -24,7 +24,6 @@ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY O | |||
24 | #endregion | 24 | #endregion |
25 | 25 | ||
26 | using System; | 26 | using System; |
27 | using System.Collections; | ||
28 | using System.Collections.Generic; | 27 | using System.Collections.Generic; |
29 | using System.IO; | 28 | using System.IO; |
30 | using System.Xml; | 29 | using System.Xml; |
@@ -90,10 +89,10 @@ namespace Prebuild.Core.Nodes | |||
90 | /// .NET 3.5 | 89 | /// .NET 3.5 |
91 | /// </summary> | 90 | /// </summary> |
92 | v3_5, | 91 | v3_5, |
93 | /// <summary> | 92 | /// <summary> |
94 | /// .NET 4.0 | 93 | /// .NET 4.0 |
95 | /// </summary> | 94 | /// </summary> |
96 | v4_0, | 95 | v4_0, |
97 | } | 96 | } |
98 | /// <summary> | 97 | /// <summary> |
99 | /// The Node object representing /Prebuild/Solution/Project elements | 98 | /// The Node object representing /Prebuild/Solution/Project elements |
@@ -121,7 +120,7 @@ namespace Prebuild.Core.Nodes | |||
121 | private Guid m_Guid; | 120 | private Guid m_Guid; |
122 | private string m_DebugStartParameters; | 121 | private string m_DebugStartParameters; |
123 | 122 | ||
124 | private Hashtable m_Configurations = new Hashtable(); | 123 | private readonly Dictionary<string, ConfigurationNode> m_Configurations = new Dictionary<string, ConfigurationNode>(); |
125 | private readonly List<ReferencePathNode> m_ReferencePaths = new List<ReferencePathNode>(); | 124 | private readonly List<ReferencePathNode> m_ReferencePaths = new List<ReferencePathNode>(); |
126 | private readonly List<ReferenceNode> m_References = new List<ReferenceNode>(); | 125 | private readonly List<ReferenceNode> m_References = new List<ReferenceNode>(); |
127 | private readonly List<AuthorNode> m_Authors = new List<AuthorNode>(); | 126 | private readonly List<AuthorNode> m_Authors = new List<AuthorNode>(); |
@@ -149,7 +148,7 @@ namespace Prebuild.Core.Nodes | |||
149 | { | 148 | { |
150 | get | 149 | get |
151 | { | 150 | { |
152 | return this.m_Framework; | 151 | return m_Framework; |
153 | } | 152 | } |
154 | } | 153 | } |
155 | /// <summary> | 154 | /// <summary> |
@@ -283,7 +282,7 @@ namespace Prebuild.Core.Nodes | |||
283 | } | 282 | } |
284 | } | 283 | } |
285 | 284 | ||
286 | private bool m_GenerateAssemblyInfoFile = false; | 285 | private bool m_GenerateAssemblyInfoFile; |
287 | 286 | ||
288 | /// <summary> | 287 | /// <summary> |
289 | /// | 288 | /// |
@@ -328,11 +327,11 @@ namespace Prebuild.Core.Nodes | |||
328 | /// Gets the configurations. | 327 | /// Gets the configurations. |
329 | /// </summary> | 328 | /// </summary> |
330 | /// <value>The configurations.</value> | 329 | /// <value>The configurations.</value> |
331 | public IList Configurations | 330 | public List<ConfigurationNode> Configurations |
332 | { | 331 | { |
333 | get | 332 | get |
334 | { | 333 | { |
335 | ArrayList tmp = new ArrayList(ConfigurationsTable.Values); | 334 | List<ConfigurationNode> tmp = new List<ConfigurationNode>(ConfigurationsTable.Values); |
336 | tmp.Sort(); | 335 | tmp.Sort(); |
337 | return tmp; | 336 | return tmp; |
338 | } | 337 | } |
@@ -342,7 +341,7 @@ namespace Prebuild.Core.Nodes | |||
342 | /// Gets the configurations table. | 341 | /// Gets the configurations table. |
343 | /// </summary> | 342 | /// </summary> |
344 | /// <value>The configurations table.</value> | 343 | /// <value>The configurations table.</value> |
345 | public Hashtable ConfigurationsTable | 344 | public Dictionary<string, ConfigurationNode> ConfigurationsTable |
346 | { | 345 | { |
347 | get | 346 | get |
348 | { | 347 | { |
@@ -420,7 +419,7 @@ namespace Prebuild.Core.Nodes | |||
420 | SolutionNode parent = (SolutionNode)base.Parent; | 419 | SolutionNode parent = (SolutionNode)base.Parent; |
421 | foreach(ConfigurationNode conf in parent.Configurations) | 420 | foreach(ConfigurationNode conf in parent.Configurations) |
422 | { | 421 | { |
423 | m_Configurations[conf.Name] = conf.Clone(); | 422 | m_Configurations[conf.NameAndPlatform] = (ConfigurationNode) conf.Clone(); |
424 | } | 423 | } |
425 | } | 424 | } |
426 | } | 425 | } |
@@ -455,19 +454,19 @@ namespace Prebuild.Core.Nodes | |||
455 | if(String.Compare(conf.Name, "all", true) == 0) //apply changes to all, this may not always be applied first, | 454 | if(String.Compare(conf.Name, "all", true) == 0) //apply changes to all, this may not always be applied first, |
456 | //so it *may* override changes to the same properties for configurations defines at the project level | 455 | //so it *may* override changes to the same properties for configurations defines at the project level |
457 | { | 456 | { |
458 | foreach(ConfigurationNode confNode in this.m_Configurations.Values) | 457 | foreach(ConfigurationNode confNode in m_Configurations.Values) |
459 | { | 458 | { |
460 | conf.CopyTo(confNode);//update the config templates defines at the project level with the overrides | 459 | conf.CopyTo(confNode);//update the config templates defines at the project level with the overrides |
461 | } | 460 | } |
462 | } | 461 | } |
463 | if(m_Configurations.ContainsKey(conf.Name)) | 462 | if(m_Configurations.ContainsKey(conf.NameAndPlatform)) |
464 | { | 463 | { |
465 | ConfigurationNode parentConf = (ConfigurationNode)m_Configurations[conf.Name]; | 464 | ConfigurationNode parentConf = m_Configurations[conf.NameAndPlatform]; |
466 | conf.CopyTo(parentConf);//update the config templates defines at the project level with the overrides | 465 | conf.CopyTo(parentConf);//update the config templates defines at the project level with the overrides |
467 | } | 466 | } |
468 | else | 467 | else |
469 | { | 468 | { |
470 | m_Configurations[conf.Name] = conf; | 469 | m_Configurations[conf.NameAndPlatform] = conf; |
471 | } | 470 | } |
472 | } | 471 | } |
473 | 472 | ||
@@ -504,12 +503,12 @@ namespace Prebuild.Core.Nodes | |||
504 | m_GenerateAssemblyInfoFile = Helper.ParseBoolean(node, "generateAssemblyInfoFile", false); | 503 | m_GenerateAssemblyInfoFile = Helper.ParseBoolean(node, "generateAssemblyInfoFile", false); |
505 | m_DebugStartParameters = Helper.AttributeValue(node, "debugStartParameters", string.Empty); | 504 | m_DebugStartParameters = Helper.AttributeValue(node, "debugStartParameters", string.Empty); |
506 | 505 | ||
507 | if(m_AssemblyName == null || m_AssemblyName.Length < 1) | 506 | if(string.IsNullOrEmpty(m_AssemblyName)) |
508 | { | 507 | { |
509 | m_AssemblyName = m_Name; | 508 | m_AssemblyName = m_Name; |
510 | } | 509 | } |
511 | 510 | ||
512 | if(m_RootNamespace == null || m_RootNamespace.Length < 1) | 511 | if(string.IsNullOrEmpty(m_RootNamespace)) |
513 | { | 512 | { |
514 | m_RootNamespace = m_Name; | 513 | m_RootNamespace = m_Name; |
515 | } | 514 | } |
@@ -572,7 +571,7 @@ namespace Prebuild.Core.Nodes | |||
572 | public int CompareTo(object obj) | 571 | public int CompareTo(object obj) |
573 | { | 572 | { |
574 | ProjectNode that = (ProjectNode)obj; | 573 | ProjectNode that = (ProjectNode)obj; |
575 | return this.m_Name.CompareTo(that.m_Name); | 574 | return m_Name.CompareTo(that.m_Name); |
576 | } | 575 | } |
577 | 576 | ||
578 | #endregion | 577 | #endregion |
diff --git a/Prebuild/src/Core/Nodes/ReferencePathNode.cs b/Prebuild/src/Core/Nodes/ReferencePathNode.cs index f0543c2..7331cd7 100644 --- a/Prebuild/src/Core/Nodes/ReferencePathNode.cs +++ b/Prebuild/src/Core/Nodes/ReferencePathNode.cs | |||
@@ -24,8 +24,6 @@ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY O | |||
24 | #endregion | 24 | #endregion |
25 | 25 | ||
26 | using System; | 26 | using System; |
27 | using System.Collections; | ||
28 | using System.Collections.Specialized; | ||
29 | using System.Xml; | 27 | using System.Xml; |
30 | 28 | ||
31 | using Prebuild.Core.Attributes; | 29 | using Prebuild.Core.Attributes; |
diff --git a/Prebuild/src/Core/Nodes/SolutionNode.cs b/Prebuild/src/Core/Nodes/SolutionNode.cs index 2a1b8e2..10c0223 100644 --- a/Prebuild/src/Core/Nodes/SolutionNode.cs +++ b/Prebuild/src/Core/Nodes/SolutionNode.cs | |||
@@ -24,10 +24,8 @@ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY O | |||
24 | #endregion | 24 | #endregion |
25 | 25 | ||
26 | using System; | 26 | using System; |
27 | using System.Collections; | ||
28 | using System.Collections.Generic; | 27 | using System.Collections.Generic; |
29 | using System.Diagnostics; | 28 | using System.Diagnostics; |
30 | using System.IO; | ||
31 | using System.Xml; | 29 | using System.Xml; |
32 | 30 | ||
33 | using Prebuild.Core.Attributes; | 31 | using Prebuild.Core.Attributes; |
@@ -50,18 +48,19 @@ namespace Prebuild.Core.Nodes | |||
50 | private string m_Name = "unknown"; | 48 | private string m_Name = "unknown"; |
51 | private string m_Path = ""; | 49 | private string m_Path = ""; |
52 | private string m_FullPath = ""; | 50 | private string m_FullPath = ""; |
53 | private string m_ActiveConfig = "Debug"; | 51 | private string m_ActiveConfig; |
54 | private string m_Version = "1.0.0"; | 52 | private string m_Version = "1.0.0"; |
55 | 53 | ||
56 | private OptionsNode m_Options; | 54 | private OptionsNode m_Options; |
57 | private FilesNode m_Files; | 55 | private FilesNode m_Files; |
58 | private readonly Hashtable m_Configurations = new Hashtable(); | 56 | private readonly ConfigurationNodeCollection m_Configurations = new ConfigurationNodeCollection(); |
59 | private readonly Hashtable m_Projects = new Hashtable(); | 57 | private readonly Dictionary<string, ProjectNode> m_Projects = new Dictionary<string, ProjectNode>(); |
60 | private readonly Hashtable m_DatabaseProjects = new Hashtable(); | 58 | private readonly Dictionary<string, DatabaseProjectNode> m_DatabaseProjects = new Dictionary<string, DatabaseProjectNode>(); |
61 | private readonly List<ProjectNode> m_ProjectsOrder = new List<ProjectNode>(); | 59 | private readonly List<ProjectNode> m_ProjectsOrder = new List<ProjectNode>(); |
62 | private readonly Hashtable m_Solutions = new Hashtable(); | 60 | private readonly Dictionary<string, SolutionNode> m_Solutions = new Dictionary<string, SolutionNode>(); |
61 | private CleanupNode m_Cleanup; | ||
63 | 62 | ||
64 | #endregion | 63 | #endregion |
65 | 64 | ||
66 | #region Properties | 65 | #region Properties |
67 | public override IDataNode Parent | 66 | public override IDataNode Parent |
@@ -77,7 +76,7 @@ namespace Prebuild.Core.Nodes | |||
77 | SolutionNode solution = (SolutionNode)value; | 76 | SolutionNode solution = (SolutionNode)value; |
78 | foreach (ConfigurationNode conf in solution.Configurations) | 77 | foreach (ConfigurationNode conf in solution.Configurations) |
79 | { | 78 | { |
80 | m_Configurations[conf.Name] = conf.Clone(); | 79 | m_Configurations[conf.Name] = (ConfigurationNode) conf.Clone(); |
81 | } | 80 | } |
82 | } | 81 | } |
83 | 82 | ||
@@ -85,6 +84,18 @@ namespace Prebuild.Core.Nodes | |||
85 | } | 84 | } |
86 | } | 85 | } |
87 | 86 | ||
87 | public CleanupNode Cleanup | ||
88 | { | ||
89 | get | ||
90 | { | ||
91 | return m_Cleanup; | ||
92 | } | ||
93 | set | ||
94 | { | ||
95 | m_Cleanup = value; | ||
96 | } | ||
97 | } | ||
98 | |||
88 | public Guid Guid | 99 | public Guid Guid |
89 | { | 100 | { |
90 | get | 101 | get |
@@ -188,13 +199,13 @@ namespace Prebuild.Core.Nodes | |||
188 | /// Gets the configurations. | 199 | /// Gets the configurations. |
189 | /// </summary> | 200 | /// </summary> |
190 | /// <value>The configurations.</value> | 201 | /// <value>The configurations.</value> |
191 | public ICollection Configurations | 202 | public ConfigurationNodeCollection Configurations |
192 | { | 203 | { |
193 | get | 204 | get |
194 | { | 205 | { |
195 | ArrayList tmp = new ArrayList(ConfigurationsTable.Values); | 206 | ConfigurationNodeCollection tmp = new ConfigurationNodeCollection(); |
196 | tmp.Sort(); | 207 | tmp.AddRange(ConfigurationsTable); |
197 | return tmp; | 208 | return tmp; |
198 | } | 209 | } |
199 | } | 210 | } |
200 | 211 | ||
@@ -202,7 +213,7 @@ namespace Prebuild.Core.Nodes | |||
202 | /// Gets the configurations table. | 213 | /// Gets the configurations table. |
203 | /// </summary> | 214 | /// </summary> |
204 | /// <value>The configurations table.</value> | 215 | /// <value>The configurations table.</value> |
205 | public Hashtable ConfigurationsTable | 216 | public ConfigurationNodeCollection ConfigurationsTable |
206 | { | 217 | { |
207 | get | 218 | get |
208 | { | 219 | { |
@@ -212,7 +223,7 @@ namespace Prebuild.Core.Nodes | |||
212 | /// <summary> | 223 | /// <summary> |
213 | /// Gets the database projects. | 224 | /// Gets the database projects. |
214 | /// </summary> | 225 | /// </summary> |
215 | public ICollection DatabaseProjects | 226 | public ICollection<DatabaseProjectNode> DatabaseProjects |
216 | { | 227 | { |
217 | get | 228 | get |
218 | { | 229 | { |
@@ -222,7 +233,7 @@ namespace Prebuild.Core.Nodes | |||
222 | /// <summary> | 233 | /// <summary> |
223 | /// Gets the nested solutions. | 234 | /// Gets the nested solutions. |
224 | /// </summary> | 235 | /// </summary> |
225 | public ICollection Solutions | 236 | public ICollection<SolutionNode> Solutions |
226 | { | 237 | { |
227 | get | 238 | get |
228 | { | 239 | { |
@@ -232,22 +243,22 @@ namespace Prebuild.Core.Nodes | |||
232 | /// <summary> | 243 | /// <summary> |
233 | /// Gets the nested solutions hash table. | 244 | /// Gets the nested solutions hash table. |
234 | /// </summary> | 245 | /// </summary> |
235 | public Hashtable SolutionsTable | 246 | public Dictionary<string, SolutionNode> SolutionsTable |
236 | { | 247 | { |
237 | get | 248 | get |
238 | { | 249 | { |
239 | return this.m_Solutions; | 250 | return m_Solutions; |
240 | } | 251 | } |
241 | } | 252 | } |
242 | /// <summary> | 253 | /// <summary> |
243 | /// Gets the projects. | 254 | /// Gets the projects. |
244 | /// </summary> | 255 | /// </summary> |
245 | /// <value>The projects.</value> | 256 | /// <value>The projects.</value> |
246 | public ICollection Projects | 257 | public ICollection<ProjectNode> Projects |
247 | { | 258 | { |
248 | get | 259 | get |
249 | { | 260 | { |
250 | ArrayList tmp = new ArrayList(m_Projects.Values); | 261 | List<ProjectNode> tmp = new List<ProjectNode>(m_Projects.Values); |
251 | tmp.Sort(); | 262 | tmp.Sort(); |
252 | return tmp; | 263 | return tmp; |
253 | } | 264 | } |
@@ -257,7 +268,7 @@ namespace Prebuild.Core.Nodes | |||
257 | /// Gets the projects table. | 268 | /// Gets the projects table. |
258 | /// </summary> | 269 | /// </summary> |
259 | /// <value>The projects table.</value> | 270 | /// <value>The projects table.</value> |
260 | public Hashtable ProjectsTable | 271 | public Dictionary<string, ProjectNode> ProjectsTable |
261 | { | 272 | { |
262 | get | 273 | get |
263 | { | 274 | { |
@@ -325,16 +336,23 @@ namespace Prebuild.Core.Nodes | |||
325 | } | 336 | } |
326 | else if(dataNode is ConfigurationNode) | 337 | else if(dataNode is ConfigurationNode) |
327 | { | 338 | { |
328 | m_Configurations[((ConfigurationNode)dataNode).Name] = dataNode; | 339 | ConfigurationNode configurationNode = (ConfigurationNode) dataNode; |
340 | m_Configurations[configurationNode.NameAndPlatform] = configurationNode; | ||
341 | |||
342 | // If the active configuration is null, then we populate it. | ||
343 | if (ActiveConfig == null) | ||
344 | { | ||
345 | ActiveConfig = configurationNode.Name; | ||
346 | } | ||
329 | } | 347 | } |
330 | else if(dataNode is ProjectNode) | 348 | else if(dataNode is ProjectNode) |
331 | { | 349 | { |
332 | m_Projects[((ProjectNode)dataNode).Name] = dataNode; | 350 | m_Projects[((ProjectNode)dataNode).Name] = (ProjectNode) dataNode; |
333 | m_ProjectsOrder.Add((ProjectNode)dataNode); | 351 | m_ProjectsOrder.Add((ProjectNode)dataNode); |
334 | } | 352 | } |
335 | else if(dataNode is SolutionNode) | 353 | else if(dataNode is SolutionNode) |
336 | { | 354 | { |
337 | m_Solutions[((SolutionNode)dataNode).Name] = dataNode; | 355 | m_Solutions[((SolutionNode)dataNode).Name] = (SolutionNode) dataNode; |
338 | } | 356 | } |
339 | else if (dataNode is ProcessNode) | 357 | else if (dataNode is ProcessNode) |
340 | { | 358 | { |
@@ -343,7 +361,13 @@ namespace Prebuild.Core.Nodes | |||
343 | } | 361 | } |
344 | else if (dataNode is DatabaseProjectNode) | 362 | else if (dataNode is DatabaseProjectNode) |
345 | { | 363 | { |
346 | m_DatabaseProjects[((DatabaseProjectNode)dataNode).Name] = dataNode; | 364 | m_DatabaseProjects[((DatabaseProjectNode)dataNode).Name] = (DatabaseProjectNode) dataNode; |
365 | } | ||
366 | else if(dataNode is CleanupNode) | ||
367 | { | ||
368 | if(m_Cleanup != null) | ||
369 | throw new WarningException("There can only be one Cleanup node."); | ||
370 | m_Cleanup = (CleanupNode)dataNode; | ||
347 | } | 371 | } |
348 | } | 372 | } |
349 | } | 373 | } |