diff options
author | Sean Dague | 2007-09-15 10:17:24 +0000 |
---|---|---|
committer | Sean Dague | 2007-09-15 10:17:24 +0000 |
commit | 5a94814bbee8314d1df165d9d6c0f0b877331f06 (patch) | |
tree | 12c15484007673376e600accaffe95cc6a2f8013 /Prebuild | |
parent | * Wired up chat so that channel goes into OnChatFromViewer. However: (diff) | |
download | opensim-SC-5a94814bbee8314d1df165d9d6c0f0b877331f06.zip opensim-SC-5a94814bbee8314d1df165d9d6c0f0b877331f06.tar.gz opensim-SC-5a94814bbee8314d1df165d9d6c0f0b877331f06.tar.bz2 opensim-SC-5a94814bbee8314d1df165d9d6c0f0b877331f06.tar.xz |
Start adding zip target to prebuild for nant
Diffstat (limited to 'Prebuild')
-rw-r--r-- | Prebuild/src/Core/Targets/NAntTarget.cs | 1112 |
1 files changed, 563 insertions, 549 deletions
diff --git a/Prebuild/src/Core/Targets/NAntTarget.cs b/Prebuild/src/Core/Targets/NAntTarget.cs index 4669cfd..efef949 100644 --- a/Prebuild/src/Core/Targets/NAntTarget.cs +++ b/Prebuild/src/Core/Targets/NAntTarget.cs | |||
@@ -1,25 +1,25 @@ | |||
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 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) |
4 | 4 | ||
5 | Redistribution and use in source and binary forms, with or without modification, are permitted | 5 | Redistribution and use in source and binary forms, with or without modification, are permitted |
6 | provided that the following conditions are met: | 6 | provided 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 | ||
16 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, | 16 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, |
17 | BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | 17 | BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
18 | ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | 18 | ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
19 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | 19 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
20 | OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY | 20 | OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
21 | OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | 21 | OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING |
22 | IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 22 | IN 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 | ||
@@ -46,576 +46,590 @@ using Prebuild.Core.Utilities; | |||
46 | 46 | ||
47 | namespace Prebuild.Core.Targets | 47 | namespace 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 | { | ||
280 | switch (project.Files.GetBuildAction(file)) | ||
281 | { | 279 | { |
282 | case BuildAction.EmbeddedResource: | 280 | switch (project.Files.GetBuildAction(file)) |
283 | ss.WriteLine(" {0}", "<include name=\"" + Helper.NormalizePath(PrependPath(file), '/') + "\" />"); | ||
284 | break; | ||
285 | default: | ||
286 | if (project.Files.GetSubType(file) != SubType.Code && project.Files.GetSubType(file) != SubType.Settings) | ||
287 | { | 281 | { |
288 | ss.WriteLine(" <include name=\"{0}\" />", file.Substring(0, file.LastIndexOf('.')) + ".resx"); | 282 | case BuildAction.EmbeddedResource: |
283 | ss.WriteLine(" {0}", "<include name=\"" + Helper.NormalizePath(PrependPath(file), '/') + "\" />"); | ||
284 | break; | ||
285 | default: | ||
286 | if (project.Files.GetSubType(file) != SubType.Code && project.Files.GetSubType(file) != SubType.Settings) | ||
287 | { | ||
288 | ss.WriteLine(" <include name=\"{0}\" />", file.Substring(0, file.LastIndexOf('.')) + ".resx"); | ||
289 | } | ||
290 | break; | ||
289 | } | 291 | } |
290 | break; | ||
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 | { | ||
327 | if (!String.IsNullOrEmpty(conf.Options.OutputPath)) | ||
328 | { | 326 | { |
329 | string targetDir = Helper.NormalizePath(conf.Options.OutputPath, '/'); | 327 | if (!String.IsNullOrEmpty(conf.Options.OutputPath)) |
328 | { | ||
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 | |||
493 | // sdague - make a zip target | ||
494 | ss.WriteLine(" <target name=\"zip\" description=\"\">"); | ||
495 | ss.WriteLine(" <zip zipfile=\"{0}.zip\">", solution.Name); | ||
496 | ss.WriteLine(" <fileset basedir=\"${project::get-base-directory()}\">"); | ||
497 | |||
498 | ss.WriteLine(" <include name=\"${project::get-base-directory()}/**/*.cs\" />"); | ||
499 | // ss.WriteLine(" <include name=\"${project.main.dir}/**/*\" />"); | ||
500 | ss.WriteLine(" </fileset>"); | ||
501 | ss.WriteLine(" </zip>"); | ||
502 | ss.WriteLine(" <echo message=\"Building zip target\" />"); | ||
503 | ss.WriteLine(" </target>"); | ||
504 | ss.WriteLine(); | ||
505 | |||
492 | 506 | ||
493 | ss.WriteLine(" <target name=\"clean\" description=\"\">"); | 507 | ss.WriteLine(" <target name=\"clean\" description=\"\">"); |
494 | ss.WriteLine(" <echo message=\"Deleting all builds from all configurations\" />"); | 508 | ss.WriteLine(" <echo message=\"Deleting all builds from all configurations\" />"); |
495 | //ss.WriteLine(" <delete dir=\"${dist.dir}\" failonerror=\"false\" />"); | 509 | //ss.WriteLine(" <delete dir=\"${dist.dir}\" failonerror=\"false\" />"); |
496 | ss.WriteLine(" <delete dir=\"${bin.dir}\" failonerror=\"false\" />"); | 510 | ss.WriteLine(" <delete dir=\"${bin.dir}\" failonerror=\"false\" />"); |
497 | ss.WriteLine(" <delete dir=\"${obj.dir}\" failonerror=\"false\" />"); | 511 | ss.WriteLine(" <delete dir=\"${obj.dir}\" failonerror=\"false\" />"); |
498 | foreach(ProjectNode project in solution.Projects) | 512 | foreach(ProjectNode project in solution.Projects) |
499 | { | 513 | { |
500 | string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath); | 514 | string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath); |
501 | ss.Write(" <nant buildfile=\"{0}\"", | 515 | ss.Write(" <nant buildfile=\"{0}\"", |
502 | Helper.NormalizePath(Helper.MakeFilePath(path, project.Name + (project.Type == ProjectType.Library ? ".dll" : ".exe"), "build"),'/')); | 516 | Helper.NormalizePath(Helper.MakeFilePath(path, project.Name + (project.Type == ProjectType.Library ? ".dll" : ".exe"), "build"),'/')); |
503 | ss.WriteLine(" target=\"clean\" />"); | 517 | ss.WriteLine(" target=\"clean\" />"); |
504 | } | 518 | } |
505 | ss.WriteLine(" </target>"); | 519 | ss.WriteLine(" </target>"); |
506 | ss.WriteLine(); | 520 | ss.WriteLine(); |
507 | 521 | ||
508 | ss.WriteLine(" <target name=\"build\" depends=\"init\" description=\"\">"); | 522 | ss.WriteLine(" <target name=\"build\" depends=\"init\" description=\"\">"); |
509 | 523 | ||
510 | foreach(ProjectNode project in solution.ProjectsTableOrder) | 524 | foreach(ProjectNode project in solution.ProjectsTableOrder) |
511 | { | 525 | { |
512 | string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath); | 526 | string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath); |
513 | ss.Write(" <nant buildfile=\"{0}\"", | 527 | ss.Write(" <nant buildfile=\"{0}\"", |
514 | Helper.NormalizePath(Helper.MakeFilePath(path, project.Name + (project.Type == ProjectType.Library ? ".dll" : ".exe"), "build"),'/')); | 528 | Helper.NormalizePath(Helper.MakeFilePath(path, project.Name + (project.Type == ProjectType.Library ? ".dll" : ".exe"), "build"),'/')); |
515 | ss.WriteLine(" target=\"build\" />"); | 529 | ss.WriteLine(" target=\"build\" />"); |
516 | } | 530 | } |
517 | ss.WriteLine(" </target>"); | 531 | ss.WriteLine(" </target>"); |
518 | ss.WriteLine(); | 532 | ss.WriteLine(); |
519 | 533 | ||
520 | ss.WriteLine(" <target name=\"build-release\" depends=\"Release, init, build\" description=\"Builds in Release mode\" />"); | 534 | ss.WriteLine(" <target name=\"build-release\" depends=\"Release, init, build\" description=\"Builds in Release mode\" />"); |
521 | ss.WriteLine(); | 535 | ss.WriteLine(); |
522 | ss.WriteLine(" <target name=\"build-debug\" depends=\"Debug, init, build\" description=\"Builds in Debug mode\" />"); | 536 | ss.WriteLine(" <target name=\"build-debug\" depends=\"Debug, init, build\" description=\"Builds in Debug mode\" />"); |
523 | ss.WriteLine(); | 537 | ss.WriteLine(); |
524 | //ss.WriteLine(" <target name=\"package\" depends=\"clean, doc, copyfiles, zip\" description=\"Builds in Release mode\" />"); | 538 | //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\" />"); | 539 | ss.WriteLine(" <target name=\"package\" depends=\"clean, doc\" description=\"Builds all\" />"); |
526 | ss.WriteLine(); | 540 | ss.WriteLine(); |
527 | 541 | ||
528 | ss.WriteLine(" <target name=\"doc\" depends=\"build-release\">"); | 542 | ss.WriteLine(" <target name=\"doc\" depends=\"build-release\">"); |
529 | ss.WriteLine(" <echo message=\"Generating all documentation from all builds\" />"); | 543 | ss.WriteLine(" <echo message=\"Generating all documentation from all builds\" />"); |
530 | foreach (ProjectNode project in solution.Projects) | 544 | foreach (ProjectNode project in solution.Projects) |
531 | { | 545 | { |
532 | string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath); | 546 | string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath); |
533 | ss.Write(" <nant buildfile=\"{0}\"", | 547 | ss.Write(" <nant buildfile=\"{0}\"", |
534 | Helper.NormalizePath(Helper.MakeFilePath(path, project.Name + (project.Type == ProjectType.Library ? ".dll" : ".exe"), "build"), '/')); | 548 | Helper.NormalizePath(Helper.MakeFilePath(path, project.Name + (project.Type == ProjectType.Library ? ".dll" : ".exe"), "build"), '/')); |
535 | ss.WriteLine(" target=\"doc\" />"); | 549 | ss.WriteLine(" target=\"doc\" />"); |
536 | } | 550 | } |
537 | ss.WriteLine(" </target>"); | 551 | ss.WriteLine(" </target>"); |
538 | ss.WriteLine(); | 552 | ss.WriteLine(); |
539 | ss.WriteLine("</project>"); | 553 | ss.WriteLine("</project>"); |
540 | } | 554 | } |
541 | 555 | ||
542 | m_Kernel.CurrentWorkingDirectory.Pop(); | 556 | m_Kernel.CurrentWorkingDirectory.Pop(); |
543 | } | 557 | } |
544 | 558 | ||
545 | private void CleanProject(ProjectNode project) | 559 | private void CleanProject(ProjectNode project) |
546 | { | 560 | { |
547 | m_Kernel.Log.Write("...Cleaning project: {0}", project.Name); | 561 | 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"); | 562 | string projectFile = Helper.MakeFilePath(project.FullPath, project.Name + (project.Type == ProjectType.Library ? ".dll" : ".exe"), "build"); |
549 | Helper.DeleteIfExists(projectFile); | 563 | Helper.DeleteIfExists(projectFile); |
550 | } | 564 | } |
551 | 565 | ||
552 | private void CleanSolution(SolutionNode solution) | 566 | private void CleanSolution(SolutionNode solution) |
553 | { | 567 | { |
554 | m_Kernel.Log.Write("Cleaning NAnt build files for", solution.Name); | 568 | m_Kernel.Log.Write("Cleaning NAnt build files for", solution.Name); |
555 | 569 | ||
556 | string slnFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "build"); | 570 | string slnFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "build"); |
557 | Helper.DeleteIfExists(slnFile); | 571 | Helper.DeleteIfExists(slnFile); |
558 | 572 | ||
559 | foreach(ProjectNode project in solution.Projects) | 573 | foreach(ProjectNode project in solution.Projects) |
560 | { | 574 | { |
561 | CleanProject(project); | 575 | CleanProject(project); |
562 | } | 576 | } |
563 | 577 | ||
564 | m_Kernel.Log.Write(""); | 578 | m_Kernel.Log.Write(""); |
565 | } | 579 | } |
566 | 580 | ||
567 | #endregion | 581 | #endregion |
568 | 582 | ||
569 | #region ITarget Members | 583 | #region ITarget Members |
570 | 584 | ||
571 | /// <summary> | 585 | /// <summary> |
572 | /// Writes the specified kern. | 586 | /// Writes the specified kern. |
573 | /// </summary> | 587 | /// </summary> |
574 | /// <param name="kern">The kern.</param> | 588 | /// <param name="kern">The kern.</param> |
575 | public void Write(Kernel kern) | 589 | public void Write(Kernel kern) |
576 | { | 590 | { |
577 | if( kern == null ) | 591 | if( kern == null ) |
578 | { | 592 | { |
579 | throw new ArgumentNullException("kern"); | 593 | throw new ArgumentNullException("kern"); |
580 | } | 594 | } |
581 | m_Kernel = kern; | 595 | m_Kernel = kern; |
582 | foreach(SolutionNode solution in kern.Solutions) | 596 | foreach(SolutionNode solution in kern.Solutions) |
583 | { | 597 | { |
584 | WriteCombine(solution); | 598 | WriteCombine(solution); |
585 | } | 599 | } |
586 | m_Kernel = null; | 600 | m_Kernel = null; |
587 | } | 601 | } |
588 | 602 | ||
589 | /// <summary> | 603 | /// <summary> |
590 | /// Cleans the specified kern. | 604 | /// Cleans the specified kern. |
591 | /// </summary> | 605 | /// </summary> |
592 | /// <param name="kern">The kern.</param> | 606 | /// <param name="kern">The kern.</param> |
593 | public virtual void Clean(Kernel kern) | 607 | public virtual void Clean(Kernel kern) |
594 | { | 608 | { |
595 | if( kern == null ) | 609 | if( kern == null ) |
596 | { | 610 | { |
597 | throw new ArgumentNullException("kern"); | 611 | throw new ArgumentNullException("kern"); |
598 | } | 612 | } |
599 | m_Kernel = kern; | 613 | m_Kernel = kern; |
600 | foreach(SolutionNode sol in kern.Solutions) | 614 | foreach(SolutionNode sol in kern.Solutions) |
601 | { | 615 | { |
602 | CleanSolution(sol); | 616 | CleanSolution(sol); |
603 | } | 617 | } |
604 | m_Kernel = null; | 618 | m_Kernel = null; |
605 | } | 619 | } |
606 | 620 | ||
607 | /// <summary> | 621 | /// <summary> |
608 | /// Gets the name. | 622 | /// Gets the name. |
609 | /// </summary> | 623 | /// </summary> |
610 | /// <value>The name.</value> | 624 | /// <value>The name.</value> |
611 | public string Name | 625 | public string Name |
612 | { | 626 | { |
613 | get | 627 | get |
614 | { | 628 | { |
615 | return "nant"; | 629 | return "nant"; |
616 | } | 630 | } |
617 | } | 631 | } |
618 | 632 | ||
619 | #endregion | 633 | #endregion |
620 | } | 634 | } |
621 | } | 635 | } |