diff options
author | UbitUmarov | 2017-08-30 22:24:07 +0100 |
---|---|---|
committer | UbitUmarov | 2017-08-30 22:24:07 +0100 |
commit | 41e8b9f91ff73fd4d18aae1e467446563f94c33f (patch) | |
tree | 363e12392f731fdcd2b60356ec946cd4ad93cd5a /Prebuild/src/Core/Targets/NAntTarget.cs | |
parent | Merge branch 'master' into httptests (diff) | |
download | opensim-SC-41e8b9f91ff73fd4d18aae1e467446563f94c33f.zip opensim-SC-41e8b9f91ff73fd4d18aae1e467446563f94c33f.tar.gz opensim-SC-41e8b9f91ff73fd4d18aae1e467446563f94c33f.tar.bz2 opensim-SC-41e8b9f91ff73fd4d18aae1e467446563f94c33f.tar.xz |
update Prebuild with WhiteCore version
Diffstat (limited to 'Prebuild/src/Core/Targets/NAntTarget.cs')
-rw-r--r-- | Prebuild/src/Core/Targets/NAntTarget.cs | 771 |
1 files changed, 398 insertions, 373 deletions
diff --git a/Prebuild/src/Core/Targets/NAntTarget.cs b/Prebuild/src/Core/Targets/NAntTarget.cs index 21bc80e..925f5ca 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,205 @@ 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 | ss.WriteLine(" <copy todir=\"${project::get-base-directory()}/${build.dir}\" flatten=\"true\">"); | |
213 | ss.Write(" <csc "); | 213 | ss.WriteLine(" <fileset basedir=\"${project::get-base-directory()}\">"); |
214 | ss.Write(" target=\"{0}\"", project.Type.ToString().ToLower()); | 214 | foreach (ReferenceNode refr in project.References) |
215 | ss.Write(" debug=\"{0}\"", "${build.debug}"); | 215 | { |
216 | ss.Write(" platform=\"${build.platform}\""); | 216 | if (refr.LocalCopy) |
217 | 217 | { | |
218 | 218 | ss.WriteLine(" <include name=\"{0}", Helper.NormalizePath(Helper.MakePathRelativeTo(project.FullPath, BuildReference(solution, project, refr)) + "\" />", '/')); | |
219 | foreach (ConfigurationNode conf in project.Configurations) | 219 | } |
220 | { | 220 | } |
221 | if (conf.Options.KeyFile != "") | 221 | |
222 | { | 222 | ss.WriteLine(" </fileset>"); |
223 | ss.Write(" keyfile=\"{0}\"", conf.Options.KeyFile); | 223 | ss.WriteLine(" </copy>"); |
224 | break; | 224 | if (project.ConfigFile != null && project.ConfigFile.Length!=0) |
225 | } | 225 | { |
226 | } | 226 | ss.Write(" <copy file=\"" + project.ConfigFile + "\" tofile=\"${project::get-base-directory()}/${build.dir}/${project::get-name()}"); |
227 | foreach (ConfigurationNode conf in project.Configurations) | 227 | |
228 | { | 228 | if (project.Type == ProjectType.Library) |
229 | ss.Write(" unsafe=\"{0}\"", conf.Options.AllowUnsafe); | 229 | { |
230 | break; | 230 | ss.Write(".dll.config\""); |
231 | } | 231 | } |
232 | foreach (ConfigurationNode conf in project.Configurations) | 232 | else |
233 | { | 233 | { |
234 | ss.Write(" warnaserror=\"{0}\"", conf.Options.WarningsAsErrors); | 234 | ss.Write(".exe.config\""); |
235 | break; | 235 | } |
236 | } | 236 | ss.WriteLine(" />"); |
237 | foreach (ConfigurationNode conf in project.Configurations) | 237 | } |
238 | { | 238 | |
239 | ss.Write(" define=\"{0}\"", conf.Options.CompilerDefines); | 239 | // Add the content files to just be copied |
240 | break; | 240 | ss.WriteLine(" {0}", "<copy todir=\"${project::get-base-directory()}/${build.dir}\">"); |
241 | } | 241 | ss.WriteLine(" {0}", "<fileset basedir=\".\">"); |
242 | foreach (ConfigurationNode conf in project.Configurations) | 242 | |
243 | { | 243 | foreach (string file in project.Files) |
244 | ss.Write(" nostdlib=\"{0}\"", conf.Options["NoStdLib"]); | 244 | { |
245 | break; | 245 | // Ignore if we aren't content |
246 | } | 246 | if (project.Files.GetBuildAction(file) != BuildAction.Content) |
247 | 247 | continue; | |
248 | ss.Write(" main=\"{0}\"", project.StartupObject); | 248 | |
249 | 249 | // Create a include tag | |
250 | foreach (ConfigurationNode conf in project.Configurations) | 250 | ss.WriteLine(" {0}", "<include name=\"" + Helper.NormalizePath(PrependPath(file), '/') + "\" />"); |
251 | { | 251 | } |
252 | if (GetXmlDocFile(project, conf) != "") | 252 | |
253 | { | 253 | ss.WriteLine(" {0}", "</fileset>"); |
254 | ss.Write(" doc=\"{0}\"", "${project::get-base-directory()}/${build.dir}/" + GetXmlDocFile(project, conf)); | 254 | ss.WriteLine(" {0}", "</copy>"); |
255 | hasDoc = true; | 255 | |
256 | } | 256 | ss.Write(" <csc "); |
257 | break; | 257 | ss.Write(" target=\"{0}\"", project.Type.ToString().ToLower()); |
258 | } | 258 | ss.Write(" debug=\"{0}\"", "${build.debug}"); |
259 | ss.Write(" output=\"{0}", "${project::get-base-directory()}/${build.dir}/${project::get-name()}"); | 259 | ss.Write(" platform=\"${build.platform}\""); |
260 | if (project.Type == ProjectType.Library) | 260 | |
261 | { | 261 | |
262 | ss.Write(".dll\""); | 262 | foreach (ConfigurationNode conf in project.Configurations) |
263 | } | 263 | { |
264 | else | 264 | if (conf.Options.KeyFile != "") |
265 | { | 265 | { |
266 | ss.Write(".exe\""); | 266 | ss.Write(" keyfile=\"{0}\"", conf.Options.KeyFile); |
267 | } | 267 | break; |
268 | if (project.AppIcon != null && project.AppIcon.Length != 0) | 268 | } |
269 | { | 269 | } |
270 | ss.Write(" win32icon=\"{0}\"", Helper.NormalizePath(project.AppIcon, '/')); | 270 | foreach (ConfigurationNode conf in project.Configurations) |
271 | } | 271 | { |
272 | ss.Write(" unsafe=\"{0}\"", conf.Options.AllowUnsafe); | ||
273 | break; | ||
274 | } | ||
275 | foreach (ConfigurationNode conf in project.Configurations) | ||
276 | { | ||
277 | ss.Write(" warnaserror=\"{0}\"", conf.Options.WarningsAsErrors); | ||
278 | break; | ||
279 | } | ||
280 | foreach (ConfigurationNode conf in project.Configurations) | ||
281 | { | ||
282 | ss.Write(" define=\"{0}\"", conf.Options.CompilerDefines); | ||
283 | break; | ||
284 | } | ||
285 | foreach (ConfigurationNode conf in project.Configurations) | ||
286 | { | ||
287 | ss.Write(" nostdlib=\"{0}\"", conf.Options["NoStdLib"]); | ||
288 | break; | ||
289 | } | ||
290 | |||
291 | ss.Write(" main=\"{0}\"", project.StartupObject); | ||
292 | |||
293 | foreach (ConfigurationNode conf in project.Configurations) | ||
294 | { | ||
295 | if (GetXmlDocFile(project, conf) != "") | ||
296 | { | ||
297 | ss.Write(" doc=\"{0}\"", "${project::get-base-directory()}/${build.dir}/" + GetXmlDocFile(project, conf)); | ||
298 | hasDoc = true; | ||
299 | } | ||
300 | break; | ||
301 | } | ||
302 | ss.Write(" output=\"{0}", "${project::get-base-directory()}/${build.dir}/${project::get-name()}"); | ||
303 | if (project.Type == ProjectType.Library) | ||
304 | { | ||
305 | ss.Write(".dll\""); | ||
306 | } | ||
307 | else | ||
308 | { | ||
309 | ss.Write(".exe\""); | ||
310 | } | ||
311 | if (project.AppIcon != null && project.AppIcon.Length != 0) | ||
312 | { | ||
313 | ss.Write(" win32icon=\"{0}\"", Helper.NormalizePath(project.AppIcon, '/')); | ||
314 | } | ||
272 | // This disables a very different behavior between VS and NAnt. With Nant, | 315 | // 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, | 316 | // 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 | 317 | // but not in VS. This will force the behaviors to match, so when it works |
275 | // in nant, it will work in VS. | 318 | // in nant, it will work in VS. |
276 | ss.Write(" noconfig=\"true\""); | 319 | ss.Write(" noconfig=\"true\""); |
277 | ss.WriteLine(">"); | 320 | ss.WriteLine(">"); |
278 | ss.WriteLine(" <resources prefix=\"{0}\" dynamicprefix=\"true\" >", project.RootNamespace); | 321 | ss.WriteLine(" <resources prefix=\"{0}\" dynamicprefix=\"true\" >", project.RootNamespace); |
279 | foreach (string file in project.Files) | 322 | foreach (string file in project.Files) |
280 | { | 323 | { |
281 | switch (project.Files.GetBuildAction(file)) | 324 | switch (project.Files.GetBuildAction(file)) |
282 | { | 325 | { |
283 | case BuildAction.EmbeddedResource: | 326 | case BuildAction.EmbeddedResource: |
284 | ss.WriteLine(" {0}", "<include name=\"" + Helper.NormalizePath(PrependPath(file), '/') + "\" />"); | 327 | ss.WriteLine(" {0}", "<include name=\"" + Helper.NormalizePath(PrependPath(file), '/') + "\" />"); |
285 | break; | 328 | break; |
286 | default: | 329 | default: |
287 | if (project.Files.GetSubType(file) != SubType.Code && project.Files.GetSubType(file) != SubType.Settings) | 330 | if (project.Files.GetSubType(file) != SubType.Code && project.Files.GetSubType(file) != SubType.Settings) |
288 | { | 331 | { |
289 | ss.WriteLine(" <include name=\"{0}\" />", file.Substring(0, file.LastIndexOf('.')) + ".resx"); | 332 | ss.WriteLine(" <include name=\"{0}\" />", file.Substring(0, file.LastIndexOf('.')) + ".resx"); |
290 | } | 333 | } |
291 | break; | 334 | break; |
292 | } | 335 | } |
293 | } | 336 | } |
294 | //if (project.Files.GetSubType(file).ToString() != "Code") | 337 | //if (project.Files.GetSubType(file).ToString() != "Code") |
295 | //{ | 338 | //{ |
296 | // ps.WriteLine(" <EmbeddedResource Include=\"{0}\">", file.Substring(0, file.LastIndexOf('.')) + ".resx"); | 339 | // ps.WriteLine(" <EmbeddedResource Include=\"{0}\">", file.Substring(0, file.LastIndexOf('.')) + ".resx"); |
297 | 340 | ||
298 | ss.WriteLine(" </resources>"); | 341 | ss.WriteLine(" </resources>"); |
299 | ss.WriteLine(" <sources failonempty=\"true\">"); | 342 | ss.WriteLine(" <sources failonempty=\"true\">"); |
300 | foreach (string file in project.Files) | 343 | foreach (string file in project.Files) |
301 | { | 344 | { |
302 | switch (project.Files.GetBuildAction(file)) | 345 | switch (project.Files.GetBuildAction(file)) |
303 | { | 346 | { |
304 | case BuildAction.Compile: | 347 | case BuildAction.Compile: |
305 | ss.WriteLine(" <include name=\"" + Helper.NormalizePath(PrependPath(file), '/') + "\" />"); | 348 | ss.WriteLine(" <include name=\"" + Helper.NormalizePath(PrependPath(file), '/') + "\" />"); |
306 | break; | 349 | break; |
307 | default: | 350 | default: |
308 | break; | 351 | break; |
309 | } | 352 | } |
310 | } | 353 | } |
311 | ss.WriteLine(" </sources>"); | 354 | ss.WriteLine(" </sources>"); |
312 | ss.WriteLine(" <references basedir=\"${project::get-base-directory()}\">"); | 355 | ss.WriteLine(" <references basedir=\"${project::get-base-directory()}\">"); |
313 | ss.WriteLine(" <lib>"); | 356 | ss.WriteLine(" <lib>"); |
314 | ss.WriteLine(" <include name=\"${project::get-base-directory()}\" />"); | 357 | ss.WriteLine(" <include name=\"${project::get-base-directory()}\" />"); |
315 | foreach(ReferencePathNode refPath in project.ReferencePaths) | 358 | foreach(ReferencePathNode refPath in project.ReferencePaths) |
316 | { | 359 | { |
317 | ss.WriteLine(" <include name=\"${project::get-base-directory()}/" + refPath.Path.TrimEnd('/', '\\') + "\" />"); | 360 | ss.WriteLine(" <include name=\"${project::get-base-directory()}/" + refPath.Path.TrimEnd('/', '\\') + "\" />"); |
318 | } | 361 | } |
319 | ss.WriteLine(" </lib>"); | 362 | ss.WriteLine(" </lib>"); |
320 | foreach (ReferenceNode refr in project.References) | 363 | foreach (ReferenceNode refr in project.References) |
321 | { | 364 | { |
322 | string path = Helper.NormalizePath(Helper.MakePathRelativeTo(project.FullPath, BuildReference(solution, project, refr)), '/'); | 365 | string path = Helper.NormalizePath(Helper.MakePathRelativeTo(project.FullPath, BuildReference(solution, project, refr)), '/'); |
323 | if (refr.Path != null) { | 366 | if (refr.Path != null) { |
324 | if (ExtensionSpecified(refr.Name)) | 367 | if (ExtensionSpecified(refr.Name)) |
325 | { | 368 | { |
@@ -334,12 +377,12 @@ namespace Prebuild.Core.Targets | |||
334 | { | 377 | { |
335 | ss.WriteLine (" <include name=\"" + path + "\" />"); | 378 | ss.WriteLine (" <include name=\"" + path + "\" />"); |
336 | } | 379 | } |
337 | } | 380 | } |
338 | ss.WriteLine(" </references>"); | 381 | ss.WriteLine(" </references>"); |
339 | 382 | ||
340 | ss.WriteLine(" </csc>"); | 383 | ss.WriteLine(" </csc>"); |
341 | 384 | ||
342 | foreach (ConfigurationNode conf in project.Configurations) | 385 | foreach (ConfigurationNode conf in project.Configurations) |
343 | { | 386 | { |
344 | if (!String.IsNullOrEmpty(conf.Options.OutputPath)) | 387 | if (!String.IsNullOrEmpty(conf.Options.OutputPath)) |
345 | { | 388 | { |
@@ -361,170 +404,170 @@ namespace Prebuild.Core.Targets | |||
361 | } | 404 | } |
362 | } | 405 | } |
363 | 406 | ||
364 | ss.WriteLine(" </target>"); | 407 | ss.WriteLine(" </target>"); |
365 | 408 | ||
366 | ss.WriteLine(" <target name=\"clean\">"); | 409 | ss.WriteLine(" <target name=\"clean\">"); |
367 | ss.WriteLine(" <delete dir=\"${bin.dir}\" failonerror=\"false\" />"); | 410 | ss.WriteLine(" <delete dir=\"${bin.dir}\" failonerror=\"false\" />"); |
368 | ss.WriteLine(" <delete dir=\"${obj.dir}\" failonerror=\"false\" />"); | 411 | ss.WriteLine(" <delete dir=\"${obj.dir}\" failonerror=\"false\" />"); |
369 | ss.WriteLine(" </target>"); | 412 | ss.WriteLine(" </target>"); |
370 | 413 | ||
371 | ss.WriteLine(" <target name=\"doc\" description=\"Creates documentation.\">"); | 414 | ss.WriteLine(" <target name=\"doc\" description=\"Creates documentation.\">"); |
372 | if (hasDoc) | 415 | if (hasDoc) |
373 | { | 416 | { |
374 | ss.WriteLine(" <property name=\"doc.target\" value=\"\" />"); | 417 | ss.WriteLine(" <property name=\"doc.target\" value=\"\" />"); |
375 | ss.WriteLine(" <if test=\"${platform::is-unix()}\">"); | 418 | ss.WriteLine(" <if test=\"${platform::is-unix()}\">"); |
376 | ss.WriteLine(" <property name=\"doc.target\" value=\"Web\" />"); | 419 | ss.WriteLine(" <property name=\"doc.target\" value=\"Web\" />"); |
377 | ss.WriteLine(" </if>"); | 420 | ss.WriteLine(" </if>"); |
378 | ss.WriteLine(" <ndoc failonerror=\"false\" verbose=\"true\">"); | 421 | ss.WriteLine(" <ndoc failonerror=\"false\" verbose=\"true\">"); |
379 | ss.WriteLine(" <assemblies basedir=\"${project::get-base-directory()}\">"); | 422 | ss.WriteLine(" <assemblies basedir=\"${project::get-base-directory()}\">"); |
380 | ss.Write(" <include name=\"${build.dir}/${project::get-name()}"); | 423 | ss.Write(" <include name=\"${build.dir}/${project::get-name()}"); |
381 | if (project.Type == ProjectType.Library) | 424 | if (project.Type == ProjectType.Library) |
382 | { | 425 | { |
383 | ss.WriteLine(".dll\" />"); | 426 | ss.WriteLine(".dll\" />"); |
384 | } | 427 | } |
385 | else | 428 | else |
386 | { | 429 | { |
387 | ss.WriteLine(".exe\" />"); | 430 | ss.WriteLine(".exe\" />"); |
388 | } | 431 | } |
389 | 432 | ||
390 | ss.WriteLine(" </assemblies>"); | 433 | ss.WriteLine(" </assemblies>"); |
391 | ss.WriteLine(" <summaries basedir=\"${project::get-base-directory()}\">"); | 434 | ss.WriteLine(" <summaries basedir=\"${project::get-base-directory()}\">"); |
392 | ss.WriteLine(" <include name=\"${build.dir}/${project::get-name()}.xml\"/>"); | 435 | ss.WriteLine(" <include name=\"${build.dir}/${project::get-name()}.xml\"/>"); |
393 | ss.WriteLine(" </summaries>"); | 436 | ss.WriteLine(" </summaries>"); |
394 | ss.WriteLine(" <referencepaths basedir=\"${project::get-base-directory()}\">"); | 437 | ss.WriteLine(" <referencepaths basedir=\"${project::get-base-directory()}\">"); |
395 | ss.WriteLine(" <include name=\"${build.dir}\" />"); | 438 | ss.WriteLine(" <include name=\"${build.dir}\" />"); |
396 | // foreach(ReferenceNode refr in project.References) | 439 | // foreach(ReferenceNode refr in project.References) |
397 | // { | 440 | // { |
398 | // string path = Helper.NormalizePath(Helper.MakePathRelativeTo(project.FullPath, BuildReferencePath(solution, refr)), '/'); | 441 | // string path = Helper.NormalizePath(Helper.MakePathRelativeTo(project.FullPath, BuildReferencePath(solution, refr)), '/'); |
399 | // if (path != "") | 442 | // if (path != "") |
400 | // { | 443 | // { |
401 | // ss.WriteLine(" <include name=\"{0}\" />", path); | 444 | // ss.WriteLine(" <include name=\"{0}\" />", path); |
402 | // } | 445 | // } |
403 | // } | 446 | // } |
404 | ss.WriteLine(" </referencepaths>"); | 447 | ss.WriteLine(" </referencepaths>"); |
405 | ss.WriteLine(" <documenters>"); | 448 | ss.WriteLine(" <documenters>"); |
406 | ss.WriteLine(" <documenter name=\"MSDN\">"); | 449 | ss.WriteLine(" <documenter name=\"MSDN\">"); |
407 | ss.WriteLine(" <property name=\"OutputDirectory\" value=\"${project::get-base-directory()}/${build.dir}/doc/${project::get-name()}\" />"); | 450 | 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}\" />"); | 451 | ss.WriteLine(" <property name=\"OutputTarget\" value=\"${doc.target}\" />"); |
409 | ss.WriteLine(" <property name=\"HtmlHelpName\" value=\"${project::get-name()}\" />"); | 452 | ss.WriteLine(" <property name=\"HtmlHelpName\" value=\"${project::get-name()}\" />"); |
410 | ss.WriteLine(" <property name=\"IncludeFavorites\" value=\"False\" />"); | 453 | ss.WriteLine(" <property name=\"IncludeFavorites\" value=\"False\" />"); |
411 | ss.WriteLine(" <property name=\"Title\" value=\"${project::get-name()} SDK Documentation\" />"); | 454 | ss.WriteLine(" <property name=\"Title\" value=\"${project::get-name()} SDK Documentation\" />"); |
412 | ss.WriteLine(" <property name=\"SplitTOCs\" value=\"False\" />"); | 455 | ss.WriteLine(" <property name=\"SplitTOCs\" value=\"False\" />"); |
413 | ss.WriteLine(" <property name=\"DefaulTOC\" value=\"\" />"); | 456 | ss.WriteLine(" <property name=\"DefaulTOC\" value=\"\" />"); |
414 | ss.WriteLine(" <property name=\"ShowVisualBasic\" value=\"True\" />"); | 457 | ss.WriteLine(" <property name=\"ShowVisualBasic\" value=\"True\" />"); |
415 | ss.WriteLine(" <property name=\"AutoDocumentConstructors\" value=\"True\" />"); | 458 | ss.WriteLine(" <property name=\"AutoDocumentConstructors\" value=\"True\" />"); |
416 | ss.WriteLine(" <property name=\"ShowMissingSummaries\" value=\"${build.debug}\" />"); | 459 | ss.WriteLine(" <property name=\"ShowMissingSummaries\" value=\"${build.debug}\" />"); |
417 | ss.WriteLine(" <property name=\"ShowMissingRemarks\" value=\"${build.debug}\" />"); | 460 | ss.WriteLine(" <property name=\"ShowMissingRemarks\" value=\"${build.debug}\" />"); |
418 | ss.WriteLine(" <property name=\"ShowMissingParams\" value=\"${build.debug}\" />"); | 461 | ss.WriteLine(" <property name=\"ShowMissingParams\" value=\"${build.debug}\" />"); |
419 | ss.WriteLine(" <property name=\"ShowMissingReturns\" value=\"${build.debug}\" />"); | 462 | ss.WriteLine(" <property name=\"ShowMissingReturns\" value=\"${build.debug}\" />"); |
420 | ss.WriteLine(" <property name=\"ShowMissingValues\" value=\"${build.debug}\" />"); | 463 | ss.WriteLine(" <property name=\"ShowMissingValues\" value=\"${build.debug}\" />"); |
421 | ss.WriteLine(" <property name=\"DocumentInternals\" value=\"False\" />"); | 464 | ss.WriteLine(" <property name=\"DocumentInternals\" value=\"False\" />"); |
422 | ss.WriteLine(" <property name=\"DocumentPrivates\" value=\"False\" />"); | 465 | ss.WriteLine(" <property name=\"DocumentPrivates\" value=\"False\" />"); |
423 | ss.WriteLine(" <property name=\"DocumentProtected\" value=\"True\" />"); | 466 | ss.WriteLine(" <property name=\"DocumentProtected\" value=\"True\" />"); |
424 | ss.WriteLine(" <property name=\"DocumentEmptyNamespaces\" value=\"${build.debug}\" />"); | 467 | ss.WriteLine(" <property name=\"DocumentEmptyNamespaces\" value=\"${build.debug}\" />"); |
425 | ss.WriteLine(" <property name=\"IncludeAssemblyVersion\" value=\"True\" />"); | 468 | ss.WriteLine(" <property name=\"IncludeAssemblyVersion\" value=\"True\" />"); |
426 | ss.WriteLine(" </documenter>"); | 469 | ss.WriteLine(" </documenter>"); |
427 | ss.WriteLine(" </documenters>"); | 470 | ss.WriteLine(" </documenters>"); |
428 | ss.WriteLine(" </ndoc>"); | 471 | ss.WriteLine(" </ndoc>"); |
429 | } | 472 | } |
430 | ss.WriteLine(" </target>"); | 473 | ss.WriteLine(" </target>"); |
431 | ss.WriteLine("</project>"); | 474 | ss.WriteLine("</project>"); |
432 | } | 475 | } |
433 | m_Kernel.CurrentWorkingDirectory.Pop(); | 476 | m_Kernel.CurrentWorkingDirectory.Pop(); |
434 | } | 477 | } |
435 | 478 | ||
436 | private void WriteCombine(SolutionNode solution) | 479 | private void WriteCombine(SolutionNode solution) |
437 | { | 480 | { |
438 | m_Kernel.Log.Write("Creating NAnt build files"); | 481 | m_Kernel.Log.Write("Creating NAnt build files"); |
439 | foreach (ProjectNode project in solution.Projects) | 482 | foreach (ProjectNode project in solution.Projects) |
440 | { | 483 | { |
441 | if (m_Kernel.AllowProject(project.FilterGroups)) | 484 | if (m_Kernel.AllowProject(project.FilterGroups)) |
442 | { | 485 | { |
443 | m_Kernel.Log.Write("...Creating project: {0}", project.Name); | 486 | m_Kernel.Log.Write("...Creating project: {0}", project.Name); |
444 | WriteProject(solution, project); | 487 | WriteProject(solution, project); |
445 | } | 488 | } |
446 | } | 489 | } |
447 | 490 | ||
448 | m_Kernel.Log.Write(""); | 491 | m_Kernel.Log.Write(""); |
449 | string combFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "build"); | 492 | string combFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "build"); |
450 | StreamWriter ss = new StreamWriter(combFile); | 493 | StreamWriter ss = new StreamWriter(combFile); |
451 | 494 | ||
452 | m_Kernel.CurrentWorkingDirectory.Push(); | 495 | m_Kernel.CurrentWorkingDirectory.Push(); |
453 | Helper.SetCurrentDir(Path.GetDirectoryName(combFile)); | 496 | Helper.SetCurrentDir(Path.GetDirectoryName(combFile)); |
454 | 497 | ||
455 | using (ss) | 498 | using (ss) |
456 | { | 499 | { |
457 | ss.WriteLine("<?xml version=\"1.0\" ?>"); | 500 | ss.WriteLine("<?xml version=\"1.0\" ?>"); |
458 | ss.WriteLine("<project name=\"{0}\" default=\"build\">", solution.Name); | 501 | ss.WriteLine("<project name=\"{0}\" default=\"build\">", solution.Name); |
459 | ss.WriteLine(" <echo message=\"Using '${nant.settings.currentframework}' Framework\"/>"); | 502 | ss.WriteLine(" <echo message=\"Using '${nant.settings.currentframework}' Framework\"/>"); |
460 | ss.WriteLine(); | 503 | ss.WriteLine(); |
461 | 504 | ||
462 | //ss.WriteLine(" <property name=\"dist.dir\" value=\"dist\" />"); | 505 | //ss.WriteLine(" <property name=\"dist.dir\" value=\"dist\" />"); |
463 | //ss.WriteLine(" <property name=\"source.dir\" value=\"source\" />"); | 506 | //ss.WriteLine(" <property name=\"source.dir\" value=\"source\" />"); |
464 | ss.WriteLine(" <property name=\"bin.dir\" value=\"bin\" />"); | 507 | ss.WriteLine(" <property name=\"bin.dir\" value=\"bin\" />"); |
465 | ss.WriteLine(" <property name=\"obj.dir\" value=\"obj\" />"); | 508 | ss.WriteLine(" <property name=\"obj.dir\" value=\"obj\" />"); |
466 | ss.WriteLine(" <property name=\"doc.dir\" value=\"doc\" />"); | 509 | ss.WriteLine(" <property name=\"doc.dir\" value=\"doc\" />"); |
467 | ss.WriteLine(" <property name=\"project.main.dir\" value=\"${project::get-base-directory()}\" />"); | 510 | ss.WriteLine(" <property name=\"project.main.dir\" value=\"${project::get-base-directory()}\" />"); |
468 | 511 | ||
469 | // Use the active configuration, which is the first configuration name in the prebuild file. | 512 | // Use the active configuration, which is the first configuration name in the prebuild file. |
470 | Dictionary<string,string> emittedConfigurations = new Dictionary<string, string>(); | 513 | Dictionary<string,string> emittedConfigurations = new Dictionary<string, string>(); |
471 | 514 | ||
472 | ss.WriteLine(" <property name=\"project.config\" value=\"{0}\" />", solution.ActiveConfig); | 515 | ss.WriteLine(" <property name=\"project.config\" value=\"{0}\" />", solution.ActiveConfig); |
473 | ss.WriteLine(); | 516 | ss.WriteLine(); |
474 | 517 | ||
475 | foreach (ConfigurationNode conf in solution.Configurations) | 518 | foreach (ConfigurationNode conf in solution.Configurations) |
476 | { | 519 | { |
477 | // If the name isn't in the emitted configurations, we give a high level target to the | 520 | // 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". | 521 | // platform specific on. This lets "Debug" point to "Debug-AnyCPU". |
479 | if (!emittedConfigurations.ContainsKey(conf.Name)) | 522 | if (!emittedConfigurations.ContainsKey(conf.Name)) |
480 | { | 523 | { |
481 | // Add it to the dictionary so we only emit one. | 524 | // Add it to the dictionary so we only emit one. |
482 | emittedConfigurations.Add(conf.Name, conf.Platform); | 525 | emittedConfigurations.Add(conf.Name, conf.Platform); |
483 | 526 | ||
484 | // Write out the target block. | 527 | // Write out the target block. |
485 | ss.WriteLine(" <target name=\"{0}\" description=\"{0}|{1}\" depends=\"{0}-{1}\">", conf.Name, conf.Platform); | 528 | ss.WriteLine(" <target name=\"{0}\" description=\"{0}|{1}\" depends=\"{0}-{1}\">", conf.Name, conf.Platform); |
486 | ss.WriteLine(" </target>"); | 529 | ss.WriteLine(" </target>"); |
487 | ss.WriteLine(); | 530 | ss.WriteLine(); |
488 | } | 531 | } |
489 | 532 | ||
490 | // Write out the target for the configuration. | 533 | // Write out the target for the configuration. |
491 | ss.WriteLine(" <target name=\"{0}-{1}\" description=\"{0}|{1}\">", conf.Name, conf.Platform); | 534 | ss.WriteLine(" <target name=\"{0}-{1}\" description=\"{0}|{1}\">", conf.Name, conf.Platform); |
492 | ss.WriteLine(" <property name=\"project.config\" value=\"{0}\" />", conf.Name); | 535 | ss.WriteLine(" <property name=\"project.config\" value=\"{0}\" />", conf.Name); |
493 | ss.WriteLine(" <property name=\"build.debug\" value=\"{0}\" />", conf.Options["DebugInformation"].ToString().ToLower()); | 536 | 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); | 537 | ss.WriteLine("\t\t <property name=\"build.platform\" value=\"{0}\" />", conf.Platform); |
495 | ss.WriteLine(" </target>"); | 538 | ss.WriteLine(" </target>"); |
496 | ss.WriteLine(); | 539 | ss.WriteLine(); |
497 | } | 540 | } |
498 | 541 | ||
499 | ss.WriteLine(" <target name=\"net-1.1\" description=\"Sets framework to .NET 1.1\">"); | 542 | 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\" />"); | 543 | ss.WriteLine(" <property name=\"nant.settings.currentframework\" value=\"net-1.1\" />"); |
501 | ss.WriteLine(" </target>"); | 544 | ss.WriteLine(" </target>"); |
502 | ss.WriteLine(); | 545 | ss.WriteLine(); |
503 | 546 | ||
504 | ss.WriteLine(" <target name=\"net-2.0\" description=\"Sets framework to .NET 2.0\">"); | 547 | 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\" />"); | 548 | ss.WriteLine(" <property name=\"nant.settings.currentframework\" value=\"net-2.0\" />"); |
506 | ss.WriteLine(" </target>"); | 549 | ss.WriteLine(" </target>"); |
507 | ss.WriteLine(); | 550 | ss.WriteLine(); |
508 | 551 | ||
509 | ss.WriteLine(" <target name=\"net-3.5\" description=\"Sets framework to .NET 3.5\">"); | 552 | 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\" />"); | 553 | ss.WriteLine(" <property name=\"nant.settings.currentframework\" value=\"net-3.5\" />"); |
511 | ss.WriteLine(" </target>"); | 554 | ss.WriteLine(" </target>"); |
512 | ss.WriteLine(); | 555 | ss.WriteLine(); |
513 | 556 | ||
514 | ss.WriteLine(" <target name=\"mono-1.0\" description=\"Sets framework to mono 1.0\">"); | 557 | 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\" />"); | 558 | ss.WriteLine(" <property name=\"nant.settings.currentframework\" value=\"mono-1.0\" />"); |
516 | ss.WriteLine(" </target>"); | 559 | ss.WriteLine(" </target>"); |
517 | ss.WriteLine(); | 560 | ss.WriteLine(); |
518 | 561 | ||
519 | ss.WriteLine(" <target name=\"mono-2.0\" description=\"Sets framework to mono 2.0\">"); | 562 | 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\" />"); | 563 | ss.WriteLine(" <property name=\"nant.settings.currentframework\" value=\"mono-2.0\" />"); |
521 | ss.WriteLine(" </target>"); | 564 | ss.WriteLine(" </target>"); |
522 | ss.WriteLine(); | 565 | ss.WriteLine(); |
523 | 566 | ||
524 | ss.WriteLine(" <target name=\"mono-3.5\" description=\"Sets framework to mono 3.5\">"); | 567 | 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\" />"); | 568 | ss.WriteLine(" <property name=\"nant.settings.currentframework\" value=\"mono-3.5\" />"); |
526 | ss.WriteLine(" </target>"); | 569 | ss.WriteLine(" </target>"); |
527 | ss.WriteLine(); | 570 | ss.WriteLine(); |
528 | 571 | ||
529 | ss.WriteLine(" <target name=\"init\" description=\"\">"); | 572 | ss.WriteLine(" <target name=\"init\" description=\"\">"); |
530 | ss.WriteLine(" <call target=\"${project.config}\" />"); | 573 | ss.WriteLine(" <call target=\"${project.config}\" />"); |
@@ -594,24 +637,6 @@ namespace Prebuild.Core.Targets | |||
594 | ss.WriteLine(" <target name=\"clean\" description=\"\">"); | 637 | ss.WriteLine(" <target name=\"clean\" description=\"\">"); |
595 | ss.WriteLine(" <echo message=\"Deleting all builds from all configurations\" />"); | 638 | ss.WriteLine(" <echo message=\"Deleting all builds from all configurations\" />"); |
596 | //ss.WriteLine(" <delete dir=\"${dist.dir}\" failonerror=\"false\" />"); | 639 | //ss.WriteLine(" <delete dir=\"${dist.dir}\" failonerror=\"false\" />"); |
597 | |||
598 | // justincc: FIXME FIXME FIXME - A temporary OpenSim hack to clean up files when "nant clean" is executed. | ||
599 | // Should be replaced with extreme prejudice once anybody finds out if the CleanFiles stuff works or there is | ||
600 | // another working mechanism for specifying this stuff | ||
601 | ss.WriteLine(" <delete failonerror=\"false\">"); | ||
602 | ss.WriteLine(" <fileset basedir=\"${bin.dir}\">"); | ||
603 | ss.WriteLine(" <include name=\"OpenSim*.dll\"/>"); | ||
604 | ss.WriteLine(" <include name=\"OpenSim*.dll.mdb\"/>"); | ||
605 | ss.WriteLine(" <include name=\"OpenSim*.exe\"/>"); | ||
606 | ss.WriteLine(" <include name=\"OpenSim*.exe.mdb\"/>"); | ||
607 | ss.WriteLine(" <include name=\"ScriptEngines/*\"/>"); | ||
608 | ss.WriteLine(" <include name=\"Physics/*.dll\"/>"); | ||
609 | ss.WriteLine(" <include name=\"Physics/*.dll.mdb\"/>"); | ||
610 | ss.WriteLine(" <exclude name=\"OpenSim.32BitLaunch.exe\"/>"); | ||
611 | ss.WriteLine(" <exclude name=\"ScriptEngines/Default.lsl\"/>"); | ||
612 | ss.WriteLine(" </fileset>"); | ||
613 | ss.WriteLine(" </delete>"); | ||
614 | |||
615 | if (solution.Cleanup != null && solution.Cleanup.CleanFiles.Count > 0) | 640 | if (solution.Cleanup != null && solution.Cleanup.CleanFiles.Count > 0) |
616 | { | 641 | { |
617 | foreach (CleanFilesNode cleanFile in solution.Cleanup.CleanFiles) | 642 | foreach (CleanFilesNode cleanFile in solution.Cleanup.CleanFiles) |
@@ -625,7 +650,7 @@ namespace Prebuild.Core.Targets | |||
625 | } | 650 | } |
626 | } | 651 | } |
627 | 652 | ||
628 | ss.WriteLine(" <delete dir=\"${obj.dir}\" failonerror=\"false\" />"); | 653 | ss.WriteLine(" <delete dir=\"${obj.dir}\" failonerror=\"false\" />"); |
629 | foreach (ProjectNode project in solution.Projects) | 654 | foreach (ProjectNode project in solution.Projects) |
630 | { | 655 | { |
631 | string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath); | 656 | string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath); |