diff options
author | Melanie Thielker | 2017-01-05 19:07:37 +0000 |
---|---|---|
committer | Melanie Thielker | 2017-01-05 19:07:37 +0000 |
commit | b16abc8166c29585cb76cc55c3bdd76e5833cb4f (patch) | |
tree | 6a34f465a74b7a3a6dc00a3d7aa8dcc25ac3e3a5 /Prebuild/src/Core/Targets/SharpDevelopTarget.cs | |
parent | Make it possible to disable the bakes module in the way it is described in co... (diff) | |
download | opensim-SC_OLD-b16abc8166c29585cb76cc55c3bdd76e5833cb4f.zip opensim-SC_OLD-b16abc8166c29585cb76cc55c3bdd76e5833cb4f.tar.gz opensim-SC_OLD-b16abc8166c29585cb76cc55c3bdd76e5833cb4f.tar.bz2 opensim-SC_OLD-b16abc8166c29585cb76cc55c3bdd76e5833cb4f.tar.xz |
Massive tab and trailing space cleanup
Diffstat (limited to 'Prebuild/src/Core/Targets/SharpDevelopTarget.cs')
-rw-r--r-- | Prebuild/src/Core/Targets/SharpDevelopTarget.cs | 794 |
1 files changed, 397 insertions, 397 deletions
diff --git a/Prebuild/src/Core/Targets/SharpDevelopTarget.cs b/Prebuild/src/Core/Targets/SharpDevelopTarget.cs index 8e32050..acab9f4 100644 --- a/Prebuild/src/Core/Targets/SharpDevelopTarget.cs +++ b/Prebuild/src/Core/Targets/SharpDevelopTarget.cs | |||
@@ -5,16 +5,16 @@ Copyright (c) 2004 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (da | |||
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 |
@@ -34,392 +34,392 @@ using Prebuild.Core.Utilities; | |||
34 | 34 | ||
35 | namespace Prebuild.Core.Targets | 35 | namespace Prebuild.Core.Targets |
36 | { | 36 | { |
37 | /// <summary> | 37 | /// <summary> |
38 | /// | 38 | /// |
39 | /// </summary> | 39 | /// </summary> |
40 | [Target("sharpdev")] | 40 | [Target("sharpdev")] |
41 | public class SharpDevelopTarget : ITarget | 41 | public class SharpDevelopTarget : ITarget |
42 | { | 42 | { |
43 | #region Fields | 43 | #region Fields |
44 | 44 | ||
45 | private Kernel m_Kernel; | 45 | private Kernel m_Kernel; |
46 | 46 | ||
47 | #endregion | 47 | #endregion |
48 | 48 | ||
49 | #region Private Methods | 49 | #region Private Methods |
50 | 50 | ||
51 | private static string PrependPath(string path) | 51 | private static string PrependPath(string path) |
52 | { | 52 | { |
53 | string tmpPath = Helper.NormalizePath(path, '/'); | 53 | string tmpPath = Helper.NormalizePath(path, '/'); |
54 | Regex regex = new Regex(@"(\w):/(\w+)"); | 54 | Regex regex = new Regex(@"(\w):/(\w+)"); |
55 | Match match = regex.Match(tmpPath); | 55 | Match match = regex.Match(tmpPath); |
56 | if(match.Success || tmpPath[0] == '.' || tmpPath[0] == '/') | 56 | if(match.Success || tmpPath[0] == '.' || tmpPath[0] == '/') |
57 | { | 57 | { |
58 | tmpPath = Helper.NormalizePath(tmpPath); | 58 | tmpPath = Helper.NormalizePath(tmpPath); |
59 | } | 59 | } |
60 | else | 60 | else |
61 | { | 61 | { |
62 | tmpPath = Helper.NormalizePath("./" + tmpPath); | 62 | tmpPath = Helper.NormalizePath("./" + tmpPath); |
63 | } | 63 | } |
64 | 64 | ||
65 | return tmpPath; | 65 | return tmpPath; |
66 | } | 66 | } |
67 | 67 | ||
68 | private static string BuildReference(SolutionNode solution, ReferenceNode refr) | 68 | private static string BuildReference(SolutionNode solution, ReferenceNode refr) |
69 | { | 69 | { |
70 | string ret = "<Reference type=\""; | 70 | string ret = "<Reference type=\""; |
71 | if(solution.ProjectsTable.ContainsKey(refr.Name)) | 71 | if(solution.ProjectsTable.ContainsKey(refr.Name)) |
72 | { | 72 | { |
73 | ret += "Project\" refto=\"" + refr.Name; | 73 | ret += "Project\" refto=\"" + refr.Name; |
74 | ret += "\" localcopy=\"" + refr.LocalCopy.ToString() + "\" />"; | 74 | ret += "\" localcopy=\"" + refr.LocalCopy.ToString() + "\" />"; |
75 | } | 75 | } |
76 | else | 76 | else |
77 | { | 77 | { |
78 | ProjectNode project = (ProjectNode)refr.Parent; | 78 | ProjectNode project = (ProjectNode)refr.Parent; |
79 | string fileRef = FindFileReference(refr.Name, project); | 79 | string fileRef = FindFileReference(refr.Name, project); |
80 | 80 | ||
81 | if(refr.Path != null || fileRef != null) | 81 | if(refr.Path != null || fileRef != null) |
82 | { | 82 | { |
83 | ret += "Assembly\" refto=\""; | 83 | ret += "Assembly\" refto=\""; |
84 | 84 | ||
85 | string finalPath = (refr.Path != null) ? Helper.MakeFilePath(refr.Path, refr.Name, "dll") : fileRef; | 85 | string finalPath = (refr.Path != null) ? Helper.MakeFilePath(refr.Path, refr.Name, "dll") : fileRef; |
86 | 86 | ||
87 | ret += finalPath; | 87 | ret += finalPath; |
88 | ret += "\" localcopy=\"" + refr.LocalCopy.ToString() + "\" />"; | 88 | ret += "\" localcopy=\"" + refr.LocalCopy.ToString() + "\" />"; |
89 | return ret; | 89 | return ret; |
90 | } | 90 | } |
91 | 91 | ||
92 | ret += "Gac\" refto=\""; | 92 | ret += "Gac\" refto=\""; |
93 | try | 93 | try |
94 | { | 94 | { |
95 | //Assembly assem = Assembly.Load(refr.Name); | 95 | //Assembly assem = Assembly.Load(refr.Name); |
96 | ret += refr.Name;// assem.FullName; | 96 | ret += refr.Name;// assem.FullName; |
97 | } | 97 | } |
98 | catch (System.NullReferenceException e) | 98 | catch (System.NullReferenceException e) |
99 | { | 99 | { |
100 | e.ToString(); | 100 | e.ToString(); |
101 | ret += refr.Name; | 101 | ret += refr.Name; |
102 | } | 102 | } |
103 | ret += "\" localcopy=\"" + refr.LocalCopy.ToString() + "\" />"; | 103 | ret += "\" localcopy=\"" + refr.LocalCopy.ToString() + "\" />"; |
104 | } | 104 | } |
105 | 105 | ||
106 | return ret; | 106 | return ret; |
107 | } | 107 | } |
108 | 108 | ||
109 | private static string FindFileReference(string refName, ProjectNode project) | 109 | private static string FindFileReference(string refName, ProjectNode project) |
110 | { | 110 | { |
111 | foreach(ReferencePathNode refPath in project.ReferencePaths) | 111 | foreach(ReferencePathNode refPath in project.ReferencePaths) |
112 | { | 112 | { |
113 | string fullPath = Helper.MakeFilePath(refPath.Path, refName, "dll"); | 113 | string fullPath = Helper.MakeFilePath(refPath.Path, refName, "dll"); |
114 | 114 | ||
115 | if(File.Exists(fullPath)) | 115 | if(File.Exists(fullPath)) |
116 | { | 116 | { |
117 | return fullPath; | 117 | return fullPath; |
118 | } | 118 | } |
119 | } | 119 | } |
120 | 120 | ||
121 | return null; | 121 | return null; |
122 | } | 122 | } |
123 | 123 | ||
124 | /// <summary> | 124 | /// <summary> |
125 | /// Gets the XML doc file. | 125 | /// Gets the XML doc file. |
126 | /// </summary> | 126 | /// </summary> |
127 | /// <param name="project">The project.</param> | 127 | /// <param name="project">The project.</param> |
128 | /// <param name="conf">The conf.</param> | 128 | /// <param name="conf">The conf.</param> |
129 | /// <returns></returns> | 129 | /// <returns></returns> |
130 | public static string GenerateXmlDocFile(ProjectNode project, ConfigurationNode conf) | 130 | public static string GenerateXmlDocFile(ProjectNode project, ConfigurationNode conf) |
131 | { | 131 | { |
132 | if( conf == null ) | 132 | if( conf == null ) |
133 | { | 133 | { |
134 | throw new ArgumentNullException("conf"); | 134 | throw new ArgumentNullException("conf"); |
135 | } | 135 | } |
136 | if( project == null ) | 136 | if( project == null ) |
137 | { | 137 | { |
138 | throw new ArgumentNullException("project"); | 138 | throw new ArgumentNullException("project"); |
139 | } | 139 | } |
140 | string docFile = (string)conf.Options["XmlDocFile"]; | 140 | string docFile = (string)conf.Options["XmlDocFile"]; |
141 | if(docFile != null && docFile.Length == 0)//default to assembly name if not specified | 141 | if(docFile != null && docFile.Length == 0)//default to assembly name if not specified |
142 | { | 142 | { |
143 | return "False"; | 143 | return "False"; |
144 | } | 144 | } |
145 | return "True"; | 145 | return "True"; |
146 | } | 146 | } |
147 | 147 | ||
148 | private void WriteProject(SolutionNode solution, ProjectNode project) | 148 | private void WriteProject(SolutionNode solution, ProjectNode project) |
149 | { | 149 | { |
150 | string csComp = "Csc"; | 150 | string csComp = "Csc"; |
151 | string netRuntime = "MsNet"; | 151 | string netRuntime = "MsNet"; |
152 | if(project.Runtime == ClrRuntime.Mono) | 152 | if(project.Runtime == ClrRuntime.Mono) |
153 | { | 153 | { |
154 | csComp = "Mcs"; | 154 | csComp = "Mcs"; |
155 | netRuntime = "Mono"; | 155 | netRuntime = "Mono"; |
156 | } | 156 | } |
157 | 157 | ||
158 | string projFile = Helper.MakeFilePath(project.FullPath, project.Name, "prjx"); | 158 | string projFile = Helper.MakeFilePath(project.FullPath, project.Name, "prjx"); |
159 | StreamWriter ss = new StreamWriter(projFile); | 159 | StreamWriter ss = new StreamWriter(projFile); |
160 | 160 | ||
161 | m_Kernel.CurrentWorkingDirectory.Push(); | 161 | m_Kernel.CurrentWorkingDirectory.Push(); |
162 | Helper.SetCurrentDir(Path.GetDirectoryName(projFile)); | 162 | Helper.SetCurrentDir(Path.GetDirectoryName(projFile)); |
163 | 163 | ||
164 | using(ss) | 164 | using(ss) |
165 | { | 165 | { |
166 | ss.WriteLine( | 166 | ss.WriteLine( |
167 | "<Project name=\"{0}\" standardNamespace=\"{1}\" description=\"\" newfilesearch=\"None\" enableviewstate=\"True\" version=\"1.1\" projecttype=\"C#\">", | 167 | "<Project name=\"{0}\" standardNamespace=\"{1}\" description=\"\" newfilesearch=\"None\" enableviewstate=\"True\" version=\"1.1\" projecttype=\"C#\">", |
168 | project.Name, | 168 | project.Name, |
169 | project.RootNamespace | 169 | project.RootNamespace |
170 | ); | 170 | ); |
171 | 171 | ||
172 | ss.WriteLine(" <Contents>"); | 172 | ss.WriteLine(" <Contents>"); |
173 | foreach(string file in project.Files) | 173 | foreach(string file in project.Files) |
174 | { | 174 | { |
175 | string buildAction = "Compile"; | 175 | string buildAction = "Compile"; |
176 | switch(project.Files.GetBuildAction(file)) | 176 | switch(project.Files.GetBuildAction(file)) |
177 | { | 177 | { |
178 | case BuildAction.None: | 178 | case BuildAction.None: |
179 | buildAction = "Nothing"; | 179 | buildAction = "Nothing"; |
180 | break; | 180 | break; |
181 | 181 | ||
182 | case BuildAction.Content: | 182 | case BuildAction.Content: |
183 | buildAction = "Exclude"; | 183 | buildAction = "Exclude"; |
184 | break; | 184 | break; |
185 | 185 | ||
186 | case BuildAction.EmbeddedResource: | 186 | case BuildAction.EmbeddedResource: |
187 | buildAction = "EmbedAsResource"; | 187 | buildAction = "EmbedAsResource"; |
188 | break; | 188 | break; |
189 | 189 | ||
190 | default: | 190 | default: |
191 | buildAction = "Compile"; | 191 | buildAction = "Compile"; |
192 | break; | 192 | break; |
193 | } | 193 | } |
194 | 194 | ||
195 | // Sort of a hack, we try and resolve the path and make it relative, if we can. | 195 | // Sort of a hack, we try and resolve the path and make it relative, if we can. |
196 | string filePath = PrependPath(file); | 196 | string filePath = PrependPath(file); |
197 | ss.WriteLine(" <File name=\"{0}\" subtype=\"Code\" buildaction=\"{1}\" dependson=\"\" data=\"\" />", filePath, buildAction); | 197 | ss.WriteLine(" <File name=\"{0}\" subtype=\"Code\" buildaction=\"{1}\" dependson=\"\" data=\"\" />", filePath, buildAction); |
198 | } | 198 | } |
199 | ss.WriteLine(" </Contents>"); | 199 | ss.WriteLine(" </Contents>"); |
200 | 200 | ||
201 | ss.WriteLine(" <References>"); | 201 | ss.WriteLine(" <References>"); |
202 | foreach(ReferenceNode refr in project.References) | 202 | foreach(ReferenceNode refr in project.References) |
203 | { | 203 | { |
204 | ss.WriteLine(" {0}", BuildReference(solution, refr)); | 204 | ss.WriteLine(" {0}", BuildReference(solution, refr)); |
205 | } | 205 | } |
206 | ss.WriteLine(" </References>"); | 206 | ss.WriteLine(" </References>"); |
207 | 207 | ||
208 | ss.Write(" <DeploymentInformation"); | 208 | ss.Write(" <DeploymentInformation"); |
209 | ss.Write(" target=\"\""); | 209 | ss.Write(" target=\"\""); |
210 | ss.Write(" script=\"\""); | 210 | ss.Write(" script=\"\""); |
211 | ss.Write(" strategy=\"File\""); | 211 | ss.Write(" strategy=\"File\""); |
212 | ss.WriteLine(" />"); | 212 | ss.WriteLine(" />"); |
213 | 213 | ||
214 | int count = 0; | 214 | int count = 0; |
215 | 215 | ||
216 | ss.WriteLine(" <Configurations active=\"{0}\">", solution.ActiveConfig); | 216 | ss.WriteLine(" <Configurations active=\"{0}\">", solution.ActiveConfig); |
217 | 217 | ||
218 | foreach(ConfigurationNode conf in project.Configurations) | 218 | foreach(ConfigurationNode conf in project.Configurations) |
219 | { | 219 | { |
220 | ss.Write(" <Configuration"); | 220 | ss.Write(" <Configuration"); |
221 | ss.Write(" runwithwarnings=\"True\""); | 221 | ss.Write(" runwithwarnings=\"True\""); |
222 | ss.Write(" name=\"{0}\"", conf.Name); | 222 | ss.Write(" name=\"{0}\"", conf.Name); |
223 | ss.WriteLine(">"); | 223 | ss.WriteLine(">"); |
224 | ss.Write(" <CodeGeneration"); | 224 | ss.Write(" <CodeGeneration"); |
225 | ss.Write(" runtime=\"{0}\"", netRuntime); | 225 | ss.Write(" runtime=\"{0}\"", netRuntime); |
226 | ss.Write(" compiler=\"{0}\"", csComp); | 226 | ss.Write(" compiler=\"{0}\"", csComp); |
227 | ss.Write(" compilerversion=\"\""); | 227 | ss.Write(" compilerversion=\"\""); |
228 | ss.Write(" warninglevel=\"{0}\"", conf.Options["WarningLevel"]); | 228 | ss.Write(" warninglevel=\"{0}\"", conf.Options["WarningLevel"]); |
229 | ss.Write(" nowarn=\"{0}\"", conf.Options["SuppressWarnings"]); | 229 | ss.Write(" nowarn=\"{0}\"", conf.Options["SuppressWarnings"]); |
230 | ss.Write(" includedebuginformation=\"{0}\"", conf.Options["DebugInformation"]); | 230 | ss.Write(" includedebuginformation=\"{0}\"", conf.Options["DebugInformation"]); |
231 | ss.Write(" optimize=\"{0}\"", conf.Options["OptimizeCode"]); | 231 | ss.Write(" optimize=\"{0}\"", conf.Options["OptimizeCode"]); |
232 | ss.Write(" unsafecodeallowed=\"{0}\"", conf.Options["AllowUnsafe"]); | 232 | ss.Write(" unsafecodeallowed=\"{0}\"", conf.Options["AllowUnsafe"]); |
233 | ss.Write(" generateoverflowchecks=\"{0}\"", conf.Options["CheckUnderflowOverflow"]); | 233 | ss.Write(" generateoverflowchecks=\"{0}\"", conf.Options["CheckUnderflowOverflow"]); |
234 | ss.Write(" mainclass=\"{0}\"", project.StartupObject); | 234 | ss.Write(" mainclass=\"{0}\"", project.StartupObject); |
235 | ss.Write(" target=\"{0}\"", project.Type); | 235 | ss.Write(" target=\"{0}\"", project.Type); |
236 | ss.Write(" definesymbols=\"{0}\"", conf.Options["CompilerDefines"]); | 236 | ss.Write(" definesymbols=\"{0}\"", conf.Options["CompilerDefines"]); |
237 | ss.Write(" generatexmldocumentation=\"{0}\"", GenerateXmlDocFile(project, conf)); | 237 | ss.Write(" generatexmldocumentation=\"{0}\"", GenerateXmlDocFile(project, conf)); |
238 | ss.Write(" win32Icon=\"{0}\"", Helper.NormalizePath(".\\" + project.AppIcon)); | 238 | ss.Write(" win32Icon=\"{0}\"", Helper.NormalizePath(".\\" + project.AppIcon)); |
239 | ss.Write(" noconfig=\"{0}\"", "False"); | 239 | ss.Write(" noconfig=\"{0}\"", "False"); |
240 | ss.Write(" nostdlib=\"{0}\"", conf.Options["NoStdLib"]); | 240 | ss.Write(" nostdlib=\"{0}\"", conf.Options["NoStdLib"]); |
241 | ss.WriteLine(" />"); | 241 | ss.WriteLine(" />"); |
242 | 242 | ||
243 | ss.Write(" <Execution"); | 243 | ss.Write(" <Execution"); |
244 | ss.Write(" commandlineparameters=\"\""); | 244 | ss.Write(" commandlineparameters=\"\""); |
245 | ss.Write(" consolepause=\"True\""); | 245 | ss.Write(" consolepause=\"True\""); |
246 | ss.WriteLine(" />"); | 246 | ss.WriteLine(" />"); |
247 | 247 | ||
248 | ss.Write(" <Output"); | 248 | ss.Write(" <Output"); |
249 | ss.Write(" directory=\".\\{0}\"", Helper.NormalizePath(conf.Options["OutputPath"].ToString())); | 249 | ss.Write(" directory=\".\\{0}\"", Helper.NormalizePath(conf.Options["OutputPath"].ToString())); |
250 | ss.Write(" assembly=\"{0}\"", project.AssemblyName); | 250 | ss.Write(" assembly=\"{0}\"", project.AssemblyName); |
251 | ss.Write(" executeScript=\"{0}\"", conf.Options["RunScript"]); | 251 | ss.Write(" executeScript=\"{0}\"", conf.Options["RunScript"]); |
252 | if (conf.Options["PreBuildEvent"] != null && conf.Options["PreBuildEvent"].ToString().Length != 0) | 252 | if (conf.Options["PreBuildEvent"] != null && conf.Options["PreBuildEvent"].ToString().Length != 0) |
253 | { | 253 | { |
254 | ss.Write(" executeBeforeBuild=\"{0}\"", Helper.NormalizePath(conf.Options["PreBuildEvent"].ToString())); | 254 | ss.Write(" executeBeforeBuild=\"{0}\"", Helper.NormalizePath(conf.Options["PreBuildEvent"].ToString())); |
255 | } | 255 | } |
256 | else | 256 | else |
257 | { | 257 | { |
258 | ss.Write(" executeBeforeBuild=\"{0}\"", conf.Options["PreBuildEvent"]); | 258 | ss.Write(" executeBeforeBuild=\"{0}\"", conf.Options["PreBuildEvent"]); |
259 | } | 259 | } |
260 | if (conf.Options["PostBuildEvent"] != null && conf.Options["PostBuildEvent"].ToString().Length != 0) | 260 | if (conf.Options["PostBuildEvent"] != null && conf.Options["PostBuildEvent"].ToString().Length != 0) |
261 | { | 261 | { |
262 | ss.Write(" executeAfterBuild=\"{0}\"", Helper.NormalizePath(conf.Options["PostBuildEvent"].ToString())); | 262 | ss.Write(" executeAfterBuild=\"{0}\"", Helper.NormalizePath(conf.Options["PostBuildEvent"].ToString())); |
263 | } | 263 | } |
264 | else | 264 | else |
265 | { | 265 | { |
266 | ss.Write(" executeAfterBuild=\"{0}\"", conf.Options["PostBuildEvent"]); | 266 | ss.Write(" executeAfterBuild=\"{0}\"", conf.Options["PostBuildEvent"]); |
267 | } | 267 | } |
268 | ss.Write(" executeBeforeBuildArguments=\"{0}\"", conf.Options["PreBuildEventArgs"]); | 268 | ss.Write(" executeBeforeBuildArguments=\"{0}\"", conf.Options["PreBuildEventArgs"]); |
269 | ss.Write(" executeAfterBuildArguments=\"{0}\"", conf.Options["PreBuildEventArgs"]); | 269 | ss.Write(" executeAfterBuildArguments=\"{0}\"", conf.Options["PreBuildEventArgs"]); |
270 | ss.WriteLine(" />"); | 270 | ss.WriteLine(" />"); |
271 | ss.WriteLine(" </Configuration>"); | 271 | ss.WriteLine(" </Configuration>"); |
272 | 272 | ||
273 | count++; | 273 | count++; |
274 | } | 274 | } |
275 | ss.WriteLine(" </Configurations>"); | 275 | ss.WriteLine(" </Configurations>"); |
276 | ss.WriteLine("</Project>"); | 276 | ss.WriteLine("</Project>"); |
277 | } | 277 | } |
278 | 278 | ||
279 | m_Kernel.CurrentWorkingDirectory.Pop(); | 279 | m_Kernel.CurrentWorkingDirectory.Pop(); |
280 | } | 280 | } |
281 | 281 | ||
282 | private void WriteCombine(SolutionNode solution) | 282 | private void WriteCombine(SolutionNode solution) |
283 | { | 283 | { |
284 | m_Kernel.Log.Write("Creating SharpDevelop combine and project files"); | 284 | m_Kernel.Log.Write("Creating SharpDevelop combine and project files"); |
285 | foreach(ProjectNode project in solution.Projects) | 285 | foreach(ProjectNode project in solution.Projects) |
286 | { | 286 | { |
287 | if(m_Kernel.AllowProject(project.FilterGroups)) | 287 | if(m_Kernel.AllowProject(project.FilterGroups)) |
288 | { | 288 | { |
289 | m_Kernel.Log.Write("...Creating project: {0}", project.Name); | 289 | m_Kernel.Log.Write("...Creating project: {0}", project.Name); |
290 | WriteProject(solution, project); | 290 | WriteProject(solution, project); |
291 | } | 291 | } |
292 | } | 292 | } |
293 | 293 | ||
294 | m_Kernel.Log.Write(""); | 294 | m_Kernel.Log.Write(""); |
295 | string combFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "cmbx"); | 295 | string combFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "cmbx"); |
296 | StreamWriter ss = new StreamWriter(combFile); | 296 | StreamWriter ss = new StreamWriter(combFile); |
297 | 297 | ||
298 | m_Kernel.CurrentWorkingDirectory.Push(); | 298 | m_Kernel.CurrentWorkingDirectory.Push(); |
299 | Helper.SetCurrentDir(Path.GetDirectoryName(combFile)); | 299 | Helper.SetCurrentDir(Path.GetDirectoryName(combFile)); |
300 | 300 | ||
301 | using(ss) | 301 | using(ss) |
302 | { | 302 | { |
303 | ss.WriteLine("<Combine fileversion=\"1.0\" name=\"{0}\" description=\"\">", solution.Name); | 303 | ss.WriteLine("<Combine fileversion=\"1.0\" name=\"{0}\" description=\"\">", solution.Name); |
304 | 304 | ||
305 | int count = 0; | 305 | int count = 0; |
306 | foreach(ProjectNode project in solution.Projects) | 306 | foreach(ProjectNode project in solution.Projects) |
307 | { | 307 | { |
308 | if(count == 0) | 308 | if(count == 0) |
309 | ss.WriteLine(" <StartMode startupentry=\"{0}\" single=\"True\">", project.Name); | 309 | ss.WriteLine(" <StartMode startupentry=\"{0}\" single=\"True\">", project.Name); |
310 | 310 | ||
311 | ss.WriteLine(" <Execute entry=\"{0}\" type=\"None\" />", project.Name); | 311 | ss.WriteLine(" <Execute entry=\"{0}\" type=\"None\" />", project.Name); |
312 | count++; | 312 | count++; |
313 | } | 313 | } |
314 | ss.WriteLine(" </StartMode>"); | 314 | ss.WriteLine(" </StartMode>"); |
315 | 315 | ||
316 | ss.WriteLine(" <Entries>"); | 316 | ss.WriteLine(" <Entries>"); |
317 | foreach(ProjectNode project in solution.Projects) | 317 | foreach(ProjectNode project in solution.Projects) |
318 | { | 318 | { |
319 | string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath); | 319 | string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath); |
320 | ss.WriteLine(" <Entry filename=\"{0}\" />", | 320 | ss.WriteLine(" <Entry filename=\"{0}\" />", |
321 | Helper.MakeFilePath(path, project.Name, "prjx")); | 321 | Helper.MakeFilePath(path, project.Name, "prjx")); |
322 | } | 322 | } |
323 | ss.WriteLine(" </Entries>"); | 323 | ss.WriteLine(" </Entries>"); |
324 | 324 | ||
325 | count = 0; | 325 | count = 0; |
326 | foreach(ConfigurationNode conf in solution.Configurations) | 326 | foreach(ConfigurationNode conf in solution.Configurations) |
327 | { | 327 | { |
328 | if(count == 0) | 328 | if(count == 0) |
329 | { | 329 | { |
330 | ss.WriteLine(" <Configurations active=\"{0}\">", conf.Name); | 330 | ss.WriteLine(" <Configurations active=\"{0}\">", conf.Name); |
331 | } | 331 | } |
332 | 332 | ||
333 | ss.WriteLine(" <Configuration name=\"{0}\">", conf.Name); | 333 | ss.WriteLine(" <Configuration name=\"{0}\">", conf.Name); |
334 | foreach(ProjectNode project in solution.Projects) | 334 | foreach(ProjectNode project in solution.Projects) |
335 | { | 335 | { |
336 | ss.WriteLine(" <Entry name=\"{0}\" configurationname=\"{1}\" build=\"True\" />", project.Name, conf.Name); | 336 | ss.WriteLine(" <Entry name=\"{0}\" configurationname=\"{1}\" build=\"True\" />", project.Name, conf.Name); |
337 | } | 337 | } |
338 | ss.WriteLine(" </Configuration>"); | 338 | ss.WriteLine(" </Configuration>"); |
339 | 339 | ||
340 | count++; | 340 | count++; |
341 | } | 341 | } |
342 | ss.WriteLine(" </Configurations>"); | 342 | ss.WriteLine(" </Configurations>"); |
343 | ss.WriteLine("</Combine>"); | 343 | ss.WriteLine("</Combine>"); |
344 | } | 344 | } |
345 | 345 | ||
346 | m_Kernel.CurrentWorkingDirectory.Pop(); | 346 | m_Kernel.CurrentWorkingDirectory.Pop(); |
347 | } | 347 | } |
348 | 348 | ||
349 | private void CleanProject(ProjectNode project) | 349 | private void CleanProject(ProjectNode project) |
350 | { | 350 | { |
351 | m_Kernel.Log.Write("...Cleaning project: {0}", project.Name); | 351 | m_Kernel.Log.Write("...Cleaning project: {0}", project.Name); |
352 | string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, "prjx"); | 352 | string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, "prjx"); |
353 | Helper.DeleteIfExists(projectFile); | 353 | Helper.DeleteIfExists(projectFile); |
354 | } | 354 | } |
355 | 355 | ||
356 | private void CleanSolution(SolutionNode solution) | 356 | private void CleanSolution(SolutionNode solution) |
357 | { | 357 | { |
358 | m_Kernel.Log.Write("Cleaning SharpDevelop combine and project files for", solution.Name); | 358 | m_Kernel.Log.Write("Cleaning SharpDevelop combine and project files for", solution.Name); |
359 | 359 | ||
360 | string slnFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "cmbx"); | 360 | string slnFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "cmbx"); |
361 | Helper.DeleteIfExists(slnFile); | 361 | Helper.DeleteIfExists(slnFile); |
362 | 362 | ||
363 | foreach(ProjectNode project in solution.Projects) | 363 | foreach(ProjectNode project in solution.Projects) |
364 | { | 364 | { |
365 | CleanProject(project); | 365 | CleanProject(project); |
366 | } | 366 | } |
367 | 367 | ||
368 | m_Kernel.Log.Write(""); | 368 | m_Kernel.Log.Write(""); |
369 | } | 369 | } |
370 | 370 | ||
371 | #endregion | 371 | #endregion |
372 | 372 | ||
373 | #region ITarget Members | 373 | #region ITarget Members |
374 | 374 | ||
375 | /// <summary> | 375 | /// <summary> |
376 | /// Writes the specified kern. | 376 | /// Writes the specified kern. |
377 | /// </summary> | 377 | /// </summary> |
378 | /// <param name="kern">The kern.</param> | 378 | /// <param name="kern">The kern.</param> |
379 | public void Write(Kernel kern) | 379 | public void Write(Kernel kern) |
380 | { | 380 | { |
381 | if( kern == null ) | 381 | if( kern == null ) |
382 | { | 382 | { |
383 | throw new ArgumentNullException("kern"); | 383 | throw new ArgumentNullException("kern"); |
384 | } | 384 | } |
385 | m_Kernel = kern; | 385 | m_Kernel = kern; |
386 | foreach(SolutionNode solution in kern.Solutions) | 386 | foreach(SolutionNode solution in kern.Solutions) |
387 | { | 387 | { |
388 | WriteCombine(solution); | 388 | WriteCombine(solution); |
389 | } | 389 | } |
390 | m_Kernel = null; | 390 | m_Kernel = null; |
391 | } | 391 | } |
392 | 392 | ||
393 | /// <summary> | 393 | /// <summary> |
394 | /// Cleans the specified kern. | 394 | /// Cleans the specified kern. |
395 | /// </summary> | 395 | /// </summary> |
396 | /// <param name="kern">The kern.</param> | 396 | /// <param name="kern">The kern.</param> |
397 | public virtual void Clean(Kernel kern) | 397 | public virtual void Clean(Kernel kern) |
398 | { | 398 | { |
399 | if( kern == null ) | 399 | if( kern == null ) |
400 | { | 400 | { |
401 | throw new ArgumentNullException("kern"); | 401 | throw new ArgumentNullException("kern"); |
402 | } | 402 | } |
403 | m_Kernel = kern; | 403 | m_Kernel = kern; |
404 | foreach(SolutionNode sol in kern.Solutions) | 404 | foreach(SolutionNode sol in kern.Solutions) |
405 | { | 405 | { |
406 | CleanSolution(sol); | 406 | CleanSolution(sol); |
407 | } | 407 | } |
408 | m_Kernel = null; | 408 | m_Kernel = null; |
409 | } | 409 | } |
410 | 410 | ||
411 | /// <summary> | 411 | /// <summary> |
412 | /// Gets the name. | 412 | /// Gets the name. |
413 | /// </summary> | 413 | /// </summary> |
414 | /// <value>The name.</value> | 414 | /// <value>The name.</value> |
415 | public string Name | 415 | public string Name |
416 | { | 416 | { |
417 | get | 417 | get |
418 | { | 418 | { |
419 | return "sharpdev"; | 419 | return "sharpdev"; |
420 | } | 420 | } |
421 | } | 421 | } |
422 | 422 | ||
423 | #endregion | 423 | #endregion |
424 | } | 424 | } |
425 | } | 425 | } |