normalize tab as 4spaces

This commit is contained in:
UbitUmarov
2022-02-26 13:22:42 +00:00
parent ad220821c5
commit bd3db9eeeb
50 changed files with 8309 additions and 8277 deletions
@@ -28,45 +28,45 @@ using System.Collections.Specialized;
namespace Prebuild.Core.Attributes
{
/// <summary>
///
/// </summary>
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct, AllowMultiple=true)]
public sealed class DataNodeAttribute : Attribute
{
#region Fields
/// <summary>
///
/// </summary>
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct, AllowMultiple = true)]
public sealed class DataNodeAttribute : Attribute
{
#region Fields
private string m_Name = "unknown";
private string m_Name = "unknown";
#endregion
#endregion
#region Constructors
#region Constructors
/// <summary>
/// Initializes a new instance of the <see cref="DataNodeAttribute"/> class.
/// </summary>
/// <param name="name">The name.</param>
public DataNodeAttribute(string name)
{
m_Name = name;
}
/// <summary>
/// Initializes a new instance of the <see cref="DataNodeAttribute"/> class.
/// </summary>
/// <param name="name">The name.</param>
public DataNodeAttribute(string name)
{
m_Name = name;
}
#endregion
#endregion
#region Properties
#region Properties
/// <summary>
/// Gets the name.
/// </summary>
/// <value>The name.</value>
public string Name
{
get
{
return m_Name;
}
}
/// <summary>
/// Gets the name.
/// </summary>
/// <value>The name.</value>
public string Name
{
get
{
return m_Name;
}
}
#endregion
}
#endregion
}
}
@@ -27,45 +27,45 @@ using System;
namespace Prebuild.Core.Attributes
{
/// <summary>
///
/// </summary>
[AttributeUsage(AttributeTargets.Field)]
public sealed class OptionNodeAttribute : Attribute
{
#region Fields
/// <summary>
///
/// </summary>
[AttributeUsage(AttributeTargets.Field)]
public sealed class OptionNodeAttribute : Attribute
{
#region Fields
private string m_NodeName;
private string m_NodeName;
#endregion
#endregion
#region Constructors
#region Constructors
/// <summary>
/// Initializes a new instance of the <see cref="OptionNodeAttribute"/> class.
/// </summary>
/// <param name="nodeName">Name of the node.</param>
public OptionNodeAttribute(string nodeName)
{
m_NodeName = nodeName;
}
/// <summary>
/// Initializes a new instance of the <see cref="OptionNodeAttribute"/> class.
/// </summary>
/// <param name="nodeName">Name of the node.</param>
public OptionNodeAttribute(string nodeName)
{
m_NodeName = nodeName;
}
#endregion
#endregion
#region Properties
#region Properties
/// <summary>
/// Gets the name of the node.
/// </summary>
/// <value>The name of the node.</value>
public string NodeName
{
get
{
return m_NodeName;
}
}
/// <summary>
/// Gets the name of the node.
/// </summary>
/// <value>The name of the node.</value>
public string NodeName
{
get
{
return m_NodeName;
}
}
#endregion
}
#endregion
}
}
+33 -33
View File
@@ -27,45 +27,45 @@ using System;
namespace Prebuild.Core.Attributes
{
/// <summary>
///
/// </summary>
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct)]
public sealed class TargetAttribute : Attribute
{
#region Fields
/// <summary>
///
/// </summary>
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct)]
public sealed class TargetAttribute : Attribute
{
#region Fields
private string m_Name;
private string m_Name;
#endregion
#endregion
#region Constructors
#region Constructors
/// <summary>
/// Initializes a new instance of the <see cref="TargetAttribute"/> class.
/// </summary>
/// <param name="name">The name.</param>
public TargetAttribute(string name)
{
m_Name = name;
}
/// <summary>
/// Initializes a new instance of the <see cref="TargetAttribute"/> class.
/// </summary>
/// <param name="name">The name.</param>
public TargetAttribute(string name)
{
m_Name = name;
}
#endregion
#endregion
#region Properties
#region Properties
/// <summary>
/// Gets the name.
/// </summary>
/// <value>The name.</value>
public string Name
{
get
{
return m_Name;
}
}
/// <summary>
/// Gets the name.
/// </summary>
/// <value>The name.</value>
public string Name
{
get
{
return m_Name;
}
}
#endregion
}
#endregion
}
}
+48 -48
View File
@@ -28,58 +28,58 @@ using System.Runtime.Serialization;
namespace Prebuild.Core
{
/// <summary>
///
/// </summary>
[Serializable()]
public class FatalException : Exception
{
#region Constructors
/// <summary>
///
/// </summary>
[Serializable()]
public class FatalException : Exception
{
#region Constructors
/// <summary>
/// Initializes a new instance of the <see cref="FatalException"/> class.
/// </summary>
public FatalException()
{
}
/// <summary>
/// Initializes a new instance of the <see cref="FatalException"/> class.
/// </summary>
/// <param name="format">The format.</param>
/// <param name="args">The args.</param>
public FatalException(string format, params object[] args)
: base(String.Format(format, args))
{
}
/// <summary>
/// Initializes a new instance of the <see cref="FatalException"/> class.
/// </summary>
public FatalException()
{
}
/// <summary>
/// Exception with specified string
/// </summary>
/// <param name="message">Exception message</param>
public FatalException(string message): base(message)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="FatalException"/> class.
/// </summary>
/// <param name="format">The format.</param>
/// <param name="args">The args.</param>
public FatalException(string format, params object[] args)
: base(String.Format(format, args))
{
}
/// <summary>
///
/// </summary>
/// <param name="message"></param>
/// <param name="exception"></param>
public FatalException(string message, Exception exception) : base(message, exception)
{
}
/// <summary>
/// Exception with specified string
/// </summary>
/// <param name="message">Exception message</param>
public FatalException(string message) : base(message)
{
}
/// <summary>
///
/// </summary>
/// <param name="info"></param>
/// <param name="context"></param>
protected FatalException(SerializationInfo info, StreamingContext context) : base( info, context )
{
}
/// <summary>
///
/// </summary>
/// <param name="message"></param>
/// <param name="exception"></param>
public FatalException(string message, Exception exception) : base(message, exception)
{
}
#endregion
}
/// <summary>
///
/// </summary>
/// <param name="info"></param>
/// <param name="context"></param>
protected FatalException(SerializationInfo info, StreamingContext context) : base(info, context)
{
}
#endregion
}
}
+17 -17
View File
@@ -26,22 +26,22 @@ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY O
using System;
using System.Xml;
namespace Prebuild.Core.Interfaces
namespace Prebuild.Core.Interfaces
{
/// <summary>
///
/// </summary>
public interface IDataNode
{
/// <summary>
/// Gets or sets the parent.
/// </summary>
/// <value>The parent.</value>
IDataNode Parent { get; set; }
/// <summary>
/// Parses the specified node.
/// </summary>
/// <param name="node">The node.</param>
void Parse(XmlNode node);
}
/// <summary>
///
/// </summary>
public interface IDataNode
{
/// <summary>
/// Gets or sets the parent.
/// </summary>
/// <value>The parent.</value>
IDataNode Parent { get; set; }
/// <summary>
/// Parses the specified node.
/// </summary>
/// <param name="node">The node.</param>
void Parse(XmlNode node);
}
}
+22 -22
View File
@@ -25,27 +25,27 @@ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY O
using System;
namespace Prebuild.Core.Interfaces
namespace Prebuild.Core.Interfaces
{
/// <summary>
///
/// </summary>
public interface ITarget
{
/// <summary>
/// Writes the specified kern.
/// </summary>
/// <param name="kern">The kern.</param>
void Write(Kernel kern);
/// <summary>
/// Cleans the specified kern.
/// </summary>
/// <param name="kern">The kern.</param>
void Clean(Kernel kern);
/// <summary>
/// Gets the name.
/// </summary>
/// <value>The name.</value>
string Name { get; }
}
/// <summary>
///
/// </summary>
public interface ITarget
{
/// <summary>
/// Writes the specified kern.
/// </summary>
/// <param name="kern">The kern.</param>
void Write(Kernel kern);
/// <summary>
/// Cleans the specified kern.
/// </summary>
/// <param name="kern">The kern.</param>
void Clean(Kernel kern);
/// <summary>
/// Gets the name.
/// </summary>
/// <value>The name.</value>
string Name { get; }
}
}
File diff suppressed because it is too large Load Diff
+42 -42
View File
@@ -32,56 +32,56 @@ using Prebuild.Core.Utilities;
namespace Prebuild.Core.Nodes
{
/// <summary>
///
/// </summary>
[DataNode("Author")]
public class AuthorNode : DataNode
{
#region Fields
/// <summary>
///
/// </summary>
[DataNode("Author")]
public class AuthorNode : DataNode
{
#region Fields
private string m_Signature;
private string m_Signature;
#endregion
#endregion
#region Properties
#region Properties
/// <summary>
/// Gets the signature.
/// </summary>
/// <value>The signature.</value>
public string Signature
{
get
{
return m_Signature;
}
}
/// <summary>
/// Gets the signature.
/// </summary>
/// <value>The signature.</value>
public string Signature
{
get
{
return m_Signature;
}
}
#endregion
#endregion
#region Public Methods
#region Public Methods
/// <summary>
/// Parses the specified node.
/// </summary>
/// <param name="node">The node.</param>
public override void Parse(XmlNode node)
{
if( node == null )
{
throw new ArgumentNullException("node");
}
/// <summary>
/// Parses the specified node.
/// </summary>
/// <param name="node">The node.</param>
public override void Parse(XmlNode node)
{
if (node == null)
{
throw new ArgumentNullException("node");
}
m_Signature = Helper.InterpolateForEnvironmentVariables(node.InnerText);
if(m_Signature == null)
{
m_Signature = "";
}
m_Signature = Helper.InterpolateForEnvironmentVariables(node.InnerText);
if (m_Signature == null)
{
m_Signature = "";
}
m_Signature = m_Signature.Trim();
}
m_Signature = m_Signature.Trim();
}
#endregion
}
#endregion
}
}
+28 -28
View File
@@ -35,40 +35,40 @@ namespace Prebuild.Core.Nodes
[DataNode("Cleanup")]
public class CleanupNode : DataNode
{
#region Fields
#region Fields
private List<CleanFilesNode> m_CleanFiles = new List<CleanFilesNode>();
private List<CleanFilesNode> m_CleanFiles = new List<CleanFilesNode>();
#endregion
#endregion
#region Properties
#region Properties
/// <summary>
/// Gets the signature.
/// </summary>
/// <value>The signature.</value>
/// <summary>
/// Gets the signature.
/// </summary>
/// <value>The signature.</value>
public List<CleanFilesNode> CleanFiles
{
get
{
return m_CleanFiles;
}
}
{
get
{
return m_CleanFiles;
}
}
#endregion
#endregion
#region Public Methods
#region Public Methods
/// <summary>
/// Parses the specified node.
/// </summary>
/// <param name="node">The node.</param>
public override void Parse(XmlNode node)
{
if( node == null )
{
throw new ArgumentNullException("node");
}
/// <summary>
/// Parses the specified node.
/// </summary>
/// <param name="node">The node.</param>
public override void Parse(XmlNode node)
{
if (node == null)
{
throw new ArgumentNullException("node");
}
foreach (XmlNode child in node.ChildNodes)
{
@@ -78,8 +78,8 @@ namespace Prebuild.Core.Nodes
m_CleanFiles.Add((CleanFilesNode)dataNode);
}
}
}
}
#endregion
#endregion
}
}
+157 -157
View File
@@ -32,194 +32,194 @@ using Prebuild.Core.Utilities;
namespace Prebuild.Core.Nodes
{
/// <summary>
///
/// </summary>
[DataNode("Configuration")]
public class ConfigurationNode : DataNode, ICloneable, IComparable
{
#region Fields
/// <summary>
///
/// </summary>
[DataNode("Configuration")]
public class ConfigurationNode : DataNode, ICloneable, IComparable
{
#region Fields
private string m_Name = "unknown";
private string m_Platform = "AnyCPU";
private OptionsNode m_Options;
private string m_Name = "unknown";
private string m_Platform = "AnyCPU";
private OptionsNode m_Options;
#endregion
#endregion
#region Constructors
#region Constructors
/// <summary>
/// Initializes a new instance of the <see cref="ConfigurationNode"/> class.
/// </summary>
public ConfigurationNode()
{
m_Options = new OptionsNode();
}
/// <summary>
/// Initializes a new instance of the <see cref="ConfigurationNode"/> class.
/// </summary>
public ConfigurationNode()
{
m_Options = new OptionsNode();
}
#endregion
#endregion
#region Properties
#region Properties
/// <summary>
/// Gets or sets the parent.
/// </summary>
/// <value>The parent.</value>
public override IDataNode Parent
{
get
{
return base.Parent;
}
set
{
base.Parent = value;
if(base.Parent is SolutionNode)
{
SolutionNode node = (SolutionNode)base.Parent;
if(node != null && node.Options != null)
{
node.Options.CopyTo(m_Options);
}
}
}
}
/// <summary>
/// Gets or sets the parent.
/// </summary>
/// <value>The parent.</value>
public override IDataNode Parent
{
get
{
return base.Parent;
}
set
{
base.Parent = value;
if (base.Parent is SolutionNode)
{
SolutionNode node = (SolutionNode)base.Parent;
if (node != null && node.Options != null)
{
node.Options.CopyTo(m_Options);
}
}
}
}
/// <summary>
/// Identifies the platform for this specific configuration.
/// </summary>
public string Platform
{
get
{
return m_Platform;
}
set
{
switch ((value + "").ToLower())
{
case "x86":
case "x64":
m_Platform = value;
break;
case "itanium":
m_Platform = "Itanium";
break;
default:
m_Platform = "AnyCPU";
break;
}
}
}
/// <summary>
/// Identifies the platform for this specific configuration.
/// </summary>
public string Platform
{
get
{
return m_Platform;
}
set
{
switch ((value + "").ToLower())
{
case "x86":
case "x64":
m_Platform = value;
break;
case "itanium":
m_Platform = "Itanium";
break;
default:
m_Platform = "AnyCPU";
break;
}
}
}
/// <summary>
/// Gets the name.
/// </summary>
/// <value>The name.</value>
public string Name
{
get
{
return m_Name;
}
}
/// <summary>
/// Gets the name.
/// </summary>
/// <value>The name.</value>
public string Name
{
get
{
return m_Name;
}
}
/// <summary>
/// Gets the name and platform for the configuration.
/// </summary>
/// <value>The name and platform.</value>
public string NameAndPlatform
{
get
{
/// <summary>
/// Gets the name and platform for the configuration.
/// </summary>
/// <value>The name and platform.</value>
public string NameAndPlatform
{
get
{
string platform = m_Platform;
if (platform == "AnyCPU")
platform = "Any CPU";
return String.Format("{0}|{1}", m_Name, platform);
}
}
return String.Format("{0}|{1}", m_Name, platform);
}
}
/// <summary>
/// Gets or sets the options.
/// </summary>
/// <value>The options.</value>
public OptionsNode Options
{
get
{
return m_Options;
}
set
{
m_Options = value;
}
}
/// <summary>
/// Gets or sets the options.
/// </summary>
/// <value>The options.</value>
public OptionsNode Options
{
get
{
return m_Options;
}
set
{
m_Options = value;
}
}
#endregion
#endregion
#region Public Methods
#region Public Methods
/// <summary>
/// Parses the specified node.
/// </summary>
/// <param name="node">The node.</param>
public override void Parse(XmlNode node)
{
m_Name = Helper.AttributeValue(node, "name", m_Name);
Platform = Helper.AttributeValue(node, "platform", m_Platform);
/// <summary>
/// Parses the specified node.
/// </summary>
/// <param name="node">The node.</param>
public override void Parse(XmlNode node)
{
m_Name = Helper.AttributeValue(node, "name", m_Name);
Platform = Helper.AttributeValue(node, "platform", m_Platform);
if (node == null)
{
throw new ArgumentNullException("node");
}
foreach(XmlNode child in node.ChildNodes)
{
IDataNode dataNode = Kernel.Instance.ParseNode(child, this);
if(dataNode is OptionsNode)
{
((OptionsNode)dataNode).CopyTo(m_Options);
}
}
}
if (node == null)
{
throw new ArgumentNullException("node");
}
foreach (XmlNode child in node.ChildNodes)
{
IDataNode dataNode = Kernel.Instance.ParseNode(child, this);
if (dataNode is OptionsNode)
{
((OptionsNode)dataNode).CopyTo(m_Options);
}
}
}
/// <summary>
/// Copies to.
/// </summary>
/// <param name="conf">The conf.</param>
public void CopyTo(ConfigurationNode conf)
{
m_Options.CopyTo(conf.m_Options);
}
/// <summary>
/// Copies to.
/// </summary>
/// <param name="conf">The conf.</param>
public void CopyTo(ConfigurationNode conf)
{
m_Options.CopyTo(conf.m_Options);
}
#endregion
#endregion
#region ICloneable Members
#region ICloneable Members
/// <summary>
/// Creates a new object that is a copy of the current instance.
/// </summary>
/// <returns>
/// A new object that is a copy of this instance.
/// </returns>
public object Clone()
{
ConfigurationNode ret = new ConfigurationNode();
ret.m_Name = m_Name;
ret.m_Platform = m_Platform;
m_Options.CopyTo(ret.m_Options);
return ret;
}
/// <summary>
/// Creates a new object that is a copy of the current instance.
/// </summary>
/// <returns>
/// A new object that is a copy of this instance.
/// </returns>
public object Clone()
{
ConfigurationNode ret = new ConfigurationNode();
ret.m_Name = m_Name;
ret.m_Platform = m_Platform;
m_Options.CopyTo(ret.m_Options);
return ret;
}
#endregion
#endregion
#region IComparable Members
public int CompareTo(object obj)
{
ConfigurationNode that = (ConfigurationNode) obj;
ConfigurationNode that = (ConfigurationNode)obj;
return this.m_Name.CompareTo(that.m_Name);
}
#endregion
}
}
}
@@ -27,45 +27,45 @@ using System.Collections.Generic;
namespace Prebuild.Core.Nodes
{
/// <summary>
/// Implements a specialized list of configuration nodes which allows for lookup via
/// configuration name and platform.
/// </summary>
public class ConfigurationNodeCollection : List<ConfigurationNode>
{
#region Properties
/// <summary>
/// Implements a specialized list of configuration nodes which allows for lookup via
/// configuration name and platform.
/// </summary>
public class ConfigurationNodeCollection : List<ConfigurationNode>
{
#region Properties
public ConfigurationNode this[string nameAndPlatform]
{
get
{
foreach (ConfigurationNode configurationNode in this)
{
if (configurationNode.NameAndPlatform == nameAndPlatform)
{
return configurationNode;
}
}
public ConfigurationNode this[string nameAndPlatform]
{
get
{
foreach (ConfigurationNode configurationNode in this)
{
if (configurationNode.NameAndPlatform == nameAndPlatform)
{
return configurationNode;
}
}
return null;
}
return null;
}
set
{
// See if the node
ConfigurationNode configurationNode = this[nameAndPlatform];
set
{
// See if the node
ConfigurationNode configurationNode = this[nameAndPlatform];
if (configurationNode != null)
{
this[IndexOf(configurationNode)] = value;
}
else
{
Add(value);
}
}
}
if (configurationNode != null)
{
this[IndexOf(configurationNode)] = value;
}
else
{
Add(value);
}
}
}
#endregion
}
#endregion
}
}
+77 -77
View File
@@ -32,86 +32,86 @@ using System.IO;
namespace Prebuild.Core.Nodes
{
/// <summary>
///
/// </summary>
public abstract class DataNode : IDataNode
{
#region Fields
/// <summary>
///
/// </summary>
public abstract class DataNode : IDataNode
{
#region Fields
private IDataNode parent;
string[] m_WebTypes = new string[] { "aspx", "ascx", "master", "ashx", "asmx" };
private IDataNode parent;
string[] m_WebTypes = new string[] { "aspx", "ascx", "master", "ashx", "asmx" };
#endregion
#endregion
#region IDataNode Members
#region IDataNode Members
/// <summary>
/// Gets or sets the parent.
/// </summary>
/// <value>The parent.</value>
public virtual IDataNode Parent
{
get
{
return parent;
}
set
{
parent = value;
}
}
public string[] WebTypes
{
get { return m_WebTypes; }
}
/// <summary>
/// Parses the specified node.
/// </summary>
/// <param name="node">The node.</param>
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;
}
/// <summary>
/// Parses the file type to figure out what type it is
/// </summary>
/// <returns></returns>
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)
{
/// <summary>
/// Gets or sets the parent.
/// </summary>
/// <value>The parent.</value>
public virtual IDataNode Parent
{
get
{
return parent;
}
set
{
parent = value;
}
}
public string[] WebTypes
{
get { return m_WebTypes; }
}
/// <summary>
/// Parses the specified node.
/// </summary>
/// <param name="node">The node.</param>
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;
}
/// <summary>
/// Parses the file type to figure out what type it is
/// </summary>
/// <returns></returns>
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(type))
{
return SubType.CodeBehind;
}
}
}
return SubType.Code;
}
#endregion
}
{
return SubType.CodeBehind;
}
}
}
return SubType.Code;
}
#endregion
}
}
@@ -43,18 +43,18 @@ namespace Prebuild.Core.Nodes
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":
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);
+32 -32
View File
@@ -32,31 +32,31 @@ using Prebuild.Core.Utilities;
namespace Prebuild.Core.Nodes
{
/// <summary>
///
/// </summary>
[DataNode("Exclude")]
public class ExcludeNode : DataNode
{
#region Fields
/// <summary>
///
/// </summary>
[DataNode("Exclude")]
public class ExcludeNode : DataNode
{
#region Fields
private string m_Pattern = "";
#endregion
#endregion
#region Properties
#region Properties
/// <summary>
/// Gets the name.
/// </summary>
/// <value>The name.</value>
public string Name
{
get
{
return m_Pattern;
}
}
/// <summary>
/// Gets the name.
/// </summary>
/// <value>The name.</value>
public string Name
{
get
{
return m_Pattern;
}
}
/// <summary>
/// Gets the pattern.
@@ -72,18 +72,18 @@ namespace Prebuild.Core.Nodes
#endregion
#region Public Methods
#region Public Methods
/// <summary>
/// Parses the specified node.
/// </summary>
/// <param name="node">The node.</param>
public override void Parse(XmlNode node)
{
m_Pattern = Helper.AttributeValue( node, "name", m_Pattern );
m_Pattern = Helper.AttributeValue(node, "pattern", m_Pattern );
}
/// <summary>
/// Parses the specified node.
/// </summary>
/// <param name="node">The node.</param>
public override void Parse(XmlNode node)
{
m_Pattern = Helper.AttributeValue(node, "name", m_Pattern);
m_Pattern = Helper.AttributeValue(node, "pattern", m_Pattern);
}
#endregion
}
#endregion
}
}
+201 -201
View File
@@ -34,190 +34,190 @@ using Prebuild.Core.Targets;
namespace Prebuild.Core.Nodes
{
/// <summary>
///
/// </summary>
public enum BuildAction
{
/// <summary>
///
/// </summary>
None,
/// <summary>
///
/// </summary>
Compile,
/// <summary>
///
/// </summary>
Content,
/// <summary>
///
/// </summary>
EmbeddedResource,
/// <summary>
///
/// </summary>
ApplicationDefinition,
/// <summary>
///
/// </summary>
Page,
/// <summary>
///
/// </summary>
public enum BuildAction
{
/// <summary>
///
/// </summary>
None,
/// <summary>
///
/// </summary>
Compile,
/// <summary>
///
/// </summary>
Content,
/// <summary>
///
/// </summary>
EmbeddedResource,
/// <summary>
///
/// </summary>
ApplicationDefinition,
/// <summary>
///
/// </summary>
Page,
/// <summary>
///
/// </summary>
Copy
}
}
/// <summary>
///
/// </summary>
public enum SubType
{
/// <summary>
///
/// </summary>
Code,
/// <summary>
///
/// </summary>
Component,
/// <summary>
///
/// </summary>
public enum SubType
{
/// <summary>
///
/// </summary>
Code,
/// <summary>
///
/// </summary>
Component,
/// <summary>
///
/// </summary>
Designer,
/// <summary>
///
/// </summary>
Form,
/// <summary>
///
/// </summary>
Settings,
/// <summary>
///
/// </summary>
UserControl,
/// <summary>
///
/// </summary>
CodeBehind,
}
/// <summary>
///
/// </summary>
Form,
/// <summary>
///
/// </summary>
Settings,
/// <summary>
///
/// </summary>
UserControl,
/// <summary>
///
/// </summary>
CodeBehind,
}
public enum CopyToOutput
{
Never,
Always,
PreserveNewest
}
public enum CopyToOutput
{
Never,
Always,
PreserveNewest
}
/// <summary>
///
/// </summary>
[DataNode("File")]
public class FileNode : DataNode
{
#region Fields
/// <summary>
///
/// </summary>
[DataNode("File")]
public class FileNode : DataNode
{
#region Fields
private string m_Path;
private string m_ResourceName = "";
private BuildAction? m_BuildAction;
private bool m_Valid;
private SubType? m_SubType;
private CopyToOutput m_CopyToOutput = CopyToOutput.Never;
private bool m_Link = false;
private string m_LinkPath = string.Empty;
private string m_Path;
private string m_ResourceName = "";
private BuildAction? m_BuildAction;
private bool m_Valid;
private SubType? m_SubType;
private CopyToOutput m_CopyToOutput = CopyToOutput.Never;
private bool m_Link = false;
private string m_LinkPath = string.Empty;
private bool m_PreservePath = false;
#endregion
#endregion
#region Properties
#region Properties
/// <summary>
///
/// </summary>
public string Path
{
get
{
return m_Path;
}
}
/// <summary>
///
/// </summary>
public string Path
{
get
{
return m_Path;
}
}
/// <summary>
///
/// </summary>
public string ResourceName
{
get
{
return m_ResourceName;
}
}
/// <summary>
///
/// </summary>
public string ResourceName
{
get
{
return m_ResourceName;
}
}
/// <summary>
///
/// </summary>
public BuildAction BuildAction
{
get
{
if (m_BuildAction != null)
return m_BuildAction.Value;
else
return GetBuildActionByFileName(this.Path);
/// <summary>
///
/// </summary>
public BuildAction BuildAction
{
get
{
if (m_BuildAction != null)
return m_BuildAction.Value;
else
return GetBuildActionByFileName(this.Path);
}
}
}
}
public CopyToOutput CopyToOutput
{
get
{
return this.m_CopyToOutput;
}
}
public CopyToOutput CopyToOutput
{
get
{
return this.m_CopyToOutput;
}
}
public bool IsLink
{
get
{
return this.m_Link;
}
}
public bool IsLink
{
get
{
return this.m_Link;
}
}
public string LinkPath
{
get
{
return this.m_LinkPath;
}
}
/// <summary>
///
/// </summary>
public SubType SubType
{
get
{
if (m_SubType != null)
return m_SubType.Value;
else
return GetSubTypeByFileName(this.Path);
}
}
public string LinkPath
{
get
{
return this.m_LinkPath;
}
}
/// <summary>
///
/// </summary>
public SubType SubType
{
get
{
if (m_SubType != null)
return m_SubType.Value;
else
return GetSubTypeByFileName(this.Path);
}
}
/// <summary>
///
/// </summary>
public bool IsValid
{
get
{
return m_Valid;
}
}
/// <summary>
///
/// </summary>
public bool IsValid
{
get
{
return m_Valid;
}
}
/// <summary>
///
@@ -232,61 +232,61 @@ namespace Prebuild.Core.Nodes
}
}
#endregion
#endregion
#region Public Methods
#region Public Methods
/// <summary>
///
/// </summary>
/// <param name="node"></param>
public override void Parse(XmlNode node)
{
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);
/// <summary>
///
/// </summary>
/// <param name="node"></param>
public override void Parse(XmlNode node)
{
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);
Console.WriteLine("[FileNode]:BuildAction is {0}", buildAction);
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 )
{
this.m_LinkPath = Helper.AttributeValue( node, "linkPath", string.Empty );
}
this.m_CopyToOutput = (CopyToOutput) Enum.Parse(typeof(CopyToOutput), Helper.AttributeValue(node, "copyToOutput", this.m_CopyToOutput.ToString()));
this.m_PreservePath = bool.Parse( Helper.AttributeValue( node, "preservePath", bool.FalseString ) );
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)
{
this.m_LinkPath = Helper.AttributeValue(node, "linkPath", string.Empty);
}
this.m_CopyToOutput = (CopyToOutput)Enum.Parse(typeof(CopyToOutput), Helper.AttributeValue(node, "copyToOutput", this.m_CopyToOutput.ToString()));
this.m_PreservePath = bool.Parse(Helper.AttributeValue(node, "preservePath", bool.FalseString));
if( node == null )
{
throw new ArgumentNullException("node");
}
if (node == null)
{
throw new ArgumentNullException("node");
}
m_Path = Helper.InterpolateForEnvironmentVariables(node.InnerText);
if(m_Path == null)
{
m_Path = "";
}
m_Path = Helper.InterpolateForEnvironmentVariables(node.InnerText);
if (m_Path == null)
{
m_Path = "";
}
m_Path = m_Path.Trim();
m_Valid = true;
if(!File.Exists(m_Path))
{
m_Valid = false;
Kernel.Instance.Log.Write(LogType.Warning, "File does not exist: {0}", m_Path);
}
m_Path = m_Path.Trim();
m_Valid = true;
if (!File.Exists(m_Path))
{
m_Valid = false;
Kernel.Instance.Log.Write(LogType.Warning, "File does not exist: {0}", m_Path);
}
if (System.IO.Path.GetExtension(m_Path) == ".settings")
{
m_SubType = SubType.Settings;
m_BuildAction = BuildAction.None;
}
}
}
#endregion
}
#endregion
}
}
+136 -136
View File
@@ -34,36 +34,36 @@ using System.IO;
namespace Prebuild.Core.Nodes
{
/// <summary>
///
/// </summary>
[DataNode("Files")]
public class FilesNode : DataNode
{
#region Fields
/// <summary>
///
/// </summary>
[DataNode("Files")]
public class FilesNode : DataNode
{
#region Fields
private readonly List<string> m_Files = new List<string>();
private readonly Dictionary<string,BuildAction> m_BuildActions = new Dictionary<string, BuildAction>();
private readonly Dictionary<string, SubType> m_SubTypes = new Dictionary<string, SubType>();
private readonly Dictionary<string, string> m_ResourceNames = new Dictionary<string, string>();
private readonly Dictionary<string, CopyToOutput> m_CopyToOutputs = new Dictionary<string, CopyToOutput>();
private readonly Dictionary<string, bool> m_Links = new Dictionary<string, bool>();
private readonly Dictionary<string, string> m_LinkPaths = new Dictionary<string, string>();
private readonly List<string> m_Files = new List<string>();
private readonly Dictionary<string, BuildAction> m_BuildActions = new Dictionary<string, BuildAction>();
private readonly Dictionary<string, SubType> m_SubTypes = new Dictionary<string, SubType>();
private readonly Dictionary<string, string> m_ResourceNames = new Dictionary<string, string>();
private readonly Dictionary<string, CopyToOutput> m_CopyToOutputs = new Dictionary<string, CopyToOutput>();
private readonly Dictionary<string, bool> m_Links = new Dictionary<string, bool>();
private readonly Dictionary<string, string> m_LinkPaths = new Dictionary<string, string>();
private readonly Dictionary<string, bool> m_PreservePaths = new Dictionary<string, bool>();
private readonly Dictionary<string, string> m_DestinationPath = new Dictionary<string, string>();
private readonly NameValueCollection m_CopyFiles = new NameValueCollection();
#endregion
#endregion
#region Properties
#region Properties
public int Count
{
get
{
return m_Files.Count;
}
}
public int Count
{
get
{
return m_Files.Count;
}
}
public string[] Destinations
{
@@ -75,23 +75,23 @@ namespace Prebuild.Core.Nodes
get { return m_CopyFiles.Count; }
}
#endregion
#endregion
#region Public Methods
#region Public Methods
public BuildAction GetBuildAction(string file)
{
if(!m_BuildActions.ContainsKey(file))
{
return BuildAction.Compile;
}
public BuildAction GetBuildAction(string file)
{
if (!m_BuildActions.ContainsKey(file))
{
return BuildAction.Compile;
}
return m_BuildActions[file];
}
return m_BuildActions[file];
}
public string GetDestinationPath(string file)
{
if( !m_DestinationPath.ContainsKey(file))
if (!m_DestinationPath.ContainsKey(file))
{
return null;
}
@@ -103,107 +103,107 @@ namespace Prebuild.Core.Nodes
return m_CopyFiles.GetValues(dest);
}
public CopyToOutput GetCopyToOutput(string file)
{
if (!m_CopyToOutputs.ContainsKey(file))
{
return CopyToOutput.Never;
}
return m_CopyToOutputs[file];
}
public CopyToOutput GetCopyToOutput(string file)
{
if (!m_CopyToOutputs.ContainsKey(file))
{
return CopyToOutput.Never;
}
return m_CopyToOutputs[file];
}
public bool GetIsLink(string file)
{
if (!m_Links.ContainsKey(file))
{
return false;
}
return m_Links[file];
}
public bool GetIsLink(string file)
{
if (!m_Links.ContainsKey(file))
{
return false;
}
return m_Links[file];
}
public bool Contains(string file)
{
return m_Files.Contains(file);
}
public string GetLinkPath( string file )
{
if ( !m_LinkPaths.ContainsKey( file ) )
{
return string.Empty;
}
return m_LinkPaths[ file ];
}
public SubType GetSubType(string file)
{
if(!m_SubTypes.ContainsKey(file))
{
return SubType.Code;
}
return m_SubTypes[file];
}
public string GetResourceName(string file)
{
if(!m_ResourceNames.ContainsKey(file))
{
return string.Empty;
}
return m_ResourceNames[file];
}
public bool GetPreservePath( string file )
public string GetLinkPath(string file)
{
if ( !m_PreservePaths.ContainsKey( file ) )
if (!m_LinkPaths.ContainsKey(file))
{
return string.Empty;
}
return m_LinkPaths[file];
}
public SubType GetSubType(string file)
{
if (!m_SubTypes.ContainsKey(file))
{
return SubType.Code;
}
return m_SubTypes[file];
}
public string GetResourceName(string file)
{
if (!m_ResourceNames.ContainsKey(file))
{
return string.Empty;
}
return m_ResourceNames[file];
}
public bool GetPreservePath(string file)
{
if (!m_PreservePaths.ContainsKey(file))
{
return false;
}
return m_PreservePaths[ file ];
return m_PreservePaths[file];
}
public override void Parse(XmlNode node)
{
if( node == null )
{
throw new ArgumentNullException("node");
}
foreach(XmlNode child in node.ChildNodes)
{
IDataNode dataNode = Kernel.Instance.ParseNode(child, this);
if(dataNode is FileNode)
{
FileNode fileNode = (FileNode)dataNode;
if(fileNode.IsValid)
{
if (!m_Files.Contains(fileNode.Path))
{
m_Files.Add(fileNode.Path);
m_BuildActions[fileNode.Path] = fileNode.BuildAction;
m_SubTypes[fileNode.Path] = fileNode.SubType;
m_ResourceNames[fileNode.Path] = fileNode.ResourceName;
m_PreservePaths[ fileNode.Path ] = fileNode.PreservePath;
m_Links[ fileNode.Path ] = fileNode.IsLink;
m_LinkPaths[ fileNode.Path ] = fileNode.LinkPath;
m_CopyToOutputs[ fileNode.Path ] = fileNode.CopyToOutput;
public override void Parse(XmlNode node)
{
if (node == null)
{
throw new ArgumentNullException("node");
}
foreach (XmlNode child in node.ChildNodes)
{
IDataNode dataNode = Kernel.Instance.ParseNode(child, this);
if (dataNode is FileNode)
{
FileNode fileNode = (FileNode)dataNode;
if (fileNode.IsValid)
{
if (!m_Files.Contains(fileNode.Path))
{
m_Files.Add(fileNode.Path);
m_BuildActions[fileNode.Path] = fileNode.BuildAction;
m_SubTypes[fileNode.Path] = fileNode.SubType;
m_ResourceNames[fileNode.Path] = fileNode.ResourceName;
m_PreservePaths[fileNode.Path] = fileNode.PreservePath;
m_Links[fileNode.Path] = fileNode.IsLink;
m_LinkPaths[fileNode.Path] = fileNode.LinkPath;
m_CopyToOutputs[fileNode.Path] = fileNode.CopyToOutput;
}
}
}
else if(dataNode is MatchNode)
{
foreach(string file in ((MatchNode)dataNode).Files)
{
}
}
}
else if (dataNode is MatchNode)
{
foreach (string file in ((MatchNode)dataNode).Files)
{
MatchNode matchNode = (MatchNode)dataNode;
if (!m_Files.Contains(file))
{
m_Files.Add(file);
if (matchNode.BuildAction == null)
if (!m_Files.Contains(file))
{
m_Files.Add(file);
if (matchNode.BuildAction == null)
m_BuildActions[file] = GetBuildActionByFileName(file);
else
else
m_BuildActions[file] = matchNode.BuildAction.Value;
if (matchNode.BuildAction == BuildAction.Copy)
@@ -212,27 +212,27 @@ namespace Prebuild.Core.Nodes
m_DestinationPath[file] = matchNode.DestinationPath;
}
m_SubTypes[file] = matchNode.SubType == null ? GetSubTypeByFileName(file) : matchNode.SubType.Value;
m_ResourceNames[ file ] = matchNode.ResourceName;
m_PreservePaths[ file ] = matchNode.PreservePath;
m_Links[ file ] = matchNode.IsLink;
m_LinkPaths[ file ] = matchNode.LinkPath;
m_CopyToOutputs[ file ] = matchNode.CopyToOutput;
m_SubTypes[file] = matchNode.SubType == null ? GetSubTypeByFileName(file) : matchNode.SubType.Value;
m_ResourceNames[file] = matchNode.ResourceName;
m_PreservePaths[file] = matchNode.PreservePath;
m_Links[file] = matchNode.IsLink;
m_LinkPaths[file] = matchNode.LinkPath;
m_CopyToOutputs[file] = matchNode.CopyToOutput;
}
}
}
}
}
}
}
}
}
}
// TODO: Check in to why StringCollection's enumerator doesn't implement
// IEnumerator?
public IEnumerator<string> GetEnumerator()
{
return m_Files.GetEnumerator();
}
// TODO: Check in to why StringCollection's enumerator doesn't implement
// IEnumerator?
public IEnumerator<string> GetEnumerator()
{
return m_Files.GetEnumerator();
}
#endregion
#endregion
}
}
+208 -208
View File
@@ -35,51 +35,51 @@ using Prebuild.Core.Utilities;
namespace Prebuild.Core.Nodes
{
/// <summary>
///
/// </summary>
[DataNode("Match")]
public class MatchNode : DataNode
{
#region Fields
/// <summary>
///
/// </summary>
[DataNode("Match")]
public class MatchNode : DataNode
{
#region Fields
private readonly List<string> m_Files = new List<string>();
private Regex m_Regex;
private BuildAction? m_BuildAction;
private SubType? m_SubType;
string m_ResourceName = "";
private CopyToOutput m_CopyToOutput;
private bool m_Link;
private string m_LinkPath;
private Regex m_Regex;
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 string m_Destination = "";
private readonly List<ExcludeNode> m_Exclusions = new List<ExcludeNode>();
#endregion
#endregion
#region Properties
#region Properties
/// <summary>
///
/// </summary>
public IEnumerable<string> Files
{
get
{
return m_Files;
}
}
/// <summary>
///
/// </summary>
public IEnumerable<string> Files
{
get
{
return m_Files;
}
}
/// <summary>
///
/// </summary>
public BuildAction? BuildAction
{
get
{
return m_BuildAction;
}
}
/// <summary>
///
/// </summary>
public BuildAction? BuildAction
{
get
{
return m_BuildAction;
}
}
public string DestinationPath
{
@@ -88,50 +88,50 @@ namespace Prebuild.Core.Nodes
return m_Destination;
}
}
/// <summary>
///
/// </summary>
public SubType? SubType
{
get
{
return m_SubType;
}
}
/// <summary>
///
/// </summary>
public SubType? SubType
{
get
{
return m_SubType;
}
}
public CopyToOutput CopyToOutput
{
get
{
return m_CopyToOutput;
}
}
public CopyToOutput CopyToOutput
{
get
{
return m_CopyToOutput;
}
}
public bool IsLink
{
get
{
return m_Link;
}
}
public bool IsLink
{
get
{
return m_Link;
}
}
public string LinkPath
{
get
{
return m_LinkPath;
}
}
/// <summary>
///
/// </summary>
public string ResourceName
{
get
{
return m_ResourceName;
}
}
public string LinkPath
{
get
{
return m_LinkPath;
}
}
/// <summary>
///
/// </summary>
public string ResourceName
{
get
{
return m_ResourceName;
}
}
public bool PreservePath
{
@@ -141,27 +141,27 @@ namespace Prebuild.Core.Nodes
}
}
#endregion
#endregion
#region Private Methods
#region Private Methods
/// <summary>
/// Recurses the directories.
/// </summary>
/// <param name="path">The path.</param>
/// <param name="pattern">The pattern.</param>
/// <param name="recurse">if set to <c>true</c> [recurse].</param>
/// <param name="useRegex">if set to <c>true</c> [use regex].</param>
private void RecurseDirectories(string path, string pattern, bool recurse, bool useRegex, List<ExcludeNode> exclusions)
{
Match match;
try
{
string[] files;
/// <summary>
/// Recurses the directories.
/// </summary>
/// <param name="path">The path.</param>
/// <param name="pattern">The pattern.</param>
/// <param name="recurse">if set to <c>true</c> [recurse].</param>
/// <param name="useRegex">if set to <c>true</c> [use regex].</param>
private void RecurseDirectories(string path, string pattern, bool recurse, bool useRegex, List<ExcludeNode> exclusions)
{
Match match;
try
{
string[] files;
Boolean excludeFile;
if(!useRegex)
{
Boolean excludeFile;
if (!useRegex)
{
try
{
files = Directory.GetFiles(path, pattern);
@@ -177,46 +177,46 @@ namespace Prebuild.Core.Nodes
files = null;
}
if(files != null)
{
foreach (string file in files)
{
if (files != null)
{
foreach (string file in files)
{
excludeFile = false;
string fileTemp;
if (file.Substring(0,2) == "./" || file.Substring(0,2) == ".\\")
{
fileTemp = file.Substring(2);
}
else
{
fileTemp = file;
}
string fileTemp;
if (file.Substring(0, 2) == "./" || file.Substring(0, 2) == ".\\")
{
fileTemp = file.Substring(2);
}
else
{
fileTemp = file;
}
// Check all excludions and set flag if there are any hits.
foreach ( ExcludeNode exclude in exclusions )
foreach (ExcludeNode exclude in exclusions)
{
Regex exRegEx = new Regex( exclude.Pattern );
match = exRegEx.Match( file );
Regex exRegEx = new Regex(exclude.Pattern);
match = exRegEx.Match(file);
excludeFile |= match.Success;
}
if ( !excludeFile )
if (!excludeFile)
{
m_Files.Add( fileTemp );
m_Files.Add(fileTemp);
}
}
}
}
}
// don't call return here, because we may need to recursively search directories below
// this one, even if no matches were found in this directory.
}
else
{
try
{
files = Directory.GetFiles(path);
}
}
else
{
try
{
files = Directory.GetFiles(path);
}
catch (IOException)
{
// swallow weird IOException error when running in a virtual box
@@ -248,12 +248,12 @@ namespace Prebuild.Core.Nodes
}
}
}
}
if(recurse)
{
string[] dirs = Directory.GetDirectories(path);
if(dirs != null && dirs.Length > 0)
}
if (recurse)
{
string[] dirs = Directory.GetDirectories(path);
if (dirs != null && dirs.Length > 0)
{
foreach (string str in dirs)
{
@@ -265,98 +265,98 @@ namespace Prebuild.Core.Nodes
RecurseDirectories(Helper.NormalizePath(str), pattern, recurse, useRegex, exclusions);
}
}
}
}
catch(DirectoryNotFoundException)
{
return;
}
catch(ArgumentException)
{
return;
}
}
}
}
catch (DirectoryNotFoundException)
{
return;
}
catch (ArgumentException)
{
return;
}
}
#endregion
#endregion
#region Public Methods
#region Public Methods
/// <summary>
///
/// </summary>
/// <param name="node"></param>
public override void Parse(XmlNode node)
{
if( node == null )
{
throw new ArgumentNullException("node");
}
string path = Helper.AttributeValue(node, "path", ".");
string pattern = Helper.AttributeValue(node, "pattern", "*");
/// <summary>
///
/// </summary>
/// <param name="node"></param>
public override void Parse(XmlNode node)
{
if (node == null)
{
throw new ArgumentNullException("node");
}
string path = Helper.AttributeValue(node, "path", ".");
string pattern = Helper.AttributeValue(node, "pattern", "*");
string destination = Helper.AttributeValue(node, "destination", string.Empty);
bool recurse = (bool)Helper.TranslateValue(typeof(bool), Helper.AttributeValue(node, "recurse", "false"));
bool useRegex = (bool)Helper.TranslateValue(typeof(bool), Helper.AttributeValue(node, "useRegex", "false"));
string buildAction = Helper.AttributeValue(node, "buildAction", String.Empty);
if (buildAction != string.Empty)
m_BuildAction = (BuildAction)Enum.Parse(typeof(BuildAction), buildAction);
bool recurse = (bool)Helper.TranslateValue(typeof(bool), Helper.AttributeValue(node, "recurse", "false"));
bool useRegex = (bool)Helper.TranslateValue(typeof(bool), Helper.AttributeValue(node, "useRegex", "false"));
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);
m_CopyToOutput = (CopyToOutput) Enum.Parse(typeof(CopyToOutput), Helper.AttributeValue(node, "copyToOutput", m_CopyToOutput.ToString()));
m_Link = bool.Parse(Helper.AttributeValue(node, "link", bool.FalseString));
if ( m_Link )
{
m_LinkPath = Helper.AttributeValue( node, "linkPath", string.Empty );
}
m_PreservePath = bool.Parse( Helper.AttributeValue( node, "preservePath", bool.FalseString ) );
//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);
m_CopyToOutput = (CopyToOutput)Enum.Parse(typeof(CopyToOutput), Helper.AttributeValue(node, "copyToOutput", m_CopyToOutput.ToString()));
m_Link = bool.Parse(Helper.AttributeValue(node, "link", bool.FalseString));
if (m_Link)
{
m_LinkPath = Helper.AttributeValue(node, "linkPath", string.Empty);
}
m_PreservePath = bool.Parse(Helper.AttributeValue(node, "preservePath", bool.FalseString));
if ( buildAction == "Copy")
if (buildAction == "Copy")
m_Destination = destination;
if(path != null && path.Length == 0)
path = ".";//use current directory
//throw new WarningException("Match must have a 'path' attribute");
if (path != null && path.Length == 0)
path = ".";//use current directory
if(pattern == null)
{
throw new WarningException("Match must have a 'pattern' attribute");
}
//throw new WarningException("Match must have a 'path' attribute");
path = Helper.NormalizePath(path);
if(!Directory.Exists(path))
{
throw new WarningException("Match path does not exist: {0}", path);
}
if (pattern == null)
{
throw new WarningException("Match must have a 'pattern' attribute");
}
try
{
if(useRegex)
{
m_Regex = new Regex(pattern);
}
}
catch(ArgumentException ex)
{
throw new WarningException("Could not compile regex pattern: {0}", ex.Message);
}
path = Helper.NormalizePath(path);
if (!Directory.Exists(path))
{
throw new WarningException("Match path does not exist: {0}", path);
}
try
{
if (useRegex)
{
m_Regex = new Regex(pattern);
}
}
catch (ArgumentException ex)
{
throw new WarningException("Could not compile regex pattern: {0}", ex.Message);
}
foreach(XmlNode child in node.ChildNodes)
{
IDataNode dataNode = Kernel.Instance.ParseNode(child, this);
if(dataNode is ExcludeNode)
{
ExcludeNode excludeNode = (ExcludeNode)dataNode;
m_Exclusions.Add( excludeNode );
}
}
foreach (XmlNode child in node.ChildNodes)
{
IDataNode dataNode = Kernel.Instance.ParseNode(child, this);
if (dataNode is ExcludeNode)
{
ExcludeNode excludeNode = (ExcludeNode)dataNode;
m_Exclusions.Add(excludeNode);
}
}
RecurseDirectories( path, pattern, recurse, useRegex, m_Exclusions );
RecurseDirectories(path, pattern, recurse, useRegex, m_Exclusions);
if (m_Files.Count < 1)
{
@@ -371,8 +371,8 @@ namespace Prebuild.Core.Nodes
throw new WarningException("Match" + projectName + " returned no files: {0}{1}", Helper.EndPath(path), pattern);
}
m_Regex = null;
}
}
#endregion
}
#endregion
}
}
File diff suppressed because it is too large Load Diff
+46 -46
View File
@@ -32,60 +32,60 @@ using Prebuild.Core.Utilities;
namespace Prebuild.Core.Nodes
{
/// <summary>
///
/// </summary>
[DataNode("PackageReference")]
public class PackageReferenceNode : DataNode, IComparable
{
#region Fields
/// <summary>
///
/// </summary>
[DataNode("PackageReference")]
public class PackageReferenceNode : DataNode, IComparable
{
#region Fields
private string m_Name = "unknown";
private string m_Version;
private string m_Name = "unknown";
private string m_Version;
#endregion
#endregion
#region Properties
#region Properties
/// <summary>
/// Gets the name.
/// </summary>
/// <value>The name.</value>
public string Name
{
get
{
return m_Name;
}
}
/// <summary>
/// Gets the name.
/// </summary>
/// <value>The name.</value>
public string Name
{
get
{
return m_Name;
}
}
/// <summary>
/// Gets the version.
/// </summary>
/// <value>The version.</value>
public string Version
{
get
{
return m_Version;
}
}
/// <summary>
/// Gets the version.
/// </summary>
/// <value>The version.</value>
public string Version
{
get
{
return m_Version;
}
}
#endregion
#endregion
#region Public Methods
#region Public Methods
/// <summary>
/// Parses the specified node.
/// </summary>
/// <param name="node">The node.</param>
public override void Parse(XmlNode node)
{
m_Name = Helper.AttributeValue(node, "name", m_Name);
m_Version = Helper.AttributeValue(node, "version", m_Version);
}
/// <summary>
/// Parses the specified node.
/// </summary>
/// <param name="node">The node.</param>
public override void Parse(XmlNode node)
{
m_Name = Helper.AttributeValue(node, "name", m_Name);
m_Version = Helper.AttributeValue(node, "version", m_Version);
}
#endregion
#endregion
#region IComparable Members
@@ -96,5 +96,5 @@ namespace Prebuild.Core.Nodes
}
#endregion
}
}
}
+62 -62
View File
@@ -32,77 +32,77 @@ using Prebuild.Core.Utilities;
namespace Prebuild.Core.Nodes
{
/// <summary>
///
/// </summary>
[DataNode("Process")]
public class ProcessNode : DataNode
{
#region Fields
/// <summary>
///
/// </summary>
[DataNode("Process")]
public class ProcessNode : DataNode
{
#region Fields
private string m_Path;
private bool m_IsValid = true;
private string m_Path;
private bool m_IsValid = true;
#endregion
#endregion
#region Properties
#region Properties
/// <summary>
/// Gets the path.
/// </summary>
/// <value>The path.</value>
public string Path
{
get
{
return m_Path;
}
}
/// <summary>
/// Gets the path.
/// </summary>
/// <value>The path.</value>
public string Path
{
get
{
return m_Path;
}
}
/// <summary>
/// Gets a value indicating whether this instance is valid.
/// </summary>
/// <value><c>true</c> if this instance is valid; otherwise, <c>false</c>.</value>
public bool IsValid
{
get
{
return m_IsValid;
}
}
/// <summary>
/// Gets a value indicating whether this instance is valid.
/// </summary>
/// <value><c>true</c> if this instance is valid; otherwise, <c>false</c>.</value>
public bool IsValid
{
get
{
return m_IsValid;
}
}
#endregion
#endregion
#region Public Methods
#region Public Methods
/// <summary>
/// Parses the specified node.
/// </summary>
/// <param name="node">The node.</param>
public override void Parse(XmlNode node)
{
if( node == null )
{
throw new ArgumentNullException("node");
}
/// <summary>
/// Parses the specified node.
/// </summary>
/// <param name="node">The node.</param>
public override void Parse(XmlNode node)
{
if (node == null)
{
throw new ArgumentNullException("node");
}
m_Path = Helper.InterpolateForEnvironmentVariables(node.InnerText);
if(m_Path == null)
{
m_Path = "";
}
m_Path = Helper.InterpolateForEnvironmentVariables(node.InnerText);
if (m_Path == null)
{
m_Path = "";
}
try
{
m_Path = Helper.ResolvePath(m_Path);
}
catch(ArgumentException)
{
Kernel.Instance.Log.Write(LogType.Warning, "Could not find prebuild file for processing: {0}", m_Path);
m_IsValid = false;
}
}
try
{
m_Path = Helper.ResolvePath(m_Path);
}
catch (ArgumentException)
{
Kernel.Instance.Log.Write(LogType.Warning, "Could not find prebuild file for processing: {0}", m_Path);
m_IsValid = false;
}
}
#endregion
}
#endregion
}
}
File diff suppressed because it is too large Load Diff
+46 -46
View File
@@ -32,60 +32,60 @@ using Prebuild.Core.Utilities;
namespace Prebuild.Core.Nodes
{
/// <summary>
///
/// </summary>
[DataNode("ProjectReference")]
public class ProjectReferenceNode : DataNode, IComparable
{
#region Fields
/// <summary>
///
/// </summary>
[DataNode("ProjectReference")]
public class ProjectReferenceNode : DataNode, IComparable
{
#region Fields
private string m_Name = "unknown";
private string m_Include;
private string m_Name = "unknown";
private string m_Include;
#endregion
#endregion
#region Properties
#region Properties
/// <summary>
/// Gets the name.
/// </summary>
/// <value>The name.</value>
public string Name
{
get
{
return m_Name;
}
}
/// <summary>
/// Gets the name.
/// </summary>
/// <value>The name.</value>
public string Name
{
get
{
return m_Name;
}
}
/// <summary>
/// Gets the path.
/// </summary>
/// <value>The path.</value>
public string Include
{
get
{
return m_Include;
}
}
/// <summary>
/// Gets the path.
/// </summary>
/// <value>The path.</value>
public string Include
{
get
{
return m_Include;
}
}
#endregion
#endregion
#region Public Methods
#region Public Methods
/// <summary>
/// Parses the specified node.
/// </summary>
/// <param name="node">The node.</param>
public override void Parse(XmlNode node)
{
m_Name = Helper.AttributeValue(node, "name", m_Name);
m_Include = Helper.AttributeValue(node, "include", m_Include);
}
/// <summary>
/// Parses the specified node.
/// </summary>
/// <param name="node">The node.</param>
public override void Parse(XmlNode node)
{
m_Name = Helper.AttributeValue(node, "name", m_Name);
m_Include = Helper.AttributeValue(node, "include", m_Include);
}
#endregion
#endregion
#region IComparable Members
@@ -96,5 +96,5 @@ namespace Prebuild.Core.Nodes
}
#endregion
}
}
}
+87 -87
View File
@@ -32,104 +32,104 @@ using Prebuild.Core.Utilities;
namespace Prebuild.Core.Nodes
{
/// <summary>
///
/// </summary>
[DataNode("Reference")]
public class ReferenceNode : DataNode, IComparable
{
#region Fields
/// <summary>
///
/// </summary>
[DataNode("Reference")]
public class ReferenceNode : DataNode, IComparable
{
#region Fields
private string m_Name = "unknown";
private string m_Path;
private string m_LocalCopy;
private string m_Version;
private string m_Name = "unknown";
private string m_Path;
private string m_LocalCopy;
private string m_Version;
#endregion
#endregion
#region Properties
#region Properties
/// <summary>
/// Gets the name.
/// </summary>
/// <value>The name.</value>
public string Name
{
get
{
return m_Name;
}
}
/// <summary>
/// Gets the name.
/// </summary>
/// <value>The name.</value>
public string Name
{
get
{
return m_Name;
}
}
/// <summary>
/// Gets the path.
/// </summary>
/// <value>The path.</value>
public string Path
{
get
{
return m_Path;
}
}
/// <summary>
/// Gets the path.
/// </summary>
/// <value>The path.</value>
public string Path
{
get
{
return m_Path;
}
}
/// <summary>
/// Gets a value indicating whether [local copy specified].
/// </summary>
/// <value><c>true</c> if [local copy specified]; otherwise, <c>false</c>.</value>
public bool LocalCopySpecified
{
get
{
return ( m_LocalCopy != null && m_LocalCopy.Length == 0);
}
}
/// <summary>
/// Gets a value indicating whether [local copy specified].
/// </summary>
/// <value><c>true</c> if [local copy specified]; otherwise, <c>false</c>.</value>
public bool LocalCopySpecified
{
get
{
return (m_LocalCopy != null && m_LocalCopy.Length == 0);
}
}
/// <summary>
/// Gets a value indicating whether [local copy].
/// </summary>
/// <value><c>true</c> if [local copy]; otherwise, <c>false</c>.</value>
public bool LocalCopy
{
get
{
if( m_LocalCopy == null)
{
return false;
}
return bool.Parse(m_LocalCopy);
}
}
/// <summary>
/// Gets a value indicating whether [local copy].
/// </summary>
/// <value><c>true</c> if [local copy]; otherwise, <c>false</c>.</value>
public bool LocalCopy
{
get
{
if (m_LocalCopy == null)
{
return false;
}
return bool.Parse(m_LocalCopy);
}
}
/// <summary>
/// Gets the version.
/// </summary>
/// <value>The version.</value>
public string Version
{
get
{
return m_Version;
}
}
/// <summary>
/// Gets the version.
/// </summary>
/// <value>The version.</value>
public string Version
{
get
{
return m_Version;
}
}
#endregion
#endregion
#region Public Methods
#region Public Methods
/// <summary>
/// Parses the specified node.
/// </summary>
/// <param name="node">The node.</param>
public override void Parse(XmlNode node)
{
m_Name = Helper.AttributeValue(node, "name", m_Name);
m_Path = Helper.AttributeValue(node, "path", m_Path);
m_LocalCopy = Helper.AttributeValue(node, "localCopy", m_LocalCopy);
m_Version = Helper.AttributeValue(node, "version", m_Version);
}
/// <summary>
/// Parses the specified node.
/// </summary>
/// <param name="node">The node.</param>
public override void Parse(XmlNode node)
{
m_Name = Helper.AttributeValue(node, "name", m_Name);
m_Path = Helper.AttributeValue(node, "path", m_Path);
m_LocalCopy = Helper.AttributeValue(node, "localCopy", m_LocalCopy);
m_Version = Helper.AttributeValue(node, "version", m_Version);
}
#endregion
#endregion
#region IComparable Members
@@ -140,5 +140,5 @@ namespace Prebuild.Core.Nodes
}
#endregion
}
}
}
+42 -42
View File
@@ -32,57 +32,57 @@ using Prebuild.Core.Utilities;
namespace Prebuild.Core.Nodes
{
/// <summary>
///
/// </summary>
[DataNode("ReferencePath")]
public class ReferencePathNode : DataNode, IComparable
{
#region Fields
/// <summary>
///
/// </summary>
[DataNode("ReferencePath")]
public class ReferencePathNode : DataNode, IComparable
{
#region Fields
private string m_Path;
private string m_Path;
#endregion
#endregion
#region Properties
#region Properties
/// <summary>
/// Gets the path.
/// </summary>
/// <value>The path.</value>
public string Path
{
get
{
return m_Path;
}
}
/// <summary>
/// Gets the path.
/// </summary>
/// <value>The path.</value>
public string Path
{
get
{
return m_Path;
}
}
#endregion
#endregion
#region Public Methods
#region Public Methods
/// <summary>
/// Parses the specified node.
/// </summary>
/// <param name="node">The node.</param>
public override void Parse(XmlNode node)
{
if( node == null )
{
throw new ArgumentNullException("node");
}
/// <summary>
/// Parses the specified node.
/// </summary>
/// <param name="node">The node.</param>
public override void Parse(XmlNode node)
{
if (node == null)
{
throw new ArgumentNullException("node");
}
m_Path = Helper.InterpolateForEnvironmentVariables(node.InnerText);
if(m_Path == null)
{
m_Path = "";
}
m_Path = Helper.InterpolateForEnvironmentVariables(node.InnerText);
if (m_Path == null)
{
m_Path = "";
}
m_Path = m_Path.Trim();
}
m_Path = m_Path.Trim();
}
#endregion
#endregion
#region IComparable Members
@@ -93,5 +93,5 @@ namespace Prebuild.Core.Nodes
}
#endregion
}
}
}
+236 -236
View File
@@ -34,35 +34,35 @@ using Prebuild.Core.Utilities;
namespace Prebuild.Core.Nodes
{
/// <summary>
///
/// </summary>
[DataNode("Solution")]
/// <summary>
///
/// </summary>
[DataNode("Solution")]
[DataNode("EmbeddedSolution")]
[DebuggerDisplay("{Name}")]
public class SolutionNode : DataNode
{
#region Fields
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;
private string m_Name = "unknown";
private string m_Path = "";
private string m_FullPath = "";
private string m_ActiveConfig;
private string m_Version = "1.0.0";
private OptionsNode m_Options;
private FilesNode m_Files;
private OptionsNode m_Options;
private FilesNode m_Files;
private readonly ConfigurationNodeCollection m_Configurations = new ConfigurationNodeCollection();
private readonly Dictionary<string, ProjectNode> m_Projects = new Dictionary<string, ProjectNode>();
private readonly Dictionary<string, DatabaseProjectNode> m_DatabaseProjects = new Dictionary<string, DatabaseProjectNode>();
private readonly List<ProjectNode> m_ProjectsOrder = new List<ProjectNode>();
private readonly Dictionary<string, SolutionNode> m_Solutions = new Dictionary<string, SolutionNode>();
private CleanupNode m_Cleanup;
private CleanupNode m_Cleanup;
#endregion
#endregion
#region Properties
#region Properties
public override IDataNode Parent
{
get
@@ -76,7 +76,7 @@ namespace Prebuild.Core.Nodes
SolutionNode solution = (SolutionNode)value;
foreach (ConfigurationNode conf in solution.Configurations)
{
m_Configurations[conf.Name] = (ConfigurationNode) conf.Clone();
m_Configurations[conf.Name] = (ConfigurationNode)conf.Clone();
}
}
@@ -84,142 +84,142 @@ namespace Prebuild.Core.Nodes
}
}
public CleanupNode Cleanup
{
get
{
return m_Cleanup;
}
public CleanupNode Cleanup
{
get
{
return m_Cleanup;
}
set
{
m_Cleanup = value;
}
}
}
public Guid Guid
{
get
{
return m_Guid;
get
{
return m_Guid;
}
set
{
m_Guid = value;
m_Guid = value;
}
}
/// <summary>
/// Gets or sets the active config.
/// </summary>
/// <value>The active config.</value>
public string ActiveConfig
{
get
{
return m_ActiveConfig;
}
set
{
m_ActiveConfig = value;
}
}
/// <summary>
/// Gets or sets the active config.
/// </summary>
/// <value>The active config.</value>
public string ActiveConfig
{
get
{
return m_ActiveConfig;
}
set
{
m_ActiveConfig = value;
}
}
/// <summary>
/// Gets the name.
/// </summary>
/// <value>The name.</value>
public string Name
{
get
{
return m_Name;
}
}
/// <summary>
/// Gets the name.
/// </summary>
/// <value>The name.</value>
public string Name
{
get
{
return m_Name;
}
}
/// <summary>
/// Gets the path.
/// </summary>
/// <value>The path.</value>
public string Path
{
get
{
return m_Path;
}
}
/// <summary>
/// Gets the path.
/// </summary>
/// <value>The path.</value>
public string Path
{
get
{
return m_Path;
}
}
/// <summary>
/// Gets the full path.
/// </summary>
/// <value>The full path.</value>
public string FullPath
{
get
{
return m_FullPath;
}
}
/// <summary>
/// Gets the full path.
/// </summary>
/// <value>The full path.</value>
public string FullPath
{
get
{
return m_FullPath;
}
}
/// <summary>
/// Gets the version.
/// </summary>
/// <value>The version.</value>
public string Version
{
get
{
return m_Version;
}
}
/// <summary>
/// Gets the version.
/// </summary>
/// <value>The version.</value>
public string Version
{
get
{
return m_Version;
}
}
/// <summary>
/// Gets the options.
/// </summary>
/// <value>The options.</value>
public OptionsNode Options
{
get
{
return m_Options;
}
}
/// <summary>
/// Gets the options.
/// </summary>
/// <value>The options.</value>
public OptionsNode Options
{
get
{
return m_Options;
}
}
/// <summary>
/// Gets the files.
/// </summary>
/// <value>The files.</value>
public FilesNode Files
{
get
{
return m_Files;
}
}
/// <summary>
/// Gets the files.
/// </summary>
/// <value>The files.</value>
public FilesNode Files
{
get
{
return m_Files;
}
}
/// <summary>
/// Gets the configurations.
/// </summary>
/// <value>The configurations.</value>
public ConfigurationNodeCollection Configurations
{
get
{
ConfigurationNodeCollection tmp = new ConfigurationNodeCollection();
tmp.AddRange(ConfigurationsTable);
return tmp;
}
}
/// <summary>
/// Gets the configurations.
/// </summary>
/// <value>The configurations.</value>
public ConfigurationNodeCollection Configurations
{
get
{
ConfigurationNodeCollection tmp = new ConfigurationNodeCollection();
tmp.AddRange(ConfigurationsTable);
return tmp;
}
}
/// <summary>
/// Gets the configurations table.
/// </summary>
/// <value>The configurations table.</value>
public ConfigurationNodeCollection ConfigurationsTable
{
get
{
return m_Configurations;
}
}
/// <summary>
/// Gets the configurations table.
/// </summary>
/// <value>The configurations table.</value>
public ConfigurationNodeCollection ConfigurationsTable
{
get
{
return m_Configurations;
}
}
/// <summary>
/// Gets the database projects.
/// </summary>
@@ -250,109 +250,109 @@ namespace Prebuild.Core.Nodes
return m_Solutions;
}
}
/// <summary>
/// Gets the projects.
/// </summary>
/// <value>The projects.</value>
public ICollection<ProjectNode> Projects
{
get
{
/// <summary>
/// Gets the projects.
/// </summary>
/// <value>The projects.</value>
public ICollection<ProjectNode> Projects
{
get
{
List<ProjectNode> tmp = new List<ProjectNode>(m_Projects.Values);
tmp.Sort();
return tmp;
}
}
}
}
/// <summary>
/// Gets the projects table.
/// </summary>
/// <value>The projects table.</value>
public Dictionary<string, ProjectNode> ProjectsTable
{
get
{
return m_Projects;
}
}
/// <summary>
/// Gets the projects table.
/// </summary>
/// <value>The projects table.</value>
public Dictionary<string, ProjectNode> ProjectsTable
{
get
{
return m_Projects;
}
}
/// <summary>
/// Gets the projects table.
/// </summary>
/// <value>The projects table.</value>
public List<ProjectNode> ProjectsTableOrder
{
get
{
return m_ProjectsOrder;
}
}
/// <summary>
/// Gets the projects table.
/// </summary>
/// <value>The projects table.</value>
public List<ProjectNode> ProjectsTableOrder
{
get
{
return m_ProjectsOrder;
}
}
#endregion
#endregion
#region Public Methods
#region Public Methods
/// <summary>
/// Parses the specified node.
/// </summary>
/// <param name="node">The node.</param>
public override void Parse(XmlNode node)
{
m_Name = Helper.AttributeValue(node, "name", m_Name);
m_ActiveConfig = Helper.AttributeValue(node, "activeConfig", m_ActiveConfig);
m_Path = Helper.AttributeValue(node, "path", m_Path);
m_Version = Helper.AttributeValue(node, "version", m_Version);
/// <summary>
/// Parses the specified node.
/// </summary>
/// <param name="node">The node.</param>
public override void Parse(XmlNode node)
{
m_Name = Helper.AttributeValue(node, "name", m_Name);
m_ActiveConfig = Helper.AttributeValue(node, "activeConfig", m_ActiveConfig);
m_Path = Helper.AttributeValue(node, "path", m_Path);
m_Version = Helper.AttributeValue(node, "version", m_Version);
m_FullPath = m_Path;
try
{
m_FullPath = Helper.ResolvePath(m_FullPath);
}
catch
{
throw new WarningException("Could not resolve solution path: {0}", m_Path);
}
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);
Kernel.Instance.CurrentWorkingDirectory.Push();
try
{
Helper.SetCurrentDir(m_FullPath);
if( node == null )
{
throw new ArgumentNullException("node");
}
if (node == null)
{
throw new ArgumentNullException("node");
}
foreach(XmlNode child in node.ChildNodes)
{
IDataNode dataNode = Kernel.Instance.ParseNode(child, this);
if(dataNode is OptionsNode)
{
m_Options = (OptionsNode)dataNode;
}
else if(dataNode is FilesNode)
{
m_Files = (FilesNode)dataNode;
}
else if(dataNode is ConfigurationNode)
{
ConfigurationNode configurationNode = (ConfigurationNode) dataNode;
m_Configurations[configurationNode.NameAndPlatform] = configurationNode;
// If the active configuration is null, then we populate it.
if (ActiveConfig == null)
{
ActiveConfig = configurationNode.Name;
}
}
else if(dataNode is ProjectNode)
{
m_Projects[((ProjectNode)dataNode).Name] = (ProjectNode) dataNode;
m_ProjectsOrder.Add((ProjectNode)dataNode);
}
else if(dataNode is SolutionNode)
foreach (XmlNode child in node.ChildNodes)
{
IDataNode dataNode = Kernel.Instance.ParseNode(child, this);
if (dataNode is OptionsNode)
{
m_Solutions[((SolutionNode)dataNode).Name] = (SolutionNode) dataNode;
m_Options = (OptionsNode)dataNode;
}
else if (dataNode is FilesNode)
{
m_Files = (FilesNode)dataNode;
}
else if (dataNode is ConfigurationNode)
{
ConfigurationNode configurationNode = (ConfigurationNode)dataNode;
m_Configurations[configurationNode.NameAndPlatform] = configurationNode;
// If the active configuration is null, then we populate it.
if (ActiveConfig == null)
{
ActiveConfig = configurationNode.Name;
}
}
else if (dataNode is ProjectNode)
{
m_Projects[((ProjectNode)dataNode).Name] = (ProjectNode)dataNode;
m_ProjectsOrder.Add((ProjectNode)dataNode);
}
else if (dataNode is SolutionNode)
{
m_Solutions[((SolutionNode)dataNode).Name] = (SolutionNode)dataNode;
}
else if (dataNode is ProcessNode)
{
@@ -361,22 +361,22 @@ namespace Prebuild.Core.Nodes
}
else if (dataNode is DatabaseProjectNode)
{
m_DatabaseProjects[((DatabaseProjectNode)dataNode).Name] = (DatabaseProjectNode) dataNode;
m_DatabaseProjects[((DatabaseProjectNode)dataNode).Name] = (DatabaseProjectNode)dataNode;
}
else if(dataNode is CleanupNode)
else if (dataNode is CleanupNode)
{
if(m_Cleanup != null)
if (m_Cleanup != null)
throw new WarningException("There can only be one Cleanup node.");
m_Cleanup = (CleanupNode)dataNode;
}
}
}
finally
{
Kernel.Instance.CurrentWorkingDirectory.Pop();
}
}
}
}
finally
{
Kernel.Instance.CurrentWorkingDirectory.Pop();
}
}
#endregion
}
#endregion
}
}
+112 -112
View File
@@ -27,128 +27,128 @@ using System;
namespace Prebuild.Core.Parse
{
/// <summary>
///
/// </summary>
public enum IfState
{
/// <summary>
///
/// </summary>
None,
/// <summary>
///
/// </summary>
If,
/// <summary>
///
/// </summary>
ElseIf,
/// <summary>
///
/// </summary>
Else
}
/// <summary>
///
/// </summary>
public enum IfState
{
/// <summary>
///
/// </summary>
None,
/// <summary>
///
/// </summary>
If,
/// <summary>
///
/// </summary>
ElseIf,
/// <summary>
///
/// </summary>
Else
}
/// <summary>
/// Summary description for IfContext.
/// </summary>
// Inspired by the equivalent WiX class (see www.sourceforge.net/projects/wix/)
public class IfContext
{
#region Properties
/// <summary>
/// Summary description for IfContext.
/// </summary>
// Inspired by the equivalent WiX class (see www.sourceforge.net/projects/wix/)
public class IfContext
{
#region Properties
bool m_Active;
bool m_Keep;
bool m_EverKept;
IfState m_State = IfState.None;
bool m_Active;
bool m_Keep;
bool m_EverKept;
IfState m_State = IfState.None;
#endregion
#endregion
#region Constructors
#region Constructors
/// <summary>
/// Initializes a new instance of the <see cref="IfContext"/> class.
/// </summary>
/// <param name="active">if set to <c>true</c> [active].</param>
/// <param name="keep">if set to <c>true</c> [keep].</param>
/// <param name="state">The state.</param>
public IfContext(bool active, bool keep, IfState state)
{
m_Active = active;
m_Keep = keep;
m_EverKept = keep;
m_State = state;
}
/// <summary>
/// Initializes a new instance of the <see cref="IfContext"/> class.
/// </summary>
/// <param name="active">if set to <c>true</c> [active].</param>
/// <param name="keep">if set to <c>true</c> [keep].</param>
/// <param name="state">The state.</param>
public IfContext(bool active, bool keep, IfState state)
{
m_Active = active;
m_Keep = keep;
m_EverKept = keep;
m_State = state;
}
#endregion
#endregion
#region Properties
#region Properties
/// <summary>
/// Gets or sets a value indicating whether this <see cref="IfContext"/> is active.
/// </summary>
/// <value><c>true</c> if active; otherwise, <c>false</c>.</value>
public bool Active
{
get
{
return m_Active;
}
set
{
m_Active = value;
}
}
/// <summary>
/// Gets or sets a value indicating whether this <see cref="IfContext"/> is active.
/// </summary>
/// <value><c>true</c> if active; otherwise, <c>false</c>.</value>
public bool Active
{
get
{
return m_Active;
}
set
{
m_Active = value;
}
}
/// <summary>
/// Gets or sets a value indicating whether this <see cref="IfContext"/> is keep.
/// </summary>
/// <value><c>true</c> if keep; otherwise, <c>false</c>.</value>
public bool Keep
{
get
{
return m_Keep;
}
set
{
m_Keep = value;
if(m_Keep)
{
m_EverKept = true;
}
}
}
/// <summary>
/// Gets or sets a value indicating whether this <see cref="IfContext"/> is keep.
/// </summary>
/// <value><c>true</c> if keep; otherwise, <c>false</c>.</value>
public bool Keep
{
get
{
return m_Keep;
}
set
{
m_Keep = value;
if (m_Keep)
{
m_EverKept = true;
}
}
}
/// <summary>
/// Gets a value indicating whether [ever kept].
/// </summary>
/// <value><c>true</c> if [ever kept]; otherwise, <c>false</c>.</value>
public bool EverKept
{
get
{
return m_EverKept;
}
}
/// <summary>
/// Gets a value indicating whether [ever kept].
/// </summary>
/// <value><c>true</c> if [ever kept]; otherwise, <c>false</c>.</value>
public bool EverKept
{
get
{
return m_EverKept;
}
}
/// <summary>
/// Gets or sets the state.
/// </summary>
/// <value>The state.</value>
public IfState State
{
get
{
return m_State;
}
set
{
m_State = value;
}
}
/// <summary>
/// Gets or sets the state.
/// </summary>
/// <value>The state.</value>
public IfState State
{
get
{
return m_State;
}
set
{
m_State = value;
}
}
#endregion
}
#endregion
}
}
File diff suppressed because it is too large Load Diff
+67 -60
View File
@@ -498,9 +498,9 @@ namespace Prebuild.Core.Targets
foreach (ProjectNode project in solution.ProjectsTableOrder)
{
m_Kernel.Log.Write(String.Format("Writing project: {0}",
project.Name));
WriteProject(solution, project);
m_Kernel.Log.Write(String.Format("Writing project: {0}",
project.Name));
WriteProject(solution, project);
}
}
@@ -509,12 +509,13 @@ namespace Prebuild.Core.Targets
{
foreach (ReferencePathNode refPath in project.ReferencePaths)
{
string fullPath =
Helper.MakeFilePath(refPath.Path, refName, "dll");
string fullPath =
Helper.MakeFilePath(refPath.Path, refName, "dll");
if (File.Exists(fullPath)) {
return fullPath;
}
if (File.Exists(fullPath))
{
return fullPath;
}
}
return null;
@@ -650,21 +651,24 @@ namespace Prebuild.Core.Targets
string tempAssemblyFile = Path.Combine(Path.GetTempPath(), project.Name + "-temp.dll");
System.CodeDom.Compiler.CompilerParameters cparam =
new System.CodeDom.Compiler.CompilerParameters(args, tempAssemblyFile);
System.CodeDom.Compiler.CompilerResults cr =
cscp.CompileAssemblyFromFile(cparam, sources);
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)
projectVersion = verMatch.Groups[1].Value;
}catch{
Console.WriteLine("Couldn't compile AssemblyInfo.cs");
try
{
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
@@ -673,11 +677,11 @@ namespace Prebuild.Core.Targets
if (File.Exists(tempAssemblyFile))
File.Delete(tempAssemblyFile);
}
catch
catch
{
Console.WriteLine("Error! '{0}'", e);
}
}
// Tell the user if there's a problem copying the file
@@ -719,7 +723,7 @@ namespace Prebuild.Core.Targets
if (packagesHash.ContainsKey(refr.Name))
{
package = packagesHash[refr.Name];
package = packagesHash[refr.Name];
}
else
@@ -794,32 +798,33 @@ namespace Prebuild.Core.Targets
}
catch (System.IO.IOException)
{
if (solution.ProjectsTable.ContainsKey(refr.Name)){
if (solution.ProjectsTable.ContainsKey(refr.Name))
{
/* If an assembly is referenced, marked for
* local copy, in the list of projects for
* this solution, but does not exist, put a
* target into the Makefile.am to build the
* assembly and copy it to this project's
* directory
*/
/* If an assembly is referenced, marked for
* local copy, in the list of projects for
* this solution, but does not exist, put a
* target into the Makefile.am to build the
* assembly and copy it to this project's
* directory
*/
ProjectNode sourcePrj =
((solution.ProjectsTable[refr.Name]));
ProjectNode sourcePrj =
((solution.ProjectsTable[refr.Name]));
string target =
String.Format("{0}:\n" +
"\t$(MAKE) -C ../{1}\n" +
"\tln ../{2}/$@ $@\n",
filename,
sourcePrj.Name,
sourcePrj.Name );
string target =
String.Format("{0}:\n" +
"\t$(MAKE) -C ../{1}\n" +
"\tln ../{2}/$@ $@\n",
filename,
sourcePrj.Name,
sourcePrj.Name);
localCopyTargets.Add(target);
}
localCopyTargets.Add(target);
}
}
}
else if( !pkgLibs.Contains(refr.Name) )
else if (!pkgLibs.Contains(refr.Name))
{
// Else, let's assume it's in the GAC or the lib path
string assemName = string.Empty;
@@ -975,27 +980,29 @@ namespace Prebuild.Core.Targets
Stream autotoolsStream = Assembly.GetExecutingAssembly()
.GetManifestResourceStream(fqStreamName);
if(autotoolsStream == null) {
if (autotoolsStream == null)
{
/*
* try without the default namespace prepended, in
* case prebuild.exe assembly was compiled with
* something other than Visual Studio .NET
*/
/*
* try without the default namespace prepended, in
* case prebuild.exe assembly was compiled with
* something other than Visual Studio .NET
*/
autotoolsStream = Assembly.GetExecutingAssembly()
.GetManifestResourceStream(streamName);
if(autotoolsStream == null){
string errStr =
String.Format("Could not find embedded resource file:\n" +
"'{0}' or '{1}'",
streamName, fqStreamName
);
autotoolsStream = Assembly.GetExecutingAssembly()
.GetManifestResourceStream(streamName);
if (autotoolsStream == null)
{
string errStr =
String.Format("Could not find embedded resource file:\n" +
"'{0}' or '{1}'",
streamName, fqStreamName
);
m_Kernel.Log.Write(errStr);
m_Kernel.Log.Write(errStr);
throw new System.Reflection.TargetException(errStr);
}
throw new System.Reflection.TargetException(errStr);
}
}
// Create an XML URL Resolver with default credentials
@@ -1028,9 +1035,9 @@ namespace Prebuild.Core.Targets
foreach (SolutionNode solution in kern.Solutions)
{
m_Kernel.Log.Write(String.Format("Writing solution: {0}",
solution.Name));
WriteCombine(solution);
m_Kernel.Log.Write(String.Format("Writing solution: {0}",
solution.Name));
WriteCombine(solution);
}
m_Kernel = null;
}
+406 -406
View File
@@ -35,67 +35,67 @@ using Prebuild.Core.Utilities;
namespace Prebuild.Core.Targets
{
/// <summary>
///
/// </summary>
[Target("monodev")]
public class MonoDevelopTarget : ITarget
{
#region Fields
/// <summary>
///
/// </summary>
[Target("monodev")]
public class MonoDevelopTarget : ITarget
{
#region Fields
private Kernel m_Kernel;
private Kernel m_Kernel;
#endregion
#endregion
#region Private Methods
#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);
}
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;
}
return tmpPath;
}
private static string BuildReference(SolutionNode solution, ReferenceNode refr)
{
string ret = "<ProjectReference type=\"";
if(solution.ProjectsTable.ContainsKey(refr.Name))
{
ret += "Project\"";
ret += " localcopy=\"" + refr.LocalCopy.ToString() + "\" refto=\"" + refr.Name + "\" />";
}
else
{
ProjectNode project = (ProjectNode)refr.Parent;
string fileRef = FindFileReference(refr.Name, project);
private static string BuildReference(SolutionNode solution, ReferenceNode refr)
{
string ret = "<ProjectReference type=\"";
if (solution.ProjectsTable.ContainsKey(refr.Name))
{
ret += "Project\"";
ret += " localcopy=\"" + refr.LocalCopy.ToString() + "\" refto=\"" + refr.Name + "\" />";
}
else
{
ProjectNode project = (ProjectNode)refr.Parent;
string fileRef = FindFileReference(refr.Name, project);
if(refr.Path != null || fileRef != null)
{
ret += "Assembly\" refto=\"";
if (refr.Path != null || fileRef != null)
{
ret += "Assembly\" refto=\"";
string finalPath = (refr.Path != null) ? Helper.MakeFilePath(refr.Path, refr.Name, "dll") : fileRef;
string finalPath = (refr.Path != null) ? Helper.MakeFilePath(refr.Path, refr.Name, "dll") : fileRef;
ret += finalPath;
ret += "\" localcopy=\"" + refr.LocalCopy.ToString() + "\" />";
return ret;
}
ret += finalPath;
ret += "\" localcopy=\"" + refr.LocalCopy.ToString() + "\" />";
return ret;
}
ret += "Gac\"";
ret += " localcopy=\"" + refr.LocalCopy.ToString() + "\"";
ret += " refto=\"";
try
{
/*
ret += "Gac\"";
ret += " localcopy=\"" + refr.LocalCopy.ToString() + "\"";
ret += " refto=\"";
try
{
/*
Day changed to 28 Mar 2007
...
08:09 < cj> is there anything that replaces Assembly.LoadFromPartialName() ?
@@ -110,406 +110,406 @@ namespace Prebuild.Core.Targets
08:12 < cj> alrighty.
08:12 < jonp> you just get warnings when using it
*/
Assembly assem = Assembly.LoadWithPartialName(refr.Name);
ret += assem.FullName;
Assembly assem = Assembly.LoadWithPartialName(refr.Name);
ret += assem.FullName;
//ret += refr.Name;
}
catch (System.NullReferenceException e)
{
e.ToString();
ret += refr.Name;
}
ret += "\" />";
}
}
catch (System.NullReferenceException e)
{
e.ToString();
ret += refr.Name;
}
ret += "\" />";
}
return ret;
}
return ret;
}
private static string FindFileReference(string refName, ProjectNode project)
{
foreach(ReferencePathNode refPath in project.ReferencePaths)
{
string fullPath = Helper.MakeFilePath(refPath.Path, refName, "dll");
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;
}
return null;
}
/// <summary>
/// Gets the XML doc file.
/// </summary>
/// <param name="project">The project.</param>
/// <param name="conf">The conf.</param>
/// <returns></returns>
public static string GenerateXmlDocFile(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 "False";
}
return "True";
}
/// <summary>
/// Gets the XML doc file.
/// </summary>
/// <param name="project">The project.</param>
/// <param name="conf">The conf.</param>
/// <returns></returns>
public static string GenerateXmlDocFile(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 "False";
}
return "True";
}
private void WriteProject(SolutionNode solution, ProjectNode project)
{
string csComp = "Mcs";
string netRuntime = "Mono";
if(project.Runtime == ClrRuntime.Microsoft)
{
csComp = "Csc";
netRuntime = "MsNet";
}
private void WriteProject(SolutionNode solution, ProjectNode project)
{
string csComp = "Mcs";
string netRuntime = "Mono";
if (project.Runtime == ClrRuntime.Microsoft)
{
csComp = "Csc";
netRuntime = "MsNet";
}
string projFile = Helper.MakeFilePath(project.FullPath, project.Name, "mdp");
StreamWriter ss = new StreamWriter(projFile);
string projFile = Helper.MakeFilePath(project.FullPath, project.Name, "mdp");
StreamWriter ss = new StreamWriter(projFile);
m_Kernel.CurrentWorkingDirectory.Push();
Helper.SetCurrentDir(Path.GetDirectoryName(projFile));
m_Kernel.CurrentWorkingDirectory.Push();
Helper.SetCurrentDir(Path.GetDirectoryName(projFile));
using(ss)
{
ss.WriteLine(
"<Project name=\"{0}\" description=\"\" standardNamespace=\"{1}\" newfilesearch=\"None\" enableviewstate=\"True\" fileversion=\"2.0\" language=\"C#\" clr-version=\"Net_2_0\" ctype=\"DotNetProject\">",
project.Name,
project.RootNamespace
);
int count = 0;
ss.WriteLine(" <Configurations active=\"{0}\">", solution.ActiveConfig);
using (ss)
{
ss.WriteLine(
"<Project name=\"{0}\" description=\"\" standardNamespace=\"{1}\" newfilesearch=\"None\" enableviewstate=\"True\" fileversion=\"2.0\" language=\"C#\" clr-version=\"Net_2_0\" ctype=\"DotNetProject\">",
project.Name,
project.RootNamespace
);
foreach(ConfigurationNode conf in project.Configurations)
{
ss.WriteLine(" <Configuration name=\"{0}\" ctype=\"DotNetProjectConfiguration\">", conf.Name);
ss.Write(" <Output");
ss.Write(" directory=\"{0}\"", Helper.EndPath(Helper.NormalizePath(".\\" + conf.Options["OutputPath"].ToString())));
ss.Write(" assembly=\"{0}\"", project.AssemblyName);
ss.Write(" executeScript=\"{0}\"", conf.Options["RunScript"]);
//ss.Write(" executeBeforeBuild=\"{0}\"", conf.Options["PreBuildEvent"]);
//ss.Write(" executeAfterBuild=\"{0}\"", conf.Options["PostBuildEvent"]);
if (conf.Options["PreBuildEvent"] != null && conf.Options["PreBuildEvent"].ToString().Length != 0)
{
ss.Write(" executeBeforeBuild=\"{0}\"", Helper.NormalizePath(conf.Options["PreBuildEvent"].ToString()));
}
else
{
ss.Write(" executeBeforeBuild=\"{0}\"", conf.Options["PreBuildEvent"]);
}
if (conf.Options["PostBuildEvent"] != null && conf.Options["PostBuildEvent"].ToString().Length != 0)
{
ss.Write(" executeAfterBuild=\"{0}\"", Helper.NormalizePath(conf.Options["PostBuildEvent"].ToString()));
}
else
{
ss.Write(" executeAfterBuild=\"{0}\"", conf.Options["PostBuildEvent"]);
}
ss.Write(" executeBeforeBuildArguments=\"{0}\"", conf.Options["PreBuildEventArgs"]);
ss.Write(" executeAfterBuildArguments=\"{0}\"", conf.Options["PreBuildEventArgs"]);
ss.WriteLine(" />");
ss.Write(" <Build");
ss.Write(" debugmode=\"True\"");
if (project.Type == ProjectType.WinExe)
{
ss.Write(" target=\"{0}\"", ProjectType.Exe.ToString());
}
else
{
ss.Write(" target=\"{0}\"", project.Type);
}
ss.WriteLine(" />");
ss.Write(" <Execution");
ss.Write(" runwithwarnings=\"{0}\"", !conf.Options.WarningsAsErrors);
ss.Write(" consolepause=\"True\"");
ss.Write(" runtime=\"{0}\"", netRuntime);
int count = 0;
ss.WriteLine(" <Configurations active=\"{0}\">", solution.ActiveConfig);
foreach (ConfigurationNode conf in project.Configurations)
{
ss.WriteLine(" <Configuration name=\"{0}\" ctype=\"DotNetProjectConfiguration\">", conf.Name);
ss.Write(" <Output");
ss.Write(" directory=\"{0}\"", Helper.EndPath(Helper.NormalizePath(".\\" + conf.Options["OutputPath"].ToString())));
ss.Write(" assembly=\"{0}\"", project.AssemblyName);
ss.Write(" executeScript=\"{0}\"", conf.Options["RunScript"]);
//ss.Write(" executeBeforeBuild=\"{0}\"", conf.Options["PreBuildEvent"]);
//ss.Write(" executeAfterBuild=\"{0}\"", conf.Options["PostBuildEvent"]);
if (conf.Options["PreBuildEvent"] != null && conf.Options["PreBuildEvent"].ToString().Length != 0)
{
ss.Write(" executeBeforeBuild=\"{0}\"", Helper.NormalizePath(conf.Options["PreBuildEvent"].ToString()));
}
else
{
ss.Write(" executeBeforeBuild=\"{0}\"", conf.Options["PreBuildEvent"]);
}
if (conf.Options["PostBuildEvent"] != null && conf.Options["PostBuildEvent"].ToString().Length != 0)
{
ss.Write(" executeAfterBuild=\"{0}\"", Helper.NormalizePath(conf.Options["PostBuildEvent"].ToString()));
}
else
{
ss.Write(" executeAfterBuild=\"{0}\"", conf.Options["PostBuildEvent"]);
}
ss.Write(" executeBeforeBuildArguments=\"{0}\"", conf.Options["PreBuildEventArgs"]);
ss.Write(" executeAfterBuildArguments=\"{0}\"", conf.Options["PreBuildEventArgs"]);
ss.WriteLine(" />");
ss.Write(" <Build");
ss.Write(" debugmode=\"True\"");
if (project.Type == ProjectType.WinExe)
{
ss.Write(" target=\"{0}\"", ProjectType.Exe.ToString());
}
else
{
ss.Write(" target=\"{0}\"", project.Type);
}
ss.WriteLine(" />");
ss.Write(" <Execution");
ss.Write(" runwithwarnings=\"{0}\"", !conf.Options.WarningsAsErrors);
ss.Write(" consolepause=\"True\"");
ss.Write(" runtime=\"{0}\"", netRuntime);
ss.Write(" clr-version=\"Net_2_0\"");
ss.WriteLine(" />");
ss.Write(" <CodeGeneration");
ss.Write(" compiler=\"{0}\"", csComp);
ss.Write(" warninglevel=\"{0}\"", conf.Options["WarningLevel"]);
ss.Write(" nowarn=\"{0}\"", conf.Options["SuppressWarnings"]);
ss.Write(" includedebuginformation=\"{0}\"", conf.Options["DebugInformation"]);
ss.Write(" optimize=\"{0}\"", conf.Options["OptimizeCode"]);
ss.Write(" unsafecodeallowed=\"{0}\"", conf.Options["AllowUnsafe"]);
ss.Write(" generateoverflowchecks=\"{0}\"", conf.Options["CheckUnderflowOverflow"]);
ss.Write(" mainclass=\"{0}\"", project.StartupObject);
ss.Write(" target=\"{0}\"", project.Type);
ss.Write(" definesymbols=\"{0}\"", conf.Options["CompilerDefines"]);
ss.Write(" generatexmldocumentation=\"{0}\"", GenerateXmlDocFile(project, conf));
ss.Write(" win32Icon=\"{0}\"", project.AppIcon);
ss.Write(" ctype=\"CSharpCompilerParameters\"");
ss.WriteLine(" />");
ss.WriteLine(" </Configuration>");
ss.WriteLine(" />");
count++;
}
ss.WriteLine(" </Configurations>");
ss.Write(" <CodeGeneration");
ss.Write(" compiler=\"{0}\"", csComp);
ss.Write(" warninglevel=\"{0}\"", conf.Options["WarningLevel"]);
ss.Write(" nowarn=\"{0}\"", conf.Options["SuppressWarnings"]);
ss.Write(" includedebuginformation=\"{0}\"", conf.Options["DebugInformation"]);
ss.Write(" optimize=\"{0}\"", conf.Options["OptimizeCode"]);
ss.Write(" unsafecodeallowed=\"{0}\"", conf.Options["AllowUnsafe"]);
ss.Write(" generateoverflowchecks=\"{0}\"", conf.Options["CheckUnderflowOverflow"]);
ss.Write(" mainclass=\"{0}\"", project.StartupObject);
ss.Write(" target=\"{0}\"", project.Type);
ss.Write(" definesymbols=\"{0}\"", conf.Options["CompilerDefines"]);
ss.Write(" generatexmldocumentation=\"{0}\"", GenerateXmlDocFile(project, conf));
ss.Write(" win32Icon=\"{0}\"", project.AppIcon);
ss.Write(" ctype=\"CSharpCompilerParameters\"");
ss.WriteLine(" />");
ss.WriteLine(" </Configuration>");
ss.Write(" <DeploymentInformation");
ss.Write(" target=\"\"");
ss.Write(" script=\"\"");
ss.Write(" strategy=\"File\"");
ss.WriteLine(">");
ss.WriteLine(" <excludeFiles />");
ss.WriteLine(" </DeploymentInformation>");
ss.WriteLine(" <Contents>");
foreach(string file in project.Files)
{
string buildAction;
string dependson = "";
string resource_id = "";
string copyToOutput = "";
switch(project.Files.GetBuildAction(file))
{
case BuildAction.None:
buildAction = "Nothing";
break;
count++;
}
ss.WriteLine(" </Configurations>");
case BuildAction.Content:
buildAction = "Exclude";
break;
ss.Write(" <DeploymentInformation");
ss.Write(" target=\"\"");
ss.Write(" script=\"\"");
ss.Write(" strategy=\"File\"");
ss.WriteLine(">");
ss.WriteLine(" <excludeFiles />");
ss.WriteLine(" </DeploymentInformation>");
case BuildAction.EmbeddedResource:
buildAction = "EmbedAsResource";
break;
ss.WriteLine(" <Contents>");
foreach (string file in project.Files)
{
string buildAction;
string dependson = "";
string resource_id = "";
string copyToOutput = "";
default:
buildAction = "Compile";
break;
}
switch (project.Files.GetBuildAction(file))
{
case BuildAction.None:
buildAction = "Nothing";
break;
case BuildAction.Content:
buildAction = "Exclude";
break;
case BuildAction.EmbeddedResource:
buildAction = "EmbedAsResource";
break;
default:
buildAction = "Compile";
break;
}
if (project.Files.GetCopyToOutput(file) != CopyToOutput.Never)
buildAction = "FileCopy";
buildAction = "FileCopy";
// Sort of a hack, we try and resolve the path and make it relative, if we can.
string extension = Path.GetExtension(file);
string designer_format = string.Format(".Designer{0}", extension);
// Sort of a hack, we try and resolve the path and make it relative, if we can.
string extension = Path.GetExtension(file);
string designer_format = string.Format(".Designer{0}", extension);
if (file.EndsWith(designer_format))
{
string basename = file.Substring(0, file.LastIndexOf(designer_format));
string[] extensions = new string[] { ".cs", ".resx", ".settings" };
if (file.EndsWith(designer_format))
{
string basename = file.Substring(0, file.LastIndexOf(designer_format));
string[] extensions = new string[] { ".cs", ".resx", ".settings" };
foreach(string ext in extensions)
{
if (project.Files.Contains(basename + ext))
{
dependson = string.Format(" dependson=\"{0}{1}\"", basename, ext);
break;
}
}
}
if (extension == ".resx")
{
buildAction = "EmbedAsResource";
string basename = file.Substring(0, file.LastIndexOf(".resx"));
// Visual Studio type resx + form dependency
if (project.Files.Contains(basename + ".cs"))
{
dependson = string.Format(" dependson=\"{0}{1}\"", basename, ".cs");
}
foreach (string ext in extensions)
{
if (project.Files.Contains(basename + ext))
{
dependson = string.Format(" dependson=\"{0}{1}\"", basename, ext);
break;
}
}
}
if (extension == ".resx")
{
buildAction = "EmbedAsResource";
string basename = file.Substring(0, file.LastIndexOf(".resx"));
// We need to specify a resources file name to avoid MissingManifestResourceExceptions
// in libraries that are built.
resource_id = string.Format(" resource_id=\"{0}.{1}.resources\"",
project.AssemblyName, basename.Replace("/", "."));
}
// Visual Studio type resx + form dependency
if (project.Files.Contains(basename + ".cs"))
{
dependson = string.Format(" dependson=\"{0}{1}\"", basename, ".cs");
}
switch(project.Files.GetCopyToOutput(file))
{
case CopyToOutput.Always:
copyToOutput = string.Format(" copyToOutputDirectory=\"Always\"");
break;
case CopyToOutput.PreserveNewest:
copyToOutput = string.Format(" copyToOutputDirectory=\"PreserveNewest\"");
break;
}
// Sort of a hack, we try and resolve the path and make it relative, if we can.
string filePath = PrependPath(file);
ss.WriteLine(" <File name=\"{0}\" subtype=\"Code\" buildaction=\"{1}\"{2}{3}{4} />",
filePath, buildAction, dependson, resource_id, copyToOutput);
}
ss.WriteLine(" </Contents>");
// We need to specify a resources file name to avoid MissingManifestResourceExceptions
// in libraries that are built.
resource_id = string.Format(" resource_id=\"{0}.{1}.resources\"",
project.AssemblyName, basename.Replace("/", "."));
}
ss.WriteLine(" <References>");
foreach(ReferenceNode refr in project.References)
{
ss.WriteLine(" {0}", BuildReference(solution, refr));
}
ss.WriteLine(" </References>");
switch (project.Files.GetCopyToOutput(file))
{
case CopyToOutput.Always:
copyToOutput = string.Format(" copyToOutputDirectory=\"Always\"");
break;
case CopyToOutput.PreserveNewest:
copyToOutput = string.Format(" copyToOutputDirectory=\"PreserveNewest\"");
break;
}
// Sort of a hack, we try and resolve the path and make it relative, if we can.
string filePath = PrependPath(file);
ss.WriteLine(" <File name=\"{0}\" subtype=\"Code\" buildaction=\"{1}\"{2}{3}{4} />",
filePath, buildAction, dependson, resource_id, copyToOutput);
}
ss.WriteLine(" </Contents>");
ss.WriteLine(" <References>");
foreach (ReferenceNode refr in project.References)
{
ss.WriteLine(" {0}", BuildReference(solution, refr));
}
ss.WriteLine(" </References>");
ss.WriteLine("</Project>");
}
ss.WriteLine("</Project>");
}
m_Kernel.CurrentWorkingDirectory.Pop();
}
m_Kernel.CurrentWorkingDirectory.Pop();
}
private void WriteCombine(SolutionNode solution)
{
m_Kernel.Log.Write("Creating MonoDevelop combine and project 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);
}
}
private void WriteCombine(SolutionNode solution)
{
m_Kernel.Log.Write("Creating MonoDevelop combine and project 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, "mds");
StreamWriter ss = new StreamWriter(combFile);
m_Kernel.Log.Write("");
string combFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "mds");
StreamWriter ss = new StreamWriter(combFile);
m_Kernel.CurrentWorkingDirectory.Push();
Helper.SetCurrentDir(Path.GetDirectoryName(combFile));
m_Kernel.CurrentWorkingDirectory.Push();
Helper.SetCurrentDir(Path.GetDirectoryName(combFile));
int count = 0;
using(ss)
{
ss.WriteLine("<Combine name=\"{0}\" fileversion=\"2.0\" description=\"\">", solution.Name);
count = 0;
foreach(ConfigurationNode conf in solution.Configurations)
{
if(count == 0)
{
ss.WriteLine(" <Configurations active=\"{0}\">", conf.Name);
}
using (ss)
{
ss.WriteLine("<Combine name=\"{0}\" fileversion=\"2.0\" description=\"\">", solution.Name);
ss.WriteLine(" <Configuration name=\"{0}\" ctype=\"CombineConfiguration\">", conf.Name);
foreach(ProjectNode project in solution.Projects)
{
ss.WriteLine(" <Entry configuration=\"{1}\" build=\"True\" name=\"{0}\" />", project.Name, conf.Name);
}
ss.WriteLine(" </Configuration>");
count = 0;
foreach (ConfigurationNode conf in solution.Configurations)
{
if (count == 0)
{
ss.WriteLine(" <Configurations active=\"{0}\">", conf.Name);
}
count++;
}
ss.WriteLine(" </Configurations>");
count = 0;
foreach(ProjectNode project in solution.Projects)
{
if(count == 0)
ss.WriteLine(" <StartMode startupentry=\"{0}\" single=\"True\">", project.Name);
ss.WriteLine(" <Configuration name=\"{0}\" ctype=\"CombineConfiguration\">", conf.Name);
foreach (ProjectNode project in solution.Projects)
{
ss.WriteLine(" <Entry configuration=\"{1}\" build=\"True\" name=\"{0}\" />", project.Name, conf.Name);
}
ss.WriteLine(" </Configuration>");
ss.WriteLine(" <Execute type=\"None\" entry=\"{0}\" />", project.Name);
count++;
}
ss.WriteLine(" </StartMode>");
ss.WriteLine(" <Entries>");
foreach(ProjectNode project in solution.Projects)
{
string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath);
ss.WriteLine(" <Entry filename=\"{0}\" />",
Helper.MakeFilePath(path, project.Name, "mdp"));
}
ss.WriteLine(" </Entries>");
ss.WriteLine("</Combine>");
}
count++;
}
ss.WriteLine(" </Configurations>");
m_Kernel.CurrentWorkingDirectory.Pop();
}
count = 0;
private void CleanProject(ProjectNode project)
{
m_Kernel.Log.Write("...Cleaning project: {0}", project.Name);
string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, "mdp");
Helper.DeleteIfExists(projectFile);
}
foreach (ProjectNode project in solution.Projects)
{
if (count == 0)
ss.WriteLine(" <StartMode startupentry=\"{0}\" single=\"True\">", project.Name);
private void CleanSolution(SolutionNode solution)
{
m_Kernel.Log.Write("Cleaning MonoDevelop combine and project files for", solution.Name);
ss.WriteLine(" <Execute type=\"None\" entry=\"{0}\" />", project.Name);
count++;
}
ss.WriteLine(" </StartMode>");
string slnFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "mds");
Helper.DeleteIfExists(slnFile);
ss.WriteLine(" <Entries>");
foreach (ProjectNode project in solution.Projects)
{
string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath);
ss.WriteLine(" <Entry filename=\"{0}\" />",
Helper.MakeFilePath(path, project.Name, "mdp"));
}
ss.WriteLine(" </Entries>");
foreach(ProjectNode project in solution.Projects)
{
CleanProject(project);
}
m_Kernel.Log.Write("");
}
ss.WriteLine("</Combine>");
}
#endregion
m_Kernel.CurrentWorkingDirectory.Pop();
}
#region ITarget Members
private void CleanProject(ProjectNode project)
{
m_Kernel.Log.Write("...Cleaning project: {0}", project.Name);
string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, "mdp");
Helper.DeleteIfExists(projectFile);
}
/// <summary>
/// Writes the specified kern.
/// </summary>
/// <param name="kern">The kern.</param>
public void Write(Kernel kern)
{
if( kern == null )
{
throw new ArgumentNullException("kern");
}
m_Kernel = kern;
foreach(SolutionNode solution in kern.Solutions)
{
WriteCombine(solution);
}
m_Kernel = null;
}
private void CleanSolution(SolutionNode solution)
{
m_Kernel.Log.Write("Cleaning MonoDevelop combine and project files for", solution.Name);
/// <summary>
/// Cleans the specified kern.
/// </summary>
/// <param name="kern">The kern.</param>
public virtual void Clean(Kernel kern)
{
if( kern == null )
{
throw new ArgumentNullException("kern");
}
m_Kernel = kern;
foreach(SolutionNode sol in kern.Solutions)
{
CleanSolution(sol);
}
m_Kernel = null;
}
string slnFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "mds");
Helper.DeleteIfExists(slnFile);
/// <summary>
/// Gets the name.
/// </summary>
/// <value>The name.</value>
public string Name
{
get
{
return "sharpdev";
}
}
foreach (ProjectNode project in solution.Projects)
{
CleanProject(project);
}
#endregion
}
m_Kernel.Log.Write("");
}
#endregion
#region ITarget Members
/// <summary>
/// Writes the specified kern.
/// </summary>
/// <param name="kern">The kern.</param>
public void Write(Kernel kern)
{
if (kern == null)
{
throw new ArgumentNullException("kern");
}
m_Kernel = kern;
foreach (SolutionNode solution in kern.Solutions)
{
WriteCombine(solution);
}
m_Kernel = null;
}
/// <summary>
/// Cleans the specified kern.
/// </summary>
/// <param name="kern">The kern.</param>
public virtual void Clean(Kernel kern)
{
if (kern == null)
{
throw new ArgumentNullException("kern");
}
m_Kernel = kern;
foreach (SolutionNode sol in kern.Solutions)
{
CleanSolution(sol);
}
m_Kernel = null;
}
/// <summary>
/// Gets the name.
/// </summary>
/// <value>The name.</value>
public string Name
{
get
{
return "sharpdev";
}
}
#endregion
}
}
+367 -366
View File
@@ -47,36 +47,36 @@ using Prebuild.Core.Utilities;
namespace Prebuild.Core.Targets
{
/// <summary>
///
/// </summary>
[Target("nant")]
public class NAntTarget : ITarget
{
#region Fields
/// <summary>
///
/// </summary>
[Target("nant")]
public class NAntTarget : ITarget
{
#region Fields
private Kernel m_Kernel;
private Kernel m_Kernel;
#endregion
#endregion
#region Private Methods
#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);
// }
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;
}
return tmpPath;
}
private static string BuildReference(SolutionNode solution, ProjectNode currentProject, ReferenceNode refr)
{
@@ -85,16 +85,16 @@ namespace Prebuild.Core.Targets
{
return refr.Path;
}
if (solution.ProjectsTable.ContainsKey(refr.Name))
{
ProjectNode projectRef = (ProjectNode) solution.ProjectsTable[refr.Name];
ProjectNode projectRef = (ProjectNode)solution.ProjectsTable[refr.Name];
string finalPath =
Helper.NormalizePath(refr.Name + GetProjectExtension(projectRef), '/');
return finalPath;
}
ProjectNode project = (ProjectNode) refr.Parent;
ProjectNode project = (ProjectNode)refr.Parent;
// Do we have an explicit file reference?
string fileRef = FindFileReference(refr.Name, project);
@@ -113,7 +113,7 @@ namespace Prebuild.Core.Targets
return refr.Name + ".dll";
}
public static string GetRefFileName(string refName)
public static string GetRefFileName(string refName)
{
if (ExtensionSpecified(refName))
{
@@ -140,11 +140,11 @@ namespace Prebuild.Core.Targets
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 FindFileReference(string refName, ProjectNode project)
{
foreach (ReferencePathNode refPath in project.ReferencePaths)
{
string fullPath = Helper.MakeFilePath(refPath.Path, refName);
if (File.Exists(fullPath))
{
@@ -153,10 +153,10 @@ namespace Prebuild.Core.Targets
fullPath = Helper.MakeFilePath(refPath.Path, refName, "dll");
if (File.Exists(fullPath))
{
return fullPath;
}
if (File.Exists(fullPath))
{
return fullPath;
}
fullPath = Helper.MakeFilePath(refPath.Path, refName, "exe");
@@ -164,225 +164,226 @@ namespace Prebuild.Core.Targets
{
return fullPath;
}
}
}
return null;
}
return null;
}
/// <summary>
/// Gets the XML doc file.
/// </summary>
/// <param name="project">The project.</param>
/// <param name="conf">The conf.</param>
/// <returns></returns>
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;
}
/// <summary>
/// Gets the XML doc file.
/// </summary>
/// <param name="project">The project.</param>
/// <param name="conf">The conf.</param>
/// <returns></returns>
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)
{
private void WriteProject(SolutionNode solution, ProjectNode project)
{
string projFile = Helper.MakeFilePath(project.FullPath, project.Name + GetProjectExtension(project), "build");
StreamWriter ss = new StreamWriter(projFile);
StreamWriter ss = new StreamWriter(projFile);
m_Kernel.CurrentWorkingDirectory.Push();
Helper.SetCurrentDir(Path.GetDirectoryName(projFile));
bool hasDoc = false;
m_Kernel.CurrentWorkingDirectory.Push();
Helper.SetCurrentDir(Path.GetDirectoryName(projFile));
bool hasDoc = false;
using (ss)
{
ss.WriteLine("<?xml version=\"1.0\" ?>");
ss.WriteLine("<project name=\"{0}\" default=\"build\">", project.Name);
ss.WriteLine(" <target name=\"{0}\">", "build");
ss.WriteLine(" <echo message=\"Build Directory is ${project::get-base-directory()}/${build.dir}\" />");
ss.WriteLine(" <mkdir dir=\"${project::get-base-directory()}/${build.dir}\" />");
ss.WriteLine(" <copy todir=\"${project::get-base-directory()}/${build.dir}\" flatten=\"true\">");
ss.WriteLine(" <fileset basedir=\"${project::get-base-directory()}\">");
foreach (ReferenceNode refr in project.References)
{
if (refr.LocalCopy)
{
ss.WriteLine(" <include name=\"{0}", Helper.NormalizePath(Helper.MakePathRelativeTo(project.FullPath, BuildReference(solution, project, refr)) + "\" />", '/'));
}
}
ss.WriteLine(" </fileset>");
ss.WriteLine(" </copy>");
if (project.ConfigFile != null && project.ConfigFile.Length!=0)
{
ss.Write(" <copy file=\"" + project.ConfigFile + "\" tofile=\"${project::get-base-directory()}/${build.dir}/${project::get-name()}");
using (ss)
{
ss.WriteLine("<?xml version=\"1.0\" ?>");
ss.WriteLine("<project name=\"{0}\" default=\"build\">", project.Name);
ss.WriteLine(" <target name=\"{0}\">", "build");
ss.WriteLine(" <echo message=\"Build Directory is ${project::get-base-directory()}/${build.dir}\" />");
ss.WriteLine(" <mkdir dir=\"${project::get-base-directory()}/${build.dir}\" />");
ss.WriteLine(" <copy todir=\"${project::get-base-directory()}/${build.dir}\" flatten=\"true\">");
ss.WriteLine(" <fileset basedir=\"${project::get-base-directory()}\">");
foreach (ReferenceNode refr in project.References)
{
if (refr.LocalCopy)
{
ss.WriteLine(" <include name=\"{0}", Helper.NormalizePath(Helper.MakePathRelativeTo(project.FullPath, BuildReference(solution, project, refr)) + "\" />", '/'));
}
}
if (project.Type == ProjectType.Library)
{
ss.Write(".dll.config\"");
}
else
{
ss.Write(".exe.config\"");
}
ss.WriteLine(" />");
}
ss.WriteLine(" </fileset>");
ss.WriteLine(" </copy>");
if (project.ConfigFile != null && project.ConfigFile.Length != 0)
{
ss.Write(" <copy file=\"" + project.ConfigFile + "\" tofile=\"${project::get-base-directory()}/${build.dir}/${project::get-name()}");
// Add the content files to just be copied
ss.WriteLine(" {0}", "<copy todir=\"${project::get-base-directory()}/${build.dir}\">");
ss.WriteLine(" {0}", "<fileset basedir=\".\">");
foreach (string file in project.Files)
{
// Ignore if we aren't content
if (project.Files.GetBuildAction(file) != BuildAction.Content)
continue;
if (project.Type == ProjectType.Library)
{
ss.Write(".dll.config\"");
}
else
{
ss.Write(".exe.config\"");
}
ss.WriteLine(" />");
}
// Create a include tag
ss.WriteLine(" {0}", "<include name=\"" + Helper.NormalizePath(PrependPath(file), '/') + "\" />");
}
// Add the content files to just be copied
ss.WriteLine(" {0}", "<copy todir=\"${project::get-base-directory()}/${build.dir}\">");
ss.WriteLine(" {0}", "<fileset basedir=\".\">");
ss.WriteLine(" {0}", "</fileset>");
ss.WriteLine(" {0}", "</copy>");
foreach (string file in project.Files)
{
// Ignore if we aren't content
if (project.Files.GetBuildAction(file) != BuildAction.Content)
continue;
ss.Write(" <csc ");
ss.Write(" target=\"{0}\"", project.Type.ToString().ToLower());
ss.Write(" debug=\"{0}\"", "${build.debug}");
ss.Write(" platform=\"${build.platform}\"");
// Create a include tag
ss.WriteLine(" {0}", "<include name=\"" + Helper.NormalizePath(PrependPath(file), '/') + "\" />");
}
ss.WriteLine(" {0}", "</fileset>");
ss.WriteLine(" {0}", "</copy>");
ss.Write(" <csc ");
ss.Write(" target=\"{0}\"", project.Type.ToString().ToLower());
ss.Write(" debug=\"{0}\"", "${build.debug}");
ss.Write(" platform=\"${build.platform}\"");
foreach (ConfigurationNode conf in project.Configurations)
{
if (conf.Options.KeyFile != "")
{
ss.Write(" keyfile=\"{0}\"", conf.Options.KeyFile);
break;
}
}
foreach (ConfigurationNode conf in project.Configurations)
{
ss.Write(" unsafe=\"{0}\"", conf.Options.AllowUnsafe);
break;
}
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;
}
foreach (ConfigurationNode conf in project.Configurations)
{
ss.Write(" nostdlib=\"{0}\"", conf.Options["NoStdLib"]);
break;
}
foreach (ConfigurationNode conf in project.Configurations)
{
if (conf.Options.KeyFile != "")
{
ss.Write(" keyfile=\"{0}\"", conf.Options.KeyFile);
break;
}
}
foreach (ConfigurationNode conf in project.Configurations)
{
ss.Write(" unsafe=\"{0}\"", conf.Options.AllowUnsafe);
break;
}
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;
}
foreach (ConfigurationNode conf in project.Configurations)
{
ss.Write(" nostdlib=\"{0}\"", conf.Options["NoStdLib"]);
break;
}
ss.Write(" main=\"{0}\"", project.StartupObject);
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, '/'));
}
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, '/'));
}
// This disables a very different behavior between VS and NAnt. With Nant,
// If you have using System.Xml; it will ensure System.Xml.dll is referenced,
// but not in VS. This will force the behaviors to match, so when it works
// in nant, it will work in VS.
ss.Write(" noconfig=\"true\"");
ss.WriteLine(">");
ss.WriteLine(" <resources prefix=\"{0}\" dynamicprefix=\"true\" >", project.RootNamespace);
foreach (string file in project.Files)
{
switch (project.Files.GetBuildAction(file))
{
case BuildAction.EmbeddedResource:
ss.WriteLine(" {0}", "<include name=\"" + Helper.NormalizePath(PrependPath(file), '/') + "\" />");
break;
default:
if (project.Files.GetSubType(file) != SubType.Code && project.Files.GetSubType(file) != SubType.Settings)
{
ss.WriteLine(" <include name=\"{0}\" />", file.Substring(0, file.LastIndexOf('.')) + ".resx");
}
break;
}
}
//if (project.Files.GetSubType(file).ToString() != "Code")
//{
// ps.WriteLine(" <EmbeddedResource Include=\"{0}\">", file.Substring(0, file.LastIndexOf('.')) + ".resx");
ss.WriteLine(" <resources prefix=\"{0}\" dynamicprefix=\"true\" >", project.RootNamespace);
foreach (string file in project.Files)
{
switch (project.Files.GetBuildAction(file))
{
case BuildAction.EmbeddedResource:
ss.WriteLine(" {0}", "<include name=\"" + Helper.NormalizePath(PrependPath(file), '/') + "\" />");
break;
default:
if (project.Files.GetSubType(file) != SubType.Code && project.Files.GetSubType(file) != SubType.Settings)
{
ss.WriteLine(" <include name=\"{0}\" />", file.Substring(0, file.LastIndexOf('.')) + ".resx");
}
break;
}
}
//if (project.Files.GetSubType(file).ToString() != "Code")
//{
// ps.WriteLine(" <EmbeddedResource Include=\"{0}\">", file.Substring(0, file.LastIndexOf('.')) + ".resx");
ss.WriteLine(" </resources>");
ss.WriteLine(" <sources failonempty=\"true\">");
foreach (string file in project.Files)
{
switch (project.Files.GetBuildAction(file))
{
case BuildAction.Compile:
ss.WriteLine(" <include name=\"" + Helper.NormalizePath(PrependPath(file), '/') + "\" />");
break;
default:
break;
}
}
ss.WriteLine(" </sources>");
ss.WriteLine(" <references basedir=\"${project::get-base-directory()}\">");
ss.WriteLine(" <lib>");
ss.WriteLine(" <include name=\"${project::get-base-directory()}\" />");
foreach(ReferencePathNode refPath in project.ReferencePaths)
ss.WriteLine(" </resources>");
ss.WriteLine(" <sources failonempty=\"true\">");
foreach (string file in project.Files)
{
switch (project.Files.GetBuildAction(file))
{
case BuildAction.Compile:
ss.WriteLine(" <include name=\"" + Helper.NormalizePath(PrependPath(file), '/') + "\" />");
break;
default:
break;
}
}
ss.WriteLine(" </sources>");
ss.WriteLine(" <references basedir=\"${project::get-base-directory()}\">");
ss.WriteLine(" <lib>");
ss.WriteLine(" <include name=\"${project::get-base-directory()}\" />");
foreach (ReferencePathNode refPath in project.ReferencePaths)
{
ss.WriteLine(" <include name=\"${project::get-base-directory()}/" + refPath.Path.TrimEnd('/', '\\') + "\" />");
}
ss.WriteLine(" </lib>");
foreach (ReferenceNode refr in project.References)
{
string path = Helper.NormalizePath(Helper.MakePathRelativeTo(project.FullPath, BuildReference(solution, project, refr)), '/');
if (refr.Path != null) {
ss.WriteLine(" </lib>");
foreach (ReferenceNode refr in project.References)
{
string path = Helper.NormalizePath(Helper.MakePathRelativeTo(project.FullPath, BuildReference(solution, project, refr)), '/');
if (refr.Path != null)
{
if (ExtensionSpecified(refr.Name))
{
ss.WriteLine (" <include name=\"" + path + refr.Name + "\"/>");
ss.WriteLine(" <include name=\"" + path + refr.Name + "\"/>");
}
else
{
ss.WriteLine (" <include name=\"" + path + refr.Name + ".dll\"/>");
ss.WriteLine(" <include name=\"" + path + refr.Name + ".dll\"/>");
}
}
else
{
ss.WriteLine (" <include name=\"" + path + "\" />");
ss.WriteLine(" <include name=\"" + path + "\" />");
}
}
ss.WriteLine(" </references>");
}
ss.WriteLine(" </references>");
ss.WriteLine(" </csc>");
ss.WriteLine(" </csc>");
foreach (ConfigurationNode conf in project.Configurations)
foreach (ConfigurationNode conf in project.Configurations)
{
if (!String.IsNullOrEmpty(conf.Options.OutputPath))
{
@@ -404,170 +405,170 @@ namespace Prebuild.Core.Targets
}
}
ss.WriteLine(" </target>");
ss.WriteLine(" </target>");
ss.WriteLine(" <target name=\"clean\">");
ss.WriteLine(" <delete dir=\"${bin.dir}\" failonerror=\"false\" />");
ss.WriteLine(" <delete dir=\"${obj.dir}\" failonerror=\"false\" />");
ss.WriteLine(" </target>");
ss.WriteLine(" <target name=\"clean\">");
ss.WriteLine(" <delete dir=\"${bin.dir}\" failonerror=\"false\" />");
ss.WriteLine(" <delete dir=\"${obj.dir}\" failonerror=\"false\" />");
ss.WriteLine(" </target>");
ss.WriteLine(" <target name=\"doc\" description=\"Creates documentation.\">");
if (hasDoc)
{
ss.WriteLine(" <property name=\"doc.target\" value=\"\" />");
ss.WriteLine(" <if test=\"${platform::is-unix()}\">");
ss.WriteLine(" <property name=\"doc.target\" value=\"Web\" />");
ss.WriteLine(" </if>");
ss.WriteLine(" <ndoc failonerror=\"false\" verbose=\"true\">");
ss.WriteLine(" <assemblies basedir=\"${project::get-base-directory()}\">");
ss.Write(" <include name=\"${build.dir}/${project::get-name()}");
if (project.Type == ProjectType.Library)
{
ss.WriteLine(".dll\" />");
}
else
{
ss.WriteLine(".exe\" />");
}
ss.WriteLine(" <target name=\"doc\" description=\"Creates documentation.\">");
if (hasDoc)
{
ss.WriteLine(" <property name=\"doc.target\" value=\"\" />");
ss.WriteLine(" <if test=\"${platform::is-unix()}\">");
ss.WriteLine(" <property name=\"doc.target\" value=\"Web\" />");
ss.WriteLine(" </if>");
ss.WriteLine(" <ndoc failonerror=\"false\" verbose=\"true\">");
ss.WriteLine(" <assemblies basedir=\"${project::get-base-directory()}\">");
ss.Write(" <include name=\"${build.dir}/${project::get-name()}");
if (project.Type == ProjectType.Library)
{
ss.WriteLine(".dll\" />");
}
else
{
ss.WriteLine(".exe\" />");
}
ss.WriteLine(" </assemblies>");
ss.WriteLine(" <summaries basedir=\"${project::get-base-directory()}\">");
ss.WriteLine(" <include name=\"${build.dir}/${project::get-name()}.xml\"/>");
ss.WriteLine(" </summaries>");
ss.WriteLine(" <referencepaths basedir=\"${project::get-base-directory()}\">");
ss.WriteLine(" <include name=\"${build.dir}\" />");
// foreach(ReferenceNode refr in project.References)
// {
// string path = Helper.NormalizePath(Helper.MakePathRelativeTo(project.FullPath, BuildReferencePath(solution, refr)), '/');
// if (path != "")
// {
// ss.WriteLine(" <include name=\"{0}\" />", path);
// }
// }
ss.WriteLine(" </referencepaths>");
ss.WriteLine(" <documenters>");
ss.WriteLine(" <documenter name=\"MSDN\">");
ss.WriteLine(" <property name=\"OutputDirectory\" value=\"${project::get-base-directory()}/${build.dir}/doc/${project::get-name()}\" />");
ss.WriteLine(" <property name=\"OutputTarget\" value=\"${doc.target}\" />");
ss.WriteLine(" <property name=\"HtmlHelpName\" value=\"${project::get-name()}\" />");
ss.WriteLine(" <property name=\"IncludeFavorites\" value=\"False\" />");
ss.WriteLine(" <property name=\"Title\" value=\"${project::get-name()} SDK Documentation\" />");
ss.WriteLine(" <property name=\"SplitTOCs\" value=\"False\" />");
ss.WriteLine(" <property name=\"DefaulTOC\" value=\"\" />");
ss.WriteLine(" <property name=\"ShowVisualBasic\" value=\"True\" />");
ss.WriteLine(" <property name=\"AutoDocumentConstructors\" value=\"True\" />");
ss.WriteLine(" <property name=\"ShowMissingSummaries\" value=\"${build.debug}\" />");
ss.WriteLine(" <property name=\"ShowMissingRemarks\" value=\"${build.debug}\" />");
ss.WriteLine(" <property name=\"ShowMissingParams\" value=\"${build.debug}\" />");
ss.WriteLine(" <property name=\"ShowMissingReturns\" value=\"${build.debug}\" />");
ss.WriteLine(" <property name=\"ShowMissingValues\" value=\"${build.debug}\" />");
ss.WriteLine(" <property name=\"DocumentInternals\" value=\"False\" />");
ss.WriteLine(" <property name=\"DocumentPrivates\" value=\"False\" />");
ss.WriteLine(" <property name=\"DocumentProtected\" value=\"True\" />");
ss.WriteLine(" <property name=\"DocumentEmptyNamespaces\" value=\"${build.debug}\" />");
ss.WriteLine(" <property name=\"IncludeAssemblyVersion\" value=\"True\" />");
ss.WriteLine(" </documenter>");
ss.WriteLine(" </documenters>");
ss.WriteLine(" </ndoc>");
}
ss.WriteLine(" </target>");
ss.WriteLine("</project>");
}
m_Kernel.CurrentWorkingDirectory.Pop();
}
ss.WriteLine(" </assemblies>");
ss.WriteLine(" <summaries basedir=\"${project::get-base-directory()}\">");
ss.WriteLine(" <include name=\"${build.dir}/${project::get-name()}.xml\"/>");
ss.WriteLine(" </summaries>");
ss.WriteLine(" <referencepaths basedir=\"${project::get-base-directory()}\">");
ss.WriteLine(" <include name=\"${build.dir}\" />");
// foreach(ReferenceNode refr in project.References)
// {
// string path = Helper.NormalizePath(Helper.MakePathRelativeTo(project.FullPath, BuildReferencePath(solution, refr)), '/');
// if (path != "")
// {
// ss.WriteLine(" <include name=\"{0}\" />", path);
// }
// }
ss.WriteLine(" </referencepaths>");
ss.WriteLine(" <documenters>");
ss.WriteLine(" <documenter name=\"MSDN\">");
ss.WriteLine(" <property name=\"OutputDirectory\" value=\"${project::get-base-directory()}/${build.dir}/doc/${project::get-name()}\" />");
ss.WriteLine(" <property name=\"OutputTarget\" value=\"${doc.target}\" />");
ss.WriteLine(" <property name=\"HtmlHelpName\" value=\"${project::get-name()}\" />");
ss.WriteLine(" <property name=\"IncludeFavorites\" value=\"False\" />");
ss.WriteLine(" <property name=\"Title\" value=\"${project::get-name()} SDK Documentation\" />");
ss.WriteLine(" <property name=\"SplitTOCs\" value=\"False\" />");
ss.WriteLine(" <property name=\"DefaulTOC\" value=\"\" />");
ss.WriteLine(" <property name=\"ShowVisualBasic\" value=\"True\" />");
ss.WriteLine(" <property name=\"AutoDocumentConstructors\" value=\"True\" />");
ss.WriteLine(" <property name=\"ShowMissingSummaries\" value=\"${build.debug}\" />");
ss.WriteLine(" <property name=\"ShowMissingRemarks\" value=\"${build.debug}\" />");
ss.WriteLine(" <property name=\"ShowMissingParams\" value=\"${build.debug}\" />");
ss.WriteLine(" <property name=\"ShowMissingReturns\" value=\"${build.debug}\" />");
ss.WriteLine(" <property name=\"ShowMissingValues\" value=\"${build.debug}\" />");
ss.WriteLine(" <property name=\"DocumentInternals\" value=\"False\" />");
ss.WriteLine(" <property name=\"DocumentPrivates\" value=\"False\" />");
ss.WriteLine(" <property name=\"DocumentProtected\" value=\"True\" />");
ss.WriteLine(" <property name=\"DocumentEmptyNamespaces\" value=\"${build.debug}\" />");
ss.WriteLine(" <property name=\"IncludeAssemblyVersion\" value=\"True\" />");
ss.WriteLine(" </documenter>");
ss.WriteLine(" </documenters>");
ss.WriteLine(" </ndoc>");
}
ss.WriteLine(" </target>");
ss.WriteLine("</project>");
}
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);
}
}
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.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));
m_Kernel.CurrentWorkingDirectory.Push();
Helper.SetCurrentDir(Path.GetDirectoryName(combFile));
using (ss)
{
ss.WriteLine("<?xml version=\"1.0\" ?>");
ss.WriteLine("<project name=\"{0}\" default=\"build\">", solution.Name);
ss.WriteLine(" <echo message=\"Using '${nant.settings.currentframework}' Framework\"/>");
ss.WriteLine();
using (ss)
{
ss.WriteLine("<?xml version=\"1.0\" ?>");
ss.WriteLine("<project name=\"{0}\" default=\"build\">", solution.Name);
ss.WriteLine(" <echo message=\"Using '${nant.settings.currentframework}' Framework\"/>");
ss.WriteLine();
//ss.WriteLine(" <property name=\"dist.dir\" value=\"dist\" />");
//ss.WriteLine(" <property name=\"source.dir\" value=\"source\" />");
ss.WriteLine(" <property name=\"bin.dir\" value=\"bin\" />");
ss.WriteLine(" <property name=\"obj.dir\" value=\"obj\" />");
ss.WriteLine(" <property name=\"doc.dir\" value=\"doc\" />");
ss.WriteLine(" <property name=\"project.main.dir\" value=\"${project::get-base-directory()}\" />");
//ss.WriteLine(" <property name=\"dist.dir\" value=\"dist\" />");
//ss.WriteLine(" <property name=\"source.dir\" value=\"source\" />");
ss.WriteLine(" <property name=\"bin.dir\" value=\"bin\" />");
ss.WriteLine(" <property name=\"obj.dir\" value=\"obj\" />");
ss.WriteLine(" <property name=\"doc.dir\" value=\"doc\" />");
ss.WriteLine(" <property name=\"project.main.dir\" value=\"${project::get-base-directory()}\" />");
// Use the active configuration, which is the first configuration name in the prebuild file.
Dictionary<string,string> emittedConfigurations = new Dictionary<string, string>();
// Use the active configuration, which is the first configuration name in the prebuild file.
Dictionary<string, string> emittedConfigurations = new Dictionary<string, string>();
ss.WriteLine(" <property name=\"project.config\" value=\"{0}\" />", solution.ActiveConfig);
ss.WriteLine();
ss.WriteLine(" <property name=\"project.config\" value=\"{0}\" />", solution.ActiveConfig);
ss.WriteLine();
foreach (ConfigurationNode conf in solution.Configurations)
{
// If the name isn't in the emitted configurations, we give a high level target to the
// platform specific on. This lets "Debug" point to "Debug-AnyCPU".
if (!emittedConfigurations.ContainsKey(conf.Name))
{
// Add it to the dictionary so we only emit one.
emittedConfigurations.Add(conf.Name, conf.Platform);
foreach (ConfigurationNode conf in solution.Configurations)
{
// If the name isn't in the emitted configurations, we give a high level target to the
// platform specific on. This lets "Debug" point to "Debug-AnyCPU".
if (!emittedConfigurations.ContainsKey(conf.Name))
{
// Add it to the dictionary so we only emit one.
emittedConfigurations.Add(conf.Name, conf.Platform);
// Write out the target block.
ss.WriteLine(" <target name=\"{0}\" description=\"{0}|{1}\" depends=\"{0}-{1}\">", conf.Name, conf.Platform);
ss.WriteLine(" </target>");
ss.WriteLine();
}
// Write out the target block.
ss.WriteLine(" <target name=\"{0}\" description=\"{0}|{1}\" depends=\"{0}-{1}\">", conf.Name, conf.Platform);
ss.WriteLine(" </target>");
ss.WriteLine();
}
// Write out the target for the configuration.
ss.WriteLine(" <target name=\"{0}-{1}\" description=\"{0}|{1}\">", conf.Name, conf.Platform);
ss.WriteLine(" <property name=\"project.config\" value=\"{0}\" />", conf.Name);
ss.WriteLine(" <property name=\"build.debug\" value=\"{0}\" />", conf.Options["DebugInformation"].ToString().ToLower());
ss.WriteLine("\t\t <property name=\"build.platform\" value=\"{0}\" />", conf.Platform);
ss.WriteLine(" </target>");
ss.WriteLine();
}
// Write out the target for the configuration.
ss.WriteLine(" <target name=\"{0}-{1}\" description=\"{0}|{1}\">", conf.Name, conf.Platform);
ss.WriteLine(" <property name=\"project.config\" value=\"{0}\" />", conf.Name);
ss.WriteLine(" <property name=\"build.debug\" value=\"{0}\" />", conf.Options["DebugInformation"].ToString().ToLower());
ss.WriteLine("\t\t <property name=\"build.platform\" value=\"{0}\" />", conf.Platform);
ss.WriteLine(" </target>");
ss.WriteLine();
}
ss.WriteLine(" <target name=\"net-1.1\" description=\"Sets framework to .NET 1.1\">");
ss.WriteLine(" <property name=\"nant.settings.currentframework\" value=\"net-1.1\" />");
ss.WriteLine(" </target>");
ss.WriteLine();
ss.WriteLine(" <target name=\"net-1.1\" description=\"Sets framework to .NET 1.1\">");
ss.WriteLine(" <property name=\"nant.settings.currentframework\" value=\"net-1.1\" />");
ss.WriteLine(" </target>");
ss.WriteLine();
ss.WriteLine(" <target name=\"net-2.0\" description=\"Sets framework to .NET 2.0\">");
ss.WriteLine(" <property name=\"nant.settings.currentframework\" value=\"net-2.0\" />");
ss.WriteLine(" </target>");
ss.WriteLine();
ss.WriteLine(" <target name=\"net-2.0\" description=\"Sets framework to .NET 2.0\">");
ss.WriteLine(" <property name=\"nant.settings.currentframework\" value=\"net-2.0\" />");
ss.WriteLine(" </target>");
ss.WriteLine();
ss.WriteLine(" <target name=\"net-3.5\" description=\"Sets framework to .NET 3.5\">");
ss.WriteLine(" <property name=\"nant.settings.currentframework\" value=\"net-3.5\" />");
ss.WriteLine(" </target>");
ss.WriteLine();
ss.WriteLine(" <target name=\"net-3.5\" description=\"Sets framework to .NET 3.5\">");
ss.WriteLine(" <property name=\"nant.settings.currentframework\" value=\"net-3.5\" />");
ss.WriteLine(" </target>");
ss.WriteLine();
ss.WriteLine(" <target name=\"mono-1.0\" description=\"Sets framework to mono 1.0\">");
ss.WriteLine(" <property name=\"nant.settings.currentframework\" value=\"mono-1.0\" />");
ss.WriteLine(" </target>");
ss.WriteLine();
ss.WriteLine(" <target name=\"mono-1.0\" description=\"Sets framework to mono 1.0\">");
ss.WriteLine(" <property name=\"nant.settings.currentframework\" value=\"mono-1.0\" />");
ss.WriteLine(" </target>");
ss.WriteLine();
ss.WriteLine(" <target name=\"mono-2.0\" description=\"Sets framework to mono 2.0\">");
ss.WriteLine(" <property name=\"nant.settings.currentframework\" value=\"mono-2.0\" />");
ss.WriteLine(" </target>");
ss.WriteLine();
ss.WriteLine(" <target name=\"mono-2.0\" description=\"Sets framework to mono 2.0\">");
ss.WriteLine(" <property name=\"nant.settings.currentframework\" value=\"mono-2.0\" />");
ss.WriteLine(" </target>");
ss.WriteLine();
ss.WriteLine(" <target name=\"mono-3.5\" description=\"Sets framework to mono 3.5\">");
ss.WriteLine(" <property name=\"nant.settings.currentframework\" value=\"mono-3.5\" />");
ss.WriteLine(" </target>");
ss.WriteLine();
ss.WriteLine(" <target name=\"mono-3.5\" description=\"Sets framework to mono 3.5\">");
ss.WriteLine(" <property name=\"nant.settings.currentframework\" value=\"mono-3.5\" />");
ss.WriteLine(" </target>");
ss.WriteLine();
ss.WriteLine(" <target name=\"init\" description=\"\">");
ss.WriteLine(" <call target=\"${project.config}\" />");
@@ -650,7 +651,7 @@ namespace Prebuild.Core.Targets
}
}
ss.WriteLine(" <delete dir=\"${obj.dir}\" failonerror=\"false\" />");
ss.WriteLine(" <delete dir=\"${obj.dir}\" failonerror=\"false\" />");
foreach (ProjectNode project in solution.Projects)
{
string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath);
@@ -29,11 +29,11 @@ using Prebuild.Core.Attributes;
namespace Prebuild.Core.Targets
{
/// <summary>
///
/// </summary>
[Target("sharpdev2")]
public class SharpDevelop2Target : VS2005Target
/// <summary>
///
/// </summary>
[Target("sharpdev2")]
public class SharpDevelop2Target : VS2005Target
{
#region Properties
public override string VersionName
@@ -45,38 +45,38 @@ namespace Prebuild.Core.Targets
}
#endregion
#region Public Methods
#region Public Methods
/// <summary>
/// Writes the specified kern.
/// </summary>
/// <param name="kern">The kern.</param>
public override void Write(Kernel kern)
{
base.Write(kern);
}
/// <summary>
/// Writes the specified kern.
/// </summary>
/// <param name="kern">The kern.</param>
public override void Write(Kernel kern)
{
base.Write(kern);
}
/// <summary>
/// Cleans the specified kern.
/// </summary>
/// <param name="kern">The kern.</param>
public override void Clean(Kernel kern)
{
base.Clean(kern);
}
/// <summary>
/// Cleans the specified kern.
/// </summary>
/// <param name="kern">The kern.</param>
public override void Clean(Kernel kern)
{
base.Clean(kern);
}
/// <summary>
/// Gets the name.
/// </summary>
/// <value>The name.</value>
public override string Name
{
get
{
return "sharpdev2";
}
}
/// <summary>
/// Gets the name.
/// </summary>
/// <value>The name.</value>
public override string Name
{
get
{
return "sharpdev2";
}
}
#endregion
}
#endregion
}
}
+337 -337
View File
@@ -34,392 +34,392 @@ using Prebuild.Core.Utilities;
namespace Prebuild.Core.Targets
{
/// <summary>
///
/// </summary>
[Target("sharpdev")]
public class SharpDevelopTarget : ITarget
{
#region Fields
/// <summary>
///
/// </summary>
[Target("sharpdev")]
public class SharpDevelopTarget : ITarget
{
#region Fields
private Kernel m_Kernel;
private Kernel m_Kernel;
#endregion
#endregion
#region Private Methods
#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);
}
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;
}
return tmpPath;
}
private static string BuildReference(SolutionNode solution, ReferenceNode refr)
{
string ret = "<Reference type=\"";
if(solution.ProjectsTable.ContainsKey(refr.Name))
{
ret += "Project\" refto=\"" + refr.Name;
ret += "\" localcopy=\"" + refr.LocalCopy.ToString() + "\" />";
}
else
{
ProjectNode project = (ProjectNode)refr.Parent;
string fileRef = FindFileReference(refr.Name, project);
private static string BuildReference(SolutionNode solution, ReferenceNode refr)
{
string ret = "<Reference type=\"";
if (solution.ProjectsTable.ContainsKey(refr.Name))
{
ret += "Project\" refto=\"" + refr.Name;
ret += "\" localcopy=\"" + refr.LocalCopy.ToString() + "\" />";
}
else
{
ProjectNode project = (ProjectNode)refr.Parent;
string fileRef = FindFileReference(refr.Name, project);
if(refr.Path != null || fileRef != null)
{
ret += "Assembly\" refto=\"";
if (refr.Path != null || fileRef != null)
{
ret += "Assembly\" refto=\"";
string finalPath = (refr.Path != null) ? Helper.MakeFilePath(refr.Path, refr.Name, "dll") : fileRef;
string finalPath = (refr.Path != null) ? Helper.MakeFilePath(refr.Path, refr.Name, "dll") : fileRef;
ret += finalPath;
ret += "\" localcopy=\"" + refr.LocalCopy.ToString() + "\" />";
return ret;
}
ret += finalPath;
ret += "\" localcopy=\"" + refr.LocalCopy.ToString() + "\" />";
return ret;
}
ret += "Gac\" refto=\"";
try
{
//Assembly assem = Assembly.Load(refr.Name);
ret += "Gac\" refto=\"";
try
{
//Assembly assem = Assembly.Load(refr.Name);
ret += refr.Name;// assem.FullName;
}
catch (System.NullReferenceException e)
{
e.ToString();
ret += refr.Name;
}
ret += "\" localcopy=\"" + refr.LocalCopy.ToString() + "\" />";
}
}
catch (System.NullReferenceException e)
{
e.ToString();
ret += refr.Name;
}
ret += "\" localcopy=\"" + refr.LocalCopy.ToString() + "\" />";
}
return ret;
}
return ret;
}
private static string FindFileReference(string refName, ProjectNode project)
{
foreach(ReferencePathNode refPath in project.ReferencePaths)
{
string fullPath = Helper.MakeFilePath(refPath.Path, refName, "dll");
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;
}
return null;
}
/// <summary>
/// Gets the XML doc file.
/// </summary>
/// <param name="project">The project.</param>
/// <param name="conf">The conf.</param>
/// <returns></returns>
public static string GenerateXmlDocFile(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 "False";
}
return "True";
}
/// <summary>
/// Gets the XML doc file.
/// </summary>
/// <param name="project">The project.</param>
/// <param name="conf">The conf.</param>
/// <returns></returns>
public static string GenerateXmlDocFile(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 "False";
}
return "True";
}
private void WriteProject(SolutionNode solution, ProjectNode project)
{
string csComp = "Csc";
string netRuntime = "MsNet";
if(project.Runtime == ClrRuntime.Mono)
{
csComp = "Mcs";
netRuntime = "Mono";
}
private void WriteProject(SolutionNode solution, ProjectNode project)
{
string csComp = "Csc";
string netRuntime = "MsNet";
if (project.Runtime == ClrRuntime.Mono)
{
csComp = "Mcs";
netRuntime = "Mono";
}
string projFile = Helper.MakeFilePath(project.FullPath, project.Name, "prjx");
StreamWriter ss = new StreamWriter(projFile);
string projFile = Helper.MakeFilePath(project.FullPath, project.Name, "prjx");
StreamWriter ss = new StreamWriter(projFile);
m_Kernel.CurrentWorkingDirectory.Push();
Helper.SetCurrentDir(Path.GetDirectoryName(projFile));
m_Kernel.CurrentWorkingDirectory.Push();
Helper.SetCurrentDir(Path.GetDirectoryName(projFile));
using(ss)
{
ss.WriteLine(
"<Project name=\"{0}\" standardNamespace=\"{1}\" description=\"\" newfilesearch=\"None\" enableviewstate=\"True\" version=\"1.1\" projecttype=\"C#\">",
project.Name,
project.RootNamespace
);
using (ss)
{
ss.WriteLine(
"<Project name=\"{0}\" standardNamespace=\"{1}\" description=\"\" newfilesearch=\"None\" enableviewstate=\"True\" version=\"1.1\" projecttype=\"C#\">",
project.Name,
project.RootNamespace
);
ss.WriteLine(" <Contents>");
foreach(string file in project.Files)
{
string buildAction = "Compile";
switch(project.Files.GetBuildAction(file))
{
case BuildAction.None:
buildAction = "Nothing";
break;
ss.WriteLine(" <Contents>");
foreach (string file in project.Files)
{
string buildAction = "Compile";
switch (project.Files.GetBuildAction(file))
{
case BuildAction.None:
buildAction = "Nothing";
break;
case BuildAction.Content:
buildAction = "Exclude";
break;
case BuildAction.Content:
buildAction = "Exclude";
break;
case BuildAction.EmbeddedResource:
buildAction = "EmbedAsResource";
break;
case BuildAction.EmbeddedResource:
buildAction = "EmbedAsResource";
break;
default:
buildAction = "Compile";
break;
}
default:
buildAction = "Compile";
break;
}
// Sort of a hack, we try and resolve the path and make it relative, if we can.
string filePath = PrependPath(file);
ss.WriteLine(" <File name=\"{0}\" subtype=\"Code\" buildaction=\"{1}\" dependson=\"\" data=\"\" />", filePath, buildAction);
}
ss.WriteLine(" </Contents>");
// Sort of a hack, we try and resolve the path and make it relative, if we can.
string filePath = PrependPath(file);
ss.WriteLine(" <File name=\"{0}\" subtype=\"Code\" buildaction=\"{1}\" dependson=\"\" data=\"\" />", filePath, buildAction);
}
ss.WriteLine(" </Contents>");
ss.WriteLine(" <References>");
foreach(ReferenceNode refr in project.References)
{
ss.WriteLine(" {0}", BuildReference(solution, refr));
}
ss.WriteLine(" </References>");
ss.WriteLine(" <References>");
foreach (ReferenceNode refr in project.References)
{
ss.WriteLine(" {0}", BuildReference(solution, refr));
}
ss.WriteLine(" </References>");
ss.Write(" <DeploymentInformation");
ss.Write(" target=\"\"");
ss.Write(" script=\"\"");
ss.Write(" strategy=\"File\"");
ss.WriteLine(" />");
ss.Write(" <DeploymentInformation");
ss.Write(" target=\"\"");
ss.Write(" script=\"\"");
ss.Write(" strategy=\"File\"");
ss.WriteLine(" />");
int count = 0;
ss.WriteLine(" <Configurations active=\"{0}\">", solution.ActiveConfig);
int count = 0;
foreach(ConfigurationNode conf in project.Configurations)
{
ss.Write(" <Configuration");
ss.Write(" runwithwarnings=\"True\"");
ss.Write(" name=\"{0}\"", conf.Name);
ss.WriteLine(">");
ss.Write(" <CodeGeneration");
ss.Write(" runtime=\"{0}\"", netRuntime);
ss.Write(" compiler=\"{0}\"", csComp);
ss.Write(" compilerversion=\"\"");
ss.Write(" warninglevel=\"{0}\"", conf.Options["WarningLevel"]);
ss.Write(" nowarn=\"{0}\"", conf.Options["SuppressWarnings"]);
ss.Write(" includedebuginformation=\"{0}\"", conf.Options["DebugInformation"]);
ss.Write(" optimize=\"{0}\"", conf.Options["OptimizeCode"]);
ss.Write(" unsafecodeallowed=\"{0}\"", conf.Options["AllowUnsafe"]);
ss.Write(" generateoverflowchecks=\"{0}\"", conf.Options["CheckUnderflowOverflow"]);
ss.Write(" mainclass=\"{0}\"", project.StartupObject);
ss.Write(" target=\"{0}\"", project.Type);
ss.Write(" definesymbols=\"{0}\"", conf.Options["CompilerDefines"]);
ss.Write(" generatexmldocumentation=\"{0}\"", GenerateXmlDocFile(project, conf));
ss.Write(" win32Icon=\"{0}\"", Helper.NormalizePath(".\\" + project.AppIcon));
ss.Write(" noconfig=\"{0}\"", "False");
ss.Write(" nostdlib=\"{0}\"", conf.Options["NoStdLib"]);
ss.WriteLine(" />");
ss.WriteLine(" <Configurations active=\"{0}\">", solution.ActiveConfig);
ss.Write(" <Execution");
ss.Write(" commandlineparameters=\"\"");
ss.Write(" consolepause=\"True\"");
ss.WriteLine(" />");
foreach (ConfigurationNode conf in project.Configurations)
{
ss.Write(" <Configuration");
ss.Write(" runwithwarnings=\"True\"");
ss.Write(" name=\"{0}\"", conf.Name);
ss.WriteLine(">");
ss.Write(" <CodeGeneration");
ss.Write(" runtime=\"{0}\"", netRuntime);
ss.Write(" compiler=\"{0}\"", csComp);
ss.Write(" compilerversion=\"\"");
ss.Write(" warninglevel=\"{0}\"", conf.Options["WarningLevel"]);
ss.Write(" nowarn=\"{0}\"", conf.Options["SuppressWarnings"]);
ss.Write(" includedebuginformation=\"{0}\"", conf.Options["DebugInformation"]);
ss.Write(" optimize=\"{0}\"", conf.Options["OptimizeCode"]);
ss.Write(" unsafecodeallowed=\"{0}\"", conf.Options["AllowUnsafe"]);
ss.Write(" generateoverflowchecks=\"{0}\"", conf.Options["CheckUnderflowOverflow"]);
ss.Write(" mainclass=\"{0}\"", project.StartupObject);
ss.Write(" target=\"{0}\"", project.Type);
ss.Write(" definesymbols=\"{0}\"", conf.Options["CompilerDefines"]);
ss.Write(" generatexmldocumentation=\"{0}\"", GenerateXmlDocFile(project, conf));
ss.Write(" win32Icon=\"{0}\"", Helper.NormalizePath(".\\" + project.AppIcon));
ss.Write(" noconfig=\"{0}\"", "False");
ss.Write(" nostdlib=\"{0}\"", conf.Options["NoStdLib"]);
ss.WriteLine(" />");
ss.Write(" <Output");
ss.Write(" directory=\".\\{0}\"", Helper.NormalizePath(conf.Options["OutputPath"].ToString()));
ss.Write(" assembly=\"{0}\"", project.AssemblyName);
ss.Write(" executeScript=\"{0}\"", conf.Options["RunScript"]);
if (conf.Options["PreBuildEvent"] != null && conf.Options["PreBuildEvent"].ToString().Length != 0)
{
ss.Write(" executeBeforeBuild=\"{0}\"", Helper.NormalizePath(conf.Options["PreBuildEvent"].ToString()));
}
else
{
ss.Write(" executeBeforeBuild=\"{0}\"", conf.Options["PreBuildEvent"]);
}
if (conf.Options["PostBuildEvent"] != null && conf.Options["PostBuildEvent"].ToString().Length != 0)
{
ss.Write(" executeAfterBuild=\"{0}\"", Helper.NormalizePath(conf.Options["PostBuildEvent"].ToString()));
}
else
{
ss.Write(" executeAfterBuild=\"{0}\"", conf.Options["PostBuildEvent"]);
}
ss.Write(" executeBeforeBuildArguments=\"{0}\"", conf.Options["PreBuildEventArgs"]);
ss.Write(" executeAfterBuildArguments=\"{0}\"", conf.Options["PreBuildEventArgs"]);
ss.WriteLine(" />");
ss.WriteLine(" </Configuration>");
ss.Write(" <Execution");
ss.Write(" commandlineparameters=\"\"");
ss.Write(" consolepause=\"True\"");
ss.WriteLine(" />");
count++;
}
ss.WriteLine(" </Configurations>");
ss.WriteLine("</Project>");
}
ss.Write(" <Output");
ss.Write(" directory=\".\\{0}\"", Helper.NormalizePath(conf.Options["OutputPath"].ToString()));
ss.Write(" assembly=\"{0}\"", project.AssemblyName);
ss.Write(" executeScript=\"{0}\"", conf.Options["RunScript"]);
if (conf.Options["PreBuildEvent"] != null && conf.Options["PreBuildEvent"].ToString().Length != 0)
{
ss.Write(" executeBeforeBuild=\"{0}\"", Helper.NormalizePath(conf.Options["PreBuildEvent"].ToString()));
}
else
{
ss.Write(" executeBeforeBuild=\"{0}\"", conf.Options["PreBuildEvent"]);
}
if (conf.Options["PostBuildEvent"] != null && conf.Options["PostBuildEvent"].ToString().Length != 0)
{
ss.Write(" executeAfterBuild=\"{0}\"", Helper.NormalizePath(conf.Options["PostBuildEvent"].ToString()));
}
else
{
ss.Write(" executeAfterBuild=\"{0}\"", conf.Options["PostBuildEvent"]);
}
ss.Write(" executeBeforeBuildArguments=\"{0}\"", conf.Options["PreBuildEventArgs"]);
ss.Write(" executeAfterBuildArguments=\"{0}\"", conf.Options["PreBuildEventArgs"]);
ss.WriteLine(" />");
ss.WriteLine(" </Configuration>");
m_Kernel.CurrentWorkingDirectory.Pop();
}
count++;
}
ss.WriteLine(" </Configurations>");
ss.WriteLine("</Project>");
}
private void WriteCombine(SolutionNode solution)
{
m_Kernel.Log.Write("Creating SharpDevelop combine and project 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.CurrentWorkingDirectory.Pop();
}
m_Kernel.Log.Write("");
string combFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "cmbx");
StreamWriter ss = new StreamWriter(combFile);
private void WriteCombine(SolutionNode solution)
{
m_Kernel.Log.Write("Creating SharpDevelop combine and project 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.CurrentWorkingDirectory.Push();
Helper.SetCurrentDir(Path.GetDirectoryName(combFile));
using(ss)
{
ss.WriteLine("<Combine fileversion=\"1.0\" name=\"{0}\" description=\"\">", solution.Name);
int count = 0;
foreach(ProjectNode project in solution.Projects)
{
if(count == 0)
ss.WriteLine(" <StartMode startupentry=\"{0}\" single=\"True\">", project.Name);
m_Kernel.Log.Write("");
string combFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "cmbx");
StreamWriter ss = new StreamWriter(combFile);
ss.WriteLine(" <Execute entry=\"{0}\" type=\"None\" />", project.Name);
count++;
}
ss.WriteLine(" </StartMode>");
ss.WriteLine(" <Entries>");
foreach(ProjectNode project in solution.Projects)
{
string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath);
ss.WriteLine(" <Entry filename=\"{0}\" />",
Helper.MakeFilePath(path, project.Name, "prjx"));
}
ss.WriteLine(" </Entries>");
m_Kernel.CurrentWorkingDirectory.Push();
Helper.SetCurrentDir(Path.GetDirectoryName(combFile));
count = 0;
foreach(ConfigurationNode conf in solution.Configurations)
{
if(count == 0)
{
ss.WriteLine(" <Configurations active=\"{0}\">", conf.Name);
}
using (ss)
{
ss.WriteLine("<Combine fileversion=\"1.0\" name=\"{0}\" description=\"\">", solution.Name);
ss.WriteLine(" <Configuration name=\"{0}\">", conf.Name);
foreach(ProjectNode project in solution.Projects)
{
ss.WriteLine(" <Entry name=\"{0}\" configurationname=\"{1}\" build=\"True\" />", project.Name, conf.Name);
}
ss.WriteLine(" </Configuration>");
int count = 0;
foreach (ProjectNode project in solution.Projects)
{
if (count == 0)
ss.WriteLine(" <StartMode startupentry=\"{0}\" single=\"True\">", project.Name);
count++;
}
ss.WriteLine(" </Configurations>");
ss.WriteLine("</Combine>");
}
ss.WriteLine(" <Execute entry=\"{0}\" type=\"None\" />", project.Name);
count++;
}
ss.WriteLine(" </StartMode>");
m_Kernel.CurrentWorkingDirectory.Pop();
}
ss.WriteLine(" <Entries>");
foreach (ProjectNode project in solution.Projects)
{
string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath);
ss.WriteLine(" <Entry filename=\"{0}\" />",
Helper.MakeFilePath(path, project.Name, "prjx"));
}
ss.WriteLine(" </Entries>");
private void CleanProject(ProjectNode project)
{
m_Kernel.Log.Write("...Cleaning project: {0}", project.Name);
string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, "prjx");
Helper.DeleteIfExists(projectFile);
}
count = 0;
foreach (ConfigurationNode conf in solution.Configurations)
{
if (count == 0)
{
ss.WriteLine(" <Configurations active=\"{0}\">", conf.Name);
}
private void CleanSolution(SolutionNode solution)
{
m_Kernel.Log.Write("Cleaning SharpDevelop combine and project files for", solution.Name);
ss.WriteLine(" <Configuration name=\"{0}\">", conf.Name);
foreach (ProjectNode project in solution.Projects)
{
ss.WriteLine(" <Entry name=\"{0}\" configurationname=\"{1}\" build=\"True\" />", project.Name, conf.Name);
}
ss.WriteLine(" </Configuration>");
string slnFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "cmbx");
Helper.DeleteIfExists(slnFile);
count++;
}
ss.WriteLine(" </Configurations>");
ss.WriteLine("</Combine>");
}
foreach(ProjectNode project in solution.Projects)
{
CleanProject(project);
}
m_Kernel.Log.Write("");
}
m_Kernel.CurrentWorkingDirectory.Pop();
}
#endregion
private void CleanProject(ProjectNode project)
{
m_Kernel.Log.Write("...Cleaning project: {0}", project.Name);
string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, "prjx");
Helper.DeleteIfExists(projectFile);
}
#region ITarget Members
private void CleanSolution(SolutionNode solution)
{
m_Kernel.Log.Write("Cleaning SharpDevelop combine and project files for", solution.Name);
/// <summary>
/// Writes the specified kern.
/// </summary>
/// <param name="kern">The kern.</param>
public void Write(Kernel kern)
{
if( kern == null )
{
throw new ArgumentNullException("kern");
}
m_Kernel = kern;
foreach(SolutionNode solution in kern.Solutions)
{
WriteCombine(solution);
}
m_Kernel = null;
}
string slnFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "cmbx");
Helper.DeleteIfExists(slnFile);
/// <summary>
/// Cleans the specified kern.
/// </summary>
/// <param name="kern">The kern.</param>
public virtual void Clean(Kernel kern)
{
if( kern == null )
{
throw new ArgumentNullException("kern");
}
m_Kernel = kern;
foreach(SolutionNode sol in kern.Solutions)
{
CleanSolution(sol);
}
m_Kernel = null;
}
foreach (ProjectNode project in solution.Projects)
{
CleanProject(project);
}
/// <summary>
/// Gets the name.
/// </summary>
/// <value>The name.</value>
public string Name
{
get
{
return "sharpdev";
}
}
m_Kernel.Log.Write("");
}
#endregion
}
#endregion
#region ITarget Members
/// <summary>
/// Writes the specified kern.
/// </summary>
/// <param name="kern">The kern.</param>
public void Write(Kernel kern)
{
if (kern == null)
{
throw new ArgumentNullException("kern");
}
m_Kernel = kern;
foreach (SolutionNode solution in kern.Solutions)
{
WriteCombine(solution);
}
m_Kernel = null;
}
/// <summary>
/// Cleans the specified kern.
/// </summary>
/// <param name="kern">The kern.</param>
public virtual void Clean(Kernel kern)
{
if (kern == null)
{
throw new ArgumentNullException("kern");
}
m_Kernel = kern;
foreach (SolutionNode sol in kern.Solutions)
{
CleanSolution(sol);
}
m_Kernel = null;
}
/// <summary>
/// Gets the name.
/// </summary>
/// <value>The name.</value>
public string Name
{
get
{
return "sharpdev";
}
}
#endregion
}
}
+178 -178
View File
@@ -4,194 +4,194 @@ using System.Text;
namespace Prebuild.Core.Targets
{
/// <summary>
///
/// </summary>
public struct ToolInfo
{
string name;
string guid;
string fileExtension;
string xmlTag;
string importProject;
/// <summary>
///
/// </summary>
public struct ToolInfo
{
string name;
string guid;
string fileExtension;
string xmlTag;
string importProject;
/// <summary>
/// Gets or sets the name.
/// </summary>
/// <value>The name.</value>
public string Name
{
get
{
return name;
}
set
{
name = value;
}
}
/// <summary>
/// Gets or sets the name.
/// </summary>
/// <value>The name.</value>
public string Name
{
get
{
return name;
}
set
{
name = value;
}
}
/// <summary>
/// Gets or sets the GUID.
/// </summary>
/// <value>The GUID.</value>
public string Guid
{
get
{
return guid;
}
set
{
guid = value;
}
}
/// <summary>
/// Gets or sets the GUID.
/// </summary>
/// <value>The GUID.</value>
public string Guid
{
get
{
return guid;
}
set
{
guid = value;
}
}
/// <summary>
/// Gets or sets the file extension.
/// </summary>
/// <value>The file extension.</value>
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";
}
}
}
/// <summary>
/// Gets or sets the XML tag.
/// </summary>
/// <value>The XML tag.</value>
public string XmlTag
{
get
{
return xmlTag;
}
set
{
xmlTag = value;
}
}
/// <summary>
/// Gets or sets the file extension.
/// </summary>
/// <value>The file extension.</value>
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";
}
}
}
/// <summary>
/// Gets or sets the XML tag.
/// </summary>
/// <value>The XML tag.</value>
public string XmlTag
{
get
{
return xmlTag;
}
set
{
xmlTag = value;
}
}
/// <summary>
/// Gets or sets the import project property.
/// </summary>
/// <value>The ImportProject tag.</value>
public string ImportProject
{
get
{
return importProject;
}
set
{
importProject = value;
}
}
/// <summary>
/// Gets or sets the import project property.
/// </summary>
/// <value>The ImportProject tag.</value>
public string ImportProject
{
get
{
return importProject;
}
set
{
importProject = value;
}
}
/// <summary>
/// Initializes a new instance of the <see cref="ToolInfo"/> class.
/// </summary>
/// <param name="name">The name.</param>
/// <param name="guid">The GUID.</param>
/// <param name="fileExtension">The file extension.</param>
/// <param name="xml">The XML.</param>
/// <param name="importProject">The import project.</param>
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;
}
/// <summary>
/// Initializes a new instance of the <see cref="ToolInfo"/> class.
/// </summary>
/// <param name="name">The name.</param>
/// <param name="guid">The GUID.</param>
/// <param name="fileExtension">The file extension.</param>
/// <param name="xml">The XML.</param>
/// <param name="importProject">The import project.</param>
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;
}
/// <summary>
/// Initializes a new instance of the <see cref="ToolInfo"/> class.
/// </summary>
/// <param name="name">The name.</param>
/// <param name="guid">The GUID.</param>
/// <param name="fileExtension">The file extension.</param>
/// <param name="xml">The XML.</param>
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";
}
/// <summary>
/// Initializes a new instance of the <see cref="ToolInfo"/> class.
/// </summary>
/// <param name="name">The name.</param>
/// <param name="guid">The GUID.</param>
/// <param name="fileExtension">The file extension.</param>
/// <param name="xml">The XML.</param>
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";
}
/// <summary>
/// Equals operator
/// </summary>
/// <param name="obj">ToolInfo to compare</param>
/// <returns>true if toolInfos are equal</returns>
public override bool Equals(object obj)
{
if (obj == null)
{
throw new ArgumentNullException("obj");
}
if (obj.GetType() != typeof(ToolInfo))
return false;
/// <summary>
/// Equals operator
/// </summary>
/// <param name="obj">ToolInfo to compare</param>
/// <returns>true if toolInfos are equal</returns>
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));
}
ToolInfo c = (ToolInfo)obj;
return ((this.name == c.name) && (this.guid == c.guid) && (this.fileExtension == c.fileExtension) && (this.importProject == c.importProject));
}
/// <summary>
/// Equals operator
/// </summary>
/// <param name="c1">ToolInfo to compare</param>
/// <param name="c2">ToolInfo to compare</param>
/// <returns>True if toolInfos are equal</returns>
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));
}
/// <summary>
/// Equals operator
/// </summary>
/// <param name="c1">ToolInfo to compare</param>
/// <param name="c2">ToolInfo to compare</param>
/// <returns>True if toolInfos are equal</returns>
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));
}
/// <summary>
/// Not equals operator
/// </summary>
/// <param name="c1">ToolInfo to compare</param>
/// <param name="c2">ToolInfo to compare</param>
/// <returns>True if toolInfos are not equal</returns>
public static bool operator !=(ToolInfo c1, ToolInfo c2)
{
return !(c1 == c2);
}
/// <summary>
/// Not equals operator
/// </summary>
/// <param name="c1">ToolInfo to compare</param>
/// <param name="c2">ToolInfo to compare</param>
/// <returns>True if toolInfos are not equal</returns>
public static bool operator !=(ToolInfo c1, ToolInfo c2)
{
return !(c1 == c2);
}
/// <summary>
/// Hash Code
/// </summary>
/// <returns>Hash code</returns>
public override int GetHashCode()
{
return name.GetHashCode() ^ guid.GetHashCode() ^ this.fileExtension.GetHashCode() ^ this.importProject.GetHashCode() ^ this.xmlTag.GetHashCode();
/// <summary>
/// Hash Code
/// </summary>
/// <returns>Hash code</returns>
public override int GetHashCode()
{
return name.GetHashCode() ^ guid.GetHashCode() ^ this.fileExtension.GetHashCode() ^ this.importProject.GetHashCode() ^ this.xmlTag.GetHashCode();
}
}
}
}
}
+48 -48
View File
@@ -29,59 +29,59 @@ using Prebuild.Core.Attributes;
namespace Prebuild.Core.Targets
{
/// <summary>
///
/// </summary>
[Target("vs2002")]
public class VS2002Target : VS2003Target
{
#region Private Methods
/// <summary>
///
/// </summary>
[Target("vs2002")]
public class VS2002Target : VS2003Target
{
#region Private Methods
private void SetVS2002()
{
this.SolutionVersion = "7.00";
this.ProductVersion = "7.0.9254";
this.SchemaVersion = "1.0";
this.VersionName = "2002";
this.Version = VSVersion.VS70;
}
private void SetVS2002()
{
this.SolutionVersion = "7.00";
this.ProductVersion = "7.0.9254";
this.SchemaVersion = "1.0";
this.VersionName = "2002";
this.Version = VSVersion.VS70;
}
#endregion
#endregion
#region Public Methods
#region Public Methods
/// <summary>
/// Writes the specified kern.
/// </summary>
/// <param name="kern">The kern.</param>
public override void Write(Kernel kern)
{
SetVS2002();
base.Write(kern);
}
/// <summary>
/// Writes the specified kern.
/// </summary>
/// <param name="kern">The kern.</param>
public override void Write(Kernel kern)
{
SetVS2002();
base.Write(kern);
}
/// <summary>
/// Cleans the specified kern.
/// </summary>
/// <param name="kern">The kern.</param>
public override void Clean(Kernel kern)
{
SetVS2002();
base.Clean(kern);
}
/// <summary>
/// Cleans the specified kern.
/// </summary>
/// <param name="kern">The kern.</param>
public override void Clean(Kernel kern)
{
SetVS2002();
base.Clean(kern);
}
/// <summary>
/// Gets the name.
/// </summary>
/// <value>The name.</value>
public override string Name
{
get
{
return "vs2002";
}
}
/// <summary>
/// Gets the name.
/// </summary>
/// <value>The name.</value>
public override string Name
{
get
{
return "vs2002";
}
}
#endregion
}
#endregion
}
}
File diff suppressed because it is too large Load Diff
+2 -2
View File
@@ -137,9 +137,9 @@ namespace Prebuild.Core.Targets
/// <summary>
/// Initializes a new instance of the <see cref="VS2005Target"/> class.
/// </summary>
public VS2005Target()
public VS2005Target()
: base()
{
{
}
#endregion
+90 -90
View File
@@ -11,86 +11,86 @@ using System.CodeDom.Compiler;
namespace Prebuild.Core.Targets
{
/// <summary>
///
/// </summary>
[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;
/// <summary>
///
/// </summary>
[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;
/// <summary>
/// Gets or sets the solution version.
/// </summary>
/// <value>The solution version.</value>
public override string SolutionVersion
{
get
{
return solutionVersion;
}
}
/// <summary>
/// Gets or sets the product version.
/// </summary>
/// <value>The product version.</value>
public override string ProductVersion
{
get
{
return productVersion;
}
}
/// <summary>
/// Gets or sets the schema version.
/// </summary>
/// <value>The schema version.</value>
public override string SchemaVersion
{
get
{
return schemaVersion;
}
}
/// <summary>
/// Gets or sets the name of the version.
/// </summary>
/// <value>The name of the version.</value>
public override string VersionName
{
get
{
return versionName;
}
}
/// <summary>
/// Gets or sets the version.
/// </summary>
/// <value>The version.</value>
public override VSVersion Version
{
get
{
return version;
}
}
/// <summary>
/// Gets the name.
/// </summary>
/// <value>The name.</value>
public override string Name
{
get
{
return name;
}
}
/// <summary>
/// Gets or sets the solution version.
/// </summary>
/// <value>The solution version.</value>
public override string SolutionVersion
{
get
{
return solutionVersion;
}
}
/// <summary>
/// Gets or sets the product version.
/// </summary>
/// <value>The product version.</value>
public override string ProductVersion
{
get
{
return productVersion;
}
}
/// <summary>
/// Gets or sets the schema version.
/// </summary>
/// <value>The schema version.</value>
public override string SchemaVersion
{
get
{
return schemaVersion;
}
}
/// <summary>
/// Gets or sets the name of the version.
/// </summary>
/// <value>The name of the version.</value>
public override string VersionName
{
get
{
return versionName;
}
}
/// <summary>
/// Gets or sets the version.
/// </summary>
/// <value>The version.</value>
public override VSVersion Version
{
get
{
return version;
}
}
/// <summary>
/// Gets the name.
/// </summary>
/// <value>The name.</value>
public override string Name
{
get
{
return name;
}
}
protected override string GetToolsVersionXml(FrameworkVersion frameworkVersion)
{
@@ -110,18 +110,18 @@ namespace Prebuild.Core.Targets
get { return "# Visual Studio 2008"; }
}
#endregion
#endregion
#region Constructors
#region Constructors
/// <summary>
/// Initializes a new instance of the <see cref="VS2005Target"/> class.
/// </summary>
public VS2008Target()
: base()
{
}
/// <summary>
/// Initializes a new instance of the <see cref="VS2005Target"/> class.
/// </summary>
public VS2008Target()
: base()
{
}
#endregion
}
#endregion
}
}
+101 -101
View File
@@ -11,96 +11,96 @@ using System.CodeDom.Compiler;
namespace Prebuild.Core.Targets
{
/// <summary>
///
/// </summary>
[Target("vs2010")]
public class VS2010Target : VSGenericTarget
{
#region Fields
string solutionVersion = "11.00";
string productVersion = "9.0.30729";
string schemaVersion = "2.0";
string versionName = "Visual Studio 2010";
string name = "vs2010";
VSVersion version = VSVersion.VS10;
/// <summary>
///
/// </summary>
[Target("vs2010")]
public class VS2010Target : VSGenericTarget
{
#region Fields
#endregion
#region Properties
/// <summary>
/// Gets or sets the solution version.
/// </summary>
/// <value>The solution version.</value>
public override string SolutionVersion
{
get
{
return solutionVersion;
}
}
/// <summary>
/// Gets or sets the product version.
/// </summary>
/// <value>The product version.</value>
public override string ProductVersion
{
get
{
return productVersion;
}
}
/// <summary>
/// Gets or sets the schema version.
/// </summary>
/// <value>The schema version.</value>
public override string SchemaVersion
{
get
{
return schemaVersion;
}
}
/// <summary>
/// Gets or sets the name of the version.
/// </summary>
/// <value>The name of the version.</value>
public override string VersionName
{
get
{
return versionName;
}
}
/// <summary>
/// Gets or sets the version.
/// </summary>
/// <value>The version.</value>
public override VSVersion Version
{
get
{
return version;
}
}
/// <summary>
/// Gets the name.
/// </summary>
/// <value>The name.</value>
public override string Name
{
get
{
return name;
}
}
string solutionVersion = "11.00";
string productVersion = "9.0.30729";
string schemaVersion = "2.0";
string versionName = "Visual Studio 2010";
string name = "vs2010";
VSVersion version = VSVersion.VS10;
#endregion
#region Properties
/// <summary>
/// Gets or sets the solution version.
/// </summary>
/// <value>The solution version.</value>
public override string SolutionVersion
{
get
{
return solutionVersion;
}
}
/// <summary>
/// Gets or sets the product version.
/// </summary>
/// <value>The product version.</value>
public override string ProductVersion
{
get
{
return productVersion;
}
}
/// <summary>
/// Gets or sets the schema version.
/// </summary>
/// <value>The schema version.</value>
public override string SchemaVersion
{
get
{
return schemaVersion;
}
}
/// <summary>
/// Gets or sets the name of the version.
/// </summary>
/// <value>The name of the version.</value>
public override string VersionName
{
get
{
return versionName;
}
}
/// <summary>
/// Gets or sets the version.
/// </summary>
/// <value>The version.</value>
public override VSVersion Version
{
get
{
return version;
}
}
/// <summary>
/// Gets the name.
/// </summary>
/// <value>The name.</value>
public override string Name
{
get
{
return name;
}
}
protected override string GetToolsVersionXml(FrameworkVersion frameworkVersion)
{
@@ -110,7 +110,7 @@ namespace Prebuild.Core.Targets
case FrameworkVersion.v4_5:
case FrameworkVersion.v4_0:
case FrameworkVersion.v3_5:
return "ToolsVersion=\"4.0\"";
return "ToolsVersion=\"4.0\"";
case FrameworkVersion.v3_0:
return "ToolsVersion=\"3.0\"";
default:
@@ -123,18 +123,18 @@ namespace Prebuild.Core.Targets
get { return "# Visual Studio 2010"; }
}
#endregion
#endregion
#region Constructors
#region Constructors
/// <summary>
/// Initializes a new instance of the <see cref="VS2005Target"/> class.
/// </summary>
public VS2010Target()
: base()
{
}
/// <summary>
/// Initializes a new instance of the <see cref="VS2005Target"/> class.
/// </summary>
public VS2010Target()
: base()
{
}
#endregion
}
#endregion
}
}
+101 -101
View File
@@ -6,96 +6,96 @@ using Prebuild.Core.Nodes;
namespace Prebuild.Core.Targets
{
/// <summary>
///
/// </summary>
[Target("vs2012")]
public class VS2012Target : VSGenericTarget
{
#region Fields
string solutionVersion = "12.00";
string productVersion = "11.0.61030.0";
string schemaVersion = "2.0";
string versionName = "Visual Studio 2012";
string name = "vs2012";
VSVersion version = VSVersion.VS11;
/// <summary>
///
/// </summary>
[Target("vs2012")]
public class VS2012Target : VSGenericTarget
{
#region Fields
#endregion
#region Properties
/// <summary>
/// Gets or sets the solution version.
/// </summary>
/// <value>The solution version.</value>
public override string SolutionVersion
{
get
{
return solutionVersion;
}
}
/// <summary>
/// Gets or sets the product version.
/// </summary>
/// <value>The product version.</value>
public override string ProductVersion
{
get
{
return productVersion;
}
}
/// <summary>
/// Gets or sets the schema version.
/// </summary>
/// <value>The schema version.</value>
public override string SchemaVersion
{
get
{
return schemaVersion;
}
}
/// <summary>
/// Gets or sets the name of the version.
/// </summary>
/// <value>The name of the version.</value>
public override string VersionName
{
get
{
return versionName;
}
}
/// <summary>
/// Gets or sets the version.
/// </summary>
/// <value>The version.</value>
public override VSVersion Version
{
get
{
return version;
}
}
/// <summary>
/// Gets the name.
/// </summary>
/// <value>The name.</value>
public override string Name
{
get
{
return name;
}
}
string solutionVersion = "12.00";
string productVersion = "11.0.61030.0";
string schemaVersion = "2.0";
string versionName = "Visual Studio 2012";
string name = "vs2012";
VSVersion version = VSVersion.VS11;
#endregion
#region Properties
/// <summary>
/// Gets or sets the solution version.
/// </summary>
/// <value>The solution version.</value>
public override string SolutionVersion
{
get
{
return solutionVersion;
}
}
/// <summary>
/// Gets or sets the product version.
/// </summary>
/// <value>The product version.</value>
public override string ProductVersion
{
get
{
return productVersion;
}
}
/// <summary>
/// Gets or sets the schema version.
/// </summary>
/// <value>The schema version.</value>
public override string SchemaVersion
{
get
{
return schemaVersion;
}
}
/// <summary>
/// Gets or sets the name of the version.
/// </summary>
/// <value>The name of the version.</value>
public override string VersionName
{
get
{
return versionName;
}
}
/// <summary>
/// Gets or sets the version.
/// </summary>
/// <value>The version.</value>
public override VSVersion Version
{
get
{
return version;
}
}
/// <summary>
/// Gets the name.
/// </summary>
/// <value>The name.</value>
public override string Name
{
get
{
return name;
}
}
protected override string GetToolsVersionXml(FrameworkVersion frameworkVersion)
{
@@ -111,7 +111,7 @@ namespace Prebuild.Core.Targets
case FrameworkVersion.v4_5:
case FrameworkVersion.v4_0:
case FrameworkVersion.v3_5:
return "ToolsVersion=\"4.0\"";
return "ToolsVersion=\"4.0\"";
case FrameworkVersion.v3_0:
return "ToolsVersion=\"3.0\"";
default:
@@ -124,18 +124,18 @@ namespace Prebuild.Core.Targets
get { return "# Visual Studio 2012"; }
}
#endregion
#endregion
#region Constructors
#region Constructors
/// <summary>
/// Initializes a new instance of the <see cref="VS2005Target"/> class.
/// </summary>
public VS2012Target()
: base()
{
}
/// <summary>
/// Initializes a new instance of the <see cref="VS2005Target"/> class.
/// </summary>
public VS2012Target()
: base()
{
}
#endregion
}
#endregion
}
}
+102 -102
View File
@@ -6,96 +6,96 @@ using Prebuild.Core.Nodes;
namespace Prebuild.Core.Targets
{
/// <summary>
///
/// </summary>
[Target("vs2013")]
public class VS2013Target : VSGenericTarget
{
#region Fields
string solutionVersion = "12.00";
string productVersion = "12.0.31101";
string schemaVersion = "2.0";
string versionName = "Visual Studio 2013";
string name = "vs2013";
VSVersion version = VSVersion.VS12;
/// <summary>
///
/// </summary>
[Target("vs2013")]
public class VS2013Target : VSGenericTarget
{
#region Fields
#endregion
#region Properties
/// <summary>
/// Gets or sets the solution version.
/// </summary>
/// <value>The solution version.</value>
public override string SolutionVersion
{
get
{
return solutionVersion;
}
}
/// <summary>
/// Gets or sets the product version.
/// </summary>
/// <value>The product version.</value>
public override string ProductVersion
{
get
{
return productVersion;
}
}
/// <summary>
/// Gets or sets the schema version.
/// </summary>
/// <value>The schema version.</value>
public override string SchemaVersion
{
get
{
return schemaVersion;
}
}
/// <summary>
/// Gets or sets the name of the version.
/// </summary>
/// <value>The name of the version.</value>
public override string VersionName
{
get
{
return versionName;
}
}
/// <summary>
/// Gets or sets the version.
/// </summary>
/// <value>The version.</value>
public override VSVersion Version
{
get
{
return version;
}
}
/// <summary>
/// Gets the name.
/// </summary>
/// <value>The name.</value>
public override string Name
{
get
{
return name;
}
}
string solutionVersion = "12.00";
string productVersion = "12.0.31101";
string schemaVersion = "2.0";
string versionName = "Visual Studio 2013";
string name = "vs2013";
VSVersion version = VSVersion.VS12;
#endregion
#region Properties
/// <summary>
/// Gets or sets the solution version.
/// </summary>
/// <value>The solution version.</value>
public override string SolutionVersion
{
get
{
return solutionVersion;
}
}
/// <summary>
/// Gets or sets the product version.
/// </summary>
/// <value>The product version.</value>
public override string ProductVersion
{
get
{
return productVersion;
}
}
/// <summary>
/// Gets or sets the schema version.
/// </summary>
/// <value>The schema version.</value>
public override string SchemaVersion
{
get
{
return schemaVersion;
}
}
/// <summary>
/// Gets or sets the name of the version.
/// </summary>
/// <value>The name of the version.</value>
public override string VersionName
{
get
{
return versionName;
}
}
/// <summary>
/// Gets or sets the version.
/// </summary>
/// <value>The version.</value>
public override VSVersion Version
{
get
{
return version;
}
}
/// <summary>
/// Gets the name.
/// </summary>
/// <value>The name.</value>
public override string Name
{
get
{
return name;
}
}
protected override string GetToolsVersionXml(FrameworkVersion frameworkVersion)
{
@@ -106,10 +106,10 @@ namespace Prebuild.Core.Targets
return "ToolsVersion=\"14.0\"";
case FrameworkVersion.v4_5_1:
case FrameworkVersion.v4_5:
return "ToolsVersion=\"12.0\"";
return "ToolsVersion=\"12.0\"";
case FrameworkVersion.v4_0:
case FrameworkVersion.v3_5:
return "ToolsVersion=\"4.0\"";
return "ToolsVersion=\"4.0\"";
case FrameworkVersion.v3_0:
return "ToolsVersion=\"3.0\"";
default:
@@ -122,18 +122,18 @@ namespace Prebuild.Core.Targets
get { return "# Visual Studio 2013"; }
}
#endregion
#endregion
#region Constructors
#region Constructors
/// <summary>
/// Initializes a new instance of the <see cref="VS2005Target"/> class.
/// </summary>
public VS2013Target()
: base()
{
}
/// <summary>
/// Initializes a new instance of the <see cref="VS2005Target"/> class.
/// </summary>
public VS2013Target()
: base()
{
}
#endregion
}
#endregion
}
}
+3 -3
View File
@@ -124,9 +124,9 @@ namespace Prebuild.Core.Targets
case FrameworkVersion.v3_5:
return "ToolsVersion=\"4.0\"";
case FrameworkVersion.v3_0:
return "ToolsVersion=\"3.0\"";
default:
return "ToolsVersion=\"2.0\"";
return "ToolsVersion=\"3.0\"";
default:
return "ToolsVersion=\"2.0\"";
}
}
File diff suppressed because it is too large Load Diff
+40 -40
View File
@@ -25,44 +25,44 @@ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY O
namespace Prebuild.Core.Targets
{
/// <summary>
///
/// </summary>
public enum VSVersion
{
/// <summary>
/// Visual Studio 2002
/// </summary>
VS70,
/// <summary>
/// Visual Studio 2003
/// </summary>
VS71,
/// <summary>
/// Visual Studio 2005
/// </summary>
VS80,
/// <summary>
/// Visual Studio 2008
/// </summary>
VS90,
/// <summary>
/// Visual Studio 2010
/// </summary>
VS10,
/// <summary>
/// Visual Studio 2012
/// </summary>
VS11,
/// <summary>
/// Visual Studio 2013
/// </summary>
VS12,
/// <summary>
/// Visual Studio 2015
/// </summary>
VS15,
VS17,
VS19
}
/// <summary>
///
/// </summary>
public enum VSVersion
{
/// <summary>
/// Visual Studio 2002
/// </summary>
VS70,
/// <summary>
/// Visual Studio 2003
/// </summary>
VS71,
/// <summary>
/// Visual Studio 2005
/// </summary>
VS80,
/// <summary>
/// Visual Studio 2008
/// </summary>
VS90,
/// <summary>
/// Visual Studio 2010
/// </summary>
VS10,
/// <summary>
/// Visual Studio 2012
/// </summary>
VS11,
/// <summary>
/// Visual Studio 2013
/// </summary>
VS12,
/// <summary>
/// Visual Studio 2015
/// </summary>
VS15,
VS17,
VS19
}
}
+36 -36
View File
@@ -20,44 +20,44 @@
using System;
using System.Runtime.Serialization;
namespace Prebuild.Core
namespace Prebuild.Core
{
/// <summary>
/// </summary>
[Serializable()]
public class UnknownLanguageException : Exception
{
/// <summary>
/// Basic exception.
/// </summary>
public UnknownLanguageException()
{
}
/// <summary>
/// </summary>
[Serializable()]
public class UnknownLanguageException : Exception
{
/// <summary>
/// Basic exception.
/// </summary>
public UnknownLanguageException()
{
}
/// <summary>
/// Exception with specified string
/// </summary>
/// <param name="message">Exception message</param>
public UnknownLanguageException(string message): base(message)
{
}
/// <summary>
/// Exception with specified string
/// </summary>
/// <param name="message">Exception message</param>
public UnknownLanguageException(string message) : base(message)
{
}
/// <summary>
///
/// </summary>
/// <param name="message"></param>
/// <param name="exception"></param>
public UnknownLanguageException(string message, Exception exception) : base(message, exception)
{
}
/// <summary>
///
/// </summary>
/// <param name="message"></param>
/// <param name="exception"></param>
public UnknownLanguageException(string message, Exception exception) : base(message, exception)
{
}
/// <summary>
///
/// </summary>
/// <param name="info"></param>
/// <param name="context"></param>
protected UnknownLanguageException(SerializationInfo info, StreamingContext context) : base( info, context )
{
}
}
/// <summary>
///
/// </summary>
/// <param name="info"></param>
/// <param name="context"></param>
protected UnknownLanguageException(SerializationInfo info, StreamingContext context) : base(info, context)
{
}
}
}
@@ -27,126 +27,126 @@ using System.Collections;
using System.Collections.Generic;
namespace Prebuild.Core.Utilities
{
/// <summary>
/// The CommandLine class parses and interprets the command-line arguments passed to
/// prebuild.
/// </summary>
public class CommandLineCollection : IEnumerable<KeyValuePair<string, string>>
{
#region Fields
{
/// <summary>
/// The CommandLine class parses and interprets the command-line arguments passed to
/// prebuild.
/// </summary>
public class CommandLineCollection : IEnumerable<KeyValuePair<string, string>>
{
#region Fields
// The raw OS arguments
private readonly string[] m_RawArgs;
// The raw OS arguments
private readonly string[] m_RawArgs;
// Command-line argument storage
private readonly Dictionary<string, string> m_Arguments = new Dictionary<string, string>();
#endregion
#region Constructors
/// <summary>
/// Create a new CommandLine instance and set some internal variables.
/// </summary>
public CommandLineCollection(string[] args)
{
m_RawArgs = args;
Parse();
}
// Command-line argument storage
private readonly Dictionary<string, string> m_Arguments = new Dictionary<string, string>();
#endregion
#endregion
#region Private Methods
#region Constructors
private void Parse()
{
if(m_RawArgs.Length < 1)
return;
/// <summary>
/// Create a new CommandLine instance and set some internal variables.
/// </summary>
public CommandLineCollection(string[] args)
{
m_RawArgs = args;
int idx = 0;
Parse();
}
#endregion
#region Private Methods
private void Parse()
{
if (m_RawArgs.Length < 1)
return;
int idx = 0;
string lastArg = null;
while(idx <m_RawArgs.Length)
{
string arg = m_RawArgs[idx];
while (idx < m_RawArgs.Length)
{
string arg = m_RawArgs[idx];
if(arg.Length > 2 && arg[0] == '/')
{
arg = arg.Substring(1);
lastArg = arg;
m_Arguments[arg] = "";
}
else
{
if(lastArg != null)
{
m_Arguments[lastArg] = arg;
lastArg = null;
}
}
if (arg.Length > 2 && arg[0] == '/')
{
arg = arg.Substring(1);
lastArg = arg;
m_Arguments[arg] = "";
}
else
{
if (lastArg != null)
{
m_Arguments[lastArg] = arg;
lastArg = null;
}
}
idx++;
}
}
idx++;
}
}
#endregion
#endregion
#region Public Methods
#region Public Methods
/// <summary>
/// Wases the passed.
/// </summary>
/// <param name="arg">The arg.</param>
/// <returns></returns>
public bool WasPassed(string arg)
{
return (m_Arguments.ContainsKey(arg));
}
/// <summary>
/// Wases the passed.
/// </summary>
/// <param name="arg">The arg.</param>
/// <returns></returns>
public bool WasPassed(string arg)
{
return (m_Arguments.ContainsKey(arg));
}
#endregion
#endregion
#region Properties
#region Properties
/// <summary>
/// Gets the parameter associated with the command line option
/// </summary>
/// <remarks>Returns null if option was not specified,
/// null string if no parameter was specified, and the value if a parameter was specified</remarks>
public string this[string index]
{
get
{
if(m_Arguments.ContainsKey(index))
{
return (m_Arguments[index]);
}
return null;
}
}
/// <summary>
/// Gets the parameter associated with the command line option
/// </summary>
/// <remarks>Returns null if option was not specified,
/// null string if no parameter was specified, and the value if a parameter was specified</remarks>
public string this[string index]
{
get
{
if (m_Arguments.ContainsKey(index))
{
return (m_Arguments[index]);
}
return null;
}
}
#endregion
#endregion
#region IEnumerable Members
#region IEnumerable Members
/// <summary>
/// Returns an enumerator that can iterate through a collection.
/// </summary>
/// <returns>
/// An <see cref="T:System.Collections.IDictionaryEnumerator"/>
/// that can be used to iterate through the collection.
/// </returns>
/// <summary>
/// Returns an enumerator that can iterate through a collection.
/// </summary>
/// <returns>
/// An <see cref="T:System.Collections.IDictionaryEnumerator"/>
/// that can be used to iterate through the collection.
/// </returns>
public IEnumerator<KeyValuePair<string, string>> GetEnumerator()
{
return m_Arguments.GetEnumerator();
}
{
return m_Arguments.GetEnumerator();
}
IEnumerator IEnumerable.GetEnumerator()
{
return GetEnumerator();
}
IEnumerator IEnumerable.GetEnumerator()
{
return GetEnumerator();
}
#endregion
}
#endregion
}
}
+31 -31
View File
@@ -28,41 +28,41 @@ using System.Collections.Generic;
namespace Prebuild.Core.Utilities
{
/// <summary>
///
/// </summary>
public class CurrentDirectory
{
#region Fields
/// <summary>
///
/// </summary>
public class CurrentDirectory
{
#region Fields
private readonly Stack<string> m_Stack = new Stack<string>();
private readonly Stack<string> m_Stack = new Stack<string>();
#endregion
#endregion
#region Public Methods
#region Public Methods
/// <summary>
/// Pushes this instance.
/// </summary>
public void Push()
{
m_Stack.Push(Environment.CurrentDirectory);
}
/// <summary>
/// Pushes this instance.
/// </summary>
public void Push()
{
m_Stack.Push(Environment.CurrentDirectory);
}
/// <summary>
/// Pops this instance.
/// </summary>
public void Pop()
{
if(m_Stack.Count < 1)
{
return;
}
string cwd = m_Stack.Pop();
Helper.SetCurrentDir(cwd);
}
/// <summary>
/// Pops this instance.
/// </summary>
public void Pop()
{
if (m_Stack.Count < 1)
{
return;
}
#endregion
}
string cwd = m_Stack.Pop();
Helper.SetCurrentDir(cwd);
}
#endregion
}
}
File diff suppressed because it is too large Load Diff
+208 -208
View File
@@ -28,74 +28,74 @@ using System.IO;
namespace Prebuild.Core.Utilities
{
/// <summary>
///
/// </summary>
public enum LogType
{
/// <summary>
///
/// </summary>
None,
/// <summary>
///
/// </summary>
Info,
/// <summary>
///
/// </summary>
Warning,
/// <summary>
///
/// </summary>
Error
}
/// <summary>
///
/// </summary>
public enum LogType
{
/// <summary>
///
/// </summary>
None,
/// <summary>
///
/// </summary>
Info,
/// <summary>
///
/// </summary>
Warning,
/// <summary>
///
/// </summary>
Error
}
/// <summary>
///
/// </summary>
[Flags]
public enum LogTargets
{
/// <summary>
///
/// </summary>
None = 0,
/// <summary>
///
/// </summary>
Null = 1,
/// <summary>
///
/// </summary>
File = 2,
/// <summary>
///
/// </summary>
Console = 4
}
/// <summary>
///
/// </summary>
[Flags]
public enum LogTargets
{
/// <summary>
///
/// </summary>
None = 0,
/// <summary>
///
/// </summary>
Null = 1,
/// <summary>
///
/// </summary>
File = 2,
/// <summary>
///
/// </summary>
Console = 4
}
/// <summary>
/// Summary description for Log.
/// </summary>
public class Log : IDisposable
{
#region Fields
/// <summary>
/// Summary description for Log.
/// </summary>
public class Log : IDisposable
{
#region Fields
private TextWriter m_Writer;
private LogTargets m_Target = LogTargets.Null;
bool disposed;
private TextWriter m_Writer;
private LogTargets m_Target = LogTargets.Null;
bool disposed;
#endregion
#endregion
#region Constructors
#region Constructors
/// <summary>
/// Initializes a new instance of the <see cref="Log"/> class.
/// </summary>
/// <param name="target">The target.</param>
/// <param name="fileName">Name of the file.</param>
public Log(LogTargets target, string fileName)
/// <summary>
/// Initializes a new instance of the <see cref="Log"/> class.
/// </summary>
/// <param name="target">The target.</param>
/// <param name="fileName">Name of the file.</param>
public Log(LogTargets target, string fileName)
{
m_Target = target;
@@ -111,166 +111,166 @@ namespace Prebuild.Core.Utilities
}
}
#endregion
#endregion
#region Public Methods
#region Public Methods
/// <summary>
/// Writes this instance.
/// </summary>
public void Write()
{
Write(string.Empty);
}
/// <summary>
/// Writes this instance.
/// </summary>
public void Write()
{
Write(string.Empty);
}
/// <summary>
/// Writes the specified MSG.
/// </summary>
/// <param name="msg">The MSG.</param>
public void Write(string msg)
{
if((m_Target & LogTargets.Null) != 0)
{
return;
}
/// <summary>
/// Writes the specified MSG.
/// </summary>
/// <param name="msg">The MSG.</param>
public void Write(string msg)
{
if ((m_Target & LogTargets.Null) != 0)
{
return;
}
if((m_Target & LogTargets.Console) != 0)
{
Console.WriteLine(msg);
}
if((m_Target & LogTargets.File) != 0 && m_Writer != null)
{
m_Writer.WriteLine(msg);
}
}
if ((m_Target & LogTargets.Console) != 0)
{
Console.WriteLine(msg);
}
if ((m_Target & LogTargets.File) != 0 && m_Writer != null)
{
m_Writer.WriteLine(msg);
}
}
/// <summary>
/// Writes the specified format.
/// </summary>
/// <param name="format">The format.</param>
/// <param name="args">The args.</param>
public void Write(string format, params object[] args)
{
Write(string.Format(format,args));
}
/// <summary>
/// Writes the specified format.
/// </summary>
/// <param name="format">The format.</param>
/// <param name="args">The args.</param>
public void Write(string format, params object[] args)
{
Write(string.Format(format, args));
}
/// <summary>
/// Writes the specified type.
/// </summary>
/// <param name="type">The type.</param>
/// <param name="format">The format.</param>
/// <param name="args">The args.</param>
public void Write(LogType type, string format, params object[] args)
{
if((m_Target & LogTargets.Null) != 0)
{
return;
}
/// <summary>
/// Writes the specified type.
/// </summary>
/// <param name="type">The type.</param>
/// <param name="format">The format.</param>
/// <param name="args">The args.</param>
public void Write(LogType type, string format, params object[] args)
{
if ((m_Target & LogTargets.Null) != 0)
{
return;
}
string str = "";
switch(type)
{
case LogType.Info:
str = "[I] ";
break;
case LogType.Warning:
str = "[!] ";
break;
case LogType.Error:
str = "[X] ";
break;
}
string str = "";
switch (type)
{
case LogType.Info:
str = "[I] ";
break;
case LogType.Warning:
str = "[!] ";
break;
case LogType.Error:
str = "[X] ";
break;
}
Write(str + format,args);
}
Write(str + format, args);
}
/// <summary>
/// Writes the exception.
/// </summary>
/// <param name="type">The type.</param>
/// <param name="ex">The ex.</param>
public void WriteException(LogType type, Exception ex)
{
if(ex != null)
{
Write(type, ex.Message);
//#if DEBUG
m_Writer.WriteLine("Exception @{0} stack trace [[", ex.TargetSite.Name);
m_Writer.WriteLine(ex.StackTrace);
m_Writer.WriteLine("]]");
//#endif
}
}
/// <summary>
/// Writes the exception.
/// </summary>
/// <param name="type">The type.</param>
/// <param name="ex">The ex.</param>
public void WriteException(LogType type, Exception ex)
{
if (ex != null)
{
Write(type, ex.Message);
//#if DEBUG
m_Writer.WriteLine("Exception @{0} stack trace [[", ex.TargetSite.Name);
m_Writer.WriteLine(ex.StackTrace);
m_Writer.WriteLine("]]");
//#endif
}
}
/// <summary>
/// Flushes this instance.
/// </summary>
public void Flush()
{
if(m_Writer != null)
{
m_Writer.Flush();
}
}
/// <summary>
/// Flushes this instance.
/// </summary>
public void Flush()
{
if (m_Writer != null)
{
m_Writer.Flush();
}
}
#endregion
#endregion
#region IDisposable Members
#region IDisposable Members
/// <summary>
/// Performs application-defined tasks associated with freeing, releasing, or
/// resetting unmanaged resources.
/// </summary>
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
/// <summary>
/// Performs application-defined tasks associated with freeing, releasing, or
/// resetting unmanaged resources.
/// </summary>
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
/// <summary>
/// Dispose objects
/// </summary>
/// <param name="disposing">
/// If true, it will dispose close the handle
/// </param>
/// <remarks>
/// Will dispose managed and unmanaged resources.
/// </remarks>
protected virtual void Dispose(bool disposing)
{
if (!this.disposed)
{
if (disposing)
{
if (m_Writer != null)
{
m_Writer.Close();
m_Writer = null;
}
}
}
this.disposed = true;
}
/// <summary>
/// Dispose objects
/// </summary>
/// <param name="disposing">
/// If true, it will dispose close the handle
/// </param>
/// <remarks>
/// Will dispose managed and unmanaged resources.
/// </remarks>
protected virtual void Dispose(bool disposing)
{
if (!this.disposed)
{
if (disposing)
{
if (m_Writer != null)
{
m_Writer.Close();
m_Writer = null;
}
}
}
this.disposed = true;
}
/// <summary>
///
/// </summary>
~Log()
{
this.Dispose(false);
}
/// <summary>
/// Closes and destroys this object
/// </summary>
/// <remarks>
/// Same as Dispose(true)
/// </remarks>
public void Close()
{
Dispose();
}
/// <summary>
///
/// </summary>
~Log()
{
this.Dispose(false);
}
#endregion
}
/// <summary>
/// Closes and destroys this object
/// </summary>
/// <remarks>
/// Same as Dispose(true)
/// </remarks>
public void Close()
{
Dispose();
}
#endregion
}
}
+47 -47
View File
@@ -28,57 +28,57 @@ using System.Runtime.Serialization;
namespace Prebuild.Core
{
/// <summary>
///
/// </summary>
[Serializable]
public class WarningException : Exception
{
#region Constructors
/// <summary>
///
/// </summary>
[Serializable]
public class WarningException : Exception
{
#region Constructors
/// <summary>
///
/// </summary>
public WarningException()
{
}
/// <summary>
///
/// </summary>
public WarningException()
{
}
/// <summary>
///
/// </summary>
/// <param name="format"></param>
/// <param name="args"></param>
public WarningException(string format, params object[] args)
: base(String.Format(format, args))
{
}
/// <summary>
///
/// </summary>
/// <param name="format"></param>
/// <param name="args"></param>
public WarningException(string format, params object[] args)
: base(String.Format(format, args))
{
}
/// <summary>
/// Exception with specified string
/// </summary>
/// <param name="message">Exception message</param>
public WarningException(string message): base(message)
{
}
/// <summary>
/// Exception with specified string
/// </summary>
/// <param name="message">Exception message</param>
public WarningException(string message) : base(message)
{
}
/// <summary>
///
/// </summary>
/// <param name="message"></param>
/// <param name="exception"></param>
public WarningException(string message, Exception exception) : base(message, exception)
{
}
/// <summary>
///
/// </summary>
/// <param name="message"></param>
/// <param name="exception"></param>
public WarningException(string message, Exception exception) : base(message, exception)
{
}
/// <summary>
///
/// </summary>
/// <param name="info"></param>
/// <param name="context"></param>
protected WarningException(SerializationInfo info, StreamingContext context) : base( info, context )
{
}
/// <summary>
///
/// </summary>
/// <param name="info"></param>
/// <param name="context"></param>
protected WarningException(SerializationInfo info, StreamingContext context) : base(info, context)
{
}
#endregion
}
#endregion
}
}
+99 -99
View File
@@ -42,50 +42,50 @@ using System.EnterpriseServices.Internal;
using Prebuild.Core;
using Prebuild.Core.Utilities;
namespace Prebuild
namespace Prebuild
{
/// <summary>
///
/// </summary>
class Prebuild
{
#region Main
/// <summary>
///
/// </summary>
class Prebuild
{
#region Main
[STAThread]
static void Main(string[] args)
{
Kernel kernel = null;
try
{
kernel = Kernel.Instance;
kernel.Initialize(LogTargets.File | LogTargets.Console, args);
bool exit = false;
[STAThread]
static void Main(string[] args)
{
Kernel kernel = null;
try
{
kernel = Kernel.Instance;
kernel.Initialize(LogTargets.File | LogTargets.Console, args);
bool exit = false;
if(kernel.CommandLine.WasPassed("usage"))
{
exit = true;
OutputUsage();
}
if(kernel.CommandLine.WasPassed("showtargets"))
{
exit = true;
OutputTargets(kernel);
}
if(kernel.CommandLine.WasPassed("install"))
{
exit = true;
InstallAssembly(kernel);
}
if(kernel.CommandLine.WasPassed("remove"))
{
exit = true;
RemoveAssembly(kernel);
}
if (kernel.CommandLine.WasPassed("usage"))
{
exit = true;
OutputUsage();
}
if (kernel.CommandLine.WasPassed("showtargets"))
{
exit = true;
OutputTargets(kernel);
}
if (kernel.CommandLine.WasPassed("install"))
{
exit = true;
InstallAssembly(kernel);
}
if (kernel.CommandLine.WasPassed("remove"))
{
exit = true;
RemoveAssembly(kernel);
}
if(!exit)
{
kernel.Process();
}
if (!exit)
{
kernel.Process();
}
}
#if !DEBUG
catch (Exception ex)
@@ -96,70 +96,70 @@ namespace Prebuild
#endif
finally
{
if(kernel != null && kernel.PauseAfterFinish)
{
Console.WriteLine("\nPress enter to continue...");
Console.ReadLine();
}
}
}
if (kernel != null && kernel.PauseAfterFinish)
{
Console.WriteLine("\nPress enter to continue...");
Console.ReadLine();
}
}
}
#endregion
#endregion
#region Private Methods
#region Private Methods
private static void InstallAssembly(Kernel kernel)
{
Publish publish = new Publish();
string file = kernel.CommandLine["install"];
private static void InstallAssembly(Kernel kernel)
{
Publish publish = new Publish();
string file = kernel.CommandLine["install"];
//Console.WriteLine(".."+file+"..");
publish.GacInstall(file);
}
publish.GacInstall(file);
}
private static void RemoveAssembly(Kernel kernel)
{
Publish publish = new Publish();
string file = kernel.CommandLine["remove"];
publish.GacRemove(file);
}
private static void RemoveAssembly(Kernel kernel)
{
Publish publish = new Publish();
string file = kernel.CommandLine["remove"];
publish.GacRemove(file);
}
private static void OutputUsage()
{
Console.WriteLine("Usage: prebuild /target <target> [options]");
Console.WriteLine("Available command-line switches:");
Console.WriteLine();
Console.WriteLine("/target Target for Prebuild");
Console.WriteLine("/clean Clean the build files for the given target");
Console.WriteLine("/file XML file to process");
Console.WriteLine("/log Log file to write to");
Console.WriteLine("/ppo Pre-process the file, but perform no other processing");
Console.WriteLine("/pause Pauses the application after execution to view the output");
Console.WriteLine("/yes Default to yes to any questions asked");
Console.WriteLine("/install Install assembly into the GAC");
Console.WriteLine("/remove Remove assembly from the GAC");
Console.WriteLine();
Console.WriteLine("See 'prebuild /showtargets for a list of available targets");
Console.WriteLine("See readme.txt or check out http://dnpb.sourceforge.net for more information");
Console.WriteLine();
}
private static void OutputUsage()
{
Console.WriteLine("Usage: prebuild /target <target> [options]");
Console.WriteLine("Available command-line switches:");
Console.WriteLine();
Console.WriteLine("/target Target for Prebuild");
Console.WriteLine("/clean Clean the build files for the given target");
Console.WriteLine("/file XML file to process");
Console.WriteLine("/log Log file to write to");
Console.WriteLine("/ppo Pre-process the file, but perform no other processing");
Console.WriteLine("/pause Pauses the application after execution to view the output");
Console.WriteLine("/yes Default to yes to any questions asked");
Console.WriteLine("/install Install assembly into the GAC");
Console.WriteLine("/remove Remove assembly from the GAC");
Console.WriteLine();
Console.WriteLine("See 'prebuild /showtargets for a list of available targets");
Console.WriteLine("See readme.txt or check out http://dnpb.sourceforge.net for more information");
Console.WriteLine();
}
private static void OutputTargets(Kernel kern)
{
Console.WriteLine("Targets available in Prebuild:");
Console.WriteLine("");
if(kern.Targets.Keys.Count > 0)
{
string[] targs = new string[kern.Targets.Keys.Count];
kern.Targets.Keys.CopyTo(targs, 0);
Array.Sort(targs);
foreach(string target in targs)
{
Console.WriteLine(target);
}
}
Console.WriteLine("");
}
#endregion
}
private static void OutputTargets(Kernel kern)
{
Console.WriteLine("Targets available in Prebuild:");
Console.WriteLine("");
if (kern.Targets.Keys.Count > 0)
{
string[] targs = new string[kern.Targets.Keys.Count];
kern.Targets.Keys.CopyTo(targs, 0);
Array.Sort(targs);
foreach (string target in targs)
{
Console.WriteLine(target);
}
}
Console.WriteLine("");
}
#endregion
}
}