From e36c452d4e891073768fd70915a65531f806f831 Mon Sep 17 00:00:00 2001 From: lbsa71 Date: Thu, 19 Feb 2009 14:16:22 +0000 Subject: * Reverted Prebuild commit due to strange run-time errors. --- Prebuild/src/Core/Targets/AutotoolsTarget.cs | 112 +-- Prebuild/src/Core/Targets/DebugTarget.cs | 2 +- Prebuild/src/Core/Targets/MonoDevelopTarget.cs | 9 + Prebuild/src/Core/Targets/NAntTarget.cs | 859 +++++++++++----------- Prebuild/src/Core/Targets/SharpDevelop2Target.cs | 33 +- Prebuild/src/Core/Targets/SharpDevelopTarget.cs | 9 + Prebuild/src/Core/Targets/ToolInfo.cs | 197 ----- Prebuild/src/Core/Targets/VS2002Target.cs | 9 + Prebuild/src/Core/Targets/VS2003Target.cs | 31 + Prebuild/src/Core/Targets/VS2005Target.cs | 837 ++++++++++++++++++++- Prebuild/src/Core/Targets/VS2008Target.cs | 152 +--- Prebuild/src/Core/Targets/VSGenericTarget.cs | 881 ----------------------- Prebuild/src/Core/Targets/VSVersion.cs | 50 -- Prebuild/src/Core/Targets/XcodeTarget.cs | 9 + 14 files changed, 1442 insertions(+), 1748 deletions(-) delete mode 100644 Prebuild/src/Core/Targets/ToolInfo.cs delete mode 100644 Prebuild/src/Core/Targets/VSGenericTarget.cs delete mode 100644 Prebuild/src/Core/Targets/VSVersion.cs (limited to 'Prebuild/src/Core/Targets') 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. */ #endregion + +#region CVS Information +/* + * $Source$ + * $Author: jendave $ + * $Date: 2006-07-28 22:43:24 -0700 (Fri, 28 Jul 2006) $ + * $Revision: 136 $ + */ +#endregion + using System; using System.Collections; -using System.Collections.Generic; using System.Collections.Specialized; using System.IO; using System.Reflection; @@ -173,7 +182,8 @@ namespace Prebuild.Core.Targets Hashtable assemblyPathToPackage = new Hashtable(); Hashtable assemblyFullNameToPath = new Hashtable(); Hashtable packagesHash = new Hashtable(); - readonly List packages = new List(); + ArrayList packages = new ArrayList(); + ClrVersion currentVersion; #endregion @@ -193,6 +203,22 @@ namespace Prebuild.Core.Targets di.Create(); } + private void mkStubFiles(string dirName, ArrayList fileNames) + { + for (int i = 0; i < fileNames.Count; i++) + { + string tmpFile = dirName + "/" + (string)fileNames[i]; + + FileStream tmpFileStream = + new FileStream(tmpFile, FileMode.Create); + + StreamWriter sw = new StreamWriter(tmpFileStream); + sw.WriteLine("These are not the files you are looking for."); + sw.Flush(); + tmpFileStream.Close(); + } + } + private void chkMkDir(string dirName) { System.IO.DirectoryInfo di = @@ -247,11 +273,11 @@ namespace Prebuild.Core.Targets } } - private List GetAssembliesWithLibInfo(string line, string file) + private ArrayList GetAssembliesWithLibInfo(string line, string file) { - List references = new List(); - List libdirs = new List(); - List retval = new List(); + ArrayList references = new ArrayList(); + ArrayList libdirs = new ArrayList(); + ArrayList retval = new ArrayList(); foreach (string piece in line.Split(' ')) { if (piece.ToLower().Trim().StartsWith("/r:") || piece.ToLower().Trim().StartsWith("-r:")) @@ -278,9 +304,9 @@ namespace Prebuild.Core.Targets return retval; } - private List GetAssembliesWithoutLibInfo(string line, string file) + private ArrayList GetAssembliesWithoutLibInfo(string line, string file) { - List references = new List(); + ArrayList references = new ArrayList(); foreach (string reference in line.Split(' ')) { if (reference.ToLower().Trim().StartsWith("/r:") || reference.ToLower().Trim().StartsWith("-r:")) @@ -330,7 +356,7 @@ namespace Prebuild.Core.Targets if (packagesHash.Contains(pname)) return; - List fullassemblies = null; + ArrayList fullassemblies = null; string version = ""; string desc = ""; @@ -378,7 +404,7 @@ namespace Prebuild.Core.Targets package.Initialize(pname, version, desc, - fullassemblies.ToArray(), + (string[])fullassemblies.ToArray(typeof(string)), ClrVersion.Default, false); packages.Add(package); @@ -388,7 +414,7 @@ namespace Prebuild.Core.Targets void RegisterSystemAssemblies(string prefix, string version, ClrVersion ver) { SystemPackage package = new SystemPackage(); - List list = new List(); + ArrayList list = new ArrayList(); string dir = Path.Combine(prefix, version); if (!Directory.Exists(dir)) @@ -405,7 +431,7 @@ namespace Prebuild.Core.Targets package.Initialize("mono", version, "The Mono runtime", - list.ToArray(), + (string[])list.ToArray(typeof(string)), ver, false); packages.Add(package); @@ -418,10 +444,12 @@ namespace Prebuild.Core.Targets if (Environment.Version.Major == 1) { versionDir = "1.0"; + currentVersion = ClrVersion.Net_1_1; } else { versionDir = "2.0"; + currentVersion = ClrVersion.Net_2_0; } //Pull up assemblies from the installed mono system. @@ -455,9 +483,9 @@ namespace Prebuild.Core.Targets } } search_dirs += Path.PathSeparator + libpath; - if (!string.IsNullOrEmpty(search_dirs)) + if (search_dirs != null && search_dirs.Length > 0) { - List scanDirs = new List(); + ArrayList scanDirs = new ArrayList(); foreach (string potentialDir in search_dirs.Split(Path.PathSeparator)) { if (!scanDirs.Contains(potentialDir)) @@ -735,22 +763,20 @@ namespace Prebuild.Core.Targets bool hasAssemblyConfig = false; chkMkDir(projectDir); - List - compiledFiles = new List(), - contentFiles = new List(), - embeddedFiles = new List(), - - binaryLibs = new List(), - pkgLibs = new List(), - systemLibs = new List(), - runtimeLibs = new List(), + ArrayList + compiledFiles = new ArrayList(), + contentFiles = new ArrayList(), + embeddedFiles = new ArrayList(), - extraDistFiles = new List(), - localCopyTargets = new List(); + binaryLibs = new ArrayList(), + pkgLibs = new ArrayList(), + systemLibs = new ArrayList(), + runtimeLibs = new ArrayList(), - // If there exists a .config file for this assembly, copy - // it to the project folder + extraDistFiles = new ArrayList(), + localCopyTargets = new ArrayList(); + // If there exists a .config file for this assembly, copy it to the project folder // TODO: Support copying .config.osx files // TODO: support processing the .config file for native library deps string projectAssemblyName = project.Name; @@ -813,15 +839,11 @@ namespace Prebuild.Core.Targets foreach (System.CodeDom.Compiler.CompilerError error in cr.Errors) Console.WriteLine("Error! '{0}'", error.ErrorText); - try { - string projectFullName = cr.CompiledAssembly.FullName; - Regex verRegex = new Regex("Version=([\\d\\.]+)"); - Match verMatch = verRegex.Match(projectFullName); - if (verMatch.Success) + string projectFullName = cr.CompiledAssembly.FullName; + Regex verRegex = new Regex("Version=([\\d\\.]+)"); + Match verMatch = verRegex.Match(projectFullName); + if (verMatch.Success) projectVersion = verMatch.Groups[1].Value; - }catch{ - Console.WriteLine("Couldn't compile AssemblyInfo.cs"); - } // Clean up the temp file try @@ -831,7 +853,7 @@ namespace Prebuild.Core.Targets } catch { - Console.WriteLine("Error! '{0}'", e.ToString()); + //Console.WriteLine("Error! '{0}'", e.ToString()); } } @@ -991,46 +1013,46 @@ namespace Prebuild.Core.Targets } } - const string lineSep = " \\\n\t"; + string lineSep = " \\\n\t"; string compiledFilesString = string.Empty; if (compiledFiles.Count > 0) compiledFilesString = - lineSep + string.Join(lineSep, compiledFiles.ToArray()); + lineSep + string.Join(lineSep, (string[])compiledFiles.ToArray(typeof(string))); string embeddedFilesString = ""; if (embeddedFiles.Count > 0) embeddedFilesString = - lineSep + string.Join(lineSep, embeddedFiles.ToArray()); + lineSep + string.Join(lineSep, (string[])embeddedFiles.ToArray(typeof(string))); string contentFilesString = ""; if (contentFiles.Count > 0) contentFilesString = - lineSep + string.Join(lineSep, contentFiles.ToArray()); + lineSep + string.Join(lineSep, (string[])contentFiles.ToArray(typeof(string))); string extraDistFilesString = ""; if (extraDistFiles.Count > 0) extraDistFilesString = - lineSep + string.Join(lineSep, extraDistFiles.ToArray()); + lineSep + string.Join(lineSep, (string[])extraDistFiles.ToArray(typeof(string))); string pkgLibsString = ""; if (pkgLibs.Count > 0) pkgLibsString = - lineSep + string.Join(lineSep, pkgLibs.ToArray()); + lineSep + string.Join(lineSep, (string[])pkgLibs.ToArray(typeof(string))); string binaryLibsString = ""; if (binaryLibs.Count > 0) binaryLibsString = - lineSep + string.Join(lineSep, binaryLibs.ToArray()); + lineSep + string.Join(lineSep, (string[])binaryLibs.ToArray(typeof(string))); string systemLibsString = ""; if (systemLibs.Count > 0) systemLibsString = - lineSep + string.Join(lineSep, systemLibs.ToArray()); + lineSep + string.Join(lineSep, (string[])systemLibs.ToArray(typeof(string))); string localCopyTargetsString = ""; if (localCopyTargets.Count > 0) localCopyTargetsString = - string.Join("\n", localCopyTargets.ToArray()); + string.Join("\n", (string[])localCopyTargets.ToArray(typeof(string))); string monoPath = ""; 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 /* * $Source$ * $Author: jendave $ - * $Date: 2006-09-20 09:42:51 +0200 (on, 20 sep 2006) $ + * $Date: 2006-09-20 16:42:51 +0900 (Wed, 20 Sep 2006) $ * $Revision: 164 $ */ #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 */ #endregion +#region CVS Information +/* + * $Source$ + * $Author: cjcollier $ + * $Date: 2007-04-11 07:10:35 +0900 (Wed, 11 Apr 2007) $ + * $Revision: 231 $ + */ +#endregion + using System; using System.Collections; 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 @@ #region BSD License /* Copyright (c) 2004 - 2008 -Matthew Holmes (matthew@wildfiregames.com), -Dan Moorehead (dan05a@gmail.com), -C.J. Adams-Collier (cjac@colliertech.org), +Matthew Holmes (matthew@wildfiregames.com), +Dan Moorehead (dan05a@gmail.com), +C.J. Adams-Collier (cjac@colliertech.org), Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are @@ -35,6 +35,15 @@ POSSIBILITY OF SUCH DAMAGE. #endregion +#region CVS Information +/* + * $Source$ + * $Author: cjcollier $ + * $Date: 2008-02-07 10:22:36 +0900 (Thu, 07 Feb 2008) $ + * $Revision: 255 $ + */ +#endregion + using System; using System.Collections; using System.Collections.Specialized; @@ -49,73 +58,85 @@ using Prebuild.Core.Utilities; namespace Prebuild.Core.Targets { - /// - /// - /// - [Target("nant")] - public class NAntTarget : ITarget - { - #region Fields - - private Kernel m_Kernel; - - #endregion - - #region Private Methods - - private static string PrependPath(string path) - { - string tmpPath = Helper.NormalizePath(path, '/'); - Regex regex = new Regex(@"(\w):/(\w+)"); - Match match = regex.Match(tmpPath); - //if(match.Success || tmpPath[0] == '.' || tmpPath[0] == '/') - //{ - tmpPath = Helper.NormalizePath(tmpPath); - //} - // else - // { - // tmpPath = Helper.NormalizePath("./" + tmpPath); - // } - - return tmpPath; - } + /// + /// + /// + [Target("nant")] + public class NAntTarget : ITarget + { + #region Fields + + private Kernel m_Kernel; + + #endregion + + #region Private Methods + + private static string PrependPath(string path) + { + string tmpPath = Helper.NormalizePath(path, '/'); + Regex regex = new Regex(@"(\w):/(\w+)"); + Match match = regex.Match(tmpPath); + //if(match.Success || tmpPath[0] == '.' || tmpPath[0] == '/') + //{ + tmpPath = Helper.NormalizePath(tmpPath); + //} + // else + // { + // tmpPath = Helper.NormalizePath("./" + tmpPath); + // } + + return tmpPath; + } private static string BuildReference(SolutionNode solution, ProjectNode currentProject, ReferenceNode refr) { + string ret = ""; + string referencePath = ((ReferencePathNode)currentProject.ReferencePaths[0]).Path; - if (!String.IsNullOrEmpty(refr.Path)) + if (String.IsNullOrEmpty(refr.Path)) { - return refr.Path; - } - - if (solution.ProjectsTable.ContainsKey(refr.Name)) - { - ProjectNode projectRef = (ProjectNode) solution.ProjectsTable[refr.Name]; - string finalPath = - Helper.NormalizePath(refr.Name + GetProjectExtension(projectRef), '/'); - return finalPath; - } + if (solution.ProjectsTable.ContainsKey(refr.Name)) + { + ProjectNode project = (ProjectNode) solution.ProjectsTable[refr.Name]; + string finalPath = + Helper.NormalizePath(referencePath + refr.Name + GetProjectExtension(project), '/'); + return finalPath; + } + else + { + ProjectNode project = (ProjectNode) refr.Parent; - ProjectNode project = (ProjectNode) refr.Parent; + // Do we have an explicit file reference? + string fileRef = FindFileReference(refr.Name, project); + if (fileRef != null) + { + return fileRef; + } - // Do we have an explicit file reference? - string fileRef = FindFileReference(refr.Name, project); - if (fileRef != null) - { - return fileRef; - } + // Is there an explicit path in the project ref? + if (refr.Path != null) + { + return Helper.NormalizePath(refr.Path + "/" + refr.Name + GetProjectExtension(project), '/'); + } - // Is there an explicit path in the project ref? - if (refr.Path != null) + // Is it a specified extension (dll or exe?) + if (ExtensionSpecified(refr.Name)) + { + return Helper.NormalizePath(referencePath + GetRefFileName(refr.Name), '/'); + } + + // No, it's an extensionless GAC ref, but nant needs the .dll extension anyway + return refr.Name + ".dll"; + } + } + else { - return Helper.NormalizePath(refr.Path + "/" + refr.Name + GetProjectExtension(project), '/'); + return refr.Path; } - - // No, it's an extensionless GAC ref, but nant needs the .dll extension anyway - return refr.Name + ".dll"; } - public static string GetRefFileName(string refName) + public static string GetRefFileName(string refName) { if (ExtensionSpecified(refName)) { @@ -123,7 +144,7 @@ namespace Prebuild.Core.Targets } else { - return refName + ".dll"; + return refName + ".dll"; } } @@ -135,235 +156,268 @@ namespace Prebuild.Core.Targets private static string GetProjectExtension(ProjectNode project) { string extension = ".dll"; - if (project.Type == ProjectType.Exe || project.Type == ProjectType.WinExe) + if (project.Type == ProjectType.Exe) { extension = ".exe"; } return extension; } - private static string FindFileReference(string refName, ProjectNode project) - { - foreach (ReferencePathNode refPath in project.ReferencePaths) - { - string fullPath = Helper.MakeFilePath(refPath.Path, refName); + //private static string BuildReferencePath(SolutionNode solution, ReferenceNode refr) + //{ + // string ret = ""; + // if (solution.ProjectsTable.ContainsKey(refr.Name)) + // { + // ProjectNode project = (ProjectNode)solution.ProjectsTable[refr.Name]; + // string finalPath = Helper.NormalizePath(((ReferencePathNode)project.ReferencePaths[0]).Path, '/'); + // return finalPath; + // } + // else + // { + // if (refr.Path == null) + // { + // ProjectNode project = (ProjectNode) refr.Parent; + // string fileRef = FindFileReference(refr.Name, project); + + // if (refr.Path != null || fileRef != null) + // { + // string finalPath = (refr.Path != null) ? Helper.NormalizePath(refr.Path, '/') : fileRef; + // ret += finalPath; + // return ret; + // } + + // try + // { + // Assembly assem = Assembly.Load(refr.Name); + // if (assem != null) + // { + // ret += ""; + // } + // else + // { + // ret += ""; + // } + // } + // catch (System.NullReferenceException e) + // { + // e.ToString(); + // ret += ""; + // } + // } + // else + // { + // ret = refr.Path; + // } + // } + // return ret; + //} + + private static string FindFileReference(string refName, ProjectNode project) + { + foreach (ReferencePathNode refPath in project.ReferencePaths) + { + string fullPath = Helper.MakeFilePath(refPath.Path, refName, "dll"); if (File.Exists(fullPath)) { return fullPath; } - fullPath = Helper.MakeFilePath(refPath.Path, refName, "dll"); - - if (File.Exists(fullPath)) - { - return fullPath; - } - fullPath = Helper.MakeFilePath(refPath.Path, refName, "exe"); if (File.Exists(fullPath)) { return fullPath; } - } - - return null; - } - - /// - /// Gets the XML doc file. - /// - /// The project. - /// The conf. - /// - public static string GetXmlDocFile(ProjectNode project, ConfigurationNode conf) - { - if (conf == null) - { - throw new ArgumentNullException("conf"); - } - if (project == null) - { - throw new ArgumentNullException("project"); - } - string docFile = (string)conf.Options["XmlDocFile"]; - // if(docFile != null && docFile.Length == 0)//default to assembly name if not specified - // { - // return Path.GetFileNameWithoutExtension(project.AssemblyName) + ".xml"; - // } - return docFile; - } - - private void WriteProject(SolutionNode solution, ProjectNode project) - { + } + + return null; + } + + /// + /// Gets the XML doc file. + /// + /// The project. + /// The conf. + /// + public static string GetXmlDocFile(ProjectNode project, ConfigurationNode conf) + { + if (conf == null) + { + throw new ArgumentNullException("conf"); + } + if (project == null) + { + throw new ArgumentNullException("project"); + } + string docFile = (string)conf.Options["XmlDocFile"]; + // if(docFile != null && docFile.Length == 0)//default to assembly name if not specified + // { + // return Path.GetFileNameWithoutExtension(project.AssemblyName) + ".xml"; + // } + return docFile; + } + + private void WriteProject(SolutionNode solution, ProjectNode project) + { string projFile = Helper.MakeFilePath(project.FullPath, project.Name + GetProjectExtension(project), "build"); - StreamWriter ss = new StreamWriter(projFile); - - m_Kernel.CurrentWorkingDirectory.Push(); - Helper.SetCurrentDir(Path.GetDirectoryName(projFile)); - bool hasDoc = false; - - using (ss) - { - ss.WriteLine(""); - ss.WriteLine("", project.Name); - ss.WriteLine(" ", "build"); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - foreach (ReferenceNode refr in project.References) - { - if (refr.LocalCopy) - { - ss.WriteLine(" ", '/')); - } - } - - ss.WriteLine(" "); - ss.WriteLine(" "); - if (project.ConfigFile != null && project.ConfigFile.Length!=0) - { - ss.Write(" "); - } - - // Add the content files to just be copied - ss.WriteLine(" {0}", ""); - ss.WriteLine(" {0}", ""); - - foreach (string file in project.Files) - { - // Ignore if we aren't content - if (project.Files.GetBuildAction(file) != BuildAction.Content) - continue; - - // Create a include tag - ss.WriteLine(" {0}", ""); - } - - ss.WriteLine(" {0}", ""); - ss.WriteLine(" {0}", ""); - - ss.Write(" "); - ss.WriteLine(" ", project.RootNamespace); - foreach (string file in project.Files) - { - switch (project.Files.GetBuildAction(file)) - { - case BuildAction.EmbeddedResource: - ss.WriteLine(" {0}", ""); - break; - default: - if (project.Files.GetSubType(file) != SubType.Code && project.Files.GetSubType(file) != SubType.Settings) - { - ss.WriteLine(" ", file.Substring(0, file.LastIndexOf('.')) + ".resx"); - } - break; - } - } - //if (project.Files.GetSubType(file).ToString() != "Code") - //{ - // ps.WriteLine(" ", file.Substring(0, file.LastIndexOf('.')) + ".resx"); - - ss.WriteLine(" "); - ss.WriteLine(" "); - foreach (string file in project.Files) - { - switch (project.Files.GetBuildAction(file)) - { - case BuildAction.Compile: - ss.WriteLine(" "); - break; - default: - break; - } - } - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - foreach(ReferencePathNode refPath in project.ReferencePaths) + StreamWriter ss = new StreamWriter(projFile); + + m_Kernel.CurrentWorkingDirectory.Push(); + Helper.SetCurrentDir(Path.GetDirectoryName(projFile)); + bool hasDoc = false; + + using (ss) + { + ss.WriteLine(""); + ss.WriteLine("", project.Name); + ss.WriteLine(" ", "build"); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + foreach (ReferenceNode refr in project.References) + { + if (refr.LocalCopy) + { + ss.WriteLine(" ", '/')); + } + } + + ss.WriteLine(" "); + ss.WriteLine(" "); + if (project.ConfigFile != null && project.ConfigFile.Length!=0) + { + ss.Write(" "); + } + + // Add the content files to just be copied + ss.WriteLine(" {0}", ""); + ss.WriteLine(" {0}", ""); + + foreach (string file in project.Files) + { + // Ignore if we aren't content + if (project.Files.GetBuildAction(file) != BuildAction.Content) + continue; + + // Create a include tag + ss.WriteLine(" {0}", ""); + } + + ss.WriteLine(" {0}", ""); + ss.WriteLine(" {0}", ""); + + ss.Write(" "); + ss.Write(" unsafe=\"{0}\"", conf.Options.AllowUnsafe); + break; } - ss.WriteLine(" "); - foreach (ReferenceNode refr in project.References) - { - string path = Helper.NormalizePath(Helper.MakePathRelativeTo(project.FullPath, BuildReference(solution, project, refr)), '/'); + foreach (ConfigurationNode conf in project.Configurations) + { + ss.Write(" warnaserror=\"{0}\"", conf.Options.WarningsAsErrors); + break; + } + foreach (ConfigurationNode conf in project.Configurations) + { + ss.Write(" define=\"{0}\"", conf.Options.CompilerDefines); + break; + } + ss.Write(" main=\"{0}\"", project.StartupObject); + + foreach (ConfigurationNode conf in project.Configurations) + { + if (GetXmlDocFile(project, conf) != "") + { + ss.Write(" doc=\"{0}\"", "${project::get-base-directory()}/${build.dir}/" + GetXmlDocFile(project, conf)); + hasDoc = true; + } + break; + } + ss.Write(" output=\"{0}", "${project::get-base-directory()}/${build.dir}/${project::get-name()}"); + if (project.Type == ProjectType.Library) + { + ss.Write(".dll\""); + } + else + { + ss.Write(".exe\""); + } + if (project.AppIcon != null && project.AppIcon.Length != 0) + { + ss.Write(" win32icon=\"{0}\"", Helper.NormalizePath(project.AppIcon, '/')); + } + ss.WriteLine(">"); + ss.WriteLine(" ", project.RootNamespace); + foreach (string file in project.Files) + { + switch (project.Files.GetBuildAction(file)) + { + case BuildAction.EmbeddedResource: + ss.WriteLine(" {0}", ""); + break; + default: + if (project.Files.GetSubType(file) != SubType.Code && project.Files.GetSubType(file) != SubType.Settings) + { + ss.WriteLine(" ", file.Substring(0, file.LastIndexOf('.')) + ".resx"); + } + break; + } + } + //if (project.Files.GetSubType(file).ToString() != "Code") + //{ + // ps.WriteLine(" ", file.Substring(0, file.LastIndexOf('.')) + ".resx"); + + ss.WriteLine(" "); + ss.WriteLine(" "); + foreach (string file in project.Files) + { + switch (project.Files.GetBuildAction(file)) + { + case BuildAction.Compile: + ss.WriteLine(" "); + break; + default: + break; + } + } + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + foreach (ReferenceNode refr in project.References) + { + string path = Helper.NormalizePath(Helper.MakePathRelativeTo(project.FullPath, BuildReference(solution, project, refr)), '/'); ss.WriteLine(" "); - } - ss.WriteLine(" "); + } + ss.WriteLine(" "); - ss.WriteLine(" "); + ss.WriteLine(" "); - foreach (ConfigurationNode conf in project.Configurations) + foreach (ConfigurationNode conf in project.Configurations) { if (!String.IsNullOrEmpty(conf.Options.OutputPath)) { @@ -378,160 +432,149 @@ namespace Prebuild.Core.Targets ss.WriteLine(" "); ss.WriteLine(" "); ss.WriteLine(" "); - ss.WriteLine(" "); ss.WriteLine(" "); ss.WriteLine(" "); break; } } - ss.WriteLine(" "); - - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - - ss.WriteLine(" "); - if (hasDoc) - { - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.Write(" "); - } - else - { - ss.WriteLine(".exe\" />"); - } - - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - // foreach(ReferenceNode refr in project.References) - // { - // string path = Helper.NormalizePath(Helper.MakePathRelativeTo(project.FullPath, BuildReferencePath(solution, refr)), '/'); - // if (path != "") - // { - // ss.WriteLine(" ", path); - // } - // } - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - } - ss.WriteLine(" "); - ss.WriteLine(""); - } - m_Kernel.CurrentWorkingDirectory.Pop(); - } - - private void WriteCombine(SolutionNode solution) - { - m_Kernel.Log.Write("Creating NAnt build files"); - foreach (ProjectNode project in solution.Projects) - { - if (m_Kernel.AllowProject(project.FilterGroups)) - { - m_Kernel.Log.Write("...Creating project: {0}", project.Name); - WriteProject(solution, project); - } - } - - m_Kernel.Log.Write(""); - string combFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "build"); - StreamWriter ss = new StreamWriter(combFile); - - m_Kernel.CurrentWorkingDirectory.Push(); - Helper.SetCurrentDir(Path.GetDirectoryName(combFile)); - - using (ss) - { - ss.WriteLine(""); - ss.WriteLine("", solution.Name); - ss.WriteLine(" "); - ss.WriteLine(); - - //ss.WriteLine(" "); - //ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); + ss.WriteLine(" "); + + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + + ss.WriteLine(" "); + if (hasDoc) + { + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.Write(" "); + } + else + { + ss.WriteLine(".exe\" />"); + } + + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + // foreach(ReferenceNode refr in project.References) + // { + // string path = Helper.NormalizePath(Helper.MakePathRelativeTo(project.FullPath, BuildReferencePath(solution, refr)), '/'); + // if (path != "") + // { + // ss.WriteLine(" ", path); + // } + // } + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + } + ss.WriteLine(" "); + ss.WriteLine(""); + } + m_Kernel.CurrentWorkingDirectory.Pop(); + } + + private void WriteCombine(SolutionNode solution) + { + m_Kernel.Log.Write("Creating NAnt build files"); + foreach (ProjectNode project in solution.Projects) + { + if (m_Kernel.AllowProject(project.FilterGroups)) + { + m_Kernel.Log.Write("...Creating project: {0}", project.Name); + WriteProject(solution, project); + } + } + + m_Kernel.Log.Write(""); + string combFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "build"); + StreamWriter ss = new StreamWriter(combFile); + + m_Kernel.CurrentWorkingDirectory.Push(); + Helper.SetCurrentDir(Path.GetDirectoryName(combFile)); + + using (ss) + { + ss.WriteLine(""); + ss.WriteLine("", solution.Name); + ss.WriteLine(" "); + ss.WriteLine(); + + //ss.WriteLine(" "); + //ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); // actually use active config out of prebuild.xml ss.WriteLine(" ", solution.ActiveConfig); - foreach (ConfigurationNode conf in solution.Configurations) - { - ss.WriteLine(); - ss.WriteLine(" ", conf.Name); - ss.WriteLine(" ", conf.Name); - ss.WriteLine(" ", conf.Options["DebugInformation"].ToString().ToLower()); - ss.WriteLine(" "); - ss.WriteLine(); - } - - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(); - - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(); - - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(); - - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(); - - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(); - - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(); + foreach (ConfigurationNode conf in solution.Configurations) + { + ss.WriteLine(); + ss.WriteLine(" ", conf.Name); + ss.WriteLine(" ", conf.Name); + ss.WriteLine(" ", conf.Options["DebugInformation"].ToString().ToLower()); + ss.WriteLine(" "); + ss.WriteLine(); + } + + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(); + + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(); + + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(); + + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(); ss.WriteLine(" "); ss.WriteLine(" "); 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 */ #endregion +#region CVS Information +/* + * $Source$ + * $Author: jendave $ + * $Date: 2006-01-27 16:49:58 -0800 (Fri, 27 Jan 2006) $ + * $Revision: 71 $ + */ +#endregion + using System; using Prebuild.Core.Attributes; @@ -34,38 +43,18 @@ namespace Prebuild.Core.Targets /// [Target("sharpdev2")] public class SharpDevelop2Target : VS2005Target - { - #region Properties - public override string VersionName + { + protected override string VersionName { get { return "SharpDevelop2"; } } - #endregion #region Public Methods /// - /// Writes the specified kern. - /// - /// The kern. - public override void Write(Kernel kern) - { - base.Write(kern); - } - - /// - /// Cleans the specified kern. - /// - /// The kern. - public override void Clean(Kernel kern) - { - base.Clean(kern); - } - - /// /// Gets the name. /// /// The name. 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 */ #endregion +#region CVS Information +/* + * $Source$ + * $Author: jendave $ + * $Date: 2007-02-14 05:58:03 +0900 (Wed, 14 Feb 2007) $ + * $Revision: 205 $ + */ +#endregion + using System; using System.Collections; 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 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace Prebuild.Core.Targets -{ - /// - /// - /// - public struct ToolInfo - { - string name; - string guid; - string fileExtension; - string xmlTag; - string importProject; - - /// - /// Gets or sets the name. - /// - /// The name. - public string Name - { - get - { - return name; - } - set - { - name = value; - } - } - - /// - /// Gets or sets the GUID. - /// - /// The GUID. - public string Guid - { - get - { - return guid; - } - set - { - guid = value; - } - } - - /// - /// Gets or sets the file extension. - /// - /// The file extension. - public string FileExtension - { - get - { - return fileExtension; - } - set - { - fileExtension = value; - } - } - public string LanguageExtension - { - get - { - switch (this.Name) - { - case "C#": - return ".cs"; - case "VisualBasic": - return ".vb"; - case "Boo": - return ".boo"; - default: - return ".cs"; - } - } - } - /// - /// Gets or sets the XML tag. - /// - /// The XML tag. - public string XmlTag - { - get - { - return xmlTag; - } - set - { - xmlTag = value; - } - } - - /// - /// Gets or sets the import project property. - /// - /// The ImportProject tag. - public string ImportProject - { - get - { - return importProject; - } - set - { - importProject = value; - } - } - - /// - /// Initializes a new instance of the class. - /// - /// The name. - /// The GUID. - /// The file extension. - /// The XML. - /// The import project. - public ToolInfo(string name, string guid, string fileExtension, string xml, string importProject) - { - this.name = name; - this.guid = guid; - this.fileExtension = fileExtension; - this.xmlTag = xml; - this.importProject = importProject; - } - - /// - /// Initializes a new instance of the class. - /// - /// The name. - /// The GUID. - /// The file extension. - /// The XML. - public ToolInfo(string name, string guid, string fileExtension, string xml) - { - this.name = name; - this.guid = guid; - this.fileExtension = fileExtension; - this.xmlTag = xml; - this.importProject = "$(MSBuildBinPath)\\Microsoft." + xml + ".Targets"; - } - - /// - /// Equals operator - /// - /// ToolInfo to compare - /// true if toolInfos are equal - public override bool Equals(object obj) - { - if (obj == null) - { - throw new ArgumentNullException("obj"); - } - if (obj.GetType() != typeof(ToolInfo)) - return false; - - ToolInfo c = (ToolInfo)obj; - return ((this.name == c.name) && (this.guid == c.guid) && (this.fileExtension == c.fileExtension) && (this.importProject == c.importProject)); - } - - /// - /// Equals operator - /// - /// ToolInfo to compare - /// ToolInfo to compare - /// True if toolInfos are equal - public static bool operator ==(ToolInfo c1, ToolInfo c2) - { - return ((c1.name == c2.name) && (c1.guid == c2.guid) && (c1.fileExtension == c2.fileExtension) && (c1.importProject == c2.importProject) && (c1.xmlTag == c2.xmlTag)); - } - - /// - /// Not equals operator - /// - /// ToolInfo to compare - /// ToolInfo to compare - /// True if toolInfos are not equal - public static bool operator !=(ToolInfo c1, ToolInfo c2) - { - return !(c1 == c2); - } - - /// - /// Hash Code - /// - /// Hash code - public override int GetHashCode() - { - return name.GetHashCode() ^ guid.GetHashCode() ^ this.fileExtension.GetHashCode() ^ this.importProject.GetHashCode() ^ this.xmlTag.GetHashCode(); - - } - } -} 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 */ #endregion +#region CVS Information +/* + * $Source$ + * $Author: jendave $ + * $Date: 2006-01-28 09:49:58 +0900 (Sat, 28 Jan 2006) $ + * $Revision: 71 $ + */ +#endregion + using System; 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 */ #endregion +#region CVS Information +/* + * $Source$ + * $Author: jendave $ + * $Date: 2006-09-30 04:11:40 +0900 (Sat, 30 Sep 2006) $ + * $Revision: 177 $ + */ +#endregion + using System; using System.Collections; using System.Collections.Specialized; @@ -35,6 +44,28 @@ using Prebuild.Core.Utilities; namespace Prebuild.Core.Targets { + /// + /// + /// + public enum VSVersion + { + /// + /// + /// + VS70, + /// + /// + /// + VS71, + /// + /// + /// + VS80 + } + + /// + /// + /// [Target("vs2003")] public class VS2003Target : ITarget { 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 */ #endregion +#region CVS Information +/* + * $Source$ + * $Author: borrillis $ + * $Date: 2007-05-25 01:03:16 +0900 (Fri, 25 May 2007) $ + * $Revision: 243 $ + */ +#endregion + using System; using System.Collections; using System.Collections.Specialized; @@ -39,8 +48,182 @@ namespace Prebuild.Core.Targets /// /// /// + public struct ToolInfo + { + string name; + string guid; + string fileExtension; + string xmlTag; + string importProject; + + /// + /// Gets or sets the name. + /// + /// The name. + public string Name + { + get + { + return name; + } + set + { + name = value; + } + } + + /// + /// Gets or sets the GUID. + /// + /// The GUID. + public string Guid + { + get + { + return guid; + } + set + { + guid = value; + } + } + + /// + /// Gets or sets the file extension. + /// + /// The file extension. + public string FileExtension + { + get + { + return fileExtension; + } + set + { + fileExtension = value; + } + } + /// + /// Gets or sets the XML tag. + /// + /// The XML tag. + public string XmlTag + { + get + { + return xmlTag; + } + set + { + xmlTag = value; + } + } + + /// + /// Gets or sets the import project property. + /// + /// The ImportProject tag. + public string ImportProject + { + get + { + return importProject; + } + set + { + importProject = value; + } + } + + /// + /// Initializes a new instance of the class. + /// + /// The name. + /// The GUID. + /// The file extension. + /// The XML. + /// The import project. + public ToolInfo(string name, string guid, string fileExtension, string xml, string importProject) + { + this.name = name; + this.guid = guid; + this.fileExtension = fileExtension; + this.xmlTag = xml; + this.importProject = importProject; + } + + /// + /// Initializes a new instance of the class. + /// + /// The name. + /// The GUID. + /// The file extension. + /// The XML. + public ToolInfo(string name, string guid, string fileExtension, string xml) + { + this.name = name; + this.guid = guid; + this.fileExtension = fileExtension; + this.xmlTag = xml; + this.importProject = "$(MSBuildBinPath)\\Microsoft." + xml + ".Targets"; + } + + /// + /// Equals operator + /// + /// ToolInfo to compare + /// true if toolInfos are equal + public override bool Equals(object obj) + { + if (obj == null) + { + throw new ArgumentNullException("obj"); + } + if (obj.GetType() != typeof(ToolInfo)) + return false; + + ToolInfo c = (ToolInfo)obj; + return ((this.name == c.name) && (this.guid == c.guid) && (this.fileExtension == c.fileExtension) && (this.importProject == c.importProject)); + } + + /// + /// Equals operator + /// + /// ToolInfo to compare + /// ToolInfo to compare + /// True if toolInfos are equal + public static bool operator ==(ToolInfo c1, ToolInfo c2) + { + return ((c1.name == c2.name) && (c1.guid == c2.guid) && (c1.fileExtension == c2.fileExtension) && (c1.importProject == c2.importProject) && (c1.xmlTag == c2.xmlTag)); + } + + /// + /// Not equals operator + /// + /// ToolInfo to compare + /// ToolInfo to compare + /// True if toolInfos are not equal + public static bool operator !=(ToolInfo c1, ToolInfo c2) + { + return !(c1 == c2); + } + + /// + /// Hash Code + /// + /// Hash code + public override int GetHashCode() + { + return name.GetHashCode() ^ guid.GetHashCode() ^ this.fileExtension.GetHashCode() ^ this.importProject.GetHashCode() ^ this.xmlTag.GetHashCode(); + + } + } + + /// + /// + /// [Target("vs2005")] - public class VS2005Target : VSGenericTarget + public class VS2005Target : ITarget { #region Inner Classes @@ -48,100 +231,694 @@ namespace Prebuild.Core.Targets #region Fields - string solutionVersion = "9.00"; - string productVersion = "8.0.50727"; string schemaVersion = "2.0"; - string versionName = "Visual C# 2005"; - string name = "vs2005"; - VSVersion version = VSVersion.VS80; - public override string SolutionTag + Hashtable tools; + Kernel kernel; + + protected virtual string ToolsVersionXml { - get { return "# Visual Studio 2005"; } + get + { + return String.Empty; + } } - protected override string GetToolsVersionXml(FrameworkVersion frameworkVersion) + protected virtual string SolutionTag { - return string.Empty; + get { return "# Visual Studio 2005"; } } + /// /// Gets or sets the solution version. /// /// The solution version. - public override string SolutionVersion + protected virtual string SolutionVersion { get { - return solutionVersion; + return "9.00"; } } + /// /// Gets or sets the product version. /// /// The product version. - public override string ProductVersion + protected virtual string ProductVersion { get { - return productVersion; + return "8.0.50727"; } } + /// /// Gets or sets the schema version. /// /// The schema version. - public override string SchemaVersion + protected string SchemaVersion { get { - return schemaVersion; + return this.schemaVersion; + } + set + { + this.schemaVersion = value; } } + /// /// Gets or sets the name of the version. /// /// The name of the version. - public override string VersionName + protected virtual string VersionName { get { - return versionName; + return "Visual C# 2005"; } } + /// /// Gets or sets the version. /// /// The version. - public override VSVersion Version + protected VSVersion Version { get { - return version; + return this.version; + } + set + { + this.version = value; } } + + #endregion + + #region Constructors + /// - /// Gets the name. + /// Initializes a new instance of the class. /// - /// The name. - public override string Name + public VS2005Target() { - get + this.tools = new Hashtable(); + + this.tools["C#"] = new ToolInfo("C#", "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}", "csproj", "CSHARP", "$(MSBuildBinPath)\\Microsoft.CSHARP.Targets"); + this.tools["Boo"] = new ToolInfo("Boo", "{45CEA7DC-C2ED-48A6-ACE0-E16144C02365}", "booproj", "Boo", "$(BooBinPath)\\Boo.Microsoft.Build.targets"); + this.tools["VisualBasic"] = new ToolInfo("VisualBasic", "{F184B08F-C81C-45F6-A57F-5ABD9991F28F}", "vbproj", "VisualBasic", "$(MSBuildBinPath)\\Microsoft.VisualBasic.Targets"); + } + + #endregion + + #region Private Methods + + private string MakeRefPath(ProjectNode project) + { + string ret = ""; + foreach (ReferencePathNode node in project.ReferencePaths) { - return name; + try + { + string fullPath = Helper.ResolvePath(node.Path); + if (ret.Length < 1) + { + ret = fullPath; + } + else + { + ret += ";" + fullPath; + } + } + catch (ArgumentException) + { + this.kernel.Log.Write(LogType.Warning, "Could not resolve reference path: {0}", node.Path); + } + } + + return ret; + } + + private static bool ExtensionSpecified(string refName) + { + return refName.EndsWith(".dll") || refName.EndsWith(".exe"); + } + + private static string GetProjectExtension(ProjectNode project) + { + string extension = ".dll"; + if (project.Type == ProjectType.Exe) + { + extension = ".exe"; + } + return extension; + } + + private void WriteProject(SolutionNode solution, ProjectNode project) + { + if (!tools.ContainsKey(project.Language)) + { + throw new UnknownLanguageException("Unknown .NET language: " + project.Language); + } + + ToolInfo toolInfo = (ToolInfo)tools[project.Language]; + string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, toolInfo.FileExtension); + StreamWriter ps = new StreamWriter(projectFile); + + kernel.CurrentWorkingDirectory.Push(); + Helper.SetCurrentDir(Path.GetDirectoryName(projectFile)); + + #region Project File + using (ps) + { + ps.WriteLine("", ToolsVersionXml); + //ps.WriteLine(" <{0}", toolInfo.XMLTag); + ps.WriteLine(" "); + ps.WriteLine(" Local"); + ps.WriteLine(" {0}", this.ProductVersion); + ps.WriteLine(" {0}", this.SchemaVersion); + ps.WriteLine(" {{{0}}}", project.Guid.ToString().ToUpper()); + + ps.WriteLine(" Debug"); + ps.WriteLine(" AnyCPU"); + //ps.WriteLine(" "); + + //ps.WriteLine(" {0}", project.AppIcon); + ps.WriteLine(" "); + ps.WriteLine(" "); + ps.WriteLine(" {0}", project.AssemblyName); + foreach (ConfigurationNode conf in project.Configurations) + { + if (conf.Options.KeyFile != "") + { + ps.WriteLine(" {0}", conf.Options.KeyFile); + ps.WriteLine(" true"); + break; + } + } + ps.WriteLine(" JScript"); + ps.WriteLine(" Grid"); + ps.WriteLine(" IE50"); + ps.WriteLine(" false"); + + //if(m_Version == VSVersion.VS70) + // ps.WriteLine(" NoStandardLibraries = \"false\""); + + ps.WriteLine(" {0}", project.Type.ToString()); + ps.WriteLine(" {0}", project.DesignerFolder); + ps.WriteLine(" {0}", project.RootNamespace); + ps.WriteLine(" {0}", project.StartupObject); + //ps.WriteLine(" >"); + ps.WriteLine(" "); + ps.WriteLine(" "); + + ps.WriteLine(" "); + + foreach (ConfigurationNode conf in project.Configurations) + { + ps.Write(" ", conf.Name); + ps.WriteLine(" {0}", conf.Options["AllowUnsafe"]); + ps.WriteLine(" {0}", conf.Options["BaseAddress"]); + ps.WriteLine(" {0}", conf.Options["CheckUnderflowOverflow"]); + ps.WriteLine(" "); + ps.WriteLine(" "); + ps.WriteLine(" {0}", conf.Options["CompilerDefines"]); + ps.WriteLine(" {0}", Helper.NormalizePath(conf.Options["XmlDocFile"].ToString())); + ps.WriteLine(" {0}", conf.Options["DebugInformation"]); + ps.WriteLine(" {0}", conf.Options["FileAlignment"]); + // ps.WriteLine(" {0}", conf.Options["OptimizeCode"]); + ps.WriteLine(" {0}", + Helper.EndPath(Helper.NormalizePath(conf.Options["OutputPath"].ToString()))); + ps.WriteLine(" {0}", conf.Options["RegisterComInterop"]); + ps.WriteLine(" {0}", conf.Options["RemoveIntegerChecks"]); + ps.WriteLine(" {0}", conf.Options["WarningsAsErrors"]); + ps.WriteLine(" {0}", conf.Options["WarningLevel"]); + ps.WriteLine(" {0}", conf.Options["SuppressWarnings"]); + ps.WriteLine(" "); + } + + //ps.WriteLine(" "); + + // Assembly References + ps.WriteLine(" "); + string refPath = ((ReferencePathNode) project.ReferencePaths[0]).Path; + + foreach (ReferenceNode refr in project.References) + { + if (!solution.ProjectsTable.ContainsKey(refr.Name)) + { + ps.Write(" "); + + string path; + + if (String.IsNullOrEmpty(refr.Path)) + { + if ( ExtensionSpecified( refr.Name ) ) + { + path = Helper.NormalizePath(Path.Combine(refPath, refr.Name), '\\'); + } + else + { + path = refr.Name + ".dll"; + } + } + else + { + path = refr.Path; + } + + // TODO: Allow reference to *.exe files + ps.WriteLine(" {0}", path ); + ps.WriteLine(" {0}", refr.LocalCopy); + ps.WriteLine(" "); + } + } + ps.WriteLine(" "); + + //Project References + ps.WriteLine(" "); + foreach (ReferenceNode refr in project.References) + { + if (solution.ProjectsTable.ContainsKey(refr.Name)) + { + ProjectNode refProject = (ProjectNode)solution.ProjectsTable[refr.Name]; + // TODO: Allow reference to visual basic projects + string path = + Helper.MakePathRelativeTo(project.FullPath, + Helper.MakeFilePath(refProject.FullPath, refProject.Name, "csproj")); + ps.WriteLine(" ", path ); + // + ps.WriteLine(" {0}", refProject.Name); + // RealmForge.Utility + ps.WriteLine(" {{{0}}}", refProject.Guid.ToString().ToUpper()); + // {6880D1D3-69EE-461B-B841-5319845B20D3} + ps.WriteLine(" {0}", toolInfo.Guid.ToString().ToUpper()); + // {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + ps.WriteLine("\t\t\t{0}", refr.LocalCopy); + ps.WriteLine(" "); + // + } + else + { + } + } + ps.WriteLine(" "); + + // ps.WriteLine(" "); + ps.WriteLine(" "); + + // ps.WriteLine(" "); + ArrayList list = new ArrayList(); + foreach (string file in project.Files) + { + // if (file == "Properties\\Bind.Designer.cs") + // { + // Console.WriteLine("Wait a minute!"); + // Console.WriteLine(project.Files.GetSubType(file).ToString()); + // } + + if (project.Files.GetSubType(file) != SubType.Code && project.Files.GetSubType(file) != SubType.Settings && project.Files.GetSubType(file) != SubType.Designer) + { + ps.WriteLine(" ", file.Substring(0, file.LastIndexOf('.')) + ".resx"); + + int slash = file.LastIndexOf('\\'); + if (slash == -1) + { + ps.WriteLine(" {0}", file); + } + else + { + ps.WriteLine(" {0}", file.Substring(slash + 1, file.Length - slash - 1)); + } + ps.WriteLine(" Designer"); + ps.WriteLine(" "); + // + } + + if (project.Files.GetSubType(file) != SubType.Code && project.Files.GetSubType(file) == SubType.Designer) + { + ps.WriteLine(" ", file.Substring(0, file.LastIndexOf('.')) + ".resx"); + ps.WriteLine(" " + project.Files.GetSubType(file) + ""); + ps.WriteLine(" ResXFileCodeGenerator"); + ps.WriteLine(" Resources.Designer.cs"); + ps.WriteLine(" "); + ps.WriteLine(" ", file.Substring(0, file.LastIndexOf('.')) + ".Designer.cs"); + ps.WriteLine(" True"); + ps.WriteLine(" True"); + ps.WriteLine(" Resources.resx"); + ps.WriteLine(" "); + list.Add(file.Substring(0, file.LastIndexOf('.')) + ".Designer.cs"); + } + if (project.Files.GetSubType(file).ToString() == "Settings") + { + //Console.WriteLine("File: " + file); + //Console.WriteLine("Last index: " + file.LastIndexOf('.')); + //Console.WriteLine("Length: " + file.Length); + ps.Write(" <{0} ", project.Files.GetBuildAction(file)); + ps.WriteLine("Include=\"{0}\">", file); + int slash = file.LastIndexOf('\\'); + string fileName = file.Substring(slash + 1, file.Length - slash - 1); + if (project.Files.GetBuildAction(file) == BuildAction.None) + { + ps.WriteLine(" SettingsSingleFileGenerator"); + + //Console.WriteLine("FileName: " + fileName); + //Console.WriteLine("FileNameMain: " + fileName.Substring(0, fileName.LastIndexOf('.'))); + //Console.WriteLine("FileNameExt: " + fileName.Substring(fileName.LastIndexOf('.'), fileName.Length - fileName.LastIndexOf('.'))); + if (slash == -1) + { + ps.WriteLine(" {0}", fileName.Substring(0, fileName.LastIndexOf('.')) + ".Designer.cs"); + } + else + { + ps.WriteLine(" {0}", fileName.Substring(0, fileName.LastIndexOf('.')) + ".Designer.cs"); + } + } + else + { + ps.WriteLine(" Code"); + ps.WriteLine(" True"); + ps.WriteLine(" True"); + string fileNameShort = fileName.Substring(0, fileName.LastIndexOf('.')); + string fileNameShorter = fileNameShort.Substring(0, fileNameShort.LastIndexOf('.')); + ps.WriteLine(" {0}", fileNameShorter + ".settings"); + } + ps.WriteLine(" ", project.Files.GetBuildAction(file)); + } + else if (project.Files.GetSubType(file) != SubType.Designer) + { + if (!list.Contains(file)) + { + ps.Write(" <{0} ", project.Files.GetBuildAction(file)); + + int startPos = 0; + if ( project.Files.GetPreservePath( file ) ) + { + while ( ( @"./\" ).IndexOf( file.Substring( startPos, 1 ) ) != -1 ) + startPos++; + + } + else + { + startPos = file.LastIndexOf( Path.GetFileName( file ) ); + } + ps.WriteLine("Include=\"{0}\">", Helper.NormalizePath(file)); + + + if (file.Contains("Designer.cs")) + { + string d = ".Designer.cs"; + int index = file.Contains("\\") ? file.IndexOf("\\") + 1 : 0; + ps.WriteLine(" {0}", file.Substring(index, file.Length - index - d.Length) + ".cs"); + } + + if (project.Files.GetIsLink(file)) + { + string alias = project.Files.GetLinkPath( file ); + alias += file.Substring( startPos ); + alias = Helper.NormalizePath( alias ); + ps.WriteLine( " {0}", alias ); + } + else if (project.Files.GetBuildAction(file) != BuildAction.None) + { + if (project.Files.GetBuildAction(file) != BuildAction.EmbeddedResource) + { + ps.WriteLine(" {0}", project.Files.GetSubType(file)); + } + } + + if (project.Files.GetCopyToOutput(file) != CopyToOutput.Never) + { + ps.WriteLine(" {0}", project.Files.GetCopyToOutput(file)); + } + + ps.WriteLine(" ", project.Files.GetBuildAction(file)); + } + } + } + // ps.WriteLine(" "); + + ps.WriteLine(" "); + ps.WriteLine(" "); + ps.WriteLine(" "); + ps.WriteLine(" "); + ps.WriteLine(" "); + ps.WriteLine(" "); + ps.WriteLine(" "); + ps.WriteLine(" "); + // ps.WriteLine(" ", toolInfo.XMLTag); + ps.WriteLine(""); + } + #endregion + + #region User File + + ps = new StreamWriter(projectFile + ".user"); + using (ps) + { + ps.WriteLine(""); + //ps.WriteLine( "" ); + //ps.WriteLine(" <{0}>", toolInfo.XMLTag); + //ps.WriteLine(" "); + ps.WriteLine(" "); + //ps.WriteLine(" ", MakeRefPath(project)); + + ps.WriteLine(" Debug"); + + if (projectFile.Contains( "OpenSim.csproj" )) + { + ps.WriteLine(" -loginserver -sandbox -accounts"); + } + + ps.WriteLine(" AnyCPU"); + ps.WriteLine(" {0}", MakeRefPath(project)); + ps.WriteLine(" {0}", this.ProductVersion); + ps.WriteLine(" ProjectFiles"); + ps.WriteLine(" 0"); + ps.WriteLine(" "); + foreach (ConfigurationNode conf in project.Configurations) + { + ps.Write(" "); + } + + ps.WriteLine(""); + } + #endregion + + kernel.CurrentWorkingDirectory.Pop(); + } + + private void WriteSolution(SolutionNode solution) + { + kernel.Log.Write("Creating {0} solution and project files", this.VersionName); + + foreach (ProjectNode project in solution.Projects) + { + kernel.Log.Write("...Creating project: {0}", project.Name); + WriteProject(solution, project); } + + kernel.Log.Write(""); + string solutionFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "sln"); + using (StreamWriter ss = new StreamWriter(solutionFile)) + { + kernel.CurrentWorkingDirectory.Push(); + Helper.SetCurrentDir(Path.GetDirectoryName(solutionFile)); + + using (ss) + { + ss.WriteLine("Microsoft Visual Studio Solution File, Format Version {0}", this.SolutionVersion); + ss.WriteLine(SolutionTag); + foreach (ProjectNode project in solution.Projects) + { + if (!tools.ContainsKey(project.Language)) + { + throw new UnknownLanguageException("Unknown .NET language: " + project.Language); + } + + ToolInfo toolInfo = (ToolInfo)tools[project.Language]; + + string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath); + ss.WriteLine("Project(\"{0}\") = \"{1}\", \"{2}\", \"{{{3}}}\"", + toolInfo.Guid, project.Name, Helper.MakeFilePath(path, project.Name, + toolInfo.FileExtension), project.Guid.ToString().ToUpper()); + + //ss.WriteLine(" ProjectSection(ProjectDependencies) = postProject"); + //ss.WriteLine(" EndProjectSection"); + + ss.WriteLine("EndProject"); + } + + if (solution.Files != null) + { + ss.WriteLine("Project(\"{0}\") = \"Solution Items\", \"Solution Items\", \"{1}\"", "{2150E333-8FDC-42A3-9474-1A3956D46DE8}", "{468F1D07-AD17-4CC3-ABD0-2CA268E4E1A6}"); + ss.WriteLine("\tProjectSection(SolutionItems) = preProject"); + foreach (string file in solution.Files) + ss.WriteLine("\t\t{0} = {0}", file); + ss.WriteLine("\tEndProjectSection"); + ss.WriteLine("EndProject"); + } + + ss.WriteLine("Global"); + + ss.WriteLine(" GlobalSection(SolutionConfigurationPlatforms) = preSolution"); + foreach (ConfigurationNode conf in solution.Configurations) + { + ss.WriteLine(" {0}|Any CPU = {0}|Any CPU", conf.Name); + } + ss.WriteLine(" EndGlobalSection"); + + if (solution.Projects.Count > 1) + { + ss.WriteLine(" GlobalSection(ProjectDependencies) = postSolution"); + } + foreach (ProjectNode project in solution.Projects) + { + for (int i = 0; i < project.References.Count; i++) + { + ReferenceNode refr = (ReferenceNode)project.References[i]; + if (solution.ProjectsTable.ContainsKey(refr.Name)) + { + ProjectNode refProject = (ProjectNode)solution.ProjectsTable[refr.Name]; + ss.WriteLine(" ({{{0}}}).{1} = ({{{2}}})", + project.Guid.ToString().ToUpper() + , i, + refProject.Guid.ToString().ToUpper() + ); + } + } + } + if (solution.Projects.Count > 1) + { + ss.WriteLine(" EndGlobalSection"); + } + ss.WriteLine(" GlobalSection(ProjectConfigurationPlatforms) = postSolution"); + foreach (ProjectNode project in solution.Projects) + { + foreach (ConfigurationNode conf in solution.Configurations) + { + ss.WriteLine(" {{{0}}}.{1}|Any CPU.ActiveCfg = {1}|Any CPU", + project.Guid.ToString().ToUpper(), + conf.Name); + + ss.WriteLine(" {{{0}}}.{1}|Any CPU.Build.0 = {1}|Any CPU", + project.Guid.ToString().ToUpper(), + conf.Name); + } + } + ss.WriteLine(" EndGlobalSection"); + ss.WriteLine(" GlobalSection(SolutionProperties) = preSolution"); + ss.WriteLine(" HideSolutionNode = FALSE"); + ss.WriteLine(" EndGlobalSection"); + + ss.WriteLine("EndGlobal"); + } + } + + kernel.CurrentWorkingDirectory.Pop(); + } + + private void CleanProject(ProjectNode project) + { + kernel.Log.Write("...Cleaning project: {0}", project.Name); + + ToolInfo toolInfo = (ToolInfo)tools[project.Language]; + string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, toolInfo.FileExtension); + string userFile = projectFile + ".user"; + + Helper.DeleteIfExists(projectFile); + Helper.DeleteIfExists(userFile); + } + + private void CleanSolution(SolutionNode solution) + { + kernel.Log.Write("Cleaning {0} solution and project files", this.VersionName, solution.Name); + + string slnFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "sln"); + string suoFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "suo"); + + Helper.DeleteIfExists(slnFile); + Helper.DeleteIfExists(suoFile); + + foreach (ProjectNode project in solution.Projects) + { + CleanProject(project); + } + + kernel.Log.Write(""); } #endregion - #region Constructors + #region ITarget Members /// - /// Initializes a new instance of the class. + /// Writes the specified kern. + /// + /// The kern. + public virtual void Write(Kernel kern) + { + if (kern == null) + { + throw new ArgumentNullException("kern"); + } + kernel = kern; + foreach (SolutionNode sol in kernel.Solutions) + { + WriteSolution(sol); + } + kernel = null; + } + + /// + /// Cleans the specified kern. /// - public VS2005Target() - : base() - { + /// The kern. + public virtual void Clean(Kernel kern) + { + if (kern == null) + { + throw new ArgumentNullException("kern"); + } + kernel = kern; + foreach (SolutionNode sol in kernel.Solutions) + { + CleanSolution(sol); + } + kernel = null; + } + + /// + /// Gets the name. + /// + /// The name. + public virtual string Name + { + get + { + return "vs2005"; + } } #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 @@ using System; -using System.Collections; -using System.Collections.Specialized; -using System.IO; +using System.Collections.Generic; using System.Text; - using Prebuild.Core.Attributes; -using Prebuild.Core.Interfaces; -using Prebuild.Core.Nodes; -using Prebuild.Core.Utilities; -using System.CodeDom.Compiler; namespace Prebuild.Core.Targets { + [Target("vs2008")] + public class VS2008Target : VS2005Target + { + protected override string SolutionTag + { + get { return "# Visual Studio 2008"; } + } - /// - /// - /// - [Target("vs2008")] - public class VS2008Target : VSGenericTarget - { - #region Fields - string solutionVersion = "10.00"; - string productVersion = "9.0.21022"; - string schemaVersion = "2.0"; - string versionName = "Visual Studio 2008"; - string name = "vs2008"; - VSVersion version = VSVersion.VS90; - - Hashtable tools; - Kernel kernel; - - /// - /// Gets or sets the solution version. - /// - /// The solution version. - public override string SolutionVersion - { - get - { - return solutionVersion; - } - } - /// - /// Gets or sets the product version. - /// - /// The product version. - public override string ProductVersion - { - get - { - return productVersion; - } - } - /// - /// Gets or sets the schema version. - /// - /// The schema version. - public override string SchemaVersion - { - get - { - return schemaVersion; - } - } - /// - /// Gets or sets the name of the version. - /// - /// The name of the version. - public override string VersionName - { - get - { - return versionName; - } - } - /// - /// Gets or sets the version. - /// - /// The version. - public override VSVersion Version - { - get - { - return version; - } - } - /// - /// Gets the name. - /// - /// The name. - public override string Name - { - get - { - return name; - } - } - - protected override string GetToolsVersionXml(FrameworkVersion frameworkVersion) + protected override string SolutionVersion { - switch (frameworkVersion) + get { - case FrameworkVersion.v3_5: - return "ToolsVersion=\"3.5\""; - case FrameworkVersion.v3_0: - return "ToolsVersion=\"3.0\""; - default: - return "ToolsVersion=\"2.0\""; + return "10.00"; } } - public override string SolutionTag + protected override string VersionName { - get { return "# Visual Studio 2008"; } + get + { + return "Visual C# 2008"; + } } - #endregion - - #region Constructors + protected override string ToolsVersionXml + { + get + { + return " ToolsVersion=\"3.5\""; + } + } - /// - /// Initializes a new instance of the class. - /// - public VS2008Target() - : base() - { - } + protected override string ProductVersion + { + get + { + return "9.0.21022"; + } + } - #endregion - } + public override string Name + { + get + { + return "vs2008"; + } + } + } } 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 @@ -#region BSD License -/* -Copyright (c) 2008 Matthew Holmes (matthew@wildfiregames.com), John Anderson (sontek@gmail.com) - -Redistribution and use in source and binary forms, with or without modification, are permitted -provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. -* The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, -BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ -#endregion - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Collections.Specialized; -using System.IO; -using System.Text; - -using Prebuild.Core.Attributes; -using Prebuild.Core.Interfaces; -using Prebuild.Core.Nodes; -using Prebuild.Core.Utilities; -using System.CodeDom.Compiler; - -namespace Prebuild.Core.Targets -{ - - /// - /// - /// - public abstract class VSGenericTarget : ITarget - { - #region Fields - - readonly Hashtable tools = new Hashtable(); - Kernel kernel; - #endregion - - #region Properties - /// - /// Gets or sets the solution version. - /// - /// The solution version. - public abstract string SolutionVersion { get; } - /// - /// Gets or sets the product version. - /// - /// The product version. - public abstract string ProductVersion { get; } - /// - /// Gets or sets the schema version. - /// - /// The schema version. - public abstract string SchemaVersion { get; } - /// - /// Gets or sets the name of the version. - /// - /// The name of the version. - public abstract string VersionName { get; } - /// - /// Gets or sets the version. - /// - /// The version. - public abstract VSVersion Version { get; } - /// - /// Gets the name. - /// - /// The name. - public abstract string Name { get; } - - protected abstract string GetToolsVersionXml(FrameworkVersion version); - public abstract string SolutionTag { get; } - - #endregion - - #region Constructors - - /// - /// Initializes a new instance of the class. - /// - protected VSGenericTarget() - { - this.tools["C#"] = new ToolInfo("C#", "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}", "csproj", "CSHARP", "$(MSBuildBinPath)\\Microsoft.CSHARP.Targets"); - this.tools["Database"] = new ToolInfo("Database", "{4F174C21-8C12-11D0-8340-0000F80270F8}", "dbp", "UNKNOWN"); - this.tools["Boo"] = new ToolInfo("Boo", "{45CEA7DC-C2ED-48A6-ACE0-E16144C02365}", "booproj", "Boo", "$(BooBinPath)\\Boo.Microsoft.Build.targets"); - this.tools["VisualBasic"] = new ToolInfo("VisualBasic", "{F184B08F-C81C-45F6-A57F-5ABD9991F28F}", "vbproj", "VisualBasic", "$(MSBuildBinPath)\\Microsoft.VisualBasic.Targets"); - this.tools["Folder"] = new ToolInfo("Folder", "{2150E333-8FDC-42A3-9474-1A3956D46DE8}", null, null); - } - - #endregion - - #region Private Methods - - private string MakeRefPath(ProjectNode project) - { - string ret = ""; - foreach (ReferencePathNode node in project.ReferencePaths) - { - try - { - string fullPath = Helper.ResolvePath(node.Path); - if (ret.Length < 1) - { - ret = fullPath; - } - else - { - ret += ";" + fullPath; - } - } - catch (ArgumentException) - { - this.kernel.Log.Write(LogType.Warning, "Could not resolve reference path: {0}", node.Path); - } - } - - return ret; - } - - private static ProjectNode FindProjectInSolution(string name, SolutionNode solution) - { - SolutionNode node = solution; - - while (node.Parent is SolutionNode) - node = node.Parent as SolutionNode; - - return FindProjectInSolutionRecursively(name, node); - } - - private static ProjectNode FindProjectInSolutionRecursively(string name, SolutionNode solution) - { - if (solution.ProjectsTable.ContainsKey(name)) - return (ProjectNode)solution.ProjectsTable[name]; - - foreach (SolutionNode child in solution.Solutions) - { - ProjectNode node = FindProjectInSolutionRecursively(name, child); - if (node != null) - return node; - } - - return null; - } - - private void WriteProject(SolutionNode solution, ProjectNode project) - { - if (!tools.ContainsKey(project.Language)) - { - throw new UnknownLanguageException("Unknown .NET language: " + project.Language); - } - - ToolInfo toolInfo = (ToolInfo)tools[project.Language]; - string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, toolInfo.FileExtension); - StreamWriter ps = new StreamWriter(projectFile); - - kernel.CurrentWorkingDirectory.Push(); - Helper.SetCurrentDir(Path.GetDirectoryName(projectFile)); - - #region Project File - using (ps) - { - ps.WriteLine("", GetToolsVersionXml(project.FrameworkVersion)); - ps.WriteLine(" "); - ps.WriteLine(" Local"); - ps.WriteLine(" {0}", this.ProductVersion); - ps.WriteLine(" {0}", this.SchemaVersion); - ps.WriteLine(" {{{0}}}", project.Guid.ToString().ToUpper()); - - // Visual Studio has a hard coded guid for the project type - if (project.Type == ProjectType.Web) - ps.WriteLine(" {349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}"); - ps.WriteLine(" Debug"); - ps.WriteLine(" AnyCPU"); - ps.WriteLine(" {0}", project.AppIcon); - ps.WriteLine(" "); - ps.WriteLine(" "); - ps.WriteLine(" {0}", project.AssemblyName); - foreach (ConfigurationNode conf in project.Configurations) - { - if (conf.Options.KeyFile != "") - { - ps.WriteLine(" {0}", conf.Options.KeyFile); - ps.WriteLine(" true"); - break; - } - } - ps.WriteLine(" JScript"); - ps.WriteLine(" Grid"); - ps.WriteLine(" IE50"); - ps.WriteLine(" false"); - ps.WriteLine(" {0}", project.FrameworkVersion.ToString().Replace("_", ".")); - - ps.WriteLine(" {0}", project.Type == ProjectType.Web ? ProjectType.Library.ToString() : project.Type.ToString()); - ps.WriteLine(" {0}", project.DesignerFolder); - ps.WriteLine(" {0}", project.RootNamespace); - ps.WriteLine(" {0}", project.StartupObject); - if (string.IsNullOrEmpty(project.DebugStartParameters)) - { - ps.WriteLine(" {0}", project.DebugStartParameters); - } - ps.WriteLine(" "); - ps.WriteLine(" "); - - ps.WriteLine(" "); - - foreach (ConfigurationNode conf in project.Configurations) - { - ps.Write(" ", conf.Name); - ps.WriteLine(" {0}", conf.Options["AllowUnsafe"]); - ps.WriteLine(" {0}", conf.Options["BaseAddress"]); - ps.WriteLine(" {0}", conf.Options["CheckUnderflowOverflow"]); - ps.WriteLine(" "); - ps.WriteLine(" "); - ps.WriteLine(" {0}", conf.Options["CompilerDefines"]); - ps.WriteLine(" {0}", Helper.NormalizePath(conf.Options["XmlDocFile"].ToString())); - ps.WriteLine(" {0}", conf.Options["DebugInformation"]); - ps.WriteLine(" {0}", conf.Options["FileAlignment"]); - ps.WriteLine(" {0}", conf.Options["OptimizeCode"]); - if (project.Type != ProjectType.Web) - ps.WriteLine(" {0}", - Helper.EndPath(Helper.NormalizePath(conf.Options["OutputPath"].ToString()))); - else - ps.WriteLine(" {0}", - Helper.EndPath(Helper.NormalizePath("bin\\"))); - - ps.WriteLine(" {0}", conf.Options["RegisterComInterop"]); - ps.WriteLine(" {0}", conf.Options["RemoveIntegerChecks"]); - ps.WriteLine(" {0}", conf.Options["WarningsAsErrors"]); - ps.WriteLine(" {0}", conf.Options["WarningLevel"]); - ps.WriteLine(" {0}", conf.Options["NoStdLib"]); - ps.WriteLine(" {0}", conf.Options["SuppressWarnings"]); - ps.WriteLine(" "); - } - - //ps.WriteLine(" "); - - List projectReferences = new List(); - List otherReferences = new List(); - - foreach (ReferenceNode refr in project.References) - { - ProjectNode projectNode = FindProjectInSolution(refr.Name, solution); - - if (projectNode == null) - otherReferences.Add(refr); - else - projectReferences.Add(projectNode); - } - // Assembly References - ps.WriteLine(" "); - - foreach (ReferenceNode refr in otherReferences) - { - ps.Write(" "); - ps.Write(" "); - ps.Write(refr.Name); - ps.WriteLine(""); - // TODO: Allow reference to *.exe files - ps.WriteLine(" {0}", refr.LocalCopy); - ps.WriteLine(" "); - } - ps.WriteLine(" "); - - //Project References - ps.WriteLine(" "); - foreach (ProjectNode projectReference in projectReferences) - { - ToolInfo tool = (ToolInfo)tools[projectReference.Language]; - if (tools == null) - throw new UnknownLanguageException(); - - string path = - Helper.MakePathRelativeTo(project.FullPath, - Helper.MakeFilePath(projectReference.FullPath, projectReference.Name, tool.FileExtension)); - ps.WriteLine(" ", path); - - // TODO: Allow reference to visual basic projects - ps.WriteLine(" {0}", projectReference.Name); - ps.WriteLine(" {0}", projectReference.Guid.ToString("B").ToUpper()); - ps.WriteLine(" {0}", tool.Guid.ToUpper()); - ps.WriteLine(" "); - } - ps.WriteLine(" "); - - // ps.WriteLine(" "); - ps.WriteLine(" "); - - // ps.WriteLine(" "); - List list = new List(); - - foreach (string path in project.Files) - { - string lower = path.ToLower(); - if (lower.EndsWith(".resx")) - { - string codebehind = String.Format("{0}.Designer{1}", path.Substring(0, path.LastIndexOf('.')), toolInfo.LanguageExtension); - if (!list.Contains(codebehind)) - list.Add(codebehind); - } - } - - foreach (string file in project.Files) - { - // if (file == "Properties\\Bind.Designer.cs") - // { - // Console.WriteLine("Wait a minute!"); - // Console.WriteLine(project.Files.GetSubType(file).ToString()); - // } - - SubType subType = project.Files.GetSubType(file); - - if (subType != SubType.Code && subType != SubType.Settings && subType != SubType.Designer - && subType != SubType.CodeBehind) - { - ps.WriteLine(" ", file.Substring(0, file.LastIndexOf('.')) + ".resx"); - ps.WriteLine(" {0}", Path.GetFileName(file)); - ps.WriteLine(" Designer"); - ps.WriteLine(" "); - // - } - - if (subType == SubType.Designer) - { - ps.WriteLine(" ", file); - ps.WriteLine(" " + subType + ""); - ps.WriteLine(" ResXFileCodeGenerator"); - - string autogen_name = file.Substring(0, file.LastIndexOf('.')) + ".Designer.cs"; - string dependent_name = file.Substring(0, file.LastIndexOf('.')) + ".cs"; - - ps.WriteLine(" {0}", autogen_name); - - // Check for a parent .cs file with the same name as this designer file - if (File.Exists(dependent_name)) - ps.WriteLine(" {0}", Path.GetFileName(dependent_name)); - - ps.WriteLine(" "); - if (File.Exists(autogen_name)) - { - ps.WriteLine(" ", autogen_name); - ps.WriteLine(" True"); - ps.WriteLine(" True"); - - // If a parent .cs file exists, link this autogen file to it. Otherwise link - // to the designer file - if (File.Exists(dependent_name)) - ps.WriteLine(" {0}", Path.GetFileName(dependent_name)); - else - ps.WriteLine(" {0}", Path.GetFileName(file)); - - ps.WriteLine(" "); - } - list.Add(autogen_name); - } - if (subType == SubType.Settings) - { - ps.Write(" <{0} ", project.Files.GetBuildAction(file)); - ps.WriteLine("Include=\"{0}\">", file); - string fileName = Path.GetFileName(file); - if (project.Files.GetBuildAction(file) == BuildAction.None) - { - ps.WriteLine(" SettingsSingleFileGenerator"); - ps.WriteLine(" {0}", fileName.Substring(0, fileName.LastIndexOf('.')) + ".Designer.cs"); - } - else - { - ps.WriteLine(" Code"); - ps.WriteLine(" True"); - ps.WriteLine(" True"); - string fileNameShort = fileName.Substring(0, fileName.LastIndexOf('.')); - string fileNameShorter = fileNameShort.Substring(0, fileNameShort.LastIndexOf('.')); - ps.WriteLine(" {0}", Path.GetFileName(fileNameShorter + ".settings")); - } - ps.WriteLine(" ", project.Files.GetBuildAction(file)); - } - else if (subType != SubType.Designer) - { - string path = Helper.NormalizePath(file); - string path_lower = path.ToLower(); - - if (!list.Contains(file)) - { - ps.Write(" <{0} ", project.Files.GetBuildAction(path)); - - int startPos = 0; - if (project.Files.GetPreservePath(file)) - { - while ((@"./\").IndexOf(file.Substring(startPos, 1)) != -1) - startPos++; - - } - else - { - startPos = file.LastIndexOf(Path.GetFileName(path)); - } - - ps.WriteLine("Include=\"{0}\">", path); - - int last_period_index = file.LastIndexOf('.'); - string short_file_name = file.Substring(0, last_period_index); - string extension = Path.GetExtension(path); - string designer_format = string.Format(".designer{0}", extension); - - if (path_lower.EndsWith(designer_format)) - { - int designer_index = path_lower.IndexOf(designer_format); - string file_name = path.Substring(0, designer_index); - - if (File.Exists(file_name)) - ps.WriteLine(" {0}", Path.GetFileName(file_name)); - else if (File.Exists(file_name + ".resx")) - ps.WriteLine(" {0}", Path.GetFileName(file_name + ".resx")); - } - else if (subType == SubType.CodeBehind) - { - ps.WriteLine(" {0}", Path.GetFileName(short_file_name)); - } - if (project.Files.GetIsLink(file)) - { - string alias = project.Files.GetLinkPath(file); - alias += file.Substring(startPos); - alias = Helper.NormalizePath(alias); - ps.WriteLine(" {0}", alias); - } - else if (project.Files.GetBuildAction(file) != BuildAction.None) - { - if (project.Files.GetBuildAction(file) != BuildAction.EmbeddedResource) - { - ps.WriteLine(" {0}", subType); - } - } - - if (project.Files.GetCopyToOutput(file) != CopyToOutput.Never) - { - ps.WriteLine(" {0}", project.Files.GetCopyToOutput(file)); - } - - ps.WriteLine(" ", project.Files.GetBuildAction(file)); - } - } - } - - ps.WriteLine(" "); - ps.WriteLine(" "); - ps.WriteLine(" "); - ps.WriteLine(" "); - ps.WriteLine(" "); - ps.WriteLine(" "); - ps.WriteLine(" "); - ps.WriteLine(" "); - ps.WriteLine(""); - } - #endregion - - #region User File - - ps = new StreamWriter(projectFile + ".user"); - using (ps) - { - ps.WriteLine(""); - //ps.WriteLine( "" ); - //ps.WriteLine(" <{0}>", toolInfo.XMLTag); - //ps.WriteLine(" "); - ps.WriteLine(" "); - //ps.WriteLine(" ", MakeRefPath(project)); - ps.WriteLine(" Debug"); - ps.WriteLine(" AnyCPU"); - ps.WriteLine(" {0}", MakeRefPath(project)); - ps.WriteLine(" {0}", this.ProductVersion); - ps.WriteLine(" ProjectFiles"); - ps.WriteLine(" 0"); - ps.WriteLine(" "); - foreach (ConfigurationNode conf in project.Configurations) - { - ps.Write(" "); - } - ps.WriteLine(""); - } - #endregion - - kernel.CurrentWorkingDirectory.Pop(); - } - - private void WriteSolution(SolutionNode solution, bool writeSolutionToDisk) - { - kernel.Log.Write("Creating {0} solution and project files", this.VersionName); - - foreach (SolutionNode child in solution.Solutions) - { - kernel.Log.Write("...Creating folder: {0}", child.Name); - WriteSolution(child, false); - } - - foreach (ProjectNode project in solution.Projects) - { - kernel.Log.Write("...Creating project: {0}", project.Name); - WriteProject(solution, project); - } - - foreach (DatabaseProjectNode project in solution.DatabaseProjects) - { - kernel.Log.Write("...Creating database project: {0}", project.Name); - WriteDatabaseProject(solution, project); - } - - if (writeSolutionToDisk) // only write main solution - { - kernel.Log.Write(""); - string solutionFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "sln"); - - using (StreamWriter ss = new StreamWriter(solutionFile)) - { - kernel.CurrentWorkingDirectory.Push(); - Helper.SetCurrentDir(Path.GetDirectoryName(solutionFile)); - - ss.WriteLine("Microsoft Visual Studio Solution File, Format Version {0}", this.SolutionVersion); - ss.WriteLine(SolutionTag); - - WriteProjectDeclarations(ss, solution, solution); - - ss.WriteLine("Global"); - - ss.WriteLine("\tGlobalSection(SolutionConfigurationPlatforms) = preSolution"); - foreach (ConfigurationNode conf in solution.Configurations) - { - ss.WriteLine("\t\t{0}|Any CPU = {0}|Any CPU", conf.Name); - } - ss.WriteLine("\tEndGlobalSection"); - - ss.WriteLine("\tGlobalSection(ProjectConfigurationPlatforms) = postSolution"); - WriteConfigurationLines(solution.Configurations, solution, ss); - ss.WriteLine("\tEndGlobalSection"); - - if (solution.Solutions.Count > 0) - { - ss.WriteLine("\tGlobalSection(NestedProjects) = preSolution"); - foreach (SolutionNode embeddedSolution in solution.Solutions) - { - WriteNestedProjectMap(ss, embeddedSolution); - } - ss.WriteLine("\tEndGlobalSection"); - } - - ss.WriteLine("EndGlobal"); - } - - kernel.CurrentWorkingDirectory.Pop(); - } - } - - private void WriteProjectDeclarations(StreamWriter writer, SolutionNode actualSolution, SolutionNode embeddedSolution) - { - foreach (SolutionNode childSolution in embeddedSolution.Solutions) - { - WriteEmbeddedSolution(writer, childSolution); - WriteProjectDeclarations(writer, actualSolution, childSolution); - } - - foreach (ProjectNode project in embeddedSolution.Projects) - { - WriteProject(actualSolution, writer, project); - } - - foreach (DatabaseProjectNode dbProject in embeddedSolution.DatabaseProjects) - { - WriteProject(actualSolution, writer, dbProject); - } - - if (actualSolution.Guid == embeddedSolution.Guid) - { - WriteSolutionFiles(actualSolution, writer); - } - } - - private static void WriteNestedProjectMap(StreamWriter writer, SolutionNode embeddedSolution) - { - foreach (ProjectNode project in embeddedSolution.Projects) - { - WriteNestedProject(writer, embeddedSolution, project.Guid); - } - - foreach (DatabaseProjectNode dbProject in embeddedSolution.DatabaseProjects) - { - WriteNestedProject(writer, embeddedSolution, dbProject.Guid); - } - - foreach (SolutionNode child in embeddedSolution.Solutions) - { - WriteNestedProject(writer, embeddedSolution, child.Guid); - WriteNestedProjectMap(writer, child); - } - } - - private static void WriteNestedProject(StreamWriter writer, SolutionNode solution, Guid projectGuid) - { - WriteNestedFolder(writer, solution.Guid, projectGuid); - } - - private static void WriteNestedFolder(StreamWriter writer, Guid parentGuid, Guid childGuid) - { - writer.WriteLine("\t\t{0} = {1}", - childGuid.ToString("B").ToUpper(), - parentGuid.ToString("B").ToUpper()); - } - - private static void WriteConfigurationLines(ICollection configurations, SolutionNode solution, StreamWriter ss) - { - foreach (ProjectNode project in solution.Projects) - { - foreach (ConfigurationNode conf in configurations) - { - ss.WriteLine("\t\t{0}.{1}|Any CPU.ActiveCfg = {1}|Any CPU", - project.Guid.ToString("B").ToUpper(), - conf.Name); - - ss.WriteLine("\t\t{0}.{1}|Any CPU.Build.0 = {1}|Any CPU", - project.Guid.ToString("B").ToUpper(), - conf.Name); - } - } - - foreach (SolutionNode child in solution.Solutions) - { - WriteConfigurationLines(configurations, child, ss); - } - } - - private void WriteSolutionFiles(SolutionNode solution, StreamWriter ss) - { - WriteProject(ss, "Folder", solution.Guid, "Solution Files", "Solution Files", solution.Files); - } - - private void WriteEmbeddedSolution(StreamWriter writer, SolutionNode embeddedSolution) - { - WriteProject(writer, "Folder", embeddedSolution.Guid, embeddedSolution.Name, embeddedSolution.Name, embeddedSolution.Files); - } - - private void WriteProject(SolutionNode solution, StreamWriter ss, ProjectNode project) - { - WriteProject(ss, solution, project.Language, project.Guid, project.Name, project.FullPath); - } - - private void WriteProject(SolutionNode solution, StreamWriter ss, DatabaseProjectNode dbProject) - { - if (solution.Files != null && solution.Files.Count > 0) - WriteProject(ss, solution, "Database", dbProject.Guid, dbProject.Name, dbProject.FullPath); - } - - private static bool ExtensionSpecified(string refName) - { - return refName.EndsWith(".dll") || refName.EndsWith(".exe"); - } - - private static string GetProjectExtension(ProjectNode project) - { - string extension = ".dll"; - if (project.Type == ProjectType.Exe) - { - extension = ".exe"; - } - return extension; - } - - const string ProjectDeclarationBeginFormat = "Project(\"{0}\") = \"{1}\", \"{2}\", \"{3}\""; - const string ProjectDeclarationEndFormat = "EndProject"; - - private void WriteProject(StreamWriter ss, SolutionNode solution, string language, Guid guid, string name, string projectFullPath) - { - if (!tools.ContainsKey(language)) - throw new UnknownLanguageException("Unknown .NET language: " + language); - - ToolInfo toolInfo = (ToolInfo)tools[language]; - - string path = Helper.MakePathRelativeTo(solution.FullPath, projectFullPath); - - path = Helper.MakeFilePath(path, name, toolInfo.FileExtension); - - WriteProject(ss, language, guid, name, path); - } - - private void WriteProject(StreamWriter writer, string language, Guid projectGuid, string name, string location) - { - WriteProject(writer, language, projectGuid, name, location, null); - } - - private void WriteProject(StreamWriter writer, string language, Guid projectGuid, string name, string location, FilesNode files) - { - if (!tools.ContainsKey(language)) - throw new UnknownLanguageException("Unknown .NET language: " + language); - - ToolInfo toolInfo = (ToolInfo)tools[language]; - - writer.WriteLine(ProjectDeclarationBeginFormat, - toolInfo.Guid, - name, - location, - projectGuid.ToString("B").ToUpper()); - - if (files != null) - { - writer.WriteLine("\tProjectSection(SolutionItems) = preProject"); - - foreach (string file in files) - writer.WriteLine("\t\t{0} = {0}", file); - - writer.WriteLine("\tEndProjectSection"); - } - - writer.WriteLine(ProjectDeclarationEndFormat); - } - - private void WriteDatabaseProject(SolutionNode solution, DatabaseProjectNode project) - { - string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, "dbp"); - IndentedTextWriter ps = new IndentedTextWriter(new StreamWriter(projectFile), " "); - - kernel.CurrentWorkingDirectory.Push(); - - Helper.SetCurrentDir(Path.GetDirectoryName(projectFile)); - - using (ps) - { - ps.WriteLine("# Microsoft Developer Studio Project File - Database Project"); - ps.WriteLine("Begin DataProject = \"{0}\"", project.Name); - ps.Indent++; - ps.WriteLine("MSDTVersion = \"80\""); - // TODO: Use the project.Files property - if (ContainsSqlFiles(Path.GetDirectoryName(projectFile))) - WriteDatabaseFoldersAndFiles(ps, Path.GetDirectoryName(projectFile)); - - ps.WriteLine("Begin DBRefFolder = \"Database References\""); - ps.Indent++; - foreach (DatabaseReferenceNode reference in project.References) - { - ps.WriteLine("Begin DBRefNode = \"{0}\"", reference.Name); - ps.Indent++; - ps.WriteLine("ConnectStr = \"{0}\"", reference.ConnectionString); - ps.WriteLine("Provider = \"{0}\"", reference.ProviderId.ToString("B").ToUpper()); - //ps.WriteLine("Colorizer = 5"); - ps.Indent--; - ps.WriteLine("End"); - } - ps.Indent--; - ps.WriteLine("End"); - ps.Indent--; - ps.WriteLine("End"); - - ps.Flush(); - } - - kernel.CurrentWorkingDirectory.Pop(); - } - - private bool ContainsSqlFiles(string folder) - { - foreach (string file in Directory.GetFiles(folder, "*.sql")) - { - return true; // if the folder contains 1 .sql file, that's good enough - } - - foreach (string child in Directory.GetDirectories(folder)) - { - if (ContainsSqlFiles(child)) - return true; // if 1 child folder contains a .sql file, still good enough - } - - return false; - } - - private void WriteDatabaseFoldersAndFiles(IndentedTextWriter writer, string folder) - { - foreach (string child in Directory.GetDirectories(folder)) - { - if (ContainsSqlFiles(child)) - { - writer.WriteLine("Begin Folder = \"{0}\"", Path.GetFileName(child)); - writer.Indent++; - WriteDatabaseFoldersAndFiles(writer, child); - writer.Indent--; - writer.WriteLine("End"); - } - } - foreach (string file in Directory.GetFiles(folder, "*.sql")) - { - writer.WriteLine("Script = \"{0}\"", Path.GetFileName(file)); - } - } - - private void CleanProject(ProjectNode project) - { - kernel.Log.Write("...Cleaning project: {0}", project.Name); - - ToolInfo toolInfo = (ToolInfo)tools[project.Language]; - string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, toolInfo.FileExtension); - string userFile = projectFile + ".user"; - - Helper.DeleteIfExists(projectFile); - Helper.DeleteIfExists(userFile); - } - - private void CleanSolution(SolutionNode solution) - { - kernel.Log.Write("Cleaning {0} solution and project files", this.VersionName, solution.Name); - - string slnFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "sln"); - string suoFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "suo"); - - Helper.DeleteIfExists(slnFile); - Helper.DeleteIfExists(suoFile); - - foreach (ProjectNode project in solution.Projects) - { - CleanProject(project); - } - - kernel.Log.Write(""); - } - - #endregion - - #region ITarget Members - - /// - /// Writes the specified kern. - /// - /// The kern. - public virtual void Write(Kernel kern) - { - if (kern == null) - { - throw new ArgumentNullException("kern"); - } - kernel = kern; - foreach (SolutionNode sol in kernel.Solutions) - { - WriteSolution(sol, true); - } - kernel = null; - } - - /// - /// Cleans the specified kern. - /// - /// The kern. - public virtual void Clean(Kernel kern) - { - if (kern == null) - { - throw new ArgumentNullException("kern"); - } - kernel = kern; - foreach (SolutionNode sol in kernel.Solutions) - { - CleanSolution(sol); - } - kernel = null; - } - - #endregion - } -} 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 @@ -#region BSD License -/* -Copyright (c) 2008-2009 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com), John Anderson (sontek@gmail.com) - -Redistribution and use in source and binary forms, with or without modification, are permitted -provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. -* The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, -BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ -#endregion - -namespace Prebuild.Core.Targets -{ - /// - /// - /// - public enum VSVersion - { - /// - /// Visual Studio 2002 - /// - VS70, - /// - /// Visual Studio 2003 - /// - VS71, - /// - /// Visual Studio 2005 - /// - VS80, - /// - /// Visual Studio 2008 - /// - VS90 - } -} 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 */ #endregion +#region CVS Information +/* + * $Source$ + * $Author: jendave $ + * $Date: 2007-02-13 12:58:03 -0800 (Tue, 13 Feb 2007) $ + * $Revision: 205 $ + */ +#endregion + using System; using System.Collections; using System.Collections.Specialized; -- cgit v1.1