diff options
Diffstat (limited to 'Prebuild/src/Core/Targets/NAntTarget.cs')
-rw-r--r-- | Prebuild/src/Core/Targets/NAntTarget.cs | 710 |
1 files changed, 355 insertions, 355 deletions
diff --git a/Prebuild/src/Core/Targets/NAntTarget.cs b/Prebuild/src/Core/Targets/NAntTarget.cs index 9a86767..21bc80e 100644 --- a/Prebuild/src/Core/Targets/NAntTarget.cs +++ b/Prebuild/src/Core/Targets/NAntTarget.cs | |||
@@ -47,36 +47,36 @@ using Prebuild.Core.Utilities; | |||
47 | 47 | ||
48 | namespace Prebuild.Core.Targets | 48 | namespace Prebuild.Core.Targets |
49 | { | 49 | { |
50 | /// <summary> | 50 | /// <summary> |
51 | /// | 51 | /// |
52 | /// </summary> | 52 | /// </summary> |
53 | [Target("nant")] | 53 | [Target("nant")] |
54 | public class NAntTarget : ITarget | 54 | public class NAntTarget : ITarget |
55 | { | 55 | { |
56 | #region Fields | 56 | #region Fields |
57 | 57 | ||
58 | private Kernel m_Kernel; | 58 | private Kernel m_Kernel; |
59 | 59 | ||
60 | #endregion | 60 | #endregion |
61 | 61 | ||
62 | #region Private Methods | 62 | #region Private Methods |
63 | 63 | ||
64 | private static string PrependPath(string path) | 64 | private static string PrependPath(string path) |
65 | { | 65 | { |
66 | string tmpPath = Helper.NormalizePath(path, '/'); | 66 | string tmpPath = Helper.NormalizePath(path, '/'); |
67 | Regex regex = new Regex(@"(\w):/(\w+)"); | 67 | Regex regex = new Regex(@"(\w):/(\w+)"); |
68 | Match match = regex.Match(tmpPath); | 68 | Match match = regex.Match(tmpPath); |
69 | //if(match.Success || tmpPath[0] == '.' || tmpPath[0] == '/') | 69 | //if(match.Success || tmpPath[0] == '.' || tmpPath[0] == '/') |
70 | //{ | 70 | //{ |
71 | tmpPath = Helper.NormalizePath(tmpPath); | 71 | tmpPath = Helper.NormalizePath(tmpPath); |
72 | //} | 72 | //} |
73 | // else | 73 | // else |
74 | // { | 74 | // { |
75 | // tmpPath = Helper.NormalizePath("./" + tmpPath); | 75 | // tmpPath = Helper.NormalizePath("./" + tmpPath); |
76 | // } | 76 | // } |
77 | 77 | ||
78 | return tmpPath; | 78 | return tmpPath; |
79 | } | 79 | } |
80 | 80 | ||
81 | private static string BuildReference(SolutionNode solution, ProjectNode currentProject, ReferenceNode refr) | 81 | private static string BuildReference(SolutionNode solution, ProjectNode currentProject, ReferenceNode refr) |
82 | { | 82 | { |
@@ -85,7 +85,7 @@ namespace Prebuild.Core.Targets | |||
85 | { | 85 | { |
86 | return refr.Path; | 86 | return refr.Path; |
87 | } | 87 | } |
88 | 88 | ||
89 | if (solution.ProjectsTable.ContainsKey(refr.Name)) | 89 | if (solution.ProjectsTable.ContainsKey(refr.Name)) |
90 | { | 90 | { |
91 | ProjectNode projectRef = (ProjectNode) solution.ProjectsTable[refr.Name]; | 91 | ProjectNode projectRef = (ProjectNode) solution.ProjectsTable[refr.Name]; |
@@ -113,7 +113,7 @@ namespace Prebuild.Core.Targets | |||
113 | return refr.Name + ".dll"; | 113 | return refr.Name + ".dll"; |
114 | } | 114 | } |
115 | 115 | ||
116 | public static string GetRefFileName(string refName) | 116 | public static string GetRefFileName(string refName) |
117 | { | 117 | { |
118 | if (ExtensionSpecified(refName)) | 118 | if (ExtensionSpecified(refName)) |
119 | { | 119 | { |
@@ -140,11 +140,11 @@ namespace Prebuild.Core.Targets | |||
140 | return extension; | 140 | return extension; |
141 | } | 141 | } |
142 | 142 | ||
143 | private static string FindFileReference(string refName, ProjectNode project) | 143 | private static string FindFileReference(string refName, ProjectNode project) |
144 | { | 144 | { |
145 | foreach (ReferencePathNode refPath in project.ReferencePaths) | 145 | foreach (ReferencePathNode refPath in project.ReferencePaths) |
146 | { | 146 | { |
147 | string fullPath = Helper.MakeFilePath(refPath.Path, refName); | 147 | string fullPath = Helper.MakeFilePath(refPath.Path, refName); |
148 | 148 | ||
149 | if (File.Exists(fullPath)) | 149 | if (File.Exists(fullPath)) |
150 | { | 150 | { |
@@ -153,10 +153,10 @@ namespace Prebuild.Core.Targets | |||
153 | 153 | ||
154 | fullPath = Helper.MakeFilePath(refPath.Path, refName, "dll"); | 154 | fullPath = Helper.MakeFilePath(refPath.Path, refName, "dll"); |
155 | 155 | ||
156 | if (File.Exists(fullPath)) | 156 | if (File.Exists(fullPath)) |
157 | { | 157 | { |
158 | return fullPath; | 158 | return fullPath; |
159 | } | 159 | } |
160 | 160 | ||
161 | fullPath = Helper.MakeFilePath(refPath.Path, refName, "exe"); | 161 | fullPath = Helper.MakeFilePath(refPath.Path, refName, "exe"); |
162 | 162 | ||
@@ -164,162 +164,162 @@ namespace Prebuild.Core.Targets | |||
164 | { | 164 | { |
165 | return fullPath; | 165 | return fullPath; |
166 | } | 166 | } |
167 | } | 167 | } |
168 | 168 | ||
169 | return null; | 169 | return null; |
170 | } | 170 | } |
171 | 171 | ||
172 | /// <summary> | 172 | /// <summary> |
173 | /// Gets the XML doc file. | 173 | /// Gets the XML doc file. |
174 | /// </summary> | 174 | /// </summary> |
175 | /// <param name="project">The project.</param> | 175 | /// <param name="project">The project.</param> |
176 | /// <param name="conf">The conf.</param> | 176 | /// <param name="conf">The conf.</param> |
177 | /// <returns></returns> | 177 | /// <returns></returns> |
178 | public static string GetXmlDocFile(ProjectNode project, ConfigurationNode conf) | 178 | public static string GetXmlDocFile(ProjectNode project, ConfigurationNode conf) |
179 | { | 179 | { |
180 | if (conf == null) | 180 | if (conf == null) |
181 | { | 181 | { |
182 | throw new ArgumentNullException("conf"); | 182 | throw new ArgumentNullException("conf"); |
183 | } | 183 | } |
184 | if (project == null) | 184 | if (project == null) |
185 | { | 185 | { |
186 | throw new ArgumentNullException("project"); | 186 | throw new ArgumentNullException("project"); |
187 | } | 187 | } |
188 | string docFile = (string)conf.Options["XmlDocFile"]; | 188 | string docFile = (string)conf.Options["XmlDocFile"]; |
189 | // if(docFile != null && docFile.Length == 0)//default to assembly name if not specified | 189 | // if(docFile != null && docFile.Length == 0)//default to assembly name if not specified |
190 | // { | 190 | // { |
191 | // return Path.GetFileNameWithoutExtension(project.AssemblyName) + ".xml"; | 191 | // return Path.GetFileNameWithoutExtension(project.AssemblyName) + ".xml"; |
192 | // } | 192 | // } |
193 | return docFile; | 193 | return docFile; |
194 | } | 194 | } |
195 | 195 | ||
196 | private void WriteProject(SolutionNode solution, ProjectNode project) | 196 | private void WriteProject(SolutionNode solution, ProjectNode project) |
197 | { | 197 | { |
198 | string projFile = Helper.MakeFilePath(project.FullPath, project.Name + GetProjectExtension(project), "build"); | 198 | string projFile = Helper.MakeFilePath(project.FullPath, project.Name + GetProjectExtension(project), "build"); |
199 | StreamWriter ss = new StreamWriter(projFile); | 199 | StreamWriter ss = new StreamWriter(projFile); |
200 | 200 | ||
201 | m_Kernel.CurrentWorkingDirectory.Push(); | 201 | m_Kernel.CurrentWorkingDirectory.Push(); |
202 | Helper.SetCurrentDir(Path.GetDirectoryName(projFile)); | 202 | Helper.SetCurrentDir(Path.GetDirectoryName(projFile)); |
203 | bool hasDoc = false; | 203 | bool hasDoc = false; |
204 | 204 | ||
205 | using (ss) | 205 | using (ss) |
206 | { | 206 | { |
207 | ss.WriteLine("<?xml version=\"1.0\" ?>"); | 207 | ss.WriteLine("<?xml version=\"1.0\" ?>"); |
208 | ss.WriteLine("<project name=\"{0}\" default=\"build\">", project.Name); | 208 | ss.WriteLine("<project name=\"{0}\" default=\"build\">", project.Name); |
209 | ss.WriteLine(" <target name=\"{0}\">", "build"); | 209 | ss.WriteLine(" <target name=\"{0}\">", "build"); |
210 | ss.WriteLine(" <echo message=\"Build Directory is ${project::get-base-directory()}/${build.dir}\" />"); | 210 | ss.WriteLine(" <echo message=\"Build Directory is ${project::get-base-directory()}/${build.dir}\" />"); |
211 | ss.WriteLine(" <mkdir dir=\"${project::get-base-directory()}/${build.dir}\" />"); | 211 | ss.WriteLine(" <mkdir dir=\"${project::get-base-directory()}/${build.dir}\" />"); |
212 | 212 | ||
213 | ss.Write(" <csc "); | 213 | ss.Write(" <csc "); |
214 | ss.Write(" target=\"{0}\"", project.Type.ToString().ToLower()); | 214 | ss.Write(" target=\"{0}\"", project.Type.ToString().ToLower()); |
215 | ss.Write(" debug=\"{0}\"", "${build.debug}"); | 215 | ss.Write(" debug=\"{0}\"", "${build.debug}"); |
216 | ss.Write(" platform=\"${build.platform}\""); | 216 | ss.Write(" platform=\"${build.platform}\""); |
217 | 217 | ||
218 | 218 | ||
219 | foreach (ConfigurationNode conf in project.Configurations) | 219 | foreach (ConfigurationNode conf in project.Configurations) |
220 | { | 220 | { |
221 | if (conf.Options.KeyFile != "") | 221 | if (conf.Options.KeyFile != "") |
222 | { | 222 | { |
223 | ss.Write(" keyfile=\"{0}\"", conf.Options.KeyFile); | 223 | ss.Write(" keyfile=\"{0}\"", conf.Options.KeyFile); |
224 | break; | 224 | break; |
225 | } | 225 | } |
226 | } | 226 | } |
227 | foreach (ConfigurationNode conf in project.Configurations) | 227 | foreach (ConfigurationNode conf in project.Configurations) |
228 | { | 228 | { |
229 | ss.Write(" unsafe=\"{0}\"", conf.Options.AllowUnsafe); | 229 | ss.Write(" unsafe=\"{0}\"", conf.Options.AllowUnsafe); |
230 | break; | 230 | break; |
231 | } | 231 | } |
232 | foreach (ConfigurationNode conf in project.Configurations) | 232 | foreach (ConfigurationNode conf in project.Configurations) |
233 | { | 233 | { |
234 | ss.Write(" warnaserror=\"{0}\"", conf.Options.WarningsAsErrors); | 234 | ss.Write(" warnaserror=\"{0}\"", conf.Options.WarningsAsErrors); |
235 | break; | 235 | break; |
236 | } | 236 | } |
237 | foreach (ConfigurationNode conf in project.Configurations) | 237 | foreach (ConfigurationNode conf in project.Configurations) |
238 | { | 238 | { |
239 | ss.Write(" define=\"{0}\"", conf.Options.CompilerDefines); | 239 | ss.Write(" define=\"{0}\"", conf.Options.CompilerDefines); |
240 | break; | 240 | break; |
241 | } | 241 | } |
242 | foreach (ConfigurationNode conf in project.Configurations) | 242 | foreach (ConfigurationNode conf in project.Configurations) |
243 | { | 243 | { |
244 | ss.Write(" nostdlib=\"{0}\"", conf.Options["NoStdLib"]); | 244 | ss.Write(" nostdlib=\"{0}\"", conf.Options["NoStdLib"]); |
245 | break; | 245 | break; |
246 | } | 246 | } |
247 | 247 | ||
248 | ss.Write(" main=\"{0}\"", project.StartupObject); | 248 | ss.Write(" main=\"{0}\"", project.StartupObject); |
249 | 249 | ||
250 | foreach (ConfigurationNode conf in project.Configurations) | 250 | foreach (ConfigurationNode conf in project.Configurations) |
251 | { | 251 | { |
252 | if (GetXmlDocFile(project, conf) != "") | 252 | if (GetXmlDocFile(project, conf) != "") |
253 | { | 253 | { |
254 | ss.Write(" doc=\"{0}\"", "${project::get-base-directory()}/${build.dir}/" + GetXmlDocFile(project, conf)); | 254 | ss.Write(" doc=\"{0}\"", "${project::get-base-directory()}/${build.dir}/" + GetXmlDocFile(project, conf)); |
255 | hasDoc = true; | 255 | hasDoc = true; |
256 | } | 256 | } |
257 | break; | 257 | break; |
258 | } | 258 | } |
259 | ss.Write(" output=\"{0}", "${project::get-base-directory()}/${build.dir}/${project::get-name()}"); | 259 | ss.Write(" output=\"{0}", "${project::get-base-directory()}/${build.dir}/${project::get-name()}"); |
260 | if (project.Type == ProjectType.Library) | 260 | if (project.Type == ProjectType.Library) |
261 | { | 261 | { |
262 | ss.Write(".dll\""); | 262 | ss.Write(".dll\""); |
263 | } | 263 | } |
264 | else | 264 | else |
265 | { | 265 | { |
266 | ss.Write(".exe\""); | 266 | ss.Write(".exe\""); |
267 | } | 267 | } |
268 | if (project.AppIcon != null && project.AppIcon.Length != 0) | 268 | if (project.AppIcon != null && project.AppIcon.Length != 0) |
269 | { | 269 | { |
270 | ss.Write(" win32icon=\"{0}\"", Helper.NormalizePath(project.AppIcon, '/')); | 270 | ss.Write(" win32icon=\"{0}\"", Helper.NormalizePath(project.AppIcon, '/')); |
271 | } | 271 | } |
272 | // This disables a very different behavior between VS and NAnt. With Nant, | 272 | // This disables a very different behavior between VS and NAnt. With Nant, |
273 | // If you have using System.Xml; it will ensure System.Xml.dll is referenced, | 273 | // If you have using System.Xml; it will ensure System.Xml.dll is referenced, |
274 | // but not in VS. This will force the behaviors to match, so when it works | 274 | // but not in VS. This will force the behaviors to match, so when it works |
275 | // in nant, it will work in VS. | 275 | // in nant, it will work in VS. |
276 | ss.Write(" noconfig=\"true\""); | 276 | ss.Write(" noconfig=\"true\""); |
277 | ss.WriteLine(">"); | 277 | ss.WriteLine(">"); |
278 | ss.WriteLine(" <resources prefix=\"{0}\" dynamicprefix=\"true\" >", project.RootNamespace); | 278 | ss.WriteLine(" <resources prefix=\"{0}\" dynamicprefix=\"true\" >", project.RootNamespace); |
279 | foreach (string file in project.Files) | 279 | foreach (string file in project.Files) |
280 | { | 280 | { |
281 | switch (project.Files.GetBuildAction(file)) | 281 | switch (project.Files.GetBuildAction(file)) |
282 | { | 282 | { |
283 | case BuildAction.EmbeddedResource: | 283 | case BuildAction.EmbeddedResource: |
284 | ss.WriteLine(" {0}", "<include name=\"" + Helper.NormalizePath(PrependPath(file), '/') + "\" />"); | 284 | ss.WriteLine(" {0}", "<include name=\"" + Helper.NormalizePath(PrependPath(file), '/') + "\" />"); |
285 | break; | 285 | break; |
286 | default: | 286 | default: |
287 | if (project.Files.GetSubType(file) != SubType.Code && project.Files.GetSubType(file) != SubType.Settings) | 287 | if (project.Files.GetSubType(file) != SubType.Code && project.Files.GetSubType(file) != SubType.Settings) |
288 | { | 288 | { |
289 | ss.WriteLine(" <include name=\"{0}\" />", file.Substring(0, file.LastIndexOf('.')) + ".resx"); | 289 | ss.WriteLine(" <include name=\"{0}\" />", file.Substring(0, file.LastIndexOf('.')) + ".resx"); |
290 | } | 290 | } |
291 | break; | 291 | break; |
292 | } | 292 | } |
293 | } | 293 | } |
294 | //if (project.Files.GetSubType(file).ToString() != "Code") | 294 | //if (project.Files.GetSubType(file).ToString() != "Code") |
295 | //{ | 295 | //{ |
296 | // ps.WriteLine(" <EmbeddedResource Include=\"{0}\">", file.Substring(0, file.LastIndexOf('.')) + ".resx"); | 296 | // ps.WriteLine(" <EmbeddedResource Include=\"{0}\">", file.Substring(0, file.LastIndexOf('.')) + ".resx"); |
297 | 297 | ||
298 | ss.WriteLine(" </resources>"); | 298 | ss.WriteLine(" </resources>"); |
299 | ss.WriteLine(" <sources failonempty=\"true\">"); | 299 | ss.WriteLine(" <sources failonempty=\"true\">"); |
300 | foreach (string file in project.Files) | 300 | foreach (string file in project.Files) |
301 | { | 301 | { |
302 | switch (project.Files.GetBuildAction(file)) | 302 | switch (project.Files.GetBuildAction(file)) |
303 | { | 303 | { |
304 | case BuildAction.Compile: | 304 | case BuildAction.Compile: |
305 | ss.WriteLine(" <include name=\"" + Helper.NormalizePath(PrependPath(file), '/') + "\" />"); | 305 | ss.WriteLine(" <include name=\"" + Helper.NormalizePath(PrependPath(file), '/') + "\" />"); |
306 | break; | 306 | break; |
307 | default: | 307 | default: |
308 | break; | 308 | break; |
309 | } | 309 | } |
310 | } | 310 | } |
311 | ss.WriteLine(" </sources>"); | 311 | ss.WriteLine(" </sources>"); |
312 | ss.WriteLine(" <references basedir=\"${project::get-base-directory()}\">"); | 312 | ss.WriteLine(" <references basedir=\"${project::get-base-directory()}\">"); |
313 | ss.WriteLine(" <lib>"); | 313 | ss.WriteLine(" <lib>"); |
314 | ss.WriteLine(" <include name=\"${project::get-base-directory()}\" />"); | 314 | ss.WriteLine(" <include name=\"${project::get-base-directory()}\" />"); |
315 | foreach(ReferencePathNode refPath in project.ReferencePaths) | 315 | foreach(ReferencePathNode refPath in project.ReferencePaths) |
316 | { | 316 | { |
317 | ss.WriteLine(" <include name=\"${project::get-base-directory()}/" + refPath.Path.TrimEnd('/', '\\') + "\" />"); | 317 | ss.WriteLine(" <include name=\"${project::get-base-directory()}/" + refPath.Path.TrimEnd('/', '\\') + "\" />"); |
318 | } | 318 | } |
319 | ss.WriteLine(" </lib>"); | 319 | ss.WriteLine(" </lib>"); |
320 | foreach (ReferenceNode refr in project.References) | 320 | foreach (ReferenceNode refr in project.References) |
321 | { | 321 | { |
322 | string path = Helper.NormalizePath(Helper.MakePathRelativeTo(project.FullPath, BuildReference(solution, project, refr)), '/'); | 322 | string path = Helper.NormalizePath(Helper.MakePathRelativeTo(project.FullPath, BuildReference(solution, project, refr)), '/'); |
323 | if (refr.Path != null) { | 323 | if (refr.Path != null) { |
324 | if (ExtensionSpecified(refr.Name)) | 324 | if (ExtensionSpecified(refr.Name)) |
325 | { | 325 | { |
@@ -334,12 +334,12 @@ namespace Prebuild.Core.Targets | |||
334 | { | 334 | { |
335 | ss.WriteLine (" <include name=\"" + path + "\" />"); | 335 | ss.WriteLine (" <include name=\"" + path + "\" />"); |
336 | } | 336 | } |
337 | } | 337 | } |
338 | ss.WriteLine(" </references>"); | 338 | ss.WriteLine(" </references>"); |
339 | 339 | ||
340 | ss.WriteLine(" </csc>"); | 340 | ss.WriteLine(" </csc>"); |
341 | 341 | ||
342 | foreach (ConfigurationNode conf in project.Configurations) | 342 | foreach (ConfigurationNode conf in project.Configurations) |
343 | { | 343 | { |
344 | if (!String.IsNullOrEmpty(conf.Options.OutputPath)) | 344 | if (!String.IsNullOrEmpty(conf.Options.OutputPath)) |
345 | { | 345 | { |
@@ -361,170 +361,170 @@ namespace Prebuild.Core.Targets | |||
361 | } | 361 | } |
362 | } | 362 | } |
363 | 363 | ||
364 | ss.WriteLine(" </target>"); | 364 | ss.WriteLine(" </target>"); |
365 | 365 | ||
366 | ss.WriteLine(" <target name=\"clean\">"); | 366 | ss.WriteLine(" <target name=\"clean\">"); |
367 | ss.WriteLine(" <delete dir=\"${bin.dir}\" failonerror=\"false\" />"); | 367 | ss.WriteLine(" <delete dir=\"${bin.dir}\" failonerror=\"false\" />"); |
368 | ss.WriteLine(" <delete dir=\"${obj.dir}\" failonerror=\"false\" />"); | 368 | ss.WriteLine(" <delete dir=\"${obj.dir}\" failonerror=\"false\" />"); |
369 | ss.WriteLine(" </target>"); | 369 | ss.WriteLine(" </target>"); |
370 | 370 | ||
371 | ss.WriteLine(" <target name=\"doc\" description=\"Creates documentation.\">"); | 371 | ss.WriteLine(" <target name=\"doc\" description=\"Creates documentation.\">"); |
372 | if (hasDoc) | 372 | if (hasDoc) |
373 | { | 373 | { |
374 | ss.WriteLine(" <property name=\"doc.target\" value=\"\" />"); | 374 | ss.WriteLine(" <property name=\"doc.target\" value=\"\" />"); |
375 | ss.WriteLine(" <if test=\"${platform::is-unix()}\">"); | 375 | ss.WriteLine(" <if test=\"${platform::is-unix()}\">"); |
376 | ss.WriteLine(" <property name=\"doc.target\" value=\"Web\" />"); | 376 | ss.WriteLine(" <property name=\"doc.target\" value=\"Web\" />"); |
377 | ss.WriteLine(" </if>"); | 377 | ss.WriteLine(" </if>"); |
378 | ss.WriteLine(" <ndoc failonerror=\"false\" verbose=\"true\">"); | 378 | ss.WriteLine(" <ndoc failonerror=\"false\" verbose=\"true\">"); |
379 | ss.WriteLine(" <assemblies basedir=\"${project::get-base-directory()}\">"); | 379 | ss.WriteLine(" <assemblies basedir=\"${project::get-base-directory()}\">"); |
380 | ss.Write(" <include name=\"${build.dir}/${project::get-name()}"); | 380 | ss.Write(" <include name=\"${build.dir}/${project::get-name()}"); |
381 | if (project.Type == ProjectType.Library) | 381 | if (project.Type == ProjectType.Library) |
382 | { | 382 | { |
383 | ss.WriteLine(".dll\" />"); | 383 | ss.WriteLine(".dll\" />"); |
384 | } | 384 | } |
385 | else | 385 | else |
386 | { | 386 | { |
387 | ss.WriteLine(".exe\" />"); | 387 | ss.WriteLine(".exe\" />"); |
388 | } | 388 | } |
389 | 389 | ||
390 | ss.WriteLine(" </assemblies>"); | 390 | ss.WriteLine(" </assemblies>"); |
391 | ss.WriteLine(" <summaries basedir=\"${project::get-base-directory()}\">"); | 391 | ss.WriteLine(" <summaries basedir=\"${project::get-base-directory()}\">"); |
392 | ss.WriteLine(" <include name=\"${build.dir}/${project::get-name()}.xml\"/>"); | 392 | ss.WriteLine(" <include name=\"${build.dir}/${project::get-name()}.xml\"/>"); |
393 | ss.WriteLine(" </summaries>"); | 393 | ss.WriteLine(" </summaries>"); |
394 | ss.WriteLine(" <referencepaths basedir=\"${project::get-base-directory()}\">"); | 394 | ss.WriteLine(" <referencepaths basedir=\"${project::get-base-directory()}\">"); |
395 | ss.WriteLine(" <include name=\"${build.dir}\" />"); | 395 | ss.WriteLine(" <include name=\"${build.dir}\" />"); |
396 | // foreach(ReferenceNode refr in project.References) | 396 | // foreach(ReferenceNode refr in project.References) |
397 | // { | 397 | // { |
398 | // string path = Helper.NormalizePath(Helper.MakePathRelativeTo(project.FullPath, BuildReferencePath(solution, refr)), '/'); | 398 | // string path = Helper.NormalizePath(Helper.MakePathRelativeTo(project.FullPath, BuildReferencePath(solution, refr)), '/'); |
399 | // if (path != "") | 399 | // if (path != "") |
400 | // { | 400 | // { |
401 | // ss.WriteLine(" <include name=\"{0}\" />", path); | 401 | // ss.WriteLine(" <include name=\"{0}\" />", path); |
402 | // } | 402 | // } |
403 | // } | 403 | // } |
404 | ss.WriteLine(" </referencepaths>"); | 404 | ss.WriteLine(" </referencepaths>"); |
405 | ss.WriteLine(" <documenters>"); | 405 | ss.WriteLine(" <documenters>"); |
406 | ss.WriteLine(" <documenter name=\"MSDN\">"); | 406 | ss.WriteLine(" <documenter name=\"MSDN\">"); |
407 | ss.WriteLine(" <property name=\"OutputDirectory\" value=\"${project::get-base-directory()}/${build.dir}/doc/${project::get-name()}\" />"); | 407 | ss.WriteLine(" <property name=\"OutputDirectory\" value=\"${project::get-base-directory()}/${build.dir}/doc/${project::get-name()}\" />"); |
408 | ss.WriteLine(" <property name=\"OutputTarget\" value=\"${doc.target}\" />"); | 408 | ss.WriteLine(" <property name=\"OutputTarget\" value=\"${doc.target}\" />"); |
409 | ss.WriteLine(" <property name=\"HtmlHelpName\" value=\"${project::get-name()}\" />"); | 409 | ss.WriteLine(" <property name=\"HtmlHelpName\" value=\"${project::get-name()}\" />"); |
410 | ss.WriteLine(" <property name=\"IncludeFavorites\" value=\"False\" />"); | 410 | ss.WriteLine(" <property name=\"IncludeFavorites\" value=\"False\" />"); |
411 | ss.WriteLine(" <property name=\"Title\" value=\"${project::get-name()} SDK Documentation\" />"); | 411 | ss.WriteLine(" <property name=\"Title\" value=\"${project::get-name()} SDK Documentation\" />"); |
412 | ss.WriteLine(" <property name=\"SplitTOCs\" value=\"False\" />"); | 412 | ss.WriteLine(" <property name=\"SplitTOCs\" value=\"False\" />"); |
413 | ss.WriteLine(" <property name=\"DefaulTOC\" value=\"\" />"); | 413 | ss.WriteLine(" <property name=\"DefaulTOC\" value=\"\" />"); |
414 | ss.WriteLine(" <property name=\"ShowVisualBasic\" value=\"True\" />"); | 414 | ss.WriteLine(" <property name=\"ShowVisualBasic\" value=\"True\" />"); |
415 | ss.WriteLine(" <property name=\"AutoDocumentConstructors\" value=\"True\" />"); | 415 | ss.WriteLine(" <property name=\"AutoDocumentConstructors\" value=\"True\" />"); |
416 | ss.WriteLine(" <property name=\"ShowMissingSummaries\" value=\"${build.debug}\" />"); | 416 | ss.WriteLine(" <property name=\"ShowMissingSummaries\" value=\"${build.debug}\" />"); |
417 | ss.WriteLine(" <property name=\"ShowMissingRemarks\" value=\"${build.debug}\" />"); | 417 | ss.WriteLine(" <property name=\"ShowMissingRemarks\" value=\"${build.debug}\" />"); |
418 | ss.WriteLine(" <property name=\"ShowMissingParams\" value=\"${build.debug}\" />"); | 418 | ss.WriteLine(" <property name=\"ShowMissingParams\" value=\"${build.debug}\" />"); |
419 | ss.WriteLine(" <property name=\"ShowMissingReturns\" value=\"${build.debug}\" />"); | 419 | ss.WriteLine(" <property name=\"ShowMissingReturns\" value=\"${build.debug}\" />"); |
420 | ss.WriteLine(" <property name=\"ShowMissingValues\" value=\"${build.debug}\" />"); | 420 | ss.WriteLine(" <property name=\"ShowMissingValues\" value=\"${build.debug}\" />"); |
421 | ss.WriteLine(" <property name=\"DocumentInternals\" value=\"False\" />"); | 421 | ss.WriteLine(" <property name=\"DocumentInternals\" value=\"False\" />"); |
422 | ss.WriteLine(" <property name=\"DocumentPrivates\" value=\"False\" />"); | 422 | ss.WriteLine(" <property name=\"DocumentPrivates\" value=\"False\" />"); |
423 | ss.WriteLine(" <property name=\"DocumentProtected\" value=\"True\" />"); | 423 | ss.WriteLine(" <property name=\"DocumentProtected\" value=\"True\" />"); |
424 | ss.WriteLine(" <property name=\"DocumentEmptyNamespaces\" value=\"${build.debug}\" />"); | 424 | ss.WriteLine(" <property name=\"DocumentEmptyNamespaces\" value=\"${build.debug}\" />"); |
425 | ss.WriteLine(" <property name=\"IncludeAssemblyVersion\" value=\"True\" />"); | 425 | ss.WriteLine(" <property name=\"IncludeAssemblyVersion\" value=\"True\" />"); |
426 | ss.WriteLine(" </documenter>"); | 426 | ss.WriteLine(" </documenter>"); |
427 | ss.WriteLine(" </documenters>"); | 427 | ss.WriteLine(" </documenters>"); |
428 | ss.WriteLine(" </ndoc>"); | 428 | ss.WriteLine(" </ndoc>"); |
429 | } | 429 | } |
430 | ss.WriteLine(" </target>"); | 430 | ss.WriteLine(" </target>"); |
431 | ss.WriteLine("</project>"); | 431 | ss.WriteLine("</project>"); |
432 | } | 432 | } |
433 | m_Kernel.CurrentWorkingDirectory.Pop(); | 433 | m_Kernel.CurrentWorkingDirectory.Pop(); |
434 | } | 434 | } |
435 | 435 | ||
436 | private void WriteCombine(SolutionNode solution) | 436 | private void WriteCombine(SolutionNode solution) |
437 | { | 437 | { |
438 | m_Kernel.Log.Write("Creating NAnt build files"); | 438 | m_Kernel.Log.Write("Creating NAnt build files"); |
439 | foreach (ProjectNode project in solution.Projects) | 439 | foreach (ProjectNode project in solution.Projects) |
440 | { | 440 | { |
441 | if (m_Kernel.AllowProject(project.FilterGroups)) | 441 | if (m_Kernel.AllowProject(project.FilterGroups)) |
442 | { | 442 | { |
443 | m_Kernel.Log.Write("...Creating project: {0}", project.Name); | 443 | m_Kernel.Log.Write("...Creating project: {0}", project.Name); |
444 | WriteProject(solution, project); | 444 | WriteProject(solution, project); |
445 | } | 445 | } |
446 | } | 446 | } |
447 | 447 | ||
448 | m_Kernel.Log.Write(""); | 448 | m_Kernel.Log.Write(""); |
449 | string combFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "build"); | 449 | string combFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "build"); |
450 | StreamWriter ss = new StreamWriter(combFile); | 450 | StreamWriter ss = new StreamWriter(combFile); |
451 | 451 | ||
452 | m_Kernel.CurrentWorkingDirectory.Push(); | 452 | m_Kernel.CurrentWorkingDirectory.Push(); |
453 | Helper.SetCurrentDir(Path.GetDirectoryName(combFile)); | 453 | Helper.SetCurrentDir(Path.GetDirectoryName(combFile)); |
454 | 454 | ||
455 | using (ss) | 455 | using (ss) |
456 | { | 456 | { |
457 | ss.WriteLine("<?xml version=\"1.0\" ?>"); | 457 | ss.WriteLine("<?xml version=\"1.0\" ?>"); |
458 | ss.WriteLine("<project name=\"{0}\" default=\"build\">", solution.Name); | 458 | ss.WriteLine("<project name=\"{0}\" default=\"build\">", solution.Name); |
459 | ss.WriteLine(" <echo message=\"Using '${nant.settings.currentframework}' Framework\"/>"); | 459 | ss.WriteLine(" <echo message=\"Using '${nant.settings.currentframework}' Framework\"/>"); |
460 | ss.WriteLine(); | 460 | ss.WriteLine(); |
461 | 461 | ||
462 | //ss.WriteLine(" <property name=\"dist.dir\" value=\"dist\" />"); | 462 | //ss.WriteLine(" <property name=\"dist.dir\" value=\"dist\" />"); |
463 | //ss.WriteLine(" <property name=\"source.dir\" value=\"source\" />"); | 463 | //ss.WriteLine(" <property name=\"source.dir\" value=\"source\" />"); |
464 | ss.WriteLine(" <property name=\"bin.dir\" value=\"bin\" />"); | 464 | ss.WriteLine(" <property name=\"bin.dir\" value=\"bin\" />"); |
465 | ss.WriteLine(" <property name=\"obj.dir\" value=\"obj\" />"); | 465 | ss.WriteLine(" <property name=\"obj.dir\" value=\"obj\" />"); |
466 | ss.WriteLine(" <property name=\"doc.dir\" value=\"doc\" />"); | 466 | ss.WriteLine(" <property name=\"doc.dir\" value=\"doc\" />"); |
467 | ss.WriteLine(" <property name=\"project.main.dir\" value=\"${project::get-base-directory()}\" />"); | 467 | ss.WriteLine(" <property name=\"project.main.dir\" value=\"${project::get-base-directory()}\" />"); |
468 | 468 | ||
469 | // Use the active configuration, which is the first configuration name in the prebuild file. | 469 | // Use the active configuration, which is the first configuration name in the prebuild file. |
470 | Dictionary<string,string> emittedConfigurations = new Dictionary<string, string>(); | 470 | Dictionary<string,string> emittedConfigurations = new Dictionary<string, string>(); |
471 | 471 | ||
472 | ss.WriteLine(" <property name=\"project.config\" value=\"{0}\" />", solution.ActiveConfig); | 472 | ss.WriteLine(" <property name=\"project.config\" value=\"{0}\" />", solution.ActiveConfig); |
473 | ss.WriteLine(); | 473 | ss.WriteLine(); |
474 | 474 | ||
475 | foreach (ConfigurationNode conf in solution.Configurations) | 475 | foreach (ConfigurationNode conf in solution.Configurations) |
476 | { | 476 | { |
477 | // If the name isn't in the emitted configurations, we give a high level target to the | 477 | // If the name isn't in the emitted configurations, we give a high level target to the |
478 | // platform specific on. This lets "Debug" point to "Debug-AnyCPU". | 478 | // platform specific on. This lets "Debug" point to "Debug-AnyCPU". |
479 | if (!emittedConfigurations.ContainsKey(conf.Name)) | 479 | if (!emittedConfigurations.ContainsKey(conf.Name)) |
480 | { | 480 | { |
481 | // Add it to the dictionary so we only emit one. | 481 | // Add it to the dictionary so we only emit one. |
482 | emittedConfigurations.Add(conf.Name, conf.Platform); | 482 | emittedConfigurations.Add(conf.Name, conf.Platform); |
483 | 483 | ||
484 | // Write out the target block. | 484 | // Write out the target block. |
485 | ss.WriteLine(" <target name=\"{0}\" description=\"{0}|{1}\" depends=\"{0}-{1}\">", conf.Name, conf.Platform); | 485 | ss.WriteLine(" <target name=\"{0}\" description=\"{0}|{1}\" depends=\"{0}-{1}\">", conf.Name, conf.Platform); |
486 | ss.WriteLine(" </target>"); | 486 | ss.WriteLine(" </target>"); |
487 | ss.WriteLine(); | 487 | ss.WriteLine(); |
488 | } | 488 | } |
489 | 489 | ||
490 | // Write out the target for the configuration. | 490 | // Write out the target for the configuration. |
491 | ss.WriteLine(" <target name=\"{0}-{1}\" description=\"{0}|{1}\">", conf.Name, conf.Platform); | 491 | ss.WriteLine(" <target name=\"{0}-{1}\" description=\"{0}|{1}\">", conf.Name, conf.Platform); |
492 | ss.WriteLine(" <property name=\"project.config\" value=\"{0}\" />", conf.Name); | 492 | ss.WriteLine(" <property name=\"project.config\" value=\"{0}\" />", conf.Name); |
493 | ss.WriteLine(" <property name=\"build.debug\" value=\"{0}\" />", conf.Options["DebugInformation"].ToString().ToLower()); | 493 | ss.WriteLine(" <property name=\"build.debug\" value=\"{0}\" />", conf.Options["DebugInformation"].ToString().ToLower()); |
494 | ss.WriteLine("\t\t <property name=\"build.platform\" value=\"{0}\" />", conf.Platform); | 494 | ss.WriteLine("\t\t <property name=\"build.platform\" value=\"{0}\" />", conf.Platform); |
495 | ss.WriteLine(" </target>"); | 495 | ss.WriteLine(" </target>"); |
496 | ss.WriteLine(); | 496 | ss.WriteLine(); |
497 | } | 497 | } |
498 | 498 | ||
499 | ss.WriteLine(" <target name=\"net-1.1\" description=\"Sets framework to .NET 1.1\">"); | 499 | ss.WriteLine(" <target name=\"net-1.1\" description=\"Sets framework to .NET 1.1\">"); |
500 | ss.WriteLine(" <property name=\"nant.settings.currentframework\" value=\"net-1.1\" />"); | 500 | ss.WriteLine(" <property name=\"nant.settings.currentframework\" value=\"net-1.1\" />"); |
501 | ss.WriteLine(" </target>"); | 501 | ss.WriteLine(" </target>"); |
502 | ss.WriteLine(); | 502 | ss.WriteLine(); |
503 | 503 | ||
504 | ss.WriteLine(" <target name=\"net-2.0\" description=\"Sets framework to .NET 2.0\">"); | 504 | ss.WriteLine(" <target name=\"net-2.0\" description=\"Sets framework to .NET 2.0\">"); |
505 | ss.WriteLine(" <property name=\"nant.settings.currentframework\" value=\"net-2.0\" />"); | 505 | ss.WriteLine(" <property name=\"nant.settings.currentframework\" value=\"net-2.0\" />"); |
506 | ss.WriteLine(" </target>"); | 506 | ss.WriteLine(" </target>"); |
507 | ss.WriteLine(); | 507 | ss.WriteLine(); |
508 | 508 | ||
509 | ss.WriteLine(" <target name=\"net-3.5\" description=\"Sets framework to .NET 3.5\">"); | 509 | ss.WriteLine(" <target name=\"net-3.5\" description=\"Sets framework to .NET 3.5\">"); |
510 | ss.WriteLine(" <property name=\"nant.settings.currentframework\" value=\"net-3.5\" />"); | 510 | ss.WriteLine(" <property name=\"nant.settings.currentframework\" value=\"net-3.5\" />"); |
511 | ss.WriteLine(" </target>"); | 511 | ss.WriteLine(" </target>"); |
512 | ss.WriteLine(); | 512 | ss.WriteLine(); |
513 | 513 | ||
514 | ss.WriteLine(" <target name=\"mono-1.0\" description=\"Sets framework to mono 1.0\">"); | 514 | ss.WriteLine(" <target name=\"mono-1.0\" description=\"Sets framework to mono 1.0\">"); |
515 | ss.WriteLine(" <property name=\"nant.settings.currentframework\" value=\"mono-1.0\" />"); | 515 | ss.WriteLine(" <property name=\"nant.settings.currentframework\" value=\"mono-1.0\" />"); |
516 | ss.WriteLine(" </target>"); | 516 | ss.WriteLine(" </target>"); |
517 | ss.WriteLine(); | 517 | ss.WriteLine(); |
518 | 518 | ||
519 | ss.WriteLine(" <target name=\"mono-2.0\" description=\"Sets framework to mono 2.0\">"); | 519 | ss.WriteLine(" <target name=\"mono-2.0\" description=\"Sets framework to mono 2.0\">"); |
520 | ss.WriteLine(" <property name=\"nant.settings.currentframework\" value=\"mono-2.0\" />"); | 520 | ss.WriteLine(" <property name=\"nant.settings.currentframework\" value=\"mono-2.0\" />"); |
521 | ss.WriteLine(" </target>"); | 521 | ss.WriteLine(" </target>"); |
522 | ss.WriteLine(); | 522 | ss.WriteLine(); |
523 | 523 | ||
524 | ss.WriteLine(" <target name=\"mono-3.5\" description=\"Sets framework to mono 3.5\">"); | 524 | ss.WriteLine(" <target name=\"mono-3.5\" description=\"Sets framework to mono 3.5\">"); |
525 | ss.WriteLine(" <property name=\"nant.settings.currentframework\" value=\"mono-3.5\" />"); | 525 | ss.WriteLine(" <property name=\"nant.settings.currentframework\" value=\"mono-3.5\" />"); |
526 | ss.WriteLine(" </target>"); | 526 | ss.WriteLine(" </target>"); |
527 | ss.WriteLine(); | 527 | ss.WriteLine(); |
528 | 528 | ||
529 | ss.WriteLine(" <target name=\"init\" description=\"\">"); | 529 | ss.WriteLine(" <target name=\"init\" description=\"\">"); |
530 | ss.WriteLine(" <call target=\"${project.config}\" />"); | 530 | ss.WriteLine(" <call target=\"${project.config}\" />"); |
@@ -625,7 +625,7 @@ namespace Prebuild.Core.Targets | |||
625 | } | 625 | } |
626 | } | 626 | } |
627 | 627 | ||
628 | ss.WriteLine(" <delete dir=\"${obj.dir}\" failonerror=\"false\" />"); | 628 | ss.WriteLine(" <delete dir=\"${obj.dir}\" failonerror=\"false\" />"); |
629 | foreach (ProjectNode project in solution.Projects) | 629 | foreach (ProjectNode project in solution.Projects) |
630 | { | 630 | { |
631 | string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath); | 631 | string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath); |