aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Prebuild/src/Core/Targets/NAntTarget.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Prebuild/src/Core/Targets/NAntTarget.cs')
-rw-r--r--Prebuild/src/Core/Targets/NAntTarget.cs1242
1 files changed, 621 insertions, 621 deletions
diff --git a/Prebuild/src/Core/Targets/NAntTarget.cs b/Prebuild/src/Core/Targets/NAntTarget.cs
index 0f0deb2..4669cfd 100644
--- a/Prebuild/src/Core/Targets/NAntTarget.cs
+++ b/Prebuild/src/Core/Targets/NAntTarget.cs
@@ -1,621 +1,621 @@
1#region BSD License 1#region BSD License
2/* 2/*
3Copyright (c) 2004 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) 3Copyright (c) 2004 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com)
4 4
5Redistribution and use in source and binary forms, with or without modification, are permitted 5Redistribution and use in source and binary forms, with or without modification, are permitted
6provided that the following conditions are met: 6provided that the following conditions are met:
7 7
8* Redistributions of source code must retain the above copyright notice, this list of conditions 8* Redistributions of source code must retain the above copyright notice, this list of conditions
9 and the following disclaimer. 9 and the following disclaimer.
10* Redistributions in binary form must reproduce the above copyright notice, this list of conditions 10* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
11 and the following disclaimer in the documentation and/or other materials provided with the 11 and the following disclaimer in the documentation and/or other materials provided with the
12 distribution. 12 distribution.
13* The name of the author may not be used to endorse or promote products derived from this software 13* The name of the author may not be used to endorse or promote products derived from this software
14 without specific prior written permission. 14 without specific prior written permission.
15 15
16THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, 16THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
17BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 18ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
19EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 19EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 20OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 21OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
22IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 22IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23*/ 23*/
24#endregion 24#endregion
25 25
26#region CVS Information 26#region CVS Information
27/* 27/*
28 * $Source$ 28 * $Source$
29 * $Author: jendave $ 29 * $Author: jendave $
30 * $Date: 2007-02-13 21:58:03 +0100 (ti, 13 feb 2007) $ 30 * $Date: 2007-02-13 21:58:03 +0100 (ti, 13 feb 2007) $
31 * $Revision: 205 $ 31 * $Revision: 205 $
32 */ 32 */
33#endregion 33#endregion
34 34
35using System; 35using System;
36using System.Collections; 36using System.Collections;
37using System.Collections.Specialized; 37using System.Collections.Specialized;
38using System.IO; 38using System.IO;
39using System.Reflection; 39using System.Reflection;
40using System.Text.RegularExpressions; 40using System.Text.RegularExpressions;
41 41
42using Prebuild.Core.Attributes; 42using Prebuild.Core.Attributes;
43using Prebuild.Core.Interfaces; 43using Prebuild.Core.Interfaces;
44using Prebuild.Core.Nodes; 44using Prebuild.Core.Nodes;
45using Prebuild.Core.Utilities; 45using Prebuild.Core.Utilities;
46 46
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")]
53 public class NAntTarget : ITarget 53 public class NAntTarget : ITarget
54 { 54 {
55 #region Fields 55 #region Fields
56 56
57 private Kernel m_Kernel; 57 private Kernel m_Kernel;
58 58
59 #endregion 59 #endregion
60 60
61 #region Private Methods 61 #region Private Methods
62 62
63 private static string PrependPath(string path) 63 private static string PrependPath(string path)
64 { 64 {
65 string tmpPath = Helper.NormalizePath(path, '/'); 65 string tmpPath = Helper.NormalizePath(path, '/');
66 Regex regex = new Regex(@"(\w):/(\w+)"); 66 Regex regex = new Regex(@"(\w):/(\w+)");
67 Match match = regex.Match(tmpPath); 67 Match match = regex.Match(tmpPath);
68 //if(match.Success || tmpPath[0] == '.' || tmpPath[0] == '/') 68 //if(match.Success || tmpPath[0] == '.' || tmpPath[0] == '/')
69 //{ 69 //{
70 tmpPath = Helper.NormalizePath(tmpPath); 70 tmpPath = Helper.NormalizePath(tmpPath);
71 //} 71 //}
72// else 72// else
73// { 73// {
74// tmpPath = Helper.NormalizePath("./" + tmpPath); 74// tmpPath = Helper.NormalizePath("./" + tmpPath);
75// } 75// }
76 76
77 return tmpPath; 77 return tmpPath;
78 } 78 }
79 79
80 private static string BuildReference(SolutionNode solution, ProjectNode currentProject, ReferenceNode refr) 80 private static string BuildReference(SolutionNode solution, ProjectNode currentProject, ReferenceNode refr)
81 { 81 {
82 string ret = ""; 82 string ret = "";
83 if(solution.ProjectsTable.ContainsKey(refr.Name)) 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 + ".dll", '/');
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 + ".dll", '/') : 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 + ".dll");
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 + ".dll";
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 BuildReferencePath(SolutionNode solution, ReferenceNode refr)
125 { 125 {
126 string ret = ""; 126 string ret = "";
127 if(solution.ProjectsTable.ContainsKey(refr.Name)) 127 if(solution.ProjectsTable.ContainsKey(refr.Name))
128 { 128 {
129 ProjectNode project = (ProjectNode)solution.ProjectsTable[refr.Name]; 129 ProjectNode project = (ProjectNode)solution.ProjectsTable[refr.Name];
130 string finalPath = Helper.NormalizePath(((ReferencePathNode)project.ReferencePaths[0]).Path, '/'); 130 string finalPath = Helper.NormalizePath(((ReferencePathNode)project.ReferencePaths[0]).Path, '/');
131 131
132 return finalPath; 132 return finalPath;
133 } 133 }
134 else 134 else
135 { 135 {
136 ProjectNode project = (ProjectNode)refr.Parent; 136 ProjectNode project = (ProjectNode)refr.Parent;
137 string fileRef = FindFileReference(refr.Name, project); 137 string fileRef = FindFileReference(refr.Name, project);
138 138
139 if(refr.Path != null || fileRef != null) 139 if(refr.Path != null || fileRef != null)
140 { 140 {
141 string finalPath = (refr.Path != null) ? Helper.NormalizePath(refr.Path, '/') : fileRef; 141 string finalPath = (refr.Path != null) ? Helper.NormalizePath(refr.Path, '/') : fileRef;
142 ret += finalPath; 142 ret += finalPath;
143 return ret; 143 return ret;
144 } 144 }
145 145
146 try 146 try
147 { 147 {
148 Assembly assem = Assembly.Load(refr.Name); 148 Assembly assem = Assembly.Load(refr.Name);
149 if (assem != null) 149 if (assem != null)
150 { 150 {
151 ret += ""; 151 ret += "";
152 } 152 }
153 else 153 else
154 { 154 {
155 ret += ""; 155 ret += "";
156 } 156 }
157 } 157 }
158 catch (System.NullReferenceException e) 158 catch (System.NullReferenceException e)
159 { 159 {
160 e.ToString(); 160 e.ToString();
161 ret += ""; 161 ret += "";
162 } 162 }
163 } 163 }
164 return ret; 164 return ret;
165 } 165 }
166 166
167 private static string FindFileReference(string refName, ProjectNode project) 167 private static string FindFileReference(string refName, ProjectNode project)
168 { 168 {
169 foreach(ReferencePathNode refPath in project.ReferencePaths) 169 foreach(ReferencePathNode refPath in project.ReferencePaths)
170 { 170 {
171 string fullPath = Helper.MakeFilePath(refPath.Path, refName, "dll"); 171 string fullPath = Helper.MakeFilePath(refPath.Path, refName, "dll");
172 172
173 if(File.Exists(fullPath)) 173 if(File.Exists(fullPath))
174 { 174 {
175 return fullPath; 175 return fullPath;
176 } 176 }
177 } 177 }
178 178
179 return null; 179 return null;
180 } 180 }
181 181
182 /// <summary> 182 /// <summary>
183 /// Gets the XML doc file. 183 /// Gets the XML doc file.
184 /// </summary> 184 /// </summary>
185 /// <param name="project">The project.</param> 185 /// <param name="project">The project.</param>
186 /// <param name="conf">The conf.</param> 186 /// <param name="conf">The conf.</param>
187 /// <returns></returns> 187 /// <returns></returns>
188 public static string GetXmlDocFile(ProjectNode project, ConfigurationNode conf) 188 public static string GetXmlDocFile(ProjectNode project, ConfigurationNode conf)
189 { 189 {
190 if( conf == null ) 190 if( conf == null )
191 { 191 {
192 throw new ArgumentNullException("conf"); 192 throw new ArgumentNullException("conf");
193 } 193 }
194 if( project == null ) 194 if( project == null )
195 { 195 {
196 throw new ArgumentNullException("project"); 196 throw new ArgumentNullException("project");
197 } 197 }
198 string docFile = (string)conf.Options["XmlDocFile"]; 198 string docFile = (string)conf.Options["XmlDocFile"];
199 // if(docFile != null && docFile.Length == 0)//default to assembly name if not specified 199 // if(docFile != null && docFile.Length == 0)//default to assembly name if not specified
200 // { 200 // {
201 // return Path.GetFileNameWithoutExtension(project.AssemblyName) + ".xml"; 201 // return Path.GetFileNameWithoutExtension(project.AssemblyName) + ".xml";
202 // } 202 // }
203 return docFile; 203 return docFile;
204 } 204 }
205 205
206 private void WriteProject(SolutionNode solution, ProjectNode project) 206 private void WriteProject(SolutionNode solution, ProjectNode project)
207 { 207 {
208 string projFile = Helper.MakeFilePath(project.FullPath, project.Name + (project.Type == ProjectType.Library ? ".dll" : ".exe"), "build"); 208 string projFile = Helper.MakeFilePath(project.FullPath, project.Name + (project.Type == ProjectType.Library ? ".dll" : ".exe"), "build");
209 StreamWriter ss = new StreamWriter(projFile); 209 StreamWriter ss = new StreamWriter(projFile);
210 210
211 m_Kernel.CurrentWorkingDirectory.Push(); 211 m_Kernel.CurrentWorkingDirectory.Push();
212 Helper.SetCurrentDir(Path.GetDirectoryName(projFile)); 212 Helper.SetCurrentDir(Path.GetDirectoryName(projFile));
213 bool hasDoc = false; 213 bool hasDoc = false;
214 214
215 using(ss) 215 using(ss)
216 { 216 {
217 ss.WriteLine("<?xml version=\"1.0\" ?>"); 217 ss.WriteLine("<?xml version=\"1.0\" ?>");
218 ss.WriteLine("<project name=\"{0}\" default=\"build\">", project.Name); 218 ss.WriteLine("<project name=\"{0}\" default=\"build\">", project.Name);
219 ss.WriteLine(" <target name=\"{0}\">", "build"); 219 ss.WriteLine(" <target name=\"{0}\">", "build");
220 ss.WriteLine(" <echo message=\"Build Directory is ${project::get-base-directory()}/${build.dir}\" />"); 220 ss.WriteLine(" <echo message=\"Build Directory is ${project::get-base-directory()}/${build.dir}\" />");
221 ss.WriteLine(" <mkdir dir=\"${project::get-base-directory()}/${build.dir}\" />"); 221 ss.WriteLine(" <mkdir dir=\"${project::get-base-directory()}/${build.dir}\" />");
222 ss.WriteLine(" <copy todir=\"${project::get-base-directory()}/${build.dir}\">"); 222 ss.WriteLine(" <copy todir=\"${project::get-base-directory()}/${build.dir}\">");
223 ss.WriteLine(" <fileset basedir=\"${project::get-base-directory()}\">"); 223 ss.WriteLine(" <fileset basedir=\"${project::get-base-directory()}\">");
224 foreach(ReferenceNode refr in project.References) 224 foreach(ReferenceNode refr in project.References)
225 { 225 {
226 if (refr.LocalCopy) 226 if (refr.LocalCopy)
227 { 227 {
228 ss.WriteLine(" <include name=\"{0}", Helper.NormalizePath(Helper.MakePathRelativeTo(project.FullPath, BuildReference(solution, project, refr))+"\" />", '/')); 228 ss.WriteLine(" <include name=\"{0}", Helper.NormalizePath(Helper.MakePathRelativeTo(project.FullPath, BuildReference(solution, project, refr))+"\" />", '/'));
229 } 229 }
230 } 230 }
231 ss.WriteLine(" </fileset>"); 231 ss.WriteLine(" </fileset>");
232 ss.WriteLine(" </copy>"); 232 ss.WriteLine(" </copy>");
233 ss.Write(" <csc"); 233 ss.Write(" <csc");
234 ss.Write(" target=\"{0}\"", project.Type.ToString().ToLower()); 234 ss.Write(" target=\"{0}\"", project.Type.ToString().ToLower());
235 ss.Write(" debug=\"{0}\"", "${build.debug}"); 235 ss.Write(" debug=\"{0}\"", "${build.debug}");
236 foreach(ConfigurationNode conf in project.Configurations) 236 foreach(ConfigurationNode conf in project.Configurations)
237 { 237 {
238 if (conf.Options.KeyFile !="") 238 if (conf.Options.KeyFile !="")
239 { 239 {
240 ss.Write(" keyfile=\"{0}\"", conf.Options.KeyFile); 240 ss.Write(" keyfile=\"{0}\"", conf.Options.KeyFile);
241 break; 241 break;
242 } 242 }
243 } 243 }
244 foreach(ConfigurationNode conf in project.Configurations) 244 foreach(ConfigurationNode conf in project.Configurations)
245 { 245 {
246 ss.Write(" unsafe=\"{0}\"", conf.Options.AllowUnsafe); 246 ss.Write(" unsafe=\"{0}\"", conf.Options.AllowUnsafe);
247 break; 247 break;
248 } 248 }
249 foreach(ConfigurationNode conf in project.Configurations) 249 foreach(ConfigurationNode conf in project.Configurations)
250 { 250 {
251 ss.Write(" define=\"{0}\"", conf.Options.CompilerDefines); 251 ss.Write(" define=\"{0}\"", conf.Options.CompilerDefines);
252 break; 252 break;
253 } 253 }
254 foreach(ConfigurationNode conf in project.Configurations) 254 foreach(ConfigurationNode conf in project.Configurations)
255 { 255 {
256 if (GetXmlDocFile(project, conf) !="") 256 if (GetXmlDocFile(project, conf) !="")
257 { 257 {
258 ss.Write(" doc=\"{0}\"", "${project::get-base-directory()}/${build.dir}/" + GetXmlDocFile(project, conf)); 258 ss.Write(" doc=\"{0}\"", "${project::get-base-directory()}/${build.dir}/" + GetXmlDocFile(project, conf));
259 hasDoc = true; 259 hasDoc = true;
260 } 260 }
261 break; 261 break;
262 } 262 }
263 ss.Write(" output=\"{0}", "${project::get-base-directory()}/${build.dir}/${project::get-name()}"); 263 ss.Write(" output=\"{0}", "${project::get-base-directory()}/${build.dir}/${project::get-name()}");
264 if (project.Type == ProjectType.Library) 264 if (project.Type == ProjectType.Library)
265 { 265 {
266 ss.Write(".dll\""); 266 ss.Write(".dll\"");
267 } 267 }
268 else 268 else
269 { 269 {
270 ss.Write(".exe\""); 270 ss.Write(".exe\"");
271 } 271 }
272 if(project.AppIcon != null && project.AppIcon.Length != 0) 272 if(project.AppIcon != null && project.AppIcon.Length != 0)
273 { 273 {
274 ss.Write(" win32icon=\"{0}\"", Helper.NormalizePath(project.AppIcon,'/')); 274 ss.Write(" win32icon=\"{0}\"", Helper.NormalizePath(project.AppIcon,'/'));
275 } 275 }
276 ss.WriteLine(">"); 276 ss.WriteLine(">");
277 ss.WriteLine(" <resources prefix=\"{0}\" dynamicprefix=\"true\" >", project.RootNamespace); 277 ss.WriteLine(" <resources prefix=\"{0}\" dynamicprefix=\"true\" >", project.RootNamespace);
278 foreach (string file in project.Files) 278 foreach (string file in project.Files)
279 { 279 {
280 switch (project.Files.GetBuildAction(file)) 280 switch (project.Files.GetBuildAction(file))
281 { 281 {
282 case BuildAction.EmbeddedResource: 282 case BuildAction.EmbeddedResource:
283 ss.WriteLine(" {0}", "<include name=\"" + Helper.NormalizePath(PrependPath(file), '/') + "\" />"); 283 ss.WriteLine(" {0}", "<include name=\"" + Helper.NormalizePath(PrependPath(file), '/') + "\" />");
284 break; 284 break;
285 default: 285 default:
286 if (project.Files.GetSubType(file) != SubType.Code && project.Files.GetSubType(file) != SubType.Settings) 286 if (project.Files.GetSubType(file) != SubType.Code && project.Files.GetSubType(file) != SubType.Settings)
287 { 287 {
288 ss.WriteLine(" <include name=\"{0}\" />", file.Substring(0, file.LastIndexOf('.')) + ".resx"); 288 ss.WriteLine(" <include name=\"{0}\" />", file.Substring(0, file.LastIndexOf('.')) + ".resx");
289 } 289 }
290 break; 290 break;
291 } 291 }
292 } 292 }
293 //if (project.Files.GetSubType(file).ToString() != "Code") 293 //if (project.Files.GetSubType(file).ToString() != "Code")
294 //{ 294 //{
295 // ps.WriteLine(" <EmbeddedResource Include=\"{0}\">", file.Substring(0, file.LastIndexOf('.')) + ".resx"); 295 // ps.WriteLine(" <EmbeddedResource Include=\"{0}\">", file.Substring(0, file.LastIndexOf('.')) + ".resx");
296 296
297 ss.WriteLine(" </resources>"); 297 ss.WriteLine(" </resources>");
298 ss.WriteLine(" <sources failonempty=\"true\">"); 298 ss.WriteLine(" <sources failonempty=\"true\">");
299 foreach(string file in project.Files) 299 foreach(string file in project.Files)
300 { 300 {
301 switch(project.Files.GetBuildAction(file)) 301 switch(project.Files.GetBuildAction(file))
302 { 302 {
303 case BuildAction.Compile: 303 case BuildAction.Compile:
304 ss.WriteLine(" <include name=\"" + Helper.NormalizePath(PrependPath(file), '/') + "\" />"); 304 ss.WriteLine(" <include name=\"" + Helper.NormalizePath(PrependPath(file), '/') + "\" />");
305 break; 305 break;
306 default: 306 default:
307 break; 307 break;
308 } 308 }
309 } 309 }
310 ss.WriteLine(" </sources>"); 310 ss.WriteLine(" </sources>");
311 ss.WriteLine(" <references basedir=\"${project::get-base-directory()}\">"); 311 ss.WriteLine(" <references basedir=\"${project::get-base-directory()}\">");
312 ss.WriteLine(" <lib>"); 312 ss.WriteLine(" <lib>");
313 ss.WriteLine(" <include name=\"${project::get-base-directory()}\" />"); 313 ss.WriteLine(" <include name=\"${project::get-base-directory()}\" />");
314 ss.WriteLine(" <include name=\"${project::get-base-directory()}/${build.dir}\" />"); 314 ss.WriteLine(" <include name=\"${project::get-base-directory()}/${build.dir}\" />");
315 ss.WriteLine(" </lib>"); 315 ss.WriteLine(" </lib>");
316 foreach(ReferenceNode refr in project.References) 316 foreach(ReferenceNode refr in project.References)
317 { 317 {
318 string path = Helper.NormalizePath(Helper.MakePathRelativeTo(project.FullPath, BuildReference(solution, project, refr)), '/'); 318 string path = Helper.NormalizePath(Helper.MakePathRelativeTo(project.FullPath, BuildReference(solution, project, refr)), '/');
319 ss.WriteLine(" <include name=\""+ path + "\" />" ); 319 ss.WriteLine(" <include name=\""+ path + "\" />" );
320 } 320 }
321 ss.WriteLine(" </references>"); 321 ss.WriteLine(" </references>");
322 322
323 ss.WriteLine(" </csc>"); 323 ss.WriteLine(" </csc>");
324 324
325 foreach (ConfigurationNode conf in project.Configurations) 325 foreach (ConfigurationNode conf in project.Configurations)
326 { 326 {
327 if (!String.IsNullOrEmpty(conf.Options.OutputPath)) 327 if (!String.IsNullOrEmpty(conf.Options.OutputPath))
328 { 328 {
329 string targetDir = Helper.NormalizePath(conf.Options.OutputPath, '/'); 329 string targetDir = Helper.NormalizePath(conf.Options.OutputPath, '/');
330 330
331 ss.WriteLine(" <echo message=\"Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/" + targetDir + "\" />"); 331 ss.WriteLine(" <echo message=\"Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/" + targetDir + "\" />");
332 332
333 ss.WriteLine(" <mkdir dir=\"${project::get-base-directory()}/" + targetDir + "\"/>"); 333 ss.WriteLine(" <mkdir dir=\"${project::get-base-directory()}/" + targetDir + "\"/>");
334 334
335 ss.WriteLine(" <copy todir=\"${project::get-base-directory()}/" + targetDir + "\">"); 335 ss.WriteLine(" <copy todir=\"${project::get-base-directory()}/" + targetDir + "\">");
336 ss.WriteLine(" <fileset basedir=\"${project::get-base-directory()}/${build.dir}/\" >"); 336 ss.WriteLine(" <fileset basedir=\"${project::get-base-directory()}/${build.dir}/\" >");
337 ss.WriteLine(" <include name=\"*.dll\"/>"); 337 ss.WriteLine(" <include name=\"*.dll\"/>");
338 ss.WriteLine(" <include name=\"*.exe\"/>"); 338 ss.WriteLine(" <include name=\"*.exe\"/>");
339 ss.WriteLine(" </fileset>"); 339 ss.WriteLine(" </fileset>");
340 ss.WriteLine(" </copy>"); 340 ss.WriteLine(" </copy>");
341 break; 341 break;
342 } 342 }
343 } 343 }
344 344
345 ss.WriteLine(" </target>"); 345 ss.WriteLine(" </target>");
346 346
347 ss.WriteLine(" <target name=\"clean\">"); 347 ss.WriteLine(" <target name=\"clean\">");
348 ss.WriteLine(" <delete dir=\"${bin.dir}\" failonerror=\"false\" />"); 348 ss.WriteLine(" <delete dir=\"${bin.dir}\" failonerror=\"false\" />");
349 ss.WriteLine(" <delete dir=\"${obj.dir}\" failonerror=\"false\" />"); 349 ss.WriteLine(" <delete dir=\"${obj.dir}\" failonerror=\"false\" />");
350 ss.WriteLine(" </target>"); 350 ss.WriteLine(" </target>");
351 351
352 ss.WriteLine(" <target name=\"doc\" description=\"Creates documentation.\">"); 352 ss.WriteLine(" <target name=\"doc\" description=\"Creates documentation.\">");
353 if (hasDoc) 353 if (hasDoc)
354 { 354 {
355 ss.WriteLine(" <property name=\"doc.target\" value=\"\" />"); 355 ss.WriteLine(" <property name=\"doc.target\" value=\"\" />");
356 ss.WriteLine(" <if test=\"${platform::is-unix()}\">"); 356 ss.WriteLine(" <if test=\"${platform::is-unix()}\">");
357 ss.WriteLine(" <property name=\"doc.target\" value=\"Web\" />"); 357 ss.WriteLine(" <property name=\"doc.target\" value=\"Web\" />");
358 ss.WriteLine(" </if>"); 358 ss.WriteLine(" </if>");
359 ss.WriteLine(" <ndoc failonerror=\"false\" verbose=\"true\">"); 359 ss.WriteLine(" <ndoc failonerror=\"false\" verbose=\"true\">");
360 ss.WriteLine(" <assemblies basedir=\"${project::get-base-directory()}\">"); 360 ss.WriteLine(" <assemblies basedir=\"${project::get-base-directory()}\">");
361 ss.Write(" <include name=\"${build.dir}/${project::get-name()}"); 361 ss.Write(" <include name=\"${build.dir}/${project::get-name()}");
362 if (project.Type == ProjectType.Library) 362 if (project.Type == ProjectType.Library)
363 { 363 {
364 ss.WriteLine(".dll\" />"); 364 ss.WriteLine(".dll\" />");
365 } 365 }
366 else 366 else
367 { 367 {
368 ss.WriteLine(".exe\" />"); 368 ss.WriteLine(".exe\" />");
369 } 369 }
370 370
371 ss.WriteLine(" </assemblies>"); 371 ss.WriteLine(" </assemblies>");
372 ss.WriteLine(" <summaries basedir=\"${project::get-base-directory()}\">"); 372 ss.WriteLine(" <summaries basedir=\"${project::get-base-directory()}\">");
373 ss.WriteLine(" <include name=\"${build.dir}/${project::get-name()}.xml\"/>"); 373 ss.WriteLine(" <include name=\"${build.dir}/${project::get-name()}.xml\"/>");
374 ss.WriteLine(" </summaries>"); 374 ss.WriteLine(" </summaries>");
375 ss.WriteLine(" <referencepaths basedir=\"${project::get-base-directory()}\">"); 375 ss.WriteLine(" <referencepaths basedir=\"${project::get-base-directory()}\">");
376 ss.WriteLine(" <include name=\"${build.dir}\" />"); 376 ss.WriteLine(" <include name=\"${build.dir}\" />");
377 // foreach(ReferenceNode refr in project.References) 377 // foreach(ReferenceNode refr in project.References)
378 // { 378 // {
379 // string path = Helper.NormalizePath(Helper.MakePathRelativeTo(project.FullPath, BuildReferencePath(solution, refr)), '/'); 379 // string path = Helper.NormalizePath(Helper.MakePathRelativeTo(project.FullPath, BuildReferencePath(solution, refr)), '/');
380 // if (path != "") 380 // if (path != "")
381 // { 381 // {
382 // ss.WriteLine(" <include name=\"{0}\" />", path); 382 // ss.WriteLine(" <include name=\"{0}\" />", path);
383 // } 383 // }
384 // } 384 // }
385 ss.WriteLine(" </referencepaths>"); 385 ss.WriteLine(" </referencepaths>");
386 ss.WriteLine(" <documenters>"); 386 ss.WriteLine(" <documenters>");
387 ss.WriteLine(" <documenter name=\"MSDN\">"); 387 ss.WriteLine(" <documenter name=\"MSDN\">");
388 ss.WriteLine(" <property name=\"OutputDirectory\" value=\"${project::get-base-directory()}/${build.dir}/doc/${project::get-name()}\" />"); 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}\" />"); 389 ss.WriteLine(" <property name=\"OutputTarget\" value=\"${doc.target}\" />");
390 ss.WriteLine(" <property name=\"HtmlHelpName\" value=\"${project::get-name()}\" />"); 390 ss.WriteLine(" <property name=\"HtmlHelpName\" value=\"${project::get-name()}\" />");
391 ss.WriteLine(" <property name=\"IncludeFavorites\" value=\"False\" />"); 391 ss.WriteLine(" <property name=\"IncludeFavorites\" value=\"False\" />");
392 ss.WriteLine(" <property name=\"Title\" value=\"${project::get-name()} SDK Documentation\" />"); 392 ss.WriteLine(" <property name=\"Title\" value=\"${project::get-name()} SDK Documentation\" />");
393 ss.WriteLine(" <property name=\"SplitTOCs\" value=\"False\" />"); 393 ss.WriteLine(" <property name=\"SplitTOCs\" value=\"False\" />");
394 ss.WriteLine(" <property name=\"DefaulTOC\" value=\"\" />"); 394 ss.WriteLine(" <property name=\"DefaulTOC\" value=\"\" />");
395 ss.WriteLine(" <property name=\"ShowVisualBasic\" value=\"True\" />"); 395 ss.WriteLine(" <property name=\"ShowVisualBasic\" value=\"True\" />");
396 ss.WriteLine(" <property name=\"AutoDocumentConstructors\" value=\"True\" />"); 396 ss.WriteLine(" <property name=\"AutoDocumentConstructors\" value=\"True\" />");
397 ss.WriteLine(" <property name=\"ShowMissingSummaries\" value=\"${build.debug}\" />"); 397 ss.WriteLine(" <property name=\"ShowMissingSummaries\" value=\"${build.debug}\" />");
398 ss.WriteLine(" <property name=\"ShowMissingRemarks\" value=\"${build.debug}\" />"); 398 ss.WriteLine(" <property name=\"ShowMissingRemarks\" value=\"${build.debug}\" />");
399 ss.WriteLine(" <property name=\"ShowMissingParams\" value=\"${build.debug}\" />"); 399 ss.WriteLine(" <property name=\"ShowMissingParams\" value=\"${build.debug}\" />");
400 ss.WriteLine(" <property name=\"ShowMissingReturns\" value=\"${build.debug}\" />"); 400 ss.WriteLine(" <property name=\"ShowMissingReturns\" value=\"${build.debug}\" />");
401 ss.WriteLine(" <property name=\"ShowMissingValues\" value=\"${build.debug}\" />"); 401 ss.WriteLine(" <property name=\"ShowMissingValues\" value=\"${build.debug}\" />");
402 ss.WriteLine(" <property name=\"DocumentInternals\" value=\"False\" />"); 402 ss.WriteLine(" <property name=\"DocumentInternals\" value=\"False\" />");
403 ss.WriteLine(" <property name=\"DocumentPrivates\" value=\"False\" />"); 403 ss.WriteLine(" <property name=\"DocumentPrivates\" value=\"False\" />");
404 ss.WriteLine(" <property name=\"DocumentProtected\" value=\"True\" />"); 404 ss.WriteLine(" <property name=\"DocumentProtected\" value=\"True\" />");
405 ss.WriteLine(" <property name=\"DocumentEmptyNamespaces\" value=\"${build.debug}\" />"); 405 ss.WriteLine(" <property name=\"DocumentEmptyNamespaces\" value=\"${build.debug}\" />");
406 ss.WriteLine(" <property name=\"IncludeAssemblyVersion\" value=\"True\" />"); 406 ss.WriteLine(" <property name=\"IncludeAssemblyVersion\" value=\"True\" />");
407 ss.WriteLine(" </documenter>"); 407 ss.WriteLine(" </documenter>");
408 ss.WriteLine(" </documenters>"); 408 ss.WriteLine(" </documenters>");
409 ss.WriteLine(" </ndoc>"); 409 ss.WriteLine(" </ndoc>");
410 } 410 }
411 ss.WriteLine(" </target>"); 411 ss.WriteLine(" </target>");
412 ss.WriteLine("</project>"); 412 ss.WriteLine("</project>");
413 } 413 }
414 m_Kernel.CurrentWorkingDirectory.Pop(); 414 m_Kernel.CurrentWorkingDirectory.Pop();
415 } 415 }
416 416
417 private void WriteCombine(SolutionNode solution) 417 private void WriteCombine(SolutionNode solution)
418 { 418 {
419 m_Kernel.Log.Write("Creating NAnt build files"); 419 m_Kernel.Log.Write("Creating NAnt build files");
420 foreach(ProjectNode project in solution.Projects) 420 foreach(ProjectNode project in solution.Projects)
421 { 421 {
422 if(m_Kernel.AllowProject(project.FilterGroups)) 422 if(m_Kernel.AllowProject(project.FilterGroups))
423 { 423 {
424 m_Kernel.Log.Write("...Creating project: {0}", project.Name); 424 m_Kernel.Log.Write("...Creating project: {0}", project.Name);
425 WriteProject(solution, project); 425 WriteProject(solution, project);
426 } 426 }
427 } 427 }
428 428
429 m_Kernel.Log.Write(""); 429 m_Kernel.Log.Write("");
430 string combFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "build"); 430 string combFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "build");
431 StreamWriter ss = new StreamWriter(combFile); 431 StreamWriter ss = new StreamWriter(combFile);
432 432
433 m_Kernel.CurrentWorkingDirectory.Push(); 433 m_Kernel.CurrentWorkingDirectory.Push();
434 Helper.SetCurrentDir(Path.GetDirectoryName(combFile)); 434 Helper.SetCurrentDir(Path.GetDirectoryName(combFile));
435 435
436 using(ss) 436 using(ss)
437 { 437 {
438 ss.WriteLine("<?xml version=\"1.0\" ?>"); 438 ss.WriteLine("<?xml version=\"1.0\" ?>");
439 ss.WriteLine("<project name=\"{0}\" default=\"build\">", solution.Name); 439 ss.WriteLine("<project name=\"{0}\" default=\"build\">", solution.Name);
440 ss.WriteLine(" <echo message=\"Using '${nant.settings.currentframework}' Framework\"/>"); 440 ss.WriteLine(" <echo message=\"Using '${nant.settings.currentframework}' Framework\"/>");
441 ss.WriteLine(); 441 ss.WriteLine();
442 442
443 //ss.WriteLine(" <property name=\"dist.dir\" value=\"dist\" />"); 443 //ss.WriteLine(" <property name=\"dist.dir\" value=\"dist\" />");
444 //ss.WriteLine(" <property name=\"source.dir\" value=\"source\" />"); 444 //ss.WriteLine(" <property name=\"source.dir\" value=\"source\" />");
445 ss.WriteLine(" <property name=\"bin.dir\" value=\"bin\" />"); 445 ss.WriteLine(" <property name=\"bin.dir\" value=\"bin\" />");
446 ss.WriteLine(" <property name=\"obj.dir\" value=\"obj\" />"); 446 ss.WriteLine(" <property name=\"obj.dir\" value=\"obj\" />");
447 ss.WriteLine(" <property name=\"doc.dir\" value=\"doc\" />"); 447 ss.WriteLine(" <property name=\"doc.dir\" value=\"doc\" />");
448 ss.WriteLine(" <property name=\"project.main.dir\" value=\"${project::get-base-directory()}\" />"); 448 ss.WriteLine(" <property name=\"project.main.dir\" value=\"${project::get-base-directory()}\" />");
449 449
450 foreach(ConfigurationNode conf in solution.Configurations) 450 foreach(ConfigurationNode conf in solution.Configurations)
451 { 451 {
452 // Set the project.config to a non-debug configuration 452 // Set the project.config to a non-debug configuration
453 if( conf.Options["DebugInformation"].ToString().ToLower() != "true" ) 453 if( conf.Options["DebugInformation"].ToString().ToLower() != "true" )
454 { 454 {
455 ss.WriteLine(" <property name=\"project.config\" value=\"{0}\" />", conf.Name); 455 ss.WriteLine(" <property name=\"project.config\" value=\"{0}\" />", conf.Name);
456 } 456 }
457 ss.WriteLine(); 457 ss.WriteLine();
458 ss.WriteLine(" <target name=\"{0}\" description=\"\">", conf.Name); 458 ss.WriteLine(" <target name=\"{0}\" description=\"\">", conf.Name);
459 ss.WriteLine(" <property name=\"project.config\" value=\"{0}\" />", 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()); 460 ss.WriteLine(" <property name=\"build.debug\" value=\"{0}\" />", conf.Options["DebugInformation"].ToString().ToLower());
461 ss.WriteLine(" </target>"); 461 ss.WriteLine(" </target>");
462 ss.WriteLine(); 462 ss.WriteLine();
463 } 463 }
464 464
465 ss.WriteLine(" <target name=\"net-1.1\" description=\"Sets framework to .NET 1.1\">"); 465 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\" />"); 466 ss.WriteLine(" <property name=\"nant.settings.currentframework\" value=\"net-1.1\" />");
467 ss.WriteLine(" </target>"); 467 ss.WriteLine(" </target>");
468 ss.WriteLine(); 468 ss.WriteLine();
469 469
470 ss.WriteLine(" <target name=\"net-2.0\" description=\"Sets framework to .NET 2.0\">"); 470 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\" />"); 471 ss.WriteLine(" <property name=\"nant.settings.currentframework\" value=\"net-2.0\" />");
472 ss.WriteLine(" </target>"); 472 ss.WriteLine(" </target>");
473 ss.WriteLine(); 473 ss.WriteLine();
474 474
475 ss.WriteLine(" <target name=\"mono-2.0\" description=\"Sets framework to mono 2.0\">"); 475 ss.WriteLine(" <target name=\"mono-2.0\" description=\"Sets framework to mono 2.0\">");
476 ss.WriteLine(" <property name=\"nant.settings.currentframework\" value=\"mono-2.0\" />"); 476 ss.WriteLine(" <property name=\"nant.settings.currentframework\" value=\"mono-2.0\" />");
477 ss.WriteLine(" </target>"); 477 ss.WriteLine(" </target>");
478 ss.WriteLine(); 478 ss.WriteLine();
479 479
480 ss.WriteLine(" <target name=\"mono-1.0\" description=\"Sets framework to mono 1.0\">"); 480 ss.WriteLine(" <target name=\"mono-1.0\" description=\"Sets framework to mono 1.0\">");
481 ss.WriteLine(" <property name=\"nant.settings.currentframework\" value=\"mono-1.0\" />"); 481 ss.WriteLine(" <property name=\"nant.settings.currentframework\" value=\"mono-1.0\" />");
482 ss.WriteLine(" </target>"); 482 ss.WriteLine(" </target>");
483 ss.WriteLine(); 483 ss.WriteLine();
484 484
485 ss.WriteLine(" <target name=\"init\" description=\"\">"); 485 ss.WriteLine(" <target name=\"init\" description=\"\">");
486 ss.WriteLine(" <call target=\"${project.config}\" />"); 486 ss.WriteLine(" <call target=\"${project.config}\" />");
487 ss.WriteLine(" <sysinfo />"); 487 ss.WriteLine(" <sysinfo />");
488 ss.WriteLine(" <echo message=\"Platform ${sys.os.platform}\" />"); 488 ss.WriteLine(" <echo message=\"Platform ${sys.os.platform}\" />");
489 ss.WriteLine(" <property name=\"build.dir\" value=\"${bin.dir}/${project.config}\" />"); 489 ss.WriteLine(" <property name=\"build.dir\" value=\"${bin.dir}/${project.config}\" />");
490 ss.WriteLine(" </target>"); 490 ss.WriteLine(" </target>");
491 ss.WriteLine(); 491 ss.WriteLine();
492 492
493 ss.WriteLine(" <target name=\"clean\" description=\"\">"); 493 ss.WriteLine(" <target name=\"clean\" description=\"\">");
494 ss.WriteLine(" <echo message=\"Deleting all builds from all configurations\" />"); 494 ss.WriteLine(" <echo message=\"Deleting all builds from all configurations\" />");
495 //ss.WriteLine(" <delete dir=\"${dist.dir}\" failonerror=\"false\" />"); 495 //ss.WriteLine(" <delete dir=\"${dist.dir}\" failonerror=\"false\" />");
496 ss.WriteLine(" <delete dir=\"${bin.dir}\" failonerror=\"false\" />"); 496 ss.WriteLine(" <delete dir=\"${bin.dir}\" failonerror=\"false\" />");
497 ss.WriteLine(" <delete dir=\"${obj.dir}\" failonerror=\"false\" />"); 497 ss.WriteLine(" <delete dir=\"${obj.dir}\" failonerror=\"false\" />");
498 foreach(ProjectNode project in solution.Projects) 498 foreach(ProjectNode project in solution.Projects)
499 { 499 {
500 string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath); 500 string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath);
501 ss.Write(" <nant buildfile=\"{0}\"", 501 ss.Write(" <nant buildfile=\"{0}\"",
502 Helper.NormalizePath(Helper.MakeFilePath(path, project.Name + (project.Type == ProjectType.Library ? ".dll" : ".exe"), "build"),'/')); 502 Helper.NormalizePath(Helper.MakeFilePath(path, project.Name + (project.Type == ProjectType.Library ? ".dll" : ".exe"), "build"),'/'));
503 ss.WriteLine(" target=\"clean\" />"); 503 ss.WriteLine(" target=\"clean\" />");
504 } 504 }
505 ss.WriteLine(" </target>"); 505 ss.WriteLine(" </target>");
506 ss.WriteLine(); 506 ss.WriteLine();
507 507
508 ss.WriteLine(" <target name=\"build\" depends=\"init\" description=\"\">"); 508 ss.WriteLine(" <target name=\"build\" depends=\"init\" description=\"\">");
509 509
510 foreach(ProjectNode project in solution.ProjectsTableOrder) 510 foreach(ProjectNode project in solution.ProjectsTableOrder)
511 { 511 {
512 string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath); 512 string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath);
513 ss.Write(" <nant buildfile=\"{0}\"", 513 ss.Write(" <nant buildfile=\"{0}\"",
514 Helper.NormalizePath(Helper.MakeFilePath(path, project.Name + (project.Type == ProjectType.Library ? ".dll" : ".exe"), "build"),'/')); 514 Helper.NormalizePath(Helper.MakeFilePath(path, project.Name + (project.Type == ProjectType.Library ? ".dll" : ".exe"), "build"),'/'));
515 ss.WriteLine(" target=\"build\" />"); 515 ss.WriteLine(" target=\"build\" />");
516 } 516 }
517 ss.WriteLine(" </target>"); 517 ss.WriteLine(" </target>");
518 ss.WriteLine(); 518 ss.WriteLine();
519 519
520 ss.WriteLine(" <target name=\"build-release\" depends=\"Release, init, build\" description=\"Builds in Release mode\" />"); 520 ss.WriteLine(" <target name=\"build-release\" depends=\"Release, init, build\" description=\"Builds in Release mode\" />");
521 ss.WriteLine(); 521 ss.WriteLine();
522 ss.WriteLine(" <target name=\"build-debug\" depends=\"Debug, init, build\" description=\"Builds in Debug mode\" />"); 522 ss.WriteLine(" <target name=\"build-debug\" depends=\"Debug, init, build\" description=\"Builds in Debug mode\" />");
523 ss.WriteLine(); 523 ss.WriteLine();
524 //ss.WriteLine(" <target name=\"package\" depends=\"clean, doc, copyfiles, zip\" description=\"Builds in Release mode\" />"); 524 //ss.WriteLine(" <target name=\"package\" depends=\"clean, doc, copyfiles, zip\" description=\"Builds in Release mode\" />");
525 ss.WriteLine(" <target name=\"package\" depends=\"clean, doc\" description=\"Builds all\" />"); 525 ss.WriteLine(" <target name=\"package\" depends=\"clean, doc\" description=\"Builds all\" />");
526 ss.WriteLine(); 526 ss.WriteLine();
527 527
528 ss.WriteLine(" <target name=\"doc\" depends=\"build-release\">"); 528 ss.WriteLine(" <target name=\"doc\" depends=\"build-release\">");
529 ss.WriteLine(" <echo message=\"Generating all documentation from all builds\" />"); 529 ss.WriteLine(" <echo message=\"Generating all documentation from all builds\" />");
530 foreach (ProjectNode project in solution.Projects) 530 foreach (ProjectNode project in solution.Projects)
531 { 531 {
532 string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath); 532 string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath);
533 ss.Write(" <nant buildfile=\"{0}\"", 533 ss.Write(" <nant buildfile=\"{0}\"",
534 Helper.NormalizePath(Helper.MakeFilePath(path, project.Name + (project.Type == ProjectType.Library ? ".dll" : ".exe"), "build"), '/')); 534 Helper.NormalizePath(Helper.MakeFilePath(path, project.Name + (project.Type == ProjectType.Library ? ".dll" : ".exe"), "build"), '/'));
535 ss.WriteLine(" target=\"doc\" />"); 535 ss.WriteLine(" target=\"doc\" />");
536 } 536 }
537 ss.WriteLine(" </target>"); 537 ss.WriteLine(" </target>");
538 ss.WriteLine(); 538 ss.WriteLine();
539 ss.WriteLine("</project>"); 539 ss.WriteLine("</project>");
540 } 540 }
541 541
542 m_Kernel.CurrentWorkingDirectory.Pop(); 542 m_Kernel.CurrentWorkingDirectory.Pop();
543 } 543 }
544 544
545 private void CleanProject(ProjectNode project) 545 private void CleanProject(ProjectNode project)
546 { 546 {
547 m_Kernel.Log.Write("...Cleaning project: {0}", project.Name); 547 m_Kernel.Log.Write("...Cleaning project: {0}", project.Name);
548 string projectFile = Helper.MakeFilePath(project.FullPath, project.Name + (project.Type == ProjectType.Library ? ".dll" : ".exe"), "build"); 548 string projectFile = Helper.MakeFilePath(project.FullPath, project.Name + (project.Type == ProjectType.Library ? ".dll" : ".exe"), "build");
549 Helper.DeleteIfExists(projectFile); 549 Helper.DeleteIfExists(projectFile);
550 } 550 }
551 551
552 private void CleanSolution(SolutionNode solution) 552 private void CleanSolution(SolutionNode solution)
553 { 553 {
554 m_Kernel.Log.Write("Cleaning NAnt build files for", solution.Name); 554 m_Kernel.Log.Write("Cleaning NAnt build files for", solution.Name);
555 555
556 string slnFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "build"); 556 string slnFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "build");
557 Helper.DeleteIfExists(slnFile); 557 Helper.DeleteIfExists(slnFile);
558 558
559 foreach(ProjectNode project in solution.Projects) 559 foreach(ProjectNode project in solution.Projects)
560 { 560 {
561 CleanProject(project); 561 CleanProject(project);
562 } 562 }
563 563
564 m_Kernel.Log.Write(""); 564 m_Kernel.Log.Write("");
565 } 565 }
566 566
567 #endregion 567 #endregion
568 568
569 #region ITarget Members 569 #region ITarget Members
570 570
571 /// <summary> 571 /// <summary>
572 /// Writes the specified kern. 572 /// Writes the specified kern.
573 /// </summary> 573 /// </summary>
574 /// <param name="kern">The kern.</param> 574 /// <param name="kern">The kern.</param>
575 public void Write(Kernel kern) 575 public void Write(Kernel kern)
576 { 576 {
577 if( kern == null ) 577 if( kern == null )
578 { 578 {
579 throw new ArgumentNullException("kern"); 579 throw new ArgumentNullException("kern");
580 } 580 }
581 m_Kernel = kern; 581 m_Kernel = kern;
582 foreach(SolutionNode solution in kern.Solutions) 582 foreach(SolutionNode solution in kern.Solutions)
583 { 583 {
584 WriteCombine(solution); 584 WriteCombine(solution);
585 } 585 }
586 m_Kernel = null; 586 m_Kernel = null;
587 } 587 }
588 588
589 /// <summary> 589 /// <summary>
590 /// Cleans the specified kern. 590 /// Cleans the specified kern.
591 /// </summary> 591 /// </summary>
592 /// <param name="kern">The kern.</param> 592 /// <param name="kern">The kern.</param>
593 public virtual void Clean(Kernel kern) 593 public virtual void Clean(Kernel kern)
594 { 594 {
595 if( kern == null ) 595 if( kern == null )
596 { 596 {
597 throw new ArgumentNullException("kern"); 597 throw new ArgumentNullException("kern");
598 } 598 }
599 m_Kernel = kern; 599 m_Kernel = kern;
600 foreach(SolutionNode sol in kern.Solutions) 600 foreach(SolutionNode sol in kern.Solutions)
601 { 601 {
602 CleanSolution(sol); 602 CleanSolution(sol);
603 } 603 }
604 m_Kernel = null; 604 m_Kernel = null;
605 } 605 }
606 606
607 /// <summary> 607 /// <summary>
608 /// Gets the name. 608 /// Gets the name.
609 /// </summary> 609 /// </summary>
610 /// <value>The name.</value> 610 /// <value>The name.</value>
611 public string Name 611 public string Name
612 { 612 {
613 get 613 get
614 { 614 {
615 return "nant"; 615 return "nant";
616 } 616 }
617 } 617 }
618 618
619 #endregion 619 #endregion
620 } 620 }
621} 621}