diff options
author | BlueWall | 2010-08-31 17:02:36 -0400 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2010-09-04 02:12:21 +0100 |
commit | 1e44ec84bd90ec9078027d1d9d78e83c7d305f2a (patch) | |
tree | e34db5ced4bc7bf59b98ff9fb72271dda0f25a33 /Prebuild/src/Core/Nodes | |
parent | Merge branch 'master' of ssh://opensimulator.org/var/git/opensim (diff) | |
download | opensim-SC-1e44ec84bd90ec9078027d1d9d78e83c7d305f2a.zip opensim-SC-1e44ec84bd90ec9078027d1d9d78e83c7d305f2a.tar.gz opensim-SC-1e44ec84bd90ec9078027d1d9d78e83c7d305f2a.tar.bz2 opensim-SC-1e44ec84bd90ec9078027d1d9d78e83c7d305f2a.tar.xz |
Build system upgrade:
Upgrading Prebuild.exe to correctly construct build solutions
for crossplatform tools such as xbuild, monodevelop and nant.
NOTE: Module prebuild files will need modification to work,
as the prebuild must correctly define the reference path for
all assemblies shipped in the OpenSimulator ./bin directory.
These include assemblies such as XMLRPC.dll, OpenMetaverse.dll,
Nini.dll, etc. . The entries should follow the form:
<Reference name="Nini" path="../../../bin/"/>
See the distributed prebuild.xml for further examples.
Crossplatform tools: xbuild and monodevelop use the
vs2008 OpenSim.sln and the .csproj files in each namespace.
Changes to the Prebuild.exe are against svn 322 and are included
in a patch attached to the mantis. And the dnpb source are
available@ svn co https://dnpb.svn.sourceforge.net/svnroot/dnpb dnpb
The patches are pending application by the dnpb team. After which,
the un-modified upstream Prebuild.exe will work as expected.
Diffstat (limited to 'Prebuild/src/Core/Nodes')
-rw-r--r-- | Prebuild/src/Core/Nodes/AuthorNode.cs | 89 | ||||
-rw-r--r-- | Prebuild/src/Core/Nodes/ConfigurationNode.cs | 178 | ||||
-rw-r--r-- | Prebuild/src/Core/Nodes/DataNode.cs | 117 | ||||
-rw-r--r-- | Prebuild/src/Core/Nodes/DatabaseProjectNode.cs | 94 | ||||
-rw-r--r-- | Prebuild/src/Core/Nodes/DatabaseReferenceNode.cs | 63 | ||||
-rw-r--r-- | Prebuild/src/Core/Nodes/DescriptionNode.cs | 89 | ||||
-rw-r--r-- | Prebuild/src/Core/Nodes/ExcludeNode.cs | 89 | ||||
-rw-r--r-- | Prebuild/src/Core/Nodes/FileNode.cs | 271 | ||||
-rw-r--r-- | Prebuild/src/Core/Nodes/FilesNode.cs | 247 | ||||
-rw-r--r-- | Prebuild/src/Core/Nodes/MatchNode.cs | 330 | ||||
-rw-r--r-- | Prebuild/src/Core/Nodes/OptionsNode.cs | 644 | ||||
-rw-r--r-- | Prebuild/src/Core/Nodes/ProcessNode.cs | 110 | ||||
-rw-r--r-- | Prebuild/src/Core/Nodes/ProjectNode.cs | 580 | ||||
-rw-r--r-- | Prebuild/src/Core/Nodes/ReferenceNode.cs | 144 | ||||
-rw-r--r-- | Prebuild/src/Core/Nodes/ReferencePathNode.cs | 99 | ||||
-rw-r--r-- | Prebuild/src/Core/Nodes/SolutionNode.cs | 358 |
16 files changed, 0 insertions, 3502 deletions
diff --git a/Prebuild/src/Core/Nodes/AuthorNode.cs b/Prebuild/src/Core/Nodes/AuthorNode.cs deleted file mode 100644 index 20e72c0..0000000 --- a/Prebuild/src/Core/Nodes/AuthorNode.cs +++ /dev/null | |||
@@ -1,89 +0,0 @@ | |||
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; | ||
28 | using System.Collections.Specialized; | ||
29 | using System.Xml; | ||
30 | |||
31 | using Prebuild.Core.Attributes; | ||
32 | using Prebuild.Core.Interfaces; | ||
33 | using Prebuild.Core.Utilities; | ||
34 | |||
35 | namespace Prebuild.Core.Nodes | ||
36 | { | ||
37 | /// <summary> | ||
38 | /// | ||
39 | /// </summary> | ||
40 | [DataNode("Author")] | ||
41 | public class AuthorNode : DataNode | ||
42 | { | ||
43 | #region Fields | ||
44 | |||
45 | private string m_Signature; | ||
46 | |||
47 | #endregion | ||
48 | |||
49 | #region Properties | ||
50 | |||
51 | /// <summary> | ||
52 | /// Gets the signature. | ||
53 | /// </summary> | ||
54 | /// <value>The signature.</value> | ||
55 | public string Signature | ||
56 | { | ||
57 | get | ||
58 | { | ||
59 | return m_Signature; | ||
60 | } | ||
61 | } | ||
62 | |||
63 | #endregion | ||
64 | |||
65 | #region Public Methods | ||
66 | |||
67 | /// <summary> | ||
68 | /// Parses the specified node. | ||
69 | /// </summary> | ||
70 | /// <param name="node">The node.</param> | ||
71 | public override void Parse(XmlNode node) | ||
72 | { | ||
73 | if( node == null ) | ||
74 | { | ||
75 | throw new ArgumentNullException("node"); | ||
76 | } | ||
77 | |||
78 | m_Signature = Helper.InterpolateForEnvironmentVariables(node.InnerText); | ||
79 | if(m_Signature == null) | ||
80 | { | ||
81 | m_Signature = ""; | ||
82 | } | ||
83 | |||
84 | m_Signature = m_Signature.Trim(); | ||
85 | } | ||
86 | |||
87 | #endregion | ||
88 | } | ||
89 | } | ||
diff --git a/Prebuild/src/Core/Nodes/ConfigurationNode.cs b/Prebuild/src/Core/Nodes/ConfigurationNode.cs deleted file mode 100644 index 67d78d5..0000000 --- a/Prebuild/src/Core/Nodes/ConfigurationNode.cs +++ /dev/null | |||
@@ -1,178 +0,0 @@ | |||
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; | ||
27 | using System.Xml; | ||
28 | |||
29 | using Prebuild.Core.Attributes; | ||
30 | using Prebuild.Core.Interfaces; | ||
31 | using Prebuild.Core.Utilities; | ||
32 | |||
33 | namespace Prebuild.Core.Nodes | ||
34 | { | ||
35 | /// <summary> | ||
36 | /// | ||
37 | /// </summary> | ||
38 | [DataNode("Configuration")] | ||
39 | public class ConfigurationNode : DataNode, ICloneable, IComparable | ||
40 | { | ||
41 | #region Fields | ||
42 | |||
43 | private string m_Name = "unknown"; | ||
44 | private OptionsNode m_Options; | ||
45 | |||
46 | #endregion | ||
47 | |||
48 | #region Constructors | ||
49 | |||
50 | /// <summary> | ||
51 | /// Initializes a new instance of the <see cref="ConfigurationNode"/> class. | ||
52 | /// </summary> | ||
53 | public ConfigurationNode() | ||
54 | { | ||
55 | m_Options = new OptionsNode(); | ||
56 | } | ||
57 | |||
58 | #endregion | ||
59 | |||
60 | #region Properties | ||
61 | |||
62 | /// <summary> | ||
63 | /// Gets or sets the parent. | ||
64 | /// </summary> | ||
65 | /// <value>The parent.</value> | ||
66 | public override IDataNode Parent | ||
67 | { | ||
68 | get | ||
69 | { | ||
70 | return base.Parent; | ||
71 | } | ||
72 | set | ||
73 | { | ||
74 | base.Parent = value; | ||
75 | if(base.Parent is SolutionNode) | ||
76 | { | ||
77 | SolutionNode node = (SolutionNode)base.Parent; | ||
78 | if(node != null && node.Options != null) | ||
79 | { | ||
80 | node.Options.CopyTo(m_Options); | ||
81 | } | ||
82 | } | ||
83 | } | ||
84 | } | ||
85 | |||
86 | /// <summary> | ||
87 | /// Gets the name. | ||
88 | /// </summary> | ||
89 | /// <value>The name.</value> | ||
90 | public string Name | ||
91 | { | ||
92 | get | ||
93 | { | ||
94 | return m_Name; | ||
95 | } | ||
96 | } | ||
97 | |||
98 | /// <summary> | ||
99 | /// Gets or sets the options. | ||
100 | /// </summary> | ||
101 | /// <value>The options.</value> | ||
102 | public OptionsNode Options | ||
103 | { | ||
104 | get | ||
105 | { | ||
106 | return m_Options; | ||
107 | } | ||
108 | set | ||
109 | { | ||
110 | m_Options = value; | ||
111 | } | ||
112 | } | ||
113 | |||
114 | #endregion | ||
115 | |||
116 | #region Public Methods | ||
117 | |||
118 | /// <summary> | ||
119 | /// Parses the specified node. | ||
120 | /// </summary> | ||
121 | /// <param name="node">The node.</param> | ||
122 | public override void Parse(XmlNode node) | ||
123 | { | ||
124 | m_Name = Helper.AttributeValue(node, "name", m_Name); | ||
125 | if( node == null ) | ||
126 | { | ||
127 | throw new ArgumentNullException("node"); | ||
128 | } | ||
129 | foreach(XmlNode child in node.ChildNodes) | ||
130 | { | ||
131 | IDataNode dataNode = Kernel.Instance.ParseNode(child, this); | ||
132 | if(dataNode is OptionsNode) | ||
133 | { | ||
134 | ((OptionsNode)dataNode).CopyTo(m_Options); | ||
135 | } | ||
136 | } | ||
137 | } | ||
138 | |||
139 | /// <summary> | ||
140 | /// Copies to. | ||
141 | /// </summary> | ||
142 | /// <param name="conf">The conf.</param> | ||
143 | public void CopyTo(ConfigurationNode conf) | ||
144 | { | ||
145 | m_Options.CopyTo(conf.m_Options); | ||
146 | } | ||
147 | |||
148 | #endregion | ||
149 | |||
150 | #region ICloneable Members | ||
151 | |||
152 | /// <summary> | ||
153 | /// Creates a new object that is a copy of the current instance. | ||
154 | /// </summary> | ||
155 | /// <returns> | ||
156 | /// A new object that is a copy of this instance. | ||
157 | /// </returns> | ||
158 | public object Clone() | ||
159 | { | ||
160 | ConfigurationNode ret = new ConfigurationNode(); | ||
161 | ret.m_Name = m_Name; | ||
162 | m_Options.CopyTo(ret.m_Options); | ||
163 | return ret; | ||
164 | } | ||
165 | |||
166 | #endregion | ||
167 | |||
168 | #region IComparable Members | ||
169 | |||
170 | public int CompareTo(object obj) | ||
171 | { | ||
172 | ConfigurationNode that = (ConfigurationNode) obj; | ||
173 | return this.m_Name.CompareTo(that.m_Name); | ||
174 | } | ||
175 | |||
176 | #endregion | ||
177 | } | ||
178 | } | ||
diff --git a/Prebuild/src/Core/Nodes/DataNode.cs b/Prebuild/src/Core/Nodes/DataNode.cs deleted file mode 100644 index 763e6c3..0000000 --- a/Prebuild/src/Core/Nodes/DataNode.cs +++ /dev/null | |||
@@ -1,117 +0,0 @@ | |||
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; | ||
27 | using System.Xml; | ||
28 | |||
29 | using Prebuild.Core.Attributes; | ||
30 | using Prebuild.Core.Interfaces; | ||
31 | using System.IO; | ||
32 | |||
33 | namespace Prebuild.Core.Nodes | ||
34 | { | ||
35 | /// <summary> | ||
36 | /// | ||
37 | /// </summary> | ||
38 | public abstract class DataNode : IDataNode | ||
39 | { | ||
40 | #region Fields | ||
41 | |||
42 | private IDataNode parent; | ||
43 | string[] m_WebTypes = new string[] { "aspx", "ascx", "master", "ashx", "asmx" }; | ||
44 | |||
45 | #endregion | ||
46 | |||
47 | #region IDataNode Members | ||
48 | |||
49 | /// <summary> | ||
50 | /// Gets or sets the parent. | ||
51 | /// </summary> | ||
52 | /// <value>The parent.</value> | ||
53 | public virtual IDataNode Parent | ||
54 | { | ||
55 | get | ||
56 | { | ||
57 | return parent; | ||
58 | } | ||
59 | set | ||
60 | { | ||
61 | parent = value; | ||
62 | } | ||
63 | } | ||
64 | public string[] WebTypes | ||
65 | { | ||
66 | get { return m_WebTypes; } | ||
67 | } | ||
68 | /// <summary> | ||
69 | /// Parses the specified node. | ||
70 | /// </summary> | ||
71 | /// <param name="node">The node.</param> | ||
72 | public virtual void Parse(XmlNode node) | ||
73 | { | ||
74 | } | ||
75 | public BuildAction GetBuildActionByFileName(string fileName) | ||
76 | { | ||
77 | string extension = Path.GetExtension(fileName).ToLower(); | ||
78 | foreach (string type in WebTypes) | ||
79 | { | ||
80 | if (extension == type) | ||
81 | return BuildAction.Content; | ||
82 | } | ||
83 | return BuildAction.Compile; | ||
84 | } | ||
85 | /// <summary> | ||
86 | /// Parses the file type to figure out what type it is | ||
87 | /// </summary> | ||
88 | /// <returns></returns> | ||
89 | public SubType GetSubTypeByFileName(string fileName) | ||
90 | { | ||
91 | string extension = System.IO.Path.GetExtension(fileName).ToLower(); | ||
92 | string designer = String.Format(".designer{0}", extension); | ||
93 | string path = fileName.ToLower(); | ||
94 | if (extension == ".resx") | ||
95 | { | ||
96 | return SubType.Designer; | ||
97 | } | ||
98 | else if (path.EndsWith(".settings")) | ||
99 | { | ||
100 | return SubType.Settings; | ||
101 | } | ||
102 | else | ||
103 | { | ||
104 | |||
105 | foreach (string type in WebTypes) | ||
106 | { | ||
107 | if (path.EndsWith(string.Format("{0}{1}", type, extension))) | ||
108 | { | ||
109 | return SubType.CodeBehind; | ||
110 | } | ||
111 | } | ||
112 | } | ||
113 | return SubType.Code; | ||
114 | } | ||
115 | #endregion | ||
116 | } | ||
117 | } | ||
diff --git a/Prebuild/src/Core/Nodes/DatabaseProjectNode.cs b/Prebuild/src/Core/Nodes/DatabaseProjectNode.cs deleted file mode 100644 index 27c2051..0000000 --- a/Prebuild/src/Core/Nodes/DatabaseProjectNode.cs +++ /dev/null | |||
@@ -1,94 +0,0 @@ | |||
1 | using System; | ||
2 | using System.Collections; | ||
3 | using System.Collections.Generic; | ||
4 | using System.Text; | ||
5 | using System.Xml; | ||
6 | |||
7 | using Prebuild.Core.Attributes; | ||
8 | using Prebuild.Core.Interfaces; | ||
9 | using Prebuild.Core.Utilities; | ||
10 | |||
11 | namespace Prebuild.Core.Nodes | ||
12 | { | ||
13 | [DataNode("DatabaseProject")] | ||
14 | public class DatabaseProjectNode : DataNode | ||
15 | { | ||
16 | string name; | ||
17 | string path; | ||
18 | string fullpath; | ||
19 | Guid guid = Guid.NewGuid(); | ||
20 | readonly List<AuthorNode> authors = new List<AuthorNode>(); | ||
21 | readonly List<DatabaseReferenceNode> references = new List<DatabaseReferenceNode>(); | ||
22 | |||
23 | public Guid Guid | ||
24 | { | ||
25 | get { return guid; } | ||
26 | } | ||
27 | |||
28 | public string Name | ||
29 | { | ||
30 | get { return name; } | ||
31 | } | ||
32 | |||
33 | public string Path | ||
34 | { | ||
35 | get { return path; } | ||
36 | } | ||
37 | |||
38 | public string FullPath | ||
39 | { | ||
40 | get { return fullpath; } | ||
41 | } | ||
42 | |||
43 | public IEnumerable<DatabaseReferenceNode> References | ||
44 | { | ||
45 | get { return references; } | ||
46 | } | ||
47 | |||
48 | public override void Parse(XmlNode node) | ||
49 | { | ||
50 | name = Helper.AttributeValue(node, "name", name); | ||
51 | path = Helper.AttributeValue(node, "path", name); | ||
52 | |||
53 | try | ||
54 | { | ||
55 | fullpath = Helper.ResolvePath(path); | ||
56 | } | ||
57 | catch | ||
58 | { | ||
59 | throw new WarningException("Could not resolve Solution path: {0}", path); | ||
60 | } | ||
61 | |||
62 | Kernel.Instance.CurrentWorkingDirectory.Push(); | ||
63 | |||
64 | try | ||
65 | { | ||
66 | Helper.SetCurrentDir(fullpath); | ||
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 | |||
77 | if (dataNode == null) | ||
78 | continue; | ||
79 | |||
80 | if (dataNode is AuthorNode) | ||
81 | authors.Add((AuthorNode)dataNode); | ||
82 | else if (dataNode is DatabaseReferenceNode) | ||
83 | references.Add((DatabaseReferenceNode)dataNode); | ||
84 | } | ||
85 | } | ||
86 | finally | ||
87 | { | ||
88 | Kernel.Instance.CurrentWorkingDirectory.Pop(); | ||
89 | } | ||
90 | |||
91 | base.Parse(node); | ||
92 | } | ||
93 | } | ||
94 | } | ||
diff --git a/Prebuild/src/Core/Nodes/DatabaseReferenceNode.cs b/Prebuild/src/Core/Nodes/DatabaseReferenceNode.cs deleted file mode 100644 index 845db24..0000000 --- a/Prebuild/src/Core/Nodes/DatabaseReferenceNode.cs +++ /dev/null | |||
@@ -1,63 +0,0 @@ | |||
1 | using System; | ||
2 | using Prebuild.Core.Attributes; | ||
3 | using Prebuild.Core.Utilities; | ||
4 | |||
5 | namespace Prebuild.Core.Nodes | ||
6 | { | ||
7 | [DataNode("DatabaseReference")] | ||
8 | public class DatabaseReferenceNode : DataNode | ||
9 | { | ||
10 | string name; | ||
11 | Guid providerId; | ||
12 | string connectionString; | ||
13 | |||
14 | public string Name | ||
15 | { | ||
16 | get { return name; } | ||
17 | } | ||
18 | |||
19 | public Guid ProviderId | ||
20 | { | ||
21 | get { return providerId; } | ||
22 | } | ||
23 | |||
24 | public string ConnectionString | ||
25 | { | ||
26 | get { return connectionString; } | ||
27 | } | ||
28 | |||
29 | public override void Parse(System.Xml.XmlNode node) | ||
30 | { | ||
31 | name = Helper.AttributeValue(node, "name", name); | ||
32 | |||
33 | string providerName = Helper.AttributeValue(node, "providerName", string.Empty); | ||
34 | if (providerName != null) | ||
35 | { | ||
36 | switch (providerName) | ||
37 | { | ||
38 | // digitaljeebus: pulled from HKLM\SOFTWARE\Microsoft\VisualStudio\9.0\DataProviders\* | ||
39 | // Not sure if these will help other operating systems, or if there's a better way. | ||
40 | case "Microsoft.SqlServerCe.Client.3.5": | ||
41 | providerId = new Guid("7C602B5B-ACCB-4acd-9DC0-CA66388C1533"); break; | ||
42 | case "System.Data.OleDb": | ||
43 | providerId = new Guid("7F041D59-D76A-44ed-9AA2-FBF6B0548B80"); break; | ||
44 | case "System.Data.OracleClient": | ||
45 | providerId = new Guid("8F5C5018-AE09-42cf-B2CC-2CCCC7CFC2BB"); break; | ||
46 | case "System.Data.SqlClient": | ||
47 | providerId = new Guid("91510608-8809-4020-8897-FBA057E22D54"); break; | ||
48 | case "System.Data.Odbc": | ||
49 | providerId = new Guid("C3D4F4CE-2C48-4381-B4D6-34FA50C51C86"); break; | ||
50 | |||
51 | default: | ||
52 | throw new ArgumentOutOfRangeException("providerName", providerName, "Could not provider name to an id."); | ||
53 | } | ||
54 | } | ||
55 | else | ||
56 | providerId = new Guid(Helper.AttributeValue(node, "providerId", Guid.Empty.ToString("B"))); | ||
57 | |||
58 | connectionString = Helper.AttributeValue(node, "connectionString", connectionString); | ||
59 | |||
60 | base.Parse(node); | ||
61 | } | ||
62 | } | ||
63 | } | ||
diff --git a/Prebuild/src/Core/Nodes/DescriptionNode.cs b/Prebuild/src/Core/Nodes/DescriptionNode.cs deleted file mode 100644 index 353a5ae..0000000 --- a/Prebuild/src/Core/Nodes/DescriptionNode.cs +++ /dev/null | |||
@@ -1,89 +0,0 @@ | |||
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; | ||
28 | using System.Collections.Specialized; | ||
29 | using System.Xml; | ||
30 | |||
31 | using Prebuild.Core.Attributes; | ||
32 | using Prebuild.Core.Interfaces; | ||
33 | using Prebuild.Core.Utilities; | ||
34 | |||
35 | namespace Prebuild.Core.Nodes | ||
36 | { | ||
37 | /// <summary> | ||
38 | /// The object representing the /Prebuild/Solution/Project/Description element | ||
39 | /// </summary> | ||
40 | [DataNode("Description")] | ||
41 | public class DescriptionNode : DataNode | ||
42 | { | ||
43 | #region Fields | ||
44 | |||
45 | private string m_Value; | ||
46 | |||
47 | #endregion | ||
48 | |||
49 | #region Properties | ||
50 | |||
51 | /// <summary> | ||
52 | /// Gets the description Value. | ||
53 | /// </summary> | ||
54 | /// <value>The description Value.</value> | ||
55 | public string Value | ||
56 | { | ||
57 | get | ||
58 | { | ||
59 | return m_Value; | ||
60 | } | ||
61 | } | ||
62 | |||
63 | #endregion | ||
64 | |||
65 | #region Public Methods | ||
66 | |||
67 | /// <summary> | ||
68 | /// Parses the specified node. | ||
69 | /// </summary> | ||
70 | /// <param name="node">The node.</param> | ||
71 | public override void Parse(XmlNode node) | ||
72 | { | ||
73 | if( node == null ) | ||
74 | { | ||
75 | throw new ArgumentNullException("node"); | ||
76 | } | ||
77 | |||
78 | m_Value = Helper.InterpolateForEnvironmentVariables(node.InnerText); | ||
79 | if(m_Value == null) | ||
80 | { | ||
81 | m_Value = ""; | ||
82 | } | ||
83 | |||
84 | m_Value = m_Value.Trim(); | ||
85 | } | ||
86 | |||
87 | #endregion | ||
88 | } | ||
89 | } | ||
diff --git a/Prebuild/src/Core/Nodes/ExcludeNode.cs b/Prebuild/src/Core/Nodes/ExcludeNode.cs deleted file mode 100644 index 7f04cba..0000000 --- a/Prebuild/src/Core/Nodes/ExcludeNode.cs +++ /dev/null | |||
@@ -1,89 +0,0 @@ | |||
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; | ||
27 | using System.Xml; | ||
28 | |||
29 | using Prebuild.Core.Attributes; | ||
30 | using Prebuild.Core.Interfaces; | ||
31 | using Prebuild.Core.Utilities; | ||
32 | |||
33 | namespace Prebuild.Core.Nodes | ||
34 | { | ||
35 | /// <summary> | ||
36 | /// | ||
37 | /// </summary> | ||
38 | [DataNode("Exclude")] | ||
39 | public class ExcludeNode : DataNode | ||
40 | { | ||
41 | #region Fields | ||
42 | |||
43 | private string m_Pattern = ""; | ||
44 | |||
45 | #endregion | ||
46 | |||
47 | #region Properties | ||
48 | |||
49 | /// <summary> | ||
50 | /// Gets the name. | ||
51 | /// </summary> | ||
52 | /// <value>The name.</value> | ||
53 | public string Name | ||
54 | { | ||
55 | get | ||
56 | { | ||
57 | return m_Pattern; | ||
58 | } | ||
59 | } | ||
60 | |||
61 | /// <summary> | ||
62 | /// Gets the pattern. | ||
63 | /// </summary> | ||
64 | /// <value>The pattern.</value> | ||
65 | public string Pattern | ||
66 | { | ||
67 | get | ||
68 | { | ||
69 | return m_Pattern; | ||
70 | } | ||
71 | } | ||
72 | |||
73 | #endregion | ||
74 | |||
75 | #region Public Methods | ||
76 | |||
77 | /// <summary> | ||
78 | /// Parses the specified node. | ||
79 | /// </summary> | ||
80 | /// <param name="node">The node.</param> | ||
81 | public override void Parse(XmlNode node) | ||
82 | { | ||
83 | m_Pattern = Helper.AttributeValue( node, "name", m_Pattern ); | ||
84 | m_Pattern = Helper.AttributeValue(node, "pattern", m_Pattern ); | ||
85 | } | ||
86 | |||
87 | #endregion | ||
88 | } | ||
89 | } | ||
diff --git a/Prebuild/src/Core/Nodes/FileNode.cs b/Prebuild/src/Core/Nodes/FileNode.cs deleted file mode 100644 index 1520fcb..0000000 --- a/Prebuild/src/Core/Nodes/FileNode.cs +++ /dev/null | |||
@@ -1,271 +0,0 @@ | |||
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; | ||
27 | using System.IO; | ||
28 | using System.Xml; | ||
29 | |||
30 | using Prebuild.Core.Attributes; | ||
31 | using Prebuild.Core.Interfaces; | ||
32 | using Prebuild.Core.Utilities; | ||
33 | using Prebuild.Core.Targets; | ||
34 | |||
35 | namespace Prebuild.Core.Nodes | ||
36 | { | ||
37 | /// <summary> | ||
38 | /// | ||
39 | /// </summary> | ||
40 | public enum BuildAction | ||
41 | { | ||
42 | /// <summary> | ||
43 | /// | ||
44 | /// </summary> | ||
45 | None, | ||
46 | /// <summary> | ||
47 | /// | ||
48 | /// </summary> | ||
49 | Compile, | ||
50 | /// <summary> | ||
51 | /// | ||
52 | /// </summary> | ||
53 | Content, | ||
54 | /// <summary> | ||
55 | /// | ||
56 | /// </summary> | ||
57 | EmbeddedResource | ||
58 | } | ||
59 | |||
60 | /// <summary> | ||
61 | /// | ||
62 | /// </summary> | ||
63 | public enum SubType | ||
64 | { | ||
65 | /// <summary> | ||
66 | /// | ||
67 | /// </summary> | ||
68 | Code, | ||
69 | /// <summary> | ||
70 | /// | ||
71 | /// </summary> | ||
72 | Component, | ||
73 | /// <summary> | ||
74 | /// | ||
75 | /// </summary> | ||
76 | Designer, | ||
77 | /// <summary> | ||
78 | /// | ||
79 | /// </summary> | ||
80 | Form, | ||
81 | /// <summary> | ||
82 | /// | ||
83 | /// </summary> | ||
84 | Settings, | ||
85 | /// <summary> | ||
86 | /// | ||
87 | /// </summary> | ||
88 | UserControl, | ||
89 | /// <summary> | ||
90 | /// | ||
91 | /// </summary> | ||
92 | CodeBehind, | ||
93 | } | ||
94 | |||
95 | public enum CopyToOutput | ||
96 | { | ||
97 | Never, | ||
98 | Always, | ||
99 | PreserveNewest | ||
100 | } | ||
101 | |||
102 | /// <summary> | ||
103 | /// | ||
104 | /// </summary> | ||
105 | [DataNode("File")] | ||
106 | public class FileNode : DataNode | ||
107 | { | ||
108 | #region Fields | ||
109 | |||
110 | private string m_Path; | ||
111 | private string m_ResourceName = ""; | ||
112 | private BuildAction? m_BuildAction; | ||
113 | private bool m_Valid; | ||
114 | private SubType? m_SubType; | ||
115 | private CopyToOutput m_CopyToOutput = CopyToOutput.Never; | ||
116 | private bool m_Link = false; | ||
117 | private string m_LinkPath = string.Empty; | ||
118 | private bool m_PreservePath = false; | ||
119 | |||
120 | |||
121 | #endregion | ||
122 | |||
123 | #region Properties | ||
124 | |||
125 | /// <summary> | ||
126 | /// | ||
127 | /// </summary> | ||
128 | public string Path | ||
129 | { | ||
130 | get | ||
131 | { | ||
132 | return m_Path; | ||
133 | } | ||
134 | } | ||
135 | |||
136 | /// <summary> | ||
137 | /// | ||
138 | /// </summary> | ||
139 | public string ResourceName | ||
140 | { | ||
141 | get | ||
142 | { | ||
143 | return m_ResourceName; | ||
144 | } | ||
145 | } | ||
146 | |||
147 | /// <summary> | ||
148 | /// | ||
149 | /// </summary> | ||
150 | public BuildAction BuildAction | ||
151 | { | ||
152 | get | ||
153 | { | ||
154 | if (m_BuildAction != null) | ||
155 | return m_BuildAction.Value; | ||
156 | else | ||
157 | return GetBuildActionByFileName(this.Path); | ||
158 | |||
159 | } | ||
160 | } | ||
161 | |||
162 | public CopyToOutput CopyToOutput | ||
163 | { | ||
164 | get | ||
165 | { | ||
166 | return this.m_CopyToOutput; | ||
167 | } | ||
168 | } | ||
169 | |||
170 | public bool IsLink | ||
171 | { | ||
172 | get | ||
173 | { | ||
174 | return this.m_Link; | ||
175 | } | ||
176 | } | ||
177 | |||
178 | public string LinkPath | ||
179 | { | ||
180 | get | ||
181 | { | ||
182 | return this.m_LinkPath; | ||
183 | } | ||
184 | } | ||
185 | /// <summary> | ||
186 | /// | ||
187 | /// </summary> | ||
188 | public SubType SubType | ||
189 | { | ||
190 | get | ||
191 | { | ||
192 | if (m_SubType != null) | ||
193 | return m_SubType.Value; | ||
194 | else | ||
195 | return GetSubTypeByFileName(this.Path); | ||
196 | } | ||
197 | } | ||
198 | |||
199 | /// <summary> | ||
200 | /// | ||
201 | /// </summary> | ||
202 | public bool IsValid | ||
203 | { | ||
204 | get | ||
205 | { | ||
206 | return m_Valid; | ||
207 | } | ||
208 | } | ||
209 | |||
210 | /// <summary> | ||
211 | /// | ||
212 | /// </summary> | ||
213 | /// <param name="file"></param> | ||
214 | /// <returns></returns> | ||
215 | public bool PreservePath | ||
216 | { | ||
217 | get | ||
218 | { | ||
219 | return m_PreservePath; | ||
220 | } | ||
221 | } | ||
222 | |||
223 | #endregion | ||
224 | |||
225 | #region Public Methods | ||
226 | |||
227 | /// <summary> | ||
228 | /// | ||
229 | /// </summary> | ||
230 | /// <param name="node"></param> | ||
231 | public override void Parse(XmlNode node) | ||
232 | { | ||
233 | string buildAction = Helper.AttributeValue(node, "buildAction", String.Empty); | ||
234 | if (buildAction != string.Empty) | ||
235 | m_BuildAction = (BuildAction)Enum.Parse(typeof(BuildAction), buildAction); | ||
236 | string subType = Helper.AttributeValue(node, "subType", string.Empty); | ||
237 | if (subType != String.Empty) | ||
238 | m_SubType = (SubType)Enum.Parse(typeof(SubType), subType); | ||
239 | |||
240 | m_ResourceName = Helper.AttributeValue(node, "resourceName", m_ResourceName.ToString()); | ||
241 | this.m_Link = bool.Parse(Helper.AttributeValue(node, "link", bool.FalseString)); | ||
242 | if ( this.m_Link == true ) | ||
243 | { | ||
244 | this.m_LinkPath = Helper.AttributeValue( node, "linkPath", string.Empty ); | ||
245 | } | ||
246 | this.m_CopyToOutput = (CopyToOutput) Enum.Parse(typeof(CopyToOutput), Helper.AttributeValue(node, "copyToOutput", this.m_CopyToOutput.ToString())); | ||
247 | this.m_PreservePath = bool.Parse( Helper.AttributeValue( node, "preservePath", bool.FalseString ) ); | ||
248 | |||
249 | if( node == null ) | ||
250 | { | ||
251 | throw new ArgumentNullException("node"); | ||
252 | } | ||
253 | |||
254 | m_Path = Helper.InterpolateForEnvironmentVariables(node.InnerText); | ||
255 | if(m_Path == null) | ||
256 | { | ||
257 | m_Path = ""; | ||
258 | } | ||
259 | |||
260 | m_Path = m_Path.Trim(); | ||
261 | m_Valid = true; | ||
262 | if(!File.Exists(m_Path)) | ||
263 | { | ||
264 | m_Valid = false; | ||
265 | Kernel.Instance.Log.Write(LogType.Warning, "File does not exist: {0}", m_Path); | ||
266 | } | ||
267 | } | ||
268 | |||
269 | #endregion | ||
270 | } | ||
271 | } | ||
diff --git a/Prebuild/src/Core/Nodes/FilesNode.cs b/Prebuild/src/Core/Nodes/FilesNode.cs deleted file mode 100644 index dc306c2..0000000 --- a/Prebuild/src/Core/Nodes/FilesNode.cs +++ /dev/null | |||
@@ -1,247 +0,0 @@ | |||
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; | ||
27 | using System.Collections; | ||
28 | using System.Collections.Specialized; | ||
29 | using System.Xml; | ||
30 | |||
31 | using Prebuild.Core.Attributes; | ||
32 | using Prebuild.Core.Interfaces; | ||
33 | using System.IO; | ||
34 | |||
35 | namespace Prebuild.Core.Nodes | ||
36 | { | ||
37 | /// <summary> | ||
38 | /// | ||
39 | /// </summary> | ||
40 | [DataNode("Files")] | ||
41 | public class FilesNode : DataNode | ||
42 | { | ||
43 | #region Fields | ||
44 | |||
45 | private StringCollection m_Files; | ||
46 | private Hashtable m_BuildActions; | ||
47 | private Hashtable m_SubTypes; | ||
48 | private Hashtable m_ResourceNames; | ||
49 | private Hashtable m_CopyToOutputs; | ||
50 | private Hashtable m_Links; | ||
51 | private Hashtable m_LinkPaths; | ||
52 | private Hashtable m_PreservePaths; | ||
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 | |||
73 | #endregion | ||
74 | |||
75 | #region Properties | ||
76 | |||
77 | /// <summary> | ||
78 | /// | ||
79 | /// </summary> | ||
80 | public int Count | ||
81 | { | ||
82 | get | ||
83 | { | ||
84 | return m_Files.Count; | ||
85 | } | ||
86 | } | ||
87 | |||
88 | #endregion | ||
89 | |||
90 | #region Public Methods | ||
91 | |||
92 | /// <summary> | ||
93 | /// | ||
94 | /// </summary> | ||
95 | /// <param name="file"></param> | ||
96 | /// <returns></returns> | ||
97 | public BuildAction GetBuildAction(string file) | ||
98 | { | ||
99 | if(!m_BuildActions.ContainsKey(file)) | ||
100 | { | ||
101 | return BuildAction.Compile; | ||
102 | } | ||
103 | |||
104 | return (BuildAction)m_BuildActions[file]; | ||
105 | } | ||
106 | |||
107 | public CopyToOutput GetCopyToOutput(string file) | ||
108 | { | ||
109 | if (!this.m_CopyToOutputs.ContainsKey(file)) | ||
110 | { | ||
111 | return CopyToOutput.Never; | ||
112 | } | ||
113 | return (CopyToOutput) this.m_CopyToOutputs[file]; | ||
114 | } | ||
115 | |||
116 | public bool GetIsLink(string file) | ||
117 | { | ||
118 | if (!this.m_Links.ContainsKey(file)) | ||
119 | { | ||
120 | return false; | ||
121 | } | ||
122 | return (bool) this.m_Links[file]; | ||
123 | } | ||
124 | |||
125 | public string GetLinkPath( string file ) | ||
126 | { | ||
127 | if ( !this.m_LinkPaths.ContainsKey( file ) ) | ||
128 | { | ||
129 | return string.Empty; | ||
130 | } | ||
131 | return (string)this.m_LinkPaths[ file ]; | ||
132 | } | ||
133 | |||
134 | /// <summary> | ||
135 | /// | ||
136 | /// </summary> | ||
137 | /// <param name="file"></param> | ||
138 | /// <returns></returns> | ||
139 | public SubType GetSubType(string file) | ||
140 | { | ||
141 | if(!m_SubTypes.ContainsKey(file)) | ||
142 | { | ||
143 | return SubType.Code; | ||
144 | } | ||
145 | |||
146 | return (SubType)m_SubTypes[file]; | ||
147 | } | ||
148 | |||
149 | /// <summary> | ||
150 | /// | ||
151 | /// </summary> | ||
152 | /// <param name="file"></param> | ||
153 | /// <returns></returns> | ||
154 | public string GetResourceName(string file) | ||
155 | { | ||
156 | if(!m_ResourceNames.ContainsKey(file)) | ||
157 | { | ||
158 | return ""; | ||
159 | } | ||
160 | |||
161 | return (string)m_ResourceNames[file]; | ||
162 | } | ||
163 | |||
164 | /// <summary> | ||
165 | /// | ||
166 | /// </summary> | ||
167 | /// <param name="file"></param> | ||
168 | /// <returns></returns> | ||
169 | public bool GetPreservePath( string file ) | ||
170 | { | ||
171 | if ( !m_PreservePaths.ContainsKey( file ) ) | ||
172 | { | ||
173 | return false; | ||
174 | } | ||
175 | |||
176 | return (bool)m_PreservePaths[ file ]; | ||
177 | } | ||
178 | |||
179 | /// <summary> | ||
180 | /// | ||
181 | /// </summary> | ||
182 | /// <param name="node"></param> | ||
183 | public override void Parse(XmlNode node) | ||
184 | { | ||
185 | if( node == null ) | ||
186 | { | ||
187 | throw new ArgumentNullException("node"); | ||
188 | } | ||
189 | foreach(XmlNode child in node.ChildNodes) | ||
190 | { | ||
191 | IDataNode dataNode = Kernel.Instance.ParseNode(child, this); | ||
192 | if(dataNode is FileNode) | ||
193 | { | ||
194 | FileNode fileNode = (FileNode)dataNode; | ||
195 | if(fileNode.IsValid) | ||
196 | { | ||
197 | if (!m_Files.Contains(fileNode.Path)) | ||
198 | { | ||
199 | m_Files.Add(fileNode.Path); | ||
200 | m_BuildActions[fileNode.Path] = fileNode.BuildAction; | ||
201 | m_SubTypes[fileNode.Path] = fileNode.SubType; | ||
202 | m_ResourceNames[fileNode.Path] = fileNode.ResourceName; | ||
203 | this.m_PreservePaths[ fileNode.Path ] = fileNode.PreservePath; | ||
204 | this.m_Links[ fileNode.Path ] = fileNode.IsLink; | ||
205 | this.m_LinkPaths[ fileNode.Path ] = fileNode.LinkPath; | ||
206 | this.m_CopyToOutputs[ fileNode.Path ] = fileNode.CopyToOutput; | ||
207 | |||
208 | } | ||
209 | } | ||
210 | } | ||
211 | else if(dataNode is MatchNode) | ||
212 | { | ||
213 | foreach(string file in ((MatchNode)dataNode).Files) | ||
214 | { | ||
215 | MatchNode matchNode = (MatchNode)dataNode; | ||
216 | if (!m_Files.Contains(file)) | ||
217 | { | ||
218 | m_Files.Add(file); | ||
219 | m_BuildActions[ file ] = matchNode.BuildAction == null ? GetBuildActionByFileName(file) : matchNode.BuildAction; | ||
220 | m_SubTypes[file] = matchNode.SubType == null ? GetSubTypeByFileName(file) : matchNode.SubType.Value; | ||
221 | m_ResourceNames[ file ] = matchNode.ResourceName; | ||
222 | this.m_PreservePaths[ file ] = matchNode.PreservePath; | ||
223 | this.m_Links[ file ] = matchNode.IsLink; | ||
224 | this.m_LinkPaths[ file ] = matchNode.LinkPath; | ||
225 | this.m_CopyToOutputs[ file ] = matchNode.CopyToOutput; | ||
226 | |||
227 | } | ||
228 | } | ||
229 | } | ||
230 | } | ||
231 | } | ||
232 | |||
233 | // TODO: Check in to why StringCollection's enumerator doesn't implement | ||
234 | // IEnumerator? | ||
235 | /// <summary> | ||
236 | /// | ||
237 | /// </summary> | ||
238 | /// <returns></returns> | ||
239 | public StringEnumerator GetEnumerator() | ||
240 | { | ||
241 | return m_Files.GetEnumerator(); | ||
242 | } | ||
243 | |||
244 | #endregion | ||
245 | |||
246 | } | ||
247 | } | ||
diff --git a/Prebuild/src/Core/Nodes/MatchNode.cs b/Prebuild/src/Core/Nodes/MatchNode.cs deleted file mode 100644 index 656d7d0..0000000 --- a/Prebuild/src/Core/Nodes/MatchNode.cs +++ /dev/null | |||
@@ -1,330 +0,0 @@ | |||
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; | ||
27 | using System.Collections.Generic; | ||
28 | using System.Collections.Specialized; | ||
29 | using System.IO; | ||
30 | using System.Text.RegularExpressions; | ||
31 | using System.Xml; | ||
32 | |||
33 | using Prebuild.Core.Attributes; | ||
34 | using Prebuild.Core.Interfaces; | ||
35 | using Prebuild.Core.Utilities; | ||
36 | using System.Collections; | ||
37 | |||
38 | namespace Prebuild.Core.Nodes | ||
39 | { | ||
40 | /// <summary> | ||
41 | /// | ||
42 | /// </summary> | ||
43 | [DataNode("Match")] | ||
44 | public class MatchNode : DataNode | ||
45 | { | ||
46 | #region Fields | ||
47 | |||
48 | private readonly StringCollection m_Files = new StringCollection(); | ||
49 | private Regex m_Regex; | ||
50 | private BuildAction? m_BuildAction; | ||
51 | private SubType? m_SubType; | ||
52 | string m_ResourceName = ""; | ||
53 | private CopyToOutput m_CopyToOutput; | ||
54 | private bool m_Link; | ||
55 | private string m_LinkPath; | ||
56 | private bool m_PreservePath; | ||
57 | private readonly List<ExcludeNode> m_Exclusions = new List<ExcludeNode>(); | ||
58 | |||
59 | #endregion | ||
60 | |||
61 | #region Properties | ||
62 | |||
63 | /// <summary> | ||
64 | /// | ||
65 | /// </summary> | ||
66 | public StringCollection Files | ||
67 | { | ||
68 | get | ||
69 | { | ||
70 | return m_Files; | ||
71 | } | ||
72 | } | ||
73 | |||
74 | /// <summary> | ||
75 | /// | ||
76 | /// </summary> | ||
77 | public BuildAction? BuildAction | ||
78 | { | ||
79 | get | ||
80 | { | ||
81 | return m_BuildAction; | ||
82 | } | ||
83 | } | ||
84 | |||
85 | /// <summary> | ||
86 | /// | ||
87 | /// </summary> | ||
88 | public SubType? SubType | ||
89 | { | ||
90 | get | ||
91 | { | ||
92 | return m_SubType; | ||
93 | } | ||
94 | } | ||
95 | |||
96 | public CopyToOutput CopyToOutput | ||
97 | { | ||
98 | get | ||
99 | { | ||
100 | return this.m_CopyToOutput; | ||
101 | } | ||
102 | } | ||
103 | |||
104 | public bool IsLink | ||
105 | { | ||
106 | get | ||
107 | { | ||
108 | return this.m_Link; | ||
109 | } | ||
110 | } | ||
111 | |||
112 | public string LinkPath | ||
113 | { | ||
114 | get | ||
115 | { | ||
116 | return this.m_LinkPath; | ||
117 | } | ||
118 | } | ||
119 | /// <summary> | ||
120 | /// | ||
121 | /// </summary> | ||
122 | public string ResourceName | ||
123 | { | ||
124 | get | ||
125 | { | ||
126 | return m_ResourceName; | ||
127 | } | ||
128 | } | ||
129 | |||
130 | public bool PreservePath | ||
131 | { | ||
132 | get | ||
133 | { | ||
134 | return m_PreservePath; | ||
135 | } | ||
136 | } | ||
137 | |||
138 | #endregion | ||
139 | |||
140 | #region Private Methods | ||
141 | |||
142 | /// <summary> | ||
143 | /// Recurses the directories. | ||
144 | /// </summary> | ||
145 | /// <param name="path">The path.</param> | ||
146 | /// <param name="pattern">The pattern.</param> | ||
147 | /// <param name="recurse">if set to <c>true</c> [recurse].</param> | ||
148 | /// <param name="useRegex">if set to <c>true</c> [use regex].</param> | ||
149 | private void RecurseDirectories(string path, string pattern, bool recurse, bool useRegex, List<ExcludeNode> exclusions) | ||
150 | { | ||
151 | Match match; | ||
152 | Boolean excludeFile; | ||
153 | try | ||
154 | { | ||
155 | string[] files; | ||
156 | |||
157 | if(!useRegex) | ||
158 | { | ||
159 | files = Directory.GetFiles(path, pattern); | ||
160 | if(files != null) | ||
161 | { | ||
162 | string fileTemp; | ||
163 | foreach (string file in files) | ||
164 | { | ||
165 | excludeFile = false; | ||
166 | if (file.Substring(0,2) == "./" || file.Substring(0,2) == ".\\") | ||
167 | { | ||
168 | fileTemp = file.Substring(2); | ||
169 | } | ||
170 | else | ||
171 | { | ||
172 | fileTemp = file; | ||
173 | } | ||
174 | |||
175 | // Check all excludions and set flag if there are any hits. | ||
176 | foreach ( ExcludeNode exclude in exclusions ) | ||
177 | { | ||
178 | Regex exRegEx = new Regex( exclude.Pattern ); | ||
179 | match = exRegEx.Match( file ); | ||
180 | excludeFile |= match.Success; | ||
181 | } | ||
182 | |||
183 | if ( !excludeFile ) | ||
184 | { | ||
185 | m_Files.Add( fileTemp ); | ||
186 | } | ||
187 | |||
188 | } | ||
189 | } | ||
190 | else | ||
191 | { | ||
192 | return; | ||
193 | } | ||
194 | } | ||
195 | else | ||
196 | { | ||
197 | files = Directory.GetFiles(path); | ||
198 | foreach(string file in files) | ||
199 | { | ||
200 | excludeFile = false; | ||
201 | |||
202 | match = m_Regex.Match(file); | ||
203 | if(match.Success) | ||
204 | { | ||
205 | // Check all excludions and set flag if there are any hits. | ||
206 | foreach ( ExcludeNode exclude in exclusions ) | ||
207 | { | ||
208 | Regex exRegEx = new Regex( exclude.Pattern ); | ||
209 | match = exRegEx.Match( file ); | ||
210 | excludeFile |= !match.Success; | ||
211 | } | ||
212 | |||
213 | if ( !excludeFile ) | ||
214 | { | ||
215 | m_Files.Add( file ); | ||
216 | } | ||
217 | } | ||
218 | } | ||
219 | } | ||
220 | |||
221 | if(recurse) | ||
222 | { | ||
223 | string[] dirs = Directory.GetDirectories(path); | ||
224 | if(dirs != null && dirs.Length > 0) | ||
225 | { | ||
226 | foreach(string str in dirs) | ||
227 | { | ||
228 | RecurseDirectories(Helper.NormalizePath(str), pattern, recurse, useRegex, exclusions); | ||
229 | } | ||
230 | } | ||
231 | } | ||
232 | } | ||
233 | catch(DirectoryNotFoundException) | ||
234 | { | ||
235 | return; | ||
236 | } | ||
237 | catch(ArgumentException) | ||
238 | { | ||
239 | return; | ||
240 | } | ||
241 | } | ||
242 | |||
243 | #endregion | ||
244 | |||
245 | #region Public Methods | ||
246 | |||
247 | /// <summary> | ||
248 | /// | ||
249 | /// </summary> | ||
250 | /// <param name="node"></param> | ||
251 | public override void Parse(XmlNode node) | ||
252 | { | ||
253 | if( node == null ) | ||
254 | { | ||
255 | throw new ArgumentNullException("node"); | ||
256 | } | ||
257 | string path = Helper.AttributeValue(node, "path", "."); | ||
258 | string pattern = Helper.AttributeValue(node, "pattern", "*"); | ||
259 | bool recurse = (bool)Helper.TranslateValue(typeof(bool), Helper.AttributeValue(node, "recurse", "false")); | ||
260 | bool useRegex = (bool)Helper.TranslateValue(typeof(bool), Helper.AttributeValue(node, "useRegex", "false")); | ||
261 | string buildAction = Helper.AttributeValue(node, "buildAction", String.Empty); | ||
262 | if (buildAction != string.Empty) | ||
263 | m_BuildAction = (BuildAction)Enum.Parse(typeof(BuildAction), buildAction); | ||
264 | |||
265 | //TODO: Figure out where the subtype node is being assigned | ||
266 | //string subType = Helper.AttributeValue(node, "subType", string.Empty); | ||
267 | //if (subType != String.Empty) | ||
268 | // m_SubType = (SubType)Enum.Parse(typeof(SubType), subType); | ||
269 | m_ResourceName = Helper.AttributeValue(node, "resourceName", m_ResourceName.ToString()); | ||
270 | this.m_CopyToOutput = (CopyToOutput) Enum.Parse(typeof(CopyToOutput), Helper.AttributeValue(node, "copyToOutput", this.m_CopyToOutput.ToString())); | ||
271 | this.m_Link = bool.Parse(Helper.AttributeValue(node, "link", bool.FalseString)); | ||
272 | if ( this.m_Link == true ) | ||
273 | { | ||
274 | this.m_LinkPath = Helper.AttributeValue( node, "linkPath", string.Empty ); | ||
275 | } | ||
276 | this.m_PreservePath = bool.Parse( Helper.AttributeValue( node, "preservePath", bool.FalseString ) ); | ||
277 | |||
278 | |||
279 | if(path != null && path.Length == 0) | ||
280 | { | ||
281 | path = ".";//use current directory | ||
282 | } | ||
283 | //throw new WarningException("Match must have a 'path' attribute"); | ||
284 | |||
285 | if(pattern == null) | ||
286 | { | ||
287 | throw new WarningException("Match must have a 'pattern' attribute"); | ||
288 | } | ||
289 | |||
290 | path = Helper.NormalizePath(path); | ||
291 | if(!Directory.Exists(path)) | ||
292 | { | ||
293 | throw new WarningException("Match path does not exist: {0}", path); | ||
294 | } | ||
295 | |||
296 | try | ||
297 | { | ||
298 | if(useRegex) | ||
299 | { | ||
300 | m_Regex = new Regex(pattern); | ||
301 | } | ||
302 | } | ||
303 | catch(ArgumentException ex) | ||
304 | { | ||
305 | throw new WarningException("Could not compile regex pattern: {0}", ex.Message); | ||
306 | } | ||
307 | |||
308 | |||
309 | foreach(XmlNode child in node.ChildNodes) | ||
310 | { | ||
311 | IDataNode dataNode = Kernel.Instance.ParseNode(child, this); | ||
312 | if(dataNode is ExcludeNode) | ||
313 | { | ||
314 | ExcludeNode excludeNode = (ExcludeNode)dataNode; | ||
315 | m_Exclusions.Add( excludeNode ); | ||
316 | } | ||
317 | } | ||
318 | |||
319 | RecurseDirectories( path, pattern, recurse, useRegex, m_Exclusions ); | ||
320 | |||
321 | if(m_Files.Count < 1) | ||
322 | { | ||
323 | throw new WarningException("Match returned no files: {0}{1}", Helper.EndPath(path), pattern); | ||
324 | } | ||
325 | m_Regex = null; | ||
326 | } | ||
327 | |||
328 | #endregion | ||
329 | } | ||
330 | } | ||
diff --git a/Prebuild/src/Core/Nodes/OptionsNode.cs b/Prebuild/src/Core/Nodes/OptionsNode.cs deleted file mode 100644 index b63034b..0000000 --- a/Prebuild/src/Core/Nodes/OptionsNode.cs +++ /dev/null | |||
@@ -1,644 +0,0 @@ | |||
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; | ||
27 | using System.Collections; | ||
28 | using System.Collections.Specialized; | ||
29 | using System.Reflection; | ||
30 | using System.Xml; | ||
31 | |||
32 | using Prebuild.Core.Attributes; | ||
33 | using Prebuild.Core.Interfaces; | ||
34 | using Prebuild.Core.Utilities; | ||
35 | |||
36 | namespace Prebuild.Core.Nodes | ||
37 | { | ||
38 | /// <summary> | ||
39 | /// | ||
40 | /// </summary> | ||
41 | [DataNode("Options")] | ||
42 | public class OptionsNode : DataNode | ||
43 | { | ||
44 | #region Fields | ||
45 | |||
46 | private static Hashtable m_OptionFields; | ||
47 | |||
48 | [OptionNode("CompilerDefines")] | ||
49 | private string m_CompilerDefines = ""; | ||
50 | |||
51 | /// <summary> | ||
52 | /// | ||
53 | /// </summary> | ||
54 | public string CompilerDefines | ||
55 | { | ||
56 | get | ||
57 | { | ||
58 | return m_CompilerDefines; | ||
59 | } | ||
60 | set | ||
61 | { | ||
62 | m_CompilerDefines = value; | ||
63 | } | ||
64 | } | ||
65 | |||
66 | [OptionNode("OptimizeCode")] | ||
67 | private bool m_OptimizeCode; | ||
68 | |||
69 | /// <summary> | ||
70 | /// | ||
71 | /// </summary> | ||
72 | public bool OptimizeCode | ||
73 | { | ||
74 | get | ||
75 | { | ||
76 | return m_OptimizeCode; | ||
77 | } | ||
78 | set | ||
79 | { | ||
80 | m_OptimizeCode = value; | ||
81 | } | ||
82 | } | ||
83 | |||
84 | [OptionNode("CheckUnderflowOverflow")] | ||
85 | private bool m_CheckUnderflowOverflow; | ||
86 | |||
87 | /// <summary> | ||
88 | /// | ||
89 | /// </summary> | ||
90 | public bool CheckUnderflowOverflow | ||
91 | { | ||
92 | get | ||
93 | { | ||
94 | return m_CheckUnderflowOverflow; | ||
95 | } | ||
96 | set | ||
97 | { | ||
98 | m_CheckUnderflowOverflow = value; | ||
99 | } | ||
100 | } | ||
101 | |||
102 | [OptionNode("AllowUnsafe")] | ||
103 | private bool m_AllowUnsafe; | ||
104 | |||
105 | /// <summary> | ||
106 | /// | ||
107 | /// </summary> | ||
108 | public bool AllowUnsafe | ||
109 | { | ||
110 | get | ||
111 | { | ||
112 | return m_AllowUnsafe; | ||
113 | } | ||
114 | set | ||
115 | { | ||
116 | m_AllowUnsafe = value; | ||
117 | } | ||
118 | } | ||
119 | |||
120 | [OptionNode("PreBuildEvent")] | ||
121 | private string m_PreBuildEvent; | ||
122 | |||
123 | /// <summary> | ||
124 | /// | ||
125 | /// </summary> | ||
126 | public string PreBuildEvent | ||
127 | { | ||
128 | get | ||
129 | { | ||
130 | return m_PreBuildEvent; | ||
131 | } | ||
132 | set | ||
133 | { | ||
134 | m_PreBuildEvent = value; | ||
135 | } | ||
136 | } | ||
137 | |||
138 | [OptionNode("PostBuildEvent")] | ||
139 | private string m_PostBuildEvent; | ||
140 | |||
141 | /// <summary> | ||
142 | /// | ||
143 | /// </summary> | ||
144 | public string PostBuildEvent | ||
145 | { | ||
146 | get | ||
147 | { | ||
148 | return m_PostBuildEvent; | ||
149 | } | ||
150 | set | ||
151 | { | ||
152 | m_PostBuildEvent = value; | ||
153 | } | ||
154 | } | ||
155 | |||
156 | [OptionNode("PreBuildEventArgs")] | ||
157 | private string m_PreBuildEventArgs; | ||
158 | |||
159 | /// <summary> | ||
160 | /// | ||
161 | /// </summary> | ||
162 | public string PreBuildEventArgs | ||
163 | { | ||
164 | get | ||
165 | { | ||
166 | return m_PreBuildEventArgs; | ||
167 | } | ||
168 | set | ||
169 | { | ||
170 | m_PreBuildEventArgs = value; | ||
171 | } | ||
172 | } | ||
173 | |||
174 | [OptionNode("PostBuildEventArgs")] | ||
175 | private string m_PostBuildEventArgs; | ||
176 | |||
177 | /// <summary> | ||
178 | /// | ||
179 | /// </summary> | ||
180 | public string PostBuildEventArgs | ||
181 | { | ||
182 | get | ||
183 | { | ||
184 | return m_PostBuildEventArgs; | ||
185 | } | ||
186 | set | ||
187 | { | ||
188 | m_PostBuildEventArgs = value; | ||
189 | } | ||
190 | } | ||
191 | |||
192 | [OptionNode("RunPostBuildEvent")] | ||
193 | private string m_RunPostBuildEvent; | ||
194 | |||
195 | /// <summary> | ||
196 | /// | ||
197 | /// </summary> | ||
198 | public string RunPostBuildEvent | ||
199 | { | ||
200 | get | ||
201 | { | ||
202 | return m_RunPostBuildEvent; | ||
203 | } | ||
204 | set | ||
205 | { | ||
206 | m_RunPostBuildEvent = value; | ||
207 | } | ||
208 | } | ||
209 | |||
210 | [OptionNode("RunScript")] | ||
211 | private string m_RunScript; | ||
212 | |||
213 | /// <summary> | ||
214 | /// | ||
215 | /// </summary> | ||
216 | public string RunScript | ||
217 | { | ||
218 | get | ||
219 | { | ||
220 | return m_RunScript; | ||
221 | } | ||
222 | set | ||
223 | { | ||
224 | m_RunScript = value; | ||
225 | } | ||
226 | } | ||
227 | |||
228 | [OptionNode("WarningLevel")] | ||
229 | private int m_WarningLevel = 4; | ||
230 | |||
231 | /// <summary> | ||
232 | /// | ||
233 | /// </summary> | ||
234 | public int WarningLevel | ||
235 | { | ||
236 | get | ||
237 | { | ||
238 | return m_WarningLevel; | ||
239 | } | ||
240 | set | ||
241 | { | ||
242 | m_WarningLevel = value; | ||
243 | } | ||
244 | } | ||
245 | |||
246 | [OptionNode("WarningsAsErrors")] | ||
247 | private bool m_WarningsAsErrors; | ||
248 | |||
249 | /// <summary> | ||
250 | /// | ||
251 | /// </summary> | ||
252 | public bool WarningsAsErrors | ||
253 | { | ||
254 | get | ||
255 | { | ||
256 | return m_WarningsAsErrors; | ||
257 | } | ||
258 | set | ||
259 | { | ||
260 | m_WarningsAsErrors = value; | ||
261 | } | ||
262 | } | ||
263 | |||
264 | [OptionNode("SuppressWarnings")] | ||
265 | private string m_SuppressWarnings = ""; | ||
266 | |||
267 | /// <summary> | ||
268 | /// | ||
269 | /// </summary> | ||
270 | public string SuppressWarnings | ||
271 | { | ||
272 | get | ||
273 | { | ||
274 | return m_SuppressWarnings; | ||
275 | } | ||
276 | set | ||
277 | { | ||
278 | m_SuppressWarnings = value; | ||
279 | } | ||
280 | } | ||
281 | |||
282 | [OptionNode("OutputPath")] | ||
283 | private string m_OutputPath = "bin/"; | ||
284 | |||
285 | /// <summary> | ||
286 | /// | ||
287 | /// </summary> | ||
288 | public string OutputPath | ||
289 | { | ||
290 | get | ||
291 | { | ||
292 | return m_OutputPath; | ||
293 | } | ||
294 | set | ||
295 | { | ||
296 | m_OutputPath = value; | ||
297 | } | ||
298 | } | ||
299 | |||
300 | [OptionNode("GenerateDocumentation")] | ||
301 | private bool m_GenerateDocumentation; | ||
302 | |||
303 | /// <summary> | ||
304 | /// | ||
305 | /// </summary> | ||
306 | public bool GenerateDocumentation | ||
307 | { | ||
308 | get | ||
309 | { | ||
310 | return m_GenerateDocumentation; | ||
311 | } | ||
312 | set | ||
313 | { | ||
314 | m_GenerateDocumentation = value; | ||
315 | } | ||
316 | } | ||
317 | |||
318 | [OptionNode("GenerateXmlDocFile")] | ||
319 | private bool m_GenerateXmlDocFile; | ||
320 | |||
321 | /// <summary> | ||
322 | /// | ||
323 | /// </summary> | ||
324 | public bool GenerateXmlDocFile | ||
325 | { | ||
326 | get | ||
327 | { | ||
328 | return m_GenerateXmlDocFile; | ||
329 | } | ||
330 | set | ||
331 | { | ||
332 | m_GenerateXmlDocFile = value; | ||
333 | } | ||
334 | } | ||
335 | |||
336 | [OptionNode("XmlDocFile")] | ||
337 | private string m_XmlDocFile = ""; | ||
338 | |||
339 | /// <summary> | ||
340 | /// | ||
341 | /// </summary> | ||
342 | public string XmlDocFile | ||
343 | { | ||
344 | get | ||
345 | { | ||
346 | return m_XmlDocFile; | ||
347 | } | ||
348 | set | ||
349 | { | ||
350 | m_XmlDocFile = value; | ||
351 | } | ||
352 | } | ||
353 | |||
354 | [OptionNode("KeyFile")] | ||
355 | private string m_KeyFile = ""; | ||
356 | |||
357 | /// <summary> | ||
358 | /// | ||
359 | /// </summary> | ||
360 | public string KeyFile | ||
361 | { | ||
362 | get | ||
363 | { | ||
364 | return m_KeyFile; | ||
365 | } | ||
366 | set | ||
367 | { | ||
368 | m_KeyFile = value; | ||
369 | } | ||
370 | } | ||
371 | |||
372 | [OptionNode("DebugInformation")] | ||
373 | private bool m_DebugInformation; | ||
374 | |||
375 | /// <summary> | ||
376 | /// | ||
377 | /// </summary> | ||
378 | public bool DebugInformation | ||
379 | { | ||
380 | get | ||
381 | { | ||
382 | return m_DebugInformation; | ||
383 | } | ||
384 | set | ||
385 | { | ||
386 | m_DebugInformation = value; | ||
387 | } | ||
388 | } | ||
389 | |||
390 | [OptionNode("RegisterComInterop")] | ||
391 | private bool m_RegisterComInterop; | ||
392 | |||
393 | /// <summary> | ||
394 | /// | ||
395 | /// </summary> | ||
396 | public bool RegisterComInterop | ||
397 | { | ||
398 | get | ||
399 | { | ||
400 | return m_RegisterComInterop; | ||
401 | } | ||
402 | set | ||
403 | { | ||
404 | m_RegisterComInterop = value; | ||
405 | } | ||
406 | } | ||
407 | |||
408 | [OptionNode("RemoveIntegerChecks")] | ||
409 | private bool m_RemoveIntegerChecks; | ||
410 | |||
411 | /// <summary> | ||
412 | /// | ||
413 | /// </summary> | ||
414 | public bool RemoveIntegerChecks | ||
415 | { | ||
416 | get | ||
417 | { | ||
418 | return m_RemoveIntegerChecks; | ||
419 | } | ||
420 | set | ||
421 | { | ||
422 | m_RemoveIntegerChecks = value; | ||
423 | } | ||
424 | } | ||
425 | |||
426 | [OptionNode("IncrementalBuild")] | ||
427 | private bool m_IncrementalBuild; | ||
428 | |||
429 | /// <summary> | ||
430 | /// | ||
431 | /// </summary> | ||
432 | public bool IncrementalBuild | ||
433 | { | ||
434 | get | ||
435 | { | ||
436 | return m_IncrementalBuild; | ||
437 | } | ||
438 | set | ||
439 | { | ||
440 | m_IncrementalBuild = value; | ||
441 | } | ||
442 | } | ||
443 | |||
444 | [OptionNode("BaseAddress")] | ||
445 | private string m_BaseAddress = "285212672"; | ||
446 | |||
447 | /// <summary> | ||
448 | /// | ||
449 | /// </summary> | ||
450 | public string BaseAddress | ||
451 | { | ||
452 | get | ||
453 | { | ||
454 | return m_BaseAddress; | ||
455 | } | ||
456 | set | ||
457 | { | ||
458 | m_BaseAddress = value; | ||
459 | } | ||
460 | } | ||
461 | |||
462 | [OptionNode("FileAlignment")] | ||
463 | private int m_FileAlignment = 4096; | ||
464 | |||
465 | /// <summary> | ||
466 | /// | ||
467 | /// </summary> | ||
468 | public int FileAlignment | ||
469 | { | ||
470 | get | ||
471 | { | ||
472 | return m_FileAlignment; | ||
473 | } | ||
474 | set | ||
475 | { | ||
476 | m_FileAlignment = value; | ||
477 | } | ||
478 | } | ||
479 | |||
480 | [OptionNode("NoStdLib")] | ||
481 | private bool m_NoStdLib; | ||
482 | |||
483 | /// <summary> | ||
484 | /// | ||
485 | /// </summary> | ||
486 | public bool NoStdLib | ||
487 | { | ||
488 | get | ||
489 | { | ||
490 | return m_NoStdLib; | ||
491 | } | ||
492 | set | ||
493 | { | ||
494 | m_NoStdLib = value; | ||
495 | } | ||
496 | } | ||
497 | |||
498 | private StringCollection m_FieldsDefined; | ||
499 | |||
500 | #endregion | ||
501 | |||
502 | #region Constructors | ||
503 | |||
504 | /// <summary> | ||
505 | /// Initializes the <see cref="OptionsNode"/> class. | ||
506 | /// </summary> | ||
507 | static OptionsNode() | ||
508 | { | ||
509 | Type t = typeof(OptionsNode); | ||
510 | |||
511 | m_OptionFields = new Hashtable(); | ||
512 | foreach(FieldInfo f in t.GetFields(BindingFlags.NonPublic | BindingFlags.Instance)) | ||
513 | { | ||
514 | object[] attrs = f.GetCustomAttributes(typeof(OptionNodeAttribute), false); | ||
515 | if(attrs == null || attrs.Length < 1) | ||
516 | { | ||
517 | continue; | ||
518 | } | ||
519 | |||
520 | OptionNodeAttribute ona = (OptionNodeAttribute)attrs[0]; | ||
521 | m_OptionFields[ona.NodeName] = f; | ||
522 | } | ||
523 | } | ||
524 | |||
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 | ||
534 | |||
535 | #region Properties | ||
536 | |||
537 | /// <summary> | ||
538 | /// Gets the <see cref="Object"/> at the specified index. | ||
539 | /// </summary> | ||
540 | /// <value></value> | ||
541 | public object this[string index] | ||
542 | { | ||
543 | get | ||
544 | { | ||
545 | if(!m_OptionFields.ContainsKey(index)) | ||
546 | { | ||
547 | return null; | ||
548 | } | ||
549 | |||
550 | FieldInfo f = (FieldInfo)m_OptionFields[index]; | ||
551 | return f.GetValue(this); | ||
552 | } | ||
553 | } | ||
554 | |||
555 | /// <summary> | ||
556 | /// Gets the <see cref="Object"/> at the specified index. | ||
557 | /// </summary> | ||
558 | /// <value></value> | ||
559 | public object this[string index, object defaultValue] | ||
560 | { | ||
561 | get | ||
562 | { | ||
563 | object valueObject = this[index]; | ||
564 | if(valueObject != null && valueObject is string && ((string)valueObject).Length == 0) | ||
565 | { | ||
566 | return defaultValue; | ||
567 | } | ||
568 | return valueObject; | ||
569 | } | ||
570 | } | ||
571 | |||
572 | |||
573 | #endregion | ||
574 | |||
575 | #region Private Methods | ||
576 | |||
577 | private void FlagDefined(string name) | ||
578 | { | ||
579 | if(!m_FieldsDefined.Contains(name)) | ||
580 | { | ||
581 | m_FieldsDefined.Add(name); | ||
582 | } | ||
583 | } | ||
584 | |||
585 | private void SetOption(string nodeName, string val) | ||
586 | { | ||
587 | lock(m_OptionFields) | ||
588 | { | ||
589 | if(!m_OptionFields.ContainsKey(nodeName)) | ||
590 | { | ||
591 | return; | ||
592 | } | ||
593 | |||
594 | FieldInfo f = (FieldInfo)m_OptionFields[nodeName]; | ||
595 | f.SetValue(this, Helper.TranslateValue(f.FieldType, val)); | ||
596 | FlagDefined(f.Name); | ||
597 | } | ||
598 | } | ||
599 | |||
600 | #endregion | ||
601 | |||
602 | #region Public Methods | ||
603 | |||
604 | /// <summary> | ||
605 | /// Parses the specified node. | ||
606 | /// </summary> | ||
607 | /// <param name="node">The node.</param> | ||
608 | public override void Parse(XmlNode node) | ||
609 | { | ||
610 | if( node == null ) | ||
611 | { | ||
612 | throw new ArgumentNullException("node"); | ||
613 | } | ||
614 | |||
615 | foreach(XmlNode child in node.ChildNodes) | ||
616 | { | ||
617 | SetOption(child.Name, Helper.InterpolateForEnvironmentVariables(child.InnerText)); | ||
618 | } | ||
619 | } | ||
620 | |||
621 | /// <summary> | ||
622 | /// Copies to. | ||
623 | /// </summary> | ||
624 | /// <param name="opt">The opt.</param> | ||
625 | public void CopyTo(OptionsNode opt) | ||
626 | { | ||
627 | if(opt == null) | ||
628 | { | ||
629 | return; | ||
630 | } | ||
631 | |||
632 | foreach(FieldInfo f in m_OptionFields.Values) | ||
633 | { | ||
634 | if(m_FieldsDefined.Contains(f.Name)) | ||
635 | { | ||
636 | f.SetValue(opt, f.GetValue(this)); | ||
637 | opt.m_FieldsDefined.Add(f.Name); | ||
638 | } | ||
639 | } | ||
640 | } | ||
641 | |||
642 | #endregion | ||
643 | } | ||
644 | } | ||
diff --git a/Prebuild/src/Core/Nodes/ProcessNode.cs b/Prebuild/src/Core/Nodes/ProcessNode.cs deleted file mode 100644 index 6bfbe16..0000000 --- a/Prebuild/src/Core/Nodes/ProcessNode.cs +++ /dev/null | |||
@@ -1,110 +0,0 @@ | |||
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; | ||
27 | using System.Collections; | ||
28 | using System.Collections.Specialized; | ||
29 | using System.Xml; | ||
30 | |||
31 | using Prebuild.Core.Attributes; | ||
32 | using Prebuild.Core.Interfaces; | ||
33 | using Prebuild.Core.Utilities; | ||
34 | |||
35 | namespace Prebuild.Core.Nodes | ||
36 | { | ||
37 | /// <summary> | ||
38 | /// | ||
39 | /// </summary> | ||
40 | [DataNode("Process")] | ||
41 | public class ProcessNode : DataNode | ||
42 | { | ||
43 | #region Fields | ||
44 | |||
45 | private string m_Path; | ||
46 | private bool m_IsValid = true; | ||
47 | |||
48 | #endregion | ||
49 | |||
50 | #region Properties | ||
51 | |||
52 | /// <summary> | ||
53 | /// Gets the path. | ||
54 | /// </summary> | ||
55 | /// <value>The path.</value> | ||
56 | public string Path | ||
57 | { | ||
58 | get | ||
59 | { | ||
60 | return m_Path; | ||
61 | } | ||
62 | } | ||
63 | |||
64 | /// <summary> | ||
65 | /// Gets a value indicating whether this instance is valid. | ||
66 | /// </summary> | ||
67 | /// <value><c>true</c> if this instance is valid; otherwise, <c>false</c>.</value> | ||
68 | public bool IsValid | ||
69 | { | ||
70 | get | ||
71 | { | ||
72 | return m_IsValid; | ||
73 | } | ||
74 | } | ||
75 | |||
76 | #endregion | ||
77 | |||
78 | #region Public Methods | ||
79 | |||
80 | /// <summary> | ||
81 | /// Parses the specified node. | ||
82 | /// </summary> | ||
83 | /// <param name="node">The node.</param> | ||
84 | public override void Parse(XmlNode node) | ||
85 | { | ||
86 | if( node == null ) | ||
87 | { | ||
88 | throw new ArgumentNullException("node"); | ||
89 | } | ||
90 | |||
91 | m_Path = Helper.InterpolateForEnvironmentVariables(node.InnerText); | ||
92 | if(m_Path == null) | ||
93 | { | ||
94 | m_Path = ""; | ||
95 | } | ||
96 | |||
97 | try | ||
98 | { | ||
99 | m_Path = Helper.ResolvePath(m_Path); | ||
100 | } | ||
101 | catch(ArgumentException) | ||
102 | { | ||
103 | Kernel.Instance.Log.Write(LogType.Warning, "Could not find prebuild file for processing: {0}", m_Path); | ||
104 | m_IsValid = false; | ||
105 | } | ||
106 | } | ||
107 | |||
108 | #endregion | ||
109 | } | ||
110 | } | ||
diff --git a/Prebuild/src/Core/Nodes/ProjectNode.cs b/Prebuild/src/Core/Nodes/ProjectNode.cs deleted file mode 100644 index 04af7a3..0000000 --- a/Prebuild/src/Core/Nodes/ProjectNode.cs +++ /dev/null | |||
@@ -1,580 +0,0 @@ | |||
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; | ||
27 | using System.Collections; | ||
28 | using System.Collections.Generic; | ||
29 | using System.IO; | ||
30 | using System.Xml; | ||
31 | |||
32 | using Prebuild.Core.Attributes; | ||
33 | using Prebuild.Core.Interfaces; | ||
34 | using Prebuild.Core.Utilities; | ||
35 | |||
36 | namespace Prebuild.Core.Nodes | ||
37 | { | ||
38 | /// <summary> | ||
39 | /// A set of values that the Project's type can be | ||
40 | /// </summary> | ||
41 | public enum ProjectType | ||
42 | { | ||
43 | /// <summary> | ||
44 | /// The project is a console executable | ||
45 | /// </summary> | ||
46 | Exe, | ||
47 | /// <summary> | ||
48 | /// The project is a windows executable | ||
49 | /// </summary> | ||
50 | WinExe, | ||
51 | /// <summary> | ||
52 | /// The project is a library | ||
53 | /// </summary> | ||
54 | Library, | ||
55 | /// <summary> | ||
56 | /// The project is a website | ||
57 | /// </summary> | ||
58 | Web, | ||
59 | } | ||
60 | |||
61 | /// <summary> | ||
62 | /// | ||
63 | /// </summary> | ||
64 | public enum ClrRuntime | ||
65 | { | ||
66 | /// <summary> | ||
67 | /// | ||
68 | /// </summary> | ||
69 | Microsoft, | ||
70 | /// <summary> | ||
71 | /// | ||
72 | /// </summary> | ||
73 | Mono | ||
74 | } | ||
75 | /// <summary> | ||
76 | /// The version of the .NET framework to use (Required for VS2008) | ||
77 | /// <remarks>We don't need .NET 1.1 in here, it'll default when using vs2003.</remarks> | ||
78 | /// </summary> | ||
79 | public enum FrameworkVersion | ||
80 | { | ||
81 | /// <summary> | ||
82 | /// .NET 2.0 | ||
83 | /// </summary> | ||
84 | v2_0, | ||
85 | /// <summary> | ||
86 | /// .NET 3.0 | ||
87 | /// </summary> | ||
88 | v3_0, | ||
89 | /// <summary> | ||
90 | /// .NET 3.5 | ||
91 | /// </summary> | ||
92 | v3_5, | ||
93 | /// <summary> | ||
94 | /// .NET 4.0 | ||
95 | /// </summary> | ||
96 | v4_0, | ||
97 | } | ||
98 | /// <summary> | ||
99 | /// The Node object representing /Prebuild/Solution/Project elements | ||
100 | /// </summary> | ||
101 | [DataNode("Project")] | ||
102 | public class ProjectNode : DataNode, IComparable | ||
103 | { | ||
104 | #region Fields | ||
105 | |||
106 | private string m_Name = "unknown"; | ||
107 | private string m_Path = ""; | ||
108 | private string m_FullPath = ""; | ||
109 | private string m_AssemblyName; | ||
110 | private string m_AppIcon = ""; | ||
111 | private string m_ConfigFile = ""; | ||
112 | private string m_DesignerFolder = ""; | ||
113 | private string m_Language = "C#"; | ||
114 | private ProjectType m_Type = ProjectType.Exe; | ||
115 | private ClrRuntime m_Runtime = ClrRuntime.Microsoft; | ||
116 | private FrameworkVersion m_Framework = FrameworkVersion.v2_0; | ||
117 | private string m_StartupObject = ""; | ||
118 | private string m_RootNamespace; | ||
119 | private string m_FilterGroups = ""; | ||
120 | private string m_Version = ""; | ||
121 | private Guid m_Guid; | ||
122 | private string m_DebugStartParameters; | ||
123 | |||
124 | private Hashtable m_Configurations = new Hashtable(); | ||
125 | private readonly List<ReferencePathNode> m_ReferencePaths = new List<ReferencePathNode>(); | ||
126 | private readonly List<ReferenceNode> m_References = new List<ReferenceNode>(); | ||
127 | private readonly List<AuthorNode> m_Authors = new List<AuthorNode>(); | ||
128 | private FilesNode m_Files; | ||
129 | |||
130 | #endregion | ||
131 | |||
132 | #region Properties | ||
133 | |||
134 | /// <summary> | ||
135 | /// Gets the name. | ||
136 | /// </summary> | ||
137 | /// <value>The name.</value> | ||
138 | public string Name | ||
139 | { | ||
140 | get | ||
141 | { | ||
142 | return m_Name; | ||
143 | } | ||
144 | } | ||
145 | /// <summary> | ||
146 | /// The version of the .NET Framework to compile under | ||
147 | /// </summary> | ||
148 | public FrameworkVersion FrameworkVersion | ||
149 | { | ||
150 | get | ||
151 | { | ||
152 | return this.m_Framework; | ||
153 | } | ||
154 | } | ||
155 | /// <summary> | ||
156 | /// Gets the path. | ||
157 | /// </summary> | ||
158 | /// <value>The path.</value> | ||
159 | public string Path | ||
160 | { | ||
161 | get | ||
162 | { | ||
163 | return m_Path; | ||
164 | } | ||
165 | } | ||
166 | |||
167 | /// <summary> | ||
168 | /// Gets the filter groups. | ||
169 | /// </summary> | ||
170 | /// <value>The filter groups.</value> | ||
171 | public string FilterGroups | ||
172 | { | ||
173 | get | ||
174 | { | ||
175 | return m_FilterGroups; | ||
176 | } | ||
177 | } | ||
178 | |||
179 | /// <summary> | ||
180 | /// Gets the project's version | ||
181 | /// </summary> | ||
182 | /// <value>The project's version.</value> | ||
183 | public string Version | ||
184 | { | ||
185 | get | ||
186 | { | ||
187 | return m_Version; | ||
188 | } | ||
189 | } | ||
190 | |||
191 | /// <summary> | ||
192 | /// Gets the full path. | ||
193 | /// </summary> | ||
194 | /// <value>The full path.</value> | ||
195 | public string FullPath | ||
196 | { | ||
197 | get | ||
198 | { | ||
199 | return m_FullPath; | ||
200 | } | ||
201 | } | ||
202 | |||
203 | /// <summary> | ||
204 | /// Gets the name of the assembly. | ||
205 | /// </summary> | ||
206 | /// <value>The name of the assembly.</value> | ||
207 | public string AssemblyName | ||
208 | { | ||
209 | get | ||
210 | { | ||
211 | return m_AssemblyName; | ||
212 | } | ||
213 | } | ||
214 | |||
215 | /// <summary> | ||
216 | /// Gets the app icon. | ||
217 | /// </summary> | ||
218 | /// <value>The app icon.</value> | ||
219 | public string AppIcon | ||
220 | { | ||
221 | get | ||
222 | { | ||
223 | return m_AppIcon; | ||
224 | } | ||
225 | } | ||
226 | |||
227 | /// <summary> | ||
228 | /// Gets the app icon. | ||
229 | /// </summary> | ||
230 | /// <value>The app icon.</value> | ||
231 | public string ConfigFile | ||
232 | { | ||
233 | get | ||
234 | { | ||
235 | return m_ConfigFile; | ||
236 | } | ||
237 | } | ||
238 | |||
239 | /// <summary> | ||
240 | /// | ||
241 | /// </summary> | ||
242 | public string DesignerFolder | ||
243 | { | ||
244 | get | ||
245 | { | ||
246 | return m_DesignerFolder; | ||
247 | } | ||
248 | } | ||
249 | |||
250 | /// <summary> | ||
251 | /// Gets the language. | ||
252 | /// </summary> | ||
253 | /// <value>The language.</value> | ||
254 | public string Language | ||
255 | { | ||
256 | get | ||
257 | { | ||
258 | return m_Language; | ||
259 | } | ||
260 | } | ||
261 | |||
262 | /// <summary> | ||
263 | /// Gets the type. | ||
264 | /// </summary> | ||
265 | /// <value>The type.</value> | ||
266 | public ProjectType Type | ||
267 | { | ||
268 | get | ||
269 | { | ||
270 | return m_Type; | ||
271 | } | ||
272 | } | ||
273 | |||
274 | /// <summary> | ||
275 | /// Gets the runtime. | ||
276 | /// </summary> | ||
277 | /// <value>The runtime.</value> | ||
278 | public ClrRuntime Runtime | ||
279 | { | ||
280 | get | ||
281 | { | ||
282 | return m_Runtime; | ||
283 | } | ||
284 | } | ||
285 | |||
286 | private bool m_GenerateAssemblyInfoFile = false; | ||
287 | |||
288 | /// <summary> | ||
289 | /// | ||
290 | /// </summary> | ||
291 | public bool GenerateAssemblyInfoFile | ||
292 | { | ||
293 | get | ||
294 | { | ||
295 | return m_GenerateAssemblyInfoFile; | ||
296 | } | ||
297 | set | ||
298 | { | ||
299 | m_GenerateAssemblyInfoFile = value; | ||
300 | } | ||
301 | } | ||
302 | |||
303 | /// <summary> | ||
304 | /// Gets the startup object. | ||
305 | /// </summary> | ||
306 | /// <value>The startup object.</value> | ||
307 | public string StartupObject | ||
308 | { | ||
309 | get | ||
310 | { | ||
311 | return m_StartupObject; | ||
312 | } | ||
313 | } | ||
314 | |||
315 | /// <summary> | ||
316 | /// Gets the root namespace. | ||
317 | /// </summary> | ||
318 | /// <value>The root namespace.</value> | ||
319 | public string RootNamespace | ||
320 | { | ||
321 | get | ||
322 | { | ||
323 | return m_RootNamespace; | ||
324 | } | ||
325 | } | ||
326 | |||
327 | /// <summary> | ||
328 | /// Gets the configurations. | ||
329 | /// </summary> | ||
330 | /// <value>The configurations.</value> | ||
331 | public IList Configurations | ||
332 | { | ||
333 | get | ||
334 | { | ||
335 | ArrayList tmp = new ArrayList(ConfigurationsTable.Values); | ||
336 | tmp.Sort(); | ||
337 | return tmp; | ||
338 | } | ||
339 | } | ||
340 | |||
341 | /// <summary> | ||
342 | /// Gets the configurations table. | ||
343 | /// </summary> | ||
344 | /// <value>The configurations table.</value> | ||
345 | public Hashtable ConfigurationsTable | ||
346 | { | ||
347 | get | ||
348 | { | ||
349 | return m_Configurations; | ||
350 | } | ||
351 | } | ||
352 | |||
353 | /// <summary> | ||
354 | /// Gets the reference paths. | ||
355 | /// </summary> | ||
356 | /// <value>The reference paths.</value> | ||
357 | public List<ReferencePathNode> ReferencePaths | ||
358 | { | ||
359 | get | ||
360 | { | ||
361 | List<ReferencePathNode> tmp = new List<ReferencePathNode>(m_ReferencePaths); | ||
362 | tmp.Sort(); | ||
363 | return tmp; | ||
364 | } | ||
365 | } | ||
366 | |||
367 | /// <summary> | ||
368 | /// Gets the references. | ||
369 | /// </summary> | ||
370 | /// <value>The references.</value> | ||
371 | public List<ReferenceNode> References | ||
372 | { | ||
373 | get | ||
374 | { | ||
375 | List<ReferenceNode> tmp = new List<ReferenceNode>(m_References); | ||
376 | tmp.Sort(); | ||
377 | return tmp; | ||
378 | } | ||
379 | } | ||
380 | |||
381 | /// <summary> | ||
382 | /// Gets the Authors list. | ||
383 | /// </summary> | ||
384 | /// <value>The list of the project's authors.</value> | ||
385 | public List<AuthorNode> Authors | ||
386 | { | ||
387 | get | ||
388 | { | ||
389 | return m_Authors; | ||
390 | } | ||
391 | } | ||
392 | |||
393 | /// <summary> | ||
394 | /// Gets the files. | ||
395 | /// </summary> | ||
396 | /// <value>The files.</value> | ||
397 | public FilesNode Files | ||
398 | { | ||
399 | get | ||
400 | { | ||
401 | return m_Files; | ||
402 | } | ||
403 | } | ||
404 | |||
405 | /// <summary> | ||
406 | /// Gets or sets the parent. | ||
407 | /// </summary> | ||
408 | /// <value>The parent.</value> | ||
409 | public override IDataNode Parent | ||
410 | { | ||
411 | get | ||
412 | { | ||
413 | return base.Parent; | ||
414 | } | ||
415 | set | ||
416 | { | ||
417 | base.Parent = value; | ||
418 | if(base.Parent is SolutionNode && m_Configurations.Count < 1) | ||
419 | { | ||
420 | SolutionNode parent = (SolutionNode)base.Parent; | ||
421 | foreach(ConfigurationNode conf in parent.Configurations) | ||
422 | { | ||
423 | m_Configurations[conf.Name] = conf.Clone(); | ||
424 | } | ||
425 | } | ||
426 | } | ||
427 | } | ||
428 | |||
429 | /// <summary> | ||
430 | /// Gets the GUID. | ||
431 | /// </summary> | ||
432 | /// <value>The GUID.</value> | ||
433 | public Guid Guid | ||
434 | { | ||
435 | get | ||
436 | { | ||
437 | return m_Guid; | ||
438 | } | ||
439 | } | ||
440 | |||
441 | public string DebugStartParameters | ||
442 | { | ||
443 | get | ||
444 | { | ||
445 | return m_DebugStartParameters; | ||
446 | } | ||
447 | } | ||
448 | |||
449 | #endregion | ||
450 | |||
451 | #region Private Methods | ||
452 | |||
453 | private void HandleConfiguration(ConfigurationNode conf) | ||
454 | { | ||
455 | 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 | ||
457 | { | ||
458 | foreach(ConfigurationNode confNode in this.m_Configurations.Values) | ||
459 | { | ||
460 | conf.CopyTo(confNode);//update the config templates defines at the project level with the overrides | ||
461 | } | ||
462 | } | ||
463 | if(m_Configurations.ContainsKey(conf.Name)) | ||
464 | { | ||
465 | ConfigurationNode parentConf = (ConfigurationNode)m_Configurations[conf.Name]; | ||
466 | conf.CopyTo(parentConf);//update the config templates defines at the project level with the overrides | ||
467 | } | ||
468 | else | ||
469 | { | ||
470 | m_Configurations[conf.Name] = conf; | ||
471 | } | ||
472 | } | ||
473 | |||
474 | #endregion | ||
475 | |||
476 | #region Public Methods | ||
477 | |||
478 | /// <summary> | ||
479 | /// Parses the specified node. | ||
480 | /// </summary> | ||
481 | /// <param name="node">The node.</param> | ||
482 | public override void Parse(XmlNode node) | ||
483 | { | ||
484 | m_Name = Helper.AttributeValue(node, "name", m_Name); | ||
485 | m_Path = Helper.AttributeValue(node, "path", m_Path); | ||
486 | m_FilterGroups = Helper.AttributeValue(node, "filterGroups", m_FilterGroups); | ||
487 | m_Version = Helper.AttributeValue(node, "version", m_Version); | ||
488 | m_AppIcon = Helper.AttributeValue(node, "icon", m_AppIcon); | ||
489 | m_ConfigFile = Helper.AttributeValue(node, "configFile", m_ConfigFile); | ||
490 | m_DesignerFolder = Helper.AttributeValue(node, "designerFolder", m_DesignerFolder); | ||
491 | m_AssemblyName = Helper.AttributeValue(node, "assemblyName", m_AssemblyName); | ||
492 | m_Language = Helper.AttributeValue(node, "language", m_Language); | ||
493 | m_Type = (ProjectType)Helper.EnumAttributeValue(node, "type", typeof(ProjectType), m_Type); | ||
494 | m_Runtime = (ClrRuntime)Helper.EnumAttributeValue(node, "runtime", typeof(ClrRuntime), m_Runtime); | ||
495 | m_Framework = (FrameworkVersion)Helper.EnumAttributeValue(node, "frameworkVersion", typeof(FrameworkVersion), m_Framework); | ||
496 | m_StartupObject = Helper.AttributeValue(node, "startupObject", m_StartupObject); | ||
497 | m_RootNamespace = Helper.AttributeValue(node, "rootNamespace", m_RootNamespace); | ||
498 | |||
499 | int hash = m_Name.GetHashCode(); | ||
500 | Guid guidByHash = new Guid(hash, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); | ||
501 | string guid = Helper.AttributeValue(node, "guid", guidByHash.ToString()); | ||
502 | m_Guid = new Guid(guid); | ||
503 | |||
504 | m_GenerateAssemblyInfoFile = Helper.ParseBoolean(node, "generateAssemblyInfoFile", false); | ||
505 | m_DebugStartParameters = Helper.AttributeValue(node, "debugStartParameters", string.Empty); | ||
506 | |||
507 | if(m_AssemblyName == null || m_AssemblyName.Length < 1) | ||
508 | { | ||
509 | m_AssemblyName = m_Name; | ||
510 | } | ||
511 | |||
512 | if(m_RootNamespace == null || m_RootNamespace.Length < 1) | ||
513 | { | ||
514 | m_RootNamespace = m_Name; | ||
515 | } | ||
516 | |||
517 | m_FullPath = m_Path; | ||
518 | try | ||
519 | { | ||
520 | m_FullPath = Helper.ResolvePath(m_FullPath); | ||
521 | } | ||
522 | catch | ||
523 | { | ||
524 | throw new WarningException("Could not resolve Solution path: {0}", m_Path); | ||
525 | } | ||
526 | |||
527 | Kernel.Instance.CurrentWorkingDirectory.Push(); | ||
528 | try | ||
529 | { | ||
530 | Helper.SetCurrentDir(m_FullPath); | ||
531 | |||
532 | if( node == null ) | ||
533 | { | ||
534 | throw new ArgumentNullException("node"); | ||
535 | } | ||
536 | |||
537 | foreach(XmlNode child in node.ChildNodes) | ||
538 | { | ||
539 | IDataNode dataNode = Kernel.Instance.ParseNode(child, this); | ||
540 | if(dataNode is ConfigurationNode) | ||
541 | { | ||
542 | HandleConfiguration((ConfigurationNode)dataNode); | ||
543 | } | ||
544 | else if(dataNode is ReferencePathNode) | ||
545 | { | ||
546 | m_ReferencePaths.Add((ReferencePathNode)dataNode); | ||
547 | } | ||
548 | else if(dataNode is ReferenceNode) | ||
549 | { | ||
550 | m_References.Add((ReferenceNode)dataNode); | ||
551 | } | ||
552 | else if(dataNode is AuthorNode) | ||
553 | { | ||
554 | m_Authors.Add((AuthorNode)dataNode); | ||
555 | } | ||
556 | else if(dataNode is FilesNode) | ||
557 | { | ||
558 | m_Files = (FilesNode)dataNode; | ||
559 | } | ||
560 | } | ||
561 | } | ||
562 | finally | ||
563 | { | ||
564 | Kernel.Instance.CurrentWorkingDirectory.Pop(); | ||
565 | } | ||
566 | } | ||
567 | |||
568 | #endregion | ||
569 | |||
570 | #region IComparable Members | ||
571 | |||
572 | public int CompareTo(object obj) | ||
573 | { | ||
574 | ProjectNode that = (ProjectNode)obj; | ||
575 | return this.m_Name.CompareTo(that.m_Name); | ||
576 | } | ||
577 | |||
578 | #endregion | ||
579 | } | ||
580 | } | ||
diff --git a/Prebuild/src/Core/Nodes/ReferenceNode.cs b/Prebuild/src/Core/Nodes/ReferenceNode.cs deleted file mode 100644 index 9c5d1a3..0000000 --- a/Prebuild/src/Core/Nodes/ReferenceNode.cs +++ /dev/null | |||
@@ -1,144 +0,0 @@ | |||
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; | ||
27 | using System.Xml; | ||
28 | |||
29 | using Prebuild.Core.Attributes; | ||
30 | using Prebuild.Core.Interfaces; | ||
31 | using Prebuild.Core.Utilities; | ||
32 | |||
33 | namespace Prebuild.Core.Nodes | ||
34 | { | ||
35 | /// <summary> | ||
36 | /// | ||
37 | /// </summary> | ||
38 | [DataNode("Reference")] | ||
39 | public class ReferenceNode : DataNode, IComparable | ||
40 | { | ||
41 | #region Fields | ||
42 | |||
43 | private string m_Name = "unknown"; | ||
44 | private string m_Path; | ||
45 | private string m_LocalCopy; | ||
46 | private string m_Version; | ||
47 | |||
48 | #endregion | ||
49 | |||
50 | #region Properties | ||
51 | |||
52 | /// <summary> | ||
53 | /// Gets the name. | ||
54 | /// </summary> | ||
55 | /// <value>The name.</value> | ||
56 | public string Name | ||
57 | { | ||
58 | get | ||
59 | { | ||
60 | return m_Name; | ||
61 | } | ||
62 | } | ||
63 | |||
64 | /// <summary> | ||
65 | /// Gets the path. | ||
66 | /// </summary> | ||
67 | /// <value>The path.</value> | ||
68 | public string Path | ||
69 | { | ||
70 | get | ||
71 | { | ||
72 | return m_Path; | ||
73 | } | ||
74 | } | ||
75 | |||
76 | /// <summary> | ||
77 | /// Gets a value indicating whether [local copy specified]. | ||
78 | /// </summary> | ||
79 | /// <value><c>true</c> if [local copy specified]; otherwise, <c>false</c>.</value> | ||
80 | public bool LocalCopySpecified | ||
81 | { | ||
82 | get | ||
83 | { | ||
84 | return ( m_LocalCopy != null && m_LocalCopy.Length == 0); | ||
85 | } | ||
86 | } | ||
87 | |||
88 | /// <summary> | ||
89 | /// Gets a value indicating whether [local copy]. | ||
90 | /// </summary> | ||
91 | /// <value><c>true</c> if [local copy]; otherwise, <c>false</c>.</value> | ||
92 | public bool LocalCopy | ||
93 | { | ||
94 | get | ||
95 | { | ||
96 | if( m_LocalCopy == null) | ||
97 | { | ||
98 | return false; | ||
99 | } | ||
100 | return bool.Parse(m_LocalCopy); | ||
101 | } | ||
102 | } | ||
103 | |||
104 | /// <summary> | ||
105 | /// Gets the version. | ||
106 | /// </summary> | ||
107 | /// <value>The version.</value> | ||
108 | public string Version | ||
109 | { | ||
110 | get | ||
111 | { | ||
112 | return m_Version; | ||
113 | } | ||
114 | } | ||
115 | |||
116 | #endregion | ||
117 | |||
118 | #region Public Methods | ||
119 | |||
120 | /// <summary> | ||
121 | /// Parses the specified node. | ||
122 | /// </summary> | ||
123 | /// <param name="node">The node.</param> | ||
124 | public override void Parse(XmlNode node) | ||
125 | { | ||
126 | m_Name = Helper.AttributeValue(node, "name", m_Name); | ||
127 | m_Path = Helper.AttributeValue(node, "path", m_Path); | ||
128 | m_LocalCopy = Helper.AttributeValue(node, "localCopy", m_LocalCopy); | ||
129 | m_Version = Helper.AttributeValue(node, "version", m_Version); | ||
130 | } | ||
131 | |||
132 | #endregion | ||
133 | |||
134 | #region IComparable Members | ||
135 | |||
136 | public int CompareTo(object obj) | ||
137 | { | ||
138 | ReferenceNode that = (ReferenceNode)obj; | ||
139 | return this.m_Name.CompareTo(that.m_Name); | ||
140 | } | ||
141 | |||
142 | #endregion | ||
143 | } | ||
144 | } | ||
diff --git a/Prebuild/src/Core/Nodes/ReferencePathNode.cs b/Prebuild/src/Core/Nodes/ReferencePathNode.cs deleted file mode 100644 index f0543c2..0000000 --- a/Prebuild/src/Core/Nodes/ReferencePathNode.cs +++ /dev/null | |||
@@ -1,99 +0,0 @@ | |||
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; | ||
27 | using System.Collections; | ||
28 | using System.Collections.Specialized; | ||
29 | using System.Xml; | ||
30 | |||
31 | using Prebuild.Core.Attributes; | ||
32 | using Prebuild.Core.Interfaces; | ||
33 | using Prebuild.Core.Utilities; | ||
34 | |||
35 | namespace Prebuild.Core.Nodes | ||
36 | { | ||
37 | /// <summary> | ||
38 | /// | ||
39 | /// </summary> | ||
40 | [DataNode("ReferencePath")] | ||
41 | public class ReferencePathNode : DataNode, IComparable | ||
42 | { | ||
43 | #region Fields | ||
44 | |||
45 | private string m_Path; | ||
46 | |||
47 | #endregion | ||
48 | |||
49 | #region Properties | ||
50 | |||
51 | /// <summary> | ||
52 | /// Gets the path. | ||
53 | /// </summary> | ||
54 | /// <value>The path.</value> | ||
55 | public string Path | ||
56 | { | ||
57 | get | ||
58 | { | ||
59 | return m_Path; | ||
60 | } | ||
61 | } | ||
62 | |||
63 | #endregion | ||
64 | |||
65 | #region Public Methods | ||
66 | |||
67 | /// <summary> | ||
68 | /// Parses the specified node. | ||
69 | /// </summary> | ||
70 | /// <param name="node">The node.</param> | ||
71 | public override void Parse(XmlNode node) | ||
72 | { | ||
73 | if( node == null ) | ||
74 | { | ||
75 | throw new ArgumentNullException("node"); | ||
76 | } | ||
77 | |||
78 | m_Path = Helper.InterpolateForEnvironmentVariables(node.InnerText); | ||
79 | if(m_Path == null) | ||
80 | { | ||
81 | m_Path = ""; | ||
82 | } | ||
83 | |||
84 | m_Path = m_Path.Trim(); | ||
85 | } | ||
86 | |||
87 | #endregion | ||
88 | |||
89 | #region IComparable Members | ||
90 | |||
91 | public int CompareTo(object obj) | ||
92 | { | ||
93 | ReferencePathNode that = (ReferencePathNode)obj; | ||
94 | return this.m_Path.CompareTo(that.m_Path); | ||
95 | } | ||
96 | |||
97 | #endregion | ||
98 | } | ||
99 | } | ||
diff --git a/Prebuild/src/Core/Nodes/SolutionNode.cs b/Prebuild/src/Core/Nodes/SolutionNode.cs deleted file mode 100644 index 2a1b8e2..0000000 --- a/Prebuild/src/Core/Nodes/SolutionNode.cs +++ /dev/null | |||
@@ -1,358 +0,0 @@ | |||
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; | ||
27 | using System.Collections; | ||
28 | using System.Collections.Generic; | ||
29 | using System.Diagnostics; | ||
30 | using System.IO; | ||
31 | using System.Xml; | ||
32 | |||
33 | using Prebuild.Core.Attributes; | ||
34 | using Prebuild.Core.Interfaces; | ||
35 | using Prebuild.Core.Utilities; | ||
36 | |||
37 | namespace Prebuild.Core.Nodes | ||
38 | { | ||
39 | /// <summary> | ||
40 | /// | ||
41 | /// </summary> | ||
42 | [DataNode("Solution")] | ||
43 | [DataNode("EmbeddedSolution")] | ||
44 | [DebuggerDisplay("{Name}")] | ||
45 | public class SolutionNode : DataNode | ||
46 | { | ||
47 | #region Fields | ||
48 | |||
49 | private Guid m_Guid = Guid.NewGuid(); | ||
50 | private string m_Name = "unknown"; | ||
51 | private string m_Path = ""; | ||
52 | private string m_FullPath = ""; | ||
53 | private string m_ActiveConfig = "Debug"; | ||
54 | private string m_Version = "1.0.0"; | ||
55 | |||
56 | private OptionsNode m_Options; | ||
57 | private FilesNode m_Files; | ||
58 | private readonly Hashtable m_Configurations = new Hashtable(); | ||
59 | private readonly Hashtable m_Projects = new Hashtable(); | ||
60 | private readonly Hashtable m_DatabaseProjects = new Hashtable(); | ||
61 | private readonly List<ProjectNode> m_ProjectsOrder = new List<ProjectNode>(); | ||
62 | private readonly Hashtable m_Solutions = new Hashtable(); | ||
63 | |||
64 | #endregion | ||
65 | |||
66 | #region Properties | ||
67 | public override IDataNode Parent | ||
68 | { | ||
69 | get | ||
70 | { | ||
71 | return base.Parent; | ||
72 | } | ||
73 | set | ||
74 | { | ||
75 | if (value is SolutionNode) | ||
76 | { | ||
77 | SolutionNode solution = (SolutionNode)value; | ||
78 | foreach (ConfigurationNode conf in solution.Configurations) | ||
79 | { | ||
80 | m_Configurations[conf.Name] = conf.Clone(); | ||
81 | } | ||
82 | } | ||
83 | |||
84 | base.Parent = value; | ||
85 | } | ||
86 | } | ||
87 | |||
88 | public Guid Guid | ||
89 | { | ||
90 | get | ||
91 | { | ||
92 | return m_Guid; | ||
93 | } | ||
94 | set | ||
95 | { | ||
96 | m_Guid = value; | ||
97 | } | ||
98 | } | ||
99 | /// <summary> | ||
100 | /// Gets or sets the active config. | ||
101 | /// </summary> | ||
102 | /// <value>The active config.</value> | ||
103 | public string ActiveConfig | ||
104 | { | ||
105 | get | ||
106 | { | ||
107 | return m_ActiveConfig; | ||
108 | } | ||
109 | set | ||
110 | { | ||
111 | m_ActiveConfig = value; | ||
112 | } | ||
113 | } | ||
114 | |||
115 | /// <summary> | ||
116 | /// Gets the name. | ||
117 | /// </summary> | ||
118 | /// <value>The name.</value> | ||
119 | public string Name | ||
120 | { | ||
121 | get | ||
122 | { | ||
123 | return m_Name; | ||
124 | } | ||
125 | } | ||
126 | |||
127 | /// <summary> | ||
128 | /// Gets the path. | ||
129 | /// </summary> | ||
130 | /// <value>The path.</value> | ||
131 | public string Path | ||
132 | { | ||
133 | get | ||
134 | { | ||
135 | return m_Path; | ||
136 | } | ||
137 | } | ||
138 | |||
139 | /// <summary> | ||
140 | /// Gets the full path. | ||
141 | /// </summary> | ||
142 | /// <value>The full path.</value> | ||
143 | public string FullPath | ||
144 | { | ||
145 | get | ||
146 | { | ||
147 | return m_FullPath; | ||
148 | } | ||
149 | } | ||
150 | |||
151 | /// <summary> | ||
152 | /// Gets the version. | ||
153 | /// </summary> | ||
154 | /// <value>The version.</value> | ||
155 | public string Version | ||
156 | { | ||
157 | get | ||
158 | { | ||
159 | return m_Version; | ||
160 | } | ||
161 | } | ||
162 | |||
163 | /// <summary> | ||
164 | /// Gets the options. | ||
165 | /// </summary> | ||
166 | /// <value>The options.</value> | ||
167 | public OptionsNode Options | ||
168 | { | ||
169 | get | ||
170 | { | ||
171 | return m_Options; | ||
172 | } | ||
173 | } | ||
174 | |||
175 | /// <summary> | ||
176 | /// Gets the files. | ||
177 | /// </summary> | ||
178 | /// <value>The files.</value> | ||
179 | public FilesNode Files | ||
180 | { | ||
181 | get | ||
182 | { | ||
183 | return m_Files; | ||
184 | } | ||
185 | } | ||
186 | |||
187 | /// <summary> | ||
188 | /// Gets the configurations. | ||
189 | /// </summary> | ||
190 | /// <value>The configurations.</value> | ||
191 | public ICollection Configurations | ||
192 | { | ||
193 | get | ||
194 | { | ||
195 | ArrayList tmp = new ArrayList(ConfigurationsTable.Values); | ||
196 | tmp.Sort(); | ||
197 | return tmp; | ||
198 | } | ||
199 | } | ||
200 | |||
201 | /// <summary> | ||
202 | /// Gets the configurations table. | ||
203 | /// </summary> | ||
204 | /// <value>The configurations table.</value> | ||
205 | public Hashtable ConfigurationsTable | ||
206 | { | ||
207 | get | ||
208 | { | ||
209 | return m_Configurations; | ||
210 | } | ||
211 | } | ||
212 | /// <summary> | ||
213 | /// Gets the database projects. | ||
214 | /// </summary> | ||
215 | public ICollection DatabaseProjects | ||
216 | { | ||
217 | get | ||
218 | { | ||
219 | return m_DatabaseProjects.Values; | ||
220 | } | ||
221 | } | ||
222 | /// <summary> | ||
223 | /// Gets the nested solutions. | ||
224 | /// </summary> | ||
225 | public ICollection Solutions | ||
226 | { | ||
227 | get | ||
228 | { | ||
229 | return m_Solutions.Values; | ||
230 | } | ||
231 | } | ||
232 | /// <summary> | ||
233 | /// Gets the nested solutions hash table. | ||
234 | /// </summary> | ||
235 | public Hashtable SolutionsTable | ||
236 | { | ||
237 | get | ||
238 | { | ||
239 | return this.m_Solutions; | ||
240 | } | ||
241 | } | ||
242 | /// <summary> | ||
243 | /// Gets the projects. | ||
244 | /// </summary> | ||
245 | /// <value>The projects.</value> | ||
246 | public ICollection Projects | ||
247 | { | ||
248 | get | ||
249 | { | ||
250 | ArrayList tmp = new ArrayList(m_Projects.Values); | ||
251 | tmp.Sort(); | ||
252 | return tmp; | ||
253 | } | ||
254 | } | ||
255 | |||
256 | /// <summary> | ||
257 | /// Gets the projects table. | ||
258 | /// </summary> | ||
259 | /// <value>The projects table.</value> | ||
260 | public Hashtable ProjectsTable | ||
261 | { | ||
262 | get | ||
263 | { | ||
264 | return m_Projects; | ||
265 | } | ||
266 | } | ||
267 | |||
268 | /// <summary> | ||
269 | /// Gets the projects table. | ||
270 | /// </summary> | ||
271 | /// <value>The projects table.</value> | ||
272 | public List<ProjectNode> ProjectsTableOrder | ||
273 | { | ||
274 | get | ||
275 | { | ||
276 | return m_ProjectsOrder; | ||
277 | } | ||
278 | } | ||
279 | |||
280 | #endregion | ||
281 | |||
282 | #region Public Methods | ||
283 | |||
284 | /// <summary> | ||
285 | /// Parses the specified node. | ||
286 | /// </summary> | ||
287 | /// <param name="node">The node.</param> | ||
288 | public override void Parse(XmlNode node) | ||
289 | { | ||
290 | m_Name = Helper.AttributeValue(node, "name", m_Name); | ||
291 | m_ActiveConfig = Helper.AttributeValue(node, "activeConfig", m_ActiveConfig); | ||
292 | m_Path = Helper.AttributeValue(node, "path", m_Path); | ||
293 | m_Version = Helper.AttributeValue(node, "version", m_Version); | ||
294 | |||
295 | m_FullPath = m_Path; | ||
296 | try | ||
297 | { | ||
298 | m_FullPath = Helper.ResolvePath(m_FullPath); | ||
299 | } | ||
300 | catch | ||
301 | { | ||
302 | throw new WarningException("Could not resolve solution path: {0}", m_Path); | ||
303 | } | ||
304 | |||
305 | Kernel.Instance.CurrentWorkingDirectory.Push(); | ||
306 | try | ||
307 | { | ||
308 | Helper.SetCurrentDir(m_FullPath); | ||
309 | |||
310 | if( node == null ) | ||
311 | { | ||
312 | throw new ArgumentNullException("node"); | ||
313 | } | ||
314 | |||
315 | foreach(XmlNode child in node.ChildNodes) | ||
316 | { | ||
317 | IDataNode dataNode = Kernel.Instance.ParseNode(child, this); | ||
318 | if(dataNode is OptionsNode) | ||
319 | { | ||
320 | m_Options = (OptionsNode)dataNode; | ||
321 | } | ||
322 | else if(dataNode is FilesNode) | ||
323 | { | ||
324 | m_Files = (FilesNode)dataNode; | ||
325 | } | ||
326 | else if(dataNode is ConfigurationNode) | ||
327 | { | ||
328 | m_Configurations[((ConfigurationNode)dataNode).Name] = dataNode; | ||
329 | } | ||
330 | else if(dataNode is ProjectNode) | ||
331 | { | ||
332 | m_Projects[((ProjectNode)dataNode).Name] = dataNode; | ||
333 | m_ProjectsOrder.Add((ProjectNode)dataNode); | ||
334 | } | ||
335 | else if(dataNode is SolutionNode) | ||
336 | { | ||
337 | m_Solutions[((SolutionNode)dataNode).Name] = dataNode; | ||
338 | } | ||
339 | else if (dataNode is ProcessNode) | ||
340 | { | ||
341 | ProcessNode p = (ProcessNode)dataNode; | ||
342 | Kernel.Instance.ProcessFile(p, this); | ||
343 | } | ||
344 | else if (dataNode is DatabaseProjectNode) | ||
345 | { | ||
346 | m_DatabaseProjects[((DatabaseProjectNode)dataNode).Name] = dataNode; | ||
347 | } | ||
348 | } | ||
349 | } | ||
350 | finally | ||
351 | { | ||
352 | Kernel.Instance.CurrentWorkingDirectory.Pop(); | ||
353 | } | ||
354 | } | ||
355 | |||
356 | #endregion | ||
357 | } | ||
358 | } | ||