aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Prebuild
diff options
context:
space:
mode:
authorlbsa712007-11-05 15:10:20 +0000
committerlbsa712007-11-05 15:10:20 +0000
commitce33db72cb7ca15087606a23abf96590c49d166e (patch)
tree0441256a4c38bf92dc74870fe667bf1b777a1c9d /Prebuild
parentFixed the MyNpcCharacter errors (diff)
downloadopensim-SC_OLD-ce33db72cb7ca15087606a23abf96590c49d166e.zip
opensim-SC_OLD-ce33db72cb7ca15087606a23abf96590c49d166e.tar.gz
opensim-SC_OLD-ce33db72cb7ca15087606a23abf96590c49d166e.tar.bz2
opensim-SC_OLD-ce33db72cb7ca15087606a23abf96590c49d166e.tar.xz
* prebuild now creates .exe references in NAntTarget
* prebuild now uses local copy of schema (for future expansions)
Diffstat (limited to 'Prebuild')
-rw-r--r--Prebuild/prebuild-opensim.xsd258
-rw-r--r--Prebuild/src/Core/Targets/NAntTarget.cs784
2 files changed, 657 insertions, 385 deletions
diff --git a/Prebuild/prebuild-opensim.xsd b/Prebuild/prebuild-opensim.xsd
new file mode 100644
index 0000000..eee36aa
--- /dev/null
+++ b/Prebuild/prebuild-opensim.xsd
@@ -0,0 +1,258 @@
1<?xml version="1.0" encoding="utf-8" ?>
2<xs:schema elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://dnpb.sourceforge.net/schemas/prebuild-1.7.xsd"
3 xmlns="http://dnpb.sourceforge.net/schemas/prebuild-1.7.xsd">
4 <xs:annotation>
5 <xs:documentation>
6 Copyright (c) 2004-2005 Matthew Holmes (calefaction at houston . rr . com), Dan Moorehead (dan05a at gmail . com), David Hudson (jendave at yahoo dot com)
7
8 .NET Prebuild is a cross-platform XML-driven pre-build tool which
9 allows developers to easily generate project or make files for major
10 IDE's and .NET development tools including: Visual Studio .NET 2002 and
11 2003, SharpDevelop, MonoDevelop, and NAnt.
12
13 BSD License:
14
15 Redistribution and use in source and binary forms, with or without modification, are permitted
16 provided that the following conditions are met:
17
18 * Redistributions of source code must retain the above copyright notice, this list of conditions
19 and the following disclaimer.
20 * Redistributions in binary form must reproduce the above copyright notice, this list of conditions
21 and the following disclaimer in the documentation and/or other materials provided with the
22 distribution.
23 * The name of the author may not be used to endorse or promote products derived from this software
24 without specific prior written permission.
25
26 THIS SOFTWARE IS PROVIDED BY THE AUTHOR 'AS IS' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
27 BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
28 ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
29 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30 OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
31 OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
32 IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 </xs:documentation>
34 </xs:annotation>
35 <xs:element name="Prebuild">
36 <xs:complexType>
37 <xs:sequence>
38 <xs:element ref="Process" minOccurs="0" maxOccurs="unbounded" />
39 <xs:element ref="Solution" minOccurs="0" maxOccurs="unbounded" />
40 </xs:sequence>
41 <xs:attribute name="version" />
42 <xs:attribute name="checkOsVars" />
43 </xs:complexType>
44 </xs:element>
45 <xs:element name="Process" type="xs:string" />
46 <xs:element name="Solution">
47 <xs:complexType>
48 <xs:sequence>
49 <xs:element ref="Options" minOccurs="0" />
50 <xs:element ref="Configuration" minOccurs="1" maxOccurs="unbounded" />
51 <xs:element ref="Files" minOccurs="0" />
52 <xs:element ref="Project" minOccurs="1" maxOccurs="unbounded" />
53 </xs:sequence>
54 <xs:attribute name="name" type="xs:string" use="required" />
55 <xs:attribute name="activeConfig" type="xs:string" default="Debug" />
56 <xs:attribute name="path" type="xs:string" default="" />
57 </xs:complexType>
58 </xs:element>
59 <xs:element name="Project">
60 <xs:complexType>
61 <xs:sequence>
62 <xs:element ref="Configuration" minOccurs="0" maxOccurs="unbounded" />
63 <xs:element name="ReferencePath" type="xs:string" minOccurs="0" maxOccurs="unbounded" />
64 <xs:element name="Reference" minOccurs="0" maxOccurs="unbounded">
65 <xs:complexType>
66 <xs:attribute name="name" type="xs:string" use="required" />
67 <xs:attribute name="path" type="xs:string" />
68 <xs:attribute name="localCopy" type="xs:boolean" />
69 <xs:attribute name="version" type="xs:string" />
70 </xs:complexType>
71 </xs:element>
72 <xs:element ref="Files" />
73 </xs:sequence>
74 <xs:attribute name="name" type="xs:string" use="required" />
75 <xs:attribute name="designerFolder" type="xs:string" default="" />
76 <xs:attribute name="filterGroups" type="xs:string" default="" />
77 <xs:attribute name="path" type="xs:string" default="" />
78 <xs:attribute name="icon" type="xs:string" default="" />
79 <xs:attribute name="language" default="C#">
80 <xs:simpleType>
81 <xs:restriction base="xs:string">
82 <xs:enumeration value="C#" />
83 <xs:enumeration value="VB.NET" />
84 </xs:restriction>
85 </xs:simpleType>
86 </xs:attribute>
87 <xs:attribute name="type" default="Exe">
88 <xs:simpleType>
89 <xs:restriction base="xs:string">
90 <xs:enumeration value="Exe" />
91 <xs:enumeration value="WinExe" />
92 <xs:enumeration value="Library" />
93 </xs:restriction>
94 </xs:simpleType>
95 </xs:attribute>
96 <xs:attribute name="runtime" default="Microsoft">
97 <xs:simpleType>
98 <xs:restriction base="xs:string">
99 <xs:enumeration value="Microsoft" />
100 <xs:enumeration value="Mono" />
101 </xs:restriction>
102 </xs:simpleType>
103 </xs:attribute>
104 <xs:attribute name="startupObject" type="xs:string" default="" />
105 <xs:attribute name="rootNamespace" type="xs:string" />
106 <xs:attribute name="assemblyName" type="xs:string" />
107 </xs:complexType>
108 </xs:element>
109 <xs:element name="Configuration">
110 <xs:complexType>
111 <xs:sequence>
112 <xs:element ref="Options" minOccurs="0" />
113 </xs:sequence>
114 <xs:attribute name="name" type="xs:string" use="required" />
115 </xs:complexType>
116 </xs:element>
117 <xs:element name="Options">
118 <xs:complexType>
119 <xs:all>
120 <xs:element name="CompilerDefines" type="xs:string" minOccurs="0" />
121 <xs:element name="OptimizeCode" type="xs:boolean" minOccurs="0" />
122 <xs:element name="CheckUnderflowOverflow" type="xs:boolean" minOccurs="0" />
123 <xs:element name="AllowUnsafe" type="xs:boolean" minOccurs="0" />
124 <xs:element name="PreBuildEvent" type="xs:string" minOccurs="0" />
125 <xs:element name="PostBuildEvent" type="xs:string" minOccurs="0" />
126 <xs:element name="RunPostBuildEvent" minOccurs="0" default="OnBuildSuccess">
127 <xs:simpleType>
128 <xs:restriction base="xs:string">
129 <xs:enumeration value="OnBuildSuccess" />
130 <xs:enumeration value="Always" />
131 <xs:enumeration value="OnOutputUpdated" />
132 </xs:restriction>
133 </xs:simpleType>
134 </xs:element>
135 <xs:element name="RunScript" type="xs:string" minOccurs="0" />
136 <xs:element name="PreBuildEventArgs" type="xs:string" minOccurs="0" />
137 <xs:element name="PostBuildEventArgs" type="xs:string" minOccurs="0" />
138 <xs:element name="WarningLevel" minOccurs="0">
139 <xs:simpleType>
140 <xs:restriction base="xs:integer">
141 <xs:minInclusive value="0" />
142 <xs:maxInclusive value="4" />
143 </xs:restriction>
144 </xs:simpleType>
145 </xs:element>
146 <xs:element name="WarningsAsErrors" type="xs:boolean" minOccurs="0" />
147 <xs:element name="SuppressWarnings" type="xs:string" minOccurs="0" />
148 <xs:element name="OutputPath" type="xs:string" minOccurs="0" />
149 <xs:element name="XmlDocFile" type="xs:string" minOccurs="0" />
150 <xs:element name="DebugInformation" type="xs:boolean" minOccurs="0" />
151 <xs:element name="RegisterComInterop" type="xs:boolean" minOccurs="0" />
152 <xs:element name="RemoveIntegerChecks" type="xs:boolean" minOccurs="0" />
153 <xs:element name="IncrementalBuild" type="xs:boolean" minOccurs="0" />
154 <xs:element name="BaseAddress" type="xs:string" minOccurs="0" />
155 <xs:element name="FileAlignment" type="xs:integer" minOccurs="0" />
156 <xs:element name="NoStdLib" type="xs:boolean" minOccurs="0" />
157 <xs:element name="KeyFile" type="xs:string" minOccurs="0" />
158 </xs:all>
159 </xs:complexType>
160 </xs:element>
161 <xs:element name="Files">
162 <xs:complexType>
163 <xs:sequence>
164 <xs:element ref="File" minOccurs="0" maxOccurs="unbounded" />
165 <xs:element ref="Match" minOccurs="0" maxOccurs="unbounded" />
166 </xs:sequence>
167 </xs:complexType>
168 </xs:element>
169 <xs:element name="File">
170 <xs:complexType>
171 <xs:simpleContent>
172 <xs:extension base="xs:string">
173 <xs:attribute name="resourceName" type="xs:string" default="" />
174 <xs:attribute name="buildAction" default="Compile">
175 <xs:simpleType>
176 <xs:restriction base="xs:string">
177 <xs:enumeration value="None" />
178 <xs:enumeration value="Compile" />
179 <xs:enumeration value="Content" />
180 <xs:enumeration value="EmbeddedResource" />
181 </xs:restriction>
182 </xs:simpleType>
183 </xs:attribute>
184 <xs:attribute name="subType" default="Code">
185 <xs:simpleType>
186 <xs:restriction base="xs:string">
187 <xs:enumeration value="Code" />
188 <xs:enumeration value="Component" />
189 <xs:enumeration value="Form" />
190 <xs:enumeration value="Settings" />
191 <xs:enumeration value="UserControl" />
192 </xs:restriction>
193 </xs:simpleType>
194 </xs:attribute>
195 <xs:attribute name="link" type="xs:boolean" />
196 <xs:attribute name="copyToOutput" default="Never">
197 <xs:simpleType>
198 <xs:restriction base="xs:string">
199 <xs:enumeration value="Never" />
200 <xs:enumeration value="Always" />
201 <xs:enumeration value="PreserveNewest" />
202 </xs:restriction>
203 </xs:simpleType>
204 </xs:attribute>
205 </xs:extension>
206 </xs:simpleContent>
207 </xs:complexType>
208 </xs:element>
209 <xs:element name="Match">
210 <xs:complexType>
211 <xs:sequence>
212 <xs:element ref="Exclude" minOccurs="0" maxOccurs="unbounded" />
213 </xs:sequence>
214 <xs:attribute name="path" type="xs:string" />
215 <xs:attribute name="pattern" type="xs:string" use="required" />
216 <xs:attribute name="recurse" type="xs:boolean" default="false" />
217 <xs:attribute name="useRegex" type="xs:boolean" default="false" />
218 <xs:attribute name="buildAction" default="Compile">
219 <xs:simpleType>
220 <xs:restriction base="xs:string">
221 <xs:enumeration value="None" />
222 <xs:enumeration value="Compile" />
223 <xs:enumeration value="Content" />
224 <xs:enumeration value="EmbeddedResource" />
225 </xs:restriction>
226 </xs:simpleType>
227 </xs:attribute>
228 <xs:attribute name="resourceName" type="xs:string" default="" />
229 <xs:attribute name="subType" default="Code">
230 <xs:simpleType>
231 <xs:restriction base="xs:string">
232 <xs:enumeration value="Code" />
233 <xs:enumeration value="Component" />
234 <xs:enumeration value="Form" />
235 <xs:enumeration value="Settings" />
236 <xs:enumeration value="UserControl" />
237 </xs:restriction>
238 </xs:simpleType>
239 </xs:attribute>
240 <xs:attribute name="link" type="xs:boolean" />
241 <xs:attribute name="copyToOutput" default="Never">
242 <xs:simpleType>
243 <xs:restriction base="xs:string">
244 <xs:enumeration value="Never" />
245 <xs:enumeration value="Always" />
246 <xs:enumeration value="PreserveNewest" />
247 </xs:restriction>
248 </xs:simpleType>
249 </xs:attribute>
250 </xs:complexType>
251 </xs:element>
252 <xs:element name="Exclude">
253 <xs:complexType>
254 <xs:attribute name="name" type="xs:string" use="required" />
255 </xs:complexType>
256 </xs:element>
257
258</xs:schema>
diff --git a/Prebuild/src/Core/Targets/NAntTarget.cs b/Prebuild/src/Core/Targets/NAntTarget.cs
index e9870db..5355eef 100644
--- a/Prebuild/src/Core/Targets/NAntTarget.cs
+++ b/Prebuild/src/Core/Targets/NAntTarget.cs
@@ -47,301 +47,311 @@ using Prebuild.Core.Utilities;
47namespace Prebuild.Core.Targets 47namespace Prebuild.Core.Targets
48{ 48{
49 /// <summary> 49 /// <summary>
50/// 50 ///
51/// </summary> 51 /// </summary>
52[Target("nant")] 52 [Target("nant")]
53public class NAntTarget : ITarget 53 public class NAntTarget : ITarget
54{
55#region Fields
56
57 private Kernel m_Kernel;
58
59#endregion
60
61#region Private Methods
62
63 private static string PrependPath(string path)
64 {
65 string tmpPath = Helper.NormalizePath(path, '/');
66 Regex regex = new Regex(@"(\w):/(\w+)");
67 Match match = regex.Match(tmpPath);
68 //if(match.Success || tmpPath[0] == '.' || tmpPath[0] == '/')
69 //{
70 tmpPath = Helper.NormalizePath(tmpPath);
71 //}
72 // else
73 // {
74 // tmpPath = Helper.NormalizePath("./" + tmpPath);
75 // }
76
77 return tmpPath;
78 }
79
80 private static string BuildReference(SolutionNode solution, ProjectNode currentProject, ReferenceNode refr)
81 { 54 {
82 string ret = ""; 55 #region Fields
83 if(solution.ProjectsTable.ContainsKey(refr.Name)) 56
57 private Kernel m_Kernel;
58
59 #endregion
60
61 #region Private Methods
62
63 private static string PrependPath(string path)
64 {
65 string tmpPath = Helper.NormalizePath(path, '/');
66 Regex regex = new Regex(@"(\w):/(\w+)");
67 Match match = regex.Match(tmpPath);
68 //if(match.Success || tmpPath[0] == '.' || tmpPath[0] == '/')
69 //{
70 tmpPath = Helper.NormalizePath(tmpPath);
71 //}
72 // else
73 // {
74 // tmpPath = Helper.NormalizePath("./" + tmpPath);
75 // }
76
77 return tmpPath;
78 }
79
80 private static string BuildReference(SolutionNode solution, ProjectNode currentProject, ReferenceNode refr)
81 {
82 string ret = "";
83 if (solution.ProjectsTable.ContainsKey(refr.Name))
84 { 84 {
85 ProjectNode project = (ProjectNode)solution.ProjectsTable[refr.Name]; 85 ProjectNode project = (ProjectNode)solution.ProjectsTable[refr.Name];
86 86
87 string finalPath = Helper.NormalizePath(((ReferencePathNode)currentProject.ReferencePaths[0]).Path + refr.Name + ".dll", '/'); 87 string finalPath = Helper.NormalizePath(((ReferencePathNode)currentProject.ReferencePaths[0]).Path + refr.Name + GetProjectExtension(project), '/');
88 88
89 return finalPath; 89 return finalPath;
90 } 90 }
91 else 91 else
92 { 92 {
93 ProjectNode project = (ProjectNode)refr.Parent; 93 ProjectNode project = (ProjectNode)refr.Parent;
94 string fileRef = FindFileReference(refr.Name, project); 94 string fileRef = FindFileReference(refr.Name, project);
95 95
96 if(refr.Path != null || fileRef != null) 96 if (refr.Path != null || fileRef != null)
97 { 97 {
98 string finalPath = (refr.Path != null) ? Helper.NormalizePath(refr.Path + "/" + refr.Name + ".dll", '/') : fileRef; 98 string finalPath = (refr.Path != null) ? Helper.NormalizePath(refr.Path + "/" + refr.Name + GetProjectExtension(project), '/') : fileRef;
99 ret += finalPath; 99 ret += finalPath;
100 return ret; 100 return ret;
101 } 101 }
102 102
103 try 103 try
104 { 104 {
105 //Assembly assem = Assembly.Load(refr.Name); 105 //Assembly assem = Assembly.Load(refr.Name);
106 //if (assem != null) 106 //if (assem != null)
107 //{ 107 //{
108 //ret += (refr.Name + ".dll"); 108 //ret += (refr.Name + ".dll");
109 //} 109 //}
110 //else 110 //else
111 //{ 111 //{
112 ret += (refr.Name + ".dll"); 112 ret += (refr.Name + GetProjectExtension(project));
113 //} 113 //}
114 } 114 }
115 catch (System.NullReferenceException e) 115 catch (System.NullReferenceException e)
116 { 116 {
117 e.ToString(); 117 e.ToString();
118 ret += refr.Name + ".dll"; 118 ret += refr.Name + GetProjectExtension(project);
119 } 119 }
120 } 120 }
121 return ret; 121 return ret;
122 } 122 }
123 123
124 private static string BuildReferencePath(SolutionNode solution, ReferenceNode refr) 124 private static string GetProjectExtension(ProjectNode project)
125 { 125 {
126 string ret = ""; 126 string extension = ".dll";
127 if(solution.ProjectsTable.ContainsKey(refr.Name)) 127 if (project.Type == ProjectType.Exe)
128 {
129 extension = ".exe";
130 }
131 return extension;
132 }
133
134 private static string BuildReferencePath(SolutionNode solution, ReferenceNode refr)
135 {
136 string ret = "";
137 if (solution.ProjectsTable.ContainsKey(refr.Name))
128 { 138 {
129 ProjectNode project = (ProjectNode)solution.ProjectsTable[refr.Name]; 139 ProjectNode project = (ProjectNode)solution.ProjectsTable[refr.Name];
130 string finalPath = Helper.NormalizePath(((ReferencePathNode)project.ReferencePaths[0]).Path, '/'); 140 string finalPath = Helper.NormalizePath(((ReferencePathNode)project.ReferencePaths[0]).Path, '/');
131 141
132 return finalPath; 142 return finalPath;
133 } 143 }
134 else 144 else
135 { 145 {
136 ProjectNode project = (ProjectNode)refr.Parent; 146 ProjectNode project = (ProjectNode)refr.Parent;
137 string fileRef = FindFileReference(refr.Name, project); 147 string fileRef = FindFileReference(refr.Name, project);
138 148
139 if(refr.Path != null || fileRef != null) 149 if (refr.Path != null || fileRef != null)
140 { 150 {
141 string finalPath = (refr.Path != null) ? Helper.NormalizePath(refr.Path, '/') : fileRef; 151 string finalPath = (refr.Path != null) ? Helper.NormalizePath(refr.Path, '/') : fileRef;
142 ret += finalPath; 152 ret += finalPath;
143 return ret; 153 return ret;
144 } 154 }
145 155
146 try 156 try
157 {
158 Assembly assem = Assembly.Load(refr.Name);
159 if (assem != null)
147 { 160 {
148 Assembly assem = Assembly.Load(refr.Name); 161 ret += "";
149 if (assem != null)
150 {
151 ret += "";
152 }
153 else
154 {
155 ret += "";
156 }
157 } 162 }
158 catch (System.NullReferenceException e) 163 else
159 { 164 {
160 e.ToString();
161 ret += ""; 165 ret += "";
162 } 166 }
167 }
168 catch (System.NullReferenceException e)
169 {
170 e.ToString();
171 ret += "";
172 }
163 } 173 }
164 return ret; 174 return ret;
165 } 175 }
166 176
167 private static string FindFileReference(string refName, ProjectNode project) 177 private static string FindFileReference(string refName, ProjectNode project)
168 { 178 {
169 foreach(ReferencePathNode refPath in project.ReferencePaths) 179 foreach (ReferencePathNode refPath in project.ReferencePaths)
170 { 180 {
171 string fullPath = Helper.MakeFilePath(refPath.Path, refName, "dll"); 181 string fullPath = Helper.MakeFilePath(refPath.Path, refName, "dll");
172 182
173 if(File.Exists(fullPath)) 183 if (File.Exists(fullPath))
174 { 184 {
175 return fullPath; 185 return fullPath;
176 } 186 }
177 } 187 }
178 188
179 return null; 189 return null;
180 } 190 }
181 191
182 /// <summary> 192 /// <summary>
183 /// Gets the XML doc file. 193 /// Gets the XML doc file.
184 /// </summary> 194 /// </summary>
185 /// <param name="project">The project.</param> 195 /// <param name="project">The project.</param>
186 /// <param name="conf">The conf.</param> 196 /// <param name="conf">The conf.</param>
187 /// <returns></returns> 197 /// <returns></returns>
188 public static string GetXmlDocFile(ProjectNode project, ConfigurationNode conf) 198 public static string GetXmlDocFile(ProjectNode project, ConfigurationNode conf)
189 { 199 {
190 if( conf == null ) 200 if (conf == null)
191 { 201 {
192 throw new ArgumentNullException("conf"); 202 throw new ArgumentNullException("conf");
193 } 203 }
194 if( project == null ) 204 if (project == null)
195 { 205 {
196 throw new ArgumentNullException("project"); 206 throw new ArgumentNullException("project");
197 } 207 }
198 string docFile = (string)conf.Options["XmlDocFile"]; 208 string docFile = (string)conf.Options["XmlDocFile"];
199 // if(docFile != null && docFile.Length == 0)//default to assembly name if not specified 209 // if(docFile != null && docFile.Length == 0)//default to assembly name if not specified
200 // { 210 // {
201 // return Path.GetFileNameWithoutExtension(project.AssemblyName) + ".xml"; 211 // return Path.GetFileNameWithoutExtension(project.AssemblyName) + ".xml";
202 // } 212 // }
203 return docFile; 213 return docFile;
204 } 214 }
205 215
206 private void WriteProject(SolutionNode solution, ProjectNode project) 216 private void WriteProject(SolutionNode solution, ProjectNode project)
207 { 217 {
208 string projFile = Helper.MakeFilePath(project.FullPath, project.Name + (project.Type == ProjectType.Library ? ".dll" : ".exe"), "build"); 218 string projFile = Helper.MakeFilePath(project.FullPath, project.Name + GetProjectExtension(project), "build");
209 StreamWriter ss = new StreamWriter(projFile); 219 StreamWriter ss = new StreamWriter(projFile);
210 220
211 m_Kernel.CurrentWorkingDirectory.Push(); 221 m_Kernel.CurrentWorkingDirectory.Push();
212 Helper.SetCurrentDir(Path.GetDirectoryName(projFile)); 222 Helper.SetCurrentDir(Path.GetDirectoryName(projFile));
213 bool hasDoc = false; 223 bool hasDoc = false;
214 224
215 using(ss) 225 using (ss)
216 { 226 {
217 ss.WriteLine("<?xml version=\"1.0\" ?>"); 227 ss.WriteLine("<?xml version=\"1.0\" ?>");
218 ss.WriteLine("<project name=\"{0}\" default=\"build\">", project.Name); 228 ss.WriteLine("<project name=\"{0}\" default=\"build\">", project.Name);
219 ss.WriteLine(" <target name=\"{0}\">", "build"); 229 ss.WriteLine(" <target name=\"{0}\">", "build");
220 ss.WriteLine(" <echo message=\"Build Directory is ${project::get-base-directory()}/${build.dir}\" />"); 230 ss.WriteLine(" <echo message=\"Build Directory is ${project::get-base-directory()}/${build.dir}\" />");
221 ss.WriteLine(" <mkdir dir=\"${project::get-base-directory()}/${build.dir}\" />"); 231 ss.WriteLine(" <mkdir dir=\"${project::get-base-directory()}/${build.dir}\" />");
222 ss.WriteLine(" <copy todir=\"${project::get-base-directory()}/${build.dir}\">"); 232 ss.WriteLine(" <copy todir=\"${project::get-base-directory()}/${build.dir}\">");
223 ss.WriteLine(" <fileset basedir=\"${project::get-base-directory()}\">"); 233 ss.WriteLine(" <fileset basedir=\"${project::get-base-directory()}\">");
224 foreach(ReferenceNode refr in project.References) 234 foreach (ReferenceNode refr in project.References)
235 {
236 if (refr.LocalCopy)
225 { 237 {
226 if (refr.LocalCopy) 238 ss.WriteLine(" <include name=\"{0}", Helper.NormalizePath(Helper.MakePathRelativeTo(project.FullPath, BuildReference(solution, project, refr)) + "\" />", '/'));
227 {
228 ss.WriteLine(" <include name=\"{0}", Helper.NormalizePath(Helper.MakePathRelativeTo(project.FullPath, BuildReference(solution, project, refr))+"\" />", '/'));
229 }
230 } 239 }
240 }
231 ss.WriteLine(" </fileset>"); 241 ss.WriteLine(" </fileset>");
232 ss.WriteLine(" </copy>"); 242 ss.WriteLine(" </copy>");
233 ss.Write(" <csc"); 243 ss.Write(" <csc");
234 ss.Write(" target=\"{0}\"", project.Type.ToString().ToLower()); 244 ss.Write(" target=\"{0}\"", project.Type.ToString().ToLower());
235 ss.Write(" debug=\"{0}\"", "${build.debug}"); 245 ss.Write(" debug=\"{0}\"", "${build.debug}");
236 foreach(ConfigurationNode conf in project.Configurations) 246 foreach (ConfigurationNode conf in project.Configurations)
237 { 247 {
238 if (conf.Options.KeyFile !="") 248 if (conf.Options.KeyFile != "")
239 {
240 ss.Write(" keyfile=\"{0}\"", conf.Options.KeyFile);
241 break;
242 }
243 }
244 foreach(ConfigurationNode conf in project.Configurations)
245 {
246 ss.Write(" unsafe=\"{0}\"", conf.Options.AllowUnsafe);
247 break;
248 }
249 foreach(ConfigurationNode conf in project.Configurations)
250 { 249 {
251 ss.Write(" define=\"{0}\"", conf.Options.CompilerDefines); 250 ss.Write(" keyfile=\"{0}\"", conf.Options.KeyFile);
252 break; 251 break;
253 } 252 }
254 foreach(ConfigurationNode conf in project.Configurations) 253 }
254 foreach (ConfigurationNode conf in project.Configurations)
255 {
256 ss.Write(" unsafe=\"{0}\"", conf.Options.AllowUnsafe);
257 break;
258 }
259 foreach (ConfigurationNode conf in project.Configurations)
260 {
261 ss.Write(" define=\"{0}\"", conf.Options.CompilerDefines);
262 break;
263 }
264 foreach (ConfigurationNode conf in project.Configurations)
265 {
266 if (GetXmlDocFile(project, conf) != "")
255 { 267 {
256 if (GetXmlDocFile(project, conf) !="") 268 ss.Write(" doc=\"{0}\"", "${project::get-base-directory()}/${build.dir}/" + GetXmlDocFile(project, conf));
257 { 269 hasDoc = true;
258 ss.Write(" doc=\"{0}\"", "${project::get-base-directory()}/${build.dir}/" + GetXmlDocFile(project, conf));
259 hasDoc = true;
260 }
261 break;
262 } 270 }
271 break;
272 }
263 ss.Write(" output=\"{0}", "${project::get-base-directory()}/${build.dir}/${project::get-name()}"); 273 ss.Write(" output=\"{0}", "${project::get-base-directory()}/${build.dir}/${project::get-name()}");
264 if (project.Type == ProjectType.Library) 274 if (project.Type == ProjectType.Library)
265 { 275 {
266 ss.Write(".dll\""); 276 ss.Write(".dll\"");
267 } 277 }
268 else 278 else
269 { 279 {
270 ss.Write(".exe\""); 280 ss.Write(".exe\"");
271 } 281 }
272 if(project.AppIcon != null && project.AppIcon.Length != 0) 282 if (project.AppIcon != null && project.AppIcon.Length != 0)
273 { 283 {
274 ss.Write(" win32icon=\"{0}\"", Helper.NormalizePath(project.AppIcon,'/')); 284 ss.Write(" win32icon=\"{0}\"", Helper.NormalizePath(project.AppIcon, '/'));
275 } 285 }
276 ss.WriteLine(">"); 286 ss.WriteLine(">");
277 ss.WriteLine(" <resources prefix=\"{0}\" dynamicprefix=\"true\" >", project.RootNamespace); 287 ss.WriteLine(" <resources prefix=\"{0}\" dynamicprefix=\"true\" >", project.RootNamespace);
278 foreach (string file in project.Files) 288 foreach (string file in project.Files)
289 {
290 switch (project.Files.GetBuildAction(file))
279 { 291 {
280 switch (project.Files.GetBuildAction(file)) 292 case BuildAction.EmbeddedResource:
293 ss.WriteLine(" {0}", "<include name=\"" + Helper.NormalizePath(PrependPath(file), '/') + "\" />");
294 break;
295 default:
296 if (project.Files.GetSubType(file) != SubType.Code && project.Files.GetSubType(file) != SubType.Settings)
281 { 297 {
282 case BuildAction.EmbeddedResource: 298 ss.WriteLine(" <include name=\"{0}\" />", file.Substring(0, file.LastIndexOf('.')) + ".resx");
283 ss.WriteLine(" {0}", "<include name=\"" + Helper.NormalizePath(PrependPath(file), '/') + "\" />");
284 break;
285 default:
286 if (project.Files.GetSubType(file) != SubType.Code && project.Files.GetSubType(file) != SubType.Settings)
287 {
288 ss.WriteLine(" <include name=\"{0}\" />", file.Substring(0, file.LastIndexOf('.')) + ".resx");
289 }
290 break;
291 } 299 }
300 break;
292 } 301 }
302 }
293 //if (project.Files.GetSubType(file).ToString() != "Code") 303 //if (project.Files.GetSubType(file).ToString() != "Code")
294 //{ 304 //{
295 // ps.WriteLine(" <EmbeddedResource Include=\"{0}\">", file.Substring(0, file.LastIndexOf('.')) + ".resx"); 305 // ps.WriteLine(" <EmbeddedResource Include=\"{0}\">", file.Substring(0, file.LastIndexOf('.')) + ".resx");
296 306
297 ss.WriteLine(" </resources>"); 307 ss.WriteLine(" </resources>");
298 ss.WriteLine(" <sources failonempty=\"true\">"); 308 ss.WriteLine(" <sources failonempty=\"true\">");
299 foreach(string file in project.Files) 309 foreach (string file in project.Files)
310 {
311 switch (project.Files.GetBuildAction(file))
300 { 312 {
301 switch(project.Files.GetBuildAction(file)) 313 case BuildAction.Compile:
302 { 314 ss.WriteLine(" <include name=\"" + Helper.NormalizePath(PrependPath(file), '/') + "\" />");
303 case BuildAction.Compile: 315 break;
304 ss.WriteLine(" <include name=\"" + Helper.NormalizePath(PrependPath(file), '/') + "\" />"); 316 default:
305 break; 317 break;
306 default:
307 break;
308 }
309 } 318 }
319 }
310 ss.WriteLine(" </sources>"); 320 ss.WriteLine(" </sources>");
311 ss.WriteLine(" <references basedir=\"${project::get-base-directory()}\">"); 321 ss.WriteLine(" <references basedir=\"${project::get-base-directory()}\">");
312 ss.WriteLine(" <lib>"); 322 ss.WriteLine(" <lib>");
313 ss.WriteLine(" <include name=\"${project::get-base-directory()}\" />"); 323 ss.WriteLine(" <include name=\"${project::get-base-directory()}\" />");
314 ss.WriteLine(" <include name=\"${project::get-base-directory()}/${build.dir}\" />"); 324 ss.WriteLine(" <include name=\"${project::get-base-directory()}/${build.dir}\" />");
315 ss.WriteLine(" </lib>"); 325 ss.WriteLine(" </lib>");
316 foreach(ReferenceNode refr in project.References) 326 foreach (ReferenceNode refr in project.References)
317 { 327 {
318 string path = Helper.NormalizePath(Helper.MakePathRelativeTo(project.FullPath, BuildReference(solution, project, refr)), '/'); 328 string path = Helper.NormalizePath(Helper.MakePathRelativeTo(project.FullPath, BuildReference(solution, project, refr)), '/');
319 ss.WriteLine(" <include name=\""+ path + "\" />" ); 329 ss.WriteLine(" <include name=\"" + path + "\" />");
320 } 330 }
321 ss.WriteLine(" </references>"); 331 ss.WriteLine(" </references>");
322 332
323 ss.WriteLine(" </csc>"); 333 ss.WriteLine(" </csc>");
324 334
325 foreach (ConfigurationNode conf in project.Configurations) 335 foreach (ConfigurationNode conf in project.Configurations)
336 {
337 if (!String.IsNullOrEmpty(conf.Options.OutputPath))
326 { 338 {
327 if (!String.IsNullOrEmpty(conf.Options.OutputPath)) 339 string targetDir = Helper.NormalizePath(conf.Options.OutputPath, '/');
328 { 340
329 string targetDir = Helper.NormalizePath(conf.Options.OutputPath, '/'); 341 ss.WriteLine(" <echo message=\"Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/" + targetDir + "\" />");
330 342
331 ss.WriteLine(" <echo message=\"Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/" + targetDir + "\" />"); 343 ss.WriteLine(" <mkdir dir=\"${project::get-base-directory()}/" + targetDir + "\"/>");
332 344
333 ss.WriteLine(" <mkdir dir=\"${project::get-base-directory()}/" + targetDir + "\"/>"); 345 ss.WriteLine(" <copy todir=\"${project::get-base-directory()}/" + targetDir + "\">");
334 346 ss.WriteLine(" <fileset basedir=\"${project::get-base-directory()}/${build.dir}/\" >");
335 ss.WriteLine(" <copy todir=\"${project::get-base-directory()}/" + targetDir + "\">"); 347 ss.WriteLine(" <include name=\"*.dll\"/>");
336 ss.WriteLine(" <fileset basedir=\"${project::get-base-directory()}/${build.dir}/\" >"); 348 ss.WriteLine(" <include name=\"*.exe\"/>");
337 ss.WriteLine(" <include name=\"*.dll\"/>"); 349 ss.WriteLine(" </fileset>");
338 ss.WriteLine(" <include name=\"*.exe\"/>"); 350 ss.WriteLine(" </copy>");
339 ss.WriteLine(" </fileset>"); 351 break;
340 ss.WriteLine(" </copy>");
341 break;
342 }
343 } 352 }
344 353 }
354
345 ss.WriteLine(" </target>"); 355 ss.WriteLine(" </target>");
346 356
347 ss.WriteLine(" <target name=\"clean\">"); 357 ss.WriteLine(" <target name=\"clean\">");
@@ -351,89 +361,89 @@ public class NAntTarget : ITarget
351 361
352 ss.WriteLine(" <target name=\"doc\" description=\"Creates documentation.\">"); 362 ss.WriteLine(" <target name=\"doc\" description=\"Creates documentation.\">");
353 if (hasDoc) 363 if (hasDoc)
364 {
365 ss.WriteLine(" <property name=\"doc.target\" value=\"\" />");
366 ss.WriteLine(" <if test=\"${platform::is-unix()}\">");
367 ss.WriteLine(" <property name=\"doc.target\" value=\"Web\" />");
368 ss.WriteLine(" </if>");
369 ss.WriteLine(" <ndoc failonerror=\"false\" verbose=\"true\">");
370 ss.WriteLine(" <assemblies basedir=\"${project::get-base-directory()}\">");
371 ss.Write(" <include name=\"${build.dir}/${project::get-name()}");
372 if (project.Type == ProjectType.Library)
354 { 373 {
355 ss.WriteLine(" <property name=\"doc.target\" value=\"\" />"); 374 ss.WriteLine(".dll\" />");
356 ss.WriteLine(" <if test=\"${platform::is-unix()}\">"); 375 }
357 ss.WriteLine(" <property name=\"doc.target\" value=\"Web\" />"); 376 else
358 ss.WriteLine(" </if>"); 377 {
359 ss.WriteLine(" <ndoc failonerror=\"false\" verbose=\"true\">"); 378 ss.WriteLine(".exe\" />");
360 ss.WriteLine(" <assemblies basedir=\"${project::get-base-directory()}\">");
361 ss.Write(" <include name=\"${build.dir}/${project::get-name()}");
362 if (project.Type == ProjectType.Library)
363 {
364 ss.WriteLine(".dll\" />");
365 }
366 else
367 {
368 ss.WriteLine(".exe\" />");
369 }
370
371 ss.WriteLine(" </assemblies>");
372 ss.WriteLine(" <summaries basedir=\"${project::get-base-directory()}\">");
373 ss.WriteLine(" <include name=\"${build.dir}/${project::get-name()}.xml\"/>");
374 ss.WriteLine(" </summaries>");
375 ss.WriteLine(" <referencepaths basedir=\"${project::get-base-directory()}\">");
376 ss.WriteLine(" <include name=\"${build.dir}\" />");
377 // foreach(ReferenceNode refr in project.References)
378 // {
379 // string path = Helper.NormalizePath(Helper.MakePathRelativeTo(project.FullPath, BuildReferencePath(solution, refr)), '/');
380 // if (path != "")
381 // {
382 // ss.WriteLine(" <include name=\"{0}\" />", path);
383 // }
384 // }
385 ss.WriteLine(" </referencepaths>");
386 ss.WriteLine(" <documenters>");
387 ss.WriteLine(" <documenter name=\"MSDN\">");
388 ss.WriteLine(" <property name=\"OutputDirectory\" value=\"${project::get-base-directory()}/${build.dir}/doc/${project::get-name()}\" />");
389 ss.WriteLine(" <property name=\"OutputTarget\" value=\"${doc.target}\" />");
390 ss.WriteLine(" <property name=\"HtmlHelpName\" value=\"${project::get-name()}\" />");
391 ss.WriteLine(" <property name=\"IncludeFavorites\" value=\"False\" />");
392 ss.WriteLine(" <property name=\"Title\" value=\"${project::get-name()} SDK Documentation\" />");
393 ss.WriteLine(" <property name=\"SplitTOCs\" value=\"False\" />");
394 ss.WriteLine(" <property name=\"DefaulTOC\" value=\"\" />");
395 ss.WriteLine(" <property name=\"ShowVisualBasic\" value=\"True\" />");
396 ss.WriteLine(" <property name=\"AutoDocumentConstructors\" value=\"True\" />");
397 ss.WriteLine(" <property name=\"ShowMissingSummaries\" value=\"${build.debug}\" />");
398 ss.WriteLine(" <property name=\"ShowMissingRemarks\" value=\"${build.debug}\" />");
399 ss.WriteLine(" <property name=\"ShowMissingParams\" value=\"${build.debug}\" />");
400 ss.WriteLine(" <property name=\"ShowMissingReturns\" value=\"${build.debug}\" />");
401 ss.WriteLine(" <property name=\"ShowMissingValues\" value=\"${build.debug}\" />");
402 ss.WriteLine(" <property name=\"DocumentInternals\" value=\"False\" />");
403 ss.WriteLine(" <property name=\"DocumentPrivates\" value=\"False\" />");
404 ss.WriteLine(" <property name=\"DocumentProtected\" value=\"True\" />");
405 ss.WriteLine(" <property name=\"DocumentEmptyNamespaces\" value=\"${build.debug}\" />");
406 ss.WriteLine(" <property name=\"IncludeAssemblyVersion\" value=\"True\" />");
407 ss.WriteLine(" </documenter>");
408 ss.WriteLine(" </documenters>");
409 ss.WriteLine(" </ndoc>");
410 } 379 }
380
381 ss.WriteLine(" </assemblies>");
382 ss.WriteLine(" <summaries basedir=\"${project::get-base-directory()}\">");
383 ss.WriteLine(" <include name=\"${build.dir}/${project::get-name()}.xml\"/>");
384 ss.WriteLine(" </summaries>");
385 ss.WriteLine(" <referencepaths basedir=\"${project::get-base-directory()}\">");
386 ss.WriteLine(" <include name=\"${build.dir}\" />");
387 // foreach(ReferenceNode refr in project.References)
388 // {
389 // string path = Helper.NormalizePath(Helper.MakePathRelativeTo(project.FullPath, BuildReferencePath(solution, refr)), '/');
390 // if (path != "")
391 // {
392 // ss.WriteLine(" <include name=\"{0}\" />", path);
393 // }
394 // }
395 ss.WriteLine(" </referencepaths>");
396 ss.WriteLine(" <documenters>");
397 ss.WriteLine(" <documenter name=\"MSDN\">");
398 ss.WriteLine(" <property name=\"OutputDirectory\" value=\"${project::get-base-directory()}/${build.dir}/doc/${project::get-name()}\" />");
399 ss.WriteLine(" <property name=\"OutputTarget\" value=\"${doc.target}\" />");
400 ss.WriteLine(" <property name=\"HtmlHelpName\" value=\"${project::get-name()}\" />");
401 ss.WriteLine(" <property name=\"IncludeFavorites\" value=\"False\" />");
402 ss.WriteLine(" <property name=\"Title\" value=\"${project::get-name()} SDK Documentation\" />");
403 ss.WriteLine(" <property name=\"SplitTOCs\" value=\"False\" />");
404 ss.WriteLine(" <property name=\"DefaulTOC\" value=\"\" />");
405 ss.WriteLine(" <property name=\"ShowVisualBasic\" value=\"True\" />");
406 ss.WriteLine(" <property name=\"AutoDocumentConstructors\" value=\"True\" />");
407 ss.WriteLine(" <property name=\"ShowMissingSummaries\" value=\"${build.debug}\" />");
408 ss.WriteLine(" <property name=\"ShowMissingRemarks\" value=\"${build.debug}\" />");
409 ss.WriteLine(" <property name=\"ShowMissingParams\" value=\"${build.debug}\" />");
410 ss.WriteLine(" <property name=\"ShowMissingReturns\" value=\"${build.debug}\" />");
411 ss.WriteLine(" <property name=\"ShowMissingValues\" value=\"${build.debug}\" />");
412 ss.WriteLine(" <property name=\"DocumentInternals\" value=\"False\" />");
413 ss.WriteLine(" <property name=\"DocumentPrivates\" value=\"False\" />");
414 ss.WriteLine(" <property name=\"DocumentProtected\" value=\"True\" />");
415 ss.WriteLine(" <property name=\"DocumentEmptyNamespaces\" value=\"${build.debug}\" />");
416 ss.WriteLine(" <property name=\"IncludeAssemblyVersion\" value=\"True\" />");
417 ss.WriteLine(" </documenter>");
418 ss.WriteLine(" </documenters>");
419 ss.WriteLine(" </ndoc>");
420 }
411 ss.WriteLine(" </target>"); 421 ss.WriteLine(" </target>");
412 ss.WriteLine("</project>"); 422 ss.WriteLine("</project>");
413 } 423 }
414 m_Kernel.CurrentWorkingDirectory.Pop(); 424 m_Kernel.CurrentWorkingDirectory.Pop();
415 } 425 }
416 426
417 private void WriteCombine(SolutionNode solution) 427 private void WriteCombine(SolutionNode solution)
418 { 428 {
419 m_Kernel.Log.Write("Creating NAnt build files"); 429 m_Kernel.Log.Write("Creating NAnt build files");
420 foreach(ProjectNode project in solution.Projects) 430 foreach (ProjectNode project in solution.Projects)
421 { 431 {
422 if(m_Kernel.AllowProject(project.FilterGroups)) 432 if (m_Kernel.AllowProject(project.FilterGroups))
423 { 433 {
424 m_Kernel.Log.Write("...Creating project: {0}", project.Name); 434 m_Kernel.Log.Write("...Creating project: {0}", project.Name);
425 WriteProject(solution, project); 435 WriteProject(solution, project);
426 } 436 }
427 } 437 }
428 438
429 m_Kernel.Log.Write(""); 439 m_Kernel.Log.Write("");
430 string combFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "build"); 440 string combFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "build");
431 StreamWriter ss = new StreamWriter(combFile); 441 StreamWriter ss = new StreamWriter(combFile);
432 442
433 m_Kernel.CurrentWorkingDirectory.Push(); 443 m_Kernel.CurrentWorkingDirectory.Push();
434 Helper.SetCurrentDir(Path.GetDirectoryName(combFile)); 444 Helper.SetCurrentDir(Path.GetDirectoryName(combFile));
435 445
436 using(ss) 446 using (ss)
437 { 447 {
438 ss.WriteLine("<?xml version=\"1.0\" ?>"); 448 ss.WriteLine("<?xml version=\"1.0\" ?>");
439 ss.WriteLine("<project name=\"{0}\" default=\"build\">", solution.Name); 449 ss.WriteLine("<project name=\"{0}\" default=\"build\">", solution.Name);
@@ -447,26 +457,26 @@ public class NAntTarget : ITarget
447 ss.WriteLine(" <property name=\"doc.dir\" value=\"doc\" />"); 457 ss.WriteLine(" <property name=\"doc.dir\" value=\"doc\" />");
448 ss.WriteLine(" <property name=\"project.main.dir\" value=\"${project::get-base-directory()}\" />"); 458 ss.WriteLine(" <property name=\"project.main.dir\" value=\"${project::get-base-directory()}\" />");
449 459
450 foreach(ConfigurationNode conf in solution.Configurations) 460 foreach (ConfigurationNode conf in solution.Configurations)
461 {
462 // Set the project.config to a non-debug configuration
463 if (conf.Options["DebugInformation"].ToString().ToLower() != "true")
451 { 464 {
452 // Set the project.config to a non-debug configuration 465 ss.WriteLine(" <property name=\"project.config\" value=\"{0}\" />", conf.Name);
453 if( conf.Options["DebugInformation"].ToString().ToLower() != "true" )
454 {
455 ss.WriteLine(" <property name=\"project.config\" value=\"{0}\" />", conf.Name);
456 }
457 ss.WriteLine();
458 ss.WriteLine(" <target name=\"{0}\" description=\"\">", conf.Name);
459 ss.WriteLine(" <property name=\"project.config\" value=\"{0}\" />", conf.Name);
460 ss.WriteLine(" <property name=\"build.debug\" value=\"{0}\" />", conf.Options["DebugInformation"].ToString().ToLower());
461 ss.WriteLine(" </target>");
462 ss.WriteLine();
463 } 466 }
467 ss.WriteLine();
468 ss.WriteLine(" <target name=\"{0}\" description=\"\">", conf.Name);
469 ss.WriteLine(" <property name=\"project.config\" value=\"{0}\" />", conf.Name);
470 ss.WriteLine(" <property name=\"build.debug\" value=\"{0}\" />", conf.Options["DebugInformation"].ToString().ToLower());
471 ss.WriteLine(" </target>");
472 ss.WriteLine();
473 }
464 474
465 ss.WriteLine(" <target name=\"net-1.1\" description=\"Sets framework to .NET 1.1\">"); 475 ss.WriteLine(" <target name=\"net-1.1\" description=\"Sets framework to .NET 1.1\">");
466 ss.WriteLine(" <property name=\"nant.settings.currentframework\" value=\"net-1.1\" />"); 476 ss.WriteLine(" <property name=\"nant.settings.currentframework\" value=\"net-1.1\" />");
467 ss.WriteLine(" </target>"); 477 ss.WriteLine(" </target>");
468 ss.WriteLine(); 478 ss.WriteLine();
469 479
470 ss.WriteLine(" <target name=\"net-2.0\" description=\"Sets framework to .NET 2.0\">"); 480 ss.WriteLine(" <target name=\"net-2.0\" description=\"Sets framework to .NET 2.0\">");
471 ss.WriteLine(" <property name=\"nant.settings.currentframework\" value=\"net-2.0\" />"); 481 ss.WriteLine(" <property name=\"nant.settings.currentframework\" value=\"net-2.0\" />");
472 ss.WriteLine(" </target>"); 482 ss.WriteLine(" </target>");
@@ -497,28 +507,31 @@ public class NAntTarget : ITarget
497 // created files from all .nant/*include files. This 507 // created files from all .nant/*include files. This
498 // lets us keep using prebuild, but allows for 508 // lets us keep using prebuild, but allows for
499 // extended nant targets to do build and the like. 509 // extended nant targets to do build and the like.
500 510
501 try { 511 try
512 {
502 Regex re = new Regex(".include$"); 513 Regex re = new Regex(".include$");
503 DirectoryInfo nantdir = new DirectoryInfo(".nant"); 514 DirectoryInfo nantdir = new DirectoryInfo(".nant");
504 foreach (FileSystemInfo item in nantdir.GetFileSystemInfos()) 515 foreach (FileSystemInfo item in nantdir.GetFileSystemInfos())
505 { 516 {
506 if (item is DirectoryInfo) {} 517 if (item is DirectoryInfo) { }
507 else if (item is FileInfo) 518 else if (item is FileInfo)
508 { 519 {
509 if (re.Match(((FileInfo)item).FullName) != 520 if (re.Match(((FileInfo)item).FullName) !=
510 System.Text.RegularExpressions.Match.Empty) { 521 System.Text.RegularExpressions.Match.Empty)
522 {
511 Console.WriteLine("Including file: " + ((FileInfo)item).FullName); 523 Console.WriteLine("Including file: " + ((FileInfo)item).FullName);
512 524
513 using (FileStream fs = new FileStream(((FileInfo)item).FullName, 525 using (FileStream fs = new FileStream(((FileInfo)item).FullName,
514 FileMode.Open, 526 FileMode.Open,
515 FileAccess.Read, 527 FileAccess.Read,
516 FileShare.None)) 528 FileShare.None))
517 { 529 {
518 using (StreamReader sr = new StreamReader(fs)) 530 using (StreamReader sr = new StreamReader(fs))
519 { 531 {
520 ss.WriteLine("<!-- included from {0} -->", ((FileInfo)item).FullName); 532 ss.WriteLine("<!-- included from {0} -->", ((FileInfo)item).FullName);
521 while (sr.Peek() != -1) { 533 while (sr.Peek() != -1)
534 {
522 ss.WriteLine(sr.ReadLine()); 535 ss.WriteLine(sr.ReadLine());
523 } 536 }
524 ss.WriteLine(); 537 ss.WriteLine();
@@ -527,45 +540,46 @@ public class NAntTarget : ITarget
527 } 540 }
528 } 541 }
529 } 542 }
530 } catch {} 543 }
544 catch { }
531 // ss.WriteLine(" <include buildfile=\".nant/local.include\" />"); 545 // ss.WriteLine(" <include buildfile=\".nant/local.include\" />");
532// ss.WriteLine(" <target name=\"zip\" description=\"\">"); 546 // ss.WriteLine(" <target name=\"zip\" description=\"\">");
533// ss.WriteLine(" <zip zipfile=\"{0}-{1}.zip\">", solution.Name, solution.Version); 547 // ss.WriteLine(" <zip zipfile=\"{0}-{1}.zip\">", solution.Name, solution.Version);
534// ss.WriteLine(" <fileset basedir=\"${project::get-base-directory()}\">"); 548 // ss.WriteLine(" <fileset basedir=\"${project::get-base-directory()}\">");
535 549
536// ss.WriteLine(" <include name=\"${project::get-base-directory()}/**/*.cs\" />"); 550 // ss.WriteLine(" <include name=\"${project::get-base-directory()}/**/*.cs\" />");
537// // ss.WriteLine(" <include name=\"${project.main.dir}/**/*\" />"); 551 // // ss.WriteLine(" <include name=\"${project.main.dir}/**/*\" />");
538// ss.WriteLine(" </fileset>"); 552 // ss.WriteLine(" </fileset>");
539// ss.WriteLine(" </zip>"); 553 // ss.WriteLine(" </zip>");
540// ss.WriteLine(" <echo message=\"Building zip target\" />"); 554 // ss.WriteLine(" <echo message=\"Building zip target\" />");
541// ss.WriteLine(" </target>"); 555 // ss.WriteLine(" </target>");
542 ss.WriteLine(); 556 ss.WriteLine();
543 557
544 558
545 ss.WriteLine(" <target name=\"clean\" description=\"\">"); 559 ss.WriteLine(" <target name=\"clean\" description=\"\">");
546 ss.WriteLine(" <echo message=\"Deleting all builds from all configurations\" />"); 560 ss.WriteLine(" <echo message=\"Deleting all builds from all configurations\" />");
547 //ss.WriteLine(" <delete dir=\"${dist.dir}\" failonerror=\"false\" />"); 561 //ss.WriteLine(" <delete dir=\"${dist.dir}\" failonerror=\"false\" />");
548 ss.WriteLine(" <delete dir=\"${bin.dir}\" failonerror=\"false\" />"); 562 ss.WriteLine(" <delete dir=\"${bin.dir}\" failonerror=\"false\" />");
549 ss.WriteLine(" <delete dir=\"${obj.dir}\" failonerror=\"false\" />"); 563 ss.WriteLine(" <delete dir=\"${obj.dir}\" failonerror=\"false\" />");
550 foreach(ProjectNode project in solution.Projects) 564 foreach (ProjectNode project in solution.Projects)
551 { 565 {
552 string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath); 566 string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath);
553 ss.Write(" <nant buildfile=\"{0}\"", 567 ss.Write(" <nant buildfile=\"{0}\"",
554 Helper.NormalizePath(Helper.MakeFilePath(path, project.Name + (project.Type == ProjectType.Library ? ".dll" : ".exe"), "build"),'/')); 568 Helper.NormalizePath(Helper.MakeFilePath(path, project.Name + GetProjectExtension(project), "build"), '/'));
555 ss.WriteLine(" target=\"clean\" />"); 569 ss.WriteLine(" target=\"clean\" />");
556 } 570 }
557 ss.WriteLine(" </target>"); 571 ss.WriteLine(" </target>");
558 ss.WriteLine(); 572 ss.WriteLine();
559 573
560 ss.WriteLine(" <target name=\"build\" depends=\"init\" description=\"\">"); 574 ss.WriteLine(" <target name=\"build\" depends=\"init\" description=\"\">");
561 575
562 foreach(ProjectNode project in solution.ProjectsTableOrder) 576 foreach (ProjectNode project in solution.ProjectsTableOrder)
563 { 577 {
564 string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath); 578 string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath);
565 ss.Write(" <nant buildfile=\"{0}\"", 579 ss.Write(" <nant buildfile=\"{0}\"",
566 Helper.NormalizePath(Helper.MakeFilePath(path, project.Name + (project.Type == ProjectType.Library ? ".dll" : ".exe"), "build"),'/')); 580 Helper.NormalizePath(Helper.MakeFilePath(path, project.Name + GetProjectExtension(project), "build"), '/'));
567 ss.WriteLine(" target=\"build\" />"); 581 ss.WriteLine(" target=\"build\" />");
568 } 582 }
569 ss.WriteLine(" </target>"); 583 ss.WriteLine(" </target>");
570 ss.WriteLine(); 584 ss.WriteLine();
571 585
@@ -580,94 +594,94 @@ public class NAntTarget : ITarget
580 ss.WriteLine(" <target name=\"doc\" depends=\"build-release\">"); 594 ss.WriteLine(" <target name=\"doc\" depends=\"build-release\">");
581 ss.WriteLine(" <echo message=\"Generating all documentation from all builds\" />"); 595 ss.WriteLine(" <echo message=\"Generating all documentation from all builds\" />");
582 foreach (ProjectNode project in solution.Projects) 596 foreach (ProjectNode project in solution.Projects)
583 { 597 {
584 string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath); 598 string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath);
585 ss.Write(" <nant buildfile=\"{0}\"", 599 ss.Write(" <nant buildfile=\"{0}\"",
586 Helper.NormalizePath(Helper.MakeFilePath(path, project.Name + (project.Type == ProjectType.Library ? ".dll" : ".exe"), "build"), '/')); 600 Helper.NormalizePath(Helper.MakeFilePath(path, project.Name + GetProjectExtension(project), "build"), '/'));
587 ss.WriteLine(" target=\"doc\" />"); 601 ss.WriteLine(" target=\"doc\" />");
588 } 602 }
589 ss.WriteLine(" </target>"); 603 ss.WriteLine(" </target>");
590 ss.WriteLine(); 604 ss.WriteLine();
591 ss.WriteLine("</project>"); 605 ss.WriteLine("</project>");
592 } 606 }
593 607
594 m_Kernel.CurrentWorkingDirectory.Pop(); 608 m_Kernel.CurrentWorkingDirectory.Pop();
595 } 609 }
596 610
597 private void CleanProject(ProjectNode project) 611 private void CleanProject(ProjectNode project)
598 { 612 {
599 m_Kernel.Log.Write("...Cleaning project: {0}", project.Name); 613 m_Kernel.Log.Write("...Cleaning project: {0}", project.Name);
600 string projectFile = Helper.MakeFilePath(project.FullPath, project.Name + (project.Type == ProjectType.Library ? ".dll" : ".exe"), "build"); 614 string projectFile = Helper.MakeFilePath(project.FullPath, project.Name + GetProjectExtension(project), "build");
601 Helper.DeleteIfExists(projectFile); 615 Helper.DeleteIfExists(projectFile);
602 } 616 }
603 617
604 private void CleanSolution(SolutionNode solution) 618 private void CleanSolution(SolutionNode solution)
605 { 619 {
606 m_Kernel.Log.Write("Cleaning NAnt build files for", solution.Name); 620 m_Kernel.Log.Write("Cleaning NAnt build files for", solution.Name);
607 621
608 string slnFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "build"); 622 string slnFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "build");
609 Helper.DeleteIfExists(slnFile); 623 Helper.DeleteIfExists(slnFile);
610 624
611 foreach(ProjectNode project in solution.Projects) 625 foreach (ProjectNode project in solution.Projects)
612 { 626 {
613 CleanProject(project); 627 CleanProject(project);
614 } 628 }
615
616 m_Kernel.Log.Write("");
617 }
618 629
619#endregion 630 m_Kernel.Log.Write("");
631 }
620 632
621#region ITarget Members 633 #endregion
622 634
623 /// <summary> 635 #region ITarget Members
624 /// Writes the specified kern. 636
625 /// </summary> 637 /// <summary>
626 /// <param name="kern">The kern.</param> 638 /// Writes the specified kern.
627 public void Write(Kernel kern) 639 /// </summary>
628 { 640 /// <param name="kern">The kern.</param>
629 if( kern == null ) 641 public void Write(Kernel kern)
642 {
643 if (kern == null)
630 { 644 {
631 throw new ArgumentNullException("kern"); 645 throw new ArgumentNullException("kern");
632 } 646 }
633 m_Kernel = kern; 647 m_Kernel = kern;
634 foreach(SolutionNode solution in kern.Solutions) 648 foreach (SolutionNode solution in kern.Solutions)
635 { 649 {
636 WriteCombine(solution); 650 WriteCombine(solution);
637 } 651 }
638 m_Kernel = null; 652 m_Kernel = null;
639 } 653 }
640 654
641 /// <summary> 655 /// <summary>
642 /// Cleans the specified kern. 656 /// Cleans the specified kern.
643 /// </summary> 657 /// </summary>
644 /// <param name="kern">The kern.</param> 658 /// <param name="kern">The kern.</param>
645 public virtual void Clean(Kernel kern) 659 public virtual void Clean(Kernel kern)
646 { 660 {
647 if( kern == null ) 661 if (kern == null)
648 { 662 {
649 throw new ArgumentNullException("kern"); 663 throw new ArgumentNullException("kern");
650 } 664 }
651 m_Kernel = kern; 665 m_Kernel = kern;
652 foreach(SolutionNode sol in kern.Solutions) 666 foreach (SolutionNode sol in kern.Solutions)
653 { 667 {
654 CleanSolution(sol); 668 CleanSolution(sol);
655 } 669 }
656 m_Kernel = null; 670 m_Kernel = null;
657 } 671 }
658 672
659 /// <summary> 673 /// <summary>
660 /// Gets the name. 674 /// Gets the name.
661 /// </summary> 675 /// </summary>
662 /// <value>The name.</value> 676 /// <value>The name.</value>
663 public string Name 677 public string Name
664 { 678 {
665 get 679 get
666 { 680 {
667 return "nant"; 681 return "nant";
668 } 682 }
669 } 683 }
670 684
671#endregion 685 #endregion
672} 686 }
673} 687}