From ce33db72cb7ca15087606a23abf96590c49d166e Mon Sep 17 00:00:00 2001 From: lbsa71 Date: Mon, 5 Nov 2007 15:10:20 +0000 Subject: * prebuild now creates .exe references in NAntTarget * prebuild now uses local copy of schema (for future expansions) --- Prebuild/prebuild-opensim.xsd | 258 +++++++++++ Prebuild/src/Core/Targets/NAntTarget.cs | 784 ++++++++++++++++---------------- 2 files changed, 657 insertions(+), 385 deletions(-) create mode 100644 Prebuild/prebuild-opensim.xsd (limited to 'Prebuild') diff --git a/Prebuild/prebuild-opensim.xsd b/Prebuild/prebuild-opensim.xsd new file mode 100644 index 0000000..eee36aa --- /dev/null +++ b/Prebuild/prebuild-opensim.xsd @@ -0,0 +1,258 @@ + + + + + Copyright (c) 2004-2005 Matthew Holmes (calefaction at houston . rr . com), Dan Moorehead (dan05a at gmail . com), David Hudson (jendave at yahoo dot com) + + .NET Prebuild is a cross-platform XML-driven pre-build tool which + allows developers to easily generate project or make files for major + IDE's and .NET development tools including: Visual Studio .NET 2002 and + 2003, SharpDevelop, MonoDevelop, and NAnt. + + BSD License: + + 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. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Prebuild/src/Core/Targets/NAntTarget.cs b/Prebuild/src/Core/Targets/NAntTarget.cs index e9870db..5355eef 100644 --- a/Prebuild/src/Core/Targets/NAntTarget.cs +++ b/Prebuild/src/Core/Targets/NAntTarget.cs @@ -47,301 +47,311 @@ 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; - } - - private static string BuildReference(SolutionNode solution, ProjectNode currentProject, ReferenceNode refr) + /// + /// + [Target("nant")] + public class NAntTarget : ITarget { - string ret = ""; - if(solution.ProjectsTable.ContainsKey(refr.Name)) + #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 = ""; + if (solution.ProjectsTable.ContainsKey(refr.Name)) { ProjectNode project = (ProjectNode)solution.ProjectsTable[refr.Name]; - string finalPath = Helper.NormalizePath(((ReferencePathNode)currentProject.ReferencePaths[0]).Path + refr.Name + ".dll", '/'); - + string finalPath = Helper.NormalizePath(((ReferencePathNode)currentProject.ReferencePaths[0]).Path + refr.Name + GetProjectExtension(project), '/'); + return finalPath; } - else + else { 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 + "/" + refr.Name + ".dll", '/') : fileRef; - ret += finalPath; - return ret; - } + if (refr.Path != null || fileRef != null) + { + string finalPath = (refr.Path != null) ? Helper.NormalizePath(refr.Path + "/" + refr.Name + GetProjectExtension(project), '/') : fileRef; + ret += finalPath; + return ret; + } try - { - //Assembly assem = Assembly.Load(refr.Name); - //if (assem != null) - //{ - //ret += (refr.Name + ".dll"); - //} - //else - //{ - ret += (refr.Name + ".dll"); - //} - } + { + //Assembly assem = Assembly.Load(refr.Name); + //if (assem != null) + //{ + //ret += (refr.Name + ".dll"); + //} + //else + //{ + ret += (refr.Name + GetProjectExtension(project)); + //} + } catch (System.NullReferenceException e) - { - e.ToString(); - ret += refr.Name + ".dll"; - } + { + e.ToString(); + ret += refr.Name + GetProjectExtension(project); + } } - return ret; - } + return ret; + } - private static string BuildReferencePath(SolutionNode solution, ReferenceNode refr) - { - string ret = ""; - if(solution.ProjectsTable.ContainsKey(refr.Name)) + private static string GetProjectExtension(ProjectNode project) + { + string extension = ".dll"; + if (project.Type == ProjectType.Exe) + { + extension = ".exe"; + } + return extension; + } + + 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 + else { 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; - } + 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) { - Assembly assem = Assembly.Load(refr.Name); - if (assem != null) - { - ret += ""; - } - else - { - ret += ""; - } + ret += ""; } - catch (System.NullReferenceException e) + else { - e.ToString(); ret += ""; } + } + catch (System.NullReferenceException e) + { + e.ToString(); + ret += ""; + } } - return ret; - } + return ret; + } - private static string FindFileReference(string refName, ProjectNode project) - { - foreach(ReferencePathNode refPath in project.ReferencePaths) + 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; - } + 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 ) + 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 ) + 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 + (project.Type == ProjectType.Library ? ".dll" : ".exe"), "build"); - StreamWriter ss = new StreamWriter(projFile); - - m_Kernel.CurrentWorkingDirectory.Push(); - Helper.SetCurrentDir(Path.GetDirectoryName(projFile)); - bool hasDoc = false; - - using(ss) + 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(" "); ss.WriteLine(" "); - foreach(ReferenceNode refr in project.References) + foreach (ReferenceNode refr in project.References) + { + if (refr.LocalCopy) { - if (refr.LocalCopy) - { - ss.WriteLine(" ", '/')); - } + ss.WriteLine(" ", '/')); } + } ss.WriteLine(" "); ss.WriteLine(" "); ss.Write(" "); ss.WriteLine(" ", project.RootNamespace); foreach (string file in project.Files) + { + switch (project.Files.GetBuildAction(file)) { - 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) { - 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; + 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) + foreach (string file in project.Files) + { + switch (project.Files.GetBuildAction(file)) { - switch(project.Files.GetBuildAction(file)) - { - case BuildAction.Compile: - ss.WriteLine(" "); - break; - default: - break; - } + 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(" " ); - } + foreach (ReferenceNode refr in project.References) + { + string path = Helper.NormalizePath(Helper.MakePathRelativeTo(project.FullPath, BuildReference(solution, project, refr)), '/'); + ss.WriteLine(" "); + } ss.WriteLine(" "); - + ss.WriteLine(" "); foreach (ConfigurationNode conf in project.Configurations) + { + if (!String.IsNullOrEmpty(conf.Options.OutputPath)) { - if (!String.IsNullOrEmpty(conf.Options.OutputPath)) - { - string targetDir = Helper.NormalizePath(conf.Options.OutputPath, '/'); - - ss.WriteLine(" "); - - ss.WriteLine(" "); - - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - break; - } + string targetDir = Helper.NormalizePath(conf.Options.OutputPath, '/'); + + ss.WriteLine(" "); + + ss.WriteLine(" "); + + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + break; } - + } + ss.WriteLine(" "); ss.WriteLine(" "); @@ -351,89 +361,89 @@ public class NAntTarget : ITarget ss.WriteLine(" "); if (hasDoc) + { + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.Write(" "); - 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(".dll\" />"); + } + 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(); - } + } + m_Kernel.CurrentWorkingDirectory.Pop(); + } - private void WriteCombine(SolutionNode solution) - { - m_Kernel.Log.Write("Creating NAnt build files"); - foreach(ProjectNode project in solution.Projects) + 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); - } + 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.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) + m_Kernel.CurrentWorkingDirectory.Push(); + Helper.SetCurrentDir(Path.GetDirectoryName(combFile)); + + using (ss) { ss.WriteLine(""); ss.WriteLine("", solution.Name); @@ -447,26 +457,26 @@ public class NAntTarget : ITarget ss.WriteLine(" "); ss.WriteLine(" "); - foreach(ConfigurationNode conf in solution.Configurations) + foreach (ConfigurationNode conf in solution.Configurations) + { + // Set the project.config to a non-debug configuration + if (conf.Options["DebugInformation"].ToString().ToLower() != "true") { - // Set the project.config to a non-debug configuration - if( conf.Options["DebugInformation"].ToString().ToLower() != "true" ) - { - ss.WriteLine(" ", conf.Name); - } - ss.WriteLine(); - ss.WriteLine(" ", conf.Name); - ss.WriteLine(" ", conf.Name); - ss.WriteLine(" ", conf.Options["DebugInformation"].ToString().ToLower()); - ss.WriteLine(" "); - ss.WriteLine(); + ss.WriteLine(" ", conf.Name); } + 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(" "); @@ -497,28 +507,31 @@ public class NAntTarget : ITarget // created files from all .nant/*include files. This // lets us keep using prebuild, but allows for // extended nant targets to do build and the like. - - try { + + try + { Regex re = new Regex(".include$"); DirectoryInfo nantdir = new DirectoryInfo(".nant"); foreach (FileSystemInfo item in nantdir.GetFileSystemInfos()) { - if (item is DirectoryInfo) {} + if (item is DirectoryInfo) { } else if (item is FileInfo) { - if (re.Match(((FileInfo)item).FullName) != - System.Text.RegularExpressions.Match.Empty) { + if (re.Match(((FileInfo)item).FullName) != + System.Text.RegularExpressions.Match.Empty) + { Console.WriteLine("Including file: " + ((FileInfo)item).FullName); - using (FileStream fs = new FileStream(((FileInfo)item).FullName, + using (FileStream fs = new FileStream(((FileInfo)item).FullName, FileMode.Open, FileAccess.Read, - FileShare.None)) + FileShare.None)) { - using (StreamReader sr = new StreamReader(fs)) + using (StreamReader sr = new StreamReader(fs)) { ss.WriteLine("", ((FileInfo)item).FullName); - while (sr.Peek() != -1) { + while (sr.Peek() != -1) + { ss.WriteLine(sr.ReadLine()); } ss.WriteLine(); @@ -527,45 +540,46 @@ public class NAntTarget : ITarget } } } - } catch {} + } + catch { } // ss.WriteLine(" "); -// ss.WriteLine(" "); -// ss.WriteLine(" ", solution.Name, solution.Version); -// ss.WriteLine(" "); - -// ss.WriteLine(" "); -// // ss.WriteLine(" "); -// ss.WriteLine(" "); -// ss.WriteLine(" "); -// ss.WriteLine(" "); -// ss.WriteLine(" "); + // ss.WriteLine(" "); + // ss.WriteLine(" ", solution.Name, solution.Version); + // 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(ProjectNode project in solution.Projects) - { - string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath); - ss.Write(" "); - } + foreach (ProjectNode project in solution.Projects) + { + string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath); + ss.Write(" "); + } ss.WriteLine(" "); ss.WriteLine(); ss.WriteLine(" "); - - foreach(ProjectNode project in solution.ProjectsTableOrder) - { - string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath); - ss.Write(" "); - } + + foreach (ProjectNode project in solution.ProjectsTableOrder) + { + string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath); + ss.Write(" "); + } ss.WriteLine(" "); ss.WriteLine(); @@ -580,94 +594,94 @@ public class NAntTarget : ITarget ss.WriteLine(" "); ss.WriteLine(" "); foreach (ProjectNode project in solution.Projects) - { - string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath); - ss.Write(" "); - } + { + string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath); + ss.Write(" "); + } ss.WriteLine(" "); - ss.WriteLine(); + ss.WriteLine(); ss.WriteLine(""); } - m_Kernel.CurrentWorkingDirectory.Pop(); - } + m_Kernel.CurrentWorkingDirectory.Pop(); + } - private void CleanProject(ProjectNode project) - { - m_Kernel.Log.Write("...Cleaning project: {0}", project.Name); - string projectFile = Helper.MakeFilePath(project.FullPath, project.Name + (project.Type == ProjectType.Library ? ".dll" : ".exe"), "build"); - Helper.DeleteIfExists(projectFile); - } + private void CleanProject(ProjectNode project) + { + m_Kernel.Log.Write("...Cleaning project: {0}", project.Name); + string projectFile = Helper.MakeFilePath(project.FullPath, project.Name + GetProjectExtension(project), "build"); + Helper.DeleteIfExists(projectFile); + } - private void CleanSolution(SolutionNode solution) - { - m_Kernel.Log.Write("Cleaning NAnt build files for", solution.Name); + private void CleanSolution(SolutionNode solution) + { + m_Kernel.Log.Write("Cleaning NAnt build files for", solution.Name); - string slnFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "build"); - Helper.DeleteIfExists(slnFile); + string slnFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "build"); + Helper.DeleteIfExists(slnFile); - foreach(ProjectNode project in solution.Projects) + foreach (ProjectNode project in solution.Projects) { CleanProject(project); } - - m_Kernel.Log.Write(""); - } -#endregion + m_Kernel.Log.Write(""); + } -#region ITarget Members + #endregion - /// - /// Writes the specified kern. - /// - /// The kern. - public void Write(Kernel kern) - { - if( kern == null ) + #region ITarget Members + + /// + /// Writes the specified kern. + /// + /// The kern. + public void Write(Kernel kern) + { + if (kern == null) { throw new ArgumentNullException("kern"); } - m_Kernel = kern; - foreach(SolutionNode solution in kern.Solutions) + m_Kernel = kern; + foreach (SolutionNode solution in kern.Solutions) { WriteCombine(solution); } - m_Kernel = null; - } - - /// - /// Cleans the specified kern. - /// - /// The kern. - public virtual void Clean(Kernel kern) - { - if( kern == null ) + m_Kernel = null; + } + + /// + /// Cleans the specified kern. + /// + /// The kern. + public virtual void Clean(Kernel kern) + { + if (kern == null) { throw new ArgumentNullException("kern"); } - m_Kernel = kern; - foreach(SolutionNode sol in kern.Solutions) + m_Kernel = kern; + foreach (SolutionNode sol in kern.Solutions) { CleanSolution(sol); } - m_Kernel = null; - } - - /// - /// Gets the name. - /// - /// The name. - public string Name - { - get + m_Kernel = null; + } + + /// + /// Gets the name. + /// + /// The name. + public string Name + { + get { return "nant"; } - } + } -#endregion -} + #endregion + } } -- cgit v1.1