diff options
author | lbsa71 | 2009-02-19 14:54:21 +0000 |
---|---|---|
committer | lbsa71 | 2009-02-19 14:54:21 +0000 |
commit | 549c615e0e7fbc4fa284de533db673e7e2fd665b (patch) | |
tree | eb1b42f9ea8c581219a4f0743ea4e92d253037ee /Prebuild/src/Core/Targets | |
parent | * Changed all AssemblyInfo to explicit version 1.0.0.0 to not confuse poor po... (diff) | |
download | opensim-SC_OLD-549c615e0e7fbc4fa284de533db673e7e2fd665b.zip opensim-SC_OLD-549c615e0e7fbc4fa284de533db673e7e2fd665b.tar.gz opensim-SC_OLD-549c615e0e7fbc4fa284de533db673e7e2fd665b.tar.bz2 opensim-SC_OLD-549c615e0e7fbc4fa284de533db673e7e2fd665b.tar.xz |
* reverted the revert of the revert. What can I say? I'm calling this a day, and will get back up on the horse tomorrow.
Diffstat (limited to 'Prebuild/src/Core/Targets')
-rw-r--r-- | Prebuild/src/Core/Targets/AutotoolsTarget.cs | 112 | ||||
-rw-r--r-- | Prebuild/src/Core/Targets/DebugTarget.cs | 2 | ||||
-rw-r--r-- | Prebuild/src/Core/Targets/MonoDevelopTarget.cs | 9 | ||||
-rw-r--r-- | Prebuild/src/Core/Targets/NAntTarget.cs | 859 | ||||
-rw-r--r-- | Prebuild/src/Core/Targets/SharpDevelop2Target.cs | 33 | ||||
-rw-r--r-- | Prebuild/src/Core/Targets/SharpDevelopTarget.cs | 9 | ||||
-rw-r--r-- | Prebuild/src/Core/Targets/ToolInfo.cs | 197 | ||||
-rw-r--r-- | Prebuild/src/Core/Targets/VS2002Target.cs | 9 | ||||
-rw-r--r-- | Prebuild/src/Core/Targets/VS2003Target.cs | 31 | ||||
-rw-r--r-- | Prebuild/src/Core/Targets/VS2005Target.cs | 837 | ||||
-rw-r--r-- | Prebuild/src/Core/Targets/VS2008Target.cs | 152 | ||||
-rw-r--r-- | Prebuild/src/Core/Targets/VSGenericTarget.cs | 881 | ||||
-rw-r--r-- | Prebuild/src/Core/Targets/VSVersion.cs | 50 | ||||
-rw-r--r-- | Prebuild/src/Core/Targets/XcodeTarget.cs | 9 |
14 files changed, 1442 insertions, 1748 deletions
diff --git a/Prebuild/src/Core/Targets/AutotoolsTarget.cs b/Prebuild/src/Core/Targets/AutotoolsTarget.cs index 5dcbb38..f102038 100644 --- a/Prebuild/src/Core/Targets/AutotoolsTarget.cs +++ b/Prebuild/src/Core/Targets/AutotoolsTarget.cs | |||
@@ -65,9 +65,18 @@ POSSIBILITY OF SUCH DAMAGE. | |||
65 | */ | 65 | */ |
66 | 66 | ||
67 | #endregion | 67 | #endregion |
68 | |||
69 | #region CVS Information | ||
70 | /* | ||
71 | * $Source$ | ||
72 | * $Author: jendave $ | ||
73 | * $Date: 2006-07-28 22:43:24 -0700 (Fri, 28 Jul 2006) $ | ||
74 | * $Revision: 136 $ | ||
75 | */ | ||
76 | #endregion | ||
77 | |||
68 | using System; | 78 | using System; |
69 | using System.Collections; | 79 | using System.Collections; |
70 | using System.Collections.Generic; | ||
71 | using System.Collections.Specialized; | 80 | using System.Collections.Specialized; |
72 | using System.IO; | 81 | using System.IO; |
73 | using System.Reflection; | 82 | using System.Reflection; |
@@ -173,7 +182,8 @@ namespace Prebuild.Core.Targets | |||
173 | Hashtable assemblyPathToPackage = new Hashtable(); | 182 | Hashtable assemblyPathToPackage = new Hashtable(); |
174 | Hashtable assemblyFullNameToPath = new Hashtable(); | 183 | Hashtable assemblyFullNameToPath = new Hashtable(); |
175 | Hashtable packagesHash = new Hashtable(); | 184 | Hashtable packagesHash = new Hashtable(); |
176 | readonly List<SystemPackage> packages = new List<SystemPackage>(); | 185 | ArrayList packages = new ArrayList(); |
186 | ClrVersion currentVersion; | ||
177 | 187 | ||
178 | #endregion | 188 | #endregion |
179 | 189 | ||
@@ -193,6 +203,22 @@ namespace Prebuild.Core.Targets | |||
193 | di.Create(); | 203 | di.Create(); |
194 | } | 204 | } |
195 | 205 | ||
206 | private void mkStubFiles(string dirName, ArrayList fileNames) | ||
207 | { | ||
208 | for (int i = 0; i < fileNames.Count; i++) | ||
209 | { | ||
210 | string tmpFile = dirName + "/" + (string)fileNames[i]; | ||
211 | |||
212 | FileStream tmpFileStream = | ||
213 | new FileStream(tmpFile, FileMode.Create); | ||
214 | |||
215 | StreamWriter sw = new StreamWriter(tmpFileStream); | ||
216 | sw.WriteLine("These are not the files you are looking for."); | ||
217 | sw.Flush(); | ||
218 | tmpFileStream.Close(); | ||
219 | } | ||
220 | } | ||
221 | |||
196 | private void chkMkDir(string dirName) | 222 | private void chkMkDir(string dirName) |
197 | { | 223 | { |
198 | System.IO.DirectoryInfo di = | 224 | System.IO.DirectoryInfo di = |
@@ -247,11 +273,11 @@ namespace Prebuild.Core.Targets | |||
247 | } | 273 | } |
248 | } | 274 | } |
249 | 275 | ||
250 | private List<string> GetAssembliesWithLibInfo(string line, string file) | 276 | private ArrayList GetAssembliesWithLibInfo(string line, string file) |
251 | { | 277 | { |
252 | List<string> references = new List<string>(); | 278 | ArrayList references = new ArrayList(); |
253 | List<string> libdirs = new List<string>(); | 279 | ArrayList libdirs = new ArrayList(); |
254 | List<string> retval = new List<string>(); | 280 | ArrayList retval = new ArrayList(); |
255 | foreach (string piece in line.Split(' ')) | 281 | foreach (string piece in line.Split(' ')) |
256 | { | 282 | { |
257 | if (piece.ToLower().Trim().StartsWith("/r:") || piece.ToLower().Trim().StartsWith("-r:")) | 283 | if (piece.ToLower().Trim().StartsWith("/r:") || piece.ToLower().Trim().StartsWith("-r:")) |
@@ -278,9 +304,9 @@ namespace Prebuild.Core.Targets | |||
278 | return retval; | 304 | return retval; |
279 | } | 305 | } |
280 | 306 | ||
281 | private List<string> GetAssembliesWithoutLibInfo(string line, string file) | 307 | private ArrayList GetAssembliesWithoutLibInfo(string line, string file) |
282 | { | 308 | { |
283 | List<string> references = new List<string>(); | 309 | ArrayList references = new ArrayList(); |
284 | foreach (string reference in line.Split(' ')) | 310 | foreach (string reference in line.Split(' ')) |
285 | { | 311 | { |
286 | if (reference.ToLower().Trim().StartsWith("/r:") || reference.ToLower().Trim().StartsWith("-r:")) | 312 | if (reference.ToLower().Trim().StartsWith("/r:") || reference.ToLower().Trim().StartsWith("-r:")) |
@@ -330,7 +356,7 @@ namespace Prebuild.Core.Targets | |||
330 | if (packagesHash.Contains(pname)) | 356 | if (packagesHash.Contains(pname)) |
331 | return; | 357 | return; |
332 | 358 | ||
333 | List<string> fullassemblies = null; | 359 | ArrayList fullassemblies = null; |
334 | string version = ""; | 360 | string version = ""; |
335 | string desc = ""; | 361 | string desc = ""; |
336 | 362 | ||
@@ -378,7 +404,7 @@ namespace Prebuild.Core.Targets | |||
378 | package.Initialize(pname, | 404 | package.Initialize(pname, |
379 | version, | 405 | version, |
380 | desc, | 406 | desc, |
381 | fullassemblies.ToArray(), | 407 | (string[])fullassemblies.ToArray(typeof(string)), |
382 | ClrVersion.Default, | 408 | ClrVersion.Default, |
383 | false); | 409 | false); |
384 | packages.Add(package); | 410 | packages.Add(package); |
@@ -388,7 +414,7 @@ namespace Prebuild.Core.Targets | |||
388 | void RegisterSystemAssemblies(string prefix, string version, ClrVersion ver) | 414 | void RegisterSystemAssemblies(string prefix, string version, ClrVersion ver) |
389 | { | 415 | { |
390 | SystemPackage package = new SystemPackage(); | 416 | SystemPackage package = new SystemPackage(); |
391 | List<string> list = new List<string>(); | 417 | ArrayList list = new ArrayList(); |
392 | 418 | ||
393 | string dir = Path.Combine(prefix, version); | 419 | string dir = Path.Combine(prefix, version); |
394 | if (!Directory.Exists(dir)) | 420 | if (!Directory.Exists(dir)) |
@@ -405,7 +431,7 @@ namespace Prebuild.Core.Targets | |||
405 | package.Initialize("mono", | 431 | package.Initialize("mono", |
406 | version, | 432 | version, |
407 | "The Mono runtime", | 433 | "The Mono runtime", |
408 | list.ToArray(), | 434 | (string[])list.ToArray(typeof(string)), |
409 | ver, | 435 | ver, |
410 | false); | 436 | false); |
411 | packages.Add(package); | 437 | packages.Add(package); |
@@ -418,10 +444,12 @@ namespace Prebuild.Core.Targets | |||
418 | if (Environment.Version.Major == 1) | 444 | if (Environment.Version.Major == 1) |
419 | { | 445 | { |
420 | versionDir = "1.0"; | 446 | versionDir = "1.0"; |
447 | currentVersion = ClrVersion.Net_1_1; | ||
421 | } | 448 | } |
422 | else | 449 | else |
423 | { | 450 | { |
424 | versionDir = "2.0"; | 451 | versionDir = "2.0"; |
452 | currentVersion = ClrVersion.Net_2_0; | ||
425 | } | 453 | } |
426 | 454 | ||
427 | //Pull up assemblies from the installed mono system. | 455 | //Pull up assemblies from the installed mono system. |
@@ -455,9 +483,9 @@ namespace Prebuild.Core.Targets | |||
455 | } | 483 | } |
456 | } | 484 | } |
457 | search_dirs += Path.PathSeparator + libpath; | 485 | search_dirs += Path.PathSeparator + libpath; |
458 | if (!string.IsNullOrEmpty(search_dirs)) | 486 | if (search_dirs != null && search_dirs.Length > 0) |
459 | { | 487 | { |
460 | List<string> scanDirs = new List<string>(); | 488 | ArrayList scanDirs = new ArrayList(); |
461 | foreach (string potentialDir in search_dirs.Split(Path.PathSeparator)) | 489 | foreach (string potentialDir in search_dirs.Split(Path.PathSeparator)) |
462 | { | 490 | { |
463 | if (!scanDirs.Contains(potentialDir)) | 491 | if (!scanDirs.Contains(potentialDir)) |
@@ -735,22 +763,20 @@ namespace Prebuild.Core.Targets | |||
735 | bool hasAssemblyConfig = false; | 763 | bool hasAssemblyConfig = false; |
736 | chkMkDir(projectDir); | 764 | chkMkDir(projectDir); |
737 | 765 | ||
738 | List<string> | 766 | ArrayList |
739 | compiledFiles = new List<string>(), | 767 | compiledFiles = new ArrayList(), |
740 | contentFiles = new List<string>(), | 768 | contentFiles = new ArrayList(), |
741 | embeddedFiles = new List<string>(), | 769 | embeddedFiles = new ArrayList(), |
742 | |||
743 | binaryLibs = new List<string>(), | ||
744 | pkgLibs = new List<string>(), | ||
745 | systemLibs = new List<string>(), | ||
746 | runtimeLibs = new List<string>(), | ||
747 | 770 | ||
748 | extraDistFiles = new List<string>(), | 771 | binaryLibs = new ArrayList(), |
749 | localCopyTargets = new List<string>(); | 772 | pkgLibs = new ArrayList(), |
773 | systemLibs = new ArrayList(), | ||
774 | runtimeLibs = new ArrayList(), | ||
750 | 775 | ||
751 | // If there exists a .config file for this assembly, copy | 776 | extraDistFiles = new ArrayList(), |
752 | // it to the project folder | 777 | localCopyTargets = new ArrayList(); |
753 | 778 | ||
779 | // If there exists a .config file for this assembly, copy it to the project folder | ||
754 | // TODO: Support copying .config.osx files | 780 | // TODO: Support copying .config.osx files |
755 | // TODO: support processing the .config file for native library deps | 781 | // TODO: support processing the .config file for native library deps |
756 | string projectAssemblyName = project.Name; | 782 | string projectAssemblyName = project.Name; |
@@ -813,15 +839,11 @@ namespace Prebuild.Core.Targets | |||
813 | foreach (System.CodeDom.Compiler.CompilerError error in cr.Errors) | 839 | foreach (System.CodeDom.Compiler.CompilerError error in cr.Errors) |
814 | Console.WriteLine("Error! '{0}'", error.ErrorText); | 840 | Console.WriteLine("Error! '{0}'", error.ErrorText); |
815 | 841 | ||
816 | try { | 842 | string projectFullName = cr.CompiledAssembly.FullName; |
817 | string projectFullName = cr.CompiledAssembly.FullName; | 843 | Regex verRegex = new Regex("Version=([\\d\\.]+)"); |
818 | Regex verRegex = new Regex("Version=([\\d\\.]+)"); | 844 | Match verMatch = verRegex.Match(projectFullName); |
819 | Match verMatch = verRegex.Match(projectFullName); | 845 | if (verMatch.Success) |
820 | if (verMatch.Success) | ||
821 | projectVersion = verMatch.Groups[1].Value; | 846 | projectVersion = verMatch.Groups[1].Value; |
822 | }catch{ | ||
823 | Console.WriteLine("Couldn't compile AssemblyInfo.cs"); | ||
824 | } | ||
825 | 847 | ||
826 | // Clean up the temp file | 848 | // Clean up the temp file |
827 | try | 849 | try |
@@ -831,7 +853,7 @@ namespace Prebuild.Core.Targets | |||
831 | } | 853 | } |
832 | catch | 854 | catch |
833 | { | 855 | { |
834 | Console.WriteLine("Error! '{0}'", e.ToString()); | 856 | //Console.WriteLine("Error! '{0}'", e.ToString()); |
835 | } | 857 | } |
836 | 858 | ||
837 | } | 859 | } |
@@ -991,46 +1013,46 @@ namespace Prebuild.Core.Targets | |||
991 | } | 1013 | } |
992 | } | 1014 | } |
993 | 1015 | ||
994 | const string lineSep = " \\\n\t"; | 1016 | string lineSep = " \\\n\t"; |
995 | string compiledFilesString = string.Empty; | 1017 | string compiledFilesString = string.Empty; |
996 | if (compiledFiles.Count > 0) | 1018 | if (compiledFiles.Count > 0) |
997 | compiledFilesString = | 1019 | compiledFilesString = |
998 | lineSep + string.Join(lineSep, compiledFiles.ToArray()); | 1020 | lineSep + string.Join(lineSep, (string[])compiledFiles.ToArray(typeof(string))); |
999 | 1021 | ||
1000 | string embeddedFilesString = ""; | 1022 | string embeddedFilesString = ""; |
1001 | if (embeddedFiles.Count > 0) | 1023 | if (embeddedFiles.Count > 0) |
1002 | embeddedFilesString = | 1024 | embeddedFilesString = |
1003 | lineSep + string.Join(lineSep, embeddedFiles.ToArray()); | 1025 | lineSep + string.Join(lineSep, (string[])embeddedFiles.ToArray(typeof(string))); |
1004 | 1026 | ||
1005 | string contentFilesString = ""; | 1027 | string contentFilesString = ""; |
1006 | if (contentFiles.Count > 0) | 1028 | if (contentFiles.Count > 0) |
1007 | contentFilesString = | 1029 | contentFilesString = |
1008 | lineSep + string.Join(lineSep, contentFiles.ToArray()); | 1030 | lineSep + string.Join(lineSep, (string[])contentFiles.ToArray(typeof(string))); |
1009 | 1031 | ||
1010 | string extraDistFilesString = ""; | 1032 | string extraDistFilesString = ""; |
1011 | if (extraDistFiles.Count > 0) | 1033 | if (extraDistFiles.Count > 0) |
1012 | extraDistFilesString = | 1034 | extraDistFilesString = |
1013 | lineSep + string.Join(lineSep, extraDistFiles.ToArray()); | 1035 | lineSep + string.Join(lineSep, (string[])extraDistFiles.ToArray(typeof(string))); |
1014 | 1036 | ||
1015 | string pkgLibsString = ""; | 1037 | string pkgLibsString = ""; |
1016 | if (pkgLibs.Count > 0) | 1038 | if (pkgLibs.Count > 0) |
1017 | pkgLibsString = | 1039 | pkgLibsString = |
1018 | lineSep + string.Join(lineSep, pkgLibs.ToArray()); | 1040 | lineSep + string.Join(lineSep, (string[])pkgLibs.ToArray(typeof(string))); |
1019 | 1041 | ||
1020 | string binaryLibsString = ""; | 1042 | string binaryLibsString = ""; |
1021 | if (binaryLibs.Count > 0) | 1043 | if (binaryLibs.Count > 0) |
1022 | binaryLibsString = | 1044 | binaryLibsString = |
1023 | lineSep + string.Join(lineSep, binaryLibs.ToArray()); | 1045 | lineSep + string.Join(lineSep, (string[])binaryLibs.ToArray(typeof(string))); |
1024 | 1046 | ||
1025 | string systemLibsString = ""; | 1047 | string systemLibsString = ""; |
1026 | if (systemLibs.Count > 0) | 1048 | if (systemLibs.Count > 0) |
1027 | systemLibsString = | 1049 | systemLibsString = |
1028 | lineSep + string.Join(lineSep, systemLibs.ToArray()); | 1050 | lineSep + string.Join(lineSep, (string[])systemLibs.ToArray(typeof(string))); |
1029 | 1051 | ||
1030 | string localCopyTargetsString = ""; | 1052 | string localCopyTargetsString = ""; |
1031 | if (localCopyTargets.Count > 0) | 1053 | if (localCopyTargets.Count > 0) |
1032 | localCopyTargetsString = | 1054 | localCopyTargetsString = |
1033 | string.Join("\n", localCopyTargets.ToArray()); | 1055 | string.Join("\n", (string[])localCopyTargets.ToArray(typeof(string))); |
1034 | 1056 | ||
1035 | string monoPath = ""; | 1057 | string monoPath = ""; |
1036 | foreach (string runtimeLib in runtimeLibs) | 1058 | foreach (string runtimeLib in runtimeLibs) |
diff --git a/Prebuild/src/Core/Targets/DebugTarget.cs b/Prebuild/src/Core/Targets/DebugTarget.cs index dc4e666..db19e05 100644 --- a/Prebuild/src/Core/Targets/DebugTarget.cs +++ b/Prebuild/src/Core/Targets/DebugTarget.cs | |||
@@ -27,7 +27,7 @@ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY O | |||
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 16:42:51 +0900 (Wed, 20 Sep 2006) $ |
31 | * $Revision: 164 $ | 31 | * $Revision: 164 $ |
32 | */ | 32 | */ |
33 | #endregion | 33 | #endregion |
diff --git a/Prebuild/src/Core/Targets/MonoDevelopTarget.cs b/Prebuild/src/Core/Targets/MonoDevelopTarget.cs index c8401fd..5a5dc55 100644 --- a/Prebuild/src/Core/Targets/MonoDevelopTarget.cs +++ b/Prebuild/src/Core/Targets/MonoDevelopTarget.cs | |||
@@ -23,6 +23,15 @@ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY O | |||
23 | */ | 23 | */ |
24 | #endregion | 24 | #endregion |
25 | 25 | ||
26 | #region CVS Information | ||
27 | /* | ||
28 | * $Source$ | ||
29 | * $Author: cjcollier $ | ||
30 | * $Date: 2007-04-11 07:10:35 +0900 (Wed, 11 Apr 2007) $ | ||
31 | * $Revision: 231 $ | ||
32 | */ | ||
33 | #endregion | ||
34 | |||
26 | using System; | 35 | using System; |
27 | using System.Collections; | 36 | using System.Collections; |
28 | using System.Collections.Specialized; | 37 | using System.Collections.Specialized; |
diff --git a/Prebuild/src/Core/Targets/NAntTarget.cs b/Prebuild/src/Core/Targets/NAntTarget.cs index 9a6ee17..eb5325d 100644 --- a/Prebuild/src/Core/Targets/NAntTarget.cs +++ b/Prebuild/src/Core/Targets/NAntTarget.cs | |||
@@ -1,9 +1,9 @@ | |||
1 | #region BSD License | 1 | #region BSD License |
2 | /* | 2 | /* |
3 | Copyright (c) 2004 - 2008 | 3 | Copyright (c) 2004 - 2008 |
4 | Matthew Holmes (matthew@wildfiregames.com), | 4 | Matthew Holmes (matthew@wildfiregames.com), |
5 | Dan Moorehead (dan05a@gmail.com), | 5 | Dan Moorehead (dan05a@gmail.com), |
6 | C.J. Adams-Collier (cjac@colliertech.org), | 6 | C.J. Adams-Collier (cjac@colliertech.org), |
7 | 7 | ||
8 | Redistribution and use in source and binary forms, with or without | 8 | Redistribution and use in source and binary forms, with or without |
9 | modification, are permitted provided that the following conditions are | 9 | modification, are permitted provided that the following conditions are |
@@ -35,6 +35,15 @@ POSSIBILITY OF SUCH DAMAGE. | |||
35 | 35 | ||
36 | #endregion | 36 | #endregion |
37 | 37 | ||
38 | #region CVS Information | ||
39 | /* | ||
40 | * $Source$ | ||
41 | * $Author: cjcollier $ | ||
42 | * $Date: 2008-02-07 10:22:36 +0900 (Thu, 07 Feb 2008) $ | ||
43 | * $Revision: 255 $ | ||
44 | */ | ||
45 | #endregion | ||
46 | |||
38 | using System; | 47 | using System; |
39 | using System.Collections; | 48 | using System.Collections; |
40 | using System.Collections.Specialized; | 49 | using System.Collections.Specialized; |
@@ -49,73 +58,85 @@ using Prebuild.Core.Utilities; | |||
49 | 58 | ||
50 | namespace Prebuild.Core.Targets | 59 | namespace Prebuild.Core.Targets |
51 | { | 60 | { |
52 | /// <summary> | 61 | /// <summary> |
53 | /// | 62 | /// |
54 | /// </summary> | 63 | /// </summary> |
55 | [Target("nant")] | 64 | [Target("nant")] |
56 | public class NAntTarget : ITarget | 65 | public class NAntTarget : ITarget |
57 | { | 66 | { |
58 | #region Fields | 67 | #region Fields |
59 | 68 | ||
60 | private Kernel m_Kernel; | 69 | private Kernel m_Kernel; |
61 | 70 | ||
62 | #endregion | 71 | #endregion |
63 | 72 | ||
64 | #region Private Methods | 73 | #region Private Methods |
65 | 74 | ||
66 | private static string PrependPath(string path) | 75 | private static string PrependPath(string path) |
67 | { | 76 | { |
68 | string tmpPath = Helper.NormalizePath(path, '/'); | 77 | string tmpPath = Helper.NormalizePath(path, '/'); |
69 | Regex regex = new Regex(@"(\w):/(\w+)"); | 78 | Regex regex = new Regex(@"(\w):/(\w+)"); |
70 | Match match = regex.Match(tmpPath); | 79 | Match match = regex.Match(tmpPath); |
71 | //if(match.Success || tmpPath[0] == '.' || tmpPath[0] == '/') | 80 | //if(match.Success || tmpPath[0] == '.' || tmpPath[0] == '/') |
72 | //{ | 81 | //{ |
73 | tmpPath = Helper.NormalizePath(tmpPath); | 82 | tmpPath = Helper.NormalizePath(tmpPath); |
74 | //} | 83 | //} |
75 | // else | 84 | // else |
76 | // { | 85 | // { |
77 | // tmpPath = Helper.NormalizePath("./" + tmpPath); | 86 | // tmpPath = Helper.NormalizePath("./" + tmpPath); |
78 | // } | 87 | // } |
79 | 88 | ||
80 | return tmpPath; | 89 | return tmpPath; |
81 | } | 90 | } |
82 | 91 | ||
83 | private static string BuildReference(SolutionNode solution, ProjectNode currentProject, ReferenceNode refr) | 92 | private static string BuildReference(SolutionNode solution, ProjectNode currentProject, ReferenceNode refr) |
84 | { | 93 | { |
94 | string ret = ""; | ||
95 | string referencePath = ((ReferencePathNode)currentProject.ReferencePaths[0]).Path; | ||
85 | 96 | ||
86 | if (!String.IsNullOrEmpty(refr.Path)) | 97 | if (String.IsNullOrEmpty(refr.Path)) |
87 | { | 98 | { |
88 | return refr.Path; | 99 | if (solution.ProjectsTable.ContainsKey(refr.Name)) |
89 | } | 100 | { |
90 | 101 | ProjectNode project = (ProjectNode) solution.ProjectsTable[refr.Name]; | |
91 | if (solution.ProjectsTable.ContainsKey(refr.Name)) | 102 | string finalPath = |
92 | { | 103 | Helper.NormalizePath(referencePath + refr.Name + GetProjectExtension(project), '/'); |
93 | ProjectNode projectRef = (ProjectNode) solution.ProjectsTable[refr.Name]; | 104 | return finalPath; |
94 | string finalPath = | 105 | } |
95 | Helper.NormalizePath(refr.Name + GetProjectExtension(projectRef), '/'); | 106 | else |
96 | return finalPath; | 107 | { |
97 | } | 108 | ProjectNode project = (ProjectNode) refr.Parent; |
98 | 109 | ||
99 | ProjectNode project = (ProjectNode) refr.Parent; | 110 | // Do we have an explicit file reference? |
111 | string fileRef = FindFileReference(refr.Name, project); | ||
112 | if (fileRef != null) | ||
113 | { | ||
114 | return fileRef; | ||
115 | } | ||
100 | 116 | ||
101 | // Do we have an explicit file reference? | 117 | // Is there an explicit path in the project ref? |
102 | string fileRef = FindFileReference(refr.Name, project); | 118 | if (refr.Path != null) |
103 | if (fileRef != null) | 119 | { |
104 | { | 120 | return Helper.NormalizePath(refr.Path + "/" + refr.Name + GetProjectExtension(project), '/'); |
105 | return fileRef; | 121 | } |
106 | } | ||
107 | 122 | ||
108 | // Is there an explicit path in the project ref? | 123 | // Is it a specified extension (dll or exe?) |
109 | if (refr.Path != null) | 124 | if (ExtensionSpecified(refr.Name)) |
125 | { | ||
126 | return Helper.NormalizePath(referencePath + GetRefFileName(refr.Name), '/'); | ||
127 | } | ||
128 | |||
129 | // No, it's an extensionless GAC ref, but nant needs the .dll extension anyway | ||
130 | return refr.Name + ".dll"; | ||
131 | } | ||
132 | } | ||
133 | else | ||
110 | { | 134 | { |
111 | return Helper.NormalizePath(refr.Path + "/" + refr.Name + GetProjectExtension(project), '/'); | 135 | return refr.Path; |
112 | } | 136 | } |
113 | |||
114 | // No, it's an extensionless GAC ref, but nant needs the .dll extension anyway | ||
115 | return refr.Name + ".dll"; | ||
116 | } | 137 | } |
117 | 138 | ||
118 | public static string GetRefFileName(string refName) | 139 | public static string GetRefFileName(string refName) |
119 | { | 140 | { |
120 | if (ExtensionSpecified(refName)) | 141 | if (ExtensionSpecified(refName)) |
121 | { | 142 | { |
@@ -123,7 +144,7 @@ namespace Prebuild.Core.Targets | |||
123 | } | 144 | } |
124 | else | 145 | else |
125 | { | 146 | { |
126 | return refName + ".dll"; | 147 | return refName + ".dll"; |
127 | } | 148 | } |
128 | } | 149 | } |
129 | 150 | ||
@@ -135,235 +156,268 @@ namespace Prebuild.Core.Targets | |||
135 | private static string GetProjectExtension(ProjectNode project) | 156 | private static string GetProjectExtension(ProjectNode project) |
136 | { | 157 | { |
137 | string extension = ".dll"; | 158 | string extension = ".dll"; |
138 | if (project.Type == ProjectType.Exe || project.Type == ProjectType.WinExe) | 159 | if (project.Type == ProjectType.Exe) |
139 | { | 160 | { |
140 | extension = ".exe"; | 161 | extension = ".exe"; |
141 | } | 162 | } |
142 | return extension; | 163 | return extension; |
143 | } | 164 | } |
144 | 165 | ||
145 | private static string FindFileReference(string refName, ProjectNode project) | 166 | //private static string BuildReferencePath(SolutionNode solution, ReferenceNode refr) |
146 | { | 167 | //{ |
147 | foreach (ReferencePathNode refPath in project.ReferencePaths) | 168 | // string ret = ""; |
148 | { | 169 | // if (solution.ProjectsTable.ContainsKey(refr.Name)) |
149 | string fullPath = Helper.MakeFilePath(refPath.Path, refName); | 170 | // { |
171 | // ProjectNode project = (ProjectNode)solution.ProjectsTable[refr.Name]; | ||
172 | // string finalPath = Helper.NormalizePath(((ReferencePathNode)project.ReferencePaths[0]).Path, '/'); | ||
173 | // return finalPath; | ||
174 | // } | ||
175 | // else | ||
176 | // { | ||
177 | // if (refr.Path == null) | ||
178 | // { | ||
179 | // ProjectNode project = (ProjectNode) refr.Parent; | ||
180 | // string fileRef = FindFileReference(refr.Name, project); | ||
181 | |||
182 | // if (refr.Path != null || fileRef != null) | ||
183 | // { | ||
184 | // string finalPath = (refr.Path != null) ? Helper.NormalizePath(refr.Path, '/') : fileRef; | ||
185 | // ret += finalPath; | ||
186 | // return ret; | ||
187 | // } | ||
188 | |||
189 | // try | ||
190 | // { | ||
191 | // Assembly assem = Assembly.Load(refr.Name); | ||
192 | // if (assem != null) | ||
193 | // { | ||
194 | // ret += ""; | ||
195 | // } | ||
196 | // else | ||
197 | // { | ||
198 | // ret += ""; | ||
199 | // } | ||
200 | // } | ||
201 | // catch (System.NullReferenceException e) | ||
202 | // { | ||
203 | // e.ToString(); | ||
204 | // ret += ""; | ||
205 | // } | ||
206 | // } | ||
207 | // else | ||
208 | // { | ||
209 | // ret = refr.Path; | ||
210 | // } | ||
211 | // } | ||
212 | // return ret; | ||
213 | //} | ||
214 | |||
215 | private static string FindFileReference(string refName, ProjectNode project) | ||
216 | { | ||
217 | foreach (ReferencePathNode refPath in project.ReferencePaths) | ||
218 | { | ||
219 | string fullPath = Helper.MakeFilePath(refPath.Path, refName, "dll"); | ||
150 | 220 | ||
151 | if (File.Exists(fullPath)) | 221 | if (File.Exists(fullPath)) |
152 | { | 222 | { |
153 | return fullPath; | 223 | return fullPath; |
154 | } | 224 | } |
155 | 225 | ||
156 | fullPath = Helper.MakeFilePath(refPath.Path, refName, "dll"); | ||
157 | |||
158 | if (File.Exists(fullPath)) | ||
159 | { | ||
160 | return fullPath; | ||
161 | } | ||
162 | |||
163 | fullPath = Helper.MakeFilePath(refPath.Path, refName, "exe"); | 226 | fullPath = Helper.MakeFilePath(refPath.Path, refName, "exe"); |
164 | 227 | ||
165 | if (File.Exists(fullPath)) | 228 | if (File.Exists(fullPath)) |
166 | { | 229 | { |
167 | return fullPath; | 230 | return fullPath; |
168 | } | 231 | } |
169 | } | 232 | } |
170 | 233 | ||
171 | return null; | 234 | return null; |
172 | } | 235 | } |
173 | 236 | ||
174 | /// <summary> | 237 | /// <summary> |
175 | /// Gets the XML doc file. | 238 | /// Gets the XML doc file. |
176 | /// </summary> | 239 | /// </summary> |
177 | /// <param name="project">The project.</param> | 240 | /// <param name="project">The project.</param> |
178 | /// <param name="conf">The conf.</param> | 241 | /// <param name="conf">The conf.</param> |
179 | /// <returns></returns> | 242 | /// <returns></returns> |
180 | public static string GetXmlDocFile(ProjectNode project, ConfigurationNode conf) | 243 | public static string GetXmlDocFile(ProjectNode project, ConfigurationNode conf) |
181 | { | 244 | { |
182 | if (conf == null) | 245 | if (conf == null) |
183 | { | 246 | { |
184 | throw new ArgumentNullException("conf"); | 247 | throw new ArgumentNullException("conf"); |
185 | } | 248 | } |
186 | if (project == null) | 249 | if (project == null) |
187 | { | 250 | { |
188 | throw new ArgumentNullException("project"); | 251 | throw new ArgumentNullException("project"); |
189 | } | 252 | } |
190 | string docFile = (string)conf.Options["XmlDocFile"]; | 253 | string docFile = (string)conf.Options["XmlDocFile"]; |
191 | // if(docFile != null && docFile.Length == 0)//default to assembly name if not specified | 254 | // if(docFile != null && docFile.Length == 0)//default to assembly name if not specified |
192 | // { | 255 | // { |
193 | // return Path.GetFileNameWithoutExtension(project.AssemblyName) + ".xml"; | 256 | // return Path.GetFileNameWithoutExtension(project.AssemblyName) + ".xml"; |
194 | // } | 257 | // } |
195 | return docFile; | 258 | return docFile; |
196 | } | 259 | } |
197 | 260 | ||
198 | private void WriteProject(SolutionNode solution, ProjectNode project) | 261 | private void WriteProject(SolutionNode solution, ProjectNode project) |
199 | { | 262 | { |
200 | string projFile = Helper.MakeFilePath(project.FullPath, project.Name + GetProjectExtension(project), "build"); | 263 | string projFile = Helper.MakeFilePath(project.FullPath, project.Name + GetProjectExtension(project), "build"); |
201 | StreamWriter ss = new StreamWriter(projFile); | 264 | StreamWriter ss = new StreamWriter(projFile); |
202 | 265 | ||
203 | m_Kernel.CurrentWorkingDirectory.Push(); | 266 | m_Kernel.CurrentWorkingDirectory.Push(); |
204 | Helper.SetCurrentDir(Path.GetDirectoryName(projFile)); | 267 | Helper.SetCurrentDir(Path.GetDirectoryName(projFile)); |
205 | bool hasDoc = false; | 268 | bool hasDoc = false; |
206 | 269 | ||
207 | using (ss) | 270 | using (ss) |
208 | { | 271 | { |
209 | ss.WriteLine("<?xml version=\"1.0\" ?>"); | 272 | ss.WriteLine("<?xml version=\"1.0\" ?>"); |
210 | ss.WriteLine("<project name=\"{0}\" default=\"build\">", project.Name); | 273 | ss.WriteLine("<project name=\"{0}\" default=\"build\">", project.Name); |
211 | ss.WriteLine(" <target name=\"{0}\">", "build"); | 274 | ss.WriteLine(" <target name=\"{0}\">", "build"); |
212 | ss.WriteLine(" <echo message=\"Build Directory is ${project::get-base-directory()}/${build.dir}\" />"); | 275 | ss.WriteLine(" <echo message=\"Build Directory is ${project::get-base-directory()}/${build.dir}\" />"); |
213 | ss.WriteLine(" <mkdir dir=\"${project::get-base-directory()}/${build.dir}\" />"); | 276 | ss.WriteLine(" <mkdir dir=\"${project::get-base-directory()}/${build.dir}\" />"); |
214 | ss.WriteLine(" <copy todir=\"${project::get-base-directory()}/${build.dir}\" flatten=\"true\">"); | 277 | ss.WriteLine(" <copy todir=\"${project::get-base-directory()}/${build.dir}\" flatten=\"true\">"); |
215 | ss.WriteLine(" <fileset basedir=\"${project::get-base-directory()}\">"); | 278 | ss.WriteLine(" <fileset basedir=\"${project::get-base-directory()}\">"); |
216 | foreach (ReferenceNode refr in project.References) | 279 | foreach (ReferenceNode refr in project.References) |
217 | { | 280 | { |
218 | if (refr.LocalCopy) | 281 | if (refr.LocalCopy) |
219 | { | 282 | { |
220 | ss.WriteLine(" <include name=\"{0}", Helper.NormalizePath(Helper.MakePathRelativeTo(project.FullPath, BuildReference(solution, project, refr)) + "\" />", '/')); | 283 | ss.WriteLine(" <include name=\"{0}", Helper.NormalizePath(Helper.MakePathRelativeTo(project.FullPath, BuildReference(solution, project, refr)) + "\" />", '/')); |
221 | } | 284 | } |
222 | } | 285 | } |
223 | 286 | ||
224 | ss.WriteLine(" </fileset>"); | 287 | ss.WriteLine(" </fileset>"); |
225 | ss.WriteLine(" </copy>"); | 288 | ss.WriteLine(" </copy>"); |
226 | if (project.ConfigFile != null && project.ConfigFile.Length!=0) | 289 | if (project.ConfigFile != null && project.ConfigFile.Length!=0) |
227 | { | 290 | { |
228 | ss.Write(" <copy file=\"" + project.ConfigFile + "\" tofile=\"${project::get-base-directory()}/${build.dir}/${project::get-name()}"); | 291 | ss.Write(" <copy file=\"" + project.ConfigFile + "\" tofile=\"${project::get-base-directory()}/${build.dir}/${project::get-name()}"); |
229 | 292 | ||
230 | if (project.Type == ProjectType.Library) | 293 | if (project.Type == ProjectType.Library) |
231 | { | 294 | { |
232 | ss.Write(".dll.config\""); | 295 | ss.Write(".dll.config\""); |
233 | } | 296 | } |
234 | else | 297 | else |
235 | { | 298 | { |
236 | ss.Write(".exe.config\""); | 299 | ss.Write(".exe.config\""); |
237 | } | 300 | } |
238 | ss.WriteLine(" />"); | 301 | ss.WriteLine(" />"); |
239 | } | 302 | } |
240 | 303 | ||
241 | // Add the content files to just be copied | 304 | // Add the content files to just be copied |
242 | ss.WriteLine(" {0}", "<copy todir=\"${project::get-base-directory()}/${build.dir}\">"); | 305 | ss.WriteLine(" {0}", "<copy todir=\"${project::get-base-directory()}/${build.dir}\">"); |
243 | ss.WriteLine(" {0}", "<fileset basedir=\".\">"); | 306 | ss.WriteLine(" {0}", "<fileset basedir=\".\">"); |
244 | 307 | ||
245 | foreach (string file in project.Files) | 308 | foreach (string file in project.Files) |
246 | { | 309 | { |
247 | // Ignore if we aren't content | 310 | // Ignore if we aren't content |
248 | if (project.Files.GetBuildAction(file) != BuildAction.Content) | 311 | if (project.Files.GetBuildAction(file) != BuildAction.Content) |
249 | continue; | 312 | continue; |
250 | 313 | ||
251 | // Create a include tag | 314 | // Create a include tag |
252 | ss.WriteLine(" {0}", "<include name=\"" + Helper.NormalizePath(PrependPath(file), '/') + "\" />"); | 315 | ss.WriteLine(" {0}", "<include name=\"" + Helper.NormalizePath(PrependPath(file), '/') + "\" />"); |
253 | } | 316 | } |
254 | 317 | ||
255 | ss.WriteLine(" {0}", "</fileset>"); | 318 | ss.WriteLine(" {0}", "</fileset>"); |
256 | ss.WriteLine(" {0}", "</copy>"); | 319 | ss.WriteLine(" {0}", "</copy>"); |
257 | 320 | ||
258 | ss.Write(" <csc"); | 321 | ss.Write(" <csc"); |
259 | ss.Write(" target=\"{0}\"", project.Type.ToString().ToLower()); | 322 | ss.Write(" target=\"{0}\"", project.Type.ToString().ToLower()); |
260 | ss.Write(" debug=\"{0}\"", "${build.debug}"); | 323 | ss.Write(" debug=\"{0}\"", "${build.debug}"); |
261 | foreach (ConfigurationNode conf in project.Configurations) | 324 | foreach (ConfigurationNode conf in project.Configurations) |
262 | { | 325 | { |
263 | if (conf.Options.KeyFile != "") | 326 | if (conf.Options.KeyFile != "") |
264 | { | 327 | { |
265 | ss.Write(" keyfile=\"{0}\"", conf.Options.KeyFile); | 328 | ss.Write(" keyfile=\"{0}\"", conf.Options.KeyFile); |
266 | break; | 329 | break; |
267 | } | 330 | } |
268 | } | 331 | } |
269 | foreach (ConfigurationNode conf in project.Configurations) | 332 | foreach (ConfigurationNode conf in project.Configurations) |
270 | { | ||
271 | ss.Write(" unsafe=\"{0}\"", conf.Options.AllowUnsafe); | ||
272 | break; | ||
273 | } | ||
274 | foreach (ConfigurationNode conf in project.Configurations) | ||
275 | { | ||
276 | ss.Write(" warnaserror=\"{0}\"", conf.Options.WarningsAsErrors); | ||
277 | break; | ||
278 | } | ||
279 | foreach (ConfigurationNode conf in project.Configurations) | ||
280 | { | ||
281 | ss.Write(" define=\"{0}\"", conf.Options.CompilerDefines); | ||
282 | break; | ||
283 | } | ||
284 | foreach (ConfigurationNode conf in project.Configurations) | ||
285 | { | ||
286 | ss.Write(" nostdlib=\"{0}\"", conf.Options["NoStdLib"]); | ||
287 | break; | ||
288 | } | ||
289 | |||
290 | ss.Write(" main=\"{0}\"", project.StartupObject); | ||
291 | |||
292 | foreach (ConfigurationNode conf in project.Configurations) | ||
293 | { | ||
294 | if (GetXmlDocFile(project, conf) != "") | ||
295 | { | ||
296 | ss.Write(" doc=\"{0}\"", "${project::get-base-directory()}/${build.dir}/" + GetXmlDocFile(project, conf)); | ||
297 | hasDoc = true; | ||
298 | } | ||
299 | break; | ||
300 | } | ||
301 | ss.Write(" output=\"{0}", "${project::get-base-directory()}/${build.dir}/${project::get-name()}"); | ||
302 | if (project.Type == ProjectType.Library) | ||
303 | { | ||
304 | ss.Write(".dll\""); | ||
305 | } | ||
306 | else | ||
307 | { | ||
308 | ss.Write(".exe\""); | ||
309 | } | ||
310 | if (project.AppIcon != null && project.AppIcon.Length != 0) | ||
311 | { | ||
312 | ss.Write(" win32icon=\"{0}\"", Helper.NormalizePath(project.AppIcon, '/')); | ||
313 | } | ||
314 | ss.WriteLine(">"); | ||
315 | ss.WriteLine(" <resources prefix=\"{0}\" dynamicprefix=\"true\" >", project.RootNamespace); | ||
316 | foreach (string file in project.Files) | ||
317 | { | ||
318 | switch (project.Files.GetBuildAction(file)) | ||
319 | { | ||
320 | case BuildAction.EmbeddedResource: | ||
321 | ss.WriteLine(" {0}", "<include name=\"" + Helper.NormalizePath(PrependPath(file), '/') + "\" />"); | ||
322 | break; | ||
323 | default: | ||
324 | if (project.Files.GetSubType(file) != SubType.Code && project.Files.GetSubType(file) != SubType.Settings) | ||
325 | { | ||
326 | ss.WriteLine(" <include name=\"{0}\" />", file.Substring(0, file.LastIndexOf('.')) + ".resx"); | ||
327 | } | ||
328 | break; | ||
329 | } | ||
330 | } | ||
331 | //if (project.Files.GetSubType(file).ToString() != "Code") | ||
332 | //{ | ||
333 | // ps.WriteLine(" <EmbeddedResource Include=\"{0}\">", file.Substring(0, file.LastIndexOf('.')) + ".resx"); | ||
334 | |||
335 | ss.WriteLine(" </resources>"); | ||
336 | ss.WriteLine(" <sources failonempty=\"true\">"); | ||
337 | foreach (string file in project.Files) | ||
338 | { | ||
339 | switch (project.Files.GetBuildAction(file)) | ||
340 | { | ||
341 | case BuildAction.Compile: | ||
342 | ss.WriteLine(" <include name=\"" + Helper.NormalizePath(PrependPath(file), '/') + "\" />"); | ||
343 | break; | ||
344 | default: | ||
345 | break; | ||
346 | } | ||
347 | } | ||
348 | ss.WriteLine(" </sources>"); | ||
349 | ss.WriteLine(" <references basedir=\"${project::get-base-directory()}\">"); | ||
350 | ss.WriteLine(" <lib>"); | ||
351 | ss.WriteLine(" <include name=\"${project::get-base-directory()}\" />"); | ||
352 | foreach(ReferencePathNode refPath in project.ReferencePaths) | ||
353 | { | 333 | { |
354 | ss.WriteLine(" <include name=\"${project::get-base-directory()}/" + refPath.Path.TrimEnd('/', '\\') + "\" />"); | 334 | ss.Write(" unsafe=\"{0}\"", conf.Options.AllowUnsafe); |
335 | break; | ||
355 | } | 336 | } |
356 | ss.WriteLine(" </lib>"); | 337 | foreach (ConfigurationNode conf in project.Configurations) |
357 | foreach (ReferenceNode refr in project.References) | 338 | { |
358 | { | 339 | ss.Write(" warnaserror=\"{0}\"", conf.Options.WarningsAsErrors); |
359 | string path = Helper.NormalizePath(Helper.MakePathRelativeTo(project.FullPath, BuildReference(solution, project, refr)), '/'); | 340 | break; |
341 | } | ||
342 | foreach (ConfigurationNode conf in project.Configurations) | ||
343 | { | ||
344 | ss.Write(" define=\"{0}\"", conf.Options.CompilerDefines); | ||
345 | break; | ||
346 | } | ||
347 | ss.Write(" main=\"{0}\"", project.StartupObject); | ||
348 | |||
349 | foreach (ConfigurationNode conf in project.Configurations) | ||
350 | { | ||
351 | if (GetXmlDocFile(project, conf) != "") | ||
352 | { | ||
353 | ss.Write(" doc=\"{0}\"", "${project::get-base-directory()}/${build.dir}/" + GetXmlDocFile(project, conf)); | ||
354 | hasDoc = true; | ||
355 | } | ||
356 | break; | ||
357 | } | ||
358 | ss.Write(" output=\"{0}", "${project::get-base-directory()}/${build.dir}/${project::get-name()}"); | ||
359 | if (project.Type == ProjectType.Library) | ||
360 | { | ||
361 | ss.Write(".dll\""); | ||
362 | } | ||
363 | else | ||
364 | { | ||
365 | ss.Write(".exe\""); | ||
366 | } | ||
367 | if (project.AppIcon != null && project.AppIcon.Length != 0) | ||
368 | { | ||
369 | ss.Write(" win32icon=\"{0}\"", Helper.NormalizePath(project.AppIcon, '/')); | ||
370 | } | ||
371 | ss.WriteLine(">"); | ||
372 | ss.WriteLine(" <resources prefix=\"{0}\" dynamicprefix=\"true\" >", project.RootNamespace); | ||
373 | foreach (string file in project.Files) | ||
374 | { | ||
375 | switch (project.Files.GetBuildAction(file)) | ||
376 | { | ||
377 | case BuildAction.EmbeddedResource: | ||
378 | ss.WriteLine(" {0}", "<include name=\"" + Helper.NormalizePath(PrependPath(file), '/') + "\" />"); | ||
379 | break; | ||
380 | default: | ||
381 | if (project.Files.GetSubType(file) != SubType.Code && project.Files.GetSubType(file) != SubType.Settings) | ||
382 | { | ||
383 | ss.WriteLine(" <include name=\"{0}\" />", file.Substring(0, file.LastIndexOf('.')) + ".resx"); | ||
384 | } | ||
385 | break; | ||
386 | } | ||
387 | } | ||
388 | //if (project.Files.GetSubType(file).ToString() != "Code") | ||
389 | //{ | ||
390 | // ps.WriteLine(" <EmbeddedResource Include=\"{0}\">", file.Substring(0, file.LastIndexOf('.')) + ".resx"); | ||
391 | |||
392 | ss.WriteLine(" </resources>"); | ||
393 | ss.WriteLine(" <sources failonempty=\"true\">"); | ||
394 | foreach (string file in project.Files) | ||
395 | { | ||
396 | switch (project.Files.GetBuildAction(file)) | ||
397 | { | ||
398 | case BuildAction.Compile: | ||
399 | ss.WriteLine(" <include name=\"" + Helper.NormalizePath(PrependPath(file), '/') + "\" />"); | ||
400 | break; | ||
401 | default: | ||
402 | break; | ||
403 | } | ||
404 | } | ||
405 | ss.WriteLine(" </sources>"); | ||
406 | ss.WriteLine(" <references basedir=\"${project::get-base-directory()}\">"); | ||
407 | ss.WriteLine(" <lib>"); | ||
408 | ss.WriteLine(" <include name=\"${project::get-base-directory()}\" />"); | ||
409 | ss.WriteLine(" <include name=\"${project::get-base-directory()}/${build.dir}\" />"); | ||
410 | ss.WriteLine(" </lib>"); | ||
411 | foreach (ReferenceNode refr in project.References) | ||
412 | { | ||
413 | string path = Helper.NormalizePath(Helper.MakePathRelativeTo(project.FullPath, BuildReference(solution, project, refr)), '/'); | ||
360 | ss.WriteLine(" <include name=\"" + path + "\" />"); | 414 | ss.WriteLine(" <include name=\"" + path + "\" />"); |
361 | } | 415 | } |
362 | ss.WriteLine(" </references>"); | 416 | ss.WriteLine(" </references>"); |
363 | 417 | ||
364 | ss.WriteLine(" </csc>"); | 418 | ss.WriteLine(" </csc>"); |
365 | 419 | ||
366 | foreach (ConfigurationNode conf in project.Configurations) | 420 | foreach (ConfigurationNode conf in project.Configurations) |
367 | { | 421 | { |
368 | if (!String.IsNullOrEmpty(conf.Options.OutputPath)) | 422 | if (!String.IsNullOrEmpty(conf.Options.OutputPath)) |
369 | { | 423 | { |
@@ -378,160 +432,149 @@ namespace Prebuild.Core.Targets | |||
378 | ss.WriteLine(" <include name=\"*.dll\"/>"); | 432 | ss.WriteLine(" <include name=\"*.dll\"/>"); |
379 | ss.WriteLine(" <include name=\"*.exe\"/>"); | 433 | ss.WriteLine(" <include name=\"*.exe\"/>"); |
380 | ss.WriteLine(" <include name=\"*.mdb\" if='${build.debug}'/>"); | 434 | ss.WriteLine(" <include name=\"*.mdb\" if='${build.debug}'/>"); |
381 | ss.WriteLine(" <include name=\"*.pdb\" if='${build.debug}'/>"); | ||
382 | ss.WriteLine(" </fileset>"); | 435 | ss.WriteLine(" </fileset>"); |
383 | ss.WriteLine(" </copy>"); | 436 | ss.WriteLine(" </copy>"); |
384 | break; | 437 | break; |
385 | } | 438 | } |
386 | } | 439 | } |
387 | 440 | ||
388 | ss.WriteLine(" </target>"); | 441 | ss.WriteLine(" </target>"); |
389 | 442 | ||
390 | ss.WriteLine(" <target name=\"clean\">"); | 443 | ss.WriteLine(" <target name=\"clean\">"); |
391 | ss.WriteLine(" <delete dir=\"${bin.dir}\" failonerror=\"false\" />"); | 444 | ss.WriteLine(" <delete dir=\"${obj.dir}\" failonerror=\"false\" />"); |
392 | ss.WriteLine(" <delete dir=\"${obj.dir}\" failonerror=\"false\" />"); | 445 | ss.WriteLine(" <delete dir=\"${bin.dir}\" failonerror=\"false\" />"); |
393 | ss.WriteLine(" </target>"); | 446 | ss.WriteLine(" </target>"); |
394 | 447 | ||
395 | ss.WriteLine(" <target name=\"doc\" description=\"Creates documentation.\">"); | 448 | ss.WriteLine(" <target name=\"doc\" description=\"Creates documentation.\">"); |
396 | if (hasDoc) | 449 | if (hasDoc) |
397 | { | 450 | { |
398 | ss.WriteLine(" <property name=\"doc.target\" value=\"\" />"); | 451 | ss.WriteLine(" <property name=\"doc.target\" value=\"\" />"); |
399 | ss.WriteLine(" <if test=\"${platform::is-unix()}\">"); | 452 | ss.WriteLine(" <if test=\"${platform::is-unix()}\">"); |
400 | ss.WriteLine(" <property name=\"doc.target\" value=\"Web\" />"); | 453 | ss.WriteLine(" <property name=\"doc.target\" value=\"Web\" />"); |
401 | ss.WriteLine(" </if>"); | 454 | ss.WriteLine(" </if>"); |
402 | ss.WriteLine(" <ndoc failonerror=\"false\" verbose=\"true\">"); | 455 | ss.WriteLine(" <ndoc failonerror=\"false\" verbose=\"true\">"); |
403 | ss.WriteLine(" <assemblies basedir=\"${project::get-base-directory()}\">"); | 456 | ss.WriteLine(" <assemblies basedir=\"${project::get-base-directory()}\">"); |
404 | ss.Write(" <include name=\"${build.dir}/${project::get-name()}"); | 457 | ss.Write(" <include name=\"${build.dir}/${project::get-name()}"); |
405 | if (project.Type == ProjectType.Library) | 458 | if (project.Type == ProjectType.Library) |
406 | { | 459 | { |
407 | ss.WriteLine(".dll\" />"); | 460 | ss.WriteLine(".dll\" />"); |
408 | } | 461 | } |
409 | else | 462 | else |
410 | { | 463 | { |
411 | ss.WriteLine(".exe\" />"); | 464 | ss.WriteLine(".exe\" />"); |
412 | } | 465 | } |
413 | 466 | ||
414 | ss.WriteLine(" </assemblies>"); | 467 | ss.WriteLine(" </assemblies>"); |
415 | ss.WriteLine(" <summaries basedir=\"${project::get-base-directory()}\">"); | 468 | ss.WriteLine(" <summaries basedir=\"${project::get-base-directory()}\">"); |
416 | ss.WriteLine(" <include name=\"${build.dir}/${project::get-name()}.xml\"/>"); | 469 | ss.WriteLine(" <include name=\"${build.dir}/${project::get-name()}.xml\"/>"); |
417 | ss.WriteLine(" </summaries>"); | 470 | ss.WriteLine(" </summaries>"); |
418 | ss.WriteLine(" <referencepaths basedir=\"${project::get-base-directory()}\">"); | 471 | ss.WriteLine(" <referencepaths basedir=\"${project::get-base-directory()}\">"); |
419 | ss.WriteLine(" <include name=\"${build.dir}\" />"); | 472 | ss.WriteLine(" <include name=\"${build.dir}\" />"); |
420 | // foreach(ReferenceNode refr in project.References) | 473 | // foreach(ReferenceNode refr in project.References) |
421 | // { | 474 | // { |
422 | // string path = Helper.NormalizePath(Helper.MakePathRelativeTo(project.FullPath, BuildReferencePath(solution, refr)), '/'); | 475 | // string path = Helper.NormalizePath(Helper.MakePathRelativeTo(project.FullPath, BuildReferencePath(solution, refr)), '/'); |
423 | // if (path != "") | 476 | // if (path != "") |
424 | // { | 477 | // { |
425 | // ss.WriteLine(" <include name=\"{0}\" />", path); | 478 | // ss.WriteLine(" <include name=\"{0}\" />", path); |
426 | // } | 479 | // } |
427 | // } | 480 | // } |
428 | ss.WriteLine(" </referencepaths>"); | 481 | ss.WriteLine(" </referencepaths>"); |
429 | ss.WriteLine(" <documenters>"); | 482 | ss.WriteLine(" <documenters>"); |
430 | ss.WriteLine(" <documenter name=\"MSDN\">"); | 483 | ss.WriteLine(" <documenter name=\"MSDN\">"); |
431 | ss.WriteLine(" <property name=\"OutputDirectory\" value=\"${project::get-base-directory()}/${build.dir}/doc/${project::get-name()}\" />"); | 484 | ss.WriteLine(" <property name=\"OutputDirectory\" value=\"${project::get-base-directory()}/${build.dir}/doc/${project::get-name()}\" />"); |
432 | ss.WriteLine(" <property name=\"OutputTarget\" value=\"${doc.target}\" />"); | 485 | ss.WriteLine(" <property name=\"OutputTarget\" value=\"${doc.target}\" />"); |
433 | ss.WriteLine(" <property name=\"HtmlHelpName\" value=\"${project::get-name()}\" />"); | 486 | ss.WriteLine(" <property name=\"HtmlHelpName\" value=\"${project::get-name()}\" />"); |
434 | ss.WriteLine(" <property name=\"IncludeFavorites\" value=\"False\" />"); | 487 | ss.WriteLine(" <property name=\"IncludeFavorites\" value=\"False\" />"); |
435 | ss.WriteLine(" <property name=\"Title\" value=\"${project::get-name()} SDK Documentation\" />"); | 488 | ss.WriteLine(" <property name=\"Title\" value=\"${project::get-name()} SDK Documentation\" />"); |
436 | ss.WriteLine(" <property name=\"SplitTOCs\" value=\"False\" />"); | 489 | ss.WriteLine(" <property name=\"SplitTOCs\" value=\"False\" />"); |
437 | ss.WriteLine(" <property name=\"DefaulTOC\" value=\"\" />"); | 490 | ss.WriteLine(" <property name=\"DefaulTOC\" value=\"\" />"); |
438 | ss.WriteLine(" <property name=\"ShowVisualBasic\" value=\"True\" />"); | 491 | ss.WriteLine(" <property name=\"ShowVisualBasic\" value=\"True\" />"); |
439 | ss.WriteLine(" <property name=\"AutoDocumentConstructors\" value=\"True\" />"); | 492 | ss.WriteLine(" <property name=\"AutoDocumentConstructors\" value=\"True\" />"); |
440 | ss.WriteLine(" <property name=\"ShowMissingSummaries\" value=\"${build.debug}\" />"); | 493 | ss.WriteLine(" <property name=\"ShowMissingSummaries\" value=\"${build.debug}\" />"); |
441 | ss.WriteLine(" <property name=\"ShowMissingRemarks\" value=\"${build.debug}\" />"); | 494 | ss.WriteLine(" <property name=\"ShowMissingRemarks\" value=\"${build.debug}\" />"); |
442 | ss.WriteLine(" <property name=\"ShowMissingParams\" value=\"${build.debug}\" />"); | 495 | ss.WriteLine(" <property name=\"ShowMissingParams\" value=\"${build.debug}\" />"); |
443 | ss.WriteLine(" <property name=\"ShowMissingReturns\" value=\"${build.debug}\" />"); | 496 | ss.WriteLine(" <property name=\"ShowMissingReturns\" value=\"${build.debug}\" />"); |
444 | ss.WriteLine(" <property name=\"ShowMissingValues\" value=\"${build.debug}\" />"); | 497 | ss.WriteLine(" <property name=\"ShowMissingValues\" value=\"${build.debug}\" />"); |
445 | ss.WriteLine(" <property name=\"DocumentInternals\" value=\"False\" />"); | 498 | ss.WriteLine(" <property name=\"DocumentInternals\" value=\"False\" />"); |
446 | ss.WriteLine(" <property name=\"DocumentPrivates\" value=\"False\" />"); | 499 | ss.WriteLine(" <property name=\"DocumentPrivates\" value=\"False\" />"); |
447 | ss.WriteLine(" <property name=\"DocumentProtected\" value=\"True\" />"); | 500 | ss.WriteLine(" <property name=\"DocumentProtected\" value=\"True\" />"); |
448 | ss.WriteLine(" <property name=\"DocumentEmptyNamespaces\" value=\"${build.debug}\" />"); | 501 | ss.WriteLine(" <property name=\"DocumentEmptyNamespaces\" value=\"${build.debug}\" />"); |
449 | ss.WriteLine(" <property name=\"IncludeAssemblyVersion\" value=\"True\" />"); | 502 | ss.WriteLine(" <property name=\"IncludeAssemblyVersion\" value=\"True\" />"); |
450 | ss.WriteLine(" </documenter>"); | 503 | ss.WriteLine(" </documenter>"); |
451 | ss.WriteLine(" </documenters>"); | 504 | ss.WriteLine(" </documenters>"); |
452 | ss.WriteLine(" </ndoc>"); | 505 | ss.WriteLine(" </ndoc>"); |
453 | } | 506 | } |
454 | ss.WriteLine(" </target>"); | 507 | ss.WriteLine(" </target>"); |
455 | ss.WriteLine("</project>"); | 508 | ss.WriteLine("</project>"); |
456 | } | 509 | } |
457 | m_Kernel.CurrentWorkingDirectory.Pop(); | 510 | m_Kernel.CurrentWorkingDirectory.Pop(); |
458 | } | 511 | } |
459 | 512 | ||
460 | private void WriteCombine(SolutionNode solution) | 513 | private void WriteCombine(SolutionNode solution) |
461 | { | 514 | { |
462 | m_Kernel.Log.Write("Creating NAnt build files"); | 515 | m_Kernel.Log.Write("Creating NAnt build files"); |
463 | foreach (ProjectNode project in solution.Projects) | 516 | foreach (ProjectNode project in solution.Projects) |
464 | { | 517 | { |
465 | if (m_Kernel.AllowProject(project.FilterGroups)) | 518 | if (m_Kernel.AllowProject(project.FilterGroups)) |
466 | { | 519 | { |
467 | m_Kernel.Log.Write("...Creating project: {0}", project.Name); | 520 | m_Kernel.Log.Write("...Creating project: {0}", project.Name); |
468 | WriteProject(solution, project); | 521 | WriteProject(solution, project); |
469 | } | 522 | } |
470 | } | 523 | } |
471 | 524 | ||
472 | m_Kernel.Log.Write(""); | 525 | m_Kernel.Log.Write(""); |
473 | string combFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "build"); | 526 | string combFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "build"); |
474 | StreamWriter ss = new StreamWriter(combFile); | 527 | StreamWriter ss = new StreamWriter(combFile); |
475 | 528 | ||
476 | m_Kernel.CurrentWorkingDirectory.Push(); | 529 | m_Kernel.CurrentWorkingDirectory.Push(); |
477 | Helper.SetCurrentDir(Path.GetDirectoryName(combFile)); | 530 | Helper.SetCurrentDir(Path.GetDirectoryName(combFile)); |
478 | 531 | ||
479 | using (ss) | 532 | using (ss) |
480 | { | 533 | { |
481 | ss.WriteLine("<?xml version=\"1.0\" ?>"); | 534 | ss.WriteLine("<?xml version=\"1.0\" ?>"); |
482 | ss.WriteLine("<project name=\"{0}\" default=\"build\">", solution.Name); | 535 | ss.WriteLine("<project name=\"{0}\" default=\"build\">", solution.Name); |
483 | ss.WriteLine(" <echo message=\"Using '${nant.settings.currentframework}' Framework\"/>"); | 536 | ss.WriteLine(" <echo message=\"Using '${nant.settings.currentframework}' Framework\"/>"); |
484 | ss.WriteLine(); | 537 | ss.WriteLine(); |
485 | 538 | ||
486 | //ss.WriteLine(" <property name=\"dist.dir\" value=\"dist\" />"); | 539 | //ss.WriteLine(" <property name=\"dist.dir\" value=\"dist\" />"); |
487 | //ss.WriteLine(" <property name=\"source.dir\" value=\"source\" />"); | 540 | //ss.WriteLine(" <property name=\"source.dir\" value=\"source\" />"); |
488 | ss.WriteLine(" <property name=\"bin.dir\" value=\"bin\" />"); | 541 | ss.WriteLine(" <property name=\"bin.dir\" value=\"bin\" />"); |
489 | ss.WriteLine(" <property name=\"obj.dir\" value=\"obj\" />"); | 542 | ss.WriteLine(" <property name=\"obj.dir\" value=\"obj\" />"); |
490 | ss.WriteLine(" <property name=\"doc.dir\" value=\"doc\" />"); | 543 | ss.WriteLine(" <property name=\"doc.dir\" value=\"doc\" />"); |
491 | ss.WriteLine(" <property name=\"project.main.dir\" value=\"${project::get-base-directory()}\" />"); | 544 | ss.WriteLine(" <property name=\"project.main.dir\" value=\"${project::get-base-directory()}\" />"); |
492 | 545 | ||
493 | // actually use active config out of prebuild.xml | 546 | // actually use active config out of prebuild.xml |
494 | ss.WriteLine(" <property name=\"project.config\" value=\"{0}\" />", solution.ActiveConfig); | 547 | ss.WriteLine(" <property name=\"project.config\" value=\"{0}\" />", solution.ActiveConfig); |
495 | 548 | ||
496 | foreach (ConfigurationNode conf in solution.Configurations) | 549 | foreach (ConfigurationNode conf in solution.Configurations) |
497 | { | 550 | { |
498 | ss.WriteLine(); | 551 | ss.WriteLine(); |
499 | ss.WriteLine(" <target name=\"{0}\" description=\"\">", conf.Name); | 552 | ss.WriteLine(" <target name=\"{0}\" description=\"\">", conf.Name); |
500 | ss.WriteLine(" <property name=\"project.config\" value=\"{0}\" />", conf.Name); | 553 | ss.WriteLine(" <property name=\"project.config\" value=\"{0}\" />", conf.Name); |
501 | ss.WriteLine(" <property name=\"build.debug\" value=\"{0}\" />", conf.Options["DebugInformation"].ToString().ToLower()); | 554 | ss.WriteLine(" <property name=\"build.debug\" value=\"{0}\" />", conf.Options["DebugInformation"].ToString().ToLower()); |
502 | ss.WriteLine(" </target>"); | 555 | ss.WriteLine(" </target>"); |
503 | ss.WriteLine(); | 556 | ss.WriteLine(); |
504 | } | 557 | } |
505 | 558 | ||
506 | ss.WriteLine(" <target name=\"net-1.1\" description=\"Sets framework to .NET 1.1\">"); | 559 | ss.WriteLine(" <target name=\"net-1.1\" description=\"Sets framework to .NET 1.1\">"); |
507 | ss.WriteLine(" <property name=\"nant.settings.currentframework\" value=\"net-1.1\" />"); | 560 | ss.WriteLine(" <property name=\"nant.settings.currentframework\" value=\"net-1.1\" />"); |
508 | ss.WriteLine(" </target>"); | 561 | ss.WriteLine(" </target>"); |
509 | ss.WriteLine(); | 562 | ss.WriteLine(); |
510 | 563 | ||
511 | ss.WriteLine(" <target name=\"net-2.0\" description=\"Sets framework to .NET 2.0\">"); | 564 | ss.WriteLine(" <target name=\"net-2.0\" description=\"Sets framework to .NET 2.0\">"); |
512 | ss.WriteLine(" <property name=\"nant.settings.currentframework\" value=\"net-2.0\" />"); | 565 | ss.WriteLine(" <property name=\"nant.settings.currentframework\" value=\"net-2.0\" />"); |
513 | ss.WriteLine(" </target>"); | 566 | ss.WriteLine(" </target>"); |
514 | ss.WriteLine(); | 567 | ss.WriteLine(); |
515 | 568 | ||
516 | ss.WriteLine(" <target name=\"net-3.5\" description=\"Sets framework to .NET 3.5\">"); | 569 | ss.WriteLine(" <target name=\"mono-2.0\" description=\"Sets framework to mono 2.0\">"); |
517 | ss.WriteLine(" <property name=\"nant.settings.currentframework\" value=\"net-3.5\" />"); | 570 | ss.WriteLine(" <property name=\"nant.settings.currentframework\" value=\"mono-2.0\" />"); |
518 | ss.WriteLine(" </target>"); | 571 | ss.WriteLine(" </target>"); |
519 | ss.WriteLine(); | 572 | ss.WriteLine(); |
520 | 573 | ||
521 | ss.WriteLine(" <target name=\"mono-1.0\" description=\"Sets framework to mono 1.0\">"); | 574 | ss.WriteLine(" <target name=\"mono-1.0\" description=\"Sets framework to mono 1.0\">"); |
522 | ss.WriteLine(" <property name=\"nant.settings.currentframework\" value=\"mono-1.0\" />"); | 575 | ss.WriteLine(" <property name=\"nant.settings.currentframework\" value=\"mono-1.0\" />"); |
523 | ss.WriteLine(" </target>"); | 576 | ss.WriteLine(" </target>"); |
524 | ss.WriteLine(); | 577 | ss.WriteLine(); |
525 | |||
526 | ss.WriteLine(" <target name=\"mono-2.0\" description=\"Sets framework to mono 2.0\">"); | ||
527 | ss.WriteLine(" <property name=\"nant.settings.currentframework\" value=\"mono-2.0\" />"); | ||
528 | ss.WriteLine(" </target>"); | ||
529 | ss.WriteLine(); | ||
530 | |||
531 | ss.WriteLine(" <target name=\"mono-3.5\" description=\"Sets framework to mono 3.5\">"); | ||
532 | ss.WriteLine(" <property name=\"nant.settings.currentframework\" value=\"mono-3.5\" />"); | ||
533 | ss.WriteLine(" </target>"); | ||
534 | ss.WriteLine(); | ||
535 | 578 | ||
536 | ss.WriteLine(" <target name=\"init\" description=\"\">"); | 579 | ss.WriteLine(" <target name=\"init\" description=\"\">"); |
537 | ss.WriteLine(" <call target=\"${project.config}\" />"); | 580 | ss.WriteLine(" <call target=\"${project.config}\" />"); |
diff --git a/Prebuild/src/Core/Targets/SharpDevelop2Target.cs b/Prebuild/src/Core/Targets/SharpDevelop2Target.cs index 66dd1bc..0d78796 100644 --- a/Prebuild/src/Core/Targets/SharpDevelop2Target.cs +++ b/Prebuild/src/Core/Targets/SharpDevelop2Target.cs | |||
@@ -23,6 +23,15 @@ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY O | |||
23 | */ | 23 | */ |
24 | #endregion | 24 | #endregion |
25 | 25 | ||
26 | #region CVS Information | ||
27 | /* | ||
28 | * $Source$ | ||
29 | * $Author: jendave $ | ||
30 | * $Date: 2006-01-27 16:49:58 -0800 (Fri, 27 Jan 2006) $ | ||
31 | * $Revision: 71 $ | ||
32 | */ | ||
33 | #endregion | ||
34 | |||
26 | using System; | 35 | using System; |
27 | 36 | ||
28 | using Prebuild.Core.Attributes; | 37 | using Prebuild.Core.Attributes; |
@@ -34,38 +43,18 @@ namespace Prebuild.Core.Targets | |||
34 | /// </summary> | 43 | /// </summary> |
35 | [Target("sharpdev2")] | 44 | [Target("sharpdev2")] |
36 | public class SharpDevelop2Target : VS2005Target | 45 | public class SharpDevelop2Target : VS2005Target |
37 | { | 46 | { |
38 | #region Properties | 47 | protected override string VersionName |
39 | public override string VersionName | ||
40 | { | 48 | { |
41 | get | 49 | get |
42 | { | 50 | { |
43 | return "SharpDevelop2"; | 51 | return "SharpDevelop2"; |
44 | } | 52 | } |
45 | } | 53 | } |
46 | #endregion | ||
47 | 54 | ||
48 | #region Public Methods | 55 | #region Public Methods |
49 | 56 | ||
50 | /// <summary> | 57 | /// <summary> |
51 | /// Writes the specified kern. | ||
52 | /// </summary> | ||
53 | /// <param name="kern">The kern.</param> | ||
54 | public override void Write(Kernel kern) | ||
55 | { | ||
56 | base.Write(kern); | ||
57 | } | ||
58 | |||
59 | /// <summary> | ||
60 | /// Cleans the specified kern. | ||
61 | /// </summary> | ||
62 | /// <param name="kern">The kern.</param> | ||
63 | public override void Clean(Kernel kern) | ||
64 | { | ||
65 | base.Clean(kern); | ||
66 | } | ||
67 | |||
68 | /// <summary> | ||
69 | /// Gets the name. | 58 | /// Gets the name. |
70 | /// </summary> | 59 | /// </summary> |
71 | /// <value>The name.</value> | 60 | /// <value>The name.</value> |
diff --git a/Prebuild/src/Core/Targets/SharpDevelopTarget.cs b/Prebuild/src/Core/Targets/SharpDevelopTarget.cs index cf7ce02..6fe038b 100644 --- a/Prebuild/src/Core/Targets/SharpDevelopTarget.cs +++ b/Prebuild/src/Core/Targets/SharpDevelopTarget.cs | |||
@@ -23,6 +23,15 @@ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY O | |||
23 | */ | 23 | */ |
24 | #endregion | 24 | #endregion |
25 | 25 | ||
26 | #region CVS Information | ||
27 | /* | ||
28 | * $Source$ | ||
29 | * $Author: jendave $ | ||
30 | * $Date: 2007-02-14 05:58:03 +0900 (Wed, 14 Feb 2007) $ | ||
31 | * $Revision: 205 $ | ||
32 | */ | ||
33 | #endregion | ||
34 | |||
26 | using System; | 35 | using System; |
27 | using System.Collections; | 36 | using System.Collections; |
28 | using System.Collections.Specialized; | 37 | using System.Collections.Specialized; |
diff --git a/Prebuild/src/Core/Targets/ToolInfo.cs b/Prebuild/src/Core/Targets/ToolInfo.cs deleted file mode 100644 index 935c674..0000000 --- a/Prebuild/src/Core/Targets/ToolInfo.cs +++ /dev/null | |||
@@ -1,197 +0,0 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | |||
5 | namespace Prebuild.Core.Targets | ||
6 | { | ||
7 | /// <summary> | ||
8 | /// | ||
9 | /// </summary> | ||
10 | public struct ToolInfo | ||
11 | { | ||
12 | string name; | ||
13 | string guid; | ||
14 | string fileExtension; | ||
15 | string xmlTag; | ||
16 | string importProject; | ||
17 | |||
18 | /// <summary> | ||
19 | /// Gets or sets the name. | ||
20 | /// </summary> | ||
21 | /// <value>The name.</value> | ||
22 | public string Name | ||
23 | { | ||
24 | get | ||
25 | { | ||
26 | return name; | ||
27 | } | ||
28 | set | ||
29 | { | ||
30 | name = value; | ||
31 | } | ||
32 | } | ||
33 | |||
34 | /// <summary> | ||
35 | /// Gets or sets the GUID. | ||
36 | /// </summary> | ||
37 | /// <value>The GUID.</value> | ||
38 | public string Guid | ||
39 | { | ||
40 | get | ||
41 | { | ||
42 | return guid; | ||
43 | } | ||
44 | set | ||
45 | { | ||
46 | guid = value; | ||
47 | } | ||
48 | } | ||
49 | |||
50 | /// <summary> | ||
51 | /// Gets or sets the file extension. | ||
52 | /// </summary> | ||
53 | /// <value>The file extension.</value> | ||
54 | public string FileExtension | ||
55 | { | ||
56 | get | ||
57 | { | ||
58 | return fileExtension; | ||
59 | } | ||
60 | set | ||
61 | { | ||
62 | fileExtension = value; | ||
63 | } | ||
64 | } | ||
65 | public string LanguageExtension | ||
66 | { | ||
67 | get | ||
68 | { | ||
69 | switch (this.Name) | ||
70 | { | ||
71 | case "C#": | ||
72 | return ".cs"; | ||
73 | case "VisualBasic": | ||
74 | return ".vb"; | ||
75 | case "Boo": | ||
76 | return ".boo"; | ||
77 | default: | ||
78 | return ".cs"; | ||
79 | } | ||
80 | } | ||
81 | } | ||
82 | /// <summary> | ||
83 | /// Gets or sets the XML tag. | ||
84 | /// </summary> | ||
85 | /// <value>The XML tag.</value> | ||
86 | public string XmlTag | ||
87 | { | ||
88 | get | ||
89 | { | ||
90 | return xmlTag; | ||
91 | } | ||
92 | set | ||
93 | { | ||
94 | xmlTag = value; | ||
95 | } | ||
96 | } | ||
97 | |||
98 | /// <summary> | ||
99 | /// Gets or sets the import project property. | ||
100 | /// </summary> | ||
101 | /// <value>The ImportProject tag.</value> | ||
102 | public string ImportProject | ||
103 | { | ||
104 | get | ||
105 | { | ||
106 | return importProject; | ||
107 | } | ||
108 | set | ||
109 | { | ||
110 | importProject = value; | ||
111 | } | ||
112 | } | ||
113 | |||
114 | /// <summary> | ||
115 | /// Initializes a new instance of the <see cref="ToolInfo"/> class. | ||
116 | /// </summary> | ||
117 | /// <param name="name">The name.</param> | ||
118 | /// <param name="guid">The GUID.</param> | ||
119 | /// <param name="fileExtension">The file extension.</param> | ||
120 | /// <param name="xml">The XML.</param> | ||
121 | /// <param name="importProject">The import project.</param> | ||
122 | public ToolInfo(string name, string guid, string fileExtension, string xml, string importProject) | ||
123 | { | ||
124 | this.name = name; | ||
125 | this.guid = guid; | ||
126 | this.fileExtension = fileExtension; | ||
127 | this.xmlTag = xml; | ||
128 | this.importProject = importProject; | ||
129 | } | ||
130 | |||
131 | /// <summary> | ||
132 | /// Initializes a new instance of the <see cref="ToolInfo"/> class. | ||
133 | /// </summary> | ||
134 | /// <param name="name">The name.</param> | ||
135 | /// <param name="guid">The GUID.</param> | ||
136 | /// <param name="fileExtension">The file extension.</param> | ||
137 | /// <param name="xml">The XML.</param> | ||
138 | public ToolInfo(string name, string guid, string fileExtension, string xml) | ||
139 | { | ||
140 | this.name = name; | ||
141 | this.guid = guid; | ||
142 | this.fileExtension = fileExtension; | ||
143 | this.xmlTag = xml; | ||
144 | this.importProject = "$(MSBuildBinPath)\\Microsoft." + xml + ".Targets"; | ||
145 | } | ||
146 | |||
147 | /// <summary> | ||
148 | /// Equals operator | ||
149 | /// </summary> | ||
150 | /// <param name="obj">ToolInfo to compare</param> | ||
151 | /// <returns>true if toolInfos are equal</returns> | ||
152 | public override bool Equals(object obj) | ||
153 | { | ||
154 | if (obj == null) | ||
155 | { | ||
156 | throw new ArgumentNullException("obj"); | ||
157 | } | ||
158 | if (obj.GetType() != typeof(ToolInfo)) | ||
159 | return false; | ||
160 | |||
161 | ToolInfo c = (ToolInfo)obj; | ||
162 | return ((this.name == c.name) && (this.guid == c.guid) && (this.fileExtension == c.fileExtension) && (this.importProject == c.importProject)); | ||
163 | } | ||
164 | |||
165 | /// <summary> | ||
166 | /// Equals operator | ||
167 | /// </summary> | ||
168 | /// <param name="c1">ToolInfo to compare</param> | ||
169 | /// <param name="c2">ToolInfo to compare</param> | ||
170 | /// <returns>True if toolInfos are equal</returns> | ||
171 | public static bool operator ==(ToolInfo c1, ToolInfo c2) | ||
172 | { | ||
173 | return ((c1.name == c2.name) && (c1.guid == c2.guid) && (c1.fileExtension == c2.fileExtension) && (c1.importProject == c2.importProject) && (c1.xmlTag == c2.xmlTag)); | ||
174 | } | ||
175 | |||
176 | /// <summary> | ||
177 | /// Not equals operator | ||
178 | /// </summary> | ||
179 | /// <param name="c1">ToolInfo to compare</param> | ||
180 | /// <param name="c2">ToolInfo to compare</param> | ||
181 | /// <returns>True if toolInfos are not equal</returns> | ||
182 | public static bool operator !=(ToolInfo c1, ToolInfo c2) | ||
183 | { | ||
184 | return !(c1 == c2); | ||
185 | } | ||
186 | |||
187 | /// <summary> | ||
188 | /// Hash Code | ||
189 | /// </summary> | ||
190 | /// <returns>Hash code</returns> | ||
191 | public override int GetHashCode() | ||
192 | { | ||
193 | return name.GetHashCode() ^ guid.GetHashCode() ^ this.fileExtension.GetHashCode() ^ this.importProject.GetHashCode() ^ this.xmlTag.GetHashCode(); | ||
194 | |||
195 | } | ||
196 | } | ||
197 | } | ||
diff --git a/Prebuild/src/Core/Targets/VS2002Target.cs b/Prebuild/src/Core/Targets/VS2002Target.cs index 2292624..7067cf3 100644 --- a/Prebuild/src/Core/Targets/VS2002Target.cs +++ b/Prebuild/src/Core/Targets/VS2002Target.cs | |||
@@ -23,6 +23,15 @@ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY O | |||
23 | */ | 23 | */ |
24 | #endregion | 24 | #endregion |
25 | 25 | ||
26 | #region CVS Information | ||
27 | /* | ||
28 | * $Source$ | ||
29 | * $Author: jendave $ | ||
30 | * $Date: 2006-01-28 09:49:58 +0900 (Sat, 28 Jan 2006) $ | ||
31 | * $Revision: 71 $ | ||
32 | */ | ||
33 | #endregion | ||
34 | |||
26 | using System; | 35 | using System; |
27 | 36 | ||
28 | using Prebuild.Core.Attributes; | 37 | using Prebuild.Core.Attributes; |
diff --git a/Prebuild/src/Core/Targets/VS2003Target.cs b/Prebuild/src/Core/Targets/VS2003Target.cs index 1bcb7dc..4bf05cb 100644 --- a/Prebuild/src/Core/Targets/VS2003Target.cs +++ b/Prebuild/src/Core/Targets/VS2003Target.cs | |||
@@ -23,6 +23,15 @@ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY O | |||
23 | */ | 23 | */ |
24 | #endregion | 24 | #endregion |
25 | 25 | ||
26 | #region CVS Information | ||
27 | /* | ||
28 | * $Source$ | ||
29 | * $Author: jendave $ | ||
30 | * $Date: 2006-09-30 04:11:40 +0900 (Sat, 30 Sep 2006) $ | ||
31 | * $Revision: 177 $ | ||
32 | */ | ||
33 | #endregion | ||
34 | |||
26 | using System; | 35 | using System; |
27 | using System.Collections; | 36 | using System.Collections; |
28 | using System.Collections.Specialized; | 37 | using System.Collections.Specialized; |
@@ -35,6 +44,28 @@ using Prebuild.Core.Utilities; | |||
35 | 44 | ||
36 | namespace Prebuild.Core.Targets | 45 | namespace Prebuild.Core.Targets |
37 | { | 46 | { |
47 | /// <summary> | ||
48 | /// | ||
49 | /// </summary> | ||
50 | public enum VSVersion | ||
51 | { | ||
52 | /// <summary> | ||
53 | /// | ||
54 | /// </summary> | ||
55 | VS70, | ||
56 | /// <summary> | ||
57 | /// | ||
58 | /// </summary> | ||
59 | VS71, | ||
60 | /// <summary> | ||
61 | /// | ||
62 | /// </summary> | ||
63 | VS80 | ||
64 | } | ||
65 | |||
66 | /// <summary> | ||
67 | /// | ||
68 | /// </summary> | ||
38 | [Target("vs2003")] | 69 | [Target("vs2003")] |
39 | public class VS2003Target : ITarget | 70 | public class VS2003Target : ITarget |
40 | { | 71 | { |
diff --git a/Prebuild/src/Core/Targets/VS2005Target.cs b/Prebuild/src/Core/Targets/VS2005Target.cs index 63461c9..5b7ad07 100644 --- a/Prebuild/src/Core/Targets/VS2005Target.cs +++ b/Prebuild/src/Core/Targets/VS2005Target.cs | |||
@@ -23,6 +23,15 @@ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY O | |||
23 | */ | 23 | */ |
24 | #endregion | 24 | #endregion |
25 | 25 | ||
26 | #region CVS Information | ||
27 | /* | ||
28 | * $Source$ | ||
29 | * $Author: borrillis $ | ||
30 | * $Date: 2007-05-25 01:03:16 +0900 (Fri, 25 May 2007) $ | ||
31 | * $Revision: 243 $ | ||
32 | */ | ||
33 | #endregion | ||
34 | |||
26 | using System; | 35 | using System; |
27 | using System.Collections; | 36 | using System.Collections; |
28 | using System.Collections.Specialized; | 37 | using System.Collections.Specialized; |
@@ -39,8 +48,182 @@ namespace Prebuild.Core.Targets | |||
39 | /// <summary> | 48 | /// <summary> |
40 | /// | 49 | /// |
41 | /// </summary> | 50 | /// </summary> |
51 | public struct ToolInfo | ||
52 | { | ||
53 | string name; | ||
54 | string guid; | ||
55 | string fileExtension; | ||
56 | string xmlTag; | ||
57 | string importProject; | ||
58 | |||
59 | /// <summary> | ||
60 | /// Gets or sets the name. | ||
61 | /// </summary> | ||
62 | /// <value>The name.</value> | ||
63 | public string Name | ||
64 | { | ||
65 | get | ||
66 | { | ||
67 | return name; | ||
68 | } | ||
69 | set | ||
70 | { | ||
71 | name = value; | ||
72 | } | ||
73 | } | ||
74 | |||
75 | /// <summary> | ||
76 | /// Gets or sets the GUID. | ||
77 | /// </summary> | ||
78 | /// <value>The GUID.</value> | ||
79 | public string Guid | ||
80 | { | ||
81 | get | ||
82 | { | ||
83 | return guid; | ||
84 | } | ||
85 | set | ||
86 | { | ||
87 | guid = value; | ||
88 | } | ||
89 | } | ||
90 | |||
91 | /// <summary> | ||
92 | /// Gets or sets the file extension. | ||
93 | /// </summary> | ||
94 | /// <value>The file extension.</value> | ||
95 | public string FileExtension | ||
96 | { | ||
97 | get | ||
98 | { | ||
99 | return fileExtension; | ||
100 | } | ||
101 | set | ||
102 | { | ||
103 | fileExtension = value; | ||
104 | } | ||
105 | } | ||
106 | /// <summary> | ||
107 | /// Gets or sets the XML tag. | ||
108 | /// </summary> | ||
109 | /// <value>The XML tag.</value> | ||
110 | public string XmlTag | ||
111 | { | ||
112 | get | ||
113 | { | ||
114 | return xmlTag; | ||
115 | } | ||
116 | set | ||
117 | { | ||
118 | xmlTag = value; | ||
119 | } | ||
120 | } | ||
121 | |||
122 | /// <summary> | ||
123 | /// Gets or sets the import project property. | ||
124 | /// </summary> | ||
125 | /// <value>The ImportProject tag.</value> | ||
126 | public string ImportProject | ||
127 | { | ||
128 | get | ||
129 | { | ||
130 | return importProject; | ||
131 | } | ||
132 | set | ||
133 | { | ||
134 | importProject = value; | ||
135 | } | ||
136 | } | ||
137 | |||
138 | /// <summary> | ||
139 | /// Initializes a new instance of the <see cref="ToolInfo"/> class. | ||
140 | /// </summary> | ||
141 | /// <param name="name">The name.</param> | ||
142 | /// <param name="guid">The GUID.</param> | ||
143 | /// <param name="fileExtension">The file extension.</param> | ||
144 | /// <param name="xml">The XML.</param> | ||
145 | /// <param name="importProject">The import project.</param> | ||
146 | public ToolInfo(string name, string guid, string fileExtension, string xml, string importProject) | ||
147 | { | ||
148 | this.name = name; | ||
149 | this.guid = guid; | ||
150 | this.fileExtension = fileExtension; | ||
151 | this.xmlTag = xml; | ||
152 | this.importProject = importProject; | ||
153 | } | ||
154 | |||
155 | /// <summary> | ||
156 | /// Initializes a new instance of the <see cref="ToolInfo"/> class. | ||
157 | /// </summary> | ||
158 | /// <param name="name">The name.</param> | ||
159 | /// <param name="guid">The GUID.</param> | ||
160 | /// <param name="fileExtension">The file extension.</param> | ||
161 | /// <param name="xml">The XML.</param> | ||
162 | public ToolInfo(string name, string guid, string fileExtension, string xml) | ||
163 | { | ||
164 | this.name = name; | ||
165 | this.guid = guid; | ||
166 | this.fileExtension = fileExtension; | ||
167 | this.xmlTag = xml; | ||
168 | this.importProject = "$(MSBuildBinPath)\\Microsoft." + xml + ".Targets"; | ||
169 | } | ||
170 | |||
171 | /// <summary> | ||
172 | /// Equals operator | ||
173 | /// </summary> | ||
174 | /// <param name="obj">ToolInfo to compare</param> | ||
175 | /// <returns>true if toolInfos are equal</returns> | ||
176 | public override bool Equals(object obj) | ||
177 | { | ||
178 | if (obj == null) | ||
179 | { | ||
180 | throw new ArgumentNullException("obj"); | ||
181 | } | ||
182 | if (obj.GetType() != typeof(ToolInfo)) | ||
183 | return false; | ||
184 | |||
185 | ToolInfo c = (ToolInfo)obj; | ||
186 | return ((this.name == c.name) && (this.guid == c.guid) && (this.fileExtension == c.fileExtension) && (this.importProject == c.importProject)); | ||
187 | } | ||
188 | |||
189 | /// <summary> | ||
190 | /// Equals operator | ||
191 | /// </summary> | ||
192 | /// <param name="c1">ToolInfo to compare</param> | ||
193 | /// <param name="c2">ToolInfo to compare</param> | ||
194 | /// <returns>True if toolInfos are equal</returns> | ||
195 | public static bool operator ==(ToolInfo c1, ToolInfo c2) | ||
196 | { | ||
197 | return ((c1.name == c2.name) && (c1.guid == c2.guid) && (c1.fileExtension == c2.fileExtension) && (c1.importProject == c2.importProject) && (c1.xmlTag == c2.xmlTag)); | ||
198 | } | ||
199 | |||
200 | /// <summary> | ||
201 | /// Not equals operator | ||
202 | /// </summary> | ||
203 | /// <param name="c1">ToolInfo to compare</param> | ||
204 | /// <param name="c2">ToolInfo to compare</param> | ||
205 | /// <returns>True if toolInfos are not equal</returns> | ||
206 | public static bool operator !=(ToolInfo c1, ToolInfo c2) | ||
207 | { | ||
208 | return !(c1 == c2); | ||
209 | } | ||
210 | |||
211 | /// <summary> | ||
212 | /// Hash Code | ||
213 | /// </summary> | ||
214 | /// <returns>Hash code</returns> | ||
215 | public override int GetHashCode() | ||
216 | { | ||
217 | return name.GetHashCode() ^ guid.GetHashCode() ^ this.fileExtension.GetHashCode() ^ this.importProject.GetHashCode() ^ this.xmlTag.GetHashCode(); | ||
218 | |||
219 | } | ||
220 | } | ||
221 | |||
222 | /// <summary> | ||
223 | /// | ||
224 | /// </summary> | ||
42 | [Target("vs2005")] | 225 | [Target("vs2005")] |
43 | public class VS2005Target : VSGenericTarget | 226 | public class VS2005Target : ITarget |
44 | { | 227 | { |
45 | #region Inner Classes | 228 | #region Inner Classes |
46 | 229 | ||
@@ -48,100 +231,694 @@ namespace Prebuild.Core.Targets | |||
48 | 231 | ||
49 | #region Fields | 232 | #region Fields |
50 | 233 | ||
51 | string solutionVersion = "9.00"; | ||
52 | string productVersion = "8.0.50727"; | ||
53 | string schemaVersion = "2.0"; | 234 | string schemaVersion = "2.0"; |
54 | string versionName = "Visual C# 2005"; | ||
55 | string name = "vs2005"; | ||
56 | |||
57 | VSVersion version = VSVersion.VS80; | 235 | VSVersion version = VSVersion.VS80; |
58 | 236 | ||
59 | public override string SolutionTag | 237 | Hashtable tools; |
238 | Kernel kernel; | ||
239 | |||
240 | protected virtual string ToolsVersionXml | ||
60 | { | 241 | { |
61 | get { return "# Visual Studio 2005"; } | 242 | get |
243 | { | ||
244 | return String.Empty; | ||
245 | } | ||
62 | } | 246 | } |
63 | 247 | ||
64 | protected override string GetToolsVersionXml(FrameworkVersion frameworkVersion) | 248 | protected virtual string SolutionTag |
65 | { | 249 | { |
66 | return string.Empty; | 250 | get { return "# Visual Studio 2005"; } |
67 | } | 251 | } |
252 | |||
68 | /// <summary> | 253 | /// <summary> |
69 | /// Gets or sets the solution version. | 254 | /// Gets or sets the solution version. |
70 | /// </summary> | 255 | /// </summary> |
71 | /// <value>The solution version.</value> | 256 | /// <value>The solution version.</value> |
72 | public override string SolutionVersion | 257 | protected virtual string SolutionVersion |
73 | { | 258 | { |
74 | get | 259 | get |
75 | { | 260 | { |
76 | return solutionVersion; | 261 | return "9.00"; |
77 | } | 262 | } |
78 | } | 263 | } |
264 | |||
79 | /// <summary> | 265 | /// <summary> |
80 | /// Gets or sets the product version. | 266 | /// Gets or sets the product version. |
81 | /// </summary> | 267 | /// </summary> |
82 | /// <value>The product version.</value> | 268 | /// <value>The product version.</value> |
83 | public override string ProductVersion | 269 | protected virtual string ProductVersion |
84 | { | 270 | { |
85 | get | 271 | get |
86 | { | 272 | { |
87 | return productVersion; | 273 | return "8.0.50727"; |
88 | } | 274 | } |
89 | } | 275 | } |
276 | |||
90 | /// <summary> | 277 | /// <summary> |
91 | /// Gets or sets the schema version. | 278 | /// Gets or sets the schema version. |
92 | /// </summary> | 279 | /// </summary> |
93 | /// <value>The schema version.</value> | 280 | /// <value>The schema version.</value> |
94 | public override string SchemaVersion | 281 | protected string SchemaVersion |
95 | { | 282 | { |
96 | get | 283 | get |
97 | { | 284 | { |
98 | return schemaVersion; | 285 | return this.schemaVersion; |
286 | } | ||
287 | set | ||
288 | { | ||
289 | this.schemaVersion = value; | ||
99 | } | 290 | } |
100 | } | 291 | } |
292 | |||
101 | /// <summary> | 293 | /// <summary> |
102 | /// Gets or sets the name of the version. | 294 | /// Gets or sets the name of the version. |
103 | /// </summary> | 295 | /// </summary> |
104 | /// <value>The name of the version.</value> | 296 | /// <value>The name of the version.</value> |
105 | public override string VersionName | 297 | protected virtual string VersionName |
106 | { | 298 | { |
107 | get | 299 | get |
108 | { | 300 | { |
109 | return versionName; | 301 | return "Visual C# 2005"; |
110 | } | 302 | } |
111 | } | 303 | } |
304 | |||
112 | /// <summary> | 305 | /// <summary> |
113 | /// Gets or sets the version. | 306 | /// Gets or sets the version. |
114 | /// </summary> | 307 | /// </summary> |
115 | /// <value>The version.</value> | 308 | /// <value>The version.</value> |
116 | public override VSVersion Version | 309 | protected VSVersion Version |
117 | { | 310 | { |
118 | get | 311 | get |
119 | { | 312 | { |
120 | return version; | 313 | return this.version; |
314 | } | ||
315 | set | ||
316 | { | ||
317 | this.version = value; | ||
121 | } | 318 | } |
122 | } | 319 | } |
320 | |||
321 | #endregion | ||
322 | |||
323 | #region Constructors | ||
324 | |||
123 | /// <summary> | 325 | /// <summary> |
124 | /// Gets the name. | 326 | /// Initializes a new instance of the <see cref="VS2005Target"/> class. |
125 | /// </summary> | 327 | /// </summary> |
126 | /// <value>The name.</value> | 328 | public VS2005Target() |
127 | public override string Name | ||
128 | { | 329 | { |
129 | get | 330 | this.tools = new Hashtable(); |
331 | |||
332 | this.tools["C#"] = new ToolInfo("C#", "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}", "csproj", "CSHARP", "$(MSBuildBinPath)\\Microsoft.CSHARP.Targets"); | ||
333 | this.tools["Boo"] = new ToolInfo("Boo", "{45CEA7DC-C2ED-48A6-ACE0-E16144C02365}", "booproj", "Boo", "$(BooBinPath)\\Boo.Microsoft.Build.targets"); | ||
334 | this.tools["VisualBasic"] = new ToolInfo("VisualBasic", "{F184B08F-C81C-45F6-A57F-5ABD9991F28F}", "vbproj", "VisualBasic", "$(MSBuildBinPath)\\Microsoft.VisualBasic.Targets"); | ||
335 | } | ||
336 | |||
337 | #endregion | ||
338 | |||
339 | #region Private Methods | ||
340 | |||
341 | private string MakeRefPath(ProjectNode project) | ||
342 | { | ||
343 | string ret = ""; | ||
344 | foreach (ReferencePathNode node in project.ReferencePaths) | ||
130 | { | 345 | { |
131 | return name; | 346 | try |
347 | { | ||
348 | string fullPath = Helper.ResolvePath(node.Path); | ||
349 | if (ret.Length < 1) | ||
350 | { | ||
351 | ret = fullPath; | ||
352 | } | ||
353 | else | ||
354 | { | ||
355 | ret += ";" + fullPath; | ||
356 | } | ||
357 | } | ||
358 | catch (ArgumentException) | ||
359 | { | ||
360 | this.kernel.Log.Write(LogType.Warning, "Could not resolve reference path: {0}", node.Path); | ||
361 | } | ||
362 | } | ||
363 | |||
364 | return ret; | ||
365 | } | ||
366 | |||
367 | private static bool ExtensionSpecified(string refName) | ||
368 | { | ||
369 | return refName.EndsWith(".dll") || refName.EndsWith(".exe"); | ||
370 | } | ||
371 | |||
372 | private static string GetProjectExtension(ProjectNode project) | ||
373 | { | ||
374 | string extension = ".dll"; | ||
375 | if (project.Type == ProjectType.Exe) | ||
376 | { | ||
377 | extension = ".exe"; | ||
378 | } | ||
379 | return extension; | ||
380 | } | ||
381 | |||
382 | private void WriteProject(SolutionNode solution, ProjectNode project) | ||
383 | { | ||
384 | if (!tools.ContainsKey(project.Language)) | ||
385 | { | ||
386 | throw new UnknownLanguageException("Unknown .NET language: " + project.Language); | ||
387 | } | ||
388 | |||
389 | ToolInfo toolInfo = (ToolInfo)tools[project.Language]; | ||
390 | string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, toolInfo.FileExtension); | ||
391 | StreamWriter ps = new StreamWriter(projectFile); | ||
392 | |||
393 | kernel.CurrentWorkingDirectory.Push(); | ||
394 | Helper.SetCurrentDir(Path.GetDirectoryName(projectFile)); | ||
395 | |||
396 | #region Project File | ||
397 | using (ps) | ||
398 | { | ||
399 | ps.WriteLine("<Project DefaultTargets=\"Build\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\"{0}>", ToolsVersionXml); | ||
400 | //ps.WriteLine(" <{0}", toolInfo.XMLTag); | ||
401 | ps.WriteLine(" <PropertyGroup>"); | ||
402 | ps.WriteLine(" <ProjectType>Local</ProjectType>"); | ||
403 | ps.WriteLine(" <ProductVersion>{0}</ProductVersion>", this.ProductVersion); | ||
404 | ps.WriteLine(" <SchemaVersion>{0}</SchemaVersion>", this.SchemaVersion); | ||
405 | ps.WriteLine(" <ProjectGuid>{{{0}}}</ProjectGuid>", project.Guid.ToString().ToUpper()); | ||
406 | |||
407 | ps.WriteLine(" <Configuration Condition=\" '$(Configuration)' == '' \">Debug</Configuration>"); | ||
408 | ps.WriteLine(" <Platform Condition=\" '$(Platform)' == '' \">AnyCPU</Platform>"); | ||
409 | //ps.WriteLine(" <Build>"); | ||
410 | |||
411 | //ps.WriteLine(" <Settings"); | ||
412 | ps.WriteLine(" <ApplicationIcon>{0}</ApplicationIcon>", project.AppIcon); | ||
413 | ps.WriteLine(" <AssemblyKeyContainerName>"); | ||
414 | ps.WriteLine(" </AssemblyKeyContainerName>"); | ||
415 | ps.WriteLine(" <AssemblyName>{0}</AssemblyName>", project.AssemblyName); | ||
416 | foreach (ConfigurationNode conf in project.Configurations) | ||
417 | { | ||
418 | if (conf.Options.KeyFile != "") | ||
419 | { | ||
420 | ps.WriteLine(" <AssemblyOriginatorKeyFile>{0}</AssemblyOriginatorKeyFile>", conf.Options.KeyFile); | ||
421 | ps.WriteLine(" <SignAssembly>true</SignAssembly>"); | ||
422 | break; | ||
423 | } | ||
424 | } | ||
425 | ps.WriteLine(" <DefaultClientScript>JScript</DefaultClientScript>"); | ||
426 | ps.WriteLine(" <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>"); | ||
427 | ps.WriteLine(" <DefaultTargetSchema>IE50</DefaultTargetSchema>"); | ||
428 | ps.WriteLine(" <DelaySign>false</DelaySign>"); | ||
429 | |||
430 | //if(m_Version == VSVersion.VS70) | ||
431 | // ps.WriteLine(" NoStandardLibraries = \"false\""); | ||
432 | |||
433 | ps.WriteLine(" <OutputType>{0}</OutputType>", project.Type.ToString()); | ||
434 | ps.WriteLine(" <AppDesignerFolder>{0}</AppDesignerFolder>", project.DesignerFolder); | ||
435 | ps.WriteLine(" <RootNamespace>{0}</RootNamespace>", project.RootNamespace); | ||
436 | ps.WriteLine(" <StartupObject>{0}</StartupObject>", project.StartupObject); | ||
437 | //ps.WriteLine(" >"); | ||
438 | ps.WriteLine(" <FileUpgradeFlags>"); | ||
439 | ps.WriteLine(" </FileUpgradeFlags>"); | ||
440 | |||
441 | ps.WriteLine(" </PropertyGroup>"); | ||
442 | |||
443 | foreach (ConfigurationNode conf in project.Configurations) | ||
444 | { | ||
445 | ps.Write(" <PropertyGroup "); | ||
446 | ps.WriteLine("Condition=\" '$(Configuration)|$(Platform)' == '{0}|AnyCPU' \">", conf.Name); | ||
447 | ps.WriteLine(" <AllowUnsafeBlocks>{0}</AllowUnsafeBlocks>", conf.Options["AllowUnsafe"]); | ||
448 | ps.WriteLine(" <BaseAddress>{0}</BaseAddress>", conf.Options["BaseAddress"]); | ||
449 | ps.WriteLine(" <CheckForOverflowUnderflow>{0}</CheckForOverflowUnderflow>", conf.Options["CheckUnderflowOverflow"]); | ||
450 | ps.WriteLine(" <ConfigurationOverrideFile>"); | ||
451 | ps.WriteLine(" </ConfigurationOverrideFile>"); | ||
452 | ps.WriteLine(" <DefineConstants>{0}</DefineConstants>", conf.Options["CompilerDefines"]); | ||
453 | ps.WriteLine(" <DocumentationFile>{0}</DocumentationFile>", Helper.NormalizePath(conf.Options["XmlDocFile"].ToString())); | ||
454 | ps.WriteLine(" <DebugSymbols>{0}</DebugSymbols>", conf.Options["DebugInformation"]); | ||
455 | ps.WriteLine(" <FileAlignment>{0}</FileAlignment>", conf.Options["FileAlignment"]); | ||
456 | // ps.WriteLine(" <IncrementalBuild = \"{0}\"", conf.Options["IncrementalBuild"]); | ||
457 | |||
458 | // if(m_Version == VSVersion.VS71) | ||
459 | // { | ||
460 | // ps.WriteLine(" NoStdLib = \"{0}\"", conf.Options["NoStdLib"]); | ||
461 | // ps.WriteLine(" NoWarn = \"{0}\"", conf.Options["SuppressWarnings"]); | ||
462 | // } | ||
463 | |||
464 | ps.WriteLine(" <Optimize>{0}</Optimize>", conf.Options["OptimizeCode"]); | ||
465 | ps.WriteLine(" <OutputPath>{0}</OutputPath>", | ||
466 | Helper.EndPath(Helper.NormalizePath(conf.Options["OutputPath"].ToString()))); | ||
467 | ps.WriteLine(" <RegisterForComInterop>{0}</RegisterForComInterop>", conf.Options["RegisterComInterop"]); | ||
468 | ps.WriteLine(" <RemoveIntegerChecks>{0}</RemoveIntegerChecks>", conf.Options["RemoveIntegerChecks"]); | ||
469 | ps.WriteLine(" <TreatWarningsAsErrors>{0}</TreatWarningsAsErrors>", conf.Options["WarningsAsErrors"]); | ||
470 | ps.WriteLine(" <WarningLevel>{0}</WarningLevel>", conf.Options["WarningLevel"]); | ||
471 | ps.WriteLine(" <NoWarn>{0}</NoWarn>", conf.Options["SuppressWarnings"]); | ||
472 | ps.WriteLine(" </PropertyGroup>"); | ||
473 | } | ||
474 | |||
475 | //ps.WriteLine(" </Settings>"); | ||
476 | |||
477 | // Assembly References | ||
478 | ps.WriteLine(" <ItemGroup>"); | ||
479 | string refPath = ((ReferencePathNode) project.ReferencePaths[0]).Path; | ||
480 | |||
481 | foreach (ReferenceNode refr in project.References) | ||
482 | { | ||
483 | if (!solution.ProjectsTable.ContainsKey(refr.Name)) | ||
484 | { | ||
485 | ps.Write(" <Reference"); | ||
486 | ps.Write(" Include=\""); | ||
487 | ps.Write(refr.Name); | ||
488 | |||
489 | ps.WriteLine("\" >"); | ||
490 | |||
491 | string path; | ||
492 | |||
493 | if (String.IsNullOrEmpty(refr.Path)) | ||
494 | { | ||
495 | if ( ExtensionSpecified( refr.Name ) ) | ||
496 | { | ||
497 | path = Helper.NormalizePath(Path.Combine(refPath, refr.Name), '\\'); | ||
498 | } | ||
499 | else | ||
500 | { | ||
501 | path = refr.Name + ".dll"; | ||
502 | } | ||
503 | } | ||
504 | else | ||
505 | { | ||
506 | path = refr.Path; | ||
507 | } | ||
508 | |||
509 | // TODO: Allow reference to *.exe files | ||
510 | ps.WriteLine(" <HintPath>{0}</HintPath>", path ); | ||
511 | ps.WriteLine(" <Private>{0}</Private>", refr.LocalCopy); | ||
512 | ps.WriteLine(" </Reference>"); | ||
513 | } | ||
514 | } | ||
515 | ps.WriteLine(" </ItemGroup>"); | ||
516 | |||
517 | //Project References | ||
518 | ps.WriteLine(" <ItemGroup>"); | ||
519 | foreach (ReferenceNode refr in project.References) | ||
520 | { | ||
521 | if (solution.ProjectsTable.ContainsKey(refr.Name)) | ||
522 | { | ||
523 | ProjectNode refProject = (ProjectNode)solution.ProjectsTable[refr.Name]; | ||
524 | // TODO: Allow reference to visual basic projects | ||
525 | string path = | ||
526 | Helper.MakePathRelativeTo(project.FullPath, | ||
527 | Helper.MakeFilePath(refProject.FullPath, refProject.Name, "csproj")); | ||
528 | ps.WriteLine(" <ProjectReference Include=\"{0}\">", path ); | ||
529 | //<ProjectReference Include="..\..\RealmForge\Utility\RealmForge.Utility.csproj"> | ||
530 | ps.WriteLine(" <Name>{0}</Name>", refProject.Name); | ||
531 | // <Name>RealmForge.Utility</Name> | ||
532 | ps.WriteLine(" <Project>{{{0}}}</Project>", refProject.Guid.ToString().ToUpper()); | ||
533 | // <Project>{6880D1D3-69EE-461B-B841-5319845B20D3}</Project> | ||
534 | ps.WriteLine(" <Package>{0}</Package>", toolInfo.Guid.ToString().ToUpper()); | ||
535 | // <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> | ||
536 | ps.WriteLine("\t\t\t<Private>{0}</Private>", refr.LocalCopy); | ||
537 | ps.WriteLine(" </ProjectReference>"); | ||
538 | //</ProjectReference> | ||
539 | } | ||
540 | else | ||
541 | { | ||
542 | } | ||
543 | } | ||
544 | ps.WriteLine(" </ItemGroup>"); | ||
545 | |||
546 | // ps.WriteLine(" </Build>"); | ||
547 | ps.WriteLine(" <ItemGroup>"); | ||
548 | |||
549 | // ps.WriteLine(" <Include>"); | ||
550 | ArrayList list = new ArrayList(); | ||
551 | foreach (string file in project.Files) | ||
552 | { | ||
553 | // if (file == "Properties\\Bind.Designer.cs") | ||
554 | // { | ||
555 | // Console.WriteLine("Wait a minute!"); | ||
556 | // Console.WriteLine(project.Files.GetSubType(file).ToString()); | ||
557 | // } | ||
558 | |||
559 | if (project.Files.GetSubType(file) != SubType.Code && project.Files.GetSubType(file) != SubType.Settings && project.Files.GetSubType(file) != SubType.Designer) | ||
560 | { | ||
561 | ps.WriteLine(" <EmbeddedResource Include=\"{0}\">", file.Substring(0, file.LastIndexOf('.')) + ".resx"); | ||
562 | |||
563 | int slash = file.LastIndexOf('\\'); | ||
564 | if (slash == -1) | ||
565 | { | ||
566 | ps.WriteLine(" <DependentUpon>{0}</DependentUpon>", file); | ||
567 | } | ||
568 | else | ||
569 | { | ||
570 | ps.WriteLine(" <DependentUpon>{0}</DependentUpon>", file.Substring(slash + 1, file.Length - slash - 1)); | ||
571 | } | ||
572 | ps.WriteLine(" <SubType>Designer</SubType>"); | ||
573 | ps.WriteLine(" </EmbeddedResource>"); | ||
574 | // | ||
575 | } | ||
576 | |||
577 | if (project.Files.GetSubType(file) != SubType.Code && project.Files.GetSubType(file) == SubType.Designer) | ||
578 | { | ||
579 | ps.WriteLine(" <EmbeddedResource Include=\"{0}\">", file.Substring(0, file.LastIndexOf('.')) + ".resx"); | ||
580 | ps.WriteLine(" <SubType>" + project.Files.GetSubType(file) + "</SubType>"); | ||
581 | ps.WriteLine(" <Generator>ResXFileCodeGenerator</Generator>"); | ||
582 | ps.WriteLine(" <LastGenOutput>Resources.Designer.cs</LastGenOutput>"); | ||
583 | ps.WriteLine(" </EmbeddedResource>"); | ||
584 | ps.WriteLine(" <Compile Include=\"{0}\">", file.Substring(0, file.LastIndexOf('.')) + ".Designer.cs"); | ||
585 | ps.WriteLine(" <AutoGen>True</AutoGen>"); | ||
586 | ps.WriteLine(" <DesignTime>True</DesignTime>"); | ||
587 | ps.WriteLine(" <DependentUpon>Resources.resx</DependentUpon>"); | ||
588 | ps.WriteLine(" </Compile>"); | ||
589 | list.Add(file.Substring(0, file.LastIndexOf('.')) + ".Designer.cs"); | ||
590 | } | ||
591 | if (project.Files.GetSubType(file).ToString() == "Settings") | ||
592 | { | ||
593 | //Console.WriteLine("File: " + file); | ||
594 | //Console.WriteLine("Last index: " + file.LastIndexOf('.')); | ||
595 | //Console.WriteLine("Length: " + file.Length); | ||
596 | ps.Write(" <{0} ", project.Files.GetBuildAction(file)); | ||
597 | ps.WriteLine("Include=\"{0}\">", file); | ||
598 | int slash = file.LastIndexOf('\\'); | ||
599 | string fileName = file.Substring(slash + 1, file.Length - slash - 1); | ||
600 | if (project.Files.GetBuildAction(file) == BuildAction.None) | ||
601 | { | ||
602 | ps.WriteLine(" <Generator>SettingsSingleFileGenerator</Generator>"); | ||
603 | |||
604 | //Console.WriteLine("FileName: " + fileName); | ||
605 | //Console.WriteLine("FileNameMain: " + fileName.Substring(0, fileName.LastIndexOf('.'))); | ||
606 | //Console.WriteLine("FileNameExt: " + fileName.Substring(fileName.LastIndexOf('.'), fileName.Length - fileName.LastIndexOf('.'))); | ||
607 | if (slash == -1) | ||
608 | { | ||
609 | ps.WriteLine(" <LastGenOutput>{0}</LastGenOutput>", fileName.Substring(0, fileName.LastIndexOf('.')) + ".Designer.cs"); | ||
610 | } | ||
611 | else | ||
612 | { | ||
613 | ps.WriteLine(" <LastGenOutput>{0}</LastGenOutput>", fileName.Substring(0, fileName.LastIndexOf('.')) + ".Designer.cs"); | ||
614 | } | ||
615 | } | ||
616 | else | ||
617 | { | ||
618 | ps.WriteLine(" <SubType>Code</SubType>"); | ||
619 | ps.WriteLine(" <AutoGen>True</AutoGen>"); | ||
620 | ps.WriteLine(" <DesignTimeSharedInput>True</DesignTimeSharedInput>"); | ||
621 | string fileNameShort = fileName.Substring(0, fileName.LastIndexOf('.')); | ||
622 | string fileNameShorter = fileNameShort.Substring(0, fileNameShort.LastIndexOf('.')); | ||
623 | ps.WriteLine(" <DependentUpon>{0}</DependentUpon>", fileNameShorter + ".settings"); | ||
624 | } | ||
625 | ps.WriteLine(" </{0}>", project.Files.GetBuildAction(file)); | ||
626 | } | ||
627 | else if (project.Files.GetSubType(file) != SubType.Designer) | ||
628 | { | ||
629 | if (!list.Contains(file)) | ||
630 | { | ||
631 | ps.Write(" <{0} ", project.Files.GetBuildAction(file)); | ||
632 | |||
633 | int startPos = 0; | ||
634 | if ( project.Files.GetPreservePath( file ) ) | ||
635 | { | ||
636 | while ( ( @"./\" ).IndexOf( file.Substring( startPos, 1 ) ) != -1 ) | ||
637 | startPos++; | ||
638 | |||
639 | } | ||
640 | else | ||
641 | { | ||
642 | startPos = file.LastIndexOf( Path.GetFileName( file ) ); | ||
643 | } | ||
644 | ps.WriteLine("Include=\"{0}\">", Helper.NormalizePath(file)); | ||
645 | |||
646 | |||
647 | if (file.Contains("Designer.cs")) | ||
648 | { | ||
649 | string d = ".Designer.cs"; | ||
650 | int index = file.Contains("\\") ? file.IndexOf("\\") + 1 : 0; | ||
651 | ps.WriteLine(" <DependentUpon>{0}</DependentUpon>", file.Substring(index, file.Length - index - d.Length) + ".cs"); | ||
652 | } | ||
653 | |||
654 | if (project.Files.GetIsLink(file)) | ||
655 | { | ||
656 | string alias = project.Files.GetLinkPath( file ); | ||
657 | alias += file.Substring( startPos ); | ||
658 | alias = Helper.NormalizePath( alias ); | ||
659 | ps.WriteLine( " <Link>{0}</Link>", alias ); | ||
660 | } | ||
661 | else if (project.Files.GetBuildAction(file) != BuildAction.None) | ||
662 | { | ||
663 | if (project.Files.GetBuildAction(file) != BuildAction.EmbeddedResource) | ||
664 | { | ||
665 | ps.WriteLine(" <SubType>{0}</SubType>", project.Files.GetSubType(file)); | ||
666 | } | ||
667 | } | ||
668 | |||
669 | if (project.Files.GetCopyToOutput(file) != CopyToOutput.Never) | ||
670 | { | ||
671 | ps.WriteLine(" <CopyToOutputDirectory>{0}</CopyToOutputDirectory>", project.Files.GetCopyToOutput(file)); | ||
672 | } | ||
673 | |||
674 | ps.WriteLine(" </{0}>", project.Files.GetBuildAction(file)); | ||
675 | } | ||
676 | } | ||
677 | } | ||
678 | // ps.WriteLine(" </Include>"); | ||
679 | |||
680 | ps.WriteLine(" </ItemGroup>"); | ||
681 | ps.WriteLine(" <Import Project=\"" + toolInfo.ImportProject + "\" />"); | ||
682 | ps.WriteLine(" <PropertyGroup>"); | ||
683 | ps.WriteLine(" <PreBuildEvent>"); | ||
684 | ps.WriteLine(" </PreBuildEvent>"); | ||
685 | ps.WriteLine(" <PostBuildEvent>"); | ||
686 | ps.WriteLine(" </PostBuildEvent>"); | ||
687 | ps.WriteLine(" </PropertyGroup>"); | ||
688 | // ps.WriteLine(" </{0}>", toolInfo.XMLTag); | ||
689 | ps.WriteLine("</Project>"); | ||
690 | } | ||
691 | #endregion | ||
692 | |||
693 | #region User File | ||
694 | |||
695 | ps = new StreamWriter(projectFile + ".user"); | ||
696 | using (ps) | ||
697 | { | ||
698 | ps.WriteLine("<Project xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">"); | ||
699 | //ps.WriteLine( "<VisualStudioProject>" ); | ||
700 | //ps.WriteLine(" <{0}>", toolInfo.XMLTag); | ||
701 | //ps.WriteLine(" <Build>"); | ||
702 | ps.WriteLine(" <PropertyGroup>"); | ||
703 | //ps.WriteLine(" <Settings ReferencePath=\"{0}\">", MakeRefPath(project)); | ||
704 | |||
705 | ps.WriteLine(" <Configuration Condition=\" '$(Configuration)' == '' \">Debug</Configuration>"); | ||
706 | |||
707 | if (projectFile.Contains( "OpenSim.csproj" )) | ||
708 | { | ||
709 | ps.WriteLine(" <StartArguments>-loginserver -sandbox -accounts</StartArguments>"); | ||
710 | } | ||
711 | |||
712 | ps.WriteLine(" <Platform Condition=\" '$(Platform)' == '' \">AnyCPU</Platform>"); | ||
713 | ps.WriteLine(" <ReferencePath>{0}</ReferencePath>", MakeRefPath(project)); | ||
714 | ps.WriteLine(" <LastOpenVersion>{0}</LastOpenVersion>", this.ProductVersion); | ||
715 | ps.WriteLine(" <ProjectView>ProjectFiles</ProjectView>"); | ||
716 | ps.WriteLine(" <ProjectTrust>0</ProjectTrust>"); | ||
717 | ps.WriteLine(" </PropertyGroup>"); | ||
718 | foreach (ConfigurationNode conf in project.Configurations) | ||
719 | { | ||
720 | ps.Write(" <PropertyGroup"); | ||
721 | ps.Write(" Condition = \" '$(Configuration)|$(Platform)' == '{0}|AnyCPU' \"", conf.Name); | ||
722 | ps.WriteLine(" />"); | ||
723 | } | ||
724 | |||
725 | ps.WriteLine("</Project>"); | ||
726 | } | ||
727 | #endregion | ||
728 | |||
729 | kernel.CurrentWorkingDirectory.Pop(); | ||
730 | } | ||
731 | |||
732 | private void WriteSolution(SolutionNode solution) | ||
733 | { | ||
734 | kernel.Log.Write("Creating {0} solution and project files", this.VersionName); | ||
735 | |||
736 | foreach (ProjectNode project in solution.Projects) | ||
737 | { | ||
738 | kernel.Log.Write("...Creating project: {0}", project.Name); | ||
739 | WriteProject(solution, project); | ||
132 | } | 740 | } |
741 | |||
742 | kernel.Log.Write(""); | ||
743 | string solutionFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "sln"); | ||
744 | using (StreamWriter ss = new StreamWriter(solutionFile)) | ||
745 | { | ||
746 | kernel.CurrentWorkingDirectory.Push(); | ||
747 | Helper.SetCurrentDir(Path.GetDirectoryName(solutionFile)); | ||
748 | |||
749 | using (ss) | ||
750 | { | ||
751 | ss.WriteLine("Microsoft Visual Studio Solution File, Format Version {0}", this.SolutionVersion); | ||
752 | ss.WriteLine(SolutionTag); | ||
753 | foreach (ProjectNode project in solution.Projects) | ||
754 | { | ||
755 | if (!tools.ContainsKey(project.Language)) | ||
756 | { | ||
757 | throw new UnknownLanguageException("Unknown .NET language: " + project.Language); | ||
758 | } | ||
759 | |||
760 | ToolInfo toolInfo = (ToolInfo)tools[project.Language]; | ||
761 | |||
762 | string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath); | ||
763 | ss.WriteLine("Project(\"{0}\") = \"{1}\", \"{2}\", \"{{{3}}}\"", | ||
764 | toolInfo.Guid, project.Name, Helper.MakeFilePath(path, project.Name, | ||
765 | toolInfo.FileExtension), project.Guid.ToString().ToUpper()); | ||
766 | |||
767 | //ss.WriteLine(" ProjectSection(ProjectDependencies) = postProject"); | ||
768 | //ss.WriteLine(" EndProjectSection"); | ||
769 | |||
770 | ss.WriteLine("EndProject"); | ||
771 | } | ||
772 | |||
773 | if (solution.Files != null) | ||
774 | { | ||
775 | ss.WriteLine("Project(\"{0}\") = \"Solution Items\", \"Solution Items\", \"{1}\"", "{2150E333-8FDC-42A3-9474-1A3956D46DE8}", "{468F1D07-AD17-4CC3-ABD0-2CA268E4E1A6}"); | ||
776 | ss.WriteLine("\tProjectSection(SolutionItems) = preProject"); | ||
777 | foreach (string file in solution.Files) | ||
778 | ss.WriteLine("\t\t{0} = {0}", file); | ||
779 | ss.WriteLine("\tEndProjectSection"); | ||
780 | ss.WriteLine("EndProject"); | ||
781 | } | ||
782 | |||
783 | ss.WriteLine("Global"); | ||
784 | |||
785 | ss.WriteLine(" GlobalSection(SolutionConfigurationPlatforms) = preSolution"); | ||
786 | foreach (ConfigurationNode conf in solution.Configurations) | ||
787 | { | ||
788 | ss.WriteLine(" {0}|Any CPU = {0}|Any CPU", conf.Name); | ||
789 | } | ||
790 | ss.WriteLine(" EndGlobalSection"); | ||
791 | |||
792 | if (solution.Projects.Count > 1) | ||
793 | { | ||
794 | ss.WriteLine(" GlobalSection(ProjectDependencies) = postSolution"); | ||
795 | } | ||
796 | foreach (ProjectNode project in solution.Projects) | ||
797 | { | ||
798 | for (int i = 0; i < project.References.Count; i++) | ||
799 | { | ||
800 | ReferenceNode refr = (ReferenceNode)project.References[i]; | ||
801 | if (solution.ProjectsTable.ContainsKey(refr.Name)) | ||
802 | { | ||
803 | ProjectNode refProject = (ProjectNode)solution.ProjectsTable[refr.Name]; | ||
804 | ss.WriteLine(" ({{{0}}}).{1} = ({{{2}}})", | ||
805 | project.Guid.ToString().ToUpper() | ||
806 | , i, | ||
807 | refProject.Guid.ToString().ToUpper() | ||
808 | ); | ||
809 | } | ||
810 | } | ||
811 | } | ||
812 | if (solution.Projects.Count > 1) | ||
813 | { | ||
814 | ss.WriteLine(" EndGlobalSection"); | ||
815 | } | ||
816 | ss.WriteLine(" GlobalSection(ProjectConfigurationPlatforms) = postSolution"); | ||
817 | foreach (ProjectNode project in solution.Projects) | ||
818 | { | ||
819 | foreach (ConfigurationNode conf in solution.Configurations) | ||
820 | { | ||
821 | ss.WriteLine(" {{{0}}}.{1}|Any CPU.ActiveCfg = {1}|Any CPU", | ||
822 | project.Guid.ToString().ToUpper(), | ||
823 | conf.Name); | ||
824 | |||
825 | ss.WriteLine(" {{{0}}}.{1}|Any CPU.Build.0 = {1}|Any CPU", | ||
826 | project.Guid.ToString().ToUpper(), | ||
827 | conf.Name); | ||
828 | } | ||
829 | } | ||
830 | ss.WriteLine(" EndGlobalSection"); | ||
831 | ss.WriteLine(" GlobalSection(SolutionProperties) = preSolution"); | ||
832 | ss.WriteLine(" HideSolutionNode = FALSE"); | ||
833 | ss.WriteLine(" EndGlobalSection"); | ||
834 | |||
835 | ss.WriteLine("EndGlobal"); | ||
836 | } | ||
837 | } | ||
838 | |||
839 | kernel.CurrentWorkingDirectory.Pop(); | ||
840 | } | ||
841 | |||
842 | private void CleanProject(ProjectNode project) | ||
843 | { | ||
844 | kernel.Log.Write("...Cleaning project: {0}", project.Name); | ||
845 | |||
846 | ToolInfo toolInfo = (ToolInfo)tools[project.Language]; | ||
847 | string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, toolInfo.FileExtension); | ||
848 | string userFile = projectFile + ".user"; | ||
849 | |||
850 | Helper.DeleteIfExists(projectFile); | ||
851 | Helper.DeleteIfExists(userFile); | ||
852 | } | ||
853 | |||
854 | private void CleanSolution(SolutionNode solution) | ||
855 | { | ||
856 | kernel.Log.Write("Cleaning {0} solution and project files", this.VersionName, solution.Name); | ||
857 | |||
858 | string slnFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "sln"); | ||
859 | string suoFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "suo"); | ||
860 | |||
861 | Helper.DeleteIfExists(slnFile); | ||
862 | Helper.DeleteIfExists(suoFile); | ||
863 | |||
864 | foreach (ProjectNode project in solution.Projects) | ||
865 | { | ||
866 | CleanProject(project); | ||
867 | } | ||
868 | |||
869 | kernel.Log.Write(""); | ||
133 | } | 870 | } |
134 | 871 | ||
135 | #endregion | 872 | #endregion |
136 | 873 | ||
137 | #region Constructors | 874 | #region ITarget Members |
138 | 875 | ||
139 | /// <summary> | 876 | /// <summary> |
140 | /// Initializes a new instance of the <see cref="VS2005Target"/> class. | 877 | /// Writes the specified kern. |
878 | /// </summary> | ||
879 | /// <param name="kern">The kern.</param> | ||
880 | public virtual void Write(Kernel kern) | ||
881 | { | ||
882 | if (kern == null) | ||
883 | { | ||
884 | throw new ArgumentNullException("kern"); | ||
885 | } | ||
886 | kernel = kern; | ||
887 | foreach (SolutionNode sol in kernel.Solutions) | ||
888 | { | ||
889 | WriteSolution(sol); | ||
890 | } | ||
891 | kernel = null; | ||
892 | } | ||
893 | |||
894 | /// <summary> | ||
895 | /// Cleans the specified kern. | ||
141 | /// </summary> | 896 | /// </summary> |
142 | public VS2005Target() | 897 | /// <param name="kern">The kern.</param> |
143 | : base() | 898 | public virtual void Clean(Kernel kern) |
144 | { | 899 | { |
900 | if (kern == null) | ||
901 | { | ||
902 | throw new ArgumentNullException("kern"); | ||
903 | } | ||
904 | kernel = kern; | ||
905 | foreach (SolutionNode sol in kernel.Solutions) | ||
906 | { | ||
907 | CleanSolution(sol); | ||
908 | } | ||
909 | kernel = null; | ||
910 | } | ||
911 | |||
912 | /// <summary> | ||
913 | /// Gets the name. | ||
914 | /// </summary> | ||
915 | /// <value>The name.</value> | ||
916 | public virtual string Name | ||
917 | { | ||
918 | get | ||
919 | { | ||
920 | return "vs2005"; | ||
921 | } | ||
145 | } | 922 | } |
146 | 923 | ||
147 | #endregion | 924 | #endregion |
diff --git a/Prebuild/src/Core/Targets/VS2008Target.cs b/Prebuild/src/Core/Targets/VS2008Target.cs index f30017b..88bb5e6 100644 --- a/Prebuild/src/Core/Targets/VS2008Target.cs +++ b/Prebuild/src/Core/Targets/VS2008Target.cs | |||
@@ -1,132 +1,56 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Collections; | 2 | using System.Collections.Generic; |
3 | using System.Collections.Specialized; | ||
4 | using System.IO; | ||
5 | using System.Text; | 3 | using System.Text; |
6 | |||
7 | using Prebuild.Core.Attributes; | 4 | using Prebuild.Core.Attributes; |
8 | using Prebuild.Core.Interfaces; | ||
9 | using Prebuild.Core.Nodes; | ||
10 | using Prebuild.Core.Utilities; | ||
11 | using System.CodeDom.Compiler; | ||
12 | 5 | ||
13 | namespace Prebuild.Core.Targets | 6 | namespace Prebuild.Core.Targets |
14 | { | 7 | { |
8 | [Target("vs2008")] | ||
9 | public class VS2008Target : VS2005Target | ||
10 | { | ||
11 | protected override string SolutionTag | ||
12 | { | ||
13 | get { return "# Visual Studio 2008"; } | ||
14 | } | ||
15 | 15 | ||
16 | /// <summary> | 16 | protected override string SolutionVersion |
17 | /// | ||
18 | /// </summary> | ||
19 | [Target("vs2008")] | ||
20 | public class VS2008Target : VSGenericTarget | ||
21 | { | ||
22 | #region Fields | ||
23 | string solutionVersion = "10.00"; | ||
24 | string productVersion = "9.0.21022"; | ||
25 | string schemaVersion = "2.0"; | ||
26 | string versionName = "Visual Studio 2008"; | ||
27 | string name = "vs2008"; | ||
28 | VSVersion version = VSVersion.VS90; | ||
29 | |||
30 | Hashtable tools; | ||
31 | Kernel kernel; | ||
32 | |||
33 | /// <summary> | ||
34 | /// Gets or sets the solution version. | ||
35 | /// </summary> | ||
36 | /// <value>The solution version.</value> | ||
37 | public override string SolutionVersion | ||
38 | { | ||
39 | get | ||
40 | { | ||
41 | return solutionVersion; | ||
42 | } | ||
43 | } | ||
44 | /// <summary> | ||
45 | /// Gets or sets the product version. | ||
46 | /// </summary> | ||
47 | /// <value>The product version.</value> | ||
48 | public override string ProductVersion | ||
49 | { | ||
50 | get | ||
51 | { | ||
52 | return productVersion; | ||
53 | } | ||
54 | } | ||
55 | /// <summary> | ||
56 | /// Gets or sets the schema version. | ||
57 | /// </summary> | ||
58 | /// <value>The schema version.</value> | ||
59 | public override string SchemaVersion | ||
60 | { | ||
61 | get | ||
62 | { | ||
63 | return schemaVersion; | ||
64 | } | ||
65 | } | ||
66 | /// <summary> | ||
67 | /// Gets or sets the name of the version. | ||
68 | /// </summary> | ||
69 | /// <value>The name of the version.</value> | ||
70 | public override string VersionName | ||
71 | { | ||
72 | get | ||
73 | { | ||
74 | return versionName; | ||
75 | } | ||
76 | } | ||
77 | /// <summary> | ||
78 | /// Gets or sets the version. | ||
79 | /// </summary> | ||
80 | /// <value>The version.</value> | ||
81 | public override VSVersion Version | ||
82 | { | ||
83 | get | ||
84 | { | ||
85 | return version; | ||
86 | } | ||
87 | } | ||
88 | /// <summary> | ||
89 | /// Gets the name. | ||
90 | /// </summary> | ||
91 | /// <value>The name.</value> | ||
92 | public override string Name | ||
93 | { | ||
94 | get | ||
95 | { | ||
96 | return name; | ||
97 | } | ||
98 | } | ||
99 | |||
100 | protected override string GetToolsVersionXml(FrameworkVersion frameworkVersion) | ||
101 | { | 17 | { |
102 | switch (frameworkVersion) | 18 | get |
103 | { | 19 | { |
104 | case FrameworkVersion.v3_5: | 20 | return "10.00"; |
105 | return "ToolsVersion=\"3.5\""; | ||
106 | case FrameworkVersion.v3_0: | ||
107 | return "ToolsVersion=\"3.0\""; | ||
108 | default: | ||
109 | return "ToolsVersion=\"2.0\""; | ||
110 | } | 21 | } |
111 | } | 22 | } |
112 | 23 | ||
113 | public override string SolutionTag | 24 | protected override string VersionName |
114 | { | 25 | { |
115 | get { return "# Visual Studio 2008"; } | 26 | get |
27 | { | ||
28 | return "Visual C# 2008"; | ||
29 | } | ||
116 | } | 30 | } |
117 | 31 | ||
118 | #endregion | 32 | protected override string ToolsVersionXml |
119 | 33 | { | |
120 | #region Constructors | 34 | get |
35 | { | ||
36 | return " ToolsVersion=\"3.5\""; | ||
37 | } | ||
38 | } | ||
121 | 39 | ||
122 | /// <summary> | 40 | protected override string ProductVersion |
123 | /// Initializes a new instance of the <see cref="VS2005Target"/> class. | 41 | { |
124 | /// </summary> | 42 | get |
125 | public VS2008Target() | 43 | { |
126 | : base() | 44 | return "9.0.21022"; |
127 | { | 45 | } |
128 | } | 46 | } |
129 | 47 | ||
130 | #endregion | 48 | public override string Name |
131 | } | 49 | { |
50 | get | ||
51 | { | ||
52 | return "vs2008"; | ||
53 | } | ||
54 | } | ||
55 | } | ||
132 | } | 56 | } |
diff --git a/Prebuild/src/Core/Targets/VSGenericTarget.cs b/Prebuild/src/Core/Targets/VSGenericTarget.cs deleted file mode 100644 index 401331d..0000000 --- a/Prebuild/src/Core/Targets/VSGenericTarget.cs +++ /dev/null | |||
@@ -1,881 +0,0 @@ | |||
1 | #region BSD License | ||
2 | /* | ||
3 | Copyright (c) 2008 Matthew Holmes (matthew@wildfiregames.com), John Anderson (sontek@gmail.com) | ||
4 | |||
5 | Redistribution and use in source and binary forms, with or without modification, are permitted | ||
6 | provided that the following conditions are met: | ||
7 | |||
8 | * Redistributions of source code must retain the above copyright notice, this list of conditions | ||
9 | and the following disclaimer. | ||
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 | ||
12 | distribution. | ||
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. | ||
15 | |||
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 | ||
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 | ||
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 | ||
22 | IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
23 | */ | ||
24 | #endregion | ||
25 | |||
26 | using System; | ||
27 | using System.Collections; | ||
28 | using System.Collections.Generic; | ||
29 | using System.Collections.Specialized; | ||
30 | using System.IO; | ||
31 | using System.Text; | ||
32 | |||
33 | using Prebuild.Core.Attributes; | ||
34 | using Prebuild.Core.Interfaces; | ||
35 | using Prebuild.Core.Nodes; | ||
36 | using Prebuild.Core.Utilities; | ||
37 | using System.CodeDom.Compiler; | ||
38 | |||
39 | namespace Prebuild.Core.Targets | ||
40 | { | ||
41 | |||
42 | /// <summary> | ||
43 | /// | ||
44 | /// </summary> | ||
45 | public abstract class VSGenericTarget : ITarget | ||
46 | { | ||
47 | #region Fields | ||
48 | |||
49 | readonly Hashtable tools = new Hashtable(); | ||
50 | Kernel kernel; | ||
51 | #endregion | ||
52 | |||
53 | #region Properties | ||
54 | /// <summary> | ||
55 | /// Gets or sets the solution version. | ||
56 | /// </summary> | ||
57 | /// <value>The solution version.</value> | ||
58 | public abstract string SolutionVersion { get; } | ||
59 | /// <summary> | ||
60 | /// Gets or sets the product version. | ||
61 | /// </summary> | ||
62 | /// <value>The product version.</value> | ||
63 | public abstract string ProductVersion { get; } | ||
64 | /// <summary> | ||
65 | /// Gets or sets the schema version. | ||
66 | /// </summary> | ||
67 | /// <value>The schema version.</value> | ||
68 | public abstract string SchemaVersion { get; } | ||
69 | /// <summary> | ||
70 | /// Gets or sets the name of the version. | ||
71 | /// </summary> | ||
72 | /// <value>The name of the version.</value> | ||
73 | public abstract string VersionName { get; } | ||
74 | /// <summary> | ||
75 | /// Gets or sets the version. | ||
76 | /// </summary> | ||
77 | /// <value>The version.</value> | ||
78 | public abstract VSVersion Version { get; } | ||
79 | /// <summary> | ||
80 | /// Gets the name. | ||
81 | /// </summary> | ||
82 | /// <value>The name.</value> | ||
83 | public abstract string Name { get; } | ||
84 | |||
85 | protected abstract string GetToolsVersionXml(FrameworkVersion version); | ||
86 | public abstract string SolutionTag { get; } | ||
87 | |||
88 | #endregion | ||
89 | |||
90 | #region Constructors | ||
91 | |||
92 | /// <summary> | ||
93 | /// Initializes a new instance of the <see cref="VSGenericTarget"/> class. | ||
94 | /// </summary> | ||
95 | protected VSGenericTarget() | ||
96 | { | ||
97 | this.tools["C#"] = new ToolInfo("C#", "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}", "csproj", "CSHARP", "$(MSBuildBinPath)\\Microsoft.CSHARP.Targets"); | ||
98 | this.tools["Database"] = new ToolInfo("Database", "{4F174C21-8C12-11D0-8340-0000F80270F8}", "dbp", "UNKNOWN"); | ||
99 | this.tools["Boo"] = new ToolInfo("Boo", "{45CEA7DC-C2ED-48A6-ACE0-E16144C02365}", "booproj", "Boo", "$(BooBinPath)\\Boo.Microsoft.Build.targets"); | ||
100 | this.tools["VisualBasic"] = new ToolInfo("VisualBasic", "{F184B08F-C81C-45F6-A57F-5ABD9991F28F}", "vbproj", "VisualBasic", "$(MSBuildBinPath)\\Microsoft.VisualBasic.Targets"); | ||
101 | this.tools["Folder"] = new ToolInfo("Folder", "{2150E333-8FDC-42A3-9474-1A3956D46DE8}", null, null); | ||
102 | } | ||
103 | |||
104 | #endregion | ||
105 | |||
106 | #region Private Methods | ||
107 | |||
108 | private string MakeRefPath(ProjectNode project) | ||
109 | { | ||
110 | string ret = ""; | ||
111 | foreach (ReferencePathNode node in project.ReferencePaths) | ||
112 | { | ||
113 | try | ||
114 | { | ||
115 | string fullPath = Helper.ResolvePath(node.Path); | ||
116 | if (ret.Length < 1) | ||
117 | { | ||
118 | ret = fullPath; | ||
119 | } | ||
120 | else | ||
121 | { | ||
122 | ret += ";" + fullPath; | ||
123 | } | ||
124 | } | ||
125 | catch (ArgumentException) | ||
126 | { | ||
127 | this.kernel.Log.Write(LogType.Warning, "Could not resolve reference path: {0}", node.Path); | ||
128 | } | ||
129 | } | ||
130 | |||
131 | return ret; | ||
132 | } | ||
133 | |||
134 | private static ProjectNode FindProjectInSolution(string name, SolutionNode solution) | ||
135 | { | ||
136 | SolutionNode node = solution; | ||
137 | |||
138 | while (node.Parent is SolutionNode) | ||
139 | node = node.Parent as SolutionNode; | ||
140 | |||
141 | return FindProjectInSolutionRecursively(name, node); | ||
142 | } | ||
143 | |||
144 | private static ProjectNode FindProjectInSolutionRecursively(string name, SolutionNode solution) | ||
145 | { | ||
146 | if (solution.ProjectsTable.ContainsKey(name)) | ||
147 | return (ProjectNode)solution.ProjectsTable[name]; | ||
148 | |||
149 | foreach (SolutionNode child in solution.Solutions) | ||
150 | { | ||
151 | ProjectNode node = FindProjectInSolutionRecursively(name, child); | ||
152 | if (node != null) | ||
153 | return node; | ||
154 | } | ||
155 | |||
156 | return null; | ||
157 | } | ||
158 | |||
159 | private void WriteProject(SolutionNode solution, ProjectNode project) | ||
160 | { | ||
161 | if (!tools.ContainsKey(project.Language)) | ||
162 | { | ||
163 | throw new UnknownLanguageException("Unknown .NET language: " + project.Language); | ||
164 | } | ||
165 | |||
166 | ToolInfo toolInfo = (ToolInfo)tools[project.Language]; | ||
167 | string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, toolInfo.FileExtension); | ||
168 | StreamWriter ps = new StreamWriter(projectFile); | ||
169 | |||
170 | kernel.CurrentWorkingDirectory.Push(); | ||
171 | Helper.SetCurrentDir(Path.GetDirectoryName(projectFile)); | ||
172 | |||
173 | #region Project File | ||
174 | using (ps) | ||
175 | { | ||
176 | ps.WriteLine("<Project DefaultTargets=\"Build\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\" {0}>", GetToolsVersionXml(project.FrameworkVersion)); | ||
177 | ps.WriteLine(" <PropertyGroup>"); | ||
178 | ps.WriteLine(" <ProjectType>Local</ProjectType>"); | ||
179 | ps.WriteLine(" <ProductVersion>{0}</ProductVersion>", this.ProductVersion); | ||
180 | ps.WriteLine(" <SchemaVersion>{0}</SchemaVersion>", this.SchemaVersion); | ||
181 | ps.WriteLine(" <ProjectGuid>{{{0}}}</ProjectGuid>", project.Guid.ToString().ToUpper()); | ||
182 | |||
183 | // Visual Studio has a hard coded guid for the project type | ||
184 | if (project.Type == ProjectType.Web) | ||
185 | ps.WriteLine(" <ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>"); | ||
186 | ps.WriteLine(" <Configuration Condition=\" '$(Configuration)' == '' \">Debug</Configuration>"); | ||
187 | ps.WriteLine(" <Platform Condition=\" '$(Platform)' == '' \">AnyCPU</Platform>"); | ||
188 | ps.WriteLine(" <ApplicationIcon>{0}</ApplicationIcon>", project.AppIcon); | ||
189 | ps.WriteLine(" <AssemblyKeyContainerName>"); | ||
190 | ps.WriteLine(" </AssemblyKeyContainerName>"); | ||
191 | ps.WriteLine(" <AssemblyName>{0}</AssemblyName>", project.AssemblyName); | ||
192 | foreach (ConfigurationNode conf in project.Configurations) | ||
193 | { | ||
194 | if (conf.Options.KeyFile != "") | ||
195 | { | ||
196 | ps.WriteLine(" <AssemblyOriginatorKeyFile>{0}</AssemblyOriginatorKeyFile>", conf.Options.KeyFile); | ||
197 | ps.WriteLine(" <SignAssembly>true</SignAssembly>"); | ||
198 | break; | ||
199 | } | ||
200 | } | ||
201 | ps.WriteLine(" <DefaultClientScript>JScript</DefaultClientScript>"); | ||
202 | ps.WriteLine(" <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>"); | ||
203 | ps.WriteLine(" <DefaultTargetSchema>IE50</DefaultTargetSchema>"); | ||
204 | ps.WriteLine(" <DelaySign>false</DelaySign>"); | ||
205 | ps.WriteLine(" <TargetFrameworkVersion>{0}</TargetFrameworkVersion>", project.FrameworkVersion.ToString().Replace("_", ".")); | ||
206 | |||
207 | ps.WriteLine(" <OutputType>{0}</OutputType>", project.Type == ProjectType.Web ? ProjectType.Library.ToString() : project.Type.ToString()); | ||
208 | ps.WriteLine(" <AppDesignerFolder>{0}</AppDesignerFolder>", project.DesignerFolder); | ||
209 | ps.WriteLine(" <RootNamespace>{0}</RootNamespace>", project.RootNamespace); | ||
210 | ps.WriteLine(" <StartupObject>{0}</StartupObject>", project.StartupObject); | ||
211 | if (string.IsNullOrEmpty(project.DebugStartParameters)) | ||
212 | { | ||
213 | ps.WriteLine(" <StartArguments>{0}</StartArguments>", project.DebugStartParameters); | ||
214 | } | ||
215 | ps.WriteLine(" <FileUpgradeFlags>"); | ||
216 | ps.WriteLine(" </FileUpgradeFlags>"); | ||
217 | |||
218 | ps.WriteLine(" </PropertyGroup>"); | ||
219 | |||
220 | foreach (ConfigurationNode conf in project.Configurations) | ||
221 | { | ||
222 | ps.Write(" <PropertyGroup "); | ||
223 | ps.WriteLine("Condition=\" '$(Configuration)|$(Platform)' == '{0}|AnyCPU' \">", conf.Name); | ||
224 | ps.WriteLine(" <AllowUnsafeBlocks>{0}</AllowUnsafeBlocks>", conf.Options["AllowUnsafe"]); | ||
225 | ps.WriteLine(" <BaseAddress>{0}</BaseAddress>", conf.Options["BaseAddress"]); | ||
226 | ps.WriteLine(" <CheckForOverflowUnderflow>{0}</CheckForOverflowUnderflow>", conf.Options["CheckUnderflowOverflow"]); | ||
227 | ps.WriteLine(" <ConfigurationOverrideFile>"); | ||
228 | ps.WriteLine(" </ConfigurationOverrideFile>"); | ||
229 | ps.WriteLine(" <DefineConstants>{0}</DefineConstants>", conf.Options["CompilerDefines"]); | ||
230 | ps.WriteLine(" <DocumentationFile>{0}</DocumentationFile>", Helper.NormalizePath(conf.Options["XmlDocFile"].ToString())); | ||
231 | ps.WriteLine(" <DebugSymbols>{0}</DebugSymbols>", conf.Options["DebugInformation"]); | ||
232 | ps.WriteLine(" <FileAlignment>{0}</FileAlignment>", conf.Options["FileAlignment"]); | ||
233 | ps.WriteLine(" <Optimize>{0}</Optimize>", conf.Options["OptimizeCode"]); | ||
234 | if (project.Type != ProjectType.Web) | ||
235 | ps.WriteLine(" <OutputPath>{0}</OutputPath>", | ||
236 | Helper.EndPath(Helper.NormalizePath(conf.Options["OutputPath"].ToString()))); | ||
237 | else | ||
238 | ps.WriteLine(" <OutputPath>{0}</OutputPath>", | ||
239 | Helper.EndPath(Helper.NormalizePath("bin\\"))); | ||
240 | |||
241 | ps.WriteLine(" <RegisterForComInterop>{0}</RegisterForComInterop>", conf.Options["RegisterComInterop"]); | ||
242 | ps.WriteLine(" <RemoveIntegerChecks>{0}</RemoveIntegerChecks>", conf.Options["RemoveIntegerChecks"]); | ||
243 | ps.WriteLine(" <TreatWarningsAsErrors>{0}</TreatWarningsAsErrors>", conf.Options["WarningsAsErrors"]); | ||
244 | ps.WriteLine(" <WarningLevel>{0}</WarningLevel>", conf.Options["WarningLevel"]); | ||
245 | ps.WriteLine(" <NoStdLib>{0}</NoStdLib>", conf.Options["NoStdLib"]); | ||
246 | ps.WriteLine(" <NoWarn>{0}</NoWarn>", conf.Options["SuppressWarnings"]); | ||
247 | ps.WriteLine(" </PropertyGroup>"); | ||
248 | } | ||
249 | |||
250 | //ps.WriteLine(" </Settings>"); | ||
251 | |||
252 | List<ProjectNode> projectReferences = new List<ProjectNode>(); | ||
253 | List<ReferenceNode> otherReferences = new List<ReferenceNode>(); | ||
254 | |||
255 | foreach (ReferenceNode refr in project.References) | ||
256 | { | ||
257 | ProjectNode projectNode = FindProjectInSolution(refr.Name, solution); | ||
258 | |||
259 | if (projectNode == null) | ||
260 | otherReferences.Add(refr); | ||
261 | else | ||
262 | projectReferences.Add(projectNode); | ||
263 | } | ||
264 | // Assembly References | ||
265 | ps.WriteLine(" <ItemGroup>"); | ||
266 | |||
267 | foreach (ReferenceNode refr in otherReferences) | ||
268 | { | ||
269 | ps.Write(" <Reference"); | ||
270 | ps.Write(" Include=\""); | ||
271 | ps.Write(refr.Name); | ||
272 | ps.WriteLine("\" >"); | ||
273 | ps.Write(" <Name>"); | ||
274 | ps.Write(refr.Name); | ||
275 | ps.WriteLine("</Name>"); | ||
276 | // TODO: Allow reference to *.exe files | ||
277 | ps.WriteLine(" <Private>{0}</Private>", refr.LocalCopy); | ||
278 | ps.WriteLine(" </Reference>"); | ||
279 | } | ||
280 | ps.WriteLine(" </ItemGroup>"); | ||
281 | |||
282 | //Project References | ||
283 | ps.WriteLine(" <ItemGroup>"); | ||
284 | foreach (ProjectNode projectReference in projectReferences) | ||
285 | { | ||
286 | ToolInfo tool = (ToolInfo)tools[projectReference.Language]; | ||
287 | if (tools == null) | ||
288 | throw new UnknownLanguageException(); | ||
289 | |||
290 | string path = | ||
291 | Helper.MakePathRelativeTo(project.FullPath, | ||
292 | Helper.MakeFilePath(projectReference.FullPath, projectReference.Name, tool.FileExtension)); | ||
293 | ps.WriteLine(" <ProjectReference Include=\"{0}\">", path); | ||
294 | |||
295 | // TODO: Allow reference to visual basic projects | ||
296 | ps.WriteLine(" <Name>{0}</Name>", projectReference.Name); | ||
297 | ps.WriteLine(" <Project>{0}</Project>", projectReference.Guid.ToString("B").ToUpper()); | ||
298 | ps.WriteLine(" <Package>{0}</Package>", tool.Guid.ToUpper()); | ||
299 | ps.WriteLine(" </ProjectReference>"); | ||
300 | } | ||
301 | ps.WriteLine(" </ItemGroup>"); | ||
302 | |||
303 | // ps.WriteLine(" </Build>"); | ||
304 | ps.WriteLine(" <ItemGroup>"); | ||
305 | |||
306 | // ps.WriteLine(" <Include>"); | ||
307 | List<string> list = new List<string>(); | ||
308 | |||
309 | foreach (string path in project.Files) | ||
310 | { | ||
311 | string lower = path.ToLower(); | ||
312 | if (lower.EndsWith(".resx")) | ||
313 | { | ||
314 | string codebehind = String.Format("{0}.Designer{1}", path.Substring(0, path.LastIndexOf('.')), toolInfo.LanguageExtension); | ||
315 | if (!list.Contains(codebehind)) | ||
316 | list.Add(codebehind); | ||
317 | } | ||
318 | } | ||
319 | |||
320 | foreach (string file in project.Files) | ||
321 | { | ||
322 | // if (file == "Properties\\Bind.Designer.cs") | ||
323 | // { | ||
324 | // Console.WriteLine("Wait a minute!"); | ||
325 | // Console.WriteLine(project.Files.GetSubType(file).ToString()); | ||
326 | // } | ||
327 | |||
328 | SubType subType = project.Files.GetSubType(file); | ||
329 | |||
330 | if (subType != SubType.Code && subType != SubType.Settings && subType != SubType.Designer | ||
331 | && subType != SubType.CodeBehind) | ||
332 | { | ||
333 | ps.WriteLine(" <EmbeddedResource Include=\"{0}\">", file.Substring(0, file.LastIndexOf('.')) + ".resx"); | ||
334 | ps.WriteLine(" <DependentUpon>{0}</DependentUpon>", Path.GetFileName(file)); | ||
335 | ps.WriteLine(" <SubType>Designer</SubType>"); | ||
336 | ps.WriteLine(" </EmbeddedResource>"); | ||
337 | // | ||
338 | } | ||
339 | |||
340 | if (subType == SubType.Designer) | ||
341 | { | ||
342 | ps.WriteLine(" <EmbeddedResource Include=\"{0}\">", file); | ||
343 | ps.WriteLine(" <SubType>" + subType + "</SubType>"); | ||
344 | ps.WriteLine(" <Generator>ResXFileCodeGenerator</Generator>"); | ||
345 | |||
346 | string autogen_name = file.Substring(0, file.LastIndexOf('.')) + ".Designer.cs"; | ||
347 | string dependent_name = file.Substring(0, file.LastIndexOf('.')) + ".cs"; | ||
348 | |||
349 | ps.WriteLine(" <LastGenOutput>{0}</LastGenOutput>", autogen_name); | ||
350 | |||
351 | // Check for a parent .cs file with the same name as this designer file | ||
352 | if (File.Exists(dependent_name)) | ||
353 | ps.WriteLine(" <DependentUpon>{0}</DependentUpon>", Path.GetFileName(dependent_name)); | ||
354 | |||
355 | ps.WriteLine(" </EmbeddedResource>"); | ||
356 | if (File.Exists(autogen_name)) | ||
357 | { | ||
358 | ps.WriteLine(" <Compile Include=\"{0}\">", autogen_name); | ||
359 | ps.WriteLine(" <AutoGen>True</AutoGen>"); | ||
360 | ps.WriteLine(" <DesignTime>True</DesignTime>"); | ||
361 | |||
362 | // If a parent .cs file exists, link this autogen file to it. Otherwise link | ||
363 | // to the designer file | ||
364 | if (File.Exists(dependent_name)) | ||
365 | ps.WriteLine(" <DependentUpon>{0}</DependentUpon>", Path.GetFileName(dependent_name)); | ||
366 | else | ||
367 | ps.WriteLine(" <DependentUpon>{0}</DependentUpon>", Path.GetFileName(file)); | ||
368 | |||
369 | ps.WriteLine(" </Compile>"); | ||
370 | } | ||
371 | list.Add(autogen_name); | ||
372 | } | ||
373 | if (subType == SubType.Settings) | ||
374 | { | ||
375 | ps.Write(" <{0} ", project.Files.GetBuildAction(file)); | ||
376 | ps.WriteLine("Include=\"{0}\">", file); | ||
377 | string fileName = Path.GetFileName(file); | ||
378 | if (project.Files.GetBuildAction(file) == BuildAction.None) | ||
379 | { | ||
380 | ps.WriteLine(" <Generator>SettingsSingleFileGenerator</Generator>"); | ||
381 | ps.WriteLine(" <LastGenOutput>{0}</LastGenOutput>", fileName.Substring(0, fileName.LastIndexOf('.')) + ".Designer.cs"); | ||
382 | } | ||
383 | else | ||
384 | { | ||
385 | ps.WriteLine(" <SubType>Code</SubType>"); | ||
386 | ps.WriteLine(" <AutoGen>True</AutoGen>"); | ||
387 | ps.WriteLine(" <DesignTimeSharedInput>True</DesignTimeSharedInput>"); | ||
388 | string fileNameShort = fileName.Substring(0, fileName.LastIndexOf('.')); | ||
389 | string fileNameShorter = fileNameShort.Substring(0, fileNameShort.LastIndexOf('.')); | ||
390 | ps.WriteLine(" <DependentUpon>{0}</DependentUpon>", Path.GetFileName(fileNameShorter + ".settings")); | ||
391 | } | ||
392 | ps.WriteLine(" </{0}>", project.Files.GetBuildAction(file)); | ||
393 | } | ||
394 | else if (subType != SubType.Designer) | ||
395 | { | ||
396 | string path = Helper.NormalizePath(file); | ||
397 | string path_lower = path.ToLower(); | ||
398 | |||
399 | if (!list.Contains(file)) | ||
400 | { | ||
401 | ps.Write(" <{0} ", project.Files.GetBuildAction(path)); | ||
402 | |||
403 | int startPos = 0; | ||
404 | if (project.Files.GetPreservePath(file)) | ||
405 | { | ||
406 | while ((@"./\").IndexOf(file.Substring(startPos, 1)) != -1) | ||
407 | startPos++; | ||
408 | |||
409 | } | ||
410 | else | ||
411 | { | ||
412 | startPos = file.LastIndexOf(Path.GetFileName(path)); | ||
413 | } | ||
414 | |||
415 | ps.WriteLine("Include=\"{0}\">", path); | ||
416 | |||
417 | int last_period_index = file.LastIndexOf('.'); | ||
418 | string short_file_name = file.Substring(0, last_period_index); | ||
419 | string extension = Path.GetExtension(path); | ||
420 | string designer_format = string.Format(".designer{0}", extension); | ||
421 | |||
422 | if (path_lower.EndsWith(designer_format)) | ||
423 | { | ||
424 | int designer_index = path_lower.IndexOf(designer_format); | ||
425 | string file_name = path.Substring(0, designer_index); | ||
426 | |||
427 | if (File.Exists(file_name)) | ||
428 | ps.WriteLine(" <DependentUpon>{0}</DependentUpon>", Path.GetFileName(file_name)); | ||
429 | else if (File.Exists(file_name + ".resx")) | ||
430 | ps.WriteLine(" <DependentUpon>{0}</DependentUpon>", Path.GetFileName(file_name + ".resx")); | ||
431 | } | ||
432 | else if (subType == SubType.CodeBehind) | ||
433 | { | ||
434 | ps.WriteLine(" <DependentUpon>{0}</DependentUpon>", Path.GetFileName(short_file_name)); | ||
435 | } | ||
436 | if (project.Files.GetIsLink(file)) | ||
437 | { | ||
438 | string alias = project.Files.GetLinkPath(file); | ||
439 | alias += file.Substring(startPos); | ||
440 | alias = Helper.NormalizePath(alias); | ||
441 | ps.WriteLine(" <Link>{0}</Link>", alias); | ||
442 | } | ||
443 | else if (project.Files.GetBuildAction(file) != BuildAction.None) | ||
444 | { | ||
445 | if (project.Files.GetBuildAction(file) != BuildAction.EmbeddedResource) | ||
446 | { | ||
447 | ps.WriteLine(" <SubType>{0}</SubType>", subType); | ||
448 | } | ||
449 | } | ||
450 | |||
451 | if (project.Files.GetCopyToOutput(file) != CopyToOutput.Never) | ||
452 | { | ||
453 | ps.WriteLine(" <CopyToOutputDirectory>{0}</CopyToOutputDirectory>", project.Files.GetCopyToOutput(file)); | ||
454 | } | ||
455 | |||
456 | ps.WriteLine(" </{0}>", project.Files.GetBuildAction(file)); | ||
457 | } | ||
458 | } | ||
459 | } | ||
460 | |||
461 | ps.WriteLine(" </ItemGroup>"); | ||
462 | ps.WriteLine(" <Import Project=\"" + toolInfo.ImportProject + "\" />"); | ||
463 | ps.WriteLine(" <PropertyGroup>"); | ||
464 | ps.WriteLine(" <PreBuildEvent>"); | ||
465 | ps.WriteLine(" </PreBuildEvent>"); | ||
466 | ps.WriteLine(" <PostBuildEvent>"); | ||
467 | ps.WriteLine(" </PostBuildEvent>"); | ||
468 | ps.WriteLine(" </PropertyGroup>"); | ||
469 | ps.WriteLine("</Project>"); | ||
470 | } | ||
471 | #endregion | ||
472 | |||
473 | #region User File | ||
474 | |||
475 | ps = new StreamWriter(projectFile + ".user"); | ||
476 | using (ps) | ||
477 | { | ||
478 | ps.WriteLine("<Project xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">"); | ||
479 | //ps.WriteLine( "<VisualStudioProject>" ); | ||
480 | //ps.WriteLine(" <{0}>", toolInfo.XMLTag); | ||
481 | //ps.WriteLine(" <Build>"); | ||
482 | ps.WriteLine(" <PropertyGroup>"); | ||
483 | //ps.WriteLine(" <Settings ReferencePath=\"{0}\">", MakeRefPath(project)); | ||
484 | ps.WriteLine(" <Configuration Condition=\" '$(Configuration)' == '' \">Debug</Configuration>"); | ||
485 | ps.WriteLine(" <Platform Condition=\" '$(Platform)' == '' \">AnyCPU</Platform>"); | ||
486 | ps.WriteLine(" <ReferencePath>{0}</ReferencePath>", MakeRefPath(project)); | ||
487 | ps.WriteLine(" <LastOpenVersion>{0}</LastOpenVersion>", this.ProductVersion); | ||
488 | ps.WriteLine(" <ProjectView>ProjectFiles</ProjectView>"); | ||
489 | ps.WriteLine(" <ProjectTrust>0</ProjectTrust>"); | ||
490 | ps.WriteLine(" </PropertyGroup>"); | ||
491 | foreach (ConfigurationNode conf in project.Configurations) | ||
492 | { | ||
493 | ps.Write(" <PropertyGroup"); | ||
494 | ps.Write(" Condition = \" '$(Configuration)|$(Platform)' == '{0}|AnyCPU' \"", conf.Name); | ||
495 | ps.WriteLine(" />"); | ||
496 | } | ||
497 | ps.WriteLine("</Project>"); | ||
498 | } | ||
499 | #endregion | ||
500 | |||
501 | kernel.CurrentWorkingDirectory.Pop(); | ||
502 | } | ||
503 | |||
504 | private void WriteSolution(SolutionNode solution, bool writeSolutionToDisk) | ||
505 | { | ||
506 | kernel.Log.Write("Creating {0} solution and project files", this.VersionName); | ||
507 | |||
508 | foreach (SolutionNode child in solution.Solutions) | ||
509 | { | ||
510 | kernel.Log.Write("...Creating folder: {0}", child.Name); | ||
511 | WriteSolution(child, false); | ||
512 | } | ||
513 | |||
514 | foreach (ProjectNode project in solution.Projects) | ||
515 | { | ||
516 | kernel.Log.Write("...Creating project: {0}", project.Name); | ||
517 | WriteProject(solution, project); | ||
518 | } | ||
519 | |||
520 | foreach (DatabaseProjectNode project in solution.DatabaseProjects) | ||
521 | { | ||
522 | kernel.Log.Write("...Creating database project: {0}", project.Name); | ||
523 | WriteDatabaseProject(solution, project); | ||
524 | } | ||
525 | |||
526 | if (writeSolutionToDisk) // only write main solution | ||
527 | { | ||
528 | kernel.Log.Write(""); | ||
529 | string solutionFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "sln"); | ||
530 | |||
531 | using (StreamWriter ss = new StreamWriter(solutionFile)) | ||
532 | { | ||
533 | kernel.CurrentWorkingDirectory.Push(); | ||
534 | Helper.SetCurrentDir(Path.GetDirectoryName(solutionFile)); | ||
535 | |||
536 | ss.WriteLine("Microsoft Visual Studio Solution File, Format Version {0}", this.SolutionVersion); | ||
537 | ss.WriteLine(SolutionTag); | ||
538 | |||
539 | WriteProjectDeclarations(ss, solution, solution); | ||
540 | |||
541 | ss.WriteLine("Global"); | ||
542 | |||
543 | ss.WriteLine("\tGlobalSection(SolutionConfigurationPlatforms) = preSolution"); | ||
544 | foreach (ConfigurationNode conf in solution.Configurations) | ||
545 | { | ||
546 | ss.WriteLine("\t\t{0}|Any CPU = {0}|Any CPU", conf.Name); | ||
547 | } | ||
548 | ss.WriteLine("\tEndGlobalSection"); | ||
549 | |||
550 | ss.WriteLine("\tGlobalSection(ProjectConfigurationPlatforms) = postSolution"); | ||
551 | WriteConfigurationLines(solution.Configurations, solution, ss); | ||
552 | ss.WriteLine("\tEndGlobalSection"); | ||
553 | |||
554 | if (solution.Solutions.Count > 0) | ||
555 | { | ||
556 | ss.WriteLine("\tGlobalSection(NestedProjects) = preSolution"); | ||
557 | foreach (SolutionNode embeddedSolution in solution.Solutions) | ||
558 | { | ||
559 | WriteNestedProjectMap(ss, embeddedSolution); | ||
560 | } | ||
561 | ss.WriteLine("\tEndGlobalSection"); | ||
562 | } | ||
563 | |||
564 | ss.WriteLine("EndGlobal"); | ||
565 | } | ||
566 | |||
567 | kernel.CurrentWorkingDirectory.Pop(); | ||
568 | } | ||
569 | } | ||
570 | |||
571 | private void WriteProjectDeclarations(StreamWriter writer, SolutionNode actualSolution, SolutionNode embeddedSolution) | ||
572 | { | ||
573 | foreach (SolutionNode childSolution in embeddedSolution.Solutions) | ||
574 | { | ||
575 | WriteEmbeddedSolution(writer, childSolution); | ||
576 | WriteProjectDeclarations(writer, actualSolution, childSolution); | ||
577 | } | ||
578 | |||
579 | foreach (ProjectNode project in embeddedSolution.Projects) | ||
580 | { | ||
581 | WriteProject(actualSolution, writer, project); | ||
582 | } | ||
583 | |||
584 | foreach (DatabaseProjectNode dbProject in embeddedSolution.DatabaseProjects) | ||
585 | { | ||
586 | WriteProject(actualSolution, writer, dbProject); | ||
587 | } | ||
588 | |||
589 | if (actualSolution.Guid == embeddedSolution.Guid) | ||
590 | { | ||
591 | WriteSolutionFiles(actualSolution, writer); | ||
592 | } | ||
593 | } | ||
594 | |||
595 | private static void WriteNestedProjectMap(StreamWriter writer, SolutionNode embeddedSolution) | ||
596 | { | ||
597 | foreach (ProjectNode project in embeddedSolution.Projects) | ||
598 | { | ||
599 | WriteNestedProject(writer, embeddedSolution, project.Guid); | ||
600 | } | ||
601 | |||
602 | foreach (DatabaseProjectNode dbProject in embeddedSolution.DatabaseProjects) | ||
603 | { | ||
604 | WriteNestedProject(writer, embeddedSolution, dbProject.Guid); | ||
605 | } | ||
606 | |||
607 | foreach (SolutionNode child in embeddedSolution.Solutions) | ||
608 | { | ||
609 | WriteNestedProject(writer, embeddedSolution, child.Guid); | ||
610 | WriteNestedProjectMap(writer, child); | ||
611 | } | ||
612 | } | ||
613 | |||
614 | private static void WriteNestedProject(StreamWriter writer, SolutionNode solution, Guid projectGuid) | ||
615 | { | ||
616 | WriteNestedFolder(writer, solution.Guid, projectGuid); | ||
617 | } | ||
618 | |||
619 | private static void WriteNestedFolder(StreamWriter writer, Guid parentGuid, Guid childGuid) | ||
620 | { | ||
621 | writer.WriteLine("\t\t{0} = {1}", | ||
622 | childGuid.ToString("B").ToUpper(), | ||
623 | parentGuid.ToString("B").ToUpper()); | ||
624 | } | ||
625 | |||
626 | private static void WriteConfigurationLines(ICollection configurations, SolutionNode solution, StreamWriter ss) | ||
627 | { | ||
628 | foreach (ProjectNode project in solution.Projects) | ||
629 | { | ||
630 | foreach (ConfigurationNode conf in configurations) | ||
631 | { | ||
632 | ss.WriteLine("\t\t{0}.{1}|Any CPU.ActiveCfg = {1}|Any CPU", | ||
633 | project.Guid.ToString("B").ToUpper(), | ||
634 | conf.Name); | ||
635 | |||
636 | ss.WriteLine("\t\t{0}.{1}|Any CPU.Build.0 = {1}|Any CPU", | ||
637 | project.Guid.ToString("B").ToUpper(), | ||
638 | conf.Name); | ||
639 | } | ||
640 | } | ||
641 | |||
642 | foreach (SolutionNode child in solution.Solutions) | ||
643 | { | ||
644 | WriteConfigurationLines(configurations, child, ss); | ||
645 | } | ||
646 | } | ||
647 | |||
648 | private void WriteSolutionFiles(SolutionNode solution, StreamWriter ss) | ||
649 | { | ||
650 | WriteProject(ss, "Folder", solution.Guid, "Solution Files", "Solution Files", solution.Files); | ||
651 | } | ||
652 | |||
653 | private void WriteEmbeddedSolution(StreamWriter writer, SolutionNode embeddedSolution) | ||
654 | { | ||
655 | WriteProject(writer, "Folder", embeddedSolution.Guid, embeddedSolution.Name, embeddedSolution.Name, embeddedSolution.Files); | ||
656 | } | ||
657 | |||
658 | private void WriteProject(SolutionNode solution, StreamWriter ss, ProjectNode project) | ||
659 | { | ||
660 | WriteProject(ss, solution, project.Language, project.Guid, project.Name, project.FullPath); | ||
661 | } | ||
662 | |||
663 | private void WriteProject(SolutionNode solution, StreamWriter ss, DatabaseProjectNode dbProject) | ||
664 | { | ||
665 | if (solution.Files != null && solution.Files.Count > 0) | ||
666 | WriteProject(ss, solution, "Database", dbProject.Guid, dbProject.Name, dbProject.FullPath); | ||
667 | } | ||
668 | |||
669 | private static bool ExtensionSpecified(string refName) | ||
670 | { | ||
671 | return refName.EndsWith(".dll") || refName.EndsWith(".exe"); | ||
672 | } | ||
673 | |||
674 | private static string GetProjectExtension(ProjectNode project) | ||
675 | { | ||
676 | string extension = ".dll"; | ||
677 | if (project.Type == ProjectType.Exe) | ||
678 | { | ||
679 | extension = ".exe"; | ||
680 | } | ||
681 | return extension; | ||
682 | } | ||
683 | |||
684 | const string ProjectDeclarationBeginFormat = "Project(\"{0}\") = \"{1}\", \"{2}\", \"{3}\""; | ||
685 | const string ProjectDeclarationEndFormat = "EndProject"; | ||
686 | |||
687 | private void WriteProject(StreamWriter ss, SolutionNode solution, string language, Guid guid, string name, string projectFullPath) | ||
688 | { | ||
689 | if (!tools.ContainsKey(language)) | ||
690 | throw new UnknownLanguageException("Unknown .NET language: " + language); | ||
691 | |||
692 | ToolInfo toolInfo = (ToolInfo)tools[language]; | ||
693 | |||
694 | string path = Helper.MakePathRelativeTo(solution.FullPath, projectFullPath); | ||
695 | |||
696 | path = Helper.MakeFilePath(path, name, toolInfo.FileExtension); | ||
697 | |||
698 | WriteProject(ss, language, guid, name, path); | ||
699 | } | ||
700 | |||
701 | private void WriteProject(StreamWriter writer, string language, Guid projectGuid, string name, string location) | ||
702 | { | ||
703 | WriteProject(writer, language, projectGuid, name, location, null); | ||
704 | } | ||
705 | |||
706 | private void WriteProject(StreamWriter writer, string language, Guid projectGuid, string name, string location, FilesNode files) | ||
707 | { | ||
708 | if (!tools.ContainsKey(language)) | ||
709 | throw new UnknownLanguageException("Unknown .NET language: " + language); | ||
710 | |||
711 | ToolInfo toolInfo = (ToolInfo)tools[language]; | ||
712 | |||
713 | writer.WriteLine(ProjectDeclarationBeginFormat, | ||
714 | toolInfo.Guid, | ||
715 | name, | ||
716 | location, | ||
717 | projectGuid.ToString("B").ToUpper()); | ||
718 | |||
719 | if (files != null) | ||
720 | { | ||
721 | writer.WriteLine("\tProjectSection(SolutionItems) = preProject"); | ||
722 | |||
723 | foreach (string file in files) | ||
724 | writer.WriteLine("\t\t{0} = {0}", file); | ||
725 | |||
726 | writer.WriteLine("\tEndProjectSection"); | ||
727 | } | ||
728 | |||
729 | writer.WriteLine(ProjectDeclarationEndFormat); | ||
730 | } | ||
731 | |||
732 | private void WriteDatabaseProject(SolutionNode solution, DatabaseProjectNode project) | ||
733 | { | ||
734 | string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, "dbp"); | ||
735 | IndentedTextWriter ps = new IndentedTextWriter(new StreamWriter(projectFile), " "); | ||
736 | |||
737 | kernel.CurrentWorkingDirectory.Push(); | ||
738 | |||
739 | Helper.SetCurrentDir(Path.GetDirectoryName(projectFile)); | ||
740 | |||
741 | using (ps) | ||
742 | { | ||
743 | ps.WriteLine("# Microsoft Developer Studio Project File - Database Project"); | ||
744 | ps.WriteLine("Begin DataProject = \"{0}\"", project.Name); | ||
745 | ps.Indent++; | ||
746 | ps.WriteLine("MSDTVersion = \"80\""); | ||
747 | // TODO: Use the project.Files property | ||
748 | if (ContainsSqlFiles(Path.GetDirectoryName(projectFile))) | ||
749 | WriteDatabaseFoldersAndFiles(ps, Path.GetDirectoryName(projectFile)); | ||
750 | |||
751 | ps.WriteLine("Begin DBRefFolder = \"Database References\""); | ||
752 | ps.Indent++; | ||
753 | foreach (DatabaseReferenceNode reference in project.References) | ||
754 | { | ||
755 | ps.WriteLine("Begin DBRefNode = \"{0}\"", reference.Name); | ||
756 | ps.Indent++; | ||
757 | ps.WriteLine("ConnectStr = \"{0}\"", reference.ConnectionString); | ||
758 | ps.WriteLine("Provider = \"{0}\"", reference.ProviderId.ToString("B").ToUpper()); | ||
759 | //ps.WriteLine("Colorizer = 5"); | ||
760 | ps.Indent--; | ||
761 | ps.WriteLine("End"); | ||
762 | } | ||
763 | ps.Indent--; | ||
764 | ps.WriteLine("End"); | ||
765 | ps.Indent--; | ||
766 | ps.WriteLine("End"); | ||
767 | |||
768 | ps.Flush(); | ||
769 | } | ||
770 | |||
771 | kernel.CurrentWorkingDirectory.Pop(); | ||
772 | } | ||
773 | |||
774 | private bool ContainsSqlFiles(string folder) | ||
775 | { | ||
776 | foreach (string file in Directory.GetFiles(folder, "*.sql")) | ||
777 | { | ||
778 | return true; // if the folder contains 1 .sql file, that's good enough | ||
779 | } | ||
780 | |||
781 | foreach (string child in Directory.GetDirectories(folder)) | ||
782 | { | ||
783 | if (ContainsSqlFiles(child)) | ||
784 | return true; // if 1 child folder contains a .sql file, still good enough | ||
785 | } | ||
786 | |||
787 | return false; | ||
788 | } | ||
789 | |||
790 | private void WriteDatabaseFoldersAndFiles(IndentedTextWriter writer, string folder) | ||
791 | { | ||
792 | foreach (string child in Directory.GetDirectories(folder)) | ||
793 | { | ||
794 | if (ContainsSqlFiles(child)) | ||
795 | { | ||
796 | writer.WriteLine("Begin Folder = \"{0}\"", Path.GetFileName(child)); | ||
797 | writer.Indent++; | ||
798 | WriteDatabaseFoldersAndFiles(writer, child); | ||
799 | writer.Indent--; | ||
800 | writer.WriteLine("End"); | ||
801 | } | ||
802 | } | ||
803 | foreach (string file in Directory.GetFiles(folder, "*.sql")) | ||
804 | { | ||
805 | writer.WriteLine("Script = \"{0}\"", Path.GetFileName(file)); | ||
806 | } | ||
807 | } | ||
808 | |||
809 | private void CleanProject(ProjectNode project) | ||
810 | { | ||
811 | kernel.Log.Write("...Cleaning project: {0}", project.Name); | ||
812 | |||
813 | ToolInfo toolInfo = (ToolInfo)tools[project.Language]; | ||
814 | string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, toolInfo.FileExtension); | ||
815 | string userFile = projectFile + ".user"; | ||
816 | |||
817 | Helper.DeleteIfExists(projectFile); | ||
818 | Helper.DeleteIfExists(userFile); | ||
819 | } | ||
820 | |||
821 | private void CleanSolution(SolutionNode solution) | ||
822 | { | ||
823 | kernel.Log.Write("Cleaning {0} solution and project files", this.VersionName, solution.Name); | ||
824 | |||
825 | string slnFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "sln"); | ||
826 | string suoFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "suo"); | ||
827 | |||
828 | Helper.DeleteIfExists(slnFile); | ||
829 | Helper.DeleteIfExists(suoFile); | ||
830 | |||
831 | foreach (ProjectNode project in solution.Projects) | ||
832 | { | ||
833 | CleanProject(project); | ||
834 | } | ||
835 | |||
836 | kernel.Log.Write(""); | ||
837 | } | ||
838 | |||
839 | #endregion | ||
840 | |||
841 | #region ITarget Members | ||
842 | |||
843 | /// <summary> | ||
844 | /// Writes the specified kern. | ||
845 | /// </summary> | ||
846 | /// <param name="kern">The kern.</param> | ||
847 | public virtual void Write(Kernel kern) | ||
848 | { | ||
849 | if (kern == null) | ||
850 | { | ||
851 | throw new ArgumentNullException("kern"); | ||
852 | } | ||
853 | kernel = kern; | ||
854 | foreach (SolutionNode sol in kernel.Solutions) | ||
855 | { | ||
856 | WriteSolution(sol, true); | ||
857 | } | ||
858 | kernel = null; | ||
859 | } | ||
860 | |||
861 | /// <summary> | ||
862 | /// Cleans the specified kern. | ||
863 | /// </summary> | ||
864 | /// <param name="kern">The kern.</param> | ||
865 | public virtual void Clean(Kernel kern) | ||
866 | { | ||
867 | if (kern == null) | ||
868 | { | ||
869 | throw new ArgumentNullException("kern"); | ||
870 | } | ||
871 | kernel = kern; | ||
872 | foreach (SolutionNode sol in kernel.Solutions) | ||
873 | { | ||
874 | CleanSolution(sol); | ||
875 | } | ||
876 | kernel = null; | ||
877 | } | ||
878 | |||
879 | #endregion | ||
880 | } | ||
881 | } | ||
diff --git a/Prebuild/src/Core/Targets/VSVersion.cs b/Prebuild/src/Core/Targets/VSVersion.cs deleted file mode 100644 index f477086..0000000 --- a/Prebuild/src/Core/Targets/VSVersion.cs +++ /dev/null | |||
@@ -1,50 +0,0 @@ | |||
1 | #region BSD License | ||
2 | /* | ||
3 | Copyright (c) 2008-2009 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com), John Anderson (sontek@gmail.com) | ||
4 | |||
5 | Redistribution and use in source and binary forms, with or without modification, are permitted | ||
6 | provided that the following conditions are met: | ||
7 | |||
8 | * Redistributions of source code must retain the above copyright notice, this list of conditions | ||
9 | and the following disclaimer. | ||
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 | ||
12 | distribution. | ||
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. | ||
15 | |||
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 | ||
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 | ||
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 | ||
22 | IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
23 | */ | ||
24 | #endregion | ||
25 | |||
26 | namespace Prebuild.Core.Targets | ||
27 | { | ||
28 | /// <summary> | ||
29 | /// | ||
30 | /// </summary> | ||
31 | public enum VSVersion | ||
32 | { | ||
33 | /// <summary> | ||
34 | /// Visual Studio 2002 | ||
35 | /// </summary> | ||
36 | VS70, | ||
37 | /// <summary> | ||
38 | /// Visual Studio 2003 | ||
39 | /// </summary> | ||
40 | VS71, | ||
41 | /// <summary> | ||
42 | /// Visual Studio 2005 | ||
43 | /// </summary> | ||
44 | VS80, | ||
45 | /// <summary> | ||
46 | /// Visual Studio 2008 | ||
47 | /// </summary> | ||
48 | VS90 | ||
49 | } | ||
50 | } | ||
diff --git a/Prebuild/src/Core/Targets/XcodeTarget.cs b/Prebuild/src/Core/Targets/XcodeTarget.cs index d96f65b..ee3b241 100644 --- a/Prebuild/src/Core/Targets/XcodeTarget.cs +++ b/Prebuild/src/Core/Targets/XcodeTarget.cs | |||
@@ -23,6 +23,15 @@ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY O | |||
23 | */ | 23 | */ |
24 | #endregion | 24 | #endregion |
25 | 25 | ||
26 | #region CVS Information | ||
27 | /* | ||
28 | * $Source$ | ||
29 | * $Author: jendave $ | ||
30 | * $Date: 2007-02-13 12:58:03 -0800 (Tue, 13 Feb 2007) $ | ||
31 | * $Revision: 205 $ | ||
32 | */ | ||
33 | #endregion | ||
34 | |||
26 | using System; | 35 | using System; |
27 | using System.Collections; | 36 | using System.Collections; |
28 | using System.Collections.Specialized; | 37 | using System.Collections.Specialized; |