diff options
author | Sean Dague | 2007-07-16 15:40:11 +0000 |
---|---|---|
committer | Sean Dague | 2007-07-16 15:40:11 +0000 |
commit | 2a3c79df83e800d5dfe75a1a3b140ed81da2b1d6 (patch) | |
tree | e3f80ad51736cf17e856547b1bcf956010927434 /Prebuild/src/Core/Targets | |
parent | *Trunk compiles now (diff) | |
download | opensim-SC_OLD-2a3c79df83e800d5dfe75a1a3b140ed81da2b1d6.zip opensim-SC_OLD-2a3c79df83e800d5dfe75a1a3b140ed81da2b1d6.tar.gz opensim-SC_OLD-2a3c79df83e800d5dfe75a1a3b140ed81da2b1d6.tar.bz2 opensim-SC_OLD-2a3c79df83e800d5dfe75a1a3b140ed81da2b1d6.tar.xz |
changed to native line ending encoding
Diffstat (limited to 'Prebuild/src/Core/Targets')
-rw-r--r-- | Prebuild/src/Core/Targets/AutotoolsTarget.cs | 1852 | ||||
-rw-r--r-- | Prebuild/src/Core/Targets/DebugTarget.cs | 204 | ||||
-rw-r--r-- | Prebuild/src/Core/Targets/MonoDevelopTarget.cs | 916 | ||||
-rw-r--r-- | Prebuild/src/Core/Targets/NAntTarget.cs | 1242 | ||||
-rw-r--r-- | Prebuild/src/Core/Targets/SharpDevelop2Target.cs | 180 | ||||
-rw-r--r-- | Prebuild/src/Core/Targets/SharpDevelopTarget.cs | 874 | ||||
-rw-r--r-- | Prebuild/src/Core/Targets/VS2002Target.cs | 192 | ||||
-rw-r--r-- | Prebuild/src/Core/Targets/VS2003Target.cs | 1266 | ||||
-rw-r--r-- | Prebuild/src/Core/Targets/VS2005Target.cs | 1766 |
9 files changed, 4246 insertions, 4246 deletions
diff --git a/Prebuild/src/Core/Targets/AutotoolsTarget.cs b/Prebuild/src/Core/Targets/AutotoolsTarget.cs index 2b4a678..cf575e3 100644 --- a/Prebuild/src/Core/Targets/AutotoolsTarget.cs +++ b/Prebuild/src/Core/Targets/AutotoolsTarget.cs | |||
@@ -1,926 +1,926 @@ | |||
1 | #region BSD License | 1 | #region BSD License |
2 | /* | 2 | /* |
3 | 3 | ||
4 | Copyright (c) 2004 - 2006 | 4 | Copyright (c) 2004 - 2006 |
5 | Matthew Holmes (matthew@wildfiregames.com), | 5 | Matthew Holmes (matthew@wildfiregames.com), |
6 | Dan Moorehead (dan05a@gmail.com), | 6 | Dan Moorehead (dan05a@gmail.com), |
7 | Dave Hudson (jendave@yahoo.com), | 7 | Dave Hudson (jendave@yahoo.com), |
8 | C.J. Adams-Collier (cjcollier@colliertech.org), | 8 | C.J. Adams-Collier (cjcollier@colliertech.org), |
9 | 9 | ||
10 | Redistribution and use in source and binary forms, with or without | 10 | Redistribution and use in source and binary forms, with or without |
11 | modification, are permitted provided that the following conditions are | 11 | modification, are permitted provided that the following conditions are |
12 | met: | 12 | met: |
13 | 13 | ||
14 | * Redistributions of source code must retain the above copyright | 14 | * Redistributions of source code must retain the above copyright |
15 | notice, this list of conditions and the following disclaimer. | 15 | notice, this list of conditions and the following disclaimer. |
16 | 16 | ||
17 | * Redistributions in binary form must reproduce the above copyright | 17 | * Redistributions in binary form must reproduce the above copyright |
18 | notice, this list of conditions and the following disclaimer in the | 18 | notice, this list of conditions and the following disclaimer in the |
19 | documentation and/or other materials provided with the distribution. | 19 | documentation and/or other materials provided with the distribution. |
20 | 20 | ||
21 | * The name of the author may not be used to endorse or promote | 21 | * The name of the author may not be used to endorse or promote |
22 | products derived from this software without specific prior written | 22 | products derived from this software without specific prior written |
23 | permission. | 23 | permission. |
24 | 24 | ||
25 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | 25 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
26 | IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 26 | IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
27 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 27 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
28 | DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, | 28 | DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, |
29 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 29 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
30 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | 30 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
31 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | 31 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
32 | HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | 32 | HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, |
33 | STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | 33 | STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING |
34 | IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | 34 | IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
35 | POSSIBILITY OF SUCH DAMAGE. | 35 | POSSIBILITY OF SUCH DAMAGE. |
36 | 36 | ||
37 | */ | 37 | */ |
38 | #endregion | 38 | #endregion |
39 | 39 | ||
40 | #region CVS Information | 40 | #region CVS Information |
41 | /* | 41 | /* |
42 | * $Source$ | 42 | * $Source$ |
43 | * $Author: jendave $ | 43 | * $Author: jendave $ |
44 | * $Date: 2006-07-28 22:43:24 -0700 (Fri, 28 Jul 2006) $ | 44 | * $Date: 2006-07-28 22:43:24 -0700 (Fri, 28 Jul 2006) $ |
45 | * $Revision: 136 $ | 45 | * $Revision: 136 $ |
46 | */ | 46 | */ |
47 | #endregion | 47 | #endregion |
48 | 48 | ||
49 | using System; | 49 | using System; |
50 | using System.Collections; | 50 | using System.Collections; |
51 | using System.Collections.Specialized; | 51 | using System.Collections.Specialized; |
52 | using System.IO; | 52 | using System.IO; |
53 | using System.Reflection; | 53 | using System.Reflection; |
54 | using System.Text; | 54 | using System.Text; |
55 | using System.Text.RegularExpressions; | 55 | using System.Text.RegularExpressions; |
56 | 56 | ||
57 | using Prebuild.Core.Attributes; | 57 | using Prebuild.Core.Attributes; |
58 | using Prebuild.Core.Interfaces; | 58 | using Prebuild.Core.Interfaces; |
59 | using Prebuild.Core.Nodes; | 59 | using Prebuild.Core.Nodes; |
60 | using Prebuild.Core.Parse; | 60 | using Prebuild.Core.Parse; |
61 | using Prebuild.Core.Utilities; | 61 | using Prebuild.Core.Utilities; |
62 | 62 | ||
63 | namespace Prebuild.Core.Targets | 63 | namespace Prebuild.Core.Targets |
64 | { | 64 | { |
65 | /// <summary> | 65 | /// <summary> |
66 | /// | 66 | /// |
67 | /// </summary> | 67 | /// </summary> |
68 | [Target("autotools")] | 68 | [Target("autotools")] |
69 | public class AutotoolsTarget : ITarget | 69 | public class AutotoolsTarget : ITarget |
70 | { | 70 | { |
71 | #region Fields | 71 | #region Fields |
72 | 72 | ||
73 | private Kernel m_Kernel; | 73 | private Kernel m_Kernel; |
74 | 74 | ||
75 | #endregion | 75 | #endregion |
76 | 76 | ||
77 | #region Private Methods | 77 | #region Private Methods |
78 | 78 | ||
79 | private static string PrependPath(string path) | 79 | private static string PrependPath(string path) |
80 | { | 80 | { |
81 | string tmpPath = Helper.NormalizePath(path, '/'); | 81 | string tmpPath = Helper.NormalizePath(path, '/'); |
82 | Regex regex = new Regex(@"(\w):/(\w+)"); | 82 | Regex regex = new Regex(@"(\w):/(\w+)"); |
83 | Match match = regex.Match(tmpPath); | 83 | Match match = regex.Match(tmpPath); |
84 | if(match.Success || tmpPath[0] == '.' || tmpPath[0] == '/') | 84 | if(match.Success || tmpPath[0] == '.' || tmpPath[0] == '/') |
85 | { | 85 | { |
86 | tmpPath = Helper.NormalizePath(tmpPath); | 86 | tmpPath = Helper.NormalizePath(tmpPath); |
87 | } | 87 | } |
88 | else | 88 | else |
89 | { | 89 | { |
90 | tmpPath = Helper.NormalizePath("./" + tmpPath); | 90 | tmpPath = Helper.NormalizePath("./" + tmpPath); |
91 | } | 91 | } |
92 | 92 | ||
93 | return tmpPath; | 93 | return tmpPath; |
94 | } | 94 | } |
95 | 95 | ||
96 | private static string BuildReference(SolutionNode solution, ReferenceNode refr) | 96 | private static string BuildReference(SolutionNode solution, ReferenceNode refr) |
97 | { | 97 | { |
98 | string ret = ""; | 98 | string ret = ""; |
99 | if(solution.ProjectsTable.ContainsKey(refr.Name)) | 99 | if(solution.ProjectsTable.ContainsKey(refr.Name)) |
100 | { | 100 | { |
101 | ProjectNode project = (ProjectNode)solution.ProjectsTable[refr.Name]; | 101 | ProjectNode project = (ProjectNode)solution.ProjectsTable[refr.Name]; |
102 | string fileRef = FindFileReference(refr.Name, project); | 102 | string fileRef = FindFileReference(refr.Name, project); |
103 | string finalPath = Helper.NormalizePath(Helper.MakeFilePath(project.FullPath + "/$(BUILD_DIR)/$(CONFIG)/", refr.Name, "dll"), '/'); | 103 | string finalPath = Helper.NormalizePath(Helper.MakeFilePath(project.FullPath + "/$(BUILD_DIR)/$(CONFIG)/", refr.Name, "dll"), '/'); |
104 | ret += finalPath; | 104 | ret += finalPath; |
105 | return ret; | 105 | return ret; |
106 | } | 106 | } |
107 | else | 107 | else |
108 | { | 108 | { |
109 | ProjectNode project = (ProjectNode)refr.Parent; | 109 | ProjectNode project = (ProjectNode)refr.Parent; |
110 | string fileRef = FindFileReference(refr.Name, project); | 110 | string fileRef = FindFileReference(refr.Name, project); |
111 | 111 | ||
112 | if(refr.Path != null || fileRef != null) | 112 | if(refr.Path != null || fileRef != null) |
113 | { | 113 | { |
114 | string finalPath = (refr.Path != null) ? Helper.NormalizePath(refr.Path + "/" + refr.Name + ".dll", '/') : fileRef; | 114 | string finalPath = (refr.Path != null) ? Helper.NormalizePath(refr.Path + "/" + refr.Name + ".dll", '/') : fileRef; |
115 | ret += Path.Combine(project.Path, finalPath); | 115 | ret += Path.Combine(project.Path, finalPath); |
116 | return ret; | 116 | return ret; |
117 | } | 117 | } |
118 | 118 | ||
119 | try | 119 | try |
120 | { | 120 | { |
121 | //Assembly assem = Assembly.Load(refr.Name); | 121 | //Assembly assem = Assembly.Load(refr.Name); |
122 | //if (assem != null) | 122 | //if (assem != null) |
123 | //{ | 123 | //{ |
124 | // int index = refr.Name.IndexOf(","); | 124 | // int index = refr.Name.IndexOf(","); |
125 | // if ( index > 0) | 125 | // if ( index > 0) |
126 | // { | 126 | // { |
127 | // ret += assem.Location; | 127 | // ret += assem.Location; |
128 | // //Console.WriteLine("Location1: " + assem.Location); | 128 | // //Console.WriteLine("Location1: " + assem.Location); |
129 | // } | 129 | // } |
130 | // else | 130 | // else |
131 | // { | 131 | // { |
132 | // ret += (refr.Name + ".dll"); | 132 | // ret += (refr.Name + ".dll"); |
133 | // //Console.WriteLine("Location2: " + assem.Location); | 133 | // //Console.WriteLine("Location2: " + assem.Location); |
134 | // } | 134 | // } |
135 | //} | 135 | //} |
136 | //else | 136 | //else |
137 | //{ | 137 | //{ |
138 | int index = refr.Name.IndexOf(","); | 138 | int index = refr.Name.IndexOf(","); |
139 | if ( index > 0) | 139 | if ( index > 0) |
140 | { | 140 | { |
141 | ret += refr.Name.Substring(0, index) + ".dll"; | 141 | ret += refr.Name.Substring(0, index) + ".dll"; |
142 | //Console.WriteLine("Location3: " + assem.Location); | 142 | //Console.WriteLine("Location3: " + assem.Location); |
143 | } | 143 | } |
144 | else | 144 | else |
145 | { | 145 | { |
146 | ret += (refr.Name + ".dll"); | 146 | ret += (refr.Name + ".dll"); |
147 | //Console.WriteLine("Location4: " + assem.Location); | 147 | //Console.WriteLine("Location4: " + assem.Location); |
148 | } | 148 | } |
149 | //} | 149 | //} |
150 | } | 150 | } |
151 | catch (System.NullReferenceException e) | 151 | catch (System.NullReferenceException e) |
152 | { | 152 | { |
153 | e.ToString(); | 153 | e.ToString(); |
154 | int index = refr.Name.IndexOf(","); | 154 | int index = refr.Name.IndexOf(","); |
155 | if ( index > 0) | 155 | if ( index > 0) |
156 | { | 156 | { |
157 | ret += refr.Name.Substring(0, index) + ".dll"; | 157 | ret += refr.Name.Substring(0, index) + ".dll"; |
158 | //Console.WriteLine("Location5: " + assem.Location); | 158 | //Console.WriteLine("Location5: " + assem.Location); |
159 | } | 159 | } |
160 | else | 160 | else |
161 | { | 161 | { |
162 | ret += (refr.Name + ".dll"); | 162 | ret += (refr.Name + ".dll"); |
163 | //Console.WriteLine("Location6: " + assem.Location); | 163 | //Console.WriteLine("Location6: " + assem.Location); |
164 | } | 164 | } |
165 | } | 165 | } |
166 | } | 166 | } |
167 | return ret; | 167 | return ret; |
168 | } | 168 | } |
169 | 169 | ||
170 | private static string BuildReferencePath(SolutionNode solution, ReferenceNode refr) | 170 | private static string BuildReferencePath(SolutionNode solution, ReferenceNode refr) |
171 | { | 171 | { |
172 | string ret = ""; | 172 | string ret = ""; |
173 | if(solution.ProjectsTable.ContainsKey(refr.Name)) | 173 | if(solution.ProjectsTable.ContainsKey(refr.Name)) |
174 | { | 174 | { |
175 | ProjectNode project = (ProjectNode)solution.ProjectsTable[refr.Name]; | 175 | ProjectNode project = (ProjectNode)solution.ProjectsTable[refr.Name]; |
176 | string finalPath = Helper.NormalizePath(Helper.MakeReferencePath(project.FullPath + "/${build.dir}/"), '/'); | 176 | string finalPath = Helper.NormalizePath(Helper.MakeReferencePath(project.FullPath + "/${build.dir}/"), '/'); |
177 | ret += finalPath; | 177 | ret += finalPath; |
178 | return ret; | 178 | return ret; |
179 | } | 179 | } |
180 | else | 180 | else |
181 | { | 181 | { |
182 | ProjectNode project = (ProjectNode)refr.Parent; | 182 | ProjectNode project = (ProjectNode)refr.Parent; |
183 | string fileRef = FindFileReference(refr.Name, project); | 183 | string fileRef = FindFileReference(refr.Name, project); |
184 | 184 | ||
185 | 185 | ||
186 | if(refr.Path != null || fileRef != null) | 186 | if(refr.Path != null || fileRef != null) |
187 | { | 187 | { |
188 | string finalPath = (refr.Path != null) ? Helper.NormalizePath(refr.Path, '/') : fileRef; | 188 | string finalPath = (refr.Path != null) ? Helper.NormalizePath(refr.Path, '/') : fileRef; |
189 | ret += finalPath; | 189 | ret += finalPath; |
190 | return ret; | 190 | return ret; |
191 | } | 191 | } |
192 | 192 | ||
193 | try | 193 | try |
194 | { | 194 | { |
195 | Assembly assem = Assembly.Load(refr.Name); | 195 | Assembly assem = Assembly.Load(refr.Name); |
196 | if (assem != null) | 196 | if (assem != null) |
197 | { | 197 | { |
198 | ret += ""; | 198 | ret += ""; |
199 | } | 199 | } |
200 | else | 200 | else |
201 | { | 201 | { |
202 | ret += ""; | 202 | ret += ""; |
203 | } | 203 | } |
204 | } | 204 | } |
205 | catch (System.NullReferenceException e) | 205 | catch (System.NullReferenceException e) |
206 | { | 206 | { |
207 | e.ToString(); | 207 | e.ToString(); |
208 | ret += ""; | 208 | ret += ""; |
209 | } | 209 | } |
210 | } | 210 | } |
211 | return ret; | 211 | return ret; |
212 | } | 212 | } |
213 | 213 | ||
214 | private static string FindFileReference(string refName, ProjectNode project) | 214 | private static string FindFileReference(string refName, ProjectNode project) |
215 | { | 215 | { |
216 | foreach(ReferencePathNode refPath in project.ReferencePaths) | 216 | foreach(ReferencePathNode refPath in project.ReferencePaths) |
217 | { | 217 | { |
218 | string fullPath = Helper.MakeFilePath(refPath.Path, refName, "dll"); | 218 | string fullPath = Helper.MakeFilePath(refPath.Path, refName, "dll"); |
219 | 219 | ||
220 | if(File.Exists(fullPath)) | 220 | if(File.Exists(fullPath)) |
221 | { | 221 | { |
222 | return fullPath; | 222 | return fullPath; |
223 | } | 223 | } |
224 | } | 224 | } |
225 | 225 | ||
226 | return null; | 226 | return null; |
227 | } | 227 | } |
228 | 228 | ||
229 | /// <summary> | 229 | /// <summary> |
230 | /// Gets the XML doc file. | 230 | /// Gets the XML doc file. |
231 | /// </summary> | 231 | /// </summary> |
232 | /// <param name="project">The project.</param> | 232 | /// <param name="project">The project.</param> |
233 | /// <param name="conf">The conf.</param> | 233 | /// <param name="conf">The conf.</param> |
234 | /// <returns></returns> | 234 | /// <returns></returns> |
235 | public static string GetXmlDocFile(ProjectNode project, ConfigurationNode conf) | 235 | public static string GetXmlDocFile(ProjectNode project, ConfigurationNode conf) |
236 | { | 236 | { |
237 | if( conf == null ) | 237 | if( conf == null ) |
238 | { | 238 | { |
239 | throw new ArgumentNullException("conf"); | 239 | throw new ArgumentNullException("conf"); |
240 | } | 240 | } |
241 | if( project == null ) | 241 | if( project == null ) |
242 | { | 242 | { |
243 | throw new ArgumentNullException("project"); | 243 | throw new ArgumentNullException("project"); |
244 | } | 244 | } |
245 | string docFile = (string)conf.Options["XmlDocFile"]; | 245 | string docFile = (string)conf.Options["XmlDocFile"]; |
246 | // if(docFile != null && docFile.Length == 0)//default to assembly name if not specified | 246 | // if(docFile != null && docFile.Length == 0)//default to assembly name if not specified |
247 | // { | 247 | // { |
248 | // return Path.GetFileNameWithoutExtension(project.AssemblyName) + ".xml"; | 248 | // return Path.GetFileNameWithoutExtension(project.AssemblyName) + ".xml"; |
249 | // } | 249 | // } |
250 | return docFile; | 250 | return docFile; |
251 | } | 251 | } |
252 | 252 | ||
253 | /// <summary> | 253 | /// <summary> |
254 | /// Normalizes the path. | 254 | /// Normalizes the path. |
255 | /// </summary> | 255 | /// </summary> |
256 | /// <param name="path">The path.</param> | 256 | /// <param name="path">The path.</param> |
257 | /// <returns></returns> | 257 | /// <returns></returns> |
258 | public static string NormalizePath(string path) | 258 | public static string NormalizePath(string path) |
259 | { | 259 | { |
260 | if(path == null) | 260 | if(path == null) |
261 | { | 261 | { |
262 | return ""; | 262 | return ""; |
263 | } | 263 | } |
264 | 264 | ||
265 | StringBuilder tmpPath; | 265 | StringBuilder tmpPath; |
266 | 266 | ||
267 | if (Core.Parse.Preprocessor.GetOS() == "Win32") | 267 | if (Core.Parse.Preprocessor.GetOS() == "Win32") |
268 | { | 268 | { |
269 | tmpPath = new StringBuilder(path.Replace('\\', '/')); | 269 | tmpPath = new StringBuilder(path.Replace('\\', '/')); |
270 | tmpPath.Replace("/", @"\\"); | 270 | tmpPath.Replace("/", @"\\"); |
271 | } | 271 | } |
272 | else | 272 | else |
273 | { | 273 | { |
274 | tmpPath = new StringBuilder(path.Replace('\\', '/')); | 274 | tmpPath = new StringBuilder(path.Replace('\\', '/')); |
275 | tmpPath = tmpPath.Replace('/', Path.DirectorySeparatorChar); | 275 | tmpPath = tmpPath.Replace('/', Path.DirectorySeparatorChar); |
276 | } | 276 | } |
277 | return tmpPath.ToString(); | 277 | return tmpPath.ToString(); |
278 | } | 278 | } |
279 | 279 | ||
280 | private void WriteProject(SolutionNode solution, ProjectNode project) | 280 | private void WriteProject(SolutionNode solution, ProjectNode project) |
281 | { | 281 | { |
282 | string projFile = Helper.MakeFilePath(project.FullPath, "Include", "am"); | 282 | string projFile = Helper.MakeFilePath(project.FullPath, "Include", "am"); |
283 | StreamWriter ss = new StreamWriter(projFile); | 283 | StreamWriter ss = new StreamWriter(projFile); |
284 | ss.NewLine = "\n"; | 284 | ss.NewLine = "\n"; |
285 | 285 | ||
286 | m_Kernel.CurrentWorkingDirectory.Push(); | 286 | m_Kernel.CurrentWorkingDirectory.Push(); |
287 | Helper.SetCurrentDir(Path.GetDirectoryName(projFile)); | 287 | Helper.SetCurrentDir(Path.GetDirectoryName(projFile)); |
288 | 288 | ||
289 | using(ss) | 289 | using(ss) |
290 | { | 290 | { |
291 | ss.WriteLine(Helper.AssemblyFullName(project.AssemblyName, project.Type) + ":"); | 291 | ss.WriteLine(Helper.AssemblyFullName(project.AssemblyName, project.Type) + ":"); |
292 | ss.WriteLine("\tmkdir -p " + Helper.MakePathRelativeTo(solution.FullPath, project.Path) + "/$(BUILD_DIR)/$(CONFIG)/"); | 292 | ss.WriteLine("\tmkdir -p " + Helper.MakePathRelativeTo(solution.FullPath, project.Path) + "/$(BUILD_DIR)/$(CONFIG)/"); |
293 | foreach(string file in project.Files) | 293 | foreach(string file in project.Files) |
294 | { | 294 | { |
295 | if (project.Files.GetSubType(file) != SubType.Code && project.Files.GetSubType(file) != SubType.Settings) | 295 | if (project.Files.GetSubType(file) != SubType.Code && project.Files.GetSubType(file) != SubType.Settings) |
296 | { | 296 | { |
297 | ss.Write("\tresgen "); | 297 | ss.Write("\tresgen "); |
298 | ss.Write(Helper.NormalizePath(Path.Combine(project.Path, file.Substring(0, file.LastIndexOf('.')) + ".resx "), '/')); | 298 | ss.Write(Helper.NormalizePath(Path.Combine(project.Path, file.Substring(0, file.LastIndexOf('.')) + ".resx "), '/')); |
299 | if (project.Files.GetResourceName(file) != "") | 299 | if (project.Files.GetResourceName(file) != "") |
300 | { | 300 | { |
301 | ss.WriteLine(Helper.NormalizePath(Path.Combine(project.Path, project.RootNamespace + "." + project.Files.GetResourceName(file) + ".resources"), '/')); | 301 | ss.WriteLine(Helper.NormalizePath(Path.Combine(project.Path, project.RootNamespace + "." + project.Files.GetResourceName(file) + ".resources"), '/')); |
302 | } | 302 | } |
303 | else | 303 | else |
304 | { | 304 | { |
305 | ss.WriteLine(Helper.NormalizePath(Path.Combine(project.Path, project.RootNamespace + "." + file.Substring(0, file.LastIndexOf('.')) + ".resources"), '/')); | 305 | ss.WriteLine(Helper.NormalizePath(Path.Combine(project.Path, project.RootNamespace + "." + file.Substring(0, file.LastIndexOf('.')) + ".resources"), '/')); |
306 | } | 306 | } |
307 | } | 307 | } |
308 | } | 308 | } |
309 | ss.WriteLine("\t$(CSC)\t/out:" + Helper.MakePathRelativeTo(solution.FullPath, project.Path) + "/$(BUILD_DIR)/$(CONFIG)/" + Helper.AssemblyFullName(project.AssemblyName, project.Type) + " \\"); | 309 | ss.WriteLine("\t$(CSC)\t/out:" + Helper.MakePathRelativeTo(solution.FullPath, project.Path) + "/$(BUILD_DIR)/$(CONFIG)/" + Helper.AssemblyFullName(project.AssemblyName, project.Type) + " \\"); |
310 | ss.WriteLine("\t\t/target:" + project.Type.ToString().ToLower() + " \\"); | 310 | ss.WriteLine("\t\t/target:" + project.Type.ToString().ToLower() + " \\"); |
311 | if (project.References.Count > 0) | 311 | if (project.References.Count > 0) |
312 | { | 312 | { |
313 | ss.Write("\t\t/reference:"); | 313 | ss.Write("\t\t/reference:"); |
314 | bool firstref = true; | 314 | bool firstref = true; |
315 | foreach(ReferenceNode refr in project.References) | 315 | foreach(ReferenceNode refr in project.References) |
316 | { | 316 | { |
317 | if (firstref) | 317 | if (firstref) |
318 | { | 318 | { |
319 | firstref = false; | 319 | firstref = false; |
320 | } | 320 | } |
321 | else | 321 | else |
322 | { | 322 | { |
323 | ss.Write(","); | 323 | ss.Write(","); |
324 | } | 324 | } |
325 | ss.Write("{0}", Helper.NormalizePath(Helper.MakePathRelativeTo(solution.FullPath, BuildReference(solution, refr)), '/')); | 325 | ss.Write("{0}", Helper.NormalizePath(Helper.MakePathRelativeTo(solution.FullPath, BuildReference(solution, refr)), '/')); |
326 | } | 326 | } |
327 | ss.WriteLine(" \\"); | 327 | ss.WriteLine(" \\"); |
328 | } | 328 | } |
329 | //ss.WriteLine("\t\tProperties/AssemblyInfo.cs \\"); | 329 | //ss.WriteLine("\t\tProperties/AssemblyInfo.cs \\"); |
330 | 330 | ||
331 | foreach(string file in project.Files) | 331 | foreach(string file in project.Files) |
332 | { | 332 | { |
333 | switch(project.Files.GetBuildAction(file)) | 333 | switch(project.Files.GetBuildAction(file)) |
334 | { | 334 | { |
335 | case BuildAction.EmbeddedResource: | 335 | case BuildAction.EmbeddedResource: |
336 | ss.Write("\t\t/resource:"); | 336 | ss.Write("\t\t/resource:"); |
337 | ss.WriteLine(Helper.NormalizePath(Path.Combine(project.Path, file), '/') + " \\"); | 337 | ss.WriteLine(Helper.NormalizePath(Path.Combine(project.Path, file), '/') + " \\"); |
338 | break; | 338 | break; |
339 | default: | 339 | default: |
340 | if (project.Files.GetSubType(file) != SubType.Code && project.Files.GetSubType(file) != SubType.Settings) | 340 | if (project.Files.GetSubType(file) != SubType.Code && project.Files.GetSubType(file) != SubType.Settings) |
341 | { | 341 | { |
342 | ss.Write("\t\t/resource:"); | 342 | ss.Write("\t\t/resource:"); |
343 | if (project.Files.GetResourceName(file) != "") | 343 | if (project.Files.GetResourceName(file) != "") |
344 | { | 344 | { |
345 | ss.WriteLine(Helper.NormalizePath(Path.Combine(project.Path, project.RootNamespace + "." + project.Files.GetResourceName(file) + ".resources"), '/') + "," + project.RootNamespace + "." + project.Files.GetResourceName(file) + ".resources" + " \\"); | 345 | ss.WriteLine(Helper.NormalizePath(Path.Combine(project.Path, project.RootNamespace + "." + project.Files.GetResourceName(file) + ".resources"), '/') + "," + project.RootNamespace + "." + project.Files.GetResourceName(file) + ".resources" + " \\"); |
346 | } | 346 | } |
347 | else | 347 | else |
348 | { | 348 | { |
349 | ss.WriteLine(Helper.NormalizePath(Path.Combine(project.Path, project.RootNamespace + "." + file.Substring(0, file.LastIndexOf('.')) + ".resources"), '/') + "," + project.RootNamespace + "." + file.Substring(0, file.LastIndexOf('.')) + ".resources" + " \\"); | 349 | ss.WriteLine(Helper.NormalizePath(Path.Combine(project.Path, project.RootNamespace + "." + file.Substring(0, file.LastIndexOf('.')) + ".resources"), '/') + "," + project.RootNamespace + "." + file.Substring(0, file.LastIndexOf('.')) + ".resources" + " \\"); |
350 | } | 350 | } |
351 | } | 351 | } |
352 | break; | 352 | break; |
353 | } | 353 | } |
354 | } | 354 | } |
355 | 355 | ||
356 | foreach(ConfigurationNode conf in project.Configurations) | 356 | foreach(ConfigurationNode conf in project.Configurations) |
357 | { | 357 | { |
358 | if (conf.Options.KeyFile !="") | 358 | if (conf.Options.KeyFile !="") |
359 | { | 359 | { |
360 | ss.WriteLine("\t\t/keyfile:" + Helper.NormalizePath(Path.Combine(project.Path, conf.Options.KeyFile), '/') + " \\"); | 360 | ss.WriteLine("\t\t/keyfile:" + Helper.NormalizePath(Path.Combine(project.Path, conf.Options.KeyFile), '/') + " \\"); |
361 | break; | 361 | break; |
362 | } | 362 | } |
363 | } | 363 | } |
364 | foreach(ConfigurationNode conf in project.Configurations) | 364 | foreach(ConfigurationNode conf in project.Configurations) |
365 | { | 365 | { |
366 | if (conf.Options.AllowUnsafe) | 366 | if (conf.Options.AllowUnsafe) |
367 | { | 367 | { |
368 | ss.WriteLine("\t\t/unsafe \\"); | 368 | ss.WriteLine("\t\t/unsafe \\"); |
369 | break; | 369 | break; |
370 | } | 370 | } |
371 | } | 371 | } |
372 | if (project.AppIcon != "") | 372 | if (project.AppIcon != "") |
373 | { | 373 | { |
374 | ss.WriteLine("\t\t/win32icon:" + Helper.NormalizePath(Path.Combine(project.Path, project.AppIcon), '/') + " \\"); | 374 | ss.WriteLine("\t\t/win32icon:" + Helper.NormalizePath(Path.Combine(project.Path, project.AppIcon), '/') + " \\"); |
375 | } | 375 | } |
376 | 376 | ||
377 | foreach(ConfigurationNode conf in project.Configurations) | 377 | foreach(ConfigurationNode conf in project.Configurations) |
378 | { | 378 | { |
379 | ss.WriteLine("\t\t/define:{0}", conf.Options.CompilerDefines.Replace(';', ',') + " \\"); | 379 | ss.WriteLine("\t\t/define:{0}", conf.Options.CompilerDefines.Replace(';', ',') + " \\"); |
380 | break; | 380 | break; |
381 | } | 381 | } |
382 | 382 | ||
383 | foreach(ConfigurationNode conf in project.Configurations) | 383 | foreach(ConfigurationNode conf in project.Configurations) |
384 | { | 384 | { |
385 | if (GetXmlDocFile(project, conf) !="") | 385 | if (GetXmlDocFile(project, conf) !="") |
386 | { | 386 | { |
387 | ss.WriteLine("\t\t/doc:" + Helper.MakePathRelativeTo(solution.FullPath, project.Path) + "/$(BUILD_DIR)/$(CONFIG)/" + project.Name + ".xml \\"); | 387 | ss.WriteLine("\t\t/doc:" + Helper.MakePathRelativeTo(solution.FullPath, project.Path) + "/$(BUILD_DIR)/$(CONFIG)/" + project.Name + ".xml \\"); |
388 | break; | 388 | break; |
389 | } | 389 | } |
390 | } | 390 | } |
391 | foreach(string file in project.Files) | 391 | foreach(string file in project.Files) |
392 | { | 392 | { |
393 | switch(project.Files.GetBuildAction(file)) | 393 | switch(project.Files.GetBuildAction(file)) |
394 | { | 394 | { |
395 | case BuildAction.Compile: | 395 | case BuildAction.Compile: |
396 | ss.WriteLine("\t\t\\"); | 396 | ss.WriteLine("\t\t\\"); |
397 | ss.Write("\t\t" + NormalizePath(Path.Combine(Helper.MakePathRelativeTo(solution.FullPath, project.Path), file))); | 397 | ss.Write("\t\t" + NormalizePath(Path.Combine(Helper.MakePathRelativeTo(solution.FullPath, project.Path), file))); |
398 | break; | 398 | break; |
399 | default: | 399 | default: |
400 | break; | 400 | break; |
401 | } | 401 | } |
402 | } | 402 | } |
403 | ss.WriteLine(); | 403 | ss.WriteLine(); |
404 | ss.WriteLine(); | 404 | ss.WriteLine(); |
405 | 405 | ||
406 | if (project.Type == ProjectType.Library) | 406 | if (project.Type == ProjectType.Library) |
407 | { | 407 | { |
408 | ss.WriteLine("install-data-local:"); | 408 | ss.WriteLine("install-data-local:"); |
409 | ss.WriteLine(" echo \"$(GACUTIL) /i bin/Release/" + project.Name + ".dll /f $(GACUTIL_FLAGS)\"; \\"); | 409 | ss.WriteLine(" echo \"$(GACUTIL) /i bin/Release/" + project.Name + ".dll /f $(GACUTIL_FLAGS)\"; \\"); |
410 | ss.WriteLine(" $(GACUTIL) /i bin/Release/" + project.Name + ".dll /f $(GACUTIL_FLAGS) || exit 1;"); | 410 | ss.WriteLine(" $(GACUTIL) /i bin/Release/" + project.Name + ".dll /f $(GACUTIL_FLAGS) || exit 1;"); |
411 | ss.WriteLine(); | 411 | ss.WriteLine(); |
412 | ss.WriteLine("uninstall-local:"); | 412 | ss.WriteLine("uninstall-local:"); |
413 | ss.WriteLine(" echo \"$(GACUTIL) /u " + project.Name + " $(GACUTIL_FLAGS)\"; \\"); | 413 | ss.WriteLine(" echo \"$(GACUTIL) /u " + project.Name + " $(GACUTIL_FLAGS)\"; \\"); |
414 | ss.WriteLine(" $(GACUTIL) /u " + project.Name + " $(GACUTIL_FLAGS) || exit 1;"); | 414 | ss.WriteLine(" $(GACUTIL) /u " + project.Name + " $(GACUTIL_FLAGS) || exit 1;"); |
415 | ss.WriteLine(); | 415 | ss.WriteLine(); |
416 | } | 416 | } |
417 | ss.WriteLine("CLEANFILES = $(BUILD_DIR)/$(CONFIG)/" + Helper.AssemblyFullName(project.AssemblyName, project.Type) + " $(BUILD_DIR)/$(CONFIG)/" + project.AssemblyName + ".mdb $(BUILD_DIR)/$(CONFIG)/" + project.AssemblyName + ".pdb " + project.AssemblyName + ".xml"); | 417 | ss.WriteLine("CLEANFILES = $(BUILD_DIR)/$(CONFIG)/" + Helper.AssemblyFullName(project.AssemblyName, project.Type) + " $(BUILD_DIR)/$(CONFIG)/" + project.AssemblyName + ".mdb $(BUILD_DIR)/$(CONFIG)/" + project.AssemblyName + ".pdb " + project.AssemblyName + ".xml"); |
418 | ss.WriteLine("EXTRA_DIST = \\"); | 418 | ss.WriteLine("EXTRA_DIST = \\"); |
419 | ss.Write(" $(FILES)"); | 419 | ss.Write(" $(FILES)"); |
420 | foreach(ConfigurationNode conf in project.Configurations) | 420 | foreach(ConfigurationNode conf in project.Configurations) |
421 | { | 421 | { |
422 | if (conf.Options.KeyFile != "") | 422 | if (conf.Options.KeyFile != "") |
423 | { | 423 | { |
424 | ss.Write(" \\"); | 424 | ss.Write(" \\"); |
425 | ss.WriteLine("\t" + conf.Options.KeyFile); | 425 | ss.WriteLine("\t" + conf.Options.KeyFile); |
426 | } | 426 | } |
427 | break; | 427 | break; |
428 | } | 428 | } |
429 | } | 429 | } |
430 | m_Kernel.CurrentWorkingDirectory.Pop(); | 430 | m_Kernel.CurrentWorkingDirectory.Pop(); |
431 | } | 431 | } |
432 | bool hasLibrary = false; | 432 | bool hasLibrary = false; |
433 | 433 | ||
434 | private void WriteCombine(SolutionNode solution) | 434 | private void WriteCombine(SolutionNode solution) |
435 | { | 435 | { |
436 | 436 | ||
437 | /* TODO: These vars should be pulled from the prebuild.xml file */ | 437 | /* TODO: These vars should be pulled from the prebuild.xml file */ |
438 | string releaseVersion = "2.0.0"; | 438 | string releaseVersion = "2.0.0"; |
439 | string assemblyVersion = "2.1.0.0"; | 439 | string assemblyVersion = "2.1.0.0"; |
440 | string description = | 440 | string description = |
441 | "Tao Framework " + solution.Name + " Binding For .NET"; | 441 | "Tao Framework " + solution.Name + " Binding For .NET"; |
442 | 442 | ||
443 | hasLibrary = false; | 443 | hasLibrary = false; |
444 | m_Kernel.Log.Write("Creating Autotools make files"); | 444 | m_Kernel.Log.Write("Creating Autotools make files"); |
445 | foreach(ProjectNode project in solution.Projects) | 445 | foreach(ProjectNode project in solution.Projects) |
446 | { | 446 | { |
447 | if(m_Kernel.AllowProject(project.FilterGroups)) | 447 | if(m_Kernel.AllowProject(project.FilterGroups)) |
448 | { | 448 | { |
449 | m_Kernel.Log.Write("...Creating makefile: {0}", project.Name); | 449 | m_Kernel.Log.Write("...Creating makefile: {0}", project.Name); |
450 | WriteProject(solution, project); | 450 | WriteProject(solution, project); |
451 | } | 451 | } |
452 | } | 452 | } |
453 | 453 | ||
454 | m_Kernel.Log.Write(""); | 454 | m_Kernel.Log.Write(""); |
455 | string combFile = Helper.MakeFilePath(solution.FullPath, "Makefile", "am"); | 455 | string combFile = Helper.MakeFilePath(solution.FullPath, "Makefile", "am"); |
456 | StreamWriter ss = new StreamWriter(combFile); | 456 | StreamWriter ss = new StreamWriter(combFile); |
457 | ss.NewLine = "\n"; | 457 | ss.NewLine = "\n"; |
458 | 458 | ||
459 | m_Kernel.CurrentWorkingDirectory.Push(); | 459 | m_Kernel.CurrentWorkingDirectory.Push(); |
460 | Helper.SetCurrentDir(Path.GetDirectoryName(combFile)); | 460 | Helper.SetCurrentDir(Path.GetDirectoryName(combFile)); |
461 | 461 | ||
462 | using(ss) | 462 | using(ss) |
463 | { | 463 | { |
464 | foreach(ProjectNode project in solution.ProjectsTableOrder) | 464 | foreach(ProjectNode project in solution.ProjectsTableOrder) |
465 | { | 465 | { |
466 | if (project.Type == ProjectType.Library) | 466 | if (project.Type == ProjectType.Library) |
467 | { | 467 | { |
468 | hasLibrary = true; | 468 | hasLibrary = true; |
469 | break; | 469 | break; |
470 | } | 470 | } |
471 | } | 471 | } |
472 | 472 | ||
473 | if (hasLibrary) | 473 | if (hasLibrary) |
474 | { | 474 | { |
475 | ss.Write("pkgconfig_in_files = "); | 475 | ss.Write("pkgconfig_in_files = "); |
476 | foreach(ProjectNode project in solution.ProjectsTableOrder) | 476 | foreach(ProjectNode project in solution.ProjectsTableOrder) |
477 | { | 477 | { |
478 | if (project.Type == ProjectType.Library) | 478 | if (project.Type == ProjectType.Library) |
479 | { | 479 | { |
480 | string combFilepc = Helper.MakeFilePath(solution.FullPath, project.Name, "pc.in"); | 480 | string combFilepc = Helper.MakeFilePath(solution.FullPath, project.Name, "pc.in"); |
481 | ss.Write(" " + project.Name + ".pc.in "); | 481 | ss.Write(" " + project.Name + ".pc.in "); |
482 | StreamWriter sspc = new StreamWriter(combFilepc); | 482 | StreamWriter sspc = new StreamWriter(combFilepc); |
483 | sspc.NewLine = "\n"; | 483 | sspc.NewLine = "\n"; |
484 | using(sspc) | 484 | using(sspc) |
485 | { | 485 | { |
486 | sspc.WriteLine("prefix=@prefix@"); | 486 | sspc.WriteLine("prefix=@prefix@"); |
487 | sspc.WriteLine("exec_prefix=${prefix}"); | 487 | sspc.WriteLine("exec_prefix=${prefix}"); |
488 | sspc.WriteLine("libdir=${exec_prefix}/lib"); | 488 | sspc.WriteLine("libdir=${exec_prefix}/lib"); |
489 | sspc.WriteLine(); | 489 | sspc.WriteLine(); |
490 | sspc.WriteLine("Name: @PACKAGE_NAME@"); | 490 | sspc.WriteLine("Name: @PACKAGE_NAME@"); |
491 | sspc.WriteLine("Description: @DESCRIPTION@"); | 491 | sspc.WriteLine("Description: @DESCRIPTION@"); |
492 | sspc.WriteLine("Version: @ASSEMBLY_VERSION@"); | 492 | sspc.WriteLine("Version: @ASSEMBLY_VERSION@"); |
493 | sspc.WriteLine("Libs: -r:${libdir}/mono/gac/@PACKAGE_NAME@/@ASSEMBLY_VERSION@__@PUBKEY@/@PACKAGE_NAME@.dll"); | 493 | sspc.WriteLine("Libs: -r:${libdir}/mono/gac/@PACKAGE_NAME@/@ASSEMBLY_VERSION@__@PUBKEY@/@PACKAGE_NAME@.dll"); |
494 | } | 494 | } |
495 | } | 495 | } |
496 | } | 496 | } |
497 | 497 | ||
498 | ss.WriteLine(); | 498 | ss.WriteLine(); |
499 | ss.WriteLine("pkgconfigdir=$(prefix)/lib/pkgconfig"); | 499 | ss.WriteLine("pkgconfigdir=$(prefix)/lib/pkgconfig"); |
500 | ss.WriteLine("pkgconfig_DATA=$(pkgconfig_in_files:.pc.in=.pc)"); | 500 | ss.WriteLine("pkgconfig_DATA=$(pkgconfig_in_files:.pc.in=.pc)"); |
501 | } | 501 | } |
502 | ss.WriteLine(); | 502 | ss.WriteLine(); |
503 | foreach(ProjectNode project in solution.ProjectsTableOrder) | 503 | foreach(ProjectNode project in solution.ProjectsTableOrder) |
504 | { | 504 | { |
505 | string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath); | 505 | string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath); |
506 | ss.WriteLine("-include x {0}", | 506 | ss.WriteLine("-include x {0}", |
507 | Helper.NormalizePath(Helper.MakeFilePath(path, "Include", "am"),'/')); | 507 | Helper.NormalizePath(Helper.MakeFilePath(path, "Include", "am"),'/')); |
508 | } | 508 | } |
509 | ss.WriteLine(); | 509 | ss.WriteLine(); |
510 | ss.WriteLine("all: \\"); | 510 | ss.WriteLine("all: \\"); |
511 | ss.Write("\t"); | 511 | ss.Write("\t"); |
512 | foreach(ProjectNode project in solution.ProjectsTableOrder) | 512 | foreach(ProjectNode project in solution.ProjectsTableOrder) |
513 | { | 513 | { |
514 | string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath); | 514 | string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath); |
515 | ss.Write(Helper.AssemblyFullName(project.AssemblyName, project.Type) + " "); | 515 | ss.Write(Helper.AssemblyFullName(project.AssemblyName, project.Type) + " "); |
516 | 516 | ||
517 | } | 517 | } |
518 | ss.WriteLine(); | 518 | ss.WriteLine(); |
519 | if (hasLibrary) | 519 | if (hasLibrary) |
520 | { | 520 | { |
521 | ss.WriteLine("EXTRA_DIST = \\"); | 521 | ss.WriteLine("EXTRA_DIST = \\"); |
522 | ss.WriteLine("\t$(pkgconfig_in_files)"); | 522 | ss.WriteLine("\t$(pkgconfig_in_files)"); |
523 | } | 523 | } |
524 | else | 524 | else |
525 | { | 525 | { |
526 | ss.WriteLine("EXTRA_DIST = "); | 526 | ss.WriteLine("EXTRA_DIST = "); |
527 | } | 527 | } |
528 | ss.WriteLine(); | 528 | ss.WriteLine(); |
529 | ss.WriteLine("DISTCLEANFILES = \\"); | 529 | ss.WriteLine("DISTCLEANFILES = \\"); |
530 | ss.WriteLine("\tconfigure \\"); | 530 | ss.WriteLine("\tconfigure \\"); |
531 | ss.WriteLine("\tMakefile.in \\"); | 531 | ss.WriteLine("\tMakefile.in \\"); |
532 | ss.WriteLine("\taclocal.m4"); | 532 | ss.WriteLine("\taclocal.m4"); |
533 | } | 533 | } |
534 | combFile = Helper.MakeFilePath(solution.FullPath, "configure", "ac"); | 534 | combFile = Helper.MakeFilePath(solution.FullPath, "configure", "ac"); |
535 | StreamWriter ts = new StreamWriter(combFile); | 535 | StreamWriter ts = new StreamWriter(combFile); |
536 | ts.NewLine = "\n"; | 536 | ts.NewLine = "\n"; |
537 | using(ts) | 537 | using(ts) |
538 | { | 538 | { |
539 | if (this.hasLibrary) | 539 | if (this.hasLibrary) |
540 | { | 540 | { |
541 | foreach(ProjectNode project in solution.ProjectsTableOrder) | 541 | foreach(ProjectNode project in solution.ProjectsTableOrder) |
542 | { | 542 | { |
543 | if (project.Type == ProjectType.Library) | 543 | if (project.Type == ProjectType.Library) |
544 | { | 544 | { |
545 | ts.WriteLine("AC_INIT(" + project.Name + ".pc.in)"); | 545 | ts.WriteLine("AC_INIT(" + project.Name + ".pc.in)"); |
546 | break; | 546 | break; |
547 | } | 547 | } |
548 | } | 548 | } |
549 | } | 549 | } |
550 | else | 550 | else |
551 | { | 551 | { |
552 | ts.WriteLine("AC_INIT(Makefile.am)"); | 552 | ts.WriteLine("AC_INIT(Makefile.am)"); |
553 | } | 553 | } |
554 | ts.WriteLine("AC_PREREQ(2.53)"); | 554 | ts.WriteLine("AC_PREREQ(2.53)"); |
555 | ts.WriteLine("AC_CANONICAL_SYSTEM"); | 555 | ts.WriteLine("AC_CANONICAL_SYSTEM"); |
556 | 556 | ||
557 | ts.WriteLine("PACKAGE_NAME={0}", solution.Name); | 557 | ts.WriteLine("PACKAGE_NAME={0}", solution.Name); |
558 | ts.WriteLine("PACKAGE_VERSION={0}", releaseVersion); | 558 | ts.WriteLine("PACKAGE_VERSION={0}", releaseVersion); |
559 | ts.WriteLine("DESCRIPTION=\"{0}\"", description); | 559 | ts.WriteLine("DESCRIPTION=\"{0}\"", description); |
560 | ts.WriteLine("AC_SUBST(DESCRIPTION)"); | 560 | ts.WriteLine("AC_SUBST(DESCRIPTION)"); |
561 | ts.WriteLine("AM_INIT_AUTOMAKE([$PACKAGE_NAME],[$PACKAGE_VERSION],[$DESCRIPTION])"); | 561 | ts.WriteLine("AM_INIT_AUTOMAKE([$PACKAGE_NAME],[$PACKAGE_VERSION],[$DESCRIPTION])"); |
562 | 562 | ||
563 | ts.WriteLine("ASSEMBLY_VERSION={0}", assemblyVersion); | 563 | ts.WriteLine("ASSEMBLY_VERSION={0}", assemblyVersion); |
564 | ts.WriteLine("AC_SUBST(ASSEMBLY_VERSION)"); | 564 | ts.WriteLine("AC_SUBST(ASSEMBLY_VERSION)"); |
565 | 565 | ||
566 | ts.WriteLine("PUBKEY=`sn -t $PACKAGE_NAME.snk | grep 'Public Key Token' | awk -F: '{print $2}' | sed -e 's/^ //'`"); | 566 | ts.WriteLine("PUBKEY=`sn -t $PACKAGE_NAME.snk | grep 'Public Key Token' | awk -F: '{print $2}' | sed -e 's/^ //'`"); |
567 | ts.WriteLine("AC_SUBST(PUBKEY)"); | 567 | ts.WriteLine("AC_SUBST(PUBKEY)"); |
568 | 568 | ||
569 | ts.WriteLine(); | 569 | ts.WriteLine(); |
570 | ts.WriteLine("AM_MAINTAINER_MODE"); | 570 | ts.WriteLine("AM_MAINTAINER_MODE"); |
571 | ts.WriteLine(); | 571 | ts.WriteLine(); |
572 | ts.WriteLine("dnl AC_PROG_INTLTOOL([0.25])"); | 572 | ts.WriteLine("dnl AC_PROG_INTLTOOL([0.25])"); |
573 | ts.WriteLine(); | 573 | ts.WriteLine(); |
574 | ts.WriteLine("AC_PROG_INSTALL"); | 574 | ts.WriteLine("AC_PROG_INSTALL"); |
575 | ts.WriteLine(); | 575 | ts.WriteLine(); |
576 | ts.WriteLine("MONO_REQUIRED_VERSION=1.1"); | 576 | ts.WriteLine("MONO_REQUIRED_VERSION=1.1"); |
577 | ts.WriteLine(); | 577 | ts.WriteLine(); |
578 | ts.WriteLine("AC_MSG_CHECKING([whether we're compiling from CVS])"); | 578 | ts.WriteLine("AC_MSG_CHECKING([whether we're compiling from CVS])"); |
579 | ts.WriteLine("if test -f \"$srcdir/.cvs_version\" ; then"); | 579 | ts.WriteLine("if test -f \"$srcdir/.cvs_version\" ; then"); |
580 | ts.WriteLine(" from_cvs=yes"); | 580 | ts.WriteLine(" from_cvs=yes"); |
581 | ts.WriteLine("else"); | 581 | ts.WriteLine("else"); |
582 | ts.WriteLine(" if test -f \"$srcdir/.svn\" ; then"); | 582 | ts.WriteLine(" if test -f \"$srcdir/.svn\" ; then"); |
583 | ts.WriteLine(" from_cvs=yes"); | 583 | ts.WriteLine(" from_cvs=yes"); |
584 | ts.WriteLine(" else"); | 584 | ts.WriteLine(" else"); |
585 | ts.WriteLine(" from_cvs=no"); | 585 | ts.WriteLine(" from_cvs=no"); |
586 | ts.WriteLine(" fi"); | 586 | ts.WriteLine(" fi"); |
587 | ts.WriteLine("fi"); | 587 | ts.WriteLine("fi"); |
588 | ts.WriteLine(); | 588 | ts.WriteLine(); |
589 | ts.WriteLine("AC_MSG_RESULT($from_cvs)"); | 589 | ts.WriteLine("AC_MSG_RESULT($from_cvs)"); |
590 | ts.WriteLine(); | 590 | ts.WriteLine(); |
591 | ts.WriteLine("AC_PATH_PROG(MONO, mono)"); | 591 | ts.WriteLine("AC_PATH_PROG(MONO, mono)"); |
592 | ts.WriteLine("AC_PATH_PROG(GMCS, gmcs)"); | 592 | ts.WriteLine("AC_PATH_PROG(GMCS, gmcs)"); |
593 | ts.WriteLine("AC_PATH_PROG(GACUTIL, gacutil)"); | 593 | ts.WriteLine("AC_PATH_PROG(GACUTIL, gacutil)"); |
594 | ts.WriteLine(); | 594 | ts.WriteLine(); |
595 | ts.WriteLine("AC_MSG_CHECKING([for mono])"); | 595 | ts.WriteLine("AC_MSG_CHECKING([for mono])"); |
596 | ts.WriteLine("dnl if test \"x$MONO\" = \"x\" ; then"); | 596 | ts.WriteLine("dnl if test \"x$MONO\" = \"x\" ; then"); |
597 | ts.WriteLine("dnl AC_MSG_ERROR([Can't find \"mono\" in your PATH])"); | 597 | ts.WriteLine("dnl AC_MSG_ERROR([Can't find \"mono\" in your PATH])"); |
598 | ts.WriteLine("dnl else"); | 598 | ts.WriteLine("dnl else"); |
599 | ts.WriteLine(" AC_MSG_RESULT([found])"); | 599 | ts.WriteLine(" AC_MSG_RESULT([found])"); |
600 | ts.WriteLine("dnl fi"); | 600 | ts.WriteLine("dnl fi"); |
601 | ts.WriteLine(); | 601 | ts.WriteLine(); |
602 | ts.WriteLine("AC_MSG_CHECKING([for gmcs])"); | 602 | ts.WriteLine("AC_MSG_CHECKING([for gmcs])"); |
603 | ts.WriteLine("dnl if test \"x$GMCS\" = \"x\" ; then"); | 603 | ts.WriteLine("dnl if test \"x$GMCS\" = \"x\" ; then"); |
604 | ts.WriteLine("dnl AC_MSG_ERROR([Can't find \"gmcs\" in your PATH])"); | 604 | ts.WriteLine("dnl AC_MSG_ERROR([Can't find \"gmcs\" in your PATH])"); |
605 | ts.WriteLine("dnl else"); | 605 | ts.WriteLine("dnl else"); |
606 | ts.WriteLine(" AC_MSG_RESULT([found])"); | 606 | ts.WriteLine(" AC_MSG_RESULT([found])"); |
607 | ts.WriteLine("dnl fi"); | 607 | ts.WriteLine("dnl fi"); |
608 | ts.WriteLine(); | 608 | ts.WriteLine(); |
609 | //ts.WriteLine("AC_MSG_CHECKING([for gacutil])"); | 609 | //ts.WriteLine("AC_MSG_CHECKING([for gacutil])"); |
610 | //ts.WriteLine("if test \"x$GACUTIL\" = \"x\" ; then"); | 610 | //ts.WriteLine("if test \"x$GACUTIL\" = \"x\" ; then"); |
611 | //ts.WriteLine(" AC_MSG_ERROR([Can't find \"gacutil\" in your PATH])"); | 611 | //ts.WriteLine(" AC_MSG_ERROR([Can't find \"gacutil\" in your PATH])"); |
612 | //ts.WriteLine("else"); | 612 | //ts.WriteLine("else"); |
613 | //ts.WriteLine(" AC_MSG_RESULT([found])"); | 613 | //ts.WriteLine(" AC_MSG_RESULT([found])"); |
614 | //ts.WriteLine("fi"); | 614 | //ts.WriteLine("fi"); |
615 | ts.WriteLine(); | 615 | ts.WriteLine(); |
616 | ts.WriteLine("AC_SUBST(PATH)"); | 616 | ts.WriteLine("AC_SUBST(PATH)"); |
617 | ts.WriteLine("AC_SUBST(LD_LIBRARY_PATH)"); | 617 | ts.WriteLine("AC_SUBST(LD_LIBRARY_PATH)"); |
618 | ts.WriteLine(); | 618 | ts.WriteLine(); |
619 | ts.WriteLine("dnl CSFLAGS=\"-debug -nowarn:1574\""); | 619 | ts.WriteLine("dnl CSFLAGS=\"-debug -nowarn:1574\""); |
620 | ts.WriteLine("CSFLAGS=\"\""); | 620 | ts.WriteLine("CSFLAGS=\"\""); |
621 | ts.WriteLine("AC_SUBST(CSFLAGS)"); | 621 | ts.WriteLine("AC_SUBST(CSFLAGS)"); |
622 | ts.WriteLine(); | 622 | ts.WriteLine(); |
623 | // ts.WriteLine("AC_MSG_CHECKING(--disable-sdl argument)"); | 623 | // ts.WriteLine("AC_MSG_CHECKING(--disable-sdl argument)"); |
624 | // ts.WriteLine("AC_ARG_ENABLE(sdl,"); | 624 | // ts.WriteLine("AC_ARG_ENABLE(sdl,"); |
625 | // ts.WriteLine(" [ --disable-sdl Disable Sdl interface.],"); | 625 | // ts.WriteLine(" [ --disable-sdl Disable Sdl interface.],"); |
626 | // ts.WriteLine(" [disable_sdl=$disableval],"); | 626 | // ts.WriteLine(" [disable_sdl=$disableval],"); |
627 | // ts.WriteLine(" [disable_sdl=\"no\"])"); | 627 | // ts.WriteLine(" [disable_sdl=\"no\"])"); |
628 | // ts.WriteLine("AC_MSG_RESULT($disable_sdl)"); | 628 | // ts.WriteLine("AC_MSG_RESULT($disable_sdl)"); |
629 | // ts.WriteLine("if test \"$disable_sdl\" = \"yes\"; then"); | 629 | // ts.WriteLine("if test \"$disable_sdl\" = \"yes\"; then"); |
630 | // ts.WriteLine(" AC_DEFINE(FEAT_SDL)"); | 630 | // ts.WriteLine(" AC_DEFINE(FEAT_SDL)"); |
631 | // ts.WriteLine("fi"); | 631 | // ts.WriteLine("fi"); |
632 | ts.WriteLine(); | 632 | ts.WriteLine(); |
633 | ts.WriteLine("dnl Find pkg-config"); | 633 | ts.WriteLine("dnl Find pkg-config"); |
634 | ts.WriteLine("AC_PATH_PROG(PKGCONFIG, pkg-config, no)"); | 634 | ts.WriteLine("AC_PATH_PROG(PKGCONFIG, pkg-config, no)"); |
635 | ts.WriteLine("if test \"x$PKG_CONFIG\" = \"xno\"; then"); | 635 | ts.WriteLine("if test \"x$PKG_CONFIG\" = \"xno\"; then"); |
636 | ts.WriteLine(" AC_MSG_ERROR([You need to install pkg-config])"); | 636 | ts.WriteLine(" AC_MSG_ERROR([You need to install pkg-config])"); |
637 | ts.WriteLine("fi"); | 637 | ts.WriteLine("fi"); |
638 | ts.WriteLine(); | 638 | ts.WriteLine(); |
639 | ts.WriteLine("PKG_CHECK_MODULES(MONO_DEPENDENCY, mono >= $MONO_REQUIRED_VERSION, has_mono=true, has_mono=false)"); | 639 | ts.WriteLine("PKG_CHECK_MODULES(MONO_DEPENDENCY, mono >= $MONO_REQUIRED_VERSION, has_mono=true, has_mono=false)"); |
640 | ts.WriteLine("BUILD_DIR=\"bin\""); | 640 | ts.WriteLine("BUILD_DIR=\"bin\""); |
641 | ts.WriteLine("AC_SUBST(BUILD_DIR)"); | 641 | ts.WriteLine("AC_SUBST(BUILD_DIR)"); |
642 | ts.WriteLine("CONFIG=\"Release\""); | 642 | ts.WriteLine("CONFIG=\"Release\""); |
643 | ts.WriteLine("AC_SUBST(CONFIG)"); | 643 | ts.WriteLine("AC_SUBST(CONFIG)"); |
644 | ts.WriteLine(); | 644 | ts.WriteLine(); |
645 | ts.WriteLine("if test \"x$has_mono\" = \"xtrue\"; then"); | 645 | ts.WriteLine("if test \"x$has_mono\" = \"xtrue\"; then"); |
646 | ts.WriteLine(" AC_PATH_PROG(RUNTIME, mono, no)"); | 646 | ts.WriteLine(" AC_PATH_PROG(RUNTIME, mono, no)"); |
647 | ts.WriteLine(" AC_PATH_PROG(CSC, gmcs, no)"); | 647 | ts.WriteLine(" AC_PATH_PROG(CSC, gmcs, no)"); |
648 | ts.WriteLine(" if test `uname -s` = \"Darwin\"; then"); | 648 | ts.WriteLine(" if test `uname -s` = \"Darwin\"; then"); |
649 | ts.WriteLine(" LIB_PREFIX="); | 649 | ts.WriteLine(" LIB_PREFIX="); |
650 | ts.WriteLine(" LIB_SUFFIX=.dylib"); | 650 | ts.WriteLine(" LIB_SUFFIX=.dylib"); |
651 | ts.WriteLine(" else"); | 651 | ts.WriteLine(" else"); |
652 | ts.WriteLine(" LIB_PREFIX=.so"); | 652 | ts.WriteLine(" LIB_PREFIX=.so"); |
653 | ts.WriteLine(" LIB_SUFFIX="); | 653 | ts.WriteLine(" LIB_SUFFIX="); |
654 | ts.WriteLine(" fi"); | 654 | ts.WriteLine(" fi"); |
655 | ts.WriteLine("else"); | 655 | ts.WriteLine("else"); |
656 | ts.WriteLine(" AC_PATH_PROG(CSC, csc.exe, no)"); | 656 | ts.WriteLine(" AC_PATH_PROG(CSC, csc.exe, no)"); |
657 | ts.WriteLine(" if test x$CSC = \"xno\"; then"); | 657 | ts.WriteLine(" if test x$CSC = \"xno\"; then"); |
658 | ts.WriteLine(" AC_MSG_ERROR([You need to install either mono or .Net])"); | 658 | ts.WriteLine(" AC_MSG_ERROR([You need to install either mono or .Net])"); |
659 | ts.WriteLine(" else"); | 659 | ts.WriteLine(" else"); |
660 | ts.WriteLine(" RUNTIME="); | 660 | ts.WriteLine(" RUNTIME="); |
661 | ts.WriteLine(" LIB_PREFIX="); | 661 | ts.WriteLine(" LIB_PREFIX="); |
662 | ts.WriteLine(" LIB_SUFFIX=.dylib"); | 662 | ts.WriteLine(" LIB_SUFFIX=.dylib"); |
663 | ts.WriteLine(" fi"); | 663 | ts.WriteLine(" fi"); |
664 | ts.WriteLine("fi"); | 664 | ts.WriteLine("fi"); |
665 | ts.WriteLine(); | 665 | ts.WriteLine(); |
666 | ts.WriteLine("AC_SUBST(LIB_PREFIX)"); | 666 | ts.WriteLine("AC_SUBST(LIB_PREFIX)"); |
667 | ts.WriteLine("AC_SUBST(LIB_SUFFIX)"); | 667 | ts.WriteLine("AC_SUBST(LIB_SUFFIX)"); |
668 | ts.WriteLine(); | 668 | ts.WriteLine(); |
669 | ts.WriteLine("AC_SUBST(BASE_DEPENDENCIES_CFLAGS)"); | 669 | ts.WriteLine("AC_SUBST(BASE_DEPENDENCIES_CFLAGS)"); |
670 | ts.WriteLine("AC_SUBST(BASE_DEPENDENCIES_LIBS)"); | 670 | ts.WriteLine("AC_SUBST(BASE_DEPENDENCIES_LIBS)"); |
671 | ts.WriteLine(); | 671 | ts.WriteLine(); |
672 | ts.WriteLine("dnl Find monodoc"); | 672 | ts.WriteLine("dnl Find monodoc"); |
673 | ts.WriteLine("MONODOC_REQUIRED_VERSION=1.0"); | 673 | ts.WriteLine("MONODOC_REQUIRED_VERSION=1.0"); |
674 | ts.WriteLine("AC_SUBST(MONODOC_REQUIRED_VERSION)"); | 674 | ts.WriteLine("AC_SUBST(MONODOC_REQUIRED_VERSION)"); |
675 | ts.WriteLine("PKG_CHECK_MODULES(MONODOC_DEPENDENCY, monodoc >= $MONODOC_REQUIRED_VERSION, enable_monodoc=yes, enable_monodoc=no)"); | 675 | ts.WriteLine("PKG_CHECK_MODULES(MONODOC_DEPENDENCY, monodoc >= $MONODOC_REQUIRED_VERSION, enable_monodoc=yes, enable_monodoc=no)"); |
676 | ts.WriteLine(); | 676 | ts.WriteLine(); |
677 | ts.WriteLine("if test \"x$enable_monodoc\" = \"xyes\"; then"); | 677 | ts.WriteLine("if test \"x$enable_monodoc\" = \"xyes\"; then"); |
678 | ts.WriteLine(" AC_PATH_PROG(MONODOC, monodoc, no)"); | 678 | ts.WriteLine(" AC_PATH_PROG(MONODOC, monodoc, no)"); |
679 | ts.WriteLine(" if test x$MONODOC = xno; then"); | 679 | ts.WriteLine(" if test x$MONODOC = xno; then"); |
680 | ts.WriteLine(" enable_monodoc=no"); | 680 | ts.WriteLine(" enable_monodoc=no"); |
681 | ts.WriteLine(" fi"); | 681 | ts.WriteLine(" fi"); |
682 | ts.WriteLine("else"); | 682 | ts.WriteLine("else"); |
683 | ts.WriteLine(" MONODOC="); | 683 | ts.WriteLine(" MONODOC="); |
684 | ts.WriteLine("fi"); | 684 | ts.WriteLine("fi"); |
685 | ts.WriteLine(); | 685 | ts.WriteLine(); |
686 | ts.WriteLine("AC_SUBST(MONODOC)"); | 686 | ts.WriteLine("AC_SUBST(MONODOC)"); |
687 | ts.WriteLine("AM_CONDITIONAL(ENABLE_MONODOC, test \"x$enable_monodoc\" = \"xyes\")"); | 687 | ts.WriteLine("AM_CONDITIONAL(ENABLE_MONODOC, test \"x$enable_monodoc\" = \"xyes\")"); |
688 | ts.WriteLine(); | 688 | ts.WriteLine(); |
689 | ts.WriteLine("AC_PATH_PROG(GACUTIL, gacutil, no)"); | 689 | ts.WriteLine("AC_PATH_PROG(GACUTIL, gacutil, no)"); |
690 | ts.WriteLine("if test \"x$GACUTIL\" = \"xno\" ; then"); | 690 | ts.WriteLine("if test \"x$GACUTIL\" = \"xno\" ; then"); |
691 | ts.WriteLine(" AC_MSG_ERROR([No gacutil tool found])"); | 691 | ts.WriteLine(" AC_MSG_ERROR([No gacutil tool found])"); |
692 | ts.WriteLine("fi"); | 692 | ts.WriteLine("fi"); |
693 | ts.WriteLine(); | 693 | ts.WriteLine(); |
694 | // foreach(ProjectNode project in solution.ProjectsTableOrder) | 694 | // foreach(ProjectNode project in solution.ProjectsTableOrder) |
695 | // { | 695 | // { |
696 | // if (project.Type == ProjectType.Library) | 696 | // if (project.Type == ProjectType.Library) |
697 | // { | 697 | // { |
698 | // } | 698 | // } |
699 | // } | 699 | // } |
700 | ts.WriteLine("GACUTIL_FLAGS='/package $(PACKAGE_NAME) /gacdir $(DESTDIR)$(prefix)'"); | 700 | ts.WriteLine("GACUTIL_FLAGS='/package $(PACKAGE_NAME) /gacdir $(DESTDIR)$(prefix)'"); |
701 | ts.WriteLine("AC_SUBST(GACUTIL_FLAGS)"); | 701 | ts.WriteLine("AC_SUBST(GACUTIL_FLAGS)"); |
702 | ts.WriteLine(); | 702 | ts.WriteLine(); |
703 | ts.WriteLine("winbuild=no"); | 703 | ts.WriteLine("winbuild=no"); |
704 | ts.WriteLine("case \"$host\" in"); | 704 | ts.WriteLine("case \"$host\" in"); |
705 | ts.WriteLine(" *-*-mingw*|*-*-cygwin*)"); | 705 | ts.WriteLine(" *-*-mingw*|*-*-cygwin*)"); |
706 | ts.WriteLine(" winbuild=yes"); | 706 | ts.WriteLine(" winbuild=yes"); |
707 | ts.WriteLine(" ;;"); | 707 | ts.WriteLine(" ;;"); |
708 | ts.WriteLine("esac"); | 708 | ts.WriteLine("esac"); |
709 | ts.WriteLine("AM_CONDITIONAL(WINBUILD, test x$winbuild = xyes)"); | 709 | ts.WriteLine("AM_CONDITIONAL(WINBUILD, test x$winbuild = xyes)"); |
710 | ts.WriteLine(); | 710 | ts.WriteLine(); |
711 | // ts.WriteLine("dnl Check for SDL"); | 711 | // ts.WriteLine("dnl Check for SDL"); |
712 | // ts.WriteLine(); | 712 | // ts.WriteLine(); |
713 | // ts.WriteLine("AC_PATH_PROG([SDL_CONFIG], [sdl-config])"); | 713 | // ts.WriteLine("AC_PATH_PROG([SDL_CONFIG], [sdl-config])"); |
714 | // ts.WriteLine("have_sdl=no"); | 714 | // ts.WriteLine("have_sdl=no"); |
715 | // ts.WriteLine("if test -n \"${SDL_CONFIG}\"; then"); | 715 | // ts.WriteLine("if test -n \"${SDL_CONFIG}\"; then"); |
716 | // ts.WriteLine(" have_sdl=yes"); | 716 | // ts.WriteLine(" have_sdl=yes"); |
717 | // ts.WriteLine(" SDL_CFLAGS=`$SDL_CONFIG --cflags`"); | 717 | // ts.WriteLine(" SDL_CFLAGS=`$SDL_CONFIG --cflags`"); |
718 | // ts.WriteLine(" SDL_LIBS=`$SDL_CONFIG --libs`"); | 718 | // ts.WriteLine(" SDL_LIBS=`$SDL_CONFIG --libs`"); |
719 | // ts.WriteLine(" #"); | 719 | // ts.WriteLine(" #"); |
720 | // ts.WriteLine(" # sdl-config sometimes emits an rpath flag pointing at its library"); | 720 | // ts.WriteLine(" # sdl-config sometimes emits an rpath flag pointing at its library"); |
721 | // ts.WriteLine(" # installation directory. We don't want this, as it prevents users from"); | 721 | // ts.WriteLine(" # installation directory. We don't want this, as it prevents users from"); |
722 | // ts.WriteLine(" # linking sdl-viewer against, for example, a locally compiled libGL when a"); | 722 | // ts.WriteLine(" # linking sdl-viewer against, for example, a locally compiled libGL when a"); |
723 | // ts.WriteLine(" # version of the library also exists in SDL's library installation"); | 723 | // ts.WriteLine(" # version of the library also exists in SDL's library installation"); |
724 | // ts.WriteLine(" # directory, typically /usr/lib."); | 724 | // ts.WriteLine(" # directory, typically /usr/lib."); |
725 | // ts.WriteLine(" #"); | 725 | // ts.WriteLine(" #"); |
726 | // ts.WriteLine(" SDL_LIBS=`echo $SDL_LIBS | sed 's/-Wl,-rpath,[[^ ]]* //'`"); | 726 | // ts.WriteLine(" SDL_LIBS=`echo $SDL_LIBS | sed 's/-Wl,-rpath,[[^ ]]* //'`"); |
727 | // ts.WriteLine("fi"); | 727 | // ts.WriteLine("fi"); |
728 | // ts.WriteLine("AC_SUBST([SDL_CFLAGS])"); | 728 | // ts.WriteLine("AC_SUBST([SDL_CFLAGS])"); |
729 | // ts.WriteLine("AC_SUBST([SDL_LIBS])"); | 729 | // ts.WriteLine("AC_SUBST([SDL_LIBS])"); |
730 | ts.WriteLine(); | 730 | ts.WriteLine(); |
731 | ts.WriteLine("AC_OUTPUT(["); | 731 | ts.WriteLine("AC_OUTPUT(["); |
732 | ts.WriteLine("Makefile"); | 732 | ts.WriteLine("Makefile"); |
733 | // TODO: this does not work quite right. | 733 | // TODO: this does not work quite right. |
734 | //ts.WriteLine("Properties/AssemblyInfo.cs"); | 734 | //ts.WriteLine("Properties/AssemblyInfo.cs"); |
735 | foreach(ProjectNode project in solution.ProjectsTableOrder) | 735 | foreach(ProjectNode project in solution.ProjectsTableOrder) |
736 | { | 736 | { |
737 | if (project.Type == ProjectType.Library) | 737 | if (project.Type == ProjectType.Library) |
738 | { | 738 | { |
739 | ts.WriteLine(project.Name + ".pc"); | 739 | ts.WriteLine(project.Name + ".pc"); |
740 | } | 740 | } |
741 | // string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath); | 741 | // string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath); |
742 | // ts.WriteLine(Helper.NormalizePath(Helper.MakeFilePath(path, "Include"),'/')); | 742 | // ts.WriteLine(Helper.NormalizePath(Helper.MakeFilePath(path, "Include"),'/')); |
743 | } | 743 | } |
744 | ts.WriteLine("])"); | 744 | ts.WriteLine("])"); |
745 | ts.WriteLine(); | 745 | ts.WriteLine(); |
746 | ts.WriteLine("#po/Makefile.in"); | 746 | ts.WriteLine("#po/Makefile.in"); |
747 | ts.WriteLine(); | 747 | ts.WriteLine(); |
748 | ts.WriteLine("echo \"---\""); | 748 | ts.WriteLine("echo \"---\""); |
749 | ts.WriteLine("echo \"Configuration summary\""); | 749 | ts.WriteLine("echo \"Configuration summary\""); |
750 | ts.WriteLine("echo \"\""); | 750 | ts.WriteLine("echo \"\""); |
751 | ts.WriteLine("echo \" * Installation prefix: $prefix\""); | 751 | ts.WriteLine("echo \" * Installation prefix: $prefix\""); |
752 | ts.WriteLine("echo \" * compiler: $CSC\""); | 752 | ts.WriteLine("echo \" * compiler: $CSC\""); |
753 | ts.WriteLine("echo \" * Documentation: $enable_monodoc ($MONODOC)\""); | 753 | ts.WriteLine("echo \" * Documentation: $enable_monodoc ($MONODOC)\""); |
754 | ts.WriteLine("echo \" * Package Name: $PACKAGE_NAME\""); | 754 | ts.WriteLine("echo \" * Package Name: $PACKAGE_NAME\""); |
755 | ts.WriteLine("echo \" * Version: $PACKAGE_VERSION\""); | 755 | ts.WriteLine("echo \" * Version: $PACKAGE_VERSION\""); |
756 | ts.WriteLine("echo \" * Public Key: $PUBKEY\""); | 756 | ts.WriteLine("echo \" * Public Key: $PUBKEY\""); |
757 | ts.WriteLine("echo \"\""); | 757 | ts.WriteLine("echo \"\""); |
758 | ts.WriteLine("echo \"---\""); | 758 | ts.WriteLine("echo \"---\""); |
759 | ts.WriteLine(); | 759 | ts.WriteLine(); |
760 | } | 760 | } |
761 | 761 | ||
762 | ts.NewLine = "\n"; | 762 | ts.NewLine = "\n"; |
763 | foreach (ProjectNode project in solution.ProjectsTableOrder) | 763 | foreach (ProjectNode project in solution.ProjectsTableOrder) |
764 | { | 764 | { |
765 | if (project.GenerateAssemblyInfoFile) | 765 | if (project.GenerateAssemblyInfoFile) |
766 | { | 766 | { |
767 | GenerateAssemblyInfoFile(solution, combFile); | 767 | GenerateAssemblyInfoFile(solution, combFile); |
768 | } | 768 | } |
769 | } | 769 | } |
770 | } | 770 | } |
771 | 771 | ||
772 | private static void GenerateAssemblyInfoFile(SolutionNode solution, string combFile) | 772 | private static void GenerateAssemblyInfoFile(SolutionNode solution, string combFile) |
773 | { | 773 | { |
774 | System.IO.Directory.CreateDirectory(Helper.MakePathRelativeTo(solution.FullPath, "Properties")); | 774 | System.IO.Directory.CreateDirectory(Helper.MakePathRelativeTo(solution.FullPath, "Properties")); |
775 | combFile = Helper.MakeFilePath(solution.FullPath + "/Properties/", "AssemblyInfo.cs", "in"); | 775 | combFile = Helper.MakeFilePath(solution.FullPath + "/Properties/", "AssemblyInfo.cs", "in"); |
776 | StreamWriter ai = new StreamWriter(combFile); | 776 | StreamWriter ai = new StreamWriter(combFile); |
777 | 777 | ||
778 | using (ai) | 778 | using (ai) |
779 | { | 779 | { |
780 | ai.WriteLine("#region License"); | 780 | ai.WriteLine("#region License"); |
781 | ai.WriteLine("/*"); | 781 | ai.WriteLine("/*"); |
782 | ai.WriteLine("MIT License"); | 782 | ai.WriteLine("MIT License"); |
783 | ai.WriteLine("Copyright (c)2003-2006 Tao Framework Team"); | 783 | ai.WriteLine("Copyright (c)2003-2006 Tao Framework Team"); |
784 | ai.WriteLine("http://www.taoframework.com"); | 784 | ai.WriteLine("http://www.taoframework.com"); |
785 | ai.WriteLine("All rights reserved."); | 785 | ai.WriteLine("All rights reserved."); |
786 | ai.WriteLine(""); | 786 | ai.WriteLine(""); |
787 | ai.WriteLine("Permission is hereby granted, free of charge, to any person obtaining a copy"); | 787 | ai.WriteLine("Permission is hereby granted, free of charge, to any person obtaining a copy"); |
788 | ai.WriteLine("of this software and associated documentation files (the \"Software\"), to deal"); | 788 | ai.WriteLine("of this software and associated documentation files (the \"Software\"), to deal"); |
789 | ai.WriteLine("in the Software without restriction, including without limitation the rights"); | 789 | ai.WriteLine("in the Software without restriction, including without limitation the rights"); |
790 | ai.WriteLine("to use, copy, modify, merge, publish, distribute, sublicense, and/or sell"); | 790 | ai.WriteLine("to use, copy, modify, merge, publish, distribute, sublicense, and/or sell"); |
791 | ai.WriteLine("copies of the Software, and to permit persons to whom the Software is"); | 791 | ai.WriteLine("copies of the Software, and to permit persons to whom the Software is"); |
792 | ai.WriteLine("furnished to do so, subject to the following conditions:"); | 792 | ai.WriteLine("furnished to do so, subject to the following conditions:"); |
793 | ai.WriteLine(""); | 793 | ai.WriteLine(""); |
794 | ai.WriteLine("The above copyright notice and this permission notice shall be included in all"); | 794 | ai.WriteLine("The above copyright notice and this permission notice shall be included in all"); |
795 | ai.WriteLine("copies or substantial portions of the Software."); | 795 | ai.WriteLine("copies or substantial portions of the Software."); |
796 | ai.WriteLine(""); | 796 | ai.WriteLine(""); |
797 | ai.WriteLine("THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR"); | 797 | ai.WriteLine("THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR"); |
798 | ai.WriteLine("IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,"); | 798 | ai.WriteLine("IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,"); |
799 | ai.WriteLine("FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE"); | 799 | ai.WriteLine("FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE"); |
800 | ai.WriteLine("AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER"); | 800 | ai.WriteLine("AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER"); |
801 | ai.WriteLine("LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,"); | 801 | ai.WriteLine("LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,"); |
802 | ai.WriteLine("OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE"); | 802 | ai.WriteLine("OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE"); |
803 | ai.WriteLine("SOFTWARE."); | 803 | ai.WriteLine("SOFTWARE."); |
804 | ai.WriteLine("*/"); | 804 | ai.WriteLine("*/"); |
805 | ai.WriteLine("#endregion License"); | 805 | ai.WriteLine("#endregion License"); |
806 | ai.WriteLine(""); | 806 | ai.WriteLine(""); |
807 | ai.WriteLine("using System;"); | 807 | ai.WriteLine("using System;"); |
808 | ai.WriteLine("using System.Reflection;"); | 808 | ai.WriteLine("using System.Reflection;"); |
809 | ai.WriteLine("using System.Runtime.InteropServices;"); | 809 | ai.WriteLine("using System.Runtime.InteropServices;"); |
810 | ai.WriteLine("using System.Security;"); | 810 | ai.WriteLine("using System.Security;"); |
811 | ai.WriteLine("using System.Security.Permissions;"); | 811 | ai.WriteLine("using System.Security.Permissions;"); |
812 | ai.WriteLine(""); | 812 | ai.WriteLine(""); |
813 | ai.WriteLine("[assembly: AllowPartiallyTrustedCallers]"); | 813 | ai.WriteLine("[assembly: AllowPartiallyTrustedCallers]"); |
814 | ai.WriteLine("[assembly: AssemblyCompany(\"Tao Framework -- http://www.taoframework.com\")]"); | 814 | ai.WriteLine("[assembly: AssemblyCompany(\"Tao Framework -- http://www.taoframework.com\")]"); |
815 | ai.WriteLine("[assembly: AssemblyConfiguration(\"Retail\")]"); | 815 | ai.WriteLine("[assembly: AssemblyConfiguration(\"Retail\")]"); |
816 | ai.WriteLine("[assembly: AssemblyCopyright(\"Copyright (c)2003-2006 Tao Framework Team. All rights reserved.\")]"); | 816 | ai.WriteLine("[assembly: AssemblyCopyright(\"Copyright (c)2003-2006 Tao Framework Team. All rights reserved.\")]"); |
817 | ai.WriteLine("[assembly: AssemblyCulture(\"\")]"); | 817 | ai.WriteLine("[assembly: AssemblyCulture(\"\")]"); |
818 | ai.WriteLine("[assembly: AssemblyDefaultAlias(\"@PACKAGE_NAME@\")]"); | 818 | ai.WriteLine("[assembly: AssemblyDefaultAlias(\"@PACKAGE_NAME@\")]"); |
819 | ai.WriteLine("[assembly: AssemblyDelaySign(false)]"); | 819 | ai.WriteLine("[assembly: AssemblyDelaySign(false)]"); |
820 | ai.WriteLine("[assembly: AssemblyDescription(\"@DESCRIPTION@\")]"); | 820 | ai.WriteLine("[assembly: AssemblyDescription(\"@DESCRIPTION@\")]"); |
821 | ai.WriteLine("[assembly: AssemblyFileVersion(\"@ASSEMBLY_VERSION@\")]"); | 821 | ai.WriteLine("[assembly: AssemblyFileVersion(\"@ASSEMBLY_VERSION@\")]"); |
822 | ai.WriteLine("[assembly: AssemblyInformationalVersion(\"@ASSEMBLY_VERSION@\")]"); | 822 | ai.WriteLine("[assembly: AssemblyInformationalVersion(\"@ASSEMBLY_VERSION@\")]"); |
823 | ai.WriteLine("[assembly: AssemblyKeyName(\"\")]"); | 823 | ai.WriteLine("[assembly: AssemblyKeyName(\"\")]"); |
824 | ai.WriteLine("[assembly: AssemblyProduct(\"@PACKAGE_NAME@.dll\")]"); | 824 | ai.WriteLine("[assembly: AssemblyProduct(\"@PACKAGE_NAME@.dll\")]"); |
825 | ai.WriteLine("[assembly: AssemblyTitle(\"@DESCRIPTION@\")]"); | 825 | ai.WriteLine("[assembly: AssemblyTitle(\"@DESCRIPTION@\")]"); |
826 | ai.WriteLine("[assembly: AssemblyTrademark(\"Tao Framework -- http://www.taoframework.com\")]"); | 826 | ai.WriteLine("[assembly: AssemblyTrademark(\"Tao Framework -- http://www.taoframework.com\")]"); |
827 | ai.WriteLine("[assembly: AssemblyVersion(\"@ASSEMBLY_VERSION@\")]"); | 827 | ai.WriteLine("[assembly: AssemblyVersion(\"@ASSEMBLY_VERSION@\")]"); |
828 | ai.WriteLine("[assembly: CLSCompliant(true)]"); | 828 | ai.WriteLine("[assembly: CLSCompliant(true)]"); |
829 | ai.WriteLine("[assembly: ComVisible(false)]"); | 829 | ai.WriteLine("[assembly: ComVisible(false)]"); |
830 | ai.WriteLine("[assembly: SecurityPermission(SecurityAction.RequestMinimum, Flags = SecurityPermissionFlag.Execution)]"); | 830 | ai.WriteLine("[assembly: SecurityPermission(SecurityAction.RequestMinimum, Flags = SecurityPermissionFlag.Execution)]"); |
831 | ai.WriteLine("[assembly: SecurityPermission(SecurityAction.RequestMinimum, Flags = SecurityPermissionFlag.SkipVerification)]"); | 831 | ai.WriteLine("[assembly: SecurityPermission(SecurityAction.RequestMinimum, Flags = SecurityPermissionFlag.SkipVerification)]"); |
832 | ai.WriteLine("[assembly: SecurityPermission(SecurityAction.RequestMinimum, Flags = SecurityPermissionFlag.UnmanagedCode)]"); | 832 | ai.WriteLine("[assembly: SecurityPermission(SecurityAction.RequestMinimum, Flags = SecurityPermissionFlag.UnmanagedCode)]"); |
833 | 833 | ||
834 | } | 834 | } |
835 | //return combFile; | 835 | //return combFile; |
836 | } | 836 | } |
837 | 837 | ||
838 | private void CleanProject(ProjectNode project) | 838 | private void CleanProject(ProjectNode project) |
839 | { | 839 | { |
840 | m_Kernel.Log.Write("...Cleaning project: {0}", project.Name); | 840 | m_Kernel.Log.Write("...Cleaning project: {0}", project.Name); |
841 | string projectFile = Helper.MakeFilePath(project.FullPath, "Include", "am"); | 841 | string projectFile = Helper.MakeFilePath(project.FullPath, "Include", "am"); |
842 | Helper.DeleteIfExists(projectFile); | 842 | Helper.DeleteIfExists(projectFile); |
843 | } | 843 | } |
844 | 844 | ||
845 | private void CleanSolution(SolutionNode solution) | 845 | private void CleanSolution(SolutionNode solution) |
846 | { | 846 | { |
847 | m_Kernel.Log.Write("Cleaning Autotools make files for", solution.Name); | 847 | m_Kernel.Log.Write("Cleaning Autotools make files for", solution.Name); |
848 | 848 | ||
849 | string slnFile = Helper.MakeFilePath(solution.FullPath, "Makefile", "am"); | 849 | string slnFile = Helper.MakeFilePath(solution.FullPath, "Makefile", "am"); |
850 | Helper.DeleteIfExists(slnFile); | 850 | Helper.DeleteIfExists(slnFile); |
851 | 851 | ||
852 | slnFile = Helper.MakeFilePath(solution.FullPath, "Makefile", "in"); | 852 | slnFile = Helper.MakeFilePath(solution.FullPath, "Makefile", "in"); |
853 | Helper.DeleteIfExists(slnFile); | 853 | Helper.DeleteIfExists(slnFile); |
854 | 854 | ||
855 | slnFile = Helper.MakeFilePath(solution.FullPath, "configure", "ac"); | 855 | slnFile = Helper.MakeFilePath(solution.FullPath, "configure", "ac"); |
856 | Helper.DeleteIfExists(slnFile); | 856 | Helper.DeleteIfExists(slnFile); |
857 | 857 | ||
858 | slnFile = Helper.MakeFilePath(solution.FullPath, "configure"); | 858 | slnFile = Helper.MakeFilePath(solution.FullPath, "configure"); |
859 | Helper.DeleteIfExists(slnFile); | 859 | Helper.DeleteIfExists(slnFile); |
860 | 860 | ||
861 | slnFile = Helper.MakeFilePath(solution.FullPath, "Makefile"); | 861 | slnFile = Helper.MakeFilePath(solution.FullPath, "Makefile"); |
862 | Helper.DeleteIfExists(slnFile); | 862 | Helper.DeleteIfExists(slnFile); |
863 | 863 | ||
864 | foreach(ProjectNode project in solution.Projects) | 864 | foreach(ProjectNode project in solution.Projects) |
865 | { | 865 | { |
866 | CleanProject(project); | 866 | CleanProject(project); |
867 | } | 867 | } |
868 | 868 | ||
869 | m_Kernel.Log.Write(""); | 869 | m_Kernel.Log.Write(""); |
870 | } | 870 | } |
871 | 871 | ||
872 | #endregion | 872 | #endregion |
873 | 873 | ||
874 | #region ITarget Members | 874 | #region ITarget Members |
875 | 875 | ||
876 | /// <summary> | 876 | /// <summary> |
877 | /// Writes the specified kern. | 877 | /// Writes the specified kern. |
878 | /// </summary> | 878 | /// </summary> |
879 | /// <param name="kern">The kern.</param> | 879 | /// <param name="kern">The kern.</param> |
880 | public void Write(Kernel kern) | 880 | public void Write(Kernel kern) |
881 | { | 881 | { |
882 | if( kern == null ) | 882 | if( kern == null ) |
883 | { | 883 | { |
884 | throw new ArgumentNullException("kern"); | 884 | throw new ArgumentNullException("kern"); |
885 | } | 885 | } |
886 | m_Kernel = kern; | 886 | m_Kernel = kern; |
887 | foreach(SolutionNode solution in kern.Solutions) | 887 | foreach(SolutionNode solution in kern.Solutions) |
888 | { | 888 | { |
889 | WriteCombine(solution); | 889 | WriteCombine(solution); |
890 | } | 890 | } |
891 | m_Kernel = null; | 891 | m_Kernel = null; |
892 | } | 892 | } |
893 | 893 | ||
894 | /// <summary> | 894 | /// <summary> |
895 | /// Cleans the specified kern. | 895 | /// Cleans the specified kern. |
896 | /// </summary> | 896 | /// </summary> |
897 | /// <param name="kern">The kern.</param> | 897 | /// <param name="kern">The kern.</param> |
898 | public virtual void Clean(Kernel kern) | 898 | public virtual void Clean(Kernel kern) |
899 | { | 899 | { |
900 | if( kern == null ) | 900 | if( kern == null ) |
901 | { | 901 | { |
902 | throw new ArgumentNullException("kern"); | 902 | throw new ArgumentNullException("kern"); |
903 | } | 903 | } |
904 | m_Kernel = kern; | 904 | m_Kernel = kern; |
905 | foreach(SolutionNode sol in kern.Solutions) | 905 | foreach(SolutionNode sol in kern.Solutions) |
906 | { | 906 | { |
907 | CleanSolution(sol); | 907 | CleanSolution(sol); |
908 | } | 908 | } |
909 | m_Kernel = null; | 909 | m_Kernel = null; |
910 | } | 910 | } |
911 | 911 | ||
912 | /// <summary> | 912 | /// <summary> |
913 | /// Gets the name. | 913 | /// Gets the name. |
914 | /// </summary> | 914 | /// </summary> |
915 | /// <value>The name.</value> | 915 | /// <value>The name.</value> |
916 | public string Name | 916 | public string Name |
917 | { | 917 | { |
918 | get | 918 | get |
919 | { | 919 | { |
920 | return "autotools"; | 920 | return "autotools"; |
921 | } | 921 | } |
922 | } | 922 | } |
923 | 923 | ||
924 | #endregion | 924 | #endregion |
925 | } | 925 | } |
926 | } | 926 | } |
diff --git a/Prebuild/src/Core/Targets/DebugTarget.cs b/Prebuild/src/Core/Targets/DebugTarget.cs index 6baa623..dc4e666 100644 --- a/Prebuild/src/Core/Targets/DebugTarget.cs +++ b/Prebuild/src/Core/Targets/DebugTarget.cs | |||
@@ -1,102 +1,102 @@ | |||
1 | #region BSD License | 1 | #region BSD License |
2 | /* | 2 | /* |
3 | Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) | 3 | Copyright (c) 2004-2005 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 | ||
26 | #region CVS Information | 26 | #region CVS Information |
27 | /* | 27 | /* |
28 | * $Source$ | 28 | * $Source$ |
29 | * $Author: jendave $ | 29 | * $Author: jendave $ |
30 | * $Date: 2006-09-20 09:42:51 +0200 (on, 20 sep 2006) $ | 30 | * $Date: 2006-09-20 09:42:51 +0200 (on, 20 sep 2006) $ |
31 | * $Revision: 164 $ | 31 | * $Revision: 164 $ |
32 | */ | 32 | */ |
33 | #endregion | 33 | #endregion |
34 | 34 | ||
35 | using System; | 35 | using System; |
36 | 36 | ||
37 | using Prebuild.Core.Attributes; | 37 | using Prebuild.Core.Attributes; |
38 | using Prebuild.Core.Interfaces; | 38 | using Prebuild.Core.Interfaces; |
39 | using Prebuild.Core.Nodes; | 39 | using Prebuild.Core.Nodes; |
40 | 40 | ||
41 | #if (DEBUG && _DEBUG_TARGET) | 41 | #if (DEBUG && _DEBUG_TARGET) |
42 | namespace Prebuild.Core.Targets | 42 | namespace Prebuild.Core.Targets |
43 | { | 43 | { |
44 | [Target("debug")] | 44 | [Target("debug")] |
45 | public class DebugTarget : ITarget | 45 | public class DebugTarget : ITarget |
46 | { | 46 | { |
47 | #region Fields | 47 | #region Fields |
48 | 48 | ||
49 | private Kernel m_Kernel = null; | 49 | private Kernel m_Kernel = null; |
50 | 50 | ||
51 | #endregion | 51 | #endregion |
52 | 52 | ||
53 | #region ITarget Members | 53 | #region ITarget Members |
54 | 54 | ||
55 | public void Write() | 55 | public void Write() |
56 | { | 56 | { |
57 | foreach(SolutionNode s in m_Kernel.Solutions) | 57 | foreach(SolutionNode s in m_Kernel.Solutions) |
58 | { | 58 | { |
59 | Console.WriteLine("Solution [ {0}, {1} ]", s.Name, s.Path); | 59 | Console.WriteLine("Solution [ {0}, {1} ]", s.Name, s.Path); |
60 | foreach(string file in s.Files) | 60 | foreach(string file in s.Files) |
61 | { | 61 | { |
62 | Console.WriteLine("\tFile [ {0} ]", file); | 62 | Console.WriteLine("\tFile [ {0} ]", file); |
63 | } | 63 | } |
64 | 64 | ||
65 | foreach(ProjectNode proj in s.Projects) | 65 | foreach(ProjectNode proj in s.Projects) |
66 | { | 66 | { |
67 | Console.WriteLine("\tProject [ {0}, {1}. {2} ]", proj.Name, proj.Path, proj.Language); | 67 | Console.WriteLine("\tProject [ {0}, {1}. {2} ]", proj.Name, proj.Path, proj.Language); |
68 | foreach(string file in proj.Files) | 68 | foreach(string file in proj.Files) |
69 | Console.WriteLine("\t\tFile [ {0} ]", file); | 69 | Console.WriteLine("\t\tFile [ {0} ]", file); |
70 | } | 70 | } |
71 | } | 71 | } |
72 | } | 72 | } |
73 | 73 | ||
74 | public void Clean() | 74 | public void Clean() |
75 | { | 75 | { |
76 | Console.WriteLine("Not implemented"); | 76 | Console.WriteLine("Not implemented"); |
77 | } | 77 | } |
78 | 78 | ||
79 | public string Name | 79 | public string Name |
80 | { | 80 | { |
81 | get | 81 | get |
82 | { | 82 | { |
83 | return "debug"; | 83 | return "debug"; |
84 | } | 84 | } |
85 | } | 85 | } |
86 | 86 | ||
87 | public Kernel Kernel | 87 | public Kernel Kernel |
88 | { | 88 | { |
89 | get | 89 | get |
90 | { | 90 | { |
91 | return m_Kernel; | 91 | return m_Kernel; |
92 | } | 92 | } |
93 | set | 93 | set |
94 | { | 94 | { |
95 | m_Kernel = value; | 95 | m_Kernel = value; |
96 | } | 96 | } |
97 | } | 97 | } |
98 | 98 | ||
99 | #endregion | 99 | #endregion |
100 | } | 100 | } |
101 | } | 101 | } |
102 | #endif | 102 | #endif |
diff --git a/Prebuild/src/Core/Targets/MonoDevelopTarget.cs b/Prebuild/src/Core/Targets/MonoDevelopTarget.cs index 8620e4b..7c0a1e2 100644 --- a/Prebuild/src/Core/Targets/MonoDevelopTarget.cs +++ b/Prebuild/src/Core/Targets/MonoDevelopTarget.cs | |||
@@ -1,458 +1,458 @@ | |||
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 | ||
26 | #region CVS Information | 26 | #region CVS Information |
27 | /* | 27 | /* |
28 | * $Source$ | 28 | * $Source$ |
29 | * $Author: jendave $ | 29 | * $Author: jendave $ |
30 | * $Date: 2007-02-13 22:07:07 +0100 (ti, 13 feb 2007) $ | 30 | * $Date: 2007-02-13 22:07:07 +0100 (ti, 13 feb 2007) $ |
31 | * $Revision: 206 $ | 31 | * $Revision: 206 $ |
32 | */ | 32 | */ |
33 | #endregion | 33 | #endregion |
34 | 34 | ||
35 | using System; | 35 | using System; |
36 | using System.Collections; | 36 | using System.Collections; |
37 | using System.Collections.Specialized; | 37 | using System.Collections.Specialized; |
38 | using System.IO; | 38 | using System.IO; |
39 | using System.Reflection; | 39 | using System.Reflection; |
40 | using System.Text.RegularExpressions; | 40 | using System.Text.RegularExpressions; |
41 | 41 | ||
42 | using Prebuild.Core.Attributes; | 42 | using Prebuild.Core.Attributes; |
43 | using Prebuild.Core.Interfaces; | 43 | using Prebuild.Core.Interfaces; |
44 | using Prebuild.Core.Nodes; | 44 | using Prebuild.Core.Nodes; |
45 | using Prebuild.Core.Utilities; | 45 | 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("monodev")] | 52 | [Target("monodev")] |
53 | public class MonoDevelopTarget : ITarget | 53 | public class MonoDevelopTarget : 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, ReferenceNode refr) | 80 | private static string BuildReference(SolutionNode solution, ReferenceNode refr) |
81 | { | 81 | { |
82 | string ret = "<ProjectReference type=\""; | 82 | string ret = "<ProjectReference type=\""; |
83 | if(solution.ProjectsTable.ContainsKey(refr.Name)) | 83 | if(solution.ProjectsTable.ContainsKey(refr.Name)) |
84 | { | 84 | { |
85 | ret += "Project\""; | 85 | ret += "Project\""; |
86 | ret += " localcopy=\"" + refr.LocalCopy.ToString() + "\" refto=\"" + refr.Name + "\" />"; | 86 | ret += " localcopy=\"" + refr.LocalCopy.ToString() + "\" refto=\"" + refr.Name + "\" />"; |
87 | } | 87 | } |
88 | else | 88 | else |
89 | { | 89 | { |
90 | ProjectNode project = (ProjectNode)refr.Parent; | 90 | ProjectNode project = (ProjectNode)refr.Parent; |
91 | string fileRef = FindFileReference(refr.Name, project); | 91 | string fileRef = FindFileReference(refr.Name, project); |
92 | 92 | ||
93 | if(refr.Path != null || fileRef != null) | 93 | if(refr.Path != null || fileRef != null) |
94 | { | 94 | { |
95 | ret += "Assembly\" refto=\""; | 95 | ret += "Assembly\" refto=\""; |
96 | 96 | ||
97 | string finalPath = (refr.Path != null) ? Helper.MakeFilePath(refr.Path, refr.Name, "dll") : fileRef; | 97 | string finalPath = (refr.Path != null) ? Helper.MakeFilePath(refr.Path, refr.Name, "dll") : fileRef; |
98 | 98 | ||
99 | ret += finalPath; | 99 | ret += finalPath; |
100 | ret += "\" localcopy=\"" + refr.LocalCopy.ToString() + "\" />"; | 100 | ret += "\" localcopy=\"" + refr.LocalCopy.ToString() + "\" />"; |
101 | return ret; | 101 | return ret; |
102 | } | 102 | } |
103 | 103 | ||
104 | ret += "Gac\""; | 104 | ret += "Gac\""; |
105 | ret += " localcopy=\"" + refr.LocalCopy.ToString() + "\""; | 105 | ret += " localcopy=\"" + refr.LocalCopy.ToString() + "\""; |
106 | ret += " refto=\""; | 106 | ret += " refto=\""; |
107 | try | 107 | try |
108 | { | 108 | { |
109 | //Assembly assem = Assembly.Load(refr.Name); | 109 | //Assembly assem = Assembly.Load(refr.Name); |
110 | //ret += assem.FullName; | 110 | //ret += assem.FullName; |
111 | ret += refr.Name; | 111 | ret += refr.Name; |
112 | } | 112 | } |
113 | catch (System.NullReferenceException e) | 113 | catch (System.NullReferenceException e) |
114 | { | 114 | { |
115 | e.ToString(); | 115 | e.ToString(); |
116 | ret += refr.Name; | 116 | ret += refr.Name; |
117 | } | 117 | } |
118 | ret += "\" />"; | 118 | ret += "\" />"; |
119 | } | 119 | } |
120 | 120 | ||
121 | return ret; | 121 | return ret; |
122 | } | 122 | } |
123 | 123 | ||
124 | private static string FindFileReference(string refName, ProjectNode project) | 124 | private static string FindFileReference(string refName, ProjectNode project) |
125 | { | 125 | { |
126 | foreach(ReferencePathNode refPath in project.ReferencePaths) | 126 | foreach(ReferencePathNode refPath in project.ReferencePaths) |
127 | { | 127 | { |
128 | string fullPath = Helper.MakeFilePath(refPath.Path, refName, "dll"); | 128 | string fullPath = Helper.MakeFilePath(refPath.Path, refName, "dll"); |
129 | 129 | ||
130 | if(File.Exists(fullPath)) | 130 | if(File.Exists(fullPath)) |
131 | { | 131 | { |
132 | return fullPath; | 132 | return fullPath; |
133 | } | 133 | } |
134 | } | 134 | } |
135 | 135 | ||
136 | return null; | 136 | return null; |
137 | } | 137 | } |
138 | 138 | ||
139 | /// <summary> | 139 | /// <summary> |
140 | /// Gets the XML doc file. | 140 | /// Gets the XML doc file. |
141 | /// </summary> | 141 | /// </summary> |
142 | /// <param name="project">The project.</param> | 142 | /// <param name="project">The project.</param> |
143 | /// <param name="conf">The conf.</param> | 143 | /// <param name="conf">The conf.</param> |
144 | /// <returns></returns> | 144 | /// <returns></returns> |
145 | public static string GenerateXmlDocFile(ProjectNode project, ConfigurationNode conf) | 145 | public static string GenerateXmlDocFile(ProjectNode project, ConfigurationNode conf) |
146 | { | 146 | { |
147 | if( conf == null ) | 147 | if( conf == null ) |
148 | { | 148 | { |
149 | throw new ArgumentNullException("conf"); | 149 | throw new ArgumentNullException("conf"); |
150 | } | 150 | } |
151 | if( project == null ) | 151 | if( project == null ) |
152 | { | 152 | { |
153 | throw new ArgumentNullException("project"); | 153 | throw new ArgumentNullException("project"); |
154 | } | 154 | } |
155 | string docFile = (string)conf.Options["XmlDocFile"]; | 155 | string docFile = (string)conf.Options["XmlDocFile"]; |
156 | if(docFile != null && docFile.Length == 0)//default to assembly name if not specified | 156 | if(docFile != null && docFile.Length == 0)//default to assembly name if not specified |
157 | { | 157 | { |
158 | return "False"; | 158 | return "False"; |
159 | } | 159 | } |
160 | return "True"; | 160 | return "True"; |
161 | } | 161 | } |
162 | 162 | ||
163 | private void WriteProject(SolutionNode solution, ProjectNode project) | 163 | private void WriteProject(SolutionNode solution, ProjectNode project) |
164 | { | 164 | { |
165 | string csComp = "Mcs"; | 165 | string csComp = "Mcs"; |
166 | string netRuntime = "Mono"; | 166 | string netRuntime = "Mono"; |
167 | if(project.Runtime == ClrRuntime.Microsoft) | 167 | if(project.Runtime == ClrRuntime.Microsoft) |
168 | { | 168 | { |
169 | csComp = "Csc"; | 169 | csComp = "Csc"; |
170 | netRuntime = "MsNet"; | 170 | netRuntime = "MsNet"; |
171 | } | 171 | } |
172 | 172 | ||
173 | string projFile = Helper.MakeFilePath(project.FullPath, project.Name, "mdp"); | 173 | string projFile = Helper.MakeFilePath(project.FullPath, project.Name, "mdp"); |
174 | StreamWriter ss = new StreamWriter(projFile); | 174 | StreamWriter ss = new StreamWriter(projFile); |
175 | 175 | ||
176 | m_Kernel.CurrentWorkingDirectory.Push(); | 176 | m_Kernel.CurrentWorkingDirectory.Push(); |
177 | Helper.SetCurrentDir(Path.GetDirectoryName(projFile)); | 177 | Helper.SetCurrentDir(Path.GetDirectoryName(projFile)); |
178 | 178 | ||
179 | using(ss) | 179 | using(ss) |
180 | { | 180 | { |
181 | ss.WriteLine( | 181 | ss.WriteLine( |
182 | "<Project name=\"{0}\" description=\"\" standardNamespace=\"{1}\" newfilesearch=\"None\" enableviewstate=\"True\" fileversion=\"2.0\" language=\"C#\" clr-version=\"Net_2_0\" ctype=\"DotNetProject\">", | 182 | "<Project name=\"{0}\" description=\"\" standardNamespace=\"{1}\" newfilesearch=\"None\" enableviewstate=\"True\" fileversion=\"2.0\" language=\"C#\" clr-version=\"Net_2_0\" ctype=\"DotNetProject\">", |
183 | project.Name, | 183 | project.Name, |
184 | project.RootNamespace | 184 | project.RootNamespace |
185 | ); | 185 | ); |
186 | 186 | ||
187 | int count = 0; | 187 | int count = 0; |
188 | 188 | ||
189 | ss.WriteLine(" <Configurations active=\"{0}\">", solution.ActiveConfig); | 189 | ss.WriteLine(" <Configurations active=\"{0}\">", solution.ActiveConfig); |
190 | 190 | ||
191 | foreach(ConfigurationNode conf in project.Configurations) | 191 | foreach(ConfigurationNode conf in project.Configurations) |
192 | { | 192 | { |
193 | ss.WriteLine(" <Configuration name=\"{0}\" ctype=\"DotNetProjectConfiguration\">", conf.Name); | 193 | ss.WriteLine(" <Configuration name=\"{0}\" ctype=\"DotNetProjectConfiguration\">", conf.Name); |
194 | ss.Write(" <Output"); | 194 | ss.Write(" <Output"); |
195 | ss.Write(" directory=\"{0}\"", Helper.EndPath(Helper.NormalizePath(".\\" + conf.Options["OutputPath"].ToString()))); | 195 | ss.Write(" directory=\"{0}\"", Helper.EndPath(Helper.NormalizePath(".\\" + conf.Options["OutputPath"].ToString()))); |
196 | ss.Write(" assembly=\"{0}\"", project.AssemblyName); | 196 | ss.Write(" assembly=\"{0}\"", project.AssemblyName); |
197 | ss.Write(" executeScript=\"{0}\"", conf.Options["RunScript"]); | 197 | ss.Write(" executeScript=\"{0}\"", conf.Options["RunScript"]); |
198 | //ss.Write(" executeBeforeBuild=\"{0}\"", conf.Options["PreBuildEvent"]); | 198 | //ss.Write(" executeBeforeBuild=\"{0}\"", conf.Options["PreBuildEvent"]); |
199 | //ss.Write(" executeAfterBuild=\"{0}\"", conf.Options["PostBuildEvent"]); | 199 | //ss.Write(" executeAfterBuild=\"{0}\"", conf.Options["PostBuildEvent"]); |
200 | if (conf.Options["PreBuildEvent"] != null && conf.Options["PreBuildEvent"].ToString().Length != 0) | 200 | if (conf.Options["PreBuildEvent"] != null && conf.Options["PreBuildEvent"].ToString().Length != 0) |
201 | { | 201 | { |
202 | ss.Write(" executeBeforeBuild=\"{0}\"", Helper.NormalizePath(conf.Options["PreBuildEvent"].ToString())); | 202 | ss.Write(" executeBeforeBuild=\"{0}\"", Helper.NormalizePath(conf.Options["PreBuildEvent"].ToString())); |
203 | } | 203 | } |
204 | else | 204 | else |
205 | { | 205 | { |
206 | ss.Write(" executeBeforeBuild=\"{0}\"", conf.Options["PreBuildEvent"]); | 206 | ss.Write(" executeBeforeBuild=\"{0}\"", conf.Options["PreBuildEvent"]); |
207 | } | 207 | } |
208 | if (conf.Options["PostBuildEvent"] != null && conf.Options["PostBuildEvent"].ToString().Length != 0) | 208 | if (conf.Options["PostBuildEvent"] != null && conf.Options["PostBuildEvent"].ToString().Length != 0) |
209 | { | 209 | { |
210 | ss.Write(" executeAfterBuild=\"{0}\"", Helper.NormalizePath(conf.Options["PostBuildEvent"].ToString())); | 210 | ss.Write(" executeAfterBuild=\"{0}\"", Helper.NormalizePath(conf.Options["PostBuildEvent"].ToString())); |
211 | } | 211 | } |
212 | else | 212 | else |
213 | { | 213 | { |
214 | ss.Write(" executeAfterBuild=\"{0}\"", conf.Options["PostBuildEvent"]); | 214 | ss.Write(" executeAfterBuild=\"{0}\"", conf.Options["PostBuildEvent"]); |
215 | } | 215 | } |
216 | ss.Write(" executeBeforeBuildArguments=\"{0}\"", conf.Options["PreBuildEventArgs"]); | 216 | ss.Write(" executeBeforeBuildArguments=\"{0}\"", conf.Options["PreBuildEventArgs"]); |
217 | ss.Write(" executeAfterBuildArguments=\"{0}\"", conf.Options["PreBuildEventArgs"]); | 217 | ss.Write(" executeAfterBuildArguments=\"{0}\"", conf.Options["PreBuildEventArgs"]); |
218 | ss.WriteLine(" />"); | 218 | ss.WriteLine(" />"); |
219 | 219 | ||
220 | ss.Write(" <Build"); | 220 | ss.Write(" <Build"); |
221 | ss.Write(" debugmode=\"True\""); | 221 | ss.Write(" debugmode=\"True\""); |
222 | if (project.Type == ProjectType.WinExe) | 222 | if (project.Type == ProjectType.WinExe) |
223 | { | 223 | { |
224 | ss.Write(" target=\"{0}\"", ProjectType.Exe.ToString()); | 224 | ss.Write(" target=\"{0}\"", ProjectType.Exe.ToString()); |
225 | } | 225 | } |
226 | else | 226 | else |
227 | { | 227 | { |
228 | ss.Write(" target=\"{0}\"", project.Type); | 228 | ss.Write(" target=\"{0}\"", project.Type); |
229 | } | 229 | } |
230 | ss.WriteLine(" />"); | 230 | ss.WriteLine(" />"); |
231 | 231 | ||
232 | ss.Write(" <Execution"); | 232 | ss.Write(" <Execution"); |
233 | ss.Write(" runwithwarnings=\"True\""); | 233 | ss.Write(" runwithwarnings=\"True\""); |
234 | ss.Write(" consolepause=\"True\""); | 234 | ss.Write(" consolepause=\"True\""); |
235 | ss.Write(" runtime=\"{0}\"", netRuntime); | 235 | ss.Write(" runtime=\"{0}\"", netRuntime); |
236 | ss.Write(" clr-version=\"Net_2_0\""); | 236 | ss.Write(" clr-version=\"Net_2_0\""); |
237 | ss.WriteLine(" />"); | 237 | ss.WriteLine(" />"); |
238 | 238 | ||
239 | ss.Write(" <CodeGeneration"); | 239 | ss.Write(" <CodeGeneration"); |
240 | ss.Write(" compiler=\"{0}\"", csComp); | 240 | ss.Write(" compiler=\"{0}\"", csComp); |
241 | ss.Write(" warninglevel=\"{0}\"", conf.Options["WarningLevel"]); | 241 | ss.Write(" warninglevel=\"{0}\"", conf.Options["WarningLevel"]); |
242 | ss.Write(" nowarn=\"{0}\"", conf.Options["SuppressWarnings"]); | 242 | ss.Write(" nowarn=\"{0}\"", conf.Options["SuppressWarnings"]); |
243 | ss.Write(" includedebuginformation=\"{0}\"", conf.Options["DebugInformation"]); | 243 | ss.Write(" includedebuginformation=\"{0}\"", conf.Options["DebugInformation"]); |
244 | ss.Write(" optimize=\"{0}\"", conf.Options["OptimizeCode"]); | 244 | ss.Write(" optimize=\"{0}\"", conf.Options["OptimizeCode"]); |
245 | ss.Write(" unsafecodeallowed=\"{0}\"", conf.Options["AllowUnsafe"]); | 245 | ss.Write(" unsafecodeallowed=\"{0}\"", conf.Options["AllowUnsafe"]); |
246 | ss.Write(" generateoverflowchecks=\"{0}\"", conf.Options["CheckUnderflowOverflow"]); | 246 | ss.Write(" generateoverflowchecks=\"{0}\"", conf.Options["CheckUnderflowOverflow"]); |
247 | ss.Write(" mainclass=\"{0}\"", project.StartupObject); | 247 | ss.Write(" mainclass=\"{0}\"", project.StartupObject); |
248 | ss.Write(" target=\"{0}\"", project.Type); | 248 | ss.Write(" target=\"{0}\"", project.Type); |
249 | ss.Write(" definesymbols=\"{0}\"", conf.Options["CompilerDefines"]); | 249 | ss.Write(" definesymbols=\"{0}\"", conf.Options["CompilerDefines"]); |
250 | ss.Write(" generatexmldocumentation=\"{0}\"", GenerateXmlDocFile(project, conf)); | 250 | ss.Write(" generatexmldocumentation=\"{0}\"", GenerateXmlDocFile(project, conf)); |
251 | ss.Write(" win32Icon=\"{0}\"", project.AppIcon); | 251 | ss.Write(" win32Icon=\"{0}\"", project.AppIcon); |
252 | ss.Write(" ctype=\"CSharpCompilerParameters\""); | 252 | ss.Write(" ctype=\"CSharpCompilerParameters\""); |
253 | ss.WriteLine(" />"); | 253 | ss.WriteLine(" />"); |
254 | ss.WriteLine(" </Configuration>"); | 254 | ss.WriteLine(" </Configuration>"); |
255 | 255 | ||
256 | count++; | 256 | count++; |
257 | } | 257 | } |
258 | ss.WriteLine(" </Configurations>"); | 258 | ss.WriteLine(" </Configurations>"); |
259 | 259 | ||
260 | ss.Write(" <DeploymentInformation"); | 260 | ss.Write(" <DeploymentInformation"); |
261 | ss.Write(" target=\"\""); | 261 | ss.Write(" target=\"\""); |
262 | ss.Write(" script=\"\""); | 262 | ss.Write(" script=\"\""); |
263 | ss.Write(" strategy=\"File\""); | 263 | ss.Write(" strategy=\"File\""); |
264 | ss.WriteLine(">"); | 264 | ss.WriteLine(">"); |
265 | ss.WriteLine(" <excludeFiles />"); | 265 | ss.WriteLine(" <excludeFiles />"); |
266 | ss.WriteLine(" </DeploymentInformation>"); | 266 | ss.WriteLine(" </DeploymentInformation>"); |
267 | 267 | ||
268 | ss.WriteLine(" <Contents>"); | 268 | ss.WriteLine(" <Contents>"); |
269 | foreach(string file in project.Files) | 269 | foreach(string file in project.Files) |
270 | { | 270 | { |
271 | string buildAction = "Compile"; | 271 | string buildAction = "Compile"; |
272 | switch(project.Files.GetBuildAction(file)) | 272 | switch(project.Files.GetBuildAction(file)) |
273 | { | 273 | { |
274 | case BuildAction.None: | 274 | case BuildAction.None: |
275 | buildAction = "Nothing"; | 275 | buildAction = "Nothing"; |
276 | break; | 276 | break; |
277 | 277 | ||
278 | case BuildAction.Content: | 278 | case BuildAction.Content: |
279 | buildAction = "Exclude"; | 279 | buildAction = "Exclude"; |
280 | break; | 280 | break; |
281 | 281 | ||
282 | case BuildAction.EmbeddedResource: | 282 | case BuildAction.EmbeddedResource: |
283 | buildAction = "EmbedAsResource"; | 283 | buildAction = "EmbedAsResource"; |
284 | break; | 284 | break; |
285 | 285 | ||
286 | default: | 286 | default: |
287 | buildAction = "Compile"; | 287 | buildAction = "Compile"; |
288 | break; | 288 | break; |
289 | } | 289 | } |
290 | 290 | ||
291 | // Sort of a hack, we try and resolve the path and make it relative, if we can. | 291 | // Sort of a hack, we try and resolve the path and make it relative, if we can. |
292 | string filePath = PrependPath(file); | 292 | string filePath = PrependPath(file); |
293 | ss.WriteLine(" <File name=\"{0}\" subtype=\"Code\" buildaction=\"{1}\" dependson=\"\" data=\"\" />", filePath, buildAction); | 293 | ss.WriteLine(" <File name=\"{0}\" subtype=\"Code\" buildaction=\"{1}\" dependson=\"\" data=\"\" />", filePath, buildAction); |
294 | } | 294 | } |
295 | ss.WriteLine(" </Contents>"); | 295 | ss.WriteLine(" </Contents>"); |
296 | 296 | ||
297 | ss.WriteLine(" <References>"); | 297 | ss.WriteLine(" <References>"); |
298 | foreach(ReferenceNode refr in project.References) | 298 | foreach(ReferenceNode refr in project.References) |
299 | { | 299 | { |
300 | ss.WriteLine(" {0}", BuildReference(solution, refr)); | 300 | ss.WriteLine(" {0}", BuildReference(solution, refr)); |
301 | } | 301 | } |
302 | ss.WriteLine(" </References>"); | 302 | ss.WriteLine(" </References>"); |
303 | 303 | ||
304 | 304 | ||
305 | ss.WriteLine("</Project>"); | 305 | ss.WriteLine("</Project>"); |
306 | } | 306 | } |
307 | 307 | ||
308 | m_Kernel.CurrentWorkingDirectory.Pop(); | 308 | m_Kernel.CurrentWorkingDirectory.Pop(); |
309 | } | 309 | } |
310 | 310 | ||
311 | private void WriteCombine(SolutionNode solution) | 311 | private void WriteCombine(SolutionNode solution) |
312 | { | 312 | { |
313 | m_Kernel.Log.Write("Creating MonoDevelop combine and project files"); | 313 | m_Kernel.Log.Write("Creating MonoDevelop combine and project files"); |
314 | foreach(ProjectNode project in solution.Projects) | 314 | foreach(ProjectNode project in solution.Projects) |
315 | { | 315 | { |
316 | if(m_Kernel.AllowProject(project.FilterGroups)) | 316 | if(m_Kernel.AllowProject(project.FilterGroups)) |
317 | { | 317 | { |
318 | m_Kernel.Log.Write("...Creating project: {0}", project.Name); | 318 | m_Kernel.Log.Write("...Creating project: {0}", project.Name); |
319 | WriteProject(solution, project); | 319 | WriteProject(solution, project); |
320 | } | 320 | } |
321 | } | 321 | } |
322 | 322 | ||
323 | m_Kernel.Log.Write(""); | 323 | m_Kernel.Log.Write(""); |
324 | string combFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "mds"); | 324 | string combFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "mds"); |
325 | StreamWriter ss = new StreamWriter(combFile); | 325 | StreamWriter ss = new StreamWriter(combFile); |
326 | 326 | ||
327 | m_Kernel.CurrentWorkingDirectory.Push(); | 327 | m_Kernel.CurrentWorkingDirectory.Push(); |
328 | Helper.SetCurrentDir(Path.GetDirectoryName(combFile)); | 328 | Helper.SetCurrentDir(Path.GetDirectoryName(combFile)); |
329 | 329 | ||
330 | int count = 0; | 330 | int count = 0; |
331 | 331 | ||
332 | using(ss) | 332 | using(ss) |
333 | { | 333 | { |
334 | ss.WriteLine("<Combine name=\"{0}\" fileversion=\"2.0\" description=\"\">", solution.Name); | 334 | ss.WriteLine("<Combine name=\"{0}\" fileversion=\"2.0\" description=\"\">", solution.Name); |
335 | 335 | ||
336 | count = 0; | 336 | count = 0; |
337 | foreach(ConfigurationNode conf in solution.Configurations) | 337 | foreach(ConfigurationNode conf in solution.Configurations) |
338 | { | 338 | { |
339 | if(count == 0) | 339 | if(count == 0) |
340 | { | 340 | { |
341 | ss.WriteLine(" <Configurations active=\"{0}\">", conf.Name); | 341 | ss.WriteLine(" <Configurations active=\"{0}\">", conf.Name); |
342 | } | 342 | } |
343 | 343 | ||
344 | ss.WriteLine(" <Configuration name=\"{0}\" ctype=\"CombineConfiguration\">", conf.Name); | 344 | ss.WriteLine(" <Configuration name=\"{0}\" ctype=\"CombineConfiguration\">", conf.Name); |
345 | foreach(ProjectNode project in solution.Projects) | 345 | foreach(ProjectNode project in solution.Projects) |
346 | { | 346 | { |
347 | ss.WriteLine(" <Entry configuration=\"{1}\" build=\"True\" name=\"{0}\" />", project.Name, conf.Name); | 347 | ss.WriteLine(" <Entry configuration=\"{1}\" build=\"True\" name=\"{0}\" />", project.Name, conf.Name); |
348 | } | 348 | } |
349 | ss.WriteLine(" </Configuration>"); | 349 | ss.WriteLine(" </Configuration>"); |
350 | 350 | ||
351 | count++; | 351 | count++; |
352 | } | 352 | } |
353 | ss.WriteLine(" </Configurations>"); | 353 | ss.WriteLine(" </Configurations>"); |
354 | 354 | ||
355 | count = 0; | 355 | count = 0; |
356 | 356 | ||
357 | foreach(ProjectNode project in solution.Projects) | 357 | foreach(ProjectNode project in solution.Projects) |
358 | { | 358 | { |
359 | if(count == 0) | 359 | if(count == 0) |
360 | ss.WriteLine(" <StartMode startupentry=\"{0}\" single=\"True\">", project.Name); | 360 | ss.WriteLine(" <StartMode startupentry=\"{0}\" single=\"True\">", project.Name); |
361 | 361 | ||
362 | ss.WriteLine(" <Execute type=\"None\" entry=\"{0}\" />", project.Name); | 362 | ss.WriteLine(" <Execute type=\"None\" entry=\"{0}\" />", project.Name); |
363 | count++; | 363 | count++; |
364 | } | 364 | } |
365 | ss.WriteLine(" </StartMode>"); | 365 | ss.WriteLine(" </StartMode>"); |
366 | 366 | ||
367 | ss.WriteLine(" <Entries>"); | 367 | ss.WriteLine(" <Entries>"); |
368 | foreach(ProjectNode project in solution.Projects) | 368 | foreach(ProjectNode project in solution.Projects) |
369 | { | 369 | { |
370 | string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath); | 370 | string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath); |
371 | ss.WriteLine(" <Entry filename=\"{0}\" />", | 371 | ss.WriteLine(" <Entry filename=\"{0}\" />", |
372 | Helper.MakeFilePath(path, project.Name, "mdp")); | 372 | Helper.MakeFilePath(path, project.Name, "mdp")); |
373 | } | 373 | } |
374 | ss.WriteLine(" </Entries>"); | 374 | ss.WriteLine(" </Entries>"); |
375 | 375 | ||
376 | ss.WriteLine("</Combine>"); | 376 | ss.WriteLine("</Combine>"); |
377 | } | 377 | } |
378 | 378 | ||
379 | m_Kernel.CurrentWorkingDirectory.Pop(); | 379 | m_Kernel.CurrentWorkingDirectory.Pop(); |
380 | } | 380 | } |
381 | 381 | ||
382 | private void CleanProject(ProjectNode project) | 382 | private void CleanProject(ProjectNode project) |
383 | { | 383 | { |
384 | m_Kernel.Log.Write("...Cleaning project: {0}", project.Name); | 384 | m_Kernel.Log.Write("...Cleaning project: {0}", project.Name); |
385 | string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, "mdp"); | 385 | string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, "mdp"); |
386 | Helper.DeleteIfExists(projectFile); | 386 | Helper.DeleteIfExists(projectFile); |
387 | } | 387 | } |
388 | 388 | ||
389 | private void CleanSolution(SolutionNode solution) | 389 | private void CleanSolution(SolutionNode solution) |
390 | { | 390 | { |
391 | m_Kernel.Log.Write("Cleaning MonoDevelop combine and project files for", solution.Name); | 391 | m_Kernel.Log.Write("Cleaning MonoDevelop combine and project files for", solution.Name); |
392 | 392 | ||
393 | string slnFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "mds"); | 393 | string slnFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "mds"); |
394 | Helper.DeleteIfExists(slnFile); | 394 | Helper.DeleteIfExists(slnFile); |
395 | 395 | ||
396 | foreach(ProjectNode project in solution.Projects) | 396 | foreach(ProjectNode project in solution.Projects) |
397 | { | 397 | { |
398 | CleanProject(project); | 398 | CleanProject(project); |
399 | } | 399 | } |
400 | 400 | ||
401 | m_Kernel.Log.Write(""); | 401 | m_Kernel.Log.Write(""); |
402 | } | 402 | } |
403 | 403 | ||
404 | #endregion | 404 | #endregion |
405 | 405 | ||
406 | #region ITarget Members | 406 | #region ITarget Members |
407 | 407 | ||
408 | /// <summary> | 408 | /// <summary> |
409 | /// Writes the specified kern. | 409 | /// Writes the specified kern. |
410 | /// </summary> | 410 | /// </summary> |
411 | /// <param name="kern">The kern.</param> | 411 | /// <param name="kern">The kern.</param> |
412 | public void Write(Kernel kern) | 412 | public void Write(Kernel kern) |
413 | { | 413 | { |
414 | if( kern == null ) | 414 | if( kern == null ) |
415 | { | 415 | { |
416 | throw new ArgumentNullException("kern"); | 416 | throw new ArgumentNullException("kern"); |
417 | } | 417 | } |
418 | m_Kernel = kern; | 418 | m_Kernel = kern; |
419 | foreach(SolutionNode solution in kern.Solutions) | 419 | foreach(SolutionNode solution in kern.Solutions) |
420 | { | 420 | { |
421 | WriteCombine(solution); | 421 | WriteCombine(solution); |
422 | } | 422 | } |
423 | m_Kernel = null; | 423 | m_Kernel = null; |
424 | } | 424 | } |
425 | 425 | ||
426 | /// <summary> | 426 | /// <summary> |
427 | /// Cleans the specified kern. | 427 | /// Cleans the specified kern. |
428 | /// </summary> | 428 | /// </summary> |
429 | /// <param name="kern">The kern.</param> | 429 | /// <param name="kern">The kern.</param> |
430 | public virtual void Clean(Kernel kern) | 430 | public virtual void Clean(Kernel kern) |
431 | { | 431 | { |
432 | if( kern == null ) | 432 | if( kern == null ) |
433 | { | 433 | { |
434 | throw new ArgumentNullException("kern"); | 434 | throw new ArgumentNullException("kern"); |
435 | } | 435 | } |
436 | m_Kernel = kern; | 436 | m_Kernel = kern; |
437 | foreach(SolutionNode sol in kern.Solutions) | 437 | foreach(SolutionNode sol in kern.Solutions) |
438 | { | 438 | { |
439 | CleanSolution(sol); | 439 | CleanSolution(sol); |
440 | } | 440 | } |
441 | m_Kernel = null; | 441 | m_Kernel = null; |
442 | } | 442 | } |
443 | 443 | ||
444 | /// <summary> | 444 | /// <summary> |
445 | /// Gets the name. | 445 | /// Gets the name. |
446 | /// </summary> | 446 | /// </summary> |
447 | /// <value>The name.</value> | 447 | /// <value>The name.</value> |
448 | public string Name | 448 | public string Name |
449 | { | 449 | { |
450 | get | 450 | get |
451 | { | 451 | { |
452 | return "sharpdev"; | 452 | return "sharpdev"; |
453 | } | 453 | } |
454 | } | 454 | } |
455 | 455 | ||
456 | #endregion | 456 | #endregion |
457 | } | 457 | } |
458 | } | 458 | } |
diff --git a/Prebuild/src/Core/Targets/NAntTarget.cs b/Prebuild/src/Core/Targets/NAntTarget.cs index 0f0deb2..4669cfd 100644 --- a/Prebuild/src/Core/Targets/NAntTarget.cs +++ b/Prebuild/src/Core/Targets/NAntTarget.cs | |||
@@ -1,621 +1,621 @@ | |||
1 | #region BSD License | 1 | #region BSD License |
2 | /* | 2 | /* |
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 | ||
26 | #region CVS Information | 26 | #region CVS Information |
27 | /* | 27 | /* |
28 | * $Source$ | 28 | * $Source$ |
29 | * $Author: jendave $ | 29 | * $Author: jendave $ |
30 | * $Date: 2007-02-13 21:58:03 +0100 (ti, 13 feb 2007) $ | 30 | * $Date: 2007-02-13 21:58:03 +0100 (ti, 13 feb 2007) $ |
31 | * $Revision: 205 $ | 31 | * $Revision: 205 $ |
32 | */ | 32 | */ |
33 | #endregion | 33 | #endregion |
34 | 34 | ||
35 | using System; | 35 | using System; |
36 | using System.Collections; | 36 | using System.Collections; |
37 | using System.Collections.Specialized; | 37 | using System.Collections.Specialized; |
38 | using System.IO; | 38 | using System.IO; |
39 | using System.Reflection; | 39 | using System.Reflection; |
40 | using System.Text.RegularExpressions; | 40 | using System.Text.RegularExpressions; |
41 | 41 | ||
42 | using Prebuild.Core.Attributes; | 42 | using Prebuild.Core.Attributes; |
43 | using Prebuild.Core.Interfaces; | 43 | using Prebuild.Core.Interfaces; |
44 | using Prebuild.Core.Nodes; | 44 | using Prebuild.Core.Nodes; |
45 | using Prebuild.Core.Utilities; | 45 | 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 | { | 279 | { |
280 | switch (project.Files.GetBuildAction(file)) | 280 | switch (project.Files.GetBuildAction(file)) |
281 | { | 281 | { |
282 | case BuildAction.EmbeddedResource: | 282 | case BuildAction.EmbeddedResource: |
283 | ss.WriteLine(" {0}", "<include name=\"" + Helper.NormalizePath(PrependPath(file), '/') + "\" />"); | 283 | ss.WriteLine(" {0}", "<include name=\"" + Helper.NormalizePath(PrependPath(file), '/') + "\" />"); |
284 | break; | 284 | break; |
285 | default: | 285 | default: |
286 | if (project.Files.GetSubType(file) != SubType.Code && project.Files.GetSubType(file) != SubType.Settings) | 286 | if (project.Files.GetSubType(file) != SubType.Code && project.Files.GetSubType(file) != SubType.Settings) |
287 | { | 287 | { |
288 | ss.WriteLine(" <include name=\"{0}\" />", file.Substring(0, file.LastIndexOf('.')) + ".resx"); | 288 | ss.WriteLine(" <include name=\"{0}\" />", file.Substring(0, file.LastIndexOf('.')) + ".resx"); |
289 | } | 289 | } |
290 | break; | 290 | break; |
291 | } | 291 | } |
292 | } | 292 | } |
293 | //if (project.Files.GetSubType(file).ToString() != "Code") | 293 | //if (project.Files.GetSubType(file).ToString() != "Code") |
294 | //{ | 294 | //{ |
295 | // ps.WriteLine(" <EmbeddedResource Include=\"{0}\">", file.Substring(0, file.LastIndexOf('.')) + ".resx"); | 295 | // ps.WriteLine(" <EmbeddedResource Include=\"{0}\">", file.Substring(0, file.LastIndexOf('.')) + ".resx"); |
296 | 296 | ||
297 | ss.WriteLine(" </resources>"); | 297 | ss.WriteLine(" </resources>"); |
298 | ss.WriteLine(" <sources failonempty=\"true\">"); | 298 | ss.WriteLine(" <sources failonempty=\"true\">"); |
299 | foreach(string file in project.Files) | 299 | foreach(string file in project.Files) |
300 | { | 300 | { |
301 | switch(project.Files.GetBuildAction(file)) | 301 | switch(project.Files.GetBuildAction(file)) |
302 | { | 302 | { |
303 | case BuildAction.Compile: | 303 | case BuildAction.Compile: |
304 | ss.WriteLine(" <include name=\"" + Helper.NormalizePath(PrependPath(file), '/') + "\" />"); | 304 | ss.WriteLine(" <include name=\"" + Helper.NormalizePath(PrependPath(file), '/') + "\" />"); |
305 | break; | 305 | break; |
306 | default: | 306 | default: |
307 | break; | 307 | break; |
308 | } | 308 | } |
309 | } | 309 | } |
310 | ss.WriteLine(" </sources>"); | 310 | ss.WriteLine(" </sources>"); |
311 | ss.WriteLine(" <references basedir=\"${project::get-base-directory()}\">"); | 311 | ss.WriteLine(" <references basedir=\"${project::get-base-directory()}\">"); |
312 | ss.WriteLine(" <lib>"); | 312 | ss.WriteLine(" <lib>"); |
313 | ss.WriteLine(" <include name=\"${project::get-base-directory()}\" />"); | 313 | ss.WriteLine(" <include name=\"${project::get-base-directory()}\" />"); |
314 | ss.WriteLine(" <include name=\"${project::get-base-directory()}/${build.dir}\" />"); | 314 | ss.WriteLine(" <include name=\"${project::get-base-directory()}/${build.dir}\" />"); |
315 | ss.WriteLine(" </lib>"); | 315 | ss.WriteLine(" </lib>"); |
316 | foreach(ReferenceNode refr in project.References) | 316 | foreach(ReferenceNode refr in project.References) |
317 | { | 317 | { |
318 | string path = Helper.NormalizePath(Helper.MakePathRelativeTo(project.FullPath, BuildReference(solution, project, refr)), '/'); | 318 | string path = Helper.NormalizePath(Helper.MakePathRelativeTo(project.FullPath, BuildReference(solution, project, refr)), '/'); |
319 | ss.WriteLine(" <include name=\""+ path + "\" />" ); | 319 | ss.WriteLine(" <include name=\""+ path + "\" />" ); |
320 | } | 320 | } |
321 | ss.WriteLine(" </references>"); | 321 | ss.WriteLine(" </references>"); |
322 | 322 | ||
323 | ss.WriteLine(" </csc>"); | 323 | ss.WriteLine(" </csc>"); |
324 | 324 | ||
325 | foreach (ConfigurationNode conf in project.Configurations) | 325 | foreach (ConfigurationNode conf in project.Configurations) |
326 | { | 326 | { |
327 | if (!String.IsNullOrEmpty(conf.Options.OutputPath)) | 327 | if (!String.IsNullOrEmpty(conf.Options.OutputPath)) |
328 | { | 328 | { |
329 | string targetDir = Helper.NormalizePath(conf.Options.OutputPath, '/'); | 329 | string targetDir = Helper.NormalizePath(conf.Options.OutputPath, '/'); |
330 | 330 | ||
331 | ss.WriteLine(" <echo message=\"Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/" + targetDir + "\" />"); | 331 | ss.WriteLine(" <echo message=\"Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/" + targetDir + "\" />"); |
332 | 332 | ||
333 | ss.WriteLine(" <mkdir dir=\"${project::get-base-directory()}/" + targetDir + "\"/>"); | 333 | ss.WriteLine(" <mkdir dir=\"${project::get-base-directory()}/" + targetDir + "\"/>"); |
334 | 334 | ||
335 | ss.WriteLine(" <copy todir=\"${project::get-base-directory()}/" + targetDir + "\">"); | 335 | ss.WriteLine(" <copy todir=\"${project::get-base-directory()}/" + targetDir + "\">"); |
336 | ss.WriteLine(" <fileset basedir=\"${project::get-base-directory()}/${build.dir}/\" >"); | 336 | ss.WriteLine(" <fileset basedir=\"${project::get-base-directory()}/${build.dir}/\" >"); |
337 | ss.WriteLine(" <include name=\"*.dll\"/>"); | 337 | ss.WriteLine(" <include name=\"*.dll\"/>"); |
338 | ss.WriteLine(" <include name=\"*.exe\"/>"); | 338 | ss.WriteLine(" <include name=\"*.exe\"/>"); |
339 | ss.WriteLine(" </fileset>"); | 339 | ss.WriteLine(" </fileset>"); |
340 | ss.WriteLine(" </copy>"); | 340 | ss.WriteLine(" </copy>"); |
341 | break; | 341 | break; |
342 | } | 342 | } |
343 | } | 343 | } |
344 | 344 | ||
345 | ss.WriteLine(" </target>"); | 345 | ss.WriteLine(" </target>"); |
346 | 346 | ||
347 | ss.WriteLine(" <target name=\"clean\">"); | 347 | ss.WriteLine(" <target name=\"clean\">"); |
348 | ss.WriteLine(" <delete dir=\"${bin.dir}\" failonerror=\"false\" />"); | 348 | ss.WriteLine(" <delete dir=\"${bin.dir}\" failonerror=\"false\" />"); |
349 | ss.WriteLine(" <delete dir=\"${obj.dir}\" failonerror=\"false\" />"); | 349 | ss.WriteLine(" <delete dir=\"${obj.dir}\" failonerror=\"false\" />"); |
350 | ss.WriteLine(" </target>"); | 350 | ss.WriteLine(" </target>"); |
351 | 351 | ||
352 | ss.WriteLine(" <target name=\"doc\" description=\"Creates documentation.\">"); | 352 | ss.WriteLine(" <target name=\"doc\" description=\"Creates documentation.\">"); |
353 | if (hasDoc) | 353 | if (hasDoc) |
354 | { | 354 | { |
355 | ss.WriteLine(" <property name=\"doc.target\" value=\"\" />"); | 355 | ss.WriteLine(" <property name=\"doc.target\" value=\"\" />"); |
356 | ss.WriteLine(" <if test=\"${platform::is-unix()}\">"); | 356 | ss.WriteLine(" <if test=\"${platform::is-unix()}\">"); |
357 | ss.WriteLine(" <property name=\"doc.target\" value=\"Web\" />"); | 357 | ss.WriteLine(" <property name=\"doc.target\" value=\"Web\" />"); |
358 | ss.WriteLine(" </if>"); | 358 | ss.WriteLine(" </if>"); |
359 | ss.WriteLine(" <ndoc failonerror=\"false\" verbose=\"true\">"); | 359 | ss.WriteLine(" <ndoc failonerror=\"false\" verbose=\"true\">"); |
360 | ss.WriteLine(" <assemblies basedir=\"${project::get-base-directory()}\">"); | 360 | ss.WriteLine(" <assemblies basedir=\"${project::get-base-directory()}\">"); |
361 | ss.Write(" <include name=\"${build.dir}/${project::get-name()}"); | 361 | ss.Write(" <include name=\"${build.dir}/${project::get-name()}"); |
362 | if (project.Type == ProjectType.Library) | 362 | if (project.Type == ProjectType.Library) |
363 | { | 363 | { |
364 | ss.WriteLine(".dll\" />"); | 364 | ss.WriteLine(".dll\" />"); |
365 | } | 365 | } |
366 | else | 366 | else |
367 | { | 367 | { |
368 | ss.WriteLine(".exe\" />"); | 368 | ss.WriteLine(".exe\" />"); |
369 | } | 369 | } |
370 | 370 | ||
371 | ss.WriteLine(" </assemblies>"); | 371 | ss.WriteLine(" </assemblies>"); |
372 | ss.WriteLine(" <summaries basedir=\"${project::get-base-directory()}\">"); | 372 | ss.WriteLine(" <summaries basedir=\"${project::get-base-directory()}\">"); |
373 | ss.WriteLine(" <include name=\"${build.dir}/${project::get-name()}.xml\"/>"); | 373 | ss.WriteLine(" <include name=\"${build.dir}/${project::get-name()}.xml\"/>"); |
374 | ss.WriteLine(" </summaries>"); | 374 | ss.WriteLine(" </summaries>"); |
375 | ss.WriteLine(" <referencepaths basedir=\"${project::get-base-directory()}\">"); | 375 | ss.WriteLine(" <referencepaths basedir=\"${project::get-base-directory()}\">"); |
376 | ss.WriteLine(" <include name=\"${build.dir}\" />"); | 376 | ss.WriteLine(" <include name=\"${build.dir}\" />"); |
377 | // foreach(ReferenceNode refr in project.References) | 377 | // foreach(ReferenceNode refr in project.References) |
378 | // { | 378 | // { |
379 | // string path = Helper.NormalizePath(Helper.MakePathRelativeTo(project.FullPath, BuildReferencePath(solution, refr)), '/'); | 379 | // string path = Helper.NormalizePath(Helper.MakePathRelativeTo(project.FullPath, BuildReferencePath(solution, refr)), '/'); |
380 | // if (path != "") | 380 | // if (path != "") |
381 | // { | 381 | // { |
382 | // ss.WriteLine(" <include name=\"{0}\" />", path); | 382 | // ss.WriteLine(" <include name=\"{0}\" />", path); |
383 | // } | 383 | // } |
384 | // } | 384 | // } |
385 | ss.WriteLine(" </referencepaths>"); | 385 | ss.WriteLine(" </referencepaths>"); |
386 | ss.WriteLine(" <documenters>"); | 386 | ss.WriteLine(" <documenters>"); |
387 | ss.WriteLine(" <documenter name=\"MSDN\">"); | 387 | ss.WriteLine(" <documenter name=\"MSDN\">"); |
388 | ss.WriteLine(" <property name=\"OutputDirectory\" value=\"${project::get-base-directory()}/${build.dir}/doc/${project::get-name()}\" />"); | 388 | ss.WriteLine(" <property name=\"OutputDirectory\" value=\"${project::get-base-directory()}/${build.dir}/doc/${project::get-name()}\" />"); |
389 | ss.WriteLine(" <property name=\"OutputTarget\" value=\"${doc.target}\" />"); | 389 | ss.WriteLine(" <property name=\"OutputTarget\" value=\"${doc.target}\" />"); |
390 | ss.WriteLine(" <property name=\"HtmlHelpName\" value=\"${project::get-name()}\" />"); | 390 | ss.WriteLine(" <property name=\"HtmlHelpName\" value=\"${project::get-name()}\" />"); |
391 | ss.WriteLine(" <property name=\"IncludeFavorites\" value=\"False\" />"); | 391 | ss.WriteLine(" <property name=\"IncludeFavorites\" value=\"False\" />"); |
392 | ss.WriteLine(" <property name=\"Title\" value=\"${project::get-name()} SDK Documentation\" />"); | 392 | ss.WriteLine(" <property name=\"Title\" value=\"${project::get-name()} SDK Documentation\" />"); |
393 | ss.WriteLine(" <property name=\"SplitTOCs\" value=\"False\" />"); | 393 | ss.WriteLine(" <property name=\"SplitTOCs\" value=\"False\" />"); |
394 | ss.WriteLine(" <property name=\"DefaulTOC\" value=\"\" />"); | 394 | ss.WriteLine(" <property name=\"DefaulTOC\" value=\"\" />"); |
395 | ss.WriteLine(" <property name=\"ShowVisualBasic\" value=\"True\" />"); | 395 | ss.WriteLine(" <property name=\"ShowVisualBasic\" value=\"True\" />"); |
396 | ss.WriteLine(" <property name=\"AutoDocumentConstructors\" value=\"True\" />"); | 396 | ss.WriteLine(" <property name=\"AutoDocumentConstructors\" value=\"True\" />"); |
397 | ss.WriteLine(" <property name=\"ShowMissingSummaries\" value=\"${build.debug}\" />"); | 397 | ss.WriteLine(" <property name=\"ShowMissingSummaries\" value=\"${build.debug}\" />"); |
398 | ss.WriteLine(" <property name=\"ShowMissingRemarks\" value=\"${build.debug}\" />"); | 398 | ss.WriteLine(" <property name=\"ShowMissingRemarks\" value=\"${build.debug}\" />"); |
399 | ss.WriteLine(" <property name=\"ShowMissingParams\" value=\"${build.debug}\" />"); | 399 | ss.WriteLine(" <property name=\"ShowMissingParams\" value=\"${build.debug}\" />"); |
400 | ss.WriteLine(" <property name=\"ShowMissingReturns\" value=\"${build.debug}\" />"); | 400 | ss.WriteLine(" <property name=\"ShowMissingReturns\" value=\"${build.debug}\" />"); |
401 | ss.WriteLine(" <property name=\"ShowMissingValues\" value=\"${build.debug}\" />"); | 401 | ss.WriteLine(" <property name=\"ShowMissingValues\" value=\"${build.debug}\" />"); |
402 | ss.WriteLine(" <property name=\"DocumentInternals\" value=\"False\" />"); | 402 | ss.WriteLine(" <property name=\"DocumentInternals\" value=\"False\" />"); |
403 | ss.WriteLine(" <property name=\"DocumentPrivates\" value=\"False\" />"); | 403 | ss.WriteLine(" <property name=\"DocumentPrivates\" value=\"False\" />"); |
404 | ss.WriteLine(" <property name=\"DocumentProtected\" value=\"True\" />"); | 404 | ss.WriteLine(" <property name=\"DocumentProtected\" value=\"True\" />"); |
405 | ss.WriteLine(" <property name=\"DocumentEmptyNamespaces\" value=\"${build.debug}\" />"); | 405 | ss.WriteLine(" <property name=\"DocumentEmptyNamespaces\" value=\"${build.debug}\" />"); |
406 | ss.WriteLine(" <property name=\"IncludeAssemblyVersion\" value=\"True\" />"); | 406 | ss.WriteLine(" <property name=\"IncludeAssemblyVersion\" value=\"True\" />"); |
407 | ss.WriteLine(" </documenter>"); | 407 | ss.WriteLine(" </documenter>"); |
408 | ss.WriteLine(" </documenters>"); | 408 | ss.WriteLine(" </documenters>"); |
409 | ss.WriteLine(" </ndoc>"); | 409 | ss.WriteLine(" </ndoc>"); |
410 | } | 410 | } |
411 | ss.WriteLine(" </target>"); | 411 | ss.WriteLine(" </target>"); |
412 | ss.WriteLine("</project>"); | 412 | ss.WriteLine("</project>"); |
413 | } | 413 | } |
414 | m_Kernel.CurrentWorkingDirectory.Pop(); | 414 | m_Kernel.CurrentWorkingDirectory.Pop(); |
415 | } | 415 | } |
416 | 416 | ||
417 | private void WriteCombine(SolutionNode solution) | 417 | private void WriteCombine(SolutionNode solution) |
418 | { | 418 | { |
419 | m_Kernel.Log.Write("Creating NAnt build files"); | 419 | m_Kernel.Log.Write("Creating NAnt build files"); |
420 | foreach(ProjectNode project in solution.Projects) | 420 | foreach(ProjectNode project in solution.Projects) |
421 | { | 421 | { |
422 | if(m_Kernel.AllowProject(project.FilterGroups)) | 422 | if(m_Kernel.AllowProject(project.FilterGroups)) |
423 | { | 423 | { |
424 | m_Kernel.Log.Write("...Creating project: {0}", project.Name); | 424 | m_Kernel.Log.Write("...Creating project: {0}", project.Name); |
425 | WriteProject(solution, project); | 425 | WriteProject(solution, project); |
426 | } | 426 | } |
427 | } | 427 | } |
428 | 428 | ||
429 | m_Kernel.Log.Write(""); | 429 | m_Kernel.Log.Write(""); |
430 | string combFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "build"); | 430 | string combFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "build"); |
431 | StreamWriter ss = new StreamWriter(combFile); | 431 | StreamWriter ss = new StreamWriter(combFile); |
432 | 432 | ||
433 | m_Kernel.CurrentWorkingDirectory.Push(); | 433 | m_Kernel.CurrentWorkingDirectory.Push(); |
434 | Helper.SetCurrentDir(Path.GetDirectoryName(combFile)); | 434 | Helper.SetCurrentDir(Path.GetDirectoryName(combFile)); |
435 | 435 | ||
436 | using(ss) | 436 | using(ss) |
437 | { | 437 | { |
438 | ss.WriteLine("<?xml version=\"1.0\" ?>"); | 438 | ss.WriteLine("<?xml version=\"1.0\" ?>"); |
439 | ss.WriteLine("<project name=\"{0}\" default=\"build\">", solution.Name); | 439 | ss.WriteLine("<project name=\"{0}\" default=\"build\">", solution.Name); |
440 | ss.WriteLine(" <echo message=\"Using '${nant.settings.currentframework}' Framework\"/>"); | 440 | ss.WriteLine(" <echo message=\"Using '${nant.settings.currentframework}' Framework\"/>"); |
441 | ss.WriteLine(); | 441 | ss.WriteLine(); |
442 | 442 | ||
443 | //ss.WriteLine(" <property name=\"dist.dir\" value=\"dist\" />"); | 443 | //ss.WriteLine(" <property name=\"dist.dir\" value=\"dist\" />"); |
444 | //ss.WriteLine(" <property name=\"source.dir\" value=\"source\" />"); | 444 | //ss.WriteLine(" <property name=\"source.dir\" value=\"source\" />"); |
445 | ss.WriteLine(" <property name=\"bin.dir\" value=\"bin\" />"); | 445 | ss.WriteLine(" <property name=\"bin.dir\" value=\"bin\" />"); |
446 | ss.WriteLine(" <property name=\"obj.dir\" value=\"obj\" />"); | 446 | ss.WriteLine(" <property name=\"obj.dir\" value=\"obj\" />"); |
447 | ss.WriteLine(" <property name=\"doc.dir\" value=\"doc\" />"); | 447 | ss.WriteLine(" <property name=\"doc.dir\" value=\"doc\" />"); |
448 | ss.WriteLine(" <property name=\"project.main.dir\" value=\"${project::get-base-directory()}\" />"); | 448 | ss.WriteLine(" <property name=\"project.main.dir\" value=\"${project::get-base-directory()}\" />"); |
449 | 449 | ||
450 | foreach(ConfigurationNode conf in solution.Configurations) | 450 | foreach(ConfigurationNode conf in solution.Configurations) |
451 | { | 451 | { |
452 | // Set the project.config to a non-debug configuration | 452 | // Set the project.config to a non-debug configuration |
453 | if( conf.Options["DebugInformation"].ToString().ToLower() != "true" ) | 453 | if( conf.Options["DebugInformation"].ToString().ToLower() != "true" ) |
454 | { | 454 | { |
455 | ss.WriteLine(" <property name=\"project.config\" value=\"{0}\" />", conf.Name); | 455 | ss.WriteLine(" <property name=\"project.config\" value=\"{0}\" />", conf.Name); |
456 | } | 456 | } |
457 | ss.WriteLine(); | 457 | ss.WriteLine(); |
458 | ss.WriteLine(" <target name=\"{0}\" description=\"\">", conf.Name); | 458 | ss.WriteLine(" <target name=\"{0}\" description=\"\">", conf.Name); |
459 | ss.WriteLine(" <property name=\"project.config\" value=\"{0}\" />", conf.Name); | 459 | ss.WriteLine(" <property name=\"project.config\" value=\"{0}\" />", conf.Name); |
460 | ss.WriteLine(" <property name=\"build.debug\" value=\"{0}\" />", conf.Options["DebugInformation"].ToString().ToLower()); | 460 | ss.WriteLine(" <property name=\"build.debug\" value=\"{0}\" />", conf.Options["DebugInformation"].ToString().ToLower()); |
461 | ss.WriteLine(" </target>"); | 461 | ss.WriteLine(" </target>"); |
462 | ss.WriteLine(); | 462 | ss.WriteLine(); |
463 | } | 463 | } |
464 | 464 | ||
465 | ss.WriteLine(" <target name=\"net-1.1\" description=\"Sets framework to .NET 1.1\">"); | 465 | ss.WriteLine(" <target name=\"net-1.1\" description=\"Sets framework to .NET 1.1\">"); |
466 | ss.WriteLine(" <property name=\"nant.settings.currentframework\" value=\"net-1.1\" />"); | 466 | ss.WriteLine(" <property name=\"nant.settings.currentframework\" value=\"net-1.1\" />"); |
467 | ss.WriteLine(" </target>"); | 467 | ss.WriteLine(" </target>"); |
468 | ss.WriteLine(); | 468 | ss.WriteLine(); |
469 | 469 | ||
470 | ss.WriteLine(" <target name=\"net-2.0\" description=\"Sets framework to .NET 2.0\">"); | 470 | ss.WriteLine(" <target name=\"net-2.0\" description=\"Sets framework to .NET 2.0\">"); |
471 | ss.WriteLine(" <property name=\"nant.settings.currentframework\" value=\"net-2.0\" />"); | 471 | ss.WriteLine(" <property name=\"nant.settings.currentframework\" value=\"net-2.0\" />"); |
472 | ss.WriteLine(" </target>"); | 472 | ss.WriteLine(" </target>"); |
473 | ss.WriteLine(); | 473 | ss.WriteLine(); |
474 | 474 | ||
475 | ss.WriteLine(" <target name=\"mono-2.0\" description=\"Sets framework to mono 2.0\">"); | 475 | ss.WriteLine(" <target name=\"mono-2.0\" description=\"Sets framework to mono 2.0\">"); |
476 | ss.WriteLine(" <property name=\"nant.settings.currentframework\" value=\"mono-2.0\" />"); | 476 | ss.WriteLine(" <property name=\"nant.settings.currentframework\" value=\"mono-2.0\" />"); |
477 | ss.WriteLine(" </target>"); | 477 | ss.WriteLine(" </target>"); |
478 | ss.WriteLine(); | 478 | ss.WriteLine(); |
479 | 479 | ||
480 | ss.WriteLine(" <target name=\"mono-1.0\" description=\"Sets framework to mono 1.0\">"); | 480 | ss.WriteLine(" <target name=\"mono-1.0\" description=\"Sets framework to mono 1.0\">"); |
481 | ss.WriteLine(" <property name=\"nant.settings.currentframework\" value=\"mono-1.0\" />"); | 481 | ss.WriteLine(" <property name=\"nant.settings.currentframework\" value=\"mono-1.0\" />"); |
482 | ss.WriteLine(" </target>"); | 482 | ss.WriteLine(" </target>"); |
483 | ss.WriteLine(); | 483 | ss.WriteLine(); |
484 | 484 | ||
485 | ss.WriteLine(" <target name=\"init\" description=\"\">"); | 485 | ss.WriteLine(" <target name=\"init\" description=\"\">"); |
486 | ss.WriteLine(" <call target=\"${project.config}\" />"); | 486 | ss.WriteLine(" <call target=\"${project.config}\" />"); |
487 | ss.WriteLine(" <sysinfo />"); | 487 | ss.WriteLine(" <sysinfo />"); |
488 | ss.WriteLine(" <echo message=\"Platform ${sys.os.platform}\" />"); | 488 | ss.WriteLine(" <echo message=\"Platform ${sys.os.platform}\" />"); |
489 | ss.WriteLine(" <property name=\"build.dir\" value=\"${bin.dir}/${project.config}\" />"); | 489 | ss.WriteLine(" <property name=\"build.dir\" value=\"${bin.dir}/${project.config}\" />"); |
490 | ss.WriteLine(" </target>"); | 490 | ss.WriteLine(" </target>"); |
491 | ss.WriteLine(); | 491 | ss.WriteLine(); |
492 | 492 | ||
493 | ss.WriteLine(" <target name=\"clean\" description=\"\">"); | 493 | ss.WriteLine(" <target name=\"clean\" description=\"\">"); |
494 | ss.WriteLine(" <echo message=\"Deleting all builds from all configurations\" />"); | 494 | ss.WriteLine(" <echo message=\"Deleting all builds from all configurations\" />"); |
495 | //ss.WriteLine(" <delete dir=\"${dist.dir}\" failonerror=\"false\" />"); | 495 | //ss.WriteLine(" <delete dir=\"${dist.dir}\" failonerror=\"false\" />"); |
496 | ss.WriteLine(" <delete dir=\"${bin.dir}\" failonerror=\"false\" />"); | 496 | ss.WriteLine(" <delete dir=\"${bin.dir}\" failonerror=\"false\" />"); |
497 | ss.WriteLine(" <delete dir=\"${obj.dir}\" failonerror=\"false\" />"); | 497 | ss.WriteLine(" <delete dir=\"${obj.dir}\" failonerror=\"false\" />"); |
498 | foreach(ProjectNode project in solution.Projects) | 498 | foreach(ProjectNode project in solution.Projects) |
499 | { | 499 | { |
500 | string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath); | 500 | string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath); |
501 | ss.Write(" <nant buildfile=\"{0}\"", | 501 | ss.Write(" <nant buildfile=\"{0}\"", |
502 | Helper.NormalizePath(Helper.MakeFilePath(path, project.Name + (project.Type == ProjectType.Library ? ".dll" : ".exe"), "build"),'/')); | 502 | Helper.NormalizePath(Helper.MakeFilePath(path, project.Name + (project.Type == ProjectType.Library ? ".dll" : ".exe"), "build"),'/')); |
503 | ss.WriteLine(" target=\"clean\" />"); | 503 | ss.WriteLine(" target=\"clean\" />"); |
504 | } | 504 | } |
505 | ss.WriteLine(" </target>"); | 505 | ss.WriteLine(" </target>"); |
506 | ss.WriteLine(); | 506 | ss.WriteLine(); |
507 | 507 | ||
508 | ss.WriteLine(" <target name=\"build\" depends=\"init\" description=\"\">"); | 508 | ss.WriteLine(" <target name=\"build\" depends=\"init\" description=\"\">"); |
509 | 509 | ||
510 | foreach(ProjectNode project in solution.ProjectsTableOrder) | 510 | foreach(ProjectNode project in solution.ProjectsTableOrder) |
511 | { | 511 | { |
512 | string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath); | 512 | string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath); |
513 | ss.Write(" <nant buildfile=\"{0}\"", | 513 | ss.Write(" <nant buildfile=\"{0}\"", |
514 | Helper.NormalizePath(Helper.MakeFilePath(path, project.Name + (project.Type == ProjectType.Library ? ".dll" : ".exe"), "build"),'/')); | 514 | Helper.NormalizePath(Helper.MakeFilePath(path, project.Name + (project.Type == ProjectType.Library ? ".dll" : ".exe"), "build"),'/')); |
515 | ss.WriteLine(" target=\"build\" />"); | 515 | ss.WriteLine(" target=\"build\" />"); |
516 | } | 516 | } |
517 | ss.WriteLine(" </target>"); | 517 | ss.WriteLine(" </target>"); |
518 | ss.WriteLine(); | 518 | ss.WriteLine(); |
519 | 519 | ||
520 | ss.WriteLine(" <target name=\"build-release\" depends=\"Release, init, build\" description=\"Builds in Release mode\" />"); | 520 | ss.WriteLine(" <target name=\"build-release\" depends=\"Release, init, build\" description=\"Builds in Release mode\" />"); |
521 | ss.WriteLine(); | 521 | ss.WriteLine(); |
522 | ss.WriteLine(" <target name=\"build-debug\" depends=\"Debug, init, build\" description=\"Builds in Debug mode\" />"); | 522 | ss.WriteLine(" <target name=\"build-debug\" depends=\"Debug, init, build\" description=\"Builds in Debug mode\" />"); |
523 | ss.WriteLine(); | 523 | ss.WriteLine(); |
524 | //ss.WriteLine(" <target name=\"package\" depends=\"clean, doc, copyfiles, zip\" description=\"Builds in Release mode\" />"); | 524 | //ss.WriteLine(" <target name=\"package\" depends=\"clean, doc, copyfiles, zip\" description=\"Builds in Release mode\" />"); |
525 | ss.WriteLine(" <target name=\"package\" depends=\"clean, doc\" description=\"Builds all\" />"); | 525 | ss.WriteLine(" <target name=\"package\" depends=\"clean, doc\" description=\"Builds all\" />"); |
526 | ss.WriteLine(); | 526 | ss.WriteLine(); |
527 | 527 | ||
528 | ss.WriteLine(" <target name=\"doc\" depends=\"build-release\">"); | 528 | ss.WriteLine(" <target name=\"doc\" depends=\"build-release\">"); |
529 | ss.WriteLine(" <echo message=\"Generating all documentation from all builds\" />"); | 529 | ss.WriteLine(" <echo message=\"Generating all documentation from all builds\" />"); |
530 | foreach (ProjectNode project in solution.Projects) | 530 | foreach (ProjectNode project in solution.Projects) |
531 | { | 531 | { |
532 | string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath); | 532 | string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath); |
533 | ss.Write(" <nant buildfile=\"{0}\"", | 533 | ss.Write(" <nant buildfile=\"{0}\"", |
534 | Helper.NormalizePath(Helper.MakeFilePath(path, project.Name + (project.Type == ProjectType.Library ? ".dll" : ".exe"), "build"), '/')); | 534 | Helper.NormalizePath(Helper.MakeFilePath(path, project.Name + (project.Type == ProjectType.Library ? ".dll" : ".exe"), "build"), '/')); |
535 | ss.WriteLine(" target=\"doc\" />"); | 535 | ss.WriteLine(" target=\"doc\" />"); |
536 | } | 536 | } |
537 | ss.WriteLine(" </target>"); | 537 | ss.WriteLine(" </target>"); |
538 | ss.WriteLine(); | 538 | ss.WriteLine(); |
539 | ss.WriteLine("</project>"); | 539 | ss.WriteLine("</project>"); |
540 | } | 540 | } |
541 | 541 | ||
542 | m_Kernel.CurrentWorkingDirectory.Pop(); | 542 | m_Kernel.CurrentWorkingDirectory.Pop(); |
543 | } | 543 | } |
544 | 544 | ||
545 | private void CleanProject(ProjectNode project) | 545 | private void CleanProject(ProjectNode project) |
546 | { | 546 | { |
547 | m_Kernel.Log.Write("...Cleaning project: {0}", project.Name); | 547 | m_Kernel.Log.Write("...Cleaning project: {0}", project.Name); |
548 | string projectFile = Helper.MakeFilePath(project.FullPath, project.Name + (project.Type == ProjectType.Library ? ".dll" : ".exe"), "build"); | 548 | string projectFile = Helper.MakeFilePath(project.FullPath, project.Name + (project.Type == ProjectType.Library ? ".dll" : ".exe"), "build"); |
549 | Helper.DeleteIfExists(projectFile); | 549 | Helper.DeleteIfExists(projectFile); |
550 | } | 550 | } |
551 | 551 | ||
552 | private void CleanSolution(SolutionNode solution) | 552 | private void CleanSolution(SolutionNode solution) |
553 | { | 553 | { |
554 | m_Kernel.Log.Write("Cleaning NAnt build files for", solution.Name); | 554 | m_Kernel.Log.Write("Cleaning NAnt build files for", solution.Name); |
555 | 555 | ||
556 | string slnFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "build"); | 556 | string slnFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "build"); |
557 | Helper.DeleteIfExists(slnFile); | 557 | Helper.DeleteIfExists(slnFile); |
558 | 558 | ||
559 | foreach(ProjectNode project in solution.Projects) | 559 | foreach(ProjectNode project in solution.Projects) |
560 | { | 560 | { |
561 | CleanProject(project); | 561 | CleanProject(project); |
562 | } | 562 | } |
563 | 563 | ||
564 | m_Kernel.Log.Write(""); | 564 | m_Kernel.Log.Write(""); |
565 | } | 565 | } |
566 | 566 | ||
567 | #endregion | 567 | #endregion |
568 | 568 | ||
569 | #region ITarget Members | 569 | #region ITarget Members |
570 | 570 | ||
571 | /// <summary> | 571 | /// <summary> |
572 | /// Writes the specified kern. | 572 | /// Writes the specified kern. |
573 | /// </summary> | 573 | /// </summary> |
574 | /// <param name="kern">The kern.</param> | 574 | /// <param name="kern">The kern.</param> |
575 | public void Write(Kernel kern) | 575 | public void Write(Kernel kern) |
576 | { | 576 | { |
577 | if( kern == null ) | 577 | if( kern == null ) |
578 | { | 578 | { |
579 | throw new ArgumentNullException("kern"); | 579 | throw new ArgumentNullException("kern"); |
580 | } | 580 | } |
581 | m_Kernel = kern; | 581 | m_Kernel = kern; |
582 | foreach(SolutionNode solution in kern.Solutions) | 582 | foreach(SolutionNode solution in kern.Solutions) |
583 | { | 583 | { |
584 | WriteCombine(solution); | 584 | WriteCombine(solution); |
585 | } | 585 | } |
586 | m_Kernel = null; | 586 | m_Kernel = null; |
587 | } | 587 | } |
588 | 588 | ||
589 | /// <summary> | 589 | /// <summary> |
590 | /// Cleans the specified kern. | 590 | /// Cleans the specified kern. |
591 | /// </summary> | 591 | /// </summary> |
592 | /// <param name="kern">The kern.</param> | 592 | /// <param name="kern">The kern.</param> |
593 | public virtual void Clean(Kernel kern) | 593 | public virtual void Clean(Kernel kern) |
594 | { | 594 | { |
595 | if( kern == null ) | 595 | if( kern == null ) |
596 | { | 596 | { |
597 | throw new ArgumentNullException("kern"); | 597 | throw new ArgumentNullException("kern"); |
598 | } | 598 | } |
599 | m_Kernel = kern; | 599 | m_Kernel = kern; |
600 | foreach(SolutionNode sol in kern.Solutions) | 600 | foreach(SolutionNode sol in kern.Solutions) |
601 | { | 601 | { |
602 | CleanSolution(sol); | 602 | CleanSolution(sol); |
603 | } | 603 | } |
604 | m_Kernel = null; | 604 | m_Kernel = null; |
605 | } | 605 | } |
606 | 606 | ||
607 | /// <summary> | 607 | /// <summary> |
608 | /// Gets the name. | 608 | /// Gets the name. |
609 | /// </summary> | 609 | /// </summary> |
610 | /// <value>The name.</value> | 610 | /// <value>The name.</value> |
611 | public string Name | 611 | public string Name |
612 | { | 612 | { |
613 | get | 613 | get |
614 | { | 614 | { |
615 | return "nant"; | 615 | return "nant"; |
616 | } | 616 | } |
617 | } | 617 | } |
618 | 618 | ||
619 | #endregion | 619 | #endregion |
620 | } | 620 | } |
621 | } | 621 | } |
diff --git a/Prebuild/src/Core/Targets/SharpDevelop2Target.cs b/Prebuild/src/Core/Targets/SharpDevelop2Target.cs index bc84b96..7109ceb 100644 --- a/Prebuild/src/Core/Targets/SharpDevelop2Target.cs +++ b/Prebuild/src/Core/Targets/SharpDevelop2Target.cs | |||
@@ -1,90 +1,90 @@ | |||
1 | #region BSD License | 1 | #region BSD License |
2 | /* | 2 | /* |
3 | Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) | 3 | Copyright (c) 2004-2005 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 | ||
26 | #region CVS Information | 26 | #region CVS Information |
27 | /* | 27 | /* |
28 | * $Source$ | 28 | * $Source$ |
29 | * $Author: jendave $ | 29 | * $Author: jendave $ |
30 | * $Date: 2006-01-27 16:49:58 -0800 (Fri, 27 Jan 2006) $ | 30 | * $Date: 2006-01-27 16:49:58 -0800 (Fri, 27 Jan 2006) $ |
31 | * $Revision: 71 $ | 31 | * $Revision: 71 $ |
32 | */ | 32 | */ |
33 | #endregion | 33 | #endregion |
34 | 34 | ||
35 | using System; | 35 | using System; |
36 | 36 | ||
37 | using Prebuild.Core.Attributes; | 37 | using Prebuild.Core.Attributes; |
38 | 38 | ||
39 | namespace Prebuild.Core.Targets | 39 | namespace Prebuild.Core.Targets |
40 | { | 40 | { |
41 | /// <summary> | 41 | /// <summary> |
42 | /// | 42 | /// |
43 | /// </summary> | 43 | /// </summary> |
44 | [Target("sharpdev2")] | 44 | [Target("sharpdev2")] |
45 | public class SharpDevelop2Target : VS2005Target | 45 | public class SharpDevelop2Target : VS2005Target |
46 | { | 46 | { |
47 | #region Private Methods | 47 | #region Private Methods |
48 | private void SetSharpDevelop2() | 48 | private void SetSharpDevelop2() |
49 | { | 49 | { |
50 | this.VersionName = "SharpDevelop2"; | 50 | this.VersionName = "SharpDevelop2"; |
51 | } | 51 | } |
52 | #endregion | 52 | #endregion |
53 | 53 | ||
54 | #region Public Methods | 54 | #region Public Methods |
55 | 55 | ||
56 | /// <summary> | 56 | /// <summary> |
57 | /// Writes the specified kern. | 57 | /// Writes the specified kern. |
58 | /// </summary> | 58 | /// </summary> |
59 | /// <param name="kern">The kern.</param> | 59 | /// <param name="kern">The kern.</param> |
60 | public override void Write(Kernel kern) | 60 | public override void Write(Kernel kern) |
61 | { | 61 | { |
62 | SetSharpDevelop2(); | 62 | SetSharpDevelop2(); |
63 | base.Write(kern); | 63 | base.Write(kern); |
64 | } | 64 | } |
65 | 65 | ||
66 | /// <summary> | 66 | /// <summary> |
67 | /// Cleans the specified kern. | 67 | /// Cleans the specified kern. |
68 | /// </summary> | 68 | /// </summary> |
69 | /// <param name="kern">The kern.</param> | 69 | /// <param name="kern">The kern.</param> |
70 | public override void Clean(Kernel kern) | 70 | public override void Clean(Kernel kern) |
71 | { | 71 | { |
72 | SetSharpDevelop2(); | 72 | SetSharpDevelop2(); |
73 | base.Clean(kern); | 73 | base.Clean(kern); |
74 | } | 74 | } |
75 | 75 | ||
76 | /// <summary> | 76 | /// <summary> |
77 | /// Gets the name. | 77 | /// Gets the name. |
78 | /// </summary> | 78 | /// </summary> |
79 | /// <value>The name.</value> | 79 | /// <value>The name.</value> |
80 | public override string Name | 80 | public override string Name |
81 | { | 81 | { |
82 | get | 82 | get |
83 | { | 83 | { |
84 | return "sharpdev2"; | 84 | return "sharpdev2"; |
85 | } | 85 | } |
86 | } | 86 | } |
87 | 87 | ||
88 | #endregion | 88 | #endregion |
89 | } | 89 | } |
90 | } | 90 | } |
diff --git a/Prebuild/src/Core/Targets/SharpDevelopTarget.cs b/Prebuild/src/Core/Targets/SharpDevelopTarget.cs index c725730..ededadb 100644 --- a/Prebuild/src/Core/Targets/SharpDevelopTarget.cs +++ b/Prebuild/src/Core/Targets/SharpDevelopTarget.cs | |||
@@ -1,437 +1,437 @@ | |||
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 | ||
26 | #region CVS Information | 26 | #region CVS Information |
27 | /* | 27 | /* |
28 | * $Source$ | 28 | * $Source$ |
29 | * $Author: jendave $ | 29 | * $Author: jendave $ |
30 | * $Date: 2007-02-13 21:58:03 +0100 (ti, 13 feb 2007) $ | 30 | * $Date: 2007-02-13 21:58:03 +0100 (ti, 13 feb 2007) $ |
31 | * $Revision: 205 $ | 31 | * $Revision: 205 $ |
32 | */ | 32 | */ |
33 | #endregion | 33 | #endregion |
34 | 34 | ||
35 | using System; | 35 | using System; |
36 | using System.Collections; | 36 | using System.Collections; |
37 | using System.Collections.Specialized; | 37 | using System.Collections.Specialized; |
38 | using System.IO; | 38 | using System.IO; |
39 | using System.Text.RegularExpressions; | 39 | using System.Text.RegularExpressions; |
40 | using System.Reflection; | 40 | using System.Reflection; |
41 | 41 | ||
42 | using Prebuild.Core.Attributes; | 42 | using Prebuild.Core.Attributes; |
43 | using Prebuild.Core.Interfaces; | 43 | using Prebuild.Core.Interfaces; |
44 | using Prebuild.Core.Nodes; | 44 | using Prebuild.Core.Nodes; |
45 | using Prebuild.Core.Utilities; | 45 | 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("sharpdev")] | 52 | [Target("sharpdev")] |
53 | public class SharpDevelopTarget : ITarget | 53 | public class SharpDevelopTarget : 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, ReferenceNode refr) | 80 | private static string BuildReference(SolutionNode solution, ReferenceNode refr) |
81 | { | 81 | { |
82 | string ret = "<Reference type=\""; | 82 | string ret = "<Reference type=\""; |
83 | if(solution.ProjectsTable.ContainsKey(refr.Name)) | 83 | if(solution.ProjectsTable.ContainsKey(refr.Name)) |
84 | { | 84 | { |
85 | ret += "Project\" refto=\"" + refr.Name; | 85 | ret += "Project\" refto=\"" + refr.Name; |
86 | ret += "\" localcopy=\"" + refr.LocalCopy.ToString() + "\" />"; | 86 | ret += "\" localcopy=\"" + refr.LocalCopy.ToString() + "\" />"; |
87 | } | 87 | } |
88 | else | 88 | else |
89 | { | 89 | { |
90 | ProjectNode project = (ProjectNode)refr.Parent; | 90 | ProjectNode project = (ProjectNode)refr.Parent; |
91 | string fileRef = FindFileReference(refr.Name, project); | 91 | string fileRef = FindFileReference(refr.Name, project); |
92 | 92 | ||
93 | if(refr.Path != null || fileRef != null) | 93 | if(refr.Path != null || fileRef != null) |
94 | { | 94 | { |
95 | ret += "Assembly\" refto=\""; | 95 | ret += "Assembly\" refto=\""; |
96 | 96 | ||
97 | string finalPath = (refr.Path != null) ? Helper.MakeFilePath(refr.Path, refr.Name, "dll") : fileRef; | 97 | string finalPath = (refr.Path != null) ? Helper.MakeFilePath(refr.Path, refr.Name, "dll") : fileRef; |
98 | 98 | ||
99 | ret += finalPath; | 99 | ret += finalPath; |
100 | ret += "\" localcopy=\"" + refr.LocalCopy.ToString() + "\" />"; | 100 | ret += "\" localcopy=\"" + refr.LocalCopy.ToString() + "\" />"; |
101 | return ret; | 101 | return ret; |
102 | } | 102 | } |
103 | 103 | ||
104 | ret += "Gac\" refto=\""; | 104 | ret += "Gac\" refto=\""; |
105 | try | 105 | try |
106 | { | 106 | { |
107 | //Assembly assem = Assembly.Load(refr.Name); | 107 | //Assembly assem = Assembly.Load(refr.Name); |
108 | ret += refr.Name;// assem.FullName; | 108 | ret += refr.Name;// assem.FullName; |
109 | } | 109 | } |
110 | catch (System.NullReferenceException e) | 110 | catch (System.NullReferenceException e) |
111 | { | 111 | { |
112 | e.ToString(); | 112 | e.ToString(); |
113 | ret += refr.Name; | 113 | ret += refr.Name; |
114 | } | 114 | } |
115 | ret += "\" localcopy=\"" + refr.LocalCopy.ToString() + "\" />"; | 115 | ret += "\" localcopy=\"" + refr.LocalCopy.ToString() + "\" />"; |
116 | } | 116 | } |
117 | 117 | ||
118 | return ret; | 118 | return ret; |
119 | } | 119 | } |
120 | 120 | ||
121 | private static string FindFileReference(string refName, ProjectNode project) | 121 | private static string FindFileReference(string refName, ProjectNode project) |
122 | { | 122 | { |
123 | foreach(ReferencePathNode refPath in project.ReferencePaths) | 123 | foreach(ReferencePathNode refPath in project.ReferencePaths) |
124 | { | 124 | { |
125 | string fullPath = Helper.MakeFilePath(refPath.Path, refName, "dll"); | 125 | string fullPath = Helper.MakeFilePath(refPath.Path, refName, "dll"); |
126 | 126 | ||
127 | if(File.Exists(fullPath)) | 127 | if(File.Exists(fullPath)) |
128 | { | 128 | { |
129 | return fullPath; | 129 | return fullPath; |
130 | } | 130 | } |
131 | } | 131 | } |
132 | 132 | ||
133 | return null; | 133 | return null; |
134 | } | 134 | } |
135 | 135 | ||
136 | /// <summary> | 136 | /// <summary> |
137 | /// Gets the XML doc file. | 137 | /// Gets the XML doc file. |
138 | /// </summary> | 138 | /// </summary> |
139 | /// <param name="project">The project.</param> | 139 | /// <param name="project">The project.</param> |
140 | /// <param name="conf">The conf.</param> | 140 | /// <param name="conf">The conf.</param> |
141 | /// <returns></returns> | 141 | /// <returns></returns> |
142 | public static string GenerateXmlDocFile(ProjectNode project, ConfigurationNode conf) | 142 | public static string GenerateXmlDocFile(ProjectNode project, ConfigurationNode conf) |
143 | { | 143 | { |
144 | if( conf == null ) | 144 | if( conf == null ) |
145 | { | 145 | { |
146 | throw new ArgumentNullException("conf"); | 146 | throw new ArgumentNullException("conf"); |
147 | } | 147 | } |
148 | if( project == null ) | 148 | if( project == null ) |
149 | { | 149 | { |
150 | throw new ArgumentNullException("project"); | 150 | throw new ArgumentNullException("project"); |
151 | } | 151 | } |
152 | string docFile = (string)conf.Options["XmlDocFile"]; | 152 | string docFile = (string)conf.Options["XmlDocFile"]; |
153 | if(docFile != null && docFile.Length == 0)//default to assembly name if not specified | 153 | if(docFile != null && docFile.Length == 0)//default to assembly name if not specified |
154 | { | 154 | { |
155 | return "False"; | 155 | return "False"; |
156 | } | 156 | } |
157 | return "True"; | 157 | return "True"; |
158 | } | 158 | } |
159 | 159 | ||
160 | private void WriteProject(SolutionNode solution, ProjectNode project) | 160 | private void WriteProject(SolutionNode solution, ProjectNode project) |
161 | { | 161 | { |
162 | string csComp = "Csc"; | 162 | string csComp = "Csc"; |
163 | string netRuntime = "MsNet"; | 163 | string netRuntime = "MsNet"; |
164 | if(project.Runtime == ClrRuntime.Mono) | 164 | if(project.Runtime == ClrRuntime.Mono) |
165 | { | 165 | { |
166 | csComp = "Mcs"; | 166 | csComp = "Mcs"; |
167 | netRuntime = "Mono"; | 167 | netRuntime = "Mono"; |
168 | } | 168 | } |
169 | 169 | ||
170 | string projFile = Helper.MakeFilePath(project.FullPath, project.Name, "prjx"); | 170 | string projFile = Helper.MakeFilePath(project.FullPath, project.Name, "prjx"); |
171 | StreamWriter ss = new StreamWriter(projFile); | 171 | StreamWriter ss = new StreamWriter(projFile); |
172 | 172 | ||
173 | m_Kernel.CurrentWorkingDirectory.Push(); | 173 | m_Kernel.CurrentWorkingDirectory.Push(); |
174 | Helper.SetCurrentDir(Path.GetDirectoryName(projFile)); | 174 | Helper.SetCurrentDir(Path.GetDirectoryName(projFile)); |
175 | 175 | ||
176 | using(ss) | 176 | using(ss) |
177 | { | 177 | { |
178 | ss.WriteLine( | 178 | ss.WriteLine( |
179 | "<Project name=\"{0}\" standardNamespace=\"{1}\" description=\"\" newfilesearch=\"None\" enableviewstate=\"True\" version=\"1.1\" projecttype=\"C#\">", | 179 | "<Project name=\"{0}\" standardNamespace=\"{1}\" description=\"\" newfilesearch=\"None\" enableviewstate=\"True\" version=\"1.1\" projecttype=\"C#\">", |
180 | project.Name, | 180 | project.Name, |
181 | project.RootNamespace | 181 | project.RootNamespace |
182 | ); | 182 | ); |
183 | 183 | ||
184 | ss.WriteLine(" <Contents>"); | 184 | ss.WriteLine(" <Contents>"); |
185 | foreach(string file in project.Files) | 185 | foreach(string file in project.Files) |
186 | { | 186 | { |
187 | string buildAction = "Compile"; | 187 | string buildAction = "Compile"; |
188 | switch(project.Files.GetBuildAction(file)) | 188 | switch(project.Files.GetBuildAction(file)) |
189 | { | 189 | { |
190 | case BuildAction.None: | 190 | case BuildAction.None: |
191 | buildAction = "Nothing"; | 191 | buildAction = "Nothing"; |
192 | break; | 192 | break; |
193 | 193 | ||
194 | case BuildAction.Content: | 194 | case BuildAction.Content: |
195 | buildAction = "Exclude"; | 195 | buildAction = "Exclude"; |
196 | break; | 196 | break; |
197 | 197 | ||
198 | case BuildAction.EmbeddedResource: | 198 | case BuildAction.EmbeddedResource: |
199 | buildAction = "EmbedAsResource"; | 199 | buildAction = "EmbedAsResource"; |
200 | break; | 200 | break; |
201 | 201 | ||
202 | default: | 202 | default: |
203 | buildAction = "Compile"; | 203 | buildAction = "Compile"; |
204 | break; | 204 | break; |
205 | } | 205 | } |
206 | 206 | ||
207 | // Sort of a hack, we try and resolve the path and make it relative, if we can. | 207 | // Sort of a hack, we try and resolve the path and make it relative, if we can. |
208 | string filePath = PrependPath(file); | 208 | string filePath = PrependPath(file); |
209 | ss.WriteLine(" <File name=\"{0}\" subtype=\"Code\" buildaction=\"{1}\" dependson=\"\" data=\"\" />", filePath, buildAction); | 209 | ss.WriteLine(" <File name=\"{0}\" subtype=\"Code\" buildaction=\"{1}\" dependson=\"\" data=\"\" />", filePath, buildAction); |
210 | } | 210 | } |
211 | ss.WriteLine(" </Contents>"); | 211 | ss.WriteLine(" </Contents>"); |
212 | 212 | ||
213 | ss.WriteLine(" <References>"); | 213 | ss.WriteLine(" <References>"); |
214 | foreach(ReferenceNode refr in project.References) | 214 | foreach(ReferenceNode refr in project.References) |
215 | { | 215 | { |
216 | ss.WriteLine(" {0}", BuildReference(solution, refr)); | 216 | ss.WriteLine(" {0}", BuildReference(solution, refr)); |
217 | } | 217 | } |
218 | ss.WriteLine(" </References>"); | 218 | ss.WriteLine(" </References>"); |
219 | 219 | ||
220 | ss.Write(" <DeploymentInformation"); | 220 | ss.Write(" <DeploymentInformation"); |
221 | ss.Write(" target=\"\""); | 221 | ss.Write(" target=\"\""); |
222 | ss.Write(" script=\"\""); | 222 | ss.Write(" script=\"\""); |
223 | ss.Write(" strategy=\"File\""); | 223 | ss.Write(" strategy=\"File\""); |
224 | ss.WriteLine(" />"); | 224 | ss.WriteLine(" />"); |
225 | 225 | ||
226 | int count = 0; | 226 | int count = 0; |
227 | 227 | ||
228 | ss.WriteLine(" <Configurations active=\"{0}\">", solution.ActiveConfig); | 228 | ss.WriteLine(" <Configurations active=\"{0}\">", solution.ActiveConfig); |
229 | 229 | ||
230 | foreach(ConfigurationNode conf in project.Configurations) | 230 | foreach(ConfigurationNode conf in project.Configurations) |
231 | { | 231 | { |
232 | ss.Write(" <Configuration"); | 232 | ss.Write(" <Configuration"); |
233 | ss.Write(" runwithwarnings=\"True\""); | 233 | ss.Write(" runwithwarnings=\"True\""); |
234 | ss.Write(" name=\"{0}\"", conf.Name); | 234 | ss.Write(" name=\"{0}\"", conf.Name); |
235 | ss.WriteLine(">"); | 235 | ss.WriteLine(">"); |
236 | ss.Write(" <CodeGeneration"); | 236 | ss.Write(" <CodeGeneration"); |
237 | ss.Write(" runtime=\"{0}\"", netRuntime); | 237 | ss.Write(" runtime=\"{0}\"", netRuntime); |
238 | ss.Write(" compiler=\"{0}\"", csComp); | 238 | ss.Write(" compiler=\"{0}\"", csComp); |
239 | ss.Write(" compilerversion=\"\""); | 239 | ss.Write(" compilerversion=\"\""); |
240 | ss.Write(" warninglevel=\"{0}\"", conf.Options["WarningLevel"]); | 240 | ss.Write(" warninglevel=\"{0}\"", conf.Options["WarningLevel"]); |
241 | ss.Write(" nowarn=\"{0}\"", conf.Options["SuppressWarnings"]); | 241 | ss.Write(" nowarn=\"{0}\"", conf.Options["SuppressWarnings"]); |
242 | ss.Write(" includedebuginformation=\"{0}\"", conf.Options["DebugInformation"]); | 242 | ss.Write(" includedebuginformation=\"{0}\"", conf.Options["DebugInformation"]); |
243 | ss.Write(" optimize=\"{0}\"", conf.Options["OptimizeCode"]); | 243 | ss.Write(" optimize=\"{0}\"", conf.Options["OptimizeCode"]); |
244 | ss.Write(" unsafecodeallowed=\"{0}\"", conf.Options["AllowUnsafe"]); | 244 | ss.Write(" unsafecodeallowed=\"{0}\"", conf.Options["AllowUnsafe"]); |
245 | ss.Write(" generateoverflowchecks=\"{0}\"", conf.Options["CheckUnderflowOverflow"]); | 245 | ss.Write(" generateoverflowchecks=\"{0}\"", conf.Options["CheckUnderflowOverflow"]); |
246 | ss.Write(" mainclass=\"{0}\"", project.StartupObject); | 246 | ss.Write(" mainclass=\"{0}\"", project.StartupObject); |
247 | ss.Write(" target=\"{0}\"", project.Type); | 247 | ss.Write(" target=\"{0}\"", project.Type); |
248 | ss.Write(" definesymbols=\"{0}\"", conf.Options["CompilerDefines"]); | 248 | ss.Write(" definesymbols=\"{0}\"", conf.Options["CompilerDefines"]); |
249 | ss.Write(" generatexmldocumentation=\"{0}\"", GenerateXmlDocFile(project, conf)); | 249 | ss.Write(" generatexmldocumentation=\"{0}\"", GenerateXmlDocFile(project, conf)); |
250 | ss.Write(" win32Icon=\"{0}\"", Helper.NormalizePath(".\\" + project.AppIcon)); | 250 | ss.Write(" win32Icon=\"{0}\"", Helper.NormalizePath(".\\" + project.AppIcon)); |
251 | ss.Write(" noconfig=\"{0}\"", "False"); | 251 | ss.Write(" noconfig=\"{0}\"", "False"); |
252 | ss.Write(" nostdlib=\"{0}\"", conf.Options["NoStdLib"]); | 252 | ss.Write(" nostdlib=\"{0}\"", conf.Options["NoStdLib"]); |
253 | ss.WriteLine(" />"); | 253 | ss.WriteLine(" />"); |
254 | 254 | ||
255 | ss.Write(" <Execution"); | 255 | ss.Write(" <Execution"); |
256 | ss.Write(" commandlineparameters=\"\""); | 256 | ss.Write(" commandlineparameters=\"\""); |
257 | ss.Write(" consolepause=\"True\""); | 257 | ss.Write(" consolepause=\"True\""); |
258 | ss.WriteLine(" />"); | 258 | ss.WriteLine(" />"); |
259 | 259 | ||
260 | ss.Write(" <Output"); | 260 | ss.Write(" <Output"); |
261 | ss.Write(" directory=\".\\{0}\"", Helper.NormalizePath(conf.Options["OutputPath"].ToString())); | 261 | ss.Write(" directory=\".\\{0}\"", Helper.NormalizePath(conf.Options["OutputPath"].ToString())); |
262 | ss.Write(" assembly=\"{0}\"", project.AssemblyName); | 262 | ss.Write(" assembly=\"{0}\"", project.AssemblyName); |
263 | ss.Write(" executeScript=\"{0}\"", conf.Options["RunScript"]); | 263 | ss.Write(" executeScript=\"{0}\"", conf.Options["RunScript"]); |
264 | if (conf.Options["PreBuildEvent"] != null && conf.Options["PreBuildEvent"].ToString().Length != 0) | 264 | if (conf.Options["PreBuildEvent"] != null && conf.Options["PreBuildEvent"].ToString().Length != 0) |
265 | { | 265 | { |
266 | ss.Write(" executeBeforeBuild=\"{0}\"", Helper.NormalizePath(conf.Options["PreBuildEvent"].ToString())); | 266 | ss.Write(" executeBeforeBuild=\"{0}\"", Helper.NormalizePath(conf.Options["PreBuildEvent"].ToString())); |
267 | } | 267 | } |
268 | else | 268 | else |
269 | { | 269 | { |
270 | ss.Write(" executeBeforeBuild=\"{0}\"", conf.Options["PreBuildEvent"]); | 270 | ss.Write(" executeBeforeBuild=\"{0}\"", conf.Options["PreBuildEvent"]); |
271 | } | 271 | } |
272 | if (conf.Options["PostBuildEvent"] != null && conf.Options["PostBuildEvent"].ToString().Length != 0) | 272 | if (conf.Options["PostBuildEvent"] != null && conf.Options["PostBuildEvent"].ToString().Length != 0) |
273 | { | 273 | { |
274 | ss.Write(" executeAfterBuild=\"{0}\"", Helper.NormalizePath(conf.Options["PostBuildEvent"].ToString())); | 274 | ss.Write(" executeAfterBuild=\"{0}\"", Helper.NormalizePath(conf.Options["PostBuildEvent"].ToString())); |
275 | } | 275 | } |
276 | else | 276 | else |
277 | { | 277 | { |
278 | ss.Write(" executeAfterBuild=\"{0}\"", conf.Options["PostBuildEvent"]); | 278 | ss.Write(" executeAfterBuild=\"{0}\"", conf.Options["PostBuildEvent"]); |
279 | } | 279 | } |
280 | ss.Write(" executeBeforeBuildArguments=\"{0}\"", conf.Options["PreBuildEventArgs"]); | 280 | ss.Write(" executeBeforeBuildArguments=\"{0}\"", conf.Options["PreBuildEventArgs"]); |
281 | ss.Write(" executeAfterBuildArguments=\"{0}\"", conf.Options["PreBuildEventArgs"]); | 281 | ss.Write(" executeAfterBuildArguments=\"{0}\"", conf.Options["PreBuildEventArgs"]); |
282 | ss.WriteLine(" />"); | 282 | ss.WriteLine(" />"); |
283 | ss.WriteLine(" </Configuration>"); | 283 | ss.WriteLine(" </Configuration>"); |
284 | 284 | ||
285 | count++; | 285 | count++; |
286 | } | 286 | } |
287 | ss.WriteLine(" </Configurations>"); | 287 | ss.WriteLine(" </Configurations>"); |
288 | ss.WriteLine("</Project>"); | 288 | ss.WriteLine("</Project>"); |
289 | } | 289 | } |
290 | 290 | ||
291 | m_Kernel.CurrentWorkingDirectory.Pop(); | 291 | m_Kernel.CurrentWorkingDirectory.Pop(); |
292 | } | 292 | } |
293 | 293 | ||
294 | private void WriteCombine(SolutionNode solution) | 294 | private void WriteCombine(SolutionNode solution) |
295 | { | 295 | { |
296 | m_Kernel.Log.Write("Creating SharpDevelop combine and project files"); | 296 | m_Kernel.Log.Write("Creating SharpDevelop combine and project files"); |
297 | foreach(ProjectNode project in solution.Projects) | 297 | foreach(ProjectNode project in solution.Projects) |
298 | { | 298 | { |
299 | if(m_Kernel.AllowProject(project.FilterGroups)) | 299 | if(m_Kernel.AllowProject(project.FilterGroups)) |
300 | { | 300 | { |
301 | m_Kernel.Log.Write("...Creating project: {0}", project.Name); | 301 | m_Kernel.Log.Write("...Creating project: {0}", project.Name); |
302 | WriteProject(solution, project); | 302 | WriteProject(solution, project); |
303 | } | 303 | } |
304 | } | 304 | } |
305 | 305 | ||
306 | m_Kernel.Log.Write(""); | 306 | m_Kernel.Log.Write(""); |
307 | string combFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "cmbx"); | 307 | string combFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "cmbx"); |
308 | StreamWriter ss = new StreamWriter(combFile); | 308 | StreamWriter ss = new StreamWriter(combFile); |
309 | 309 | ||
310 | m_Kernel.CurrentWorkingDirectory.Push(); | 310 | m_Kernel.CurrentWorkingDirectory.Push(); |
311 | Helper.SetCurrentDir(Path.GetDirectoryName(combFile)); | 311 | Helper.SetCurrentDir(Path.GetDirectoryName(combFile)); |
312 | 312 | ||
313 | using(ss) | 313 | using(ss) |
314 | { | 314 | { |
315 | ss.WriteLine("<Combine fileversion=\"1.0\" name=\"{0}\" description=\"\">", solution.Name); | 315 | ss.WriteLine("<Combine fileversion=\"1.0\" name=\"{0}\" description=\"\">", solution.Name); |
316 | 316 | ||
317 | int count = 0; | 317 | int count = 0; |
318 | foreach(ProjectNode project in solution.Projects) | 318 | foreach(ProjectNode project in solution.Projects) |
319 | { | 319 | { |
320 | if(count == 0) | 320 | if(count == 0) |
321 | ss.WriteLine(" <StartMode startupentry=\"{0}\" single=\"True\">", project.Name); | 321 | ss.WriteLine(" <StartMode startupentry=\"{0}\" single=\"True\">", project.Name); |
322 | 322 | ||
323 | ss.WriteLine(" <Execute entry=\"{0}\" type=\"None\" />", project.Name); | 323 | ss.WriteLine(" <Execute entry=\"{0}\" type=\"None\" />", project.Name); |
324 | count++; | 324 | count++; |
325 | } | 325 | } |
326 | ss.WriteLine(" </StartMode>"); | 326 | ss.WriteLine(" </StartMode>"); |
327 | 327 | ||
328 | ss.WriteLine(" <Entries>"); | 328 | ss.WriteLine(" <Entries>"); |
329 | foreach(ProjectNode project in solution.Projects) | 329 | foreach(ProjectNode project in solution.Projects) |
330 | { | 330 | { |
331 | string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath); | 331 | string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath); |
332 | ss.WriteLine(" <Entry filename=\"{0}\" />", | 332 | ss.WriteLine(" <Entry filename=\"{0}\" />", |
333 | Helper.MakeFilePath(path, project.Name, "prjx")); | 333 | Helper.MakeFilePath(path, project.Name, "prjx")); |
334 | } | 334 | } |
335 | ss.WriteLine(" </Entries>"); | 335 | ss.WriteLine(" </Entries>"); |
336 | 336 | ||
337 | count = 0; | 337 | count = 0; |
338 | foreach(ConfigurationNode conf in solution.Configurations) | 338 | foreach(ConfigurationNode conf in solution.Configurations) |
339 | { | 339 | { |
340 | if(count == 0) | 340 | if(count == 0) |
341 | { | 341 | { |
342 | ss.WriteLine(" <Configurations active=\"{0}\">", conf.Name); | 342 | ss.WriteLine(" <Configurations active=\"{0}\">", conf.Name); |
343 | } | 343 | } |
344 | 344 | ||
345 | ss.WriteLine(" <Configuration name=\"{0}\">", conf.Name); | 345 | ss.WriteLine(" <Configuration name=\"{0}\">", conf.Name); |
346 | foreach(ProjectNode project in solution.Projects) | 346 | foreach(ProjectNode project in solution.Projects) |
347 | { | 347 | { |
348 | ss.WriteLine(" <Entry name=\"{0}\" configurationname=\"{1}\" build=\"True\" />", project.Name, conf.Name); | 348 | ss.WriteLine(" <Entry name=\"{0}\" configurationname=\"{1}\" build=\"True\" />", project.Name, conf.Name); |
349 | } | 349 | } |
350 | ss.WriteLine(" </Configuration>"); | 350 | ss.WriteLine(" </Configuration>"); |
351 | 351 | ||
352 | count++; | 352 | count++; |
353 | } | 353 | } |
354 | ss.WriteLine(" </Configurations>"); | 354 | ss.WriteLine(" </Configurations>"); |
355 | ss.WriteLine("</Combine>"); | 355 | ss.WriteLine("</Combine>"); |
356 | } | 356 | } |
357 | 357 | ||
358 | m_Kernel.CurrentWorkingDirectory.Pop(); | 358 | m_Kernel.CurrentWorkingDirectory.Pop(); |
359 | } | 359 | } |
360 | 360 | ||
361 | private void CleanProject(ProjectNode project) | 361 | private void CleanProject(ProjectNode project) |
362 | { | 362 | { |
363 | m_Kernel.Log.Write("...Cleaning project: {0}", project.Name); | 363 | m_Kernel.Log.Write("...Cleaning project: {0}", project.Name); |
364 | string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, "prjx"); | 364 | string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, "prjx"); |
365 | Helper.DeleteIfExists(projectFile); | 365 | Helper.DeleteIfExists(projectFile); |
366 | } | 366 | } |
367 | 367 | ||
368 | private void CleanSolution(SolutionNode solution) | 368 | private void CleanSolution(SolutionNode solution) |
369 | { | 369 | { |
370 | m_Kernel.Log.Write("Cleaning SharpDevelop combine and project files for", solution.Name); | 370 | m_Kernel.Log.Write("Cleaning SharpDevelop combine and project files for", solution.Name); |
371 | 371 | ||
372 | string slnFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "cmbx"); | 372 | string slnFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "cmbx"); |
373 | Helper.DeleteIfExists(slnFile); | 373 | Helper.DeleteIfExists(slnFile); |
374 | 374 | ||
375 | foreach(ProjectNode project in solution.Projects) | 375 | foreach(ProjectNode project in solution.Projects) |
376 | { | 376 | { |
377 | CleanProject(project); | 377 | CleanProject(project); |
378 | } | 378 | } |
379 | 379 | ||
380 | m_Kernel.Log.Write(""); | 380 | m_Kernel.Log.Write(""); |
381 | } | 381 | } |
382 | 382 | ||
383 | #endregion | 383 | #endregion |
384 | 384 | ||
385 | #region ITarget Members | 385 | #region ITarget Members |
386 | 386 | ||
387 | /// <summary> | 387 | /// <summary> |
388 | /// Writes the specified kern. | 388 | /// Writes the specified kern. |
389 | /// </summary> | 389 | /// </summary> |
390 | /// <param name="kern">The kern.</param> | 390 | /// <param name="kern">The kern.</param> |
391 | public void Write(Kernel kern) | 391 | public void Write(Kernel kern) |
392 | { | 392 | { |
393 | if( kern == null ) | 393 | if( kern == null ) |
394 | { | 394 | { |
395 | throw new ArgumentNullException("kern"); | 395 | throw new ArgumentNullException("kern"); |
396 | } | 396 | } |
397 | m_Kernel = kern; | 397 | m_Kernel = kern; |
398 | foreach(SolutionNode solution in kern.Solutions) | 398 | foreach(SolutionNode solution in kern.Solutions) |
399 | { | 399 | { |
400 | WriteCombine(solution); | 400 | WriteCombine(solution); |
401 | } | 401 | } |
402 | m_Kernel = null; | 402 | m_Kernel = null; |
403 | } | 403 | } |
404 | 404 | ||
405 | /// <summary> | 405 | /// <summary> |
406 | /// Cleans the specified kern. | 406 | /// Cleans the specified kern. |
407 | /// </summary> | 407 | /// </summary> |
408 | /// <param name="kern">The kern.</param> | 408 | /// <param name="kern">The kern.</param> |
409 | public virtual void Clean(Kernel kern) | 409 | public virtual void Clean(Kernel kern) |
410 | { | 410 | { |
411 | if( kern == null ) | 411 | if( kern == null ) |
412 | { | 412 | { |
413 | throw new ArgumentNullException("kern"); | 413 | throw new ArgumentNullException("kern"); |
414 | } | 414 | } |
415 | m_Kernel = kern; | 415 | m_Kernel = kern; |
416 | foreach(SolutionNode sol in kern.Solutions) | 416 | foreach(SolutionNode sol in kern.Solutions) |
417 | { | 417 | { |
418 | CleanSolution(sol); | 418 | CleanSolution(sol); |
419 | } | 419 | } |
420 | m_Kernel = null; | 420 | m_Kernel = null; |
421 | } | 421 | } |
422 | 422 | ||
423 | /// <summary> | 423 | /// <summary> |
424 | /// Gets the name. | 424 | /// Gets the name. |
425 | /// </summary> | 425 | /// </summary> |
426 | /// <value>The name.</value> | 426 | /// <value>The name.</value> |
427 | public string Name | 427 | public string Name |
428 | { | 428 | { |
429 | get | 429 | get |
430 | { | 430 | { |
431 | return "sharpdev"; | 431 | return "sharpdev"; |
432 | } | 432 | } |
433 | } | 433 | } |
434 | 434 | ||
435 | #endregion | 435 | #endregion |
436 | } | 436 | } |
437 | } | 437 | } |
diff --git a/Prebuild/src/Core/Targets/VS2002Target.cs b/Prebuild/src/Core/Targets/VS2002Target.cs index 66216dc..b380f36 100644 --- a/Prebuild/src/Core/Targets/VS2002Target.cs +++ b/Prebuild/src/Core/Targets/VS2002Target.cs | |||
@@ -1,96 +1,96 @@ | |||
1 | #region BSD License | 1 | #region BSD License |
2 | /* | 2 | /* |
3 | Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) | 3 | Copyright (c) 2004-2005 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 | ||
26 | #region CVS Information | 26 | #region CVS Information |
27 | /* | 27 | /* |
28 | * $Source$ | 28 | * $Source$ |
29 | * $Author: jendave $ | 29 | * $Author: jendave $ |
30 | * $Date: 2006-01-28 01:49:58 +0100 (lö, 28 jan 2006) $ | 30 | * $Date: 2006-01-28 01:49:58 +0100 (lö, 28 jan 2006) $ |
31 | * $Revision: 71 $ | 31 | * $Revision: 71 $ |
32 | */ | 32 | */ |
33 | #endregion | 33 | #endregion |
34 | 34 | ||
35 | using System; | 35 | using System; |
36 | 36 | ||
37 | using Prebuild.Core.Attributes; | 37 | using Prebuild.Core.Attributes; |
38 | 38 | ||
39 | namespace Prebuild.Core.Targets | 39 | namespace Prebuild.Core.Targets |
40 | { | 40 | { |
41 | /// <summary> | 41 | /// <summary> |
42 | /// | 42 | /// |
43 | /// </summary> | 43 | /// </summary> |
44 | [Target("vs2002")] | 44 | [Target("vs2002")] |
45 | public class VS2002Target : VS2003Target | 45 | public class VS2002Target : VS2003Target |
46 | { | 46 | { |
47 | #region Private Methods | 47 | #region Private Methods |
48 | 48 | ||
49 | private void SetVS2002() | 49 | private void SetVS2002() |
50 | { | 50 | { |
51 | this.SolutionVersion = "7.00"; | 51 | this.SolutionVersion = "7.00"; |
52 | this.ProductVersion = "7.0.9254"; | 52 | this.ProductVersion = "7.0.9254"; |
53 | this.SchemaVersion = "1.0"; | 53 | this.SchemaVersion = "1.0"; |
54 | this.VersionName = "2002"; | 54 | this.VersionName = "2002"; |
55 | this.Version = VSVersion.VS70; | 55 | this.Version = VSVersion.VS70; |
56 | } | 56 | } |
57 | 57 | ||
58 | #endregion | 58 | #endregion |
59 | 59 | ||
60 | #region Public Methods | 60 | #region Public Methods |
61 | 61 | ||
62 | /// <summary> | 62 | /// <summary> |
63 | /// Writes the specified kern. | 63 | /// Writes the specified kern. |
64 | /// </summary> | 64 | /// </summary> |
65 | /// <param name="kern">The kern.</param> | 65 | /// <param name="kern">The kern.</param> |
66 | public override void Write(Kernel kern) | 66 | public override void Write(Kernel kern) |
67 | { | 67 | { |
68 | SetVS2002(); | 68 | SetVS2002(); |
69 | base.Write(kern); | 69 | base.Write(kern); |
70 | } | 70 | } |
71 | 71 | ||
72 | /// <summary> | 72 | /// <summary> |
73 | /// Cleans the specified kern. | 73 | /// Cleans the specified kern. |
74 | /// </summary> | 74 | /// </summary> |
75 | /// <param name="kern">The kern.</param> | 75 | /// <param name="kern">The kern.</param> |
76 | public override void Clean(Kernel kern) | 76 | public override void Clean(Kernel kern) |
77 | { | 77 | { |
78 | SetVS2002(); | 78 | SetVS2002(); |
79 | base.Clean(kern); | 79 | base.Clean(kern); |
80 | } | 80 | } |
81 | 81 | ||
82 | /// <summary> | 82 | /// <summary> |
83 | /// Gets the name. | 83 | /// Gets the name. |
84 | /// </summary> | 84 | /// </summary> |
85 | /// <value>The name.</value> | 85 | /// <value>The name.</value> |
86 | public override string Name | 86 | public override string Name |
87 | { | 87 | { |
88 | get | 88 | get |
89 | { | 89 | { |
90 | return "vs2002"; | 90 | return "vs2002"; |
91 | } | 91 | } |
92 | } | 92 | } |
93 | 93 | ||
94 | #endregion | 94 | #endregion |
95 | } | 95 | } |
96 | } | 96 | } |
diff --git a/Prebuild/src/Core/Targets/VS2003Target.cs b/Prebuild/src/Core/Targets/VS2003Target.cs index b3236a8..c3ca930 100644 --- a/Prebuild/src/Core/Targets/VS2003Target.cs +++ b/Prebuild/src/Core/Targets/VS2003Target.cs | |||
@@ -1,633 +1,633 @@ | |||
1 | #region BSD License | 1 | #region BSD License |
2 | /* | 2 | /* |
3 | Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) | 3 | Copyright (c) 2004-2005 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 | ||
26 | #region CVS Information | 26 | #region CVS Information |
27 | /* | 27 | /* |
28 | * $Source$ | 28 | * $Source$ |
29 | * $Author: jendave $ | 29 | * $Author: jendave $ |
30 | * $Date: 2006-09-29 21:11:40 +0200 (fr, 29 sep 2006) $ | 30 | * $Date: 2006-09-29 21:11:40 +0200 (fr, 29 sep 2006) $ |
31 | * $Revision: 177 $ | 31 | * $Revision: 177 $ |
32 | */ | 32 | */ |
33 | #endregion | 33 | #endregion |
34 | 34 | ||
35 | using System; | 35 | using System; |
36 | using System.Collections; | 36 | using System.Collections; |
37 | using System.Collections.Specialized; | 37 | using System.Collections.Specialized; |
38 | using System.IO; | 38 | using System.IO; |
39 | 39 | ||
40 | using Prebuild.Core.Attributes; | 40 | using Prebuild.Core.Attributes; |
41 | using Prebuild.Core.Interfaces; | 41 | using Prebuild.Core.Interfaces; |
42 | using Prebuild.Core.Nodes; | 42 | using Prebuild.Core.Nodes; |
43 | using Prebuild.Core.Utilities; | 43 | using Prebuild.Core.Utilities; |
44 | 44 | ||
45 | namespace Prebuild.Core.Targets | 45 | namespace Prebuild.Core.Targets |
46 | { | 46 | { |
47 | /// <summary> | 47 | /// <summary> |
48 | /// | 48 | /// |
49 | /// </summary> | 49 | /// </summary> |
50 | public enum VSVersion | 50 | public enum VSVersion |
51 | { | 51 | { |
52 | /// <summary> | 52 | /// <summary> |
53 | /// | 53 | /// |
54 | /// </summary> | 54 | /// </summary> |
55 | VS70, | 55 | VS70, |
56 | /// <summary> | 56 | /// <summary> |
57 | /// | 57 | /// |
58 | /// </summary> | 58 | /// </summary> |
59 | VS71, | 59 | VS71, |
60 | /// <summary> | 60 | /// <summary> |
61 | /// | 61 | /// |
62 | /// </summary> | 62 | /// </summary> |
63 | VS80 | 63 | VS80 |
64 | } | 64 | } |
65 | 65 | ||
66 | /// <summary> | 66 | /// <summary> |
67 | /// | 67 | /// |
68 | /// </summary> | 68 | /// </summary> |
69 | [Target("vs2003")] | 69 | [Target("vs2003")] |
70 | public class VS2003Target : ITarget | 70 | public class VS2003Target : ITarget |
71 | { | 71 | { |
72 | 72 | ||
73 | #region Fields | 73 | #region Fields |
74 | 74 | ||
75 | string solutionVersion = "8.00"; | 75 | string solutionVersion = "8.00"; |
76 | string productVersion = "7.10.3077"; | 76 | string productVersion = "7.10.3077"; |
77 | string schemaVersion = "2.0"; | 77 | string schemaVersion = "2.0"; |
78 | string versionName = "2003"; | 78 | string versionName = "2003"; |
79 | VSVersion version = VSVersion.VS71; | 79 | VSVersion version = VSVersion.VS71; |
80 | 80 | ||
81 | Hashtable m_Tools; | 81 | Hashtable m_Tools; |
82 | Kernel m_Kernel; | 82 | Kernel m_Kernel; |
83 | 83 | ||
84 | /// <summary> | 84 | /// <summary> |
85 | /// Gets or sets the solution version. | 85 | /// Gets or sets the solution version. |
86 | /// </summary> | 86 | /// </summary> |
87 | /// <value>The solution version.</value> | 87 | /// <value>The solution version.</value> |
88 | protected string SolutionVersion | 88 | protected string SolutionVersion |
89 | { | 89 | { |
90 | get | 90 | get |
91 | { | 91 | { |
92 | return this.solutionVersion; | 92 | return this.solutionVersion; |
93 | } | 93 | } |
94 | set | 94 | set |
95 | { | 95 | { |
96 | this.solutionVersion = value; | 96 | this.solutionVersion = value; |
97 | } | 97 | } |
98 | } | 98 | } |
99 | /// <summary> | 99 | /// <summary> |
100 | /// Gets or sets the product version. | 100 | /// Gets or sets the product version. |
101 | /// </summary> | 101 | /// </summary> |
102 | /// <value>The product version.</value> | 102 | /// <value>The product version.</value> |
103 | protected string ProductVersion | 103 | protected string ProductVersion |
104 | { | 104 | { |
105 | get | 105 | get |
106 | { | 106 | { |
107 | return this.productVersion; | 107 | return this.productVersion; |
108 | } | 108 | } |
109 | set | 109 | set |
110 | { | 110 | { |
111 | this.productVersion = value; | 111 | this.productVersion = value; |
112 | } | 112 | } |
113 | } | 113 | } |
114 | /// <summary> | 114 | /// <summary> |
115 | /// Gets or sets the schema version. | 115 | /// Gets or sets the schema version. |
116 | /// </summary> | 116 | /// </summary> |
117 | /// <value>The schema version.</value> | 117 | /// <value>The schema version.</value> |
118 | protected string SchemaVersion | 118 | protected string SchemaVersion |
119 | { | 119 | { |
120 | get | 120 | get |
121 | { | 121 | { |
122 | return this.schemaVersion; | 122 | return this.schemaVersion; |
123 | } | 123 | } |
124 | set | 124 | set |
125 | { | 125 | { |
126 | this.schemaVersion = value; | 126 | this.schemaVersion = value; |
127 | } | 127 | } |
128 | } | 128 | } |
129 | /// <summary> | 129 | /// <summary> |
130 | /// Gets or sets the name of the version. | 130 | /// Gets or sets the name of the version. |
131 | /// </summary> | 131 | /// </summary> |
132 | /// <value>The name of the version.</value> | 132 | /// <value>The name of the version.</value> |
133 | protected string VersionName | 133 | protected string VersionName |
134 | { | 134 | { |
135 | get | 135 | get |
136 | { | 136 | { |
137 | return this.versionName; | 137 | return this.versionName; |
138 | } | 138 | } |
139 | set | 139 | set |
140 | { | 140 | { |
141 | this.versionName = value; | 141 | this.versionName = value; |
142 | } | 142 | } |
143 | } | 143 | } |
144 | /// <summary> | 144 | /// <summary> |
145 | /// Gets or sets the version. | 145 | /// Gets or sets the version. |
146 | /// </summary> | 146 | /// </summary> |
147 | /// <value>The version.</value> | 147 | /// <value>The version.</value> |
148 | protected VSVersion Version | 148 | protected VSVersion Version |
149 | { | 149 | { |
150 | get | 150 | get |
151 | { | 151 | { |
152 | return this.version; | 152 | return this.version; |
153 | } | 153 | } |
154 | set | 154 | set |
155 | { | 155 | { |
156 | this.version = value; | 156 | this.version = value; |
157 | } | 157 | } |
158 | } | 158 | } |
159 | 159 | ||
160 | #endregion | 160 | #endregion |
161 | 161 | ||
162 | #region Constructors | 162 | #region Constructors |
163 | 163 | ||
164 | /// <summary> | 164 | /// <summary> |
165 | /// Initializes a new instance of the <see cref="VS2003Target"/> class. | 165 | /// Initializes a new instance of the <see cref="VS2003Target"/> class. |
166 | /// </summary> | 166 | /// </summary> |
167 | public VS2003Target() | 167 | public VS2003Target() |
168 | { | 168 | { |
169 | m_Tools = new Hashtable(); | 169 | m_Tools = new Hashtable(); |
170 | 170 | ||
171 | m_Tools["C#"] = new ToolInfo("C#", "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}", "csproj", "CSHARP"); | 171 | m_Tools["C#"] = new ToolInfo("C#", "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}", "csproj", "CSHARP"); |
172 | m_Tools["VB.NET"] = new ToolInfo("VB.NET", "{F184B08F-C81C-45F6-A57F-5ABD9991F28F}", "vbproj", "VisualBasic"); | 172 | m_Tools["VB.NET"] = new ToolInfo("VB.NET", "{F184B08F-C81C-45F6-A57F-5ABD9991F28F}", "vbproj", "VisualBasic"); |
173 | } | 173 | } |
174 | 174 | ||
175 | #endregion | 175 | #endregion |
176 | 176 | ||
177 | #region Private Methods | 177 | #region Private Methods |
178 | 178 | ||
179 | private string MakeRefPath(ProjectNode project) | 179 | private string MakeRefPath(ProjectNode project) |
180 | { | 180 | { |
181 | string ret = ""; | 181 | string ret = ""; |
182 | foreach(ReferencePathNode node in project.ReferencePaths) | 182 | foreach(ReferencePathNode node in project.ReferencePaths) |
183 | { | 183 | { |
184 | try | 184 | try |
185 | { | 185 | { |
186 | string fullPath = Helper.ResolvePath(node.Path); | 186 | string fullPath = Helper.ResolvePath(node.Path); |
187 | if(ret.Length < 1) | 187 | if(ret.Length < 1) |
188 | { | 188 | { |
189 | ret = fullPath; | 189 | ret = fullPath; |
190 | } | 190 | } |
191 | else | 191 | else |
192 | { | 192 | { |
193 | ret += ";" + fullPath; | 193 | ret += ";" + fullPath; |
194 | } | 194 | } |
195 | } | 195 | } |
196 | catch(ArgumentException) | 196 | catch(ArgumentException) |
197 | { | 197 | { |
198 | m_Kernel.Log.Write(LogType.Warning, "Could not resolve reference path: {0}", node.Path); | 198 | m_Kernel.Log.Write(LogType.Warning, "Could not resolve reference path: {0}", node.Path); |
199 | } | 199 | } |
200 | } | 200 | } |
201 | 201 | ||
202 | return ret; | 202 | return ret; |
203 | } | 203 | } |
204 | 204 | ||
205 | private void WriteProject(SolutionNode solution, ProjectNode project) | 205 | private void WriteProject(SolutionNode solution, ProjectNode project) |
206 | { | 206 | { |
207 | if(!m_Tools.ContainsKey(project.Language)) | 207 | if(!m_Tools.ContainsKey(project.Language)) |
208 | { | 208 | { |
209 | throw new UnknownLanguageException("Unknown .NET language: " + project.Language); | 209 | throw new UnknownLanguageException("Unknown .NET language: " + project.Language); |
210 | } | 210 | } |
211 | 211 | ||
212 | ToolInfo toolInfo = (ToolInfo)m_Tools[project.Language]; | 212 | ToolInfo toolInfo = (ToolInfo)m_Tools[project.Language]; |
213 | string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, toolInfo.FileExtension); | 213 | string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, toolInfo.FileExtension); |
214 | StreamWriter ps = new StreamWriter(projectFile); | 214 | StreamWriter ps = new StreamWriter(projectFile); |
215 | 215 | ||
216 | m_Kernel.CurrentWorkingDirectory.Push(); | 216 | m_Kernel.CurrentWorkingDirectory.Push(); |
217 | Helper.SetCurrentDir(Path.GetDirectoryName(projectFile)); | 217 | Helper.SetCurrentDir(Path.GetDirectoryName(projectFile)); |
218 | 218 | ||
219 | IEnumerator enumerator; | 219 | IEnumerator enumerator; |
220 | //ConfigurationNode scripts; | 220 | //ConfigurationNode scripts; |
221 | 221 | ||
222 | using(ps) | 222 | using(ps) |
223 | { | 223 | { |
224 | ps.WriteLine("<VisualStudioProject>"); | 224 | ps.WriteLine("<VisualStudioProject>"); |
225 | ps.WriteLine(" <{0}", toolInfo.XmlTag); | 225 | ps.WriteLine(" <{0}", toolInfo.XmlTag); |
226 | ps.WriteLine("\t\t\t\tProjectType = \"Local\""); | 226 | ps.WriteLine("\t\t\t\tProjectType = \"Local\""); |
227 | ps.WriteLine("\t\t\t\tProductVersion = \"{0}\"", this.ProductVersion); | 227 | ps.WriteLine("\t\t\t\tProductVersion = \"{0}\"", this.ProductVersion); |
228 | ps.WriteLine("\t\t\t\tSchemaVersion = \"{0}\"", this.SchemaVersion); | 228 | ps.WriteLine("\t\t\t\tSchemaVersion = \"{0}\"", this.SchemaVersion); |
229 | ps.WriteLine("\t\t\t\tProjectGuid = \"{{{0}}}\"", project.Guid.ToString().ToUpper()); | 229 | ps.WriteLine("\t\t\t\tProjectGuid = \"{{{0}}}\"", project.Guid.ToString().ToUpper()); |
230 | ps.WriteLine("\t\t>"); | 230 | ps.WriteLine("\t\t>"); |
231 | 231 | ||
232 | ps.WriteLine("\t\t\t\t<Build>"); | 232 | ps.WriteLine("\t\t\t\t<Build>"); |
233 | ps.WriteLine(" <Settings"); | 233 | ps.WriteLine(" <Settings"); |
234 | ps.WriteLine("\t\t\t\t ApplicationIcon = \"{0}\"",project.AppIcon); | 234 | ps.WriteLine("\t\t\t\t ApplicationIcon = \"{0}\"",project.AppIcon); |
235 | ps.WriteLine("\t\t\t\t AssemblyKeyContainerName = \"\""); | 235 | ps.WriteLine("\t\t\t\t AssemblyKeyContainerName = \"\""); |
236 | ps.WriteLine("\t\t\t\t AssemblyName = \"{0}\"", project.AssemblyName); | 236 | ps.WriteLine("\t\t\t\t AssemblyName = \"{0}\"", project.AssemblyName); |
237 | ps.WriteLine("\t\t\t\t AssemblyOriginatorKeyFile = \"\""); | 237 | ps.WriteLine("\t\t\t\t AssemblyOriginatorKeyFile = \"\""); |
238 | ps.WriteLine("\t\t\t\t DefaultClientScript = \"JScript\""); | 238 | ps.WriteLine("\t\t\t\t DefaultClientScript = \"JScript\""); |
239 | ps.WriteLine("\t\t\t\t DefaultHTMLPageLayout = \"Grid\""); | 239 | ps.WriteLine("\t\t\t\t DefaultHTMLPageLayout = \"Grid\""); |
240 | ps.WriteLine("\t\t\t\t DefaultTargetSchema = \"IE50\""); | 240 | ps.WriteLine("\t\t\t\t DefaultTargetSchema = \"IE50\""); |
241 | ps.WriteLine("\t\t\t\t DelaySign = \"false\""); | 241 | ps.WriteLine("\t\t\t\t DelaySign = \"false\""); |
242 | 242 | ||
243 | if(this.Version == VSVersion.VS70) | 243 | if(this.Version == VSVersion.VS70) |
244 | { | 244 | { |
245 | ps.WriteLine("\t\t\t\t NoStandardLibraries = \"false\""); | 245 | ps.WriteLine("\t\t\t\t NoStandardLibraries = \"false\""); |
246 | } | 246 | } |
247 | 247 | ||
248 | ps.WriteLine("\t\t\t\t OutputType = \"{0}\"", project.Type.ToString()); | 248 | ps.WriteLine("\t\t\t\t OutputType = \"{0}\"", project.Type.ToString()); |
249 | 249 | ||
250 | enumerator = project.Configurations.GetEnumerator(); | 250 | enumerator = project.Configurations.GetEnumerator(); |
251 | enumerator.Reset(); | 251 | enumerator.Reset(); |
252 | enumerator.MoveNext(); | 252 | enumerator.MoveNext(); |
253 | foreach(ConfigurationNode conf in project.Configurations) | 253 | foreach(ConfigurationNode conf in project.Configurations) |
254 | { | 254 | { |
255 | if (conf.Options["PreBuildEvent"] != null && conf.Options["PreBuildEvent"].ToString().Length != 0) | 255 | if (conf.Options["PreBuildEvent"] != null && conf.Options["PreBuildEvent"].ToString().Length != 0) |
256 | { | 256 | { |
257 | ps.WriteLine("\t\t\t\t PreBuildEvent = \"{0}\"", Helper.NormalizePath(conf.Options["PreBuildEvent"].ToString())); | 257 | ps.WriteLine("\t\t\t\t PreBuildEvent = \"{0}\"", Helper.NormalizePath(conf.Options["PreBuildEvent"].ToString())); |
258 | } | 258 | } |
259 | else | 259 | else |
260 | { | 260 | { |
261 | ps.WriteLine("\t\t\t\t PreBuildEvent = \"{0}\"", conf.Options["PreBuildEvent"]); | 261 | ps.WriteLine("\t\t\t\t PreBuildEvent = \"{0}\"", conf.Options["PreBuildEvent"]); |
262 | } | 262 | } |
263 | if (conf.Options["PostBuildEvent"] != null && conf.Options["PostBuildEvent"].ToString().Length != 0) | 263 | if (conf.Options["PostBuildEvent"] != null && conf.Options["PostBuildEvent"].ToString().Length != 0) |
264 | { | 264 | { |
265 | ps.WriteLine("\t\t\t\t PostBuildEvent = \"{0}\"", Helper.NormalizePath(conf.Options["PostBuildEvent"].ToString())); | 265 | ps.WriteLine("\t\t\t\t PostBuildEvent = \"{0}\"", Helper.NormalizePath(conf.Options["PostBuildEvent"].ToString())); |
266 | } | 266 | } |
267 | else | 267 | else |
268 | { | 268 | { |
269 | ps.WriteLine("\t\t\t\t PostBuildEvent = \"{0}\"", conf.Options["PostBuildEvent"]); | 269 | ps.WriteLine("\t\t\t\t PostBuildEvent = \"{0}\"", conf.Options["PostBuildEvent"]); |
270 | } | 270 | } |
271 | if (conf.Options["RunPostBuildEvent"] == null) | 271 | if (conf.Options["RunPostBuildEvent"] == null) |
272 | { | 272 | { |
273 | ps.WriteLine("\t\t\t\t RunPostBuildEvent = \"{0}\"", "OnBuildSuccess"); | 273 | ps.WriteLine("\t\t\t\t RunPostBuildEvent = \"{0}\"", "OnBuildSuccess"); |
274 | } | 274 | } |
275 | else | 275 | else |
276 | { | 276 | { |
277 | ps.WriteLine("\t\t\t\t RunPostBuildEvent = \"{0}\"", conf.Options["RunPostBuildEvent"]); | 277 | ps.WriteLine("\t\t\t\t RunPostBuildEvent = \"{0}\"", conf.Options["RunPostBuildEvent"]); |
278 | } | 278 | } |
279 | break; | 279 | break; |
280 | } | 280 | } |
281 | 281 | ||
282 | ps.WriteLine("\t\t\t\t RootNamespace = \"{0}\"", project.RootNamespace); | 282 | ps.WriteLine("\t\t\t\t RootNamespace = \"{0}\"", project.RootNamespace); |
283 | ps.WriteLine("\t\t\t\t StartupObject = \"{0}\"", project.StartupObject); | 283 | ps.WriteLine("\t\t\t\t StartupObject = \"{0}\"", project.StartupObject); |
284 | ps.WriteLine("\t\t >"); | 284 | ps.WriteLine("\t\t >"); |
285 | 285 | ||
286 | foreach(ConfigurationNode conf in project.Configurations) | 286 | foreach(ConfigurationNode conf in project.Configurations) |
287 | { | 287 | { |
288 | ps.WriteLine("\t\t\t\t <Config"); | 288 | ps.WriteLine("\t\t\t\t <Config"); |
289 | ps.WriteLine("\t\t\t\t Name = \"{0}\"", conf.Name); | 289 | ps.WriteLine("\t\t\t\t Name = \"{0}\"", conf.Name); |
290 | ps.WriteLine("\t\t\t\t AllowUnsafeBlocks = \"{0}\"", conf.Options["AllowUnsafe"].ToString().ToLower()); | 290 | ps.WriteLine("\t\t\t\t AllowUnsafeBlocks = \"{0}\"", conf.Options["AllowUnsafe"].ToString().ToLower()); |
291 | ps.WriteLine("\t\t\t\t BaseAddress = \"{0}\"", conf.Options["BaseAddress"]); | 291 | ps.WriteLine("\t\t\t\t BaseAddress = \"{0}\"", conf.Options["BaseAddress"]); |
292 | ps.WriteLine("\t\t\t\t CheckForOverflowUnderflow = \"{0}\"", conf.Options["CheckUnderflowOverflow"].ToString().ToLower()); | 292 | ps.WriteLine("\t\t\t\t CheckForOverflowUnderflow = \"{0}\"", conf.Options["CheckUnderflowOverflow"].ToString().ToLower()); |
293 | ps.WriteLine("\t\t\t\t ConfigurationOverrideFile = \"\""); | 293 | ps.WriteLine("\t\t\t\t ConfigurationOverrideFile = \"\""); |
294 | ps.WriteLine("\t\t\t\t DefineConstants = \"{0}\"", conf.Options["CompilerDefines"]); | 294 | ps.WriteLine("\t\t\t\t DefineConstants = \"{0}\"", conf.Options["CompilerDefines"]); |
295 | ps.WriteLine("\t\t\t\t DocumentationFile = \"{0}\"", GetXmlDocFile(project, conf));//default to the assembly name | 295 | ps.WriteLine("\t\t\t\t DocumentationFile = \"{0}\"", GetXmlDocFile(project, conf));//default to the assembly name |
296 | ps.WriteLine("\t\t\t\t DebugSymbols = \"{0}\"", conf.Options["DebugInformation"].ToString().ToLower()); | 296 | ps.WriteLine("\t\t\t\t DebugSymbols = \"{0}\"", conf.Options["DebugInformation"].ToString().ToLower()); |
297 | ps.WriteLine("\t\t\t\t FileAlignment = \"{0}\"", conf.Options["FileAlignment"]); | 297 | ps.WriteLine("\t\t\t\t FileAlignment = \"{0}\"", conf.Options["FileAlignment"]); |
298 | ps.WriteLine("\t\t\t\t IncrementalBuild = \"{0}\"", conf.Options["IncrementalBuild"].ToString().ToLower()); | 298 | ps.WriteLine("\t\t\t\t IncrementalBuild = \"{0}\"", conf.Options["IncrementalBuild"].ToString().ToLower()); |
299 | 299 | ||
300 | if(this.Version == VSVersion.VS71) | 300 | if(this.Version == VSVersion.VS71) |
301 | { | 301 | { |
302 | ps.WriteLine("\t\t\t\t NoStdLib = \"{0}\"", conf.Options["NoStdLib"].ToString().ToLower()); | 302 | ps.WriteLine("\t\t\t\t NoStdLib = \"{0}\"", conf.Options["NoStdLib"].ToString().ToLower()); |
303 | ps.WriteLine("\t\t\t\t NoWarn = \"{0}\"", conf.Options["SuppressWarnings"].ToString().ToLower()); | 303 | ps.WriteLine("\t\t\t\t NoWarn = \"{0}\"", conf.Options["SuppressWarnings"].ToString().ToLower()); |
304 | } | 304 | } |
305 | 305 | ||
306 | ps.WriteLine("\t\t\t\t Optimize = \"{0}\"", conf.Options["OptimizeCode"].ToString().ToLower()); | 306 | ps.WriteLine("\t\t\t\t Optimize = \"{0}\"", conf.Options["OptimizeCode"].ToString().ToLower()); |
307 | ps.WriteLine(" OutputPath = \"{0}\"", | 307 | ps.WriteLine(" OutputPath = \"{0}\"", |
308 | Helper.EndPath(Helper.NormalizePath(conf.Options["OutputPath"].ToString()))); | 308 | Helper.EndPath(Helper.NormalizePath(conf.Options["OutputPath"].ToString()))); |
309 | ps.WriteLine(" RegisterForComInterop = \"{0}\"", conf.Options["RegisterComInterop"].ToString().ToLower()); | 309 | ps.WriteLine(" RegisterForComInterop = \"{0}\"", conf.Options["RegisterComInterop"].ToString().ToLower()); |
310 | ps.WriteLine(" RemoveIntegerChecks = \"{0}\"", conf.Options["RemoveIntegerChecks"].ToString().ToLower()); | 310 | ps.WriteLine(" RemoveIntegerChecks = \"{0}\"", conf.Options["RemoveIntegerChecks"].ToString().ToLower()); |
311 | ps.WriteLine(" TreatWarningsAsErrors = \"{0}\"", conf.Options["WarningsAsErrors"].ToString().ToLower()); | 311 | ps.WriteLine(" TreatWarningsAsErrors = \"{0}\"", conf.Options["WarningsAsErrors"].ToString().ToLower()); |
312 | ps.WriteLine(" WarningLevel = \"{0}\"", conf.Options["WarningLevel"]); | 312 | ps.WriteLine(" WarningLevel = \"{0}\"", conf.Options["WarningLevel"]); |
313 | ps.WriteLine(" />"); | 313 | ps.WriteLine(" />"); |
314 | } | 314 | } |
315 | 315 | ||
316 | ps.WriteLine(" </Settings>"); | 316 | ps.WriteLine(" </Settings>"); |
317 | 317 | ||
318 | ps.WriteLine(" <References>"); | 318 | ps.WriteLine(" <References>"); |
319 | foreach(ReferenceNode refr in project.References) | 319 | foreach(ReferenceNode refr in project.References) |
320 | { | 320 | { |
321 | ps.WriteLine(" <Reference"); | 321 | ps.WriteLine(" <Reference"); |
322 | ps.WriteLine(" Name = \"{0}\"", refr.Name); | 322 | ps.WriteLine(" Name = \"{0}\"", refr.Name); |
323 | ps.WriteLine(" AssemblyName = \"{0}\"", refr.Name); | 323 | ps.WriteLine(" AssemblyName = \"{0}\"", refr.Name); |
324 | 324 | ||
325 | if(solution.ProjectsTable.ContainsKey(refr.Name)) | 325 | if(solution.ProjectsTable.ContainsKey(refr.Name)) |
326 | { | 326 | { |
327 | ProjectNode refProject = (ProjectNode)solution.ProjectsTable[refr.Name]; | 327 | ProjectNode refProject = (ProjectNode)solution.ProjectsTable[refr.Name]; |
328 | ps.WriteLine(" Project = \"{{{0}}}\"", refProject.Guid.ToString().ToUpper()); | 328 | ps.WriteLine(" Project = \"{{{0}}}\"", refProject.Guid.ToString().ToUpper()); |
329 | ps.WriteLine(" Package = \"{0}\"", toolInfo.Guid.ToString().ToUpper()); | 329 | ps.WriteLine(" Package = \"{0}\"", toolInfo.Guid.ToString().ToUpper()); |
330 | } | 330 | } |
331 | else | 331 | else |
332 | { | 332 | { |
333 | if(refr.Path != null) | 333 | if(refr.Path != null) |
334 | { | 334 | { |
335 | ps.WriteLine(" HintPath = \"{0}\"", Helper.MakeFilePath(refr.Path, refr.Name, "dll")); | 335 | ps.WriteLine(" HintPath = \"{0}\"", Helper.MakeFilePath(refr.Path, refr.Name, "dll")); |
336 | } | 336 | } |
337 | 337 | ||
338 | } | 338 | } |
339 | 339 | ||
340 | if(refr.LocalCopySpecified) | 340 | if(refr.LocalCopySpecified) |
341 | { | 341 | { |
342 | ps.WriteLine(" Private = \"{0}\"",refr.LocalCopy); | 342 | ps.WriteLine(" Private = \"{0}\"",refr.LocalCopy); |
343 | } | 343 | } |
344 | 344 | ||
345 | ps.WriteLine(" />"); | 345 | ps.WriteLine(" />"); |
346 | } | 346 | } |
347 | ps.WriteLine(" </References>"); | 347 | ps.WriteLine(" </References>"); |
348 | 348 | ||
349 | ps.WriteLine(" </Build>"); | 349 | ps.WriteLine(" </Build>"); |
350 | ps.WriteLine(" <Files>"); | 350 | ps.WriteLine(" <Files>"); |
351 | 351 | ||
352 | ps.WriteLine(" <Include>"); | 352 | ps.WriteLine(" <Include>"); |
353 | 353 | ||
354 | foreach(string file in project.Files) | 354 | foreach(string file in project.Files) |
355 | { | 355 | { |
356 | string fileName = file.Replace(".\\", ""); | 356 | string fileName = file.Replace(".\\", ""); |
357 | ps.WriteLine(" <File"); | 357 | ps.WriteLine(" <File"); |
358 | ps.WriteLine(" RelPath = \"{0}\"", fileName); | 358 | ps.WriteLine(" RelPath = \"{0}\"", fileName); |
359 | ps.WriteLine(" SubType = \"{0}\"", project.Files.GetSubType(file)); | 359 | ps.WriteLine(" SubType = \"{0}\"", project.Files.GetSubType(file)); |
360 | ps.WriteLine(" BuildAction = \"{0}\"", project.Files.GetBuildAction(file)); | 360 | ps.WriteLine(" BuildAction = \"{0}\"", project.Files.GetBuildAction(file)); |
361 | ps.WriteLine(" />"); | 361 | ps.WriteLine(" />"); |
362 | 362 | ||
363 | if (project.Files.GetSubType(file) != SubType.Code && project.Files.GetSubType(file) != SubType.Settings) | 363 | if (project.Files.GetSubType(file) != SubType.Code && project.Files.GetSubType(file) != SubType.Settings) |
364 | { | 364 | { |
365 | ps.WriteLine(" <File"); | 365 | ps.WriteLine(" <File"); |
366 | ps.WriteLine(" RelPath = \"{0}\"", fileName.Substring(0, fileName.LastIndexOf('.')) + ".resx"); | 366 | ps.WriteLine(" RelPath = \"{0}\"", fileName.Substring(0, fileName.LastIndexOf('.')) + ".resx"); |
367 | int slash = fileName.LastIndexOf('\\'); | 367 | int slash = fileName.LastIndexOf('\\'); |
368 | if (slash == -1) | 368 | if (slash == -1) |
369 | { | 369 | { |
370 | ps.WriteLine(" DependentUpon = \"{0}\"", fileName); | 370 | ps.WriteLine(" DependentUpon = \"{0}\"", fileName); |
371 | } | 371 | } |
372 | else | 372 | else |
373 | { | 373 | { |
374 | ps.WriteLine(" DependentUpon = \"{0}\"", fileName.Substring(slash + 1, fileName.Length - slash - 1)); | 374 | ps.WriteLine(" DependentUpon = \"{0}\"", fileName.Substring(slash + 1, fileName.Length - slash - 1)); |
375 | } | 375 | } |
376 | ps.WriteLine(" BuildAction = \"{0}\"", "EmbeddedResource"); | 376 | ps.WriteLine(" BuildAction = \"{0}\"", "EmbeddedResource"); |
377 | ps.WriteLine(" />"); | 377 | ps.WriteLine(" />"); |
378 | 378 | ||
379 | } | 379 | } |
380 | } | 380 | } |
381 | ps.WriteLine(" </Include>"); | 381 | ps.WriteLine(" </Include>"); |
382 | 382 | ||
383 | ps.WriteLine(" </Files>"); | 383 | ps.WriteLine(" </Files>"); |
384 | ps.WriteLine(" </{0}>", toolInfo.XmlTag); | 384 | ps.WriteLine(" </{0}>", toolInfo.XmlTag); |
385 | ps.WriteLine("</VisualStudioProject>"); | 385 | ps.WriteLine("</VisualStudioProject>"); |
386 | } | 386 | } |
387 | 387 | ||
388 | ps = new StreamWriter(projectFile + ".user"); | 388 | ps = new StreamWriter(projectFile + ".user"); |
389 | using(ps) | 389 | using(ps) |
390 | { | 390 | { |
391 | ps.WriteLine("<VisualStudioProject>"); | 391 | ps.WriteLine("<VisualStudioProject>"); |
392 | ps.WriteLine(" <{0}>", toolInfo.XmlTag); | 392 | ps.WriteLine(" <{0}>", toolInfo.XmlTag); |
393 | ps.WriteLine(" <Build>"); | 393 | ps.WriteLine(" <Build>"); |
394 | 394 | ||
395 | ps.WriteLine(" <Settings ReferencePath=\"{0}\">", MakeRefPath(project)); | 395 | ps.WriteLine(" <Settings ReferencePath=\"{0}\">", MakeRefPath(project)); |
396 | foreach(ConfigurationNode conf in project.Configurations) | 396 | foreach(ConfigurationNode conf in project.Configurations) |
397 | { | 397 | { |
398 | ps.WriteLine(" <Config"); | 398 | ps.WriteLine(" <Config"); |
399 | ps.WriteLine(" Name = \"{0}\"", conf.Name); | 399 | ps.WriteLine(" Name = \"{0}\"", conf.Name); |
400 | ps.WriteLine(" />"); | 400 | ps.WriteLine(" />"); |
401 | } | 401 | } |
402 | ps.WriteLine(" </Settings>"); | 402 | ps.WriteLine(" </Settings>"); |
403 | 403 | ||
404 | ps.WriteLine(" </Build>"); | 404 | ps.WriteLine(" </Build>"); |
405 | ps.WriteLine(" </{0}>", toolInfo.XmlTag); | 405 | ps.WriteLine(" </{0}>", toolInfo.XmlTag); |
406 | ps.WriteLine("</VisualStudioProject>"); | 406 | ps.WriteLine("</VisualStudioProject>"); |
407 | } | 407 | } |
408 | 408 | ||
409 | m_Kernel.CurrentWorkingDirectory.Pop(); | 409 | m_Kernel.CurrentWorkingDirectory.Pop(); |
410 | } | 410 | } |
411 | 411 | ||
412 | /// <summary> | 412 | /// <summary> |
413 | /// Gets the XML doc file. | 413 | /// Gets the XML doc file. |
414 | /// </summary> | 414 | /// </summary> |
415 | /// <param name="project">The project.</param> | 415 | /// <param name="project">The project.</param> |
416 | /// <param name="conf">The conf.</param> | 416 | /// <param name="conf">The conf.</param> |
417 | /// <returns></returns> | 417 | /// <returns></returns> |
418 | public static string GetXmlDocFile(ProjectNode project, ConfigurationNode conf) | 418 | public static string GetXmlDocFile(ProjectNode project, ConfigurationNode conf) |
419 | { | 419 | { |
420 | if( conf == null ) | 420 | if( conf == null ) |
421 | { | 421 | { |
422 | throw new ArgumentNullException("conf"); | 422 | throw new ArgumentNullException("conf"); |
423 | } | 423 | } |
424 | if( project == null ) | 424 | if( project == null ) |
425 | { | 425 | { |
426 | throw new ArgumentNullException("project"); | 426 | throw new ArgumentNullException("project"); |
427 | } | 427 | } |
428 | // if(!(bool)conf.Options["GenerateXmlDocFile"]) //default to none, if the generate option is false | 428 | // if(!(bool)conf.Options["GenerateXmlDocFile"]) //default to none, if the generate option is false |
429 | // { | 429 | // { |
430 | // return string.Empty; | 430 | // return string.Empty; |
431 | // } | 431 | // } |
432 | 432 | ||
433 | //default to "AssemblyName.xml" | 433 | //default to "AssemblyName.xml" |
434 | //string defaultValue = Path.GetFileNameWithoutExtension(project.AssemblyName) + ".xml"; | 434 | //string defaultValue = Path.GetFileNameWithoutExtension(project.AssemblyName) + ".xml"; |
435 | //return (string)conf.Options["XmlDocFile", defaultValue]; | 435 | //return (string)conf.Options["XmlDocFile", defaultValue]; |
436 | 436 | ||
437 | //default to no XmlDocFile file | 437 | //default to no XmlDocFile file |
438 | return (string)conf.Options["XmlDocFile", ""]; | 438 | return (string)conf.Options["XmlDocFile", ""]; |
439 | } | 439 | } |
440 | 440 | ||
441 | private void WriteSolution(SolutionNode solution) | 441 | private void WriteSolution(SolutionNode solution) |
442 | { | 442 | { |
443 | m_Kernel.Log.Write("Creating Visual Studio {0} solution and project files", this.VersionName); | 443 | m_Kernel.Log.Write("Creating Visual Studio {0} solution and project files", this.VersionName); |
444 | 444 | ||
445 | foreach(ProjectNode project in solution.Projects) | 445 | foreach(ProjectNode project in solution.Projects) |
446 | { | 446 | { |
447 | if(m_Kernel.AllowProject(project.FilterGroups)) | 447 | if(m_Kernel.AllowProject(project.FilterGroups)) |
448 | { | 448 | { |
449 | m_Kernel.Log.Write("...Creating project: {0}", project.Name); | 449 | m_Kernel.Log.Write("...Creating project: {0}", project.Name); |
450 | WriteProject(solution, project); | 450 | WriteProject(solution, project); |
451 | } | 451 | } |
452 | } | 452 | } |
453 | 453 | ||
454 | m_Kernel.Log.Write(""); | 454 | m_Kernel.Log.Write(""); |
455 | string solutionFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "sln"); | 455 | string solutionFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "sln"); |
456 | StreamWriter ss = new StreamWriter(solutionFile); | 456 | StreamWriter ss = new StreamWriter(solutionFile); |
457 | 457 | ||
458 | m_Kernel.CurrentWorkingDirectory.Push(); | 458 | m_Kernel.CurrentWorkingDirectory.Push(); |
459 | Helper.SetCurrentDir(Path.GetDirectoryName(solutionFile)); | 459 | Helper.SetCurrentDir(Path.GetDirectoryName(solutionFile)); |
460 | 460 | ||
461 | using(ss) | 461 | using(ss) |
462 | { | 462 | { |
463 | ss.WriteLine("Microsoft Visual Studio Solution File, Format Version {0}", this.SolutionVersion); | 463 | ss.WriteLine("Microsoft Visual Studio Solution File, Format Version {0}", this.SolutionVersion); |
464 | foreach(ProjectNode project in solution.Projects) | 464 | foreach(ProjectNode project in solution.Projects) |
465 | { | 465 | { |
466 | if(!m_Tools.ContainsKey(project.Language)) | 466 | if(!m_Tools.ContainsKey(project.Language)) |
467 | { | 467 | { |
468 | throw new UnknownLanguageException("Unknown .NET language: " + project.Language); | 468 | throw new UnknownLanguageException("Unknown .NET language: " + project.Language); |
469 | } | 469 | } |
470 | 470 | ||
471 | ToolInfo toolInfo = (ToolInfo)m_Tools[project.Language]; | 471 | ToolInfo toolInfo = (ToolInfo)m_Tools[project.Language]; |
472 | 472 | ||
473 | string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath); | 473 | string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath); |
474 | ss.WriteLine("Project(\"{0}\") = \"{1}\", \"{2}\", \"{{{3}}}\"", | 474 | ss.WriteLine("Project(\"{0}\") = \"{1}\", \"{2}\", \"{{{3}}}\"", |
475 | toolInfo.Guid, project.Name, Helper.MakeFilePath(path, project.Name, | 475 | toolInfo.Guid, project.Name, Helper.MakeFilePath(path, project.Name, |
476 | toolInfo.FileExtension), project.Guid.ToString().ToUpper()); | 476 | toolInfo.FileExtension), project.Guid.ToString().ToUpper()); |
477 | 477 | ||
478 | ss.WriteLine("\tProjectSection(ProjectDependencies) = postProject"); | 478 | ss.WriteLine("\tProjectSection(ProjectDependencies) = postProject"); |
479 | ss.WriteLine("\tEndProjectSection"); | 479 | ss.WriteLine("\tEndProjectSection"); |
480 | 480 | ||
481 | ss.WriteLine("EndProject"); | 481 | ss.WriteLine("EndProject"); |
482 | } | 482 | } |
483 | 483 | ||
484 | ss.WriteLine("Global"); | 484 | ss.WriteLine("Global"); |
485 | 485 | ||
486 | ss.WriteLine("\tGlobalSection(SolutionConfiguration) = preSolution"); | 486 | ss.WriteLine("\tGlobalSection(SolutionConfiguration) = preSolution"); |
487 | foreach(ConfigurationNode conf in solution.Configurations) | 487 | foreach(ConfigurationNode conf in solution.Configurations) |
488 | { | 488 | { |
489 | ss.WriteLine("\t\t{0} = {0}", conf.Name); | 489 | ss.WriteLine("\t\t{0} = {0}", conf.Name); |
490 | } | 490 | } |
491 | ss.WriteLine("\tEndGlobalSection"); | 491 | ss.WriteLine("\tEndGlobalSection"); |
492 | 492 | ||
493 | ss.WriteLine("\tGlobalSection(ProjectDependencies) = postSolution"); | 493 | ss.WriteLine("\tGlobalSection(ProjectDependencies) = postSolution"); |
494 | foreach(ProjectNode project in solution.Projects) | 494 | foreach(ProjectNode project in solution.Projects) |
495 | { | 495 | { |
496 | for(int i = 0; i < project.References.Count; i++) | 496 | for(int i = 0; i < project.References.Count; i++) |
497 | { | 497 | { |
498 | ReferenceNode refr = (ReferenceNode)project.References[i]; | 498 | ReferenceNode refr = (ReferenceNode)project.References[i]; |
499 | if(solution.ProjectsTable.ContainsKey(refr.Name)) | 499 | if(solution.ProjectsTable.ContainsKey(refr.Name)) |
500 | { | 500 | { |
501 | ProjectNode refProject = (ProjectNode)solution.ProjectsTable[refr.Name]; | 501 | ProjectNode refProject = (ProjectNode)solution.ProjectsTable[refr.Name]; |
502 | ss.WriteLine("\t\t({{{0}}}).{1} = ({{{2}}})", | 502 | ss.WriteLine("\t\t({{{0}}}).{1} = ({{{2}}})", |
503 | project.Guid.ToString().ToUpper() | 503 | project.Guid.ToString().ToUpper() |
504 | , i, | 504 | , i, |
505 | refProject.Guid.ToString().ToUpper() | 505 | refProject.Guid.ToString().ToUpper() |
506 | ); | 506 | ); |
507 | } | 507 | } |
508 | } | 508 | } |
509 | } | 509 | } |
510 | ss.WriteLine("\tEndGlobalSection"); | 510 | ss.WriteLine("\tEndGlobalSection"); |
511 | 511 | ||
512 | ss.WriteLine("\tGlobalSection(ProjectConfiguration) = postSolution"); | 512 | ss.WriteLine("\tGlobalSection(ProjectConfiguration) = postSolution"); |
513 | foreach(ProjectNode project in solution.Projects) | 513 | foreach(ProjectNode project in solution.Projects) |
514 | { | 514 | { |
515 | foreach(ConfigurationNode conf in solution.Configurations) | 515 | foreach(ConfigurationNode conf in solution.Configurations) |
516 | { | 516 | { |
517 | ss.WriteLine("\t\t{{{0}}}.{1}.ActiveCfg = {1}|.NET", | 517 | ss.WriteLine("\t\t{{{0}}}.{1}.ActiveCfg = {1}|.NET", |
518 | project.Guid.ToString().ToUpper(), | 518 | project.Guid.ToString().ToUpper(), |
519 | conf.Name); | 519 | conf.Name); |
520 | 520 | ||
521 | ss.WriteLine("\t\t{{{0}}}.{1}.Build.0 = {1}|.NET", | 521 | ss.WriteLine("\t\t{{{0}}}.{1}.Build.0 = {1}|.NET", |
522 | project.Guid.ToString().ToUpper(), | 522 | project.Guid.ToString().ToUpper(), |
523 | conf.Name); | 523 | conf.Name); |
524 | } | 524 | } |
525 | } | 525 | } |
526 | ss.WriteLine("\tEndGlobalSection"); | 526 | ss.WriteLine("\tEndGlobalSection"); |
527 | 527 | ||
528 | if(solution.Files != null) | 528 | if(solution.Files != null) |
529 | { | 529 | { |
530 | ss.WriteLine("\tGlobalSection(SolutionItems) = postSolution"); | 530 | ss.WriteLine("\tGlobalSection(SolutionItems) = postSolution"); |
531 | foreach(string file in solution.Files) | 531 | foreach(string file in solution.Files) |
532 | { | 532 | { |
533 | ss.WriteLine("\t\t{0} = {0}", file); | 533 | ss.WriteLine("\t\t{0} = {0}", file); |
534 | } | 534 | } |
535 | ss.WriteLine("\tEndGlobalSection"); | 535 | ss.WriteLine("\tEndGlobalSection"); |
536 | } | 536 | } |
537 | 537 | ||
538 | ss.WriteLine("\tGlobalSection(ExtensibilityGlobals) = postSolution"); | 538 | ss.WriteLine("\tGlobalSection(ExtensibilityGlobals) = postSolution"); |
539 | ss.WriteLine("\tEndGlobalSection"); | 539 | ss.WriteLine("\tEndGlobalSection"); |
540 | ss.WriteLine("\tGlobalSection(ExtensibilityAddIns) = postSolution"); | 540 | ss.WriteLine("\tGlobalSection(ExtensibilityAddIns) = postSolution"); |
541 | ss.WriteLine("\tEndGlobalSection"); | 541 | ss.WriteLine("\tEndGlobalSection"); |
542 | 542 | ||
543 | ss.WriteLine("EndGlobal"); | 543 | ss.WriteLine("EndGlobal"); |
544 | } | 544 | } |
545 | 545 | ||
546 | m_Kernel.CurrentWorkingDirectory.Pop(); | 546 | m_Kernel.CurrentWorkingDirectory.Pop(); |
547 | } | 547 | } |
548 | 548 | ||
549 | private void CleanProject(ProjectNode project) | 549 | private void CleanProject(ProjectNode project) |
550 | { | 550 | { |
551 | m_Kernel.Log.Write("...Cleaning project: {0}", project.Name); | 551 | m_Kernel.Log.Write("...Cleaning project: {0}", project.Name); |
552 | 552 | ||
553 | ToolInfo toolInfo = (ToolInfo)m_Tools[project.Language]; | 553 | ToolInfo toolInfo = (ToolInfo)m_Tools[project.Language]; |
554 | string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, toolInfo.FileExtension); | 554 | string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, toolInfo.FileExtension); |
555 | string userFile = projectFile + ".user"; | 555 | string userFile = projectFile + ".user"; |
556 | 556 | ||
557 | Helper.DeleteIfExists(projectFile); | 557 | Helper.DeleteIfExists(projectFile); |
558 | Helper.DeleteIfExists(userFile); | 558 | Helper.DeleteIfExists(userFile); |
559 | } | 559 | } |
560 | 560 | ||
561 | private void CleanSolution(SolutionNode solution) | 561 | private void CleanSolution(SolutionNode solution) |
562 | { | 562 | { |
563 | m_Kernel.Log.Write("Cleaning Visual Studio {0} solution and project files", this.VersionName, solution.Name); | 563 | m_Kernel.Log.Write("Cleaning Visual Studio {0} solution and project files", this.VersionName, solution.Name); |
564 | 564 | ||
565 | string slnFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "sln"); | 565 | string slnFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "sln"); |
566 | string suoFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "suo"); | 566 | string suoFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "suo"); |
567 | 567 | ||
568 | Helper.DeleteIfExists(slnFile); | 568 | Helper.DeleteIfExists(slnFile); |
569 | Helper.DeleteIfExists(suoFile); | 569 | Helper.DeleteIfExists(suoFile); |
570 | 570 | ||
571 | foreach(ProjectNode project in solution.Projects) | 571 | foreach(ProjectNode project in solution.Projects) |
572 | { | 572 | { |
573 | CleanProject(project); | 573 | CleanProject(project); |
574 | } | 574 | } |
575 | 575 | ||
576 | m_Kernel.Log.Write(""); | 576 | m_Kernel.Log.Write(""); |
577 | } | 577 | } |
578 | 578 | ||
579 | #endregion | 579 | #endregion |
580 | 580 | ||
581 | #region ITarget Members | 581 | #region ITarget Members |
582 | 582 | ||
583 | /// <summary> | 583 | /// <summary> |
584 | /// Writes the specified kern. | 584 | /// Writes the specified kern. |
585 | /// </summary> | 585 | /// </summary> |
586 | /// <param name="kern">The kern.</param> | 586 | /// <param name="kern">The kern.</param> |
587 | public virtual void Write(Kernel kern) | 587 | public virtual void Write(Kernel kern) |
588 | { | 588 | { |
589 | if( kern == null ) | 589 | if( kern == null ) |
590 | { | 590 | { |
591 | throw new ArgumentNullException("kern"); | 591 | throw new ArgumentNullException("kern"); |
592 | } | 592 | } |
593 | m_Kernel = kern; | 593 | m_Kernel = kern; |
594 | foreach(SolutionNode sol in m_Kernel.Solutions) | 594 | foreach(SolutionNode sol in m_Kernel.Solutions) |
595 | { | 595 | { |
596 | WriteSolution(sol); | 596 | WriteSolution(sol); |
597 | } | 597 | } |
598 | m_Kernel = null; | 598 | m_Kernel = null; |
599 | } | 599 | } |
600 | 600 | ||
601 | /// <summary> | 601 | /// <summary> |
602 | /// Cleans the specified kern. | 602 | /// Cleans the specified kern. |
603 | /// </summary> | 603 | /// </summary> |
604 | /// <param name="kern">The kern.</param> | 604 | /// <param name="kern">The kern.</param> |
605 | public virtual void Clean(Kernel kern) | 605 | public virtual void Clean(Kernel kern) |
606 | { | 606 | { |
607 | if( kern == null ) | 607 | if( kern == null ) |
608 | { | 608 | { |
609 | throw new ArgumentNullException("kern"); | 609 | throw new ArgumentNullException("kern"); |
610 | } | 610 | } |
611 | m_Kernel = kern; | 611 | m_Kernel = kern; |
612 | foreach(SolutionNode sol in m_Kernel.Solutions) | 612 | foreach(SolutionNode sol in m_Kernel.Solutions) |
613 | { | 613 | { |
614 | CleanSolution(sol); | 614 | CleanSolution(sol); |
615 | } | 615 | } |
616 | m_Kernel = null; | 616 | m_Kernel = null; |
617 | } | 617 | } |
618 | 618 | ||
619 | /// <summary> | 619 | /// <summary> |
620 | /// Gets the name. | 620 | /// Gets the name. |
621 | /// </summary> | 621 | /// </summary> |
622 | /// <value>The name.</value> | 622 | /// <value>The name.</value> |
623 | public virtual string Name | 623 | public virtual string Name |
624 | { | 624 | { |
625 | get | 625 | get |
626 | { | 626 | { |
627 | return "vs2003"; | 627 | return "vs2003"; |
628 | } | 628 | } |
629 | } | 629 | } |
630 | 630 | ||
631 | #endregion | 631 | #endregion |
632 | } | 632 | } |
633 | } | 633 | } |
diff --git a/Prebuild/src/Core/Targets/VS2005Target.cs b/Prebuild/src/Core/Targets/VS2005Target.cs index 23b6116..f01906b 100644 --- a/Prebuild/src/Core/Targets/VS2005Target.cs +++ b/Prebuild/src/Core/Targets/VS2005Target.cs | |||
@@ -1,883 +1,883 @@ | |||
1 | #region BSD License | 1 | #region BSD License |
2 | /* | 2 | /* |
3 | Copyright (c) 2004 Matthew Holmes (matthew@wildfiregames.com) | 3 | Copyright (c) 2004 Matthew Holmes (matthew@wildfiregames.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 | ||
26 | #region CVS Information | 26 | #region CVS Information |
27 | /* | 27 | /* |
28 | * $Source$ | 28 | * $Source$ |
29 | * $Author: robloach $ | 29 | * $Author: robloach $ |
30 | * $Date: 2007-02-27 19:52:34 +0100 (ti, 27 feb 2007) $ | 30 | * $Date: 2007-02-27 19:52:34 +0100 (ti, 27 feb 2007) $ |
31 | * $Revision: 207 $ | 31 | * $Revision: 207 $ |
32 | */ | 32 | */ |
33 | #endregion | 33 | #endregion |
34 | 34 | ||
35 | using System; | 35 | using System; |
36 | using System.Collections; | 36 | using System.Collections; |
37 | using System.Collections.Specialized; | 37 | using System.Collections.Specialized; |
38 | using System.IO; | 38 | using System.IO; |
39 | 39 | ||
40 | using Prebuild.Core.Attributes; | 40 | using Prebuild.Core.Attributes; |
41 | using Prebuild.Core.Interfaces; | 41 | using Prebuild.Core.Interfaces; |
42 | using Prebuild.Core.Nodes; | 42 | using Prebuild.Core.Nodes; |
43 | using Prebuild.Core.Utilities; | 43 | using Prebuild.Core.Utilities; |
44 | 44 | ||
45 | namespace Prebuild.Core.Targets | 45 | namespace Prebuild.Core.Targets |
46 | { | 46 | { |
47 | /// <summary> | 47 | /// <summary> |
48 | /// | 48 | /// |
49 | /// </summary> | 49 | /// </summary> |
50 | public struct ToolInfo | 50 | public struct ToolInfo |
51 | { | 51 | { |
52 | string name; | 52 | string name; |
53 | string guid; | 53 | string guid; |
54 | string fileExtension; | 54 | string fileExtension; |
55 | string xmlTag; | 55 | string xmlTag; |
56 | string importProject; | 56 | string importProject; |
57 | 57 | ||
58 | /// <summary> | 58 | /// <summary> |
59 | /// Gets or sets the name. | 59 | /// Gets or sets the name. |
60 | /// </summary> | 60 | /// </summary> |
61 | /// <value>The name.</value> | 61 | /// <value>The name.</value> |
62 | public string Name | 62 | public string Name |
63 | { | 63 | { |
64 | get | 64 | get |
65 | { | 65 | { |
66 | return name; | 66 | return name; |
67 | } | 67 | } |
68 | set | 68 | set |
69 | { | 69 | { |
70 | name = value; | 70 | name = value; |
71 | } | 71 | } |
72 | } | 72 | } |
73 | 73 | ||
74 | /// <summary> | 74 | /// <summary> |
75 | /// Gets or sets the GUID. | 75 | /// Gets or sets the GUID. |
76 | /// </summary> | 76 | /// </summary> |
77 | /// <value>The GUID.</value> | 77 | /// <value>The GUID.</value> |
78 | public string Guid | 78 | public string Guid |
79 | { | 79 | { |
80 | get | 80 | get |
81 | { | 81 | { |
82 | return guid; | 82 | return guid; |
83 | } | 83 | } |
84 | set | 84 | set |
85 | { | 85 | { |
86 | guid = value; | 86 | guid = value; |
87 | } | 87 | } |
88 | } | 88 | } |
89 | 89 | ||
90 | /// <summary> | 90 | /// <summary> |
91 | /// Gets or sets the file extension. | 91 | /// Gets or sets the file extension. |
92 | /// </summary> | 92 | /// </summary> |
93 | /// <value>The file extension.</value> | 93 | /// <value>The file extension.</value> |
94 | public string FileExtension | 94 | public string FileExtension |
95 | { | 95 | { |
96 | get | 96 | get |
97 | { | 97 | { |
98 | return fileExtension; | 98 | return fileExtension; |
99 | } | 99 | } |
100 | set | 100 | set |
101 | { | 101 | { |
102 | fileExtension = value; | 102 | fileExtension = value; |
103 | } | 103 | } |
104 | } | 104 | } |
105 | /// <summary> | 105 | /// <summary> |
106 | /// Gets or sets the XML tag. | 106 | /// Gets or sets the XML tag. |
107 | /// </summary> | 107 | /// </summary> |
108 | /// <value>The XML tag.</value> | 108 | /// <value>The XML tag.</value> |
109 | public string XmlTag | 109 | public string XmlTag |
110 | { | 110 | { |
111 | get | 111 | get |
112 | { | 112 | { |
113 | return xmlTag; | 113 | return xmlTag; |
114 | } | 114 | } |
115 | set | 115 | set |
116 | { | 116 | { |
117 | xmlTag = value; | 117 | xmlTag = value; |
118 | } | 118 | } |
119 | } | 119 | } |
120 | 120 | ||
121 | /// <summary> | 121 | /// <summary> |
122 | /// Gets or sets the import project property. | 122 | /// Gets or sets the import project property. |
123 | /// </summary> | 123 | /// </summary> |
124 | /// <value>The ImportProject tag.</value> | 124 | /// <value>The ImportProject tag.</value> |
125 | public string ImportProject | 125 | public string ImportProject |
126 | { | 126 | { |
127 | get | 127 | get |
128 | { | 128 | { |
129 | return importProject; | 129 | return importProject; |
130 | } | 130 | } |
131 | set | 131 | set |
132 | { | 132 | { |
133 | importProject = value; | 133 | importProject = value; |
134 | } | 134 | } |
135 | } | 135 | } |
136 | 136 | ||
137 | /// <summary> | 137 | /// <summary> |
138 | /// Initializes a new instance of the <see cref="ToolInfo"/> class. | 138 | /// Initializes a new instance of the <see cref="ToolInfo"/> class. |
139 | /// </summary> | 139 | /// </summary> |
140 | /// <param name="name">The name.</param> | 140 | /// <param name="name">The name.</param> |
141 | /// <param name="guid">The GUID.</param> | 141 | /// <param name="guid">The GUID.</param> |
142 | /// <param name="fileExtension">The file extension.</param> | 142 | /// <param name="fileExtension">The file extension.</param> |
143 | /// <param name="xml">The XML.</param> | 143 | /// <param name="xml">The XML.</param> |
144 | /// <param name="importProject">The import project.</param> | 144 | /// <param name="importProject">The import project.</param> |
145 | public ToolInfo(string name, string guid, string fileExtension, string xml, string importProject) | 145 | public ToolInfo(string name, string guid, string fileExtension, string xml, string importProject) |
146 | { | 146 | { |
147 | this.name = name; | 147 | this.name = name; |
148 | this.guid = guid; | 148 | this.guid = guid; |
149 | this.fileExtension = fileExtension; | 149 | this.fileExtension = fileExtension; |
150 | this.xmlTag = xml; | 150 | this.xmlTag = xml; |
151 | this.importProject = importProject; | 151 | this.importProject = importProject; |
152 | } | 152 | } |
153 | 153 | ||
154 | /// <summary> | 154 | /// <summary> |
155 | /// Initializes a new instance of the <see cref="ToolInfo"/> class. | 155 | /// Initializes a new instance of the <see cref="ToolInfo"/> class. |
156 | /// </summary> | 156 | /// </summary> |
157 | /// <param name="name">The name.</param> | 157 | /// <param name="name">The name.</param> |
158 | /// <param name="guid">The GUID.</param> | 158 | /// <param name="guid">The GUID.</param> |
159 | /// <param name="fileExtension">The file extension.</param> | 159 | /// <param name="fileExtension">The file extension.</param> |
160 | /// <param name="xml">The XML.</param> | 160 | /// <param name="xml">The XML.</param> |
161 | public ToolInfo(string name, string guid, string fileExtension, string xml) | 161 | public ToolInfo(string name, string guid, string fileExtension, string xml) |
162 | { | 162 | { |
163 | this.name = name; | 163 | this.name = name; |
164 | this.guid = guid; | 164 | this.guid = guid; |
165 | this.fileExtension = fileExtension; | 165 | this.fileExtension = fileExtension; |
166 | this.xmlTag = xml; | 166 | this.xmlTag = xml; |
167 | this.importProject = "$(MSBuildBinPath)\\Microsoft." + xml + ".Targets"; | 167 | this.importProject = "$(MSBuildBinPath)\\Microsoft." + xml + ".Targets"; |
168 | } | 168 | } |
169 | 169 | ||
170 | /// <summary> | 170 | /// <summary> |
171 | /// Equals operator | 171 | /// Equals operator |
172 | /// </summary> | 172 | /// </summary> |
173 | /// <param name="obj">ToolInfo to compare</param> | 173 | /// <param name="obj">ToolInfo to compare</param> |
174 | /// <returns>true if toolInfos are equal</returns> | 174 | /// <returns>true if toolInfos are equal</returns> |
175 | public override bool Equals(object obj) | 175 | public override bool Equals(object obj) |
176 | { | 176 | { |
177 | if (obj == null) | 177 | if (obj == null) |
178 | { | 178 | { |
179 | throw new ArgumentNullException("obj"); | 179 | throw new ArgumentNullException("obj"); |
180 | } | 180 | } |
181 | if (obj.GetType() != typeof(ToolInfo)) | 181 | if (obj.GetType() != typeof(ToolInfo)) |
182 | return false; | 182 | return false; |
183 | 183 | ||
184 | ToolInfo c = (ToolInfo)obj; | 184 | ToolInfo c = (ToolInfo)obj; |
185 | return ((this.name == c.name) && (this.guid == c.guid) && (this.fileExtension == c.fileExtension) && (this.importProject == c.importProject)); | 185 | return ((this.name == c.name) && (this.guid == c.guid) && (this.fileExtension == c.fileExtension) && (this.importProject == c.importProject)); |
186 | } | 186 | } |
187 | 187 | ||
188 | /// <summary> | 188 | /// <summary> |
189 | /// Equals operator | 189 | /// Equals operator |
190 | /// </summary> | 190 | /// </summary> |
191 | /// <param name="c1">ToolInfo to compare</param> | 191 | /// <param name="c1">ToolInfo to compare</param> |
192 | /// <param name="c2">ToolInfo to compare</param> | 192 | /// <param name="c2">ToolInfo to compare</param> |
193 | /// <returns>True if toolInfos are equal</returns> | 193 | /// <returns>True if toolInfos are equal</returns> |
194 | public static bool operator ==(ToolInfo c1, ToolInfo c2) | 194 | public static bool operator ==(ToolInfo c1, ToolInfo c2) |
195 | { | 195 | { |
196 | return ((c1.name == c2.name) && (c1.guid == c2.guid) && (c1.fileExtension == c2.fileExtension) && (c1.importProject == c2.importProject) && (c1.xmlTag == c2.xmlTag)); | 196 | return ((c1.name == c2.name) && (c1.guid == c2.guid) && (c1.fileExtension == c2.fileExtension) && (c1.importProject == c2.importProject) && (c1.xmlTag == c2.xmlTag)); |
197 | } | 197 | } |
198 | 198 | ||
199 | /// <summary> | 199 | /// <summary> |
200 | /// Not equals operator | 200 | /// Not equals operator |
201 | /// </summary> | 201 | /// </summary> |
202 | /// <param name="c1">ToolInfo to compare</param> | 202 | /// <param name="c1">ToolInfo to compare</param> |
203 | /// <param name="c2">ToolInfo to compare</param> | 203 | /// <param name="c2">ToolInfo to compare</param> |
204 | /// <returns>True if toolInfos are not equal</returns> | 204 | /// <returns>True if toolInfos are not equal</returns> |
205 | public static bool operator !=(ToolInfo c1, ToolInfo c2) | 205 | public static bool operator !=(ToolInfo c1, ToolInfo c2) |
206 | { | 206 | { |
207 | return !(c1 == c2); | 207 | return !(c1 == c2); |
208 | } | 208 | } |
209 | 209 | ||
210 | /// <summary> | 210 | /// <summary> |
211 | /// Hash Code | 211 | /// Hash Code |
212 | /// </summary> | 212 | /// </summary> |
213 | /// <returns>Hash code</returns> | 213 | /// <returns>Hash code</returns> |
214 | public override int GetHashCode() | 214 | public override int GetHashCode() |
215 | { | 215 | { |
216 | return name.GetHashCode() ^ guid.GetHashCode() ^ this.fileExtension.GetHashCode() ^ this.importProject.GetHashCode() ^ this.xmlTag.GetHashCode(); | 216 | return name.GetHashCode() ^ guid.GetHashCode() ^ this.fileExtension.GetHashCode() ^ this.importProject.GetHashCode() ^ this.xmlTag.GetHashCode(); |
217 | 217 | ||
218 | } | 218 | } |
219 | } | 219 | } |
220 | 220 | ||
221 | /// <summary> | 221 | /// <summary> |
222 | /// | 222 | /// |
223 | /// </summary> | 223 | /// </summary> |
224 | [Target("vs2005")] | 224 | [Target("vs2005")] |
225 | public class VS2005Target : ITarget | 225 | public class VS2005Target : ITarget |
226 | { | 226 | { |
227 | #region Inner Classes | 227 | #region Inner Classes |
228 | 228 | ||
229 | #endregion | 229 | #endregion |
230 | 230 | ||
231 | #region Fields | 231 | #region Fields |
232 | 232 | ||
233 | string solutionVersion = "9.00"; | 233 | string solutionVersion = "9.00"; |
234 | string productVersion = "8.0.50727"; | 234 | string productVersion = "8.0.50727"; |
235 | string schemaVersion = "2.0"; | 235 | string schemaVersion = "2.0"; |
236 | string versionName = "Visual C# 2005"; | 236 | string versionName = "Visual C# 2005"; |
237 | VSVersion version = VSVersion.VS80; | 237 | VSVersion version = VSVersion.VS80; |
238 | 238 | ||
239 | Hashtable tools; | 239 | Hashtable tools; |
240 | Kernel kernel; | 240 | Kernel kernel; |
241 | 241 | ||
242 | /// <summary> | 242 | /// <summary> |
243 | /// Gets or sets the solution version. | 243 | /// Gets or sets the solution version. |
244 | /// </summary> | 244 | /// </summary> |
245 | /// <value>The solution version.</value> | 245 | /// <value>The solution version.</value> |
246 | protected string SolutionVersion | 246 | protected string SolutionVersion |
247 | { | 247 | { |
248 | get | 248 | get |
249 | { | 249 | { |
250 | return this.solutionVersion; | 250 | return this.solutionVersion; |
251 | } | 251 | } |
252 | set | 252 | set |
253 | { | 253 | { |
254 | this.solutionVersion = value; | 254 | this.solutionVersion = value; |
255 | } | 255 | } |
256 | } | 256 | } |
257 | /// <summary> | 257 | /// <summary> |
258 | /// Gets or sets the product version. | 258 | /// Gets or sets the product version. |
259 | /// </summary> | 259 | /// </summary> |
260 | /// <value>The product version.</value> | 260 | /// <value>The product version.</value> |
261 | protected string ProductVersion | 261 | protected string ProductVersion |
262 | { | 262 | { |
263 | get | 263 | get |
264 | { | 264 | { |
265 | return this.productVersion; | 265 | return this.productVersion; |
266 | } | 266 | } |
267 | set | 267 | set |
268 | { | 268 | { |
269 | this.productVersion = value; | 269 | this.productVersion = value; |
270 | } | 270 | } |
271 | } | 271 | } |
272 | /// <summary> | 272 | /// <summary> |
273 | /// Gets or sets the schema version. | 273 | /// Gets or sets the schema version. |
274 | /// </summary> | 274 | /// </summary> |
275 | /// <value>The schema version.</value> | 275 | /// <value>The schema version.</value> |
276 | protected string SchemaVersion | 276 | protected string SchemaVersion |
277 | { | 277 | { |
278 | get | 278 | get |
279 | { | 279 | { |
280 | return this.schemaVersion; | 280 | return this.schemaVersion; |
281 | } | 281 | } |
282 | set | 282 | set |
283 | { | 283 | { |
284 | this.schemaVersion = value; | 284 | this.schemaVersion = value; |
285 | } | 285 | } |
286 | } | 286 | } |
287 | /// <summary> | 287 | /// <summary> |
288 | /// Gets or sets the name of the version. | 288 | /// Gets or sets the name of the version. |
289 | /// </summary> | 289 | /// </summary> |
290 | /// <value>The name of the version.</value> | 290 | /// <value>The name of the version.</value> |
291 | protected string VersionName | 291 | protected string VersionName |
292 | { | 292 | { |
293 | get | 293 | get |
294 | { | 294 | { |
295 | return this.versionName; | 295 | return this.versionName; |
296 | } | 296 | } |
297 | set | 297 | set |
298 | { | 298 | { |
299 | this.versionName = value; | 299 | this.versionName = value; |
300 | } | 300 | } |
301 | } | 301 | } |
302 | /// <summary> | 302 | /// <summary> |
303 | /// Gets or sets the version. | 303 | /// Gets or sets the version. |
304 | /// </summary> | 304 | /// </summary> |
305 | /// <value>The version.</value> | 305 | /// <value>The version.</value> |
306 | protected VSVersion Version | 306 | protected VSVersion Version |
307 | { | 307 | { |
308 | get | 308 | get |
309 | { | 309 | { |
310 | return this.version; | 310 | return this.version; |
311 | } | 311 | } |
312 | set | 312 | set |
313 | { | 313 | { |
314 | this.version = value; | 314 | this.version = value; |
315 | } | 315 | } |
316 | } | 316 | } |
317 | 317 | ||
318 | #endregion | 318 | #endregion |
319 | 319 | ||
320 | #region Constructors | 320 | #region Constructors |
321 | 321 | ||
322 | /// <summary> | 322 | /// <summary> |
323 | /// Initializes a new instance of the <see cref="VS2005Target"/> class. | 323 | /// Initializes a new instance of the <see cref="VS2005Target"/> class. |
324 | /// </summary> | 324 | /// </summary> |
325 | public VS2005Target() | 325 | public VS2005Target() |
326 | { | 326 | { |
327 | this.tools = new Hashtable(); | 327 | this.tools = new Hashtable(); |
328 | 328 | ||
329 | this.tools["C#"] = new ToolInfo("C#", "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}", "csproj", "CSHARP", "$(MSBuildBinPath)\\Microsoft.CSHARP.Targets"); | 329 | this.tools["C#"] = new ToolInfo("C#", "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}", "csproj", "CSHARP", "$(MSBuildBinPath)\\Microsoft.CSHARP.Targets"); |
330 | this.tools["Boo"] = new ToolInfo("Boo", "{45CEA7DC-C2ED-48A6-ACE0-E16144C02365}", "booproj", "Boo", "$(BooBinPath)\\Boo.Microsoft.Build.targets"); | 330 | this.tools["Boo"] = new ToolInfo("Boo", "{45CEA7DC-C2ED-48A6-ACE0-E16144C02365}", "booproj", "Boo", "$(BooBinPath)\\Boo.Microsoft.Build.targets"); |
331 | this.tools["VisualBasic"] = new ToolInfo("VisualBasic", "{F184B08F-C81C-45F6-A57F-5ABD9991F28F}", "vbproj", "VisualBasic", "$(MSBuildBinPath)\\Microsoft.VisualBasic.Targets"); | 331 | this.tools["VisualBasic"] = new ToolInfo("VisualBasic", "{F184B08F-C81C-45F6-A57F-5ABD9991F28F}", "vbproj", "VisualBasic", "$(MSBuildBinPath)\\Microsoft.VisualBasic.Targets"); |
332 | } | 332 | } |
333 | 333 | ||
334 | #endregion | 334 | #endregion |
335 | 335 | ||
336 | #region Private Methods | 336 | #region Private Methods |
337 | 337 | ||
338 | private string MakeRefPath(ProjectNode project) | 338 | private string MakeRefPath(ProjectNode project) |
339 | { | 339 | { |
340 | string ret = ""; | 340 | string ret = ""; |
341 | foreach (ReferencePathNode node in project.ReferencePaths) | 341 | foreach (ReferencePathNode node in project.ReferencePaths) |
342 | { | 342 | { |
343 | try | 343 | try |
344 | { | 344 | { |
345 | string fullPath = Helper.ResolvePath(node.Path); | 345 | string fullPath = Helper.ResolvePath(node.Path); |
346 | if (ret.Length < 1) | 346 | if (ret.Length < 1) |
347 | { | 347 | { |
348 | ret = fullPath; | 348 | ret = fullPath; |
349 | } | 349 | } |
350 | else | 350 | else |
351 | { | 351 | { |
352 | ret += ";" + fullPath; | 352 | ret += ";" + fullPath; |
353 | } | 353 | } |
354 | } | 354 | } |
355 | catch (ArgumentException) | 355 | catch (ArgumentException) |
356 | { | 356 | { |
357 | this.kernel.Log.Write(LogType.Warning, "Could not resolve reference path: {0}", node.Path); | 357 | this.kernel.Log.Write(LogType.Warning, "Could not resolve reference path: {0}", node.Path); |
358 | } | 358 | } |
359 | } | 359 | } |
360 | 360 | ||
361 | return ret; | 361 | return ret; |
362 | } | 362 | } |
363 | 363 | ||
364 | private void WriteProject(SolutionNode solution, ProjectNode project) | 364 | private void WriteProject(SolutionNode solution, ProjectNode project) |
365 | { | 365 | { |
366 | if (!tools.ContainsKey(project.Language)) | 366 | if (!tools.ContainsKey(project.Language)) |
367 | { | 367 | { |
368 | throw new UnknownLanguageException("Unknown .NET language: " + project.Language); | 368 | throw new UnknownLanguageException("Unknown .NET language: " + project.Language); |
369 | } | 369 | } |
370 | 370 | ||
371 | ToolInfo toolInfo = (ToolInfo)tools[project.Language]; | 371 | ToolInfo toolInfo = (ToolInfo)tools[project.Language]; |
372 | string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, toolInfo.FileExtension); | 372 | string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, toolInfo.FileExtension); |
373 | StreamWriter ps = new StreamWriter(projectFile); | 373 | StreamWriter ps = new StreamWriter(projectFile); |
374 | 374 | ||
375 | kernel.CurrentWorkingDirectory.Push(); | 375 | kernel.CurrentWorkingDirectory.Push(); |
376 | Helper.SetCurrentDir(Path.GetDirectoryName(projectFile)); | 376 | Helper.SetCurrentDir(Path.GetDirectoryName(projectFile)); |
377 | 377 | ||
378 | #region Project File | 378 | #region Project File |
379 | using (ps) | 379 | using (ps) |
380 | { | 380 | { |
381 | ps.WriteLine("<Project DefaultTargets=\"Build\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">"); | 381 | ps.WriteLine("<Project DefaultTargets=\"Build\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">"); |
382 | //ps.WriteLine(" <{0}", toolInfo.XMLTag); | 382 | //ps.WriteLine(" <{0}", toolInfo.XMLTag); |
383 | ps.WriteLine(" <PropertyGroup>"); | 383 | ps.WriteLine(" <PropertyGroup>"); |
384 | ps.WriteLine(" <ProjectType>Local</ProjectType>"); | 384 | ps.WriteLine(" <ProjectType>Local</ProjectType>"); |
385 | ps.WriteLine(" <ProductVersion>{0}</ProductVersion>", this.ProductVersion); | 385 | ps.WriteLine(" <ProductVersion>{0}</ProductVersion>", this.ProductVersion); |
386 | ps.WriteLine(" <SchemaVersion>{0}</SchemaVersion>", this.SchemaVersion); | 386 | ps.WriteLine(" <SchemaVersion>{0}</SchemaVersion>", this.SchemaVersion); |
387 | ps.WriteLine(" <ProjectGuid>{{{0}}}</ProjectGuid>", project.Guid.ToString().ToUpper()); | 387 | ps.WriteLine(" <ProjectGuid>{{{0}}}</ProjectGuid>", project.Guid.ToString().ToUpper()); |
388 | 388 | ||
389 | ps.WriteLine(" <Configuration Condition=\" '$(Configuration)' == '' \">Debug</Configuration>"); | 389 | ps.WriteLine(" <Configuration Condition=\" '$(Configuration)' == '' \">Debug</Configuration>"); |
390 | ps.WriteLine(" <Platform Condition=\" '$(Platform)' == '' \">AnyCPU</Platform>"); | 390 | ps.WriteLine(" <Platform Condition=\" '$(Platform)' == '' \">AnyCPU</Platform>"); |
391 | //ps.WriteLine(" <Build>"); | 391 | //ps.WriteLine(" <Build>"); |
392 | 392 | ||
393 | //ps.WriteLine(" <Settings"); | 393 | //ps.WriteLine(" <Settings"); |
394 | ps.WriteLine(" <ApplicationIcon>{0}</ApplicationIcon>", project.AppIcon); | 394 | ps.WriteLine(" <ApplicationIcon>{0}</ApplicationIcon>", project.AppIcon); |
395 | ps.WriteLine(" <AssemblyKeyContainerName>"); | 395 | ps.WriteLine(" <AssemblyKeyContainerName>"); |
396 | ps.WriteLine(" </AssemblyKeyContainerName>"); | 396 | ps.WriteLine(" </AssemblyKeyContainerName>"); |
397 | ps.WriteLine(" <AssemblyName>{0}</AssemblyName>", project.AssemblyName); | 397 | ps.WriteLine(" <AssemblyName>{0}</AssemblyName>", project.AssemblyName); |
398 | foreach (ConfigurationNode conf in project.Configurations) | 398 | foreach (ConfigurationNode conf in project.Configurations) |
399 | { | 399 | { |
400 | if (conf.Options.KeyFile != "") | 400 | if (conf.Options.KeyFile != "") |
401 | { | 401 | { |
402 | ps.WriteLine(" <AssemblyOriginatorKeyFile>{0}</AssemblyOriginatorKeyFile>", conf.Options.KeyFile); | 402 | ps.WriteLine(" <AssemblyOriginatorKeyFile>{0}</AssemblyOriginatorKeyFile>", conf.Options.KeyFile); |
403 | ps.WriteLine(" <SignAssembly>true</SignAssembly>"); | 403 | ps.WriteLine(" <SignAssembly>true</SignAssembly>"); |
404 | break; | 404 | break; |
405 | } | 405 | } |
406 | } | 406 | } |
407 | ps.WriteLine(" <DefaultClientScript>JScript</DefaultClientScript>"); | 407 | ps.WriteLine(" <DefaultClientScript>JScript</DefaultClientScript>"); |
408 | ps.WriteLine(" <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>"); | 408 | ps.WriteLine(" <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>"); |
409 | ps.WriteLine(" <DefaultTargetSchema>IE50</DefaultTargetSchema>"); | 409 | ps.WriteLine(" <DefaultTargetSchema>IE50</DefaultTargetSchema>"); |
410 | ps.WriteLine(" <DelaySign>false</DelaySign>"); | 410 | ps.WriteLine(" <DelaySign>false</DelaySign>"); |
411 | 411 | ||
412 | //if(m_Version == VSVersion.VS70) | 412 | //if(m_Version == VSVersion.VS70) |
413 | // ps.WriteLine(" NoStandardLibraries = \"false\""); | 413 | // ps.WriteLine(" NoStandardLibraries = \"false\""); |
414 | 414 | ||
415 | ps.WriteLine(" <OutputType>{0}</OutputType>", project.Type.ToString()); | 415 | ps.WriteLine(" <OutputType>{0}</OutputType>", project.Type.ToString()); |
416 | ps.WriteLine(" <AppDesignerFolder>{0}</AppDesignerFolder>", project.DesignerFolder); | 416 | ps.WriteLine(" <AppDesignerFolder>{0}</AppDesignerFolder>", project.DesignerFolder); |
417 | ps.WriteLine(" <RootNamespace>{0}</RootNamespace>", project.RootNamespace); | 417 | ps.WriteLine(" <RootNamespace>{0}</RootNamespace>", project.RootNamespace); |
418 | ps.WriteLine(" <StartupObject>{0}</StartupObject>", project.StartupObject); | 418 | ps.WriteLine(" <StartupObject>{0}</StartupObject>", project.StartupObject); |
419 | //ps.WriteLine(" >"); | 419 | //ps.WriteLine(" >"); |
420 | ps.WriteLine(" <FileUpgradeFlags>"); | 420 | ps.WriteLine(" <FileUpgradeFlags>"); |
421 | ps.WriteLine(" </FileUpgradeFlags>"); | 421 | ps.WriteLine(" </FileUpgradeFlags>"); |
422 | 422 | ||
423 | ps.WriteLine(" </PropertyGroup>"); | 423 | ps.WriteLine(" </PropertyGroup>"); |
424 | 424 | ||
425 | foreach (ConfigurationNode conf in project.Configurations) | 425 | foreach (ConfigurationNode conf in project.Configurations) |
426 | { | 426 | { |
427 | ps.Write(" <PropertyGroup "); | 427 | ps.Write(" <PropertyGroup "); |
428 | ps.WriteLine("Condition=\" '$(Configuration)|$(Platform)' == '{0}|AnyCPU' \">", conf.Name); | 428 | ps.WriteLine("Condition=\" '$(Configuration)|$(Platform)' == '{0}|AnyCPU' \">", conf.Name); |
429 | ps.WriteLine(" <AllowUnsafeBlocks>{0}</AllowUnsafeBlocks>", conf.Options["AllowUnsafe"]); | 429 | ps.WriteLine(" <AllowUnsafeBlocks>{0}</AllowUnsafeBlocks>", conf.Options["AllowUnsafe"]); |
430 | ps.WriteLine(" <BaseAddress>{0}</BaseAddress>", conf.Options["BaseAddress"]); | 430 | ps.WriteLine(" <BaseAddress>{0}</BaseAddress>", conf.Options["BaseAddress"]); |
431 | ps.WriteLine(" <CheckForOverflowUnderflow>{0}</CheckForOverflowUnderflow>", conf.Options["CheckUnderflowOverflow"]); | 431 | ps.WriteLine(" <CheckForOverflowUnderflow>{0}</CheckForOverflowUnderflow>", conf.Options["CheckUnderflowOverflow"]); |
432 | ps.WriteLine(" <ConfigurationOverrideFile>"); | 432 | ps.WriteLine(" <ConfigurationOverrideFile>"); |
433 | ps.WriteLine(" </ConfigurationOverrideFile>"); | 433 | ps.WriteLine(" </ConfigurationOverrideFile>"); |
434 | ps.WriteLine(" <DefineConstants>{0}</DefineConstants>", conf.Options["CompilerDefines"]); | 434 | ps.WriteLine(" <DefineConstants>{0}</DefineConstants>", conf.Options["CompilerDefines"]); |
435 | ps.WriteLine(" <DocumentationFile>{0}</DocumentationFile>", conf.Options["XmlDocFile"]); | 435 | ps.WriteLine(" <DocumentationFile>{0}</DocumentationFile>", conf.Options["XmlDocFile"]); |
436 | ps.WriteLine(" <DebugSymbols>{0}</DebugSymbols>", conf.Options["DebugInformation"]); | 436 | ps.WriteLine(" <DebugSymbols>{0}</DebugSymbols>", conf.Options["DebugInformation"]); |
437 | ps.WriteLine(" <FileAlignment>{0}</FileAlignment>", conf.Options["FileAlignment"]); | 437 | ps.WriteLine(" <FileAlignment>{0}</FileAlignment>", conf.Options["FileAlignment"]); |
438 | // ps.WriteLine(" <IncrementalBuild = \"{0}\"", conf.Options["IncrementalBuild"]); | 438 | // ps.WriteLine(" <IncrementalBuild = \"{0}\"", conf.Options["IncrementalBuild"]); |
439 | 439 | ||
440 | // if(m_Version == VSVersion.VS71) | 440 | // if(m_Version == VSVersion.VS71) |
441 | // { | 441 | // { |
442 | // ps.WriteLine(" NoStdLib = \"{0}\"", conf.Options["NoStdLib"]); | 442 | // ps.WriteLine(" NoStdLib = \"{0}\"", conf.Options["NoStdLib"]); |
443 | // ps.WriteLine(" NoWarn = \"{0}\"", conf.Options["SuppressWarnings"]); | 443 | // ps.WriteLine(" NoWarn = \"{0}\"", conf.Options["SuppressWarnings"]); |
444 | // } | 444 | // } |
445 | 445 | ||
446 | ps.WriteLine(" <Optimize>{0}</Optimize>", conf.Options["OptimizeCode"]); | 446 | ps.WriteLine(" <Optimize>{0}</Optimize>", conf.Options["OptimizeCode"]); |
447 | ps.WriteLine(" <OutputPath>{0}</OutputPath>", | 447 | ps.WriteLine(" <OutputPath>{0}</OutputPath>", |
448 | Helper.EndPath(Helper.NormalizePath(conf.Options["OutputPath"].ToString()))); | 448 | Helper.EndPath(Helper.NormalizePath(conf.Options["OutputPath"].ToString()))); |
449 | ps.WriteLine(" <RegisterForComInterop>{0}</RegisterForComInterop>", conf.Options["RegisterComInterop"]); | 449 | ps.WriteLine(" <RegisterForComInterop>{0}</RegisterForComInterop>", conf.Options["RegisterComInterop"]); |
450 | ps.WriteLine(" <RemoveIntegerChecks>{0}</RemoveIntegerChecks>", conf.Options["RemoveIntegerChecks"]); | 450 | ps.WriteLine(" <RemoveIntegerChecks>{0}</RemoveIntegerChecks>", conf.Options["RemoveIntegerChecks"]); |
451 | ps.WriteLine(" <TreatWarningsAsErrors>{0}</TreatWarningsAsErrors>", conf.Options["WarningsAsErrors"]); | 451 | ps.WriteLine(" <TreatWarningsAsErrors>{0}</TreatWarningsAsErrors>", conf.Options["WarningsAsErrors"]); |
452 | ps.WriteLine(" <WarningLevel>{0}</WarningLevel>", conf.Options["WarningLevel"]); | 452 | ps.WriteLine(" <WarningLevel>{0}</WarningLevel>", conf.Options["WarningLevel"]); |
453 | ps.WriteLine(" <NoWarn>{0}</NoWarn>", conf.Options["SuppressWarnings"]); | 453 | ps.WriteLine(" <NoWarn>{0}</NoWarn>", conf.Options["SuppressWarnings"]); |
454 | ps.WriteLine(" </PropertyGroup>"); | 454 | ps.WriteLine(" </PropertyGroup>"); |
455 | } | 455 | } |
456 | 456 | ||
457 | //ps.WriteLine(" </Settings>"); | 457 | //ps.WriteLine(" </Settings>"); |
458 | 458 | ||
459 | // Assembly References | 459 | // Assembly References |
460 | ps.WriteLine(" <ItemGroup>"); | 460 | ps.WriteLine(" <ItemGroup>"); |
461 | string refPath = ((ReferencePathNode) project.ReferencePaths[0]).Path; | 461 | string refPath = ((ReferencePathNode) project.ReferencePaths[0]).Path; |
462 | 462 | ||
463 | foreach (ReferenceNode refr in project.References) | 463 | foreach (ReferenceNode refr in project.References) |
464 | { | 464 | { |
465 | if (!solution.ProjectsTable.ContainsKey(refr.Name)) | 465 | if (!solution.ProjectsTable.ContainsKey(refr.Name)) |
466 | { | 466 | { |
467 | ps.Write(" <Reference"); | 467 | ps.Write(" <Reference"); |
468 | ps.Write(" Include=\""); | 468 | ps.Write(" Include=\""); |
469 | ps.Write(refr.Name); | 469 | ps.Write(refr.Name); |
470 | 470 | ||
471 | ps.WriteLine("\" >"); | 471 | ps.WriteLine("\" >"); |
472 | 472 | ||
473 | string path; | 473 | string path; |
474 | 474 | ||
475 | if( refr.Name.EndsWith(".dll", StringComparison.InvariantCultureIgnoreCase )) | 475 | if( refr.Name.EndsWith(".dll", StringComparison.InvariantCultureIgnoreCase )) |
476 | { | 476 | { |
477 | path = Helper.NormalizePath(Path.Combine( refPath, refr.Name), '\\'); | 477 | path = Helper.NormalizePath(Path.Combine( refPath, refr.Name), '\\'); |
478 | } | 478 | } |
479 | else | 479 | else |
480 | { | 480 | { |
481 | path = refr.Name + ".dll"; | 481 | path = refr.Name + ".dll"; |
482 | } | 482 | } |
483 | 483 | ||
484 | // TODO: Allow reference to *.exe files | 484 | // TODO: Allow reference to *.exe files |
485 | ps.WriteLine(" <HintPath>{0}</HintPath>", path ); | 485 | ps.WriteLine(" <HintPath>{0}</HintPath>", path ); |
486 | ps.WriteLine(" <Private>{0}</Private>", refr.LocalCopy); | 486 | ps.WriteLine(" <Private>{0}</Private>", refr.LocalCopy); |
487 | ps.WriteLine(" </Reference>"); | 487 | ps.WriteLine(" </Reference>"); |
488 | } | 488 | } |
489 | } | 489 | } |
490 | ps.WriteLine(" </ItemGroup>"); | 490 | ps.WriteLine(" </ItemGroup>"); |
491 | 491 | ||
492 | //Project References | 492 | //Project References |
493 | ps.WriteLine(" <ItemGroup>"); | 493 | ps.WriteLine(" <ItemGroup>"); |
494 | foreach (ReferenceNode refr in project.References) | 494 | foreach (ReferenceNode refr in project.References) |
495 | { | 495 | { |
496 | if (solution.ProjectsTable.ContainsKey(refr.Name)) | 496 | if (solution.ProjectsTable.ContainsKey(refr.Name)) |
497 | { | 497 | { |
498 | ProjectNode refProject = (ProjectNode)solution.ProjectsTable[refr.Name]; | 498 | ProjectNode refProject = (ProjectNode)solution.ProjectsTable[refr.Name]; |
499 | // TODO: Allow reference to visual basic projects | 499 | // TODO: Allow reference to visual basic projects |
500 | string path = | 500 | string path = |
501 | Helper.MakePathRelativeTo(project.FullPath, | 501 | Helper.MakePathRelativeTo(project.FullPath, |
502 | Helper.MakeFilePath(refProject.FullPath, refProject.Name, "csproj")); | 502 | Helper.MakeFilePath(refProject.FullPath, refProject.Name, "csproj")); |
503 | ps.WriteLine(" <ProjectReference Include=\"{0}\">", path ); | 503 | ps.WriteLine(" <ProjectReference Include=\"{0}\">", path ); |
504 | //<ProjectReference Include="..\..\RealmForge\Utility\RealmForge.Utility.csproj"> | 504 | //<ProjectReference Include="..\..\RealmForge\Utility\RealmForge.Utility.csproj"> |
505 | ps.WriteLine(" <Name>{0}</Name>", refProject.Name); | 505 | ps.WriteLine(" <Name>{0}</Name>", refProject.Name); |
506 | // <Name>RealmForge.Utility</Name> | 506 | // <Name>RealmForge.Utility</Name> |
507 | ps.WriteLine(" <Project>{{{0}}}</Project>", refProject.Guid.ToString().ToUpper()); | 507 | ps.WriteLine(" <Project>{{{0}}}</Project>", refProject.Guid.ToString().ToUpper()); |
508 | // <Project>{6880D1D3-69EE-461B-B841-5319845B20D3}</Project> | 508 | // <Project>{6880D1D3-69EE-461B-B841-5319845B20D3}</Project> |
509 | ps.WriteLine(" <Package>{0}</Package>", toolInfo.Guid.ToString().ToUpper()); | 509 | ps.WriteLine(" <Package>{0}</Package>", toolInfo.Guid.ToString().ToUpper()); |
510 | // <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> | 510 | // <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> |
511 | ps.WriteLine("\t\t\t<Private>{0}</Private>", refr.LocalCopy); | 511 | ps.WriteLine("\t\t\t<Private>{0}</Private>", refr.LocalCopy); |
512 | ps.WriteLine(" </ProjectReference>"); | 512 | ps.WriteLine(" </ProjectReference>"); |
513 | //</ProjectReference> | 513 | //</ProjectReference> |
514 | } | 514 | } |
515 | else | 515 | else |
516 | { | 516 | { |
517 | } | 517 | } |
518 | } | 518 | } |
519 | ps.WriteLine(" </ItemGroup>"); | 519 | ps.WriteLine(" </ItemGroup>"); |
520 | 520 | ||
521 | // ps.WriteLine(" </Build>"); | 521 | // ps.WriteLine(" </Build>"); |
522 | ps.WriteLine(" <ItemGroup>"); | 522 | ps.WriteLine(" <ItemGroup>"); |
523 | 523 | ||
524 | // ps.WriteLine(" <Include>"); | 524 | // ps.WriteLine(" <Include>"); |
525 | ArrayList list = new ArrayList(); | 525 | ArrayList list = new ArrayList(); |
526 | foreach (string file in project.Files) | 526 | foreach (string file in project.Files) |
527 | { | 527 | { |
528 | // if (file == "Properties\\Bind.Designer.cs") | 528 | // if (file == "Properties\\Bind.Designer.cs") |
529 | // { | 529 | // { |
530 | // Console.WriteLine("Wait a minute!"); | 530 | // Console.WriteLine("Wait a minute!"); |
531 | // Console.WriteLine(project.Files.GetSubType(file).ToString()); | 531 | // Console.WriteLine(project.Files.GetSubType(file).ToString()); |
532 | // } | 532 | // } |
533 | 533 | ||
534 | if (project.Files.GetSubType(file) != SubType.Code && project.Files.GetSubType(file) != SubType.Settings && project.Files.GetSubType(file) != SubType.Designer) | 534 | if (project.Files.GetSubType(file) != SubType.Code && project.Files.GetSubType(file) != SubType.Settings && project.Files.GetSubType(file) != SubType.Designer) |
535 | { | 535 | { |
536 | ps.WriteLine(" <EmbeddedResource Include=\"{0}\">", file.Substring(0, file.LastIndexOf('.')) + ".resx"); | 536 | ps.WriteLine(" <EmbeddedResource Include=\"{0}\">", file.Substring(0, file.LastIndexOf('.')) + ".resx"); |
537 | 537 | ||
538 | int slash = file.LastIndexOf('\\'); | 538 | int slash = file.LastIndexOf('\\'); |
539 | if (slash == -1) | 539 | if (slash == -1) |
540 | { | 540 | { |
541 | ps.WriteLine(" <DependentUpon>{0}</DependentUpon>", file); | 541 | ps.WriteLine(" <DependentUpon>{0}</DependentUpon>", file); |
542 | } | 542 | } |
543 | else | 543 | else |
544 | { | 544 | { |
545 | ps.WriteLine(" <DependentUpon>{0}</DependentUpon>", file.Substring(slash + 1, file.Length - slash - 1)); | 545 | ps.WriteLine(" <DependentUpon>{0}</DependentUpon>", file.Substring(slash + 1, file.Length - slash - 1)); |
546 | } | 546 | } |
547 | ps.WriteLine(" <SubType>Designer</SubType>"); | 547 | ps.WriteLine(" <SubType>Designer</SubType>"); |
548 | ps.WriteLine(" </EmbeddedResource>"); | 548 | ps.WriteLine(" </EmbeddedResource>"); |
549 | // | 549 | // |
550 | } | 550 | } |
551 | 551 | ||
552 | if (project.Files.GetSubType(file) != SubType.Code && project.Files.GetSubType(file) == SubType.Designer) | 552 | if (project.Files.GetSubType(file) != SubType.Code && project.Files.GetSubType(file) == SubType.Designer) |
553 | { | 553 | { |
554 | ps.WriteLine(" <EmbeddedResource Include=\"{0}\">", file.Substring(0, file.LastIndexOf('.')) + ".resx"); | 554 | ps.WriteLine(" <EmbeddedResource Include=\"{0}\">", file.Substring(0, file.LastIndexOf('.')) + ".resx"); |
555 | ps.WriteLine(" <SubType>" + project.Files.GetSubType(file) + "</SubType>"); | 555 | ps.WriteLine(" <SubType>" + project.Files.GetSubType(file) + "</SubType>"); |
556 | ps.WriteLine(" <Generator>ResXFileCodeGenerator</Generator>"); | 556 | ps.WriteLine(" <Generator>ResXFileCodeGenerator</Generator>"); |
557 | ps.WriteLine(" <LastGenOutput>Resources.Designer.cs</LastGenOutput>"); | 557 | ps.WriteLine(" <LastGenOutput>Resources.Designer.cs</LastGenOutput>"); |
558 | ps.WriteLine(" </EmbeddedResource>"); | 558 | ps.WriteLine(" </EmbeddedResource>"); |
559 | ps.WriteLine(" <Compile Include=\"{0}\">", file.Substring(0, file.LastIndexOf('.')) + ".Designer.cs"); | 559 | ps.WriteLine(" <Compile Include=\"{0}\">", file.Substring(0, file.LastIndexOf('.')) + ".Designer.cs"); |
560 | ps.WriteLine(" <AutoGen>True</AutoGen>"); | 560 | ps.WriteLine(" <AutoGen>True</AutoGen>"); |
561 | ps.WriteLine(" <DesignTime>True</DesignTime>"); | 561 | ps.WriteLine(" <DesignTime>True</DesignTime>"); |
562 | ps.WriteLine(" <DependentUpon>Resources.resx</DependentUpon>"); | 562 | ps.WriteLine(" <DependentUpon>Resources.resx</DependentUpon>"); |
563 | ps.WriteLine(" </Compile>"); | 563 | ps.WriteLine(" </Compile>"); |
564 | list.Add(file.Substring(0, file.LastIndexOf('.')) + ".Designer.cs"); | 564 | list.Add(file.Substring(0, file.LastIndexOf('.')) + ".Designer.cs"); |
565 | } | 565 | } |
566 | if (project.Files.GetSubType(file).ToString() == "Settings") | 566 | if (project.Files.GetSubType(file).ToString() == "Settings") |
567 | { | 567 | { |
568 | //Console.WriteLine("File: " + file); | 568 | //Console.WriteLine("File: " + file); |
569 | //Console.WriteLine("Last index: " + file.LastIndexOf('.')); | 569 | //Console.WriteLine("Last index: " + file.LastIndexOf('.')); |
570 | //Console.WriteLine("Length: " + file.Length); | 570 | //Console.WriteLine("Length: " + file.Length); |
571 | ps.Write(" <{0} ", project.Files.GetBuildAction(file)); | 571 | ps.Write(" <{0} ", project.Files.GetBuildAction(file)); |
572 | ps.WriteLine("Include=\"{0}\">", file); | 572 | ps.WriteLine("Include=\"{0}\">", file); |
573 | int slash = file.LastIndexOf('\\'); | 573 | int slash = file.LastIndexOf('\\'); |
574 | string fileName = file.Substring(slash + 1, file.Length - slash - 1); | 574 | string fileName = file.Substring(slash + 1, file.Length - slash - 1); |
575 | if (project.Files.GetBuildAction(file) == BuildAction.None) | 575 | if (project.Files.GetBuildAction(file) == BuildAction.None) |
576 | { | 576 | { |
577 | ps.WriteLine(" <Generator>SettingsSingleFileGenerator</Generator>"); | 577 | ps.WriteLine(" <Generator>SettingsSingleFileGenerator</Generator>"); |
578 | 578 | ||
579 | //Console.WriteLine("FileName: " + fileName); | 579 | //Console.WriteLine("FileName: " + fileName); |
580 | //Console.WriteLine("FileNameMain: " + fileName.Substring(0, fileName.LastIndexOf('.'))); | 580 | //Console.WriteLine("FileNameMain: " + fileName.Substring(0, fileName.LastIndexOf('.'))); |
581 | //Console.WriteLine("FileNameExt: " + fileName.Substring(fileName.LastIndexOf('.'), fileName.Length - fileName.LastIndexOf('.'))); | 581 | //Console.WriteLine("FileNameExt: " + fileName.Substring(fileName.LastIndexOf('.'), fileName.Length - fileName.LastIndexOf('.'))); |
582 | if (slash == -1) | 582 | if (slash == -1) |
583 | { | 583 | { |
584 | ps.WriteLine(" <LastGenOutput>{0}</LastGenOutput>", fileName.Substring(0, fileName.LastIndexOf('.')) + ".Designer.cs"); | 584 | ps.WriteLine(" <LastGenOutput>{0}</LastGenOutput>", fileName.Substring(0, fileName.LastIndexOf('.')) + ".Designer.cs"); |
585 | } | 585 | } |
586 | else | 586 | else |
587 | { | 587 | { |
588 | ps.WriteLine(" <LastGenOutput>{0}</LastGenOutput>", fileName.Substring(0, fileName.LastIndexOf('.')) + ".Designer.cs"); | 588 | ps.WriteLine(" <LastGenOutput>{0}</LastGenOutput>", fileName.Substring(0, fileName.LastIndexOf('.')) + ".Designer.cs"); |
589 | } | 589 | } |
590 | } | 590 | } |
591 | else | 591 | else |
592 | { | 592 | { |
593 | ps.WriteLine(" <SubType>Code</SubType>"); | 593 | ps.WriteLine(" <SubType>Code</SubType>"); |
594 | ps.WriteLine(" <AutoGen>True</AutoGen>"); | 594 | ps.WriteLine(" <AutoGen>True</AutoGen>"); |
595 | ps.WriteLine(" <DesignTimeSharedInput>True</DesignTimeSharedInput>"); | 595 | ps.WriteLine(" <DesignTimeSharedInput>True</DesignTimeSharedInput>"); |
596 | string fileNameShort = fileName.Substring(0, fileName.LastIndexOf('.')); | 596 | string fileNameShort = fileName.Substring(0, fileName.LastIndexOf('.')); |
597 | string fileNameShorter = fileNameShort.Substring(0, fileNameShort.LastIndexOf('.')); | 597 | string fileNameShorter = fileNameShort.Substring(0, fileNameShort.LastIndexOf('.')); |
598 | ps.WriteLine(" <DependentUpon>{0}</DependentUpon>", fileNameShorter + ".settings"); | 598 | ps.WriteLine(" <DependentUpon>{0}</DependentUpon>", fileNameShorter + ".settings"); |
599 | } | 599 | } |
600 | ps.WriteLine(" </{0}>", project.Files.GetBuildAction(file)); | 600 | ps.WriteLine(" </{0}>", project.Files.GetBuildAction(file)); |
601 | } | 601 | } |
602 | else if (project.Files.GetSubType(file) != SubType.Designer) | 602 | else if (project.Files.GetSubType(file) != SubType.Designer) |
603 | { | 603 | { |
604 | if (!list.Contains(file)) | 604 | if (!list.Contains(file)) |
605 | { | 605 | { |
606 | ps.Write(" <{0} ", project.Files.GetBuildAction(file)); | 606 | ps.Write(" <{0} ", project.Files.GetBuildAction(file)); |
607 | ps.WriteLine("Include=\"{0}\">", file); | 607 | ps.WriteLine("Include=\"{0}\">", file); |
608 | 608 | ||
609 | 609 | ||
610 | if (file.Contains("Designer.cs")) | 610 | if (file.Contains("Designer.cs")) |
611 | { | 611 | { |
612 | ps.WriteLine(" <DependentUpon>{0}</DependentUpon>", file.Substring(0, file.IndexOf(".Designer.cs")) + ".cs"); | 612 | ps.WriteLine(" <DependentUpon>{0}</DependentUpon>", file.Substring(0, file.IndexOf(".Designer.cs")) + ".cs"); |
613 | } | 613 | } |
614 | 614 | ||
615 | if (project.Files.GetIsLink(file)) | 615 | if (project.Files.GetIsLink(file)) |
616 | { | 616 | { |
617 | ps.WriteLine(" <Link>{0}</Link>", Path.GetFileName(file)); | 617 | ps.WriteLine(" <Link>{0}</Link>", Path.GetFileName(file)); |
618 | } | 618 | } |
619 | else if (project.Files.GetBuildAction(file) != BuildAction.None) | 619 | else if (project.Files.GetBuildAction(file) != BuildAction.None) |
620 | { | 620 | { |
621 | if (project.Files.GetBuildAction(file) != BuildAction.EmbeddedResource) | 621 | if (project.Files.GetBuildAction(file) != BuildAction.EmbeddedResource) |
622 | { | 622 | { |
623 | ps.WriteLine(" <SubType>{0}</SubType>", project.Files.GetSubType(file)); | 623 | ps.WriteLine(" <SubType>{0}</SubType>", project.Files.GetSubType(file)); |
624 | } | 624 | } |
625 | } | 625 | } |
626 | if (project.Files.GetCopyToOutput(file) != CopyToOutput.Never) | 626 | if (project.Files.GetCopyToOutput(file) != CopyToOutput.Never) |
627 | { | 627 | { |
628 | ps.WriteLine(" <CopyToOutputDirectory>{0}</CopyToOutputDirectory>", project.Files.GetCopyToOutput(file)); | 628 | ps.WriteLine(" <CopyToOutputDirectory>{0}</CopyToOutputDirectory>", project.Files.GetCopyToOutput(file)); |
629 | } | 629 | } |
630 | 630 | ||
631 | ps.WriteLine(" </{0}>", project.Files.GetBuildAction(file)); | 631 | ps.WriteLine(" </{0}>", project.Files.GetBuildAction(file)); |
632 | } | 632 | } |
633 | } | 633 | } |
634 | } | 634 | } |
635 | // ps.WriteLine(" </Include>"); | 635 | // ps.WriteLine(" </Include>"); |
636 | 636 | ||
637 | ps.WriteLine(" </ItemGroup>"); | 637 | ps.WriteLine(" </ItemGroup>"); |
638 | ps.WriteLine(" <Import Project=\"" + toolInfo.ImportProject + "\" />"); | 638 | ps.WriteLine(" <Import Project=\"" + toolInfo.ImportProject + "\" />"); |
639 | ps.WriteLine(" <PropertyGroup>"); | 639 | ps.WriteLine(" <PropertyGroup>"); |
640 | ps.WriteLine(" <PreBuildEvent>"); | 640 | ps.WriteLine(" <PreBuildEvent>"); |
641 | ps.WriteLine(" </PreBuildEvent>"); | 641 | ps.WriteLine(" </PreBuildEvent>"); |
642 | ps.WriteLine(" <PostBuildEvent>"); | 642 | ps.WriteLine(" <PostBuildEvent>"); |
643 | ps.WriteLine(" </PostBuildEvent>"); | 643 | ps.WriteLine(" </PostBuildEvent>"); |
644 | ps.WriteLine(" </PropertyGroup>"); | 644 | ps.WriteLine(" </PropertyGroup>"); |
645 | // ps.WriteLine(" </{0}>", toolInfo.XMLTag); | 645 | // ps.WriteLine(" </{0}>", toolInfo.XMLTag); |
646 | ps.WriteLine("</Project>"); | 646 | ps.WriteLine("</Project>"); |
647 | } | 647 | } |
648 | #endregion | 648 | #endregion |
649 | 649 | ||
650 | #region User File | 650 | #region User File |
651 | 651 | ||
652 | ps = new StreamWriter(projectFile + ".user"); | 652 | ps = new StreamWriter(projectFile + ".user"); |
653 | using (ps) | 653 | using (ps) |
654 | { | 654 | { |
655 | ps.WriteLine("<Project xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">"); | 655 | ps.WriteLine("<Project xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">"); |
656 | //ps.WriteLine( "<VisualStudioProject>" ); | 656 | //ps.WriteLine( "<VisualStudioProject>" ); |
657 | //ps.WriteLine(" <{0}>", toolInfo.XMLTag); | 657 | //ps.WriteLine(" <{0}>", toolInfo.XMLTag); |
658 | //ps.WriteLine(" <Build>"); | 658 | //ps.WriteLine(" <Build>"); |
659 | ps.WriteLine(" <PropertyGroup>"); | 659 | ps.WriteLine(" <PropertyGroup>"); |
660 | //ps.WriteLine(" <Settings ReferencePath=\"{0}\">", MakeRefPath(project)); | 660 | //ps.WriteLine(" <Settings ReferencePath=\"{0}\">", MakeRefPath(project)); |
661 | 661 | ||
662 | 662 | ||
663 | ps.WriteLine(" <Configuration Condition=\" '$(Configuration)' == '' \">Debug</Configuration>"); | 663 | ps.WriteLine(" <Configuration Condition=\" '$(Configuration)' == '' \">Debug</Configuration>"); |
664 | ps.WriteLine(" <Platform Condition=\" '$(Platform)' == '' \">AnyCPU</Platform>"); | 664 | ps.WriteLine(" <Platform Condition=\" '$(Platform)' == '' \">AnyCPU</Platform>"); |
665 | 665 | ||
666 | if (projectFile.Contains( "OpenSim.csproj" )) | 666 | if (projectFile.Contains( "OpenSim.csproj" )) |
667 | { | 667 | { |
668 | ps.WriteLine(" <StartArguments>-loginserver -sandbox -accounts</StartArguments>"); | 668 | ps.WriteLine(" <StartArguments>-loginserver -sandbox -accounts</StartArguments>"); |
669 | } | 669 | } |
670 | 670 | ||
671 | ps.WriteLine(" <ReferencePath>{0}</ReferencePath>", MakeRefPath(project)); | 671 | ps.WriteLine(" <ReferencePath>{0}</ReferencePath>", MakeRefPath(project)); |
672 | ps.WriteLine(" <LastOpenVersion>{0}</LastOpenVersion>", this.ProductVersion); | 672 | ps.WriteLine(" <LastOpenVersion>{0}</LastOpenVersion>", this.ProductVersion); |
673 | ps.WriteLine(" <ProjectView>ProjectFiles</ProjectView>"); | 673 | ps.WriteLine(" <ProjectView>ProjectFiles</ProjectView>"); |
674 | ps.WriteLine(" <ProjectTrust>0</ProjectTrust>"); | 674 | ps.WriteLine(" <ProjectTrust>0</ProjectTrust>"); |
675 | ps.WriteLine(" </PropertyGroup>"); | 675 | ps.WriteLine(" </PropertyGroup>"); |
676 | foreach (ConfigurationNode conf in project.Configurations) | 676 | foreach (ConfigurationNode conf in project.Configurations) |
677 | { | 677 | { |
678 | ps.Write(" <PropertyGroup"); | 678 | ps.Write(" <PropertyGroup"); |
679 | ps.Write(" Condition = \" '$(Configuration)|$(Platform)' == '{0}|AnyCPU' \"", conf.Name); | 679 | ps.Write(" Condition = \" '$(Configuration)|$(Platform)' == '{0}|AnyCPU' \"", conf.Name); |
680 | ps.WriteLine(" />"); | 680 | ps.WriteLine(" />"); |
681 | } | 681 | } |
682 | 682 | ||
683 | ps.WriteLine("</Project>"); | 683 | ps.WriteLine("</Project>"); |
684 | } | 684 | } |
685 | #endregion | 685 | #endregion |
686 | 686 | ||
687 | kernel.CurrentWorkingDirectory.Pop(); | 687 | kernel.CurrentWorkingDirectory.Pop(); |
688 | } | 688 | } |
689 | 689 | ||
690 | private void WriteSolution(SolutionNode solution) | 690 | private void WriteSolution(SolutionNode solution) |
691 | { | 691 | { |
692 | kernel.Log.Write("Creating {0} solution and project files", this.VersionName); | 692 | kernel.Log.Write("Creating {0} solution and project files", this.VersionName); |
693 | 693 | ||
694 | foreach (ProjectNode project in solution.Projects) | 694 | foreach (ProjectNode project in solution.Projects) |
695 | { | 695 | { |
696 | kernel.Log.Write("...Creating project: {0}", project.Name); | 696 | kernel.Log.Write("...Creating project: {0}", project.Name); |
697 | WriteProject(solution, project); | 697 | WriteProject(solution, project); |
698 | } | 698 | } |
699 | 699 | ||
700 | kernel.Log.Write(""); | 700 | kernel.Log.Write(""); |
701 | string solutionFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "sln"); | 701 | string solutionFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "sln"); |
702 | StreamWriter ss = new StreamWriter(solutionFile); | 702 | StreamWriter ss = new StreamWriter(solutionFile); |
703 | 703 | ||
704 | kernel.CurrentWorkingDirectory.Push(); | 704 | kernel.CurrentWorkingDirectory.Push(); |
705 | Helper.SetCurrentDir(Path.GetDirectoryName(solutionFile)); | 705 | Helper.SetCurrentDir(Path.GetDirectoryName(solutionFile)); |
706 | 706 | ||
707 | using (ss) | 707 | using (ss) |
708 | { | 708 | { |
709 | ss.WriteLine("Microsoft Visual Studio Solution File, Format Version {0}", this.SolutionVersion); | 709 | ss.WriteLine("Microsoft Visual Studio Solution File, Format Version {0}", this.SolutionVersion); |
710 | ss.WriteLine("# Visual Studio 2005"); | 710 | ss.WriteLine("# Visual Studio 2005"); |
711 | foreach (ProjectNode project in solution.Projects) | 711 | foreach (ProjectNode project in solution.Projects) |
712 | { | 712 | { |
713 | if (!tools.ContainsKey(project.Language)) | 713 | if (!tools.ContainsKey(project.Language)) |
714 | { | 714 | { |
715 | throw new UnknownLanguageException("Unknown .NET language: " + project.Language); | 715 | throw new UnknownLanguageException("Unknown .NET language: " + project.Language); |
716 | } | 716 | } |
717 | 717 | ||
718 | ToolInfo toolInfo = (ToolInfo)tools[project.Language]; | 718 | ToolInfo toolInfo = (ToolInfo)tools[project.Language]; |
719 | 719 | ||
720 | string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath); | 720 | string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath); |
721 | ss.WriteLine("Project(\"{0}\") = \"{1}\", \"{2}\", \"{{{3}}}\"", | 721 | ss.WriteLine("Project(\"{0}\") = \"{1}\", \"{2}\", \"{{{3}}}\"", |
722 | toolInfo.Guid, project.Name, Helper.MakeFilePath(path, project.Name, | 722 | toolInfo.Guid, project.Name, Helper.MakeFilePath(path, project.Name, |
723 | toolInfo.FileExtension), project.Guid.ToString().ToUpper()); | 723 | toolInfo.FileExtension), project.Guid.ToString().ToUpper()); |
724 | 724 | ||
725 | //ss.WriteLine(" ProjectSection(ProjectDependencies) = postProject"); | 725 | //ss.WriteLine(" ProjectSection(ProjectDependencies) = postProject"); |
726 | //ss.WriteLine(" EndProjectSection"); | 726 | //ss.WriteLine(" EndProjectSection"); |
727 | 727 | ||
728 | ss.WriteLine("EndProject"); | 728 | ss.WriteLine("EndProject"); |
729 | } | 729 | } |
730 | 730 | ||
731 | if (solution.Files != null) | 731 | if (solution.Files != null) |
732 | { | 732 | { |
733 | ss.WriteLine("Project(\"{0}\") = \"Solution Items\", \"Solution Items\", \"{1}\"", "{2150E333-8FDC-42A3-9474-1A3956D46DE8}", "{468F1D07-AD17-4CC3-ABD0-2CA268E4E1A6}"); | 733 | ss.WriteLine("Project(\"{0}\") = \"Solution Items\", \"Solution Items\", \"{1}\"", "{2150E333-8FDC-42A3-9474-1A3956D46DE8}", "{468F1D07-AD17-4CC3-ABD0-2CA268E4E1A6}"); |
734 | ss.WriteLine("\tProjectSection(SolutionItems) = preProject"); | 734 | ss.WriteLine("\tProjectSection(SolutionItems) = preProject"); |
735 | foreach (string file in solution.Files) | 735 | foreach (string file in solution.Files) |
736 | ss.WriteLine("\t\t{0} = {0}", file); | 736 | ss.WriteLine("\t\t{0} = {0}", file); |
737 | ss.WriteLine("\tEndProjectSection"); | 737 | ss.WriteLine("\tEndProjectSection"); |
738 | ss.WriteLine("EndProject"); | 738 | ss.WriteLine("EndProject"); |
739 | } | 739 | } |
740 | 740 | ||
741 | ss.WriteLine("Global"); | 741 | ss.WriteLine("Global"); |
742 | 742 | ||
743 | ss.WriteLine(" GlobalSection(SolutionConfigurationPlatforms) = preSolution"); | 743 | ss.WriteLine(" GlobalSection(SolutionConfigurationPlatforms) = preSolution"); |
744 | foreach (ConfigurationNode conf in solution.Configurations) | 744 | foreach (ConfigurationNode conf in solution.Configurations) |
745 | { | 745 | { |
746 | ss.WriteLine(" {0}|Any CPU = {0}|Any CPU", conf.Name); | 746 | ss.WriteLine(" {0}|Any CPU = {0}|Any CPU", conf.Name); |
747 | } | 747 | } |
748 | ss.WriteLine(" EndGlobalSection"); | 748 | ss.WriteLine(" EndGlobalSection"); |
749 | 749 | ||
750 | if (solution.Projects.Count > 1) | 750 | if (solution.Projects.Count > 1) |
751 | { | 751 | { |
752 | ss.WriteLine(" GlobalSection(ProjectDependencies) = postSolution"); | 752 | ss.WriteLine(" GlobalSection(ProjectDependencies) = postSolution"); |
753 | } | 753 | } |
754 | foreach (ProjectNode project in solution.Projects) | 754 | foreach (ProjectNode project in solution.Projects) |
755 | { | 755 | { |
756 | for (int i = 0; i < project.References.Count; i++) | 756 | for (int i = 0; i < project.References.Count; i++) |
757 | { | 757 | { |
758 | ReferenceNode refr = (ReferenceNode)project.References[i]; | 758 | ReferenceNode refr = (ReferenceNode)project.References[i]; |
759 | if (solution.ProjectsTable.ContainsKey(refr.Name)) | 759 | if (solution.ProjectsTable.ContainsKey(refr.Name)) |
760 | { | 760 | { |
761 | ProjectNode refProject = (ProjectNode)solution.ProjectsTable[refr.Name]; | 761 | ProjectNode refProject = (ProjectNode)solution.ProjectsTable[refr.Name]; |
762 | ss.WriteLine(" ({{{0}}}).{1} = ({{{2}}})", | 762 | ss.WriteLine(" ({{{0}}}).{1} = ({{{2}}})", |
763 | project.Guid.ToString().ToUpper() | 763 | project.Guid.ToString().ToUpper() |
764 | , i, | 764 | , i, |
765 | refProject.Guid.ToString().ToUpper() | 765 | refProject.Guid.ToString().ToUpper() |
766 | ); | 766 | ); |
767 | } | 767 | } |
768 | } | 768 | } |
769 | } | 769 | } |
770 | if (solution.Projects.Count > 1) | 770 | if (solution.Projects.Count > 1) |
771 | { | 771 | { |
772 | ss.WriteLine(" EndGlobalSection"); | 772 | ss.WriteLine(" EndGlobalSection"); |
773 | } | 773 | } |
774 | ss.WriteLine(" GlobalSection(ProjectConfigurationPlatforms) = postSolution"); | 774 | ss.WriteLine(" GlobalSection(ProjectConfigurationPlatforms) = postSolution"); |
775 | foreach (ProjectNode project in solution.Projects) | 775 | foreach (ProjectNode project in solution.Projects) |
776 | { | 776 | { |
777 | foreach (ConfigurationNode conf in solution.Configurations) | 777 | foreach (ConfigurationNode conf in solution.Configurations) |
778 | { | 778 | { |
779 | ss.WriteLine(" {{{0}}}.{1}|Any CPU.ActiveCfg = {1}|Any CPU", | 779 | ss.WriteLine(" {{{0}}}.{1}|Any CPU.ActiveCfg = {1}|Any CPU", |
780 | project.Guid.ToString().ToUpper(), | 780 | project.Guid.ToString().ToUpper(), |
781 | conf.Name); | 781 | conf.Name); |
782 | 782 | ||
783 | ss.WriteLine(" {{{0}}}.{1}|Any CPU.Build.0 = {1}|Any CPU", | 783 | ss.WriteLine(" {{{0}}}.{1}|Any CPU.Build.0 = {1}|Any CPU", |
784 | project.Guid.ToString().ToUpper(), | 784 | project.Guid.ToString().ToUpper(), |
785 | conf.Name); | 785 | conf.Name); |
786 | } | 786 | } |
787 | } | 787 | } |
788 | ss.WriteLine(" EndGlobalSection"); | 788 | ss.WriteLine(" EndGlobalSection"); |
789 | ss.WriteLine(" GlobalSection(SolutionProperties) = preSolution"); | 789 | ss.WriteLine(" GlobalSection(SolutionProperties) = preSolution"); |
790 | ss.WriteLine(" HideSolutionNode = FALSE"); | 790 | ss.WriteLine(" HideSolutionNode = FALSE"); |
791 | ss.WriteLine(" EndGlobalSection"); | 791 | ss.WriteLine(" EndGlobalSection"); |
792 | 792 | ||
793 | ss.WriteLine("EndGlobal"); | 793 | ss.WriteLine("EndGlobal"); |
794 | } | 794 | } |
795 | 795 | ||
796 | kernel.CurrentWorkingDirectory.Pop(); | 796 | kernel.CurrentWorkingDirectory.Pop(); |
797 | } | 797 | } |
798 | 798 | ||
799 | private void CleanProject(ProjectNode project) | 799 | private void CleanProject(ProjectNode project) |
800 | { | 800 | { |
801 | kernel.Log.Write("...Cleaning project: {0}", project.Name); | 801 | kernel.Log.Write("...Cleaning project: {0}", project.Name); |
802 | 802 | ||
803 | ToolInfo toolInfo = (ToolInfo)tools[project.Language]; | 803 | ToolInfo toolInfo = (ToolInfo)tools[project.Language]; |
804 | string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, toolInfo.FileExtension); | 804 | string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, toolInfo.FileExtension); |
805 | string userFile = projectFile + ".user"; | 805 | string userFile = projectFile + ".user"; |
806 | 806 | ||
807 | Helper.DeleteIfExists(projectFile); | 807 | Helper.DeleteIfExists(projectFile); |
808 | Helper.DeleteIfExists(userFile); | 808 | Helper.DeleteIfExists(userFile); |
809 | } | 809 | } |
810 | 810 | ||
811 | private void CleanSolution(SolutionNode solution) | 811 | private void CleanSolution(SolutionNode solution) |
812 | { | 812 | { |
813 | kernel.Log.Write("Cleaning {0} solution and project files", this.VersionName, solution.Name); | 813 | kernel.Log.Write("Cleaning {0} solution and project files", this.VersionName, solution.Name); |
814 | 814 | ||
815 | string slnFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "sln"); | 815 | string slnFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "sln"); |
816 | string suoFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "suo"); | 816 | string suoFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "suo"); |
817 | 817 | ||
818 | Helper.DeleteIfExists(slnFile); | 818 | Helper.DeleteIfExists(slnFile); |
819 | Helper.DeleteIfExists(suoFile); | 819 | Helper.DeleteIfExists(suoFile); |
820 | 820 | ||
821 | foreach (ProjectNode project in solution.Projects) | 821 | foreach (ProjectNode project in solution.Projects) |
822 | { | 822 | { |
823 | CleanProject(project); | 823 | CleanProject(project); |
824 | } | 824 | } |
825 | 825 | ||
826 | kernel.Log.Write(""); | 826 | kernel.Log.Write(""); |
827 | } | 827 | } |
828 | 828 | ||
829 | #endregion | 829 | #endregion |
830 | 830 | ||
831 | #region ITarget Members | 831 | #region ITarget Members |
832 | 832 | ||
833 | /// <summary> | 833 | /// <summary> |
834 | /// Writes the specified kern. | 834 | /// Writes the specified kern. |
835 | /// </summary> | 835 | /// </summary> |
836 | /// <param name="kern">The kern.</param> | 836 | /// <param name="kern">The kern.</param> |
837 | public virtual void Write(Kernel kern) | 837 | public virtual void Write(Kernel kern) |
838 | { | 838 | { |
839 | if (kern == null) | 839 | if (kern == null) |
840 | { | 840 | { |
841 | throw new ArgumentNullException("kern"); | 841 | throw new ArgumentNullException("kern"); |
842 | } | 842 | } |
843 | kernel = kern; | 843 | kernel = kern; |
844 | foreach (SolutionNode sol in kernel.Solutions) | 844 | foreach (SolutionNode sol in kernel.Solutions) |
845 | { | 845 | { |
846 | WriteSolution(sol); | 846 | WriteSolution(sol); |
847 | } | 847 | } |
848 | kernel = null; | 848 | kernel = null; |
849 | } | 849 | } |
850 | 850 | ||
851 | /// <summary> | 851 | /// <summary> |
852 | /// Cleans the specified kern. | 852 | /// Cleans the specified kern. |
853 | /// </summary> | 853 | /// </summary> |
854 | /// <param name="kern">The kern.</param> | 854 | /// <param name="kern">The kern.</param> |
855 | public virtual void Clean(Kernel kern) | 855 | public virtual void Clean(Kernel kern) |
856 | { | 856 | { |
857 | if (kern == null) | 857 | if (kern == null) |
858 | { | 858 | { |
859 | throw new ArgumentNullException("kern"); | 859 | throw new ArgumentNullException("kern"); |
860 | } | 860 | } |
861 | kernel = kern; | 861 | kernel = kern; |
862 | foreach (SolutionNode sol in kernel.Solutions) | 862 | foreach (SolutionNode sol in kernel.Solutions) |
863 | { | 863 | { |
864 | CleanSolution(sol); | 864 | CleanSolution(sol); |
865 | } | 865 | } |
866 | kernel = null; | 866 | kernel = null; |
867 | } | 867 | } |
868 | 868 | ||
869 | /// <summary> | 869 | /// <summary> |
870 | /// Gets the name. | 870 | /// Gets the name. |
871 | /// </summary> | 871 | /// </summary> |
872 | /// <value>The name.</value> | 872 | /// <value>The name.</value> |
873 | public virtual string Name | 873 | public virtual string Name |
874 | { | 874 | { |
875 | get | 875 | get |
876 | { | 876 | { |
877 | return "vs2005"; | 877 | return "vs2005"; |
878 | } | 878 | } |
879 | } | 879 | } |
880 | 880 | ||
881 | #endregion | 881 | #endregion |
882 | } | 882 | } |
883 | } | 883 | } |