From dd9640cda82bca8125289f292238ea6b447cc6e9 Mon Sep 17 00:00:00 2001 From: lbsa71 Date: Thu, 19 Feb 2009 12:48:38 +0000 Subject: === PREBUILD UPSTREAMS UPDATE : POTENTIAL BREAKAGE === * Applied upstreams changes to allow for auditing and debugging in our various environments. * This should, in theory, bring back 'multiple ref dirs'. * Temporarily Removed xmlns because prebuild-1.7 schema does not allow for multiple solutions per prebuild node (This will be a moot issue once the Prebuild node is moved out of prebuild.xml) * Autotools target: Various minor fixes * MonoDevelop Target : No changes. * Nant Target: Various minor fixes, support for net-3.5 and mono-2.0/3.5 targets * Sharpdevelop targets: No changes. * VS Targets: Refactored into using VSGenericTarget, and supports 2.0-3.5 * XCode Target: No changes. --- Regressions and outstanding issues --- * The Solution is assigned a random Guid - will lead to unnecessary reloads and loss of user settings. --- New features of Prebuild 2.0.4 --- * (Better) support for Web, WinForms and Database Projects and build actions * Conditional Framework Version compilation support (1.1, 2.0-3.5) * ArrayList -> List<>, ICollection -> IList (this means Prebuild can generate 1.1 solutions, but can't itself be built under 1.1 - how very meta) * Added preprocessor directive. --- Prebuild/src/Core/Nodes/AuthorNode.cs | 9 -- Prebuild/src/Core/Nodes/ConfigurationNode.cs | 9 -- Prebuild/src/Core/Nodes/DataNode.cs | 59 ++++++-- Prebuild/src/Core/Nodes/DatabaseProjectNode.cs | 94 +++++++++++++ Prebuild/src/Core/Nodes/DatabaseReferenceNode.cs | 63 +++++++++ Prebuild/src/Core/Nodes/DescriptionNode.cs | 9 -- Prebuild/src/Core/Nodes/ExcludeNode.cs | 9 -- Prebuild/src/Core/Nodes/FileNode.cs | 42 +++--- Prebuild/src/Core/Nodes/FilesNode.cs | 14 +- Prebuild/src/Core/Nodes/MatchNode.cs | 51 +++---- Prebuild/src/Core/Nodes/OptionsNode.cs | 11 -- Prebuild/src/Core/Nodes/ProcessNode.cs | 9 -- Prebuild/src/Core/Nodes/ProjectNode.cs | 169 +++++++++++++---------- Prebuild/src/Core/Nodes/ReferenceNode.cs | 9 -- Prebuild/src/Core/Nodes/ReferencePathNode.cs | 9 -- Prebuild/src/Core/Nodes/SolutionNode.cs | 120 +++++++++++----- 16 files changed, 432 insertions(+), 254 deletions(-) create mode 100644 Prebuild/src/Core/Nodes/DatabaseProjectNode.cs create mode 100644 Prebuild/src/Core/Nodes/DatabaseReferenceNode.cs (limited to 'Prebuild/src/Core/Nodes') diff --git a/Prebuild/src/Core/Nodes/AuthorNode.cs b/Prebuild/src/Core/Nodes/AuthorNode.cs index 03ea934..20e72c0 100644 --- a/Prebuild/src/Core/Nodes/AuthorNode.cs +++ b/Prebuild/src/Core/Nodes/AuthorNode.cs @@ -23,15 +23,6 @@ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY O */ #endregion -#region CVS Information -/* - * $Source $ - * $Author: $ - * $Date: $ - * $Revision: $ - */ -#endregion - using System; using System.Collections; using System.Collections.Specialized; diff --git a/Prebuild/src/Core/Nodes/ConfigurationNode.cs b/Prebuild/src/Core/Nodes/ConfigurationNode.cs index 828bff6..67d78d5 100644 --- a/Prebuild/src/Core/Nodes/ConfigurationNode.cs +++ b/Prebuild/src/Core/Nodes/ConfigurationNode.cs @@ -23,15 +23,6 @@ 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 System.Xml; diff --git a/Prebuild/src/Core/Nodes/DataNode.cs b/Prebuild/src/Core/Nodes/DataNode.cs index 60ed122..763e6c3 100644 --- a/Prebuild/src/Core/Nodes/DataNode.cs +++ b/Prebuild/src/Core/Nodes/DataNode.cs @@ -23,31 +23,24 @@ 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 System.Xml; using Prebuild.Core.Attributes; using Prebuild.Core.Interfaces; +using System.IO; namespace Prebuild.Core.Nodes { /// /// /// - public class DataNode : IDataNode + public abstract class DataNode : IDataNode { #region Fields private IDataNode parent; + string[] m_WebTypes = new string[] { "aspx", "ascx", "master", "ashx", "asmx" }; #endregion @@ -68,7 +61,10 @@ namespace Prebuild.Core.Nodes parent = value; } } - + public string[] WebTypes + { + get { return m_WebTypes; } + } /// /// Parses the specified node. /// @@ -76,7 +72,46 @@ namespace Prebuild.Core.Nodes public virtual void Parse(XmlNode node) { } - + public BuildAction GetBuildActionByFileName(string fileName) + { + string extension = Path.GetExtension(fileName).ToLower(); + foreach (string type in WebTypes) + { + if (extension == type) + return BuildAction.Content; + } + return BuildAction.Compile; + } + /// + /// Parses the file type to figure out what type it is + /// + /// + public SubType GetSubTypeByFileName(string fileName) + { + string extension = System.IO.Path.GetExtension(fileName).ToLower(); + string designer = String.Format(".designer{0}", extension); + string path = fileName.ToLower(); + if (extension == ".resx") + { + return SubType.Designer; + } + else if (path.EndsWith(".settings")) + { + return SubType.Settings; + } + else + { + + foreach (string type in WebTypes) + { + if (path.EndsWith(string.Format("{0}{1}", type, extension))) + { + return SubType.CodeBehind; + } + } + } + return SubType.Code; + } #endregion } } diff --git a/Prebuild/src/Core/Nodes/DatabaseProjectNode.cs b/Prebuild/src/Core/Nodes/DatabaseProjectNode.cs new file mode 100644 index 0000000..8696a79 --- /dev/null +++ b/Prebuild/src/Core/Nodes/DatabaseProjectNode.cs @@ -0,0 +1,94 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Text; +using System.Xml; + +using Prebuild.Core.Attributes; +using Prebuild.Core.Interfaces; +using Prebuild.Core.Utilities; + +namespace Prebuild.Core.Nodes +{ + [DataNode("DatabaseProject")] + public class DatabaseProjectNode : DataNode + { + string name; + string path; + string fullpath; + Guid guid = Guid.NewGuid(); + readonly List authors = new List(); + readonly List references = new List(); + + public Guid Guid + { + get { return guid; } + } + + public string Name + { + get { return name; } + } + + public string Path + { + get { return path; } + } + + public string FullPath + { + get { return fullpath; } + } + + public IEnumerable References + { + get { return references; } + } + + public override void Parse(XmlNode node) + { + name = Helper.AttributeValue(node, "name", name); + path = Helper.AttributeValue(node, "path", name); + + try + { + fullpath = Helper.ResolvePath(path); + } + catch + { + throw new WarningException("Could not resolve Solution path: {0}", path); + } + + Kernel.Instance.CurrentWorkingDirectory.Push(); + + try + { + Helper.SetCurrentDir(fullpath); + + if (node == null) + { + throw new ArgumentNullException("node"); + } + + foreach (XmlNode child in node.ChildNodes) + { + IDataNode dataNode = Kernel.Instance.ParseNode(child, this); + + if (dataNode == null) + continue; + + if (dataNode is AuthorNode) + authors.Add((AuthorNode)dataNode); + else if (dataNode is DatabaseReferenceNode) + references.Add((DatabaseReferenceNode)dataNode); + } + } + finally + { + Kernel.Instance.CurrentWorkingDirectory.Pop(); + } + + base.Parse(node); + } + } +} diff --git a/Prebuild/src/Core/Nodes/DatabaseReferenceNode.cs b/Prebuild/src/Core/Nodes/DatabaseReferenceNode.cs new file mode 100644 index 0000000..97c3964 --- /dev/null +++ b/Prebuild/src/Core/Nodes/DatabaseReferenceNode.cs @@ -0,0 +1,63 @@ +using System; +using Prebuild.Core.Attributes; +using Prebuild.Core.Utilities; + +namespace Prebuild.Core.Nodes +{ + [DataNode("DatabaseReference")] + public class DatabaseReferenceNode : DataNode + { + string name; + Guid providerId; + string connectionString; + + public string Name + { + get { return name; } + } + + public Guid ProviderId + { + get { return providerId; } + } + + public string ConnectionString + { + get { return connectionString; } + } + + public override void Parse(System.Xml.XmlNode node) + { + name = Helper.AttributeValue(node, "name", name); + + string providerName = Helper.AttributeValue(node, "providerName", string.Empty); + if (providerName != null) + { + switch (providerName) + { + // digitaljeebus: pulled from HKLM\SOFTWARE\Microsoft\VisualStudio\9.0\DataProviders\* + // Not sure if these will help other operating systems, or if there's a better way. + case "Microsoft.SqlServerCe.Client.3.5": + providerId = new Guid("7C602B5B-ACCB-4acd-9DC0-CA66388C1533"); break; + case "System.Data.OleDb": + providerId = new Guid("7F041D59-D76A-44ed-9AA2-FBF6B0548B80"); break; + case "System.Data.OracleClient": + providerId = new Guid("8F5C5018-AE09-42cf-B2CC-2CCCC7CFC2BB"); break; + case "System.Data.SqlClient": + providerId = new Guid("91510608-8809-4020-8897-FBA057E22D54"); break; + case "System.Data.Odbc": + providerId = new Guid("C3D4F4CE-2C48-4381-B4D6-34FA50C51C86"); break; + + default: + throw new ArgumentOutOfRangeException("providerName", providerName, "Could not provider name to an id."); + } + } + else + providerId = new Guid(Helper.AttributeValue(node, "providerId", Guid.Empty.ToString("B"))); + + connectionString = Helper.AttributeValue(node, "connectionString", connectionString); + + base.Parse(node); + } + } +} diff --git a/Prebuild/src/Core/Nodes/DescriptionNode.cs b/Prebuild/src/Core/Nodes/DescriptionNode.cs index cff7afc..353a5ae 100644 --- a/Prebuild/src/Core/Nodes/DescriptionNode.cs +++ b/Prebuild/src/Core/Nodes/DescriptionNode.cs @@ -23,15 +23,6 @@ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY O */ #endregion -#region CVS Information -/* - * $Source $ - * $Author: $ - * $Date: $ - * $Revision: $ - */ -#endregion - using System; using System.Collections; using System.Collections.Specialized; diff --git a/Prebuild/src/Core/Nodes/ExcludeNode.cs b/Prebuild/src/Core/Nodes/ExcludeNode.cs index afc869d..7f04cba 100644 --- a/Prebuild/src/Core/Nodes/ExcludeNode.cs +++ b/Prebuild/src/Core/Nodes/ExcludeNode.cs @@ -23,15 +23,6 @@ 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.Xml; diff --git a/Prebuild/src/Core/Nodes/FileNode.cs b/Prebuild/src/Core/Nodes/FileNode.cs index 083dba5..1520fcb 100644 --- a/Prebuild/src/Core/Nodes/FileNode.cs +++ b/Prebuild/src/Core/Nodes/FileNode.cs @@ -23,15 +23,6 @@ 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.IO; using System.Xml; @@ -39,6 +30,7 @@ using System.Xml; using Prebuild.Core.Attributes; using Prebuild.Core.Interfaces; using Prebuild.Core.Utilities; +using Prebuild.Core.Targets; namespace Prebuild.Core.Nodes { @@ -93,7 +85,11 @@ namespace Prebuild.Core.Nodes /// /// /// - UserControl + UserControl, + /// + /// + /// + CodeBehind, } public enum CopyToOutput @@ -113,9 +109,9 @@ namespace Prebuild.Core.Nodes private string m_Path; private string m_ResourceName = ""; - private BuildAction m_BuildAction = BuildAction.Compile; + private BuildAction? m_BuildAction; private bool m_Valid; - private SubType m_SubType = SubType.Code; + private SubType? m_SubType; private CopyToOutput m_CopyToOutput = CopyToOutput.Never; private bool m_Link = false; private string m_LinkPath = string.Empty; @@ -155,7 +151,11 @@ namespace Prebuild.Core.Nodes { get { - return m_BuildAction; + if (m_BuildAction != null) + return m_BuildAction.Value; + else + return GetBuildActionByFileName(this.Path); + } } @@ -189,7 +189,10 @@ namespace Prebuild.Core.Nodes { get { - return m_SubType; + if (m_SubType != null) + return m_SubType.Value; + else + return GetSubTypeByFileName(this.Path); } } @@ -227,10 +230,13 @@ namespace Prebuild.Core.Nodes /// public override void Parse(XmlNode node) { - m_BuildAction = (BuildAction)Enum.Parse(typeof(BuildAction), - Helper.AttributeValue(node, "buildAction", m_BuildAction.ToString())); - m_SubType = (SubType)Enum.Parse(typeof(SubType), - Helper.AttributeValue(node, "subType", m_SubType.ToString())); + string buildAction = Helper.AttributeValue(node, "buildAction", String.Empty); + if (buildAction != string.Empty) + m_BuildAction = (BuildAction)Enum.Parse(typeof(BuildAction), buildAction); + string subType = Helper.AttributeValue(node, "subType", string.Empty); + if (subType != String.Empty) + m_SubType = (SubType)Enum.Parse(typeof(SubType), subType); + m_ResourceName = Helper.AttributeValue(node, "resourceName", m_ResourceName.ToString()); this.m_Link = bool.Parse(Helper.AttributeValue(node, "link", bool.FalseString)); if ( this.m_Link == true ) diff --git a/Prebuild/src/Core/Nodes/FilesNode.cs b/Prebuild/src/Core/Nodes/FilesNode.cs index 7c1dd19..dc306c2 100644 --- a/Prebuild/src/Core/Nodes/FilesNode.cs +++ b/Prebuild/src/Core/Nodes/FilesNode.cs @@ -23,15 +23,6 @@ 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,6 +30,7 @@ using System.Xml; using Prebuild.Core.Attributes; using Prebuild.Core.Interfaces; +using System.IO; namespace Prebuild.Core.Nodes { @@ -224,8 +216,8 @@ namespace Prebuild.Core.Nodes if (!m_Files.Contains(file)) { m_Files.Add(file); - m_BuildActions[ file ] = matchNode.BuildAction; - m_SubTypes[ file ] = matchNode.SubType; + m_BuildActions[ file ] = matchNode.BuildAction == null ? GetBuildActionByFileName(file) : matchNode.BuildAction; + m_SubTypes[file] = matchNode.SubType == null ? GetSubTypeByFileName(file) : matchNode.SubType.Value; m_ResourceNames[ file ] = matchNode.ResourceName; this.m_PreservePaths[ file ] = matchNode.PreservePath; this.m_Links[ file ] = matchNode.IsLink; diff --git a/Prebuild/src/Core/Nodes/MatchNode.cs b/Prebuild/src/Core/Nodes/MatchNode.cs index aeaf3c1..656d7d0 100644 --- a/Prebuild/src/Core/Nodes/MatchNode.cs +++ b/Prebuild/src/Core/Nodes/MatchNode.cs @@ -23,16 +23,8 @@ 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.Generic; using System.Collections.Specialized; using System.IO; using System.Text.RegularExpressions; @@ -53,29 +45,16 @@ namespace Prebuild.Core.Nodes { #region Fields - private StringCollection m_Files; + private readonly StringCollection m_Files = new StringCollection(); private Regex m_Regex; - private BuildAction m_BuildAction = BuildAction.Compile; - private SubType m_SubType = SubType.Code; + private BuildAction? m_BuildAction; + private SubType? m_SubType; string m_ResourceName = ""; private CopyToOutput m_CopyToOutput; private bool m_Link; private string m_LinkPath; private bool m_PreservePath; - private ArrayList m_Exclusions; - - #endregion - - #region Constructors - - /// - /// - /// - public MatchNode() - { - m_Files = new StringCollection(); - m_Exclusions = new ArrayList(); - } + private readonly List m_Exclusions = new List(); #endregion @@ -95,7 +74,7 @@ namespace Prebuild.Core.Nodes /// /// /// - public BuildAction BuildAction + public BuildAction? BuildAction { get { @@ -106,7 +85,7 @@ namespace Prebuild.Core.Nodes /// /// /// - public SubType SubType + public SubType? SubType { get { @@ -167,7 +146,7 @@ namespace Prebuild.Core.Nodes /// The pattern. /// if set to true [recurse]. /// if set to true [use regex]. - private void RecurseDirectories(string path, string pattern, bool recurse, bool useRegex, ArrayList exclusions) + private void RecurseDirectories(string path, string pattern, bool recurse, bool useRegex, List exclusions) { Match match; Boolean excludeFile; @@ -279,10 +258,14 @@ namespace Prebuild.Core.Nodes string pattern = Helper.AttributeValue(node, "pattern", "*"); bool recurse = (bool)Helper.TranslateValue(typeof(bool), Helper.AttributeValue(node, "recurse", "false")); bool useRegex = (bool)Helper.TranslateValue(typeof(bool), Helper.AttributeValue(node, "useRegex", "false")); - m_BuildAction = (BuildAction)Enum.Parse(typeof(BuildAction), - Helper.AttributeValue(node, "buildAction", m_BuildAction.ToString())); - m_SubType = (SubType)Enum.Parse(typeof(SubType), - Helper.AttributeValue(node, "subType", m_SubType.ToString())); + string buildAction = Helper.AttributeValue(node, "buildAction", String.Empty); + if (buildAction != string.Empty) + m_BuildAction = (BuildAction)Enum.Parse(typeof(BuildAction), buildAction); + + //TODO: Figure out where the subtype node is being assigned + //string subType = Helper.AttributeValue(node, "subType", string.Empty); + //if (subType != String.Empty) + // m_SubType = (SubType)Enum.Parse(typeof(SubType), subType); m_ResourceName = Helper.AttributeValue(node, "resourceName", m_ResourceName.ToString()); this.m_CopyToOutput = (CopyToOutput) Enum.Parse(typeof(CopyToOutput), Helper.AttributeValue(node, "copyToOutput", this.m_CopyToOutput.ToString())); this.m_Link = bool.Parse(Helper.AttributeValue(node, "link", bool.FalseString)); @@ -329,7 +312,7 @@ namespace Prebuild.Core.Nodes if(dataNode is ExcludeNode) { ExcludeNode excludeNode = (ExcludeNode)dataNode; - m_Exclusions.Add( dataNode ); + m_Exclusions.Add( excludeNode ); } } diff --git a/Prebuild/src/Core/Nodes/OptionsNode.cs b/Prebuild/src/Core/Nodes/OptionsNode.cs index 651c339..b63034b 100644 --- a/Prebuild/src/Core/Nodes/OptionsNode.cs +++ b/Prebuild/src/Core/Nodes/OptionsNode.cs @@ -23,17 +23,6 @@ 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-01-09 01:55:40 +0900 (Tue, 09 Jan 2007) $ - * $Revision: 197 $ - */ -#endregion - - - using System; using System.Collections; using System.Collections.Specialized; diff --git a/Prebuild/src/Core/Nodes/ProcessNode.cs b/Prebuild/src/Core/Nodes/ProcessNode.cs index 2d2162c..6bfbe16 100644 --- a/Prebuild/src/Core/Nodes/ProcessNode.cs +++ b/Prebuild/src/Core/Nodes/ProcessNode.cs @@ -23,15 +23,6 @@ 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 System.Collections; using System.Collections.Specialized; diff --git a/Prebuild/src/Core/Nodes/ProjectNode.cs b/Prebuild/src/Core/Nodes/ProjectNode.cs index e98ab5f..0a24abf 100644 --- a/Prebuild/src/Core/Nodes/ProjectNode.cs +++ b/Prebuild/src/Core/Nodes/ProjectNode.cs @@ -23,17 +23,9 @@ 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-05-26 06:58:26 +0900 (Sat, 26 May 2007) $ - * $Revision: 244 $ - */ -#endregion - using System; using System.Collections; +using System.Collections.Generic; using System.IO; using System.Xml; @@ -59,7 +51,11 @@ namespace Prebuild.Core.Nodes /// /// The project is a library /// - Library + Library, + /// + /// The project is a website + /// + Web, } /// @@ -76,7 +72,25 @@ namespace Prebuild.Core.Nodes /// 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, + } /// /// The Node object representing /Prebuild/Solution/Project elements /// @@ -95,35 +109,22 @@ namespace Prebuild.Core.Nodes 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 Hashtable m_Configurations; - private ArrayList m_ReferencePaths; - private ArrayList m_References; - private ArrayList m_Authors; + private Hashtable m_Configurations = new Hashtable(); + 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 Constructors - - /// - /// Initializes a new instance of the class. - /// - public ProjectNode() - { - m_Configurations = new Hashtable(); - m_ReferencePaths = new ArrayList(); - m_References = new ArrayList(); - m_Authors = new ArrayList(); - } - - #endregion - #region Properties /// @@ -134,10 +135,19 @@ namespace Prebuild.Core.Nodes { get { - return m_Name; + return m_Name; + } + } + /// + /// The version of the .NET Framework to compile under + /// + public FrameworkVersion FrameworkVersion + { + get + { + return this.m_Framework; } } - /// /// Gets the path. /// @@ -210,17 +220,17 @@ namespace Prebuild.Core.Nodes } } - /// - /// Gets the app icon. - /// - /// The app icon. - public string ConfigFile - { - get - { - return m_ConfigFile; - } - } + /// + /// Gets the app icon. + /// + /// The app icon. + public string ConfigFile + { + get + { + return m_ConfigFile; + } + } /// /// @@ -269,22 +279,22 @@ namespace Prebuild.Core.Nodes } } - private bool m_GenerateAssemblyInfoFile = false; - - /// - /// - /// - public bool GenerateAssemblyInfoFile - { - get - { - return m_GenerateAssemblyInfoFile; - } - set - { - m_GenerateAssemblyInfoFile = value; - } - } + private bool m_GenerateAssemblyInfoFile = false; + + /// + /// + /// + public bool GenerateAssemblyInfoFile + { + get + { + return m_GenerateAssemblyInfoFile; + } + set + { + m_GenerateAssemblyInfoFile = value; + } + } /// /// Gets the startup object. @@ -314,7 +324,7 @@ namespace Prebuild.Core.Nodes /// Gets the configurations. /// /// The configurations. - public ICollection Configurations + public IList Configurations { get { @@ -340,11 +350,11 @@ namespace Prebuild.Core.Nodes /// Gets the reference paths. /// /// The reference paths. - public ArrayList ReferencePaths + public List ReferencePaths { get { - ArrayList tmp = new ArrayList(m_ReferencePaths); + List tmp = new List(m_ReferencePaths); tmp.Sort(); return tmp; } @@ -354,11 +364,11 @@ namespace Prebuild.Core.Nodes /// Gets the references. /// /// The references. - public ArrayList References + public List References { get { - ArrayList tmp = new ArrayList(m_References); + List tmp = new List(m_References); tmp.Sort(); return tmp; } @@ -368,7 +378,7 @@ namespace Prebuild.Core.Nodes /// Gets the Authors list. /// /// The list of the project's authors. - public ArrayList Authors + public List Authors { get { @@ -424,7 +434,15 @@ namespace Prebuild.Core.Nodes } } - #endregion + public string DebugStartParameters + { + get + { + return m_DebugStartParameters; + } + } + + #endregion #region Private Methods @@ -470,13 +488,18 @@ namespace Prebuild.Core.Nodes 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); - m_GenerateAssemblyInfoFile = Helper.ParseBoolean(node, "generateAssemblyInfoFile", false); - + int hash = m_Name.GetHashCode(); - m_Guid = new Guid(hash, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); + 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(m_AssemblyName == null || m_AssemblyName.Length < 1) { m_AssemblyName = m_Name; @@ -516,15 +539,15 @@ namespace Prebuild.Core.Nodes } else if(dataNode is ReferencePathNode) { - m_ReferencePaths.Add(dataNode); + m_ReferencePaths.Add((ReferencePathNode)dataNode); } else if(dataNode is ReferenceNode) { - m_References.Add(dataNode); + m_References.Add((ReferenceNode)dataNode); } else if(dataNode is AuthorNode) { - m_Authors.Add(dataNode); + m_Authors.Add((AuthorNode)dataNode); } else if(dataNode is FilesNode) { @@ -548,6 +571,6 @@ namespace Prebuild.Core.Nodes return this.m_Name.CompareTo(that.m_Name); } - #endregion + #endregion } } diff --git a/Prebuild/src/Core/Nodes/ReferenceNode.cs b/Prebuild/src/Core/Nodes/ReferenceNode.cs index df0c2e4..9c5d1a3 100644 --- a/Prebuild/src/Core/Nodes/ReferenceNode.cs +++ b/Prebuild/src/Core/Nodes/ReferenceNode.cs @@ -23,15 +23,6 @@ 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-07-26 01:56:49 +0900 (Wed, 26 Jul 2006) $ - * $Revision: 132 $ - */ -#endregion - using System; using System.Xml; diff --git a/Prebuild/src/Core/Nodes/ReferencePathNode.cs b/Prebuild/src/Core/Nodes/ReferencePathNode.cs index d4042ef..f0543c2 100644 --- a/Prebuild/src/Core/Nodes/ReferencePathNode.cs +++ b/Prebuild/src/Core/Nodes/ReferencePathNode.cs @@ -23,15 +23,6 @@ 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 System.Collections; using System.Collections.Specialized; diff --git a/Prebuild/src/Core/Nodes/SolutionNode.cs b/Prebuild/src/Core/Nodes/SolutionNode.cs index 9473fe6..2a1b8e2 100644 --- a/Prebuild/src/Core/Nodes/SolutionNode.cs +++ b/Prebuild/src/Core/Nodes/SolutionNode.cs @@ -23,17 +23,9 @@ 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-03-01 01:15:42 +0900 (Wed, 01 Mar 2006) $ - * $Revision: 92 $ - */ -#endregion - using System; using System.Collections; +using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Xml; @@ -48,40 +40,62 @@ namespace Prebuild.Core.Nodes /// /// [DataNode("Solution")] + [DataNode("EmbeddedSolution")] + [DebuggerDisplay("{Name}")] public class SolutionNode : DataNode { #region Fields - + + private Guid m_Guid = Guid.NewGuid(); private string m_Name = "unknown"; private string m_Path = ""; private string m_FullPath = ""; private string m_ActiveConfig = "Debug"; private string m_Version = "1.0.0"; - + private OptionsNode m_Options; private FilesNode m_Files; - private Hashtable m_Configurations; - private Hashtable m_Projects; - private ArrayList m_ProjectsOrder; - - #endregion - - #region Constructors - - /// - /// Initializes a new instance of the class. - /// - public SolutionNode() - { - m_Configurations = new Hashtable(); - m_Projects = new Hashtable(); - m_ProjectsOrder = new ArrayList(); - } + private readonly Hashtable m_Configurations = new Hashtable(); + private readonly Hashtable m_Projects = new Hashtable(); + private readonly Hashtable m_DatabaseProjects = new Hashtable(); + private readonly List m_ProjectsOrder = new List(); + private readonly Hashtable m_Solutions = new Hashtable(); #endregion #region Properties - + public override IDataNode Parent + { + get + { + return base.Parent; + } + set + { + if (value is SolutionNode) + { + SolutionNode solution = (SolutionNode)value; + foreach (ConfigurationNode conf in solution.Configurations) + { + m_Configurations[conf.Name] = conf.Clone(); + } + } + + base.Parent = value; + } + } + + public Guid Guid + { + get + { + return m_Guid; + } + set + { + m_Guid = value; + } + } /// /// Gets or sets the active config. /// @@ -195,7 +209,36 @@ namespace Prebuild.Core.Nodes return m_Configurations; } } - + /// + /// Gets the database projects. + /// + public ICollection DatabaseProjects + { + get + { + return m_DatabaseProjects.Values; + } + } + /// + /// Gets the nested solutions. + /// + public ICollection Solutions + { + get + { + return m_Solutions.Values; + } + } + /// + /// Gets the nested solutions hash table. + /// + public Hashtable SolutionsTable + { + get + { + return this.m_Solutions; + } + } /// /// Gets the projects. /// @@ -226,7 +269,7 @@ namespace Prebuild.Core.Nodes /// Gets the projects table. /// /// The projects table. - public ArrayList ProjectsTableOrder + public List ProjectsTableOrder { get { @@ -287,8 +330,21 @@ namespace Prebuild.Core.Nodes else if(dataNode is ProjectNode) { m_Projects[((ProjectNode)dataNode).Name] = dataNode; - m_ProjectsOrder.Add(dataNode); + m_ProjectsOrder.Add((ProjectNode)dataNode); } + else if(dataNode is SolutionNode) + { + m_Solutions[((SolutionNode)dataNode).Name] = dataNode; + } + else if (dataNode is ProcessNode) + { + ProcessNode p = (ProcessNode)dataNode; + Kernel.Instance.ProcessFile(p, this); + } + else if (dataNode is DatabaseProjectNode) + { + m_DatabaseProjects[((DatabaseProjectNode)dataNode).Name] = dataNode; + } } } finally -- cgit v1.1