diff options
Diffstat (limited to '')
-rw-r--r-- | Prebuild/src/Core/Targets/NAntTarget.cs | 103 |
1 files changed, 74 insertions, 29 deletions
diff --git a/Prebuild/src/Core/Targets/NAntTarget.cs b/Prebuild/src/Core/Targets/NAntTarget.cs index 8a6dbdf..6ee6aef 100644 --- a/Prebuild/src/Core/Targets/NAntTarget.cs +++ b/Prebuild/src/Core/Targets/NAntTarget.cs | |||
@@ -1,34 +1,46 @@ | |||
1 | #region BSD License | 1 | #region BSD License |
2 | /* | 2 | /* |
3 | Copyright (c) 2004 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) | 3 | Copyright (c) 2004 - 2008 |
4 | 4 | Matthew Holmes (matthew@wildfiregames.com), | |
5 | Redistribution and use in source and binary forms, with or without modification, are permitted | 5 | Dan Moorehead (dan05a@gmail.com), |
6 | provided that the following conditions are met: | 6 | C.J. Adams-Collier (cjac@colliertech.org), |
7 | 7 | ||
8 | * Redistributions of source code must retain the above copyright notice, this list of conditions | 8 | Redistribution and use in source and binary forms, with or without |
9 | and the following disclaimer. | 9 | modification, are permitted provided that the following conditions are |
10 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions | 10 | met: |
11 | and the following disclaimer in the documentation and/or other materials provided with the | 11 | |
12 | distribution. | 12 | * Redistributions of source code must retain the above copyright |
13 | * The name of the author may not be used to endorse or promote products derived from this software | 13 | notice, this list of conditions and the following disclaimer. |
14 | without specific prior written permission. | 14 | |
15 | 15 | * Redistributions in binary form must reproduce the above copyright | |
16 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, | 16 | notice, this list of conditions and the following disclaimer in the |
17 | BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | 17 | documentation and/or other materials provided with the distribution. |
18 | ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | 18 | |
19 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | 19 | * The name of the author may not be used to endorse or promote |
20 | OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY | 20 | products derived from this software without specific prior written |
21 | OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | 21 | permission. |
22 | IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 22 | |
23 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | ||
24 | IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
25 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
26 | DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, | ||
27 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
28 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | ||
29 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
30 | HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
31 | STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | ||
32 | IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
33 | POSSIBILITY OF SUCH DAMAGE. | ||
23 | */ | 34 | */ |
35 | |||
24 | #endregion | 36 | #endregion |
25 | 37 | ||
26 | #region CVS Information | 38 | #region CVS Information |
27 | /* | 39 | /* |
28 | * $Source$ | 40 | * $Source$ |
29 | * $Author: jendave $ | 41 | * $Author: cjcollier $ |
30 | * $Date: 2007-02-13 21:58:03 +0100 (ti, 13 feb 2007) $ | 42 | * $Date: 2008-02-07 10:22:36 +0900 (Thu, 07 Feb 2008) $ |
31 | * $Revision: 205 $ | 43 | * $Revision: 255 $ |
32 | */ | 44 | */ |
33 | #endregion | 45 | #endregion |
34 | 46 | ||
@@ -83,9 +95,7 @@ namespace Prebuild.Core.Targets | |||
83 | if (solution.ProjectsTable.ContainsKey(refr.Name)) | 95 | if (solution.ProjectsTable.ContainsKey(refr.Name)) |
84 | { | 96 | { |
85 | ProjectNode project = (ProjectNode)solution.ProjectsTable[refr.Name]; | 97 | ProjectNode project = (ProjectNode)solution.ProjectsTable[refr.Name]; |
86 | |||
87 | string finalPath = Helper.NormalizePath(((ReferencePathNode)currentProject.ReferencePaths[0]).Path + refr.Name + GetProjectExtension(project), '/'); | 98 | string finalPath = Helper.NormalizePath(((ReferencePathNode)currentProject.ReferencePaths[0]).Path + refr.Name + GetProjectExtension(project), '/'); |
88 | |||
89 | return finalPath; | 99 | return finalPath; |
90 | } | 100 | } |
91 | else | 101 | else |
@@ -122,7 +132,6 @@ namespace Prebuild.Core.Targets | |||
122 | { | 132 | { |
123 | ProjectNode project = (ProjectNode)solution.ProjectsTable[refr.Name]; | 133 | ProjectNode project = (ProjectNode)solution.ProjectsTable[refr.Name]; |
124 | string finalPath = Helper.NormalizePath(((ReferencePathNode)project.ReferencePaths[0]).Path, '/'); | 134 | string finalPath = Helper.NormalizePath(((ReferencePathNode)project.ReferencePaths[0]).Path, '/'); |
125 | |||
126 | return finalPath; | 135 | return finalPath; |
127 | } | 136 | } |
128 | else | 137 | else |
@@ -213,7 +222,7 @@ namespace Prebuild.Core.Targets | |||
213 | ss.WriteLine(" <target name=\"{0}\">", "build"); | 222 | ss.WriteLine(" <target name=\"{0}\">", "build"); |
214 | ss.WriteLine(" <echo message=\"Build Directory is ${project::get-base-directory()}/${build.dir}\" />"); | 223 | ss.WriteLine(" <echo message=\"Build Directory is ${project::get-base-directory()}/${build.dir}\" />"); |
215 | ss.WriteLine(" <mkdir dir=\"${project::get-base-directory()}/${build.dir}\" />"); | 224 | ss.WriteLine(" <mkdir dir=\"${project::get-base-directory()}/${build.dir}\" />"); |
216 | ss.WriteLine(" <copy todir=\"${project::get-base-directory()}/${build.dir}\">"); | 225 | ss.WriteLine(" <copy todir=\"${project::get-base-directory()}/${build.dir}\" flatten=\"true\">"); |
217 | ss.WriteLine(" <fileset basedir=\"${project::get-base-directory()}\">"); | 226 | ss.WriteLine(" <fileset basedir=\"${project::get-base-directory()}\">"); |
218 | foreach (ReferenceNode refr in project.References) | 227 | foreach (ReferenceNode refr in project.References) |
219 | { | 228 | { |
@@ -222,8 +231,41 @@ namespace Prebuild.Core.Targets | |||
222 | ss.WriteLine(" <include name=\"{0}", Helper.NormalizePath(Helper.MakePathRelativeTo(project.FullPath, BuildReference(solution, project, refr)) + "\" />", '/')); | 231 | ss.WriteLine(" <include name=\"{0}", Helper.NormalizePath(Helper.MakePathRelativeTo(project.FullPath, BuildReference(solution, project, refr)) + "\" />", '/')); |
223 | } | 232 | } |
224 | } | 233 | } |
234 | |||
225 | ss.WriteLine(" </fileset>"); | 235 | ss.WriteLine(" </fileset>"); |
226 | ss.WriteLine(" </copy>"); | 236 | ss.WriteLine(" </copy>"); |
237 | if (project.ConfigFile != null && project.ConfigFile.Length!=0) | ||
238 | { | ||
239 | ss.Write(" <copy file=\"" + project.ConfigFile + "\" tofile=\"${project::get-base-directory()}/${build.dir}/${project::get-name()}"); | ||
240 | |||
241 | if (project.Type == ProjectType.Library) | ||
242 | { | ||
243 | ss.Write(".dll.config\""); | ||
244 | } | ||
245 | else | ||
246 | { | ||
247 | ss.Write(".exe.config\""); | ||
248 | } | ||
249 | ss.WriteLine(" />"); | ||
250 | } | ||
251 | |||
252 | // Add the content files to just be copied | ||
253 | ss.WriteLine(" {0}", "<copy todir=\"${project::get-base-directory()}/${build.dir}\">"); | ||
254 | ss.WriteLine(" {0}", "<fileset basedir=\".\">"); | ||
255 | |||
256 | foreach (string file in project.Files) | ||
257 | { | ||
258 | // Ignore if we aren't content | ||
259 | if (project.Files.GetBuildAction(file) != BuildAction.Content) | ||
260 | continue; | ||
261 | |||
262 | // Create a include tag | ||
263 | ss.WriteLine(" {0}", "<include name=\"" + Helper.NormalizePath(PrependPath(file), '/') + "\" />"); | ||
264 | } | ||
265 | |||
266 | ss.WriteLine(" {0}", "</fileset>"); | ||
267 | ss.WriteLine(" {0}", "</copy>"); | ||
268 | |||
227 | ss.Write(" <csc"); | 269 | ss.Write(" <csc"); |
228 | ss.Write(" target=\"{0}\"", project.Type.ToString().ToLower()); | 270 | ss.Write(" target=\"{0}\"", project.Type.ToString().ToLower()); |
229 | ss.Write(" debug=\"{0}\"", "${build.debug}"); | 271 | ss.Write(" debug=\"{0}\"", "${build.debug}"); |
@@ -245,6 +287,8 @@ namespace Prebuild.Core.Targets | |||
245 | ss.Write(" define=\"{0}\"", conf.Options.CompilerDefines); | 287 | ss.Write(" define=\"{0}\"", conf.Options.CompilerDefines); |
246 | break; | 288 | break; |
247 | } | 289 | } |
290 | ss.Write(" main=\"{0}\"", project.StartupObject); | ||
291 | |||
248 | foreach (ConfigurationNode conf in project.Configurations) | 292 | foreach (ConfigurationNode conf in project.Configurations) |
249 | { | 293 | { |
250 | if (GetXmlDocFile(project, conf) != "") | 294 | if (GetXmlDocFile(project, conf) != "") |
@@ -476,14 +520,15 @@ namespace Prebuild.Core.Targets | |||
476 | 520 | ||
477 | ss.WriteLine(" <target name=\"init\" description=\"\">"); | 521 | ss.WriteLine(" <target name=\"init\" description=\"\">"); |
478 | ss.WriteLine(" <call target=\"${project.config}\" />"); | 522 | ss.WriteLine(" <call target=\"${project.config}\" />"); |
479 | ss.WriteLine(" <sysinfo />"); | 523 | ss.WriteLine(" <property name=\"sys.os.platform\""); |
524 | ss.WriteLine(" value=\"${platform::get-name()}\""); | ||
525 | ss.WriteLine(" />"); | ||
480 | ss.WriteLine(" <echo message=\"Platform ${sys.os.platform}\" />"); | 526 | ss.WriteLine(" <echo message=\"Platform ${sys.os.platform}\" />"); |
481 | ss.WriteLine(" <property name=\"build.dir\" value=\"${bin.dir}/${project.config}\" />"); | 527 | ss.WriteLine(" <property name=\"build.dir\" value=\"${bin.dir}/${project.config}\" />"); |
482 | ss.WriteLine(" </target>"); | 528 | ss.WriteLine(" </target>"); |
483 | ss.WriteLine(); | 529 | ss.WriteLine(); |
484 | 530 | ||
485 | 531 | ||
486 | |||
487 | // sdague - ok, this is an ugly hack, but what it lets | 532 | // sdague - ok, this is an ugly hack, but what it lets |
488 | // us do is native include of files into the nant | 533 | // us do is native include of files into the nant |
489 | // created files from all .nant/*include files. This | 534 | // created files from all .nant/*include files. This |