From 7e65590a55ba575d0086bdfc25addaf1051d799b Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 11 Sep 2010 01:13:08 +0100 Subject: Update Prebuild.exe with Prebuild r323 + an existing OpenSim specific nant hack to correctly clean up chosen OpenSim exes and dlls in bin/ on a "nant clean" Source code is included for reference. This can go away again once Prebuild is updated with a more general mechanism for cleaning up files. The Prebuild source code here can be built with nant, or regnerated for other tools using the prebuild at {root}/bin/Prebuild.exe --- .../Nodes/.svn/text-base/ProjectNode.cs.svn-base | 579 +++++++++++++++++++++ 1 file changed, 579 insertions(+) create mode 100644 Prebuild/src/Core/Nodes/.svn/text-base/ProjectNode.cs.svn-base (limited to 'Prebuild/src/Core/Nodes/.svn/text-base/ProjectNode.cs.svn-base') diff --git a/Prebuild/src/Core/Nodes/.svn/text-base/ProjectNode.cs.svn-base b/Prebuild/src/Core/Nodes/.svn/text-base/ProjectNode.cs.svn-base new file mode 100644 index 0000000..fb92b32 --- /dev/null +++ b/Prebuild/src/Core/Nodes/.svn/text-base/ProjectNode.cs.svn-base @@ -0,0 +1,579 @@ +#region BSD License +/* +Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@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.Generic; +using System.IO; +using System.Xml; + +using Prebuild.Core.Attributes; +using Prebuild.Core.Interfaces; +using Prebuild.Core.Utilities; + +namespace Prebuild.Core.Nodes +{ + /// + /// A set of values that the Project's type can be + /// + public enum ProjectType + { + /// + /// The project is a console executable + /// + Exe, + /// + /// The project is a windows executable + /// + WinExe, + /// + /// The project is a library + /// + Library, + /// + /// The project is a website + /// + Web, + } + + /// + /// + /// + public enum ClrRuntime + { + /// + /// + /// + Microsoft, + /// + /// + /// + Mono + } + /// + /// The version of the .NET framework to use (Required for VS2008) + /// We don't need .NET 1.1 in here, it'll default when using vs2003. + /// + public enum FrameworkVersion + { + /// + /// .NET 2.0 + /// + v2_0, + /// + /// .NET 3.0 + /// + v3_0, + /// + /// .NET 3.5 + /// + v3_5, + /// + /// .NET 4.0 + /// + v4_0, + } + /// + /// The Node object representing /Prebuild/Solution/Project elements + /// + [DataNode("Project")] + public class ProjectNode : DataNode, IComparable + { + #region Fields + + private string m_Name = "unknown"; + private string m_Path = ""; + private string m_FullPath = ""; + private string m_AssemblyName; + private string m_AppIcon = ""; + private string m_ConfigFile = ""; + private string m_DesignerFolder = ""; + private string m_Language = "C#"; + private ProjectType m_Type = ProjectType.Exe; + private ClrRuntime m_Runtime = ClrRuntime.Microsoft; + private FrameworkVersion m_Framework = FrameworkVersion.v2_0; + private string m_StartupObject = ""; + private string m_RootNamespace; + private string m_FilterGroups = ""; + private string m_Version = ""; + private Guid m_Guid; + private string m_DebugStartParameters; + + private readonly Dictionary m_Configurations = new Dictionary(); + private readonly List m_ReferencePaths = new List(); + private readonly List m_References = new List(); + private readonly List m_Authors = new List(); + private FilesNode m_Files; + + #endregion + + #region Properties + + /// + /// Gets the name. + /// + /// The name. + public string Name + { + get + { + return m_Name; + } + } + /// + /// The version of the .NET Framework to compile under + /// + public FrameworkVersion FrameworkVersion + { + get + { + return m_Framework; + } + } + /// + /// Gets the path. + /// + /// The path. + public string Path + { + get + { + return m_Path; + } + } + + /// + /// Gets the filter groups. + /// + /// The filter groups. + public string FilterGroups + { + get + { + return m_FilterGroups; + } + } + + /// + /// Gets the project's version + /// + /// The project's version. + public string Version + { + get + { + return m_Version; + } + } + + /// + /// Gets the full path. + /// + /// The full path. + public string FullPath + { + get + { + return m_FullPath; + } + } + + /// + /// Gets the name of the assembly. + /// + /// The name of the assembly. + public string AssemblyName + { + get + { + return m_AssemblyName; + } + } + + /// + /// Gets the app icon. + /// + /// The app icon. + public string AppIcon + { + get + { + return m_AppIcon; + } + } + + /// + /// Gets the app icon. + /// + /// The app icon. + public string ConfigFile + { + get + { + return m_ConfigFile; + } + } + + /// + /// + /// + public string DesignerFolder + { + get + { + return m_DesignerFolder; + } + } + + /// + /// Gets the language. + /// + /// The language. + public string Language + { + get + { + return m_Language; + } + } + + /// + /// Gets the type. + /// + /// The type. + public ProjectType Type + { + get + { + return m_Type; + } + } + + /// + /// Gets the runtime. + /// + /// The runtime. + public ClrRuntime Runtime + { + get + { + return m_Runtime; + } + } + + private bool m_GenerateAssemblyInfoFile; + + /// + /// + /// + public bool GenerateAssemblyInfoFile + { + get + { + return m_GenerateAssemblyInfoFile; + } + set + { + m_GenerateAssemblyInfoFile = value; + } + } + + /// + /// Gets the startup object. + /// + /// The startup object. + public string StartupObject + { + get + { + return m_StartupObject; + } + } + + /// + /// Gets the root namespace. + /// + /// The root namespace. + public string RootNamespace + { + get + { + return m_RootNamespace; + } + } + + /// + /// Gets the configurations. + /// + /// The configurations. + public List Configurations + { + get + { + List tmp = new List(ConfigurationsTable.Values); + tmp.Sort(); + return tmp; + } + } + + /// + /// Gets the configurations table. + /// + /// The configurations table. + public Dictionary ConfigurationsTable + { + get + { + return m_Configurations; + } + } + + /// + /// Gets the reference paths. + /// + /// The reference paths. + public List ReferencePaths + { + get + { + List tmp = new List(m_ReferencePaths); + tmp.Sort(); + return tmp; + } + } + + /// + /// Gets the references. + /// + /// The references. + public List References + { + get + { + List tmp = new List(m_References); + tmp.Sort(); + return tmp; + } + } + + /// + /// Gets the Authors list. + /// + /// The list of the project's authors. + public List Authors + { + get + { + return m_Authors; + } + } + + /// + /// Gets the files. + /// + /// The files. + public FilesNode Files + { + get + { + return m_Files; + } + } + + /// + /// Gets or sets the parent. + /// + /// The parent. + public override IDataNode Parent + { + get + { + return base.Parent; + } + set + { + base.Parent = value; + if(base.Parent is SolutionNode && m_Configurations.Count < 1) + { + SolutionNode parent = (SolutionNode)base.Parent; + foreach(ConfigurationNode conf in parent.Configurations) + { + m_Configurations[conf.NameAndPlatform] = (ConfigurationNode) conf.Clone(); + } + } + } + } + + /// + /// Gets the GUID. + /// + /// The GUID. + public Guid Guid + { + get + { + return m_Guid; + } + } + + public string DebugStartParameters + { + get + { + return m_DebugStartParameters; + } + } + + #endregion + + #region Private Methods + + private void HandleConfiguration(ConfigurationNode conf) + { + if(String.Compare(conf.Name, "all", true) == 0) //apply changes to all, this may not always be applied first, + //so it *may* override changes to the same properties for configurations defines at the project level + { + foreach(ConfigurationNode confNode in m_Configurations.Values) + { + conf.CopyTo(confNode);//update the config templates defines at the project level with the overrides + } + } + if(m_Configurations.ContainsKey(conf.NameAndPlatform)) + { + ConfigurationNode parentConf = m_Configurations[conf.NameAndPlatform]; + conf.CopyTo(parentConf);//update the config templates defines at the project level with the overrides + } + else + { + m_Configurations[conf.NameAndPlatform] = conf; + } + } + + #endregion + + #region Public Methods + + /// + /// Parses the specified node. + /// + /// The node. + public override void Parse(XmlNode node) + { + m_Name = Helper.AttributeValue(node, "name", m_Name); + m_Path = Helper.AttributeValue(node, "path", m_Path); + m_FilterGroups = Helper.AttributeValue(node, "filterGroups", m_FilterGroups); + m_Version = Helper.AttributeValue(node, "version", m_Version); + m_AppIcon = Helper.AttributeValue(node, "icon", m_AppIcon); + m_ConfigFile = Helper.AttributeValue(node, "configFile", m_ConfigFile); + m_DesignerFolder = Helper.AttributeValue(node, "designerFolder", m_DesignerFolder); + m_AssemblyName = Helper.AttributeValue(node, "assemblyName", m_AssemblyName); + m_Language = Helper.AttributeValue(node, "language", m_Language); + m_Type = (ProjectType)Helper.EnumAttributeValue(node, "type", typeof(ProjectType), m_Type); + m_Runtime = (ClrRuntime)Helper.EnumAttributeValue(node, "runtime", typeof(ClrRuntime), m_Runtime); + m_Framework = (FrameworkVersion)Helper.EnumAttributeValue(node, "frameworkVersion", typeof(FrameworkVersion), m_Framework); + m_StartupObject = Helper.AttributeValue(node, "startupObject", m_StartupObject); + m_RootNamespace = Helper.AttributeValue(node, "rootNamespace", m_RootNamespace); + + int hash = m_Name.GetHashCode(); + Guid guidByHash = new Guid(hash, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); + string guid = Helper.AttributeValue(node, "guid", guidByHash.ToString()); + m_Guid = new Guid(guid); + + m_GenerateAssemblyInfoFile = Helper.ParseBoolean(node, "generateAssemblyInfoFile", false); + m_DebugStartParameters = Helper.AttributeValue(node, "debugStartParameters", string.Empty); + + if(string.IsNullOrEmpty(m_AssemblyName)) + { + m_AssemblyName = m_Name; + } + + if(string.IsNullOrEmpty(m_RootNamespace)) + { + m_RootNamespace = m_Name; + } + + m_FullPath = m_Path; + try + { + m_FullPath = Helper.ResolvePath(m_FullPath); + } + catch + { + throw new WarningException("Could not resolve Solution path: {0}", m_Path); + } + + Kernel.Instance.CurrentWorkingDirectory.Push(); + try + { + Helper.SetCurrentDir(m_FullPath); + + if( node == null ) + { + throw new ArgumentNullException("node"); + } + + foreach(XmlNode child in node.ChildNodes) + { + IDataNode dataNode = Kernel.Instance.ParseNode(child, this); + if(dataNode is ConfigurationNode) + { + HandleConfiguration((ConfigurationNode)dataNode); + } + else if(dataNode is ReferencePathNode) + { + m_ReferencePaths.Add((ReferencePathNode)dataNode); + } + else if(dataNode is ReferenceNode) + { + m_References.Add((ReferenceNode)dataNode); + } + else if(dataNode is AuthorNode) + { + m_Authors.Add((AuthorNode)dataNode); + } + else if(dataNode is FilesNode) + { + m_Files = (FilesNode)dataNode; + } + } + } + finally + { + Kernel.Instance.CurrentWorkingDirectory.Pop(); + } + } + + #endregion + + #region IComparable Members + + public int CompareTo(object obj) + { + ProjectNode that = (ProjectNode)obj; + return m_Name.CompareTo(that.m_Name); + } + + #endregion + } +} -- cgit v1.1