Add a initialization command to prebuild
This commit is contained in:
parent
f0b7dd327a
commit
353006b90b
30 changed files with 731 additions and 195 deletions
Binary file not shown.
|
@ -42,10 +42,12 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Xml;
|
using System.Xml;
|
||||||
using System.Xml.Schema;
|
using System.Xml.Schema;
|
||||||
|
using System.Xml.Serialization;
|
||||||
using Prebuild.Core.Attributes;
|
using Prebuild.Core.Attributes;
|
||||||
using Prebuild.Core.Interfaces;
|
using Prebuild.Core.Interfaces;
|
||||||
using Prebuild.Core.Nodes;
|
using Prebuild.Core.Nodes;
|
||||||
|
@ -94,10 +96,10 @@ public class Kernel : IDisposable
|
||||||
|
|
||||||
private readonly Dictionary<string, NodeEntry> m_Nodes = new();
|
private readonly Dictionary<string, NodeEntry> m_Nodes = new();
|
||||||
|
|
||||||
private string m_Target;
|
private string m_Target = "vs2022";
|
||||||
private bool cmdlineTargetFramework;
|
private bool cmdlineTargetFramework;
|
||||||
private FrameworkVersion m_TargetFramework; //Overrides all project settings
|
private FrameworkVersion m_TargetFramework; //Overrides all project settings
|
||||||
public string ForcedConditionals { get; private set; }
|
public string ForcedConditionals { get; internal set; }
|
||||||
|
|
||||||
private string m_Clean;
|
private string m_Clean;
|
||||||
private string[] m_RemoveDirectories;
|
private string[] m_RemoveDirectories;
|
||||||
|
@ -113,7 +115,7 @@ public class Kernel : IDisposable
|
||||||
/// Gets a value indicating whether [pause after finish].
|
/// Gets a value indicating whether [pause after finish].
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value><c>true</c> if [pause after finish]; otherwise, <c>false</c>.</value>
|
/// <value><c>true</c> if [pause after finish]; otherwise, <c>false</c>.</value>
|
||||||
public bool PauseAfterFinish { get; private set; }
|
public bool PauseAfterFinish { get; internal set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the instance.
|
/// Gets the instance.
|
||||||
|
@ -132,7 +134,7 @@ public class Kernel : IDisposable
|
||||||
/// Gets the command line.
|
/// Gets the command line.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The command line.</value>
|
/// <value>The command line.</value>
|
||||||
public CommandLineCollection CommandLine { get; private set; }
|
public CommandLineCollection CommandLine { get; internal set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the targets.
|
/// Gets the targets.
|
||||||
|
@ -144,13 +146,13 @@ public class Kernel : IDisposable
|
||||||
/// Gets the log.
|
/// Gets the log.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The log.</value>
|
/// <value>The log.</value>
|
||||||
public Log Log { get; private set; }
|
public Log Log { get; internal set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the current working directory.
|
/// Gets the current working directory.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The current working directory.</value>
|
/// <value>The current working directory.</value>
|
||||||
public CurrentDirectory CurrentWorkingDirectory { get; private set; }
|
public CurrentDirectory CurrentWorkingDirectory { get; internal set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the solutions.
|
/// Gets the solutions.
|
||||||
|
@ -163,7 +165,7 @@ public class Kernel : IDisposable
|
||||||
/// being processed
|
/// being processed
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The XmlDocument object</value>
|
/// <value>The XmlDocument object</value>
|
||||||
public XmlDocument CurrentDoc { get; private set; }
|
public XmlDocument CurrentDoc { get; internal set; }
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
@ -270,7 +272,8 @@ public class Kernel : IDisposable
|
||||||
Log.Write("John Hurliman (john.hurliman@intel.com),");
|
Log.Write("John Hurliman (john.hurliman@intel.com),");
|
||||||
Log.Write("WhiteCore build 2015 (greythane@gmail.com),");
|
Log.Write("WhiteCore build 2015 (greythane@gmail.com),");
|
||||||
Log.Write("OpenSimulator build 2017 Ubit Umarov,");
|
Log.Write("OpenSimulator build 2017 Ubit Umarov,");
|
||||||
Log.Write("");
|
Log.Write("Aria's Creations 2023 - Tara Piccari");
|
||||||
|
Log.Write();
|
||||||
Log.Write("See 'prebuild /usage' for help");
|
Log.Write("See 'prebuild /usage' for help");
|
||||||
Log.Write();
|
Log.Write();
|
||||||
}
|
}
|
||||||
|
@ -646,6 +649,63 @@ public class Kernel : IDisposable
|
||||||
var file = "./prebuild.xml";
|
var file = "./prebuild.xml";
|
||||||
if (CommandLine.WasPassed("file")) file = CommandLine["file"];
|
if (CommandLine.WasPassed("file")) file = CommandLine["file"];
|
||||||
|
|
||||||
|
if(CommandLine.WasPassed("init"))
|
||||||
|
{
|
||||||
|
Log.Write("Initializing a skeleton Prebuild.xml file");
|
||||||
|
// Initialize a new Prebuild file
|
||||||
|
// Write out a dummy file with a Solution that consists of a dummy project.
|
||||||
|
|
||||||
|
XmlDocument doc = new XmlDocument();
|
||||||
|
XmlElement elem = doc.CreateElement("Prebuild");
|
||||||
|
|
||||||
|
var ver = doc.CreateAttribute("version");
|
||||||
|
ver.InnerText = "1.10";
|
||||||
|
elem.Attributes.Append(ver);
|
||||||
|
|
||||||
|
var ns = doc.CreateAttribute("xmlns");
|
||||||
|
ns.InnerText = "http://dnpb.sourceforge.net/schemas/prebuild-1.10.xsd";
|
||||||
|
elem.Attributes.Append(ns);
|
||||||
|
|
||||||
|
doc.AppendChild(elem);
|
||||||
|
|
||||||
|
SolutionNode sol = new SolutionNode();
|
||||||
|
sol.Name = "Example";
|
||||||
|
sol.Version = "1.0";
|
||||||
|
sol.DefaultFramework = FrameworkVersion.net7_0;
|
||||||
|
|
||||||
|
ProjectNode proj = new ProjectNode();
|
||||||
|
proj.Name = "Hello World";
|
||||||
|
proj.Path = "source/example";
|
||||||
|
var Opts = new OptionsNode();
|
||||||
|
Opts.OutputPath = "../../bin/";
|
||||||
|
|
||||||
|
ConfigurationNode debug = new ConfigurationNode();
|
||||||
|
debug.Name = "Debug";
|
||||||
|
debug.Options = Opts;
|
||||||
|
|
||||||
|
ConfigurationNode release = new ConfigurationNode();
|
||||||
|
release.Name = "Release";
|
||||||
|
release.Options = Opts;
|
||||||
|
|
||||||
|
proj.ConfigurationsTable.Add("Debug", debug);
|
||||||
|
proj.ConfigurationsTable.Add("Release", release);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
sol.ProjectsTable.Add(proj.Name, proj);
|
||||||
|
|
||||||
|
sol.Write(doc, elem);
|
||||||
|
|
||||||
|
|
||||||
|
using (FileStream fs = new FileStream(file, FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.ReadWrite))
|
||||||
|
{
|
||||||
|
doc.Save(fs);
|
||||||
|
}
|
||||||
|
|
||||||
|
Log.Write("Initialization completed");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
ProcessFile(file);
|
ProcessFile(file);
|
||||||
|
|
||||||
var target = m_Target != null ? m_Target.ToLower() : m_Clean.ToLower();
|
var target = m_Target != null ? m_Target.ToLower() : m_Clean.ToLower();
|
||||||
|
|
|
@ -27,6 +27,7 @@ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY O
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Xml;
|
using System.Xml;
|
||||||
|
using System.Xml.Linq;
|
||||||
using Prebuild.Core.Attributes;
|
using Prebuild.Core.Attributes;
|
||||||
using Prebuild.Core.Utilities;
|
using Prebuild.Core.Utilities;
|
||||||
|
|
||||||
|
@ -47,7 +48,7 @@ public class AuthorNode : DataNode
|
||||||
/// Gets the signature.
|
/// Gets the signature.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The signature.</value>
|
/// <value>The signature.</value>
|
||||||
public string Signature { get; private set; }
|
public string Signature { get; internal set; }
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
@ -67,5 +68,13 @@ public class AuthorNode : DataNode
|
||||||
Signature = Signature.Trim();
|
Signature = Signature.Trim();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override void Write(XmlDocument doc, XmlElement current)
|
||||||
|
{
|
||||||
|
|
||||||
|
XmlElement elem = doc.CreateElement("Author");
|
||||||
|
elem.InnerText = Signature;
|
||||||
|
current.AppendChild(elem);
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
|
@ -45,7 +45,7 @@ public class CleanFilesNode : DataNode
|
||||||
/// Gets the signature.
|
/// Gets the signature.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The signature.</value>
|
/// <value>The signature.</value>
|
||||||
public string Pattern { get; private set; }
|
public string Pattern { get; internal set; }
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
@ -60,9 +60,18 @@ public class CleanFilesNode : DataNode
|
||||||
if (node == null) throw new ArgumentNullException("node");
|
if (node == null) throw new ArgumentNullException("node");
|
||||||
|
|
||||||
Pattern = Helper.AttributeValue(node, "pattern", string.Empty);
|
Pattern = Helper.AttributeValue(node, "pattern", string.Empty);
|
||||||
;
|
|
||||||
Pattern = Pattern.Trim();
|
Pattern = Pattern.Trim();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public override void Write(XmlDocument doc, XmlElement current)
|
||||||
|
{
|
||||||
|
XmlElement Clean = doc.CreateElement("CleanFiles");
|
||||||
|
Clean.InnerText = Pattern;
|
||||||
|
|
||||||
|
current.AppendChild (Clean);
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
|
@ -66,5 +66,15 @@ public class CleanupNode : DataNode
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override void Write(XmlDocument doc, XmlElement current)
|
||||||
|
{
|
||||||
|
XmlElement main = doc.CreateElement("Cleanup");
|
||||||
|
foreach(CleanFilesNode n in CleanFiles)
|
||||||
|
{
|
||||||
|
n.Write(doc, main);
|
||||||
|
}
|
||||||
|
current.AppendChild(main);
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
|
@ -133,7 +133,7 @@ public class ConfigurationNode : DataNode, ICloneable, IComparable
|
||||||
/// Gets the name.
|
/// Gets the name.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The name.</value>
|
/// <value>The name.</value>
|
||||||
public string Name { get; private set; } = "unknown";
|
public string Name { get; internal set; } = "unknown";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the name and platform for the configuration.
|
/// Gets the name and platform for the configuration.
|
||||||
|
@ -187,5 +187,17 @@ public class ConfigurationNode : DataNode, ICloneable, IComparable
|
||||||
Options.CopyTo(conf.Options);
|
Options.CopyTo(conf.Options);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override void Write(XmlDocument doc, XmlElement current)
|
||||||
|
{
|
||||||
|
XmlElement main = doc.CreateElement("Configuration");
|
||||||
|
main.SetAttribute("name", Name);
|
||||||
|
main.SetAttribute("platform", Platform);
|
||||||
|
|
||||||
|
|
||||||
|
Options.Write(doc, main);
|
||||||
|
|
||||||
|
current.AppendChild(main);
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
|
@ -27,6 +27,7 @@ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY O
|
||||||
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Xml;
|
using System.Xml;
|
||||||
|
using System.Xml.Serialization;
|
||||||
using Prebuild.Core.Interfaces;
|
using Prebuild.Core.Interfaces;
|
||||||
|
|
||||||
namespace Prebuild.Core.Nodes;
|
namespace Prebuild.Core.Nodes;
|
||||||
|
@ -57,6 +58,16 @@ public abstract class DataNode : IDataNode
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Serializes to the specified node
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="doc">The document</param>
|
||||||
|
/// <param name="current">The current node</param>
|
||||||
|
public virtual void Write(XmlDocument doc, XmlElement current) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public BuildAction GetBuildActionByFileName(string fileName)
|
public BuildAction GetBuildActionByFileName(string fileName)
|
||||||
{
|
{
|
||||||
var extension = Path.GetExtension(fileName).ToLower();
|
var extension = Path.GetExtension(fileName).ToLower();
|
||||||
|
|
|
@ -14,11 +14,11 @@ public class DatabaseProjectNode : DataNode
|
||||||
|
|
||||||
public Guid Guid { get; } = Guid.NewGuid();
|
public Guid Guid { get; } = Guid.NewGuid();
|
||||||
|
|
||||||
public string Name { get; private set; }
|
public string Name { get; internal set; }
|
||||||
|
|
||||||
public string Path { get; private set; }
|
public string Path { get; internal set; }
|
||||||
|
|
||||||
public string FullPath { get; private set; }
|
public string FullPath { get; internal set; }
|
||||||
|
|
||||||
public IEnumerable<DatabaseReferenceNode> References => references;
|
public IEnumerable<DatabaseReferenceNode> References => references;
|
||||||
|
|
||||||
|
@ -64,4 +64,24 @@ public class DatabaseProjectNode : DataNode
|
||||||
|
|
||||||
base.Parse(node);
|
base.Parse(node);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override void Write(XmlDocument doc, XmlElement current)
|
||||||
|
{
|
||||||
|
|
||||||
|
XmlElement main = doc.CreateElement("DatabaseProject");
|
||||||
|
main.SetAttribute("name", Name);
|
||||||
|
main.SetAttribute("path", Path);
|
||||||
|
|
||||||
|
|
||||||
|
foreach(AuthorNode author in authors)
|
||||||
|
{
|
||||||
|
author.Write(doc, main);
|
||||||
|
}
|
||||||
|
foreach(DatabaseReferenceNode databaseReference in references)
|
||||||
|
{
|
||||||
|
databaseReference.Write(doc, main);
|
||||||
|
}
|
||||||
|
|
||||||
|
current.AppendChild(main);
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -8,11 +8,11 @@ namespace Prebuild.Core.Nodes;
|
||||||
[DataNode("DatabaseReference")]
|
[DataNode("DatabaseReference")]
|
||||||
public class DatabaseReferenceNode : DataNode
|
public class DatabaseReferenceNode : DataNode
|
||||||
{
|
{
|
||||||
public string Name { get; private set; }
|
public string Name { get; internal set; }
|
||||||
|
|
||||||
public Guid ProviderId { get; private set; }
|
public Guid ProviderId { get; internal set; }
|
||||||
|
|
||||||
public string ConnectionString { get; private set; }
|
public string ConnectionString { get; internal set; }
|
||||||
|
|
||||||
public override void Parse(XmlNode node)
|
public override void Parse(XmlNode node)
|
||||||
{
|
{
|
||||||
|
@ -25,19 +25,19 @@ public class DatabaseReferenceNode : DataNode
|
||||||
// digitaljeebus: pulled from HKLM\SOFTWARE\Microsoft\VisualStudio\9.0\DataProviders\*
|
// digitaljeebus: pulled from HKLM\SOFTWARE\Microsoft\VisualStudio\9.0\DataProviders\*
|
||||||
// Not sure if these will help other operating systems, or if there's a better way.
|
// Not sure if these will help other operating systems, or if there's a better way.
|
||||||
case "Microsoft.SqlServerCe.Client.3.5":
|
case "Microsoft.SqlServerCe.Client.3.5":
|
||||||
ProviderId = new Guid("7C602B5B-ACCB-4acd-9DC0-CA66388C1533");
|
ProviderId = new Guid(DatabaseProviders.SqlServerCe35);
|
||||||
break;
|
break;
|
||||||
case "System.Data.OleDb":
|
case "System.Data.OleDb":
|
||||||
ProviderId = new Guid("7F041D59-D76A-44ed-9AA2-FBF6B0548B80");
|
ProviderId = new Guid(DatabaseProviders.OleDb);
|
||||||
break;
|
break;
|
||||||
case "System.Data.OracleClient":
|
case "System.Data.OracleClient":
|
||||||
ProviderId = new Guid("8F5C5018-AE09-42cf-B2CC-2CCCC7CFC2BB");
|
ProviderId = new Guid(DatabaseProviders.OracleClient);
|
||||||
break;
|
break;
|
||||||
case "System.Data.SqlClient":
|
case "System.Data.SqlClient":
|
||||||
ProviderId = new Guid("91510608-8809-4020-8897-FBA057E22D54");
|
ProviderId = new Guid(DatabaseProviders.SqlClient);
|
||||||
break;
|
break;
|
||||||
case "System.Data.Odbc":
|
case "System.Data.Odbc":
|
||||||
ProviderId = new Guid("C3D4F4CE-2C48-4381-B4D6-34FA50C51C86");
|
ProviderId = new Guid(DatabaseProviders.Odbc);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -51,4 +51,70 @@ public class DatabaseReferenceNode : DataNode
|
||||||
|
|
||||||
base.Parse(node);
|
base.Parse(node);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override void Write(XmlDocument doc, XmlElement current)
|
||||||
|
{
|
||||||
|
XmlElement main = doc.CreateElement("DatabaseReference");
|
||||||
|
main.SetAttribute("name", Name);
|
||||||
|
|
||||||
|
string provider = "";
|
||||||
|
string providerId = "";
|
||||||
|
|
||||||
|
|
||||||
|
switch (ProviderId.ToString())
|
||||||
|
{
|
||||||
|
case DatabaseProviders.Odbc:
|
||||||
|
{
|
||||||
|
provider = "System.Data.Odbc";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case DatabaseProviders.OracleClient:
|
||||||
|
{
|
||||||
|
provider = "System.Data.OracleClient";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case DatabaseProviders.SqlClient:
|
||||||
|
{
|
||||||
|
provider = "System.Data.SqlClient";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case DatabaseProviders.OleDb:
|
||||||
|
{
|
||||||
|
provider = "System.Data.OleDb";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case DatabaseProviders.SqlServerCe35:
|
||||||
|
{
|
||||||
|
provider = "Microsoft.SqlServerCe.Client.3.5";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
providerId = ProviderId.ToString();
|
||||||
|
provider = null;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(provider!= null)
|
||||||
|
main.SetAttribute("providerName", provider);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
main.SetAttribute("providerId", providerId);
|
||||||
|
}
|
||||||
|
|
||||||
|
var conn = doc.CreateAttribute("connectionString");
|
||||||
|
conn.InnerText = ConnectionString;
|
||||||
|
main.Attributes.Append(conn);
|
||||||
|
|
||||||
|
current.AppendChild(main);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class DatabaseProviders
|
||||||
|
{
|
||||||
|
public const string SqlServerCe35 = ("7C602B5B-ACCB-4acd-9DC0-CA66388C1533");
|
||||||
|
public const string OleDb = ("7F041D59-D76A-44ed-9AA2-FBF6B0548B80");
|
||||||
|
public const string OracleClient = ("8F5C5018-AE09-42cf-B2CC-2CCCC7CFC2BB");
|
||||||
|
public const string SqlClient = ("91510608-8809-4020-8897-FBA057E22D54");
|
||||||
|
public const string Odbc = ("C3D4F4CE-2C48-4381-B4D6-34FA50C51C86");
|
||||||
}
|
}
|
|
@ -48,7 +48,7 @@ public class DescriptionNode : DataNode
|
||||||
/// Gets the description Value.
|
/// Gets the description Value.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The description Value.</value>
|
/// <value>The description Value.</value>
|
||||||
public string Value { get; private set; }
|
public string Value { get; internal set; }
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
@ -68,5 +68,13 @@ public class DescriptionNode : DataNode
|
||||||
Value = Value.Trim();
|
Value = Value.Trim();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override void Write(XmlDocument doc, XmlElement current)
|
||||||
|
{
|
||||||
|
XmlElement main = doc.CreateElement("Description");
|
||||||
|
main.InnerText = Value;
|
||||||
|
|
||||||
|
current.AppendChild(main);
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
|
@ -49,7 +49,18 @@ public class ExcludeNode : DataNode
|
||||||
public override void Parse(XmlNode node)
|
public override void Parse(XmlNode node)
|
||||||
{
|
{
|
||||||
Name = Helper.AttributeValue(node, "name", Name);
|
Name = Helper.AttributeValue(node, "name", Name);
|
||||||
Name = Helper.AttributeValue(node, "pattern", Name);
|
Pattern = Helper.AttributeValue(node, "pattern", Pattern);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Write(XmlDocument doc, XmlElement current)
|
||||||
|
{
|
||||||
|
XmlElement main = doc.CreateElement("Exclude");
|
||||||
|
if(Name != null && Name!= "")
|
||||||
|
main.SetAttribute("name", Name);
|
||||||
|
else
|
||||||
|
main.SetAttribute("pattern", Pattern);
|
||||||
|
|
||||||
|
current.AppendChild(main);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
@ -60,13 +71,14 @@ public class ExcludeNode : DataNode
|
||||||
/// Gets the name.
|
/// Gets the name.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The name.</value>
|
/// <value>The name.</value>
|
||||||
public string Name { get; private set; } = "";
|
public string Name { get; internal set; } = "";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the pattern.
|
/// Gets the pattern.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The pattern.</value>
|
/// <value>The pattern.</value>
|
||||||
public string Pattern => Name;
|
public string Pattern { get; internal set; } = "";
|
||||||
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
|
@ -155,6 +155,21 @@ public class FileNode : DataNode
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override void Write(XmlDocument doc, XmlElement current)
|
||||||
|
{
|
||||||
|
XmlElement main = doc.CreateElement("File");
|
||||||
|
main.SetAttribute("buildAction", BuildAction.ToString());
|
||||||
|
main.SetAttribute("subType", SubType.ToString());
|
||||||
|
main.SetAttribute("resourceName", ResourceName);
|
||||||
|
main.SetAttribute("link", IsLink ? bool.TrueString : bool.FalseString);
|
||||||
|
main.SetAttribute("linkPath", LinkPath);
|
||||||
|
main.SetAttribute("copyToOutput", CopyToOutput.ToString());
|
||||||
|
main.SetAttribute("preservePath", PreservePath ? bool.TrueString : bool.FalseString);
|
||||||
|
main.InnerText = Path;
|
||||||
|
|
||||||
|
current.AppendChild(main);
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Fields
|
#region Fields
|
||||||
|
@ -168,11 +183,11 @@ public class FileNode : DataNode
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Path { get; private set; }
|
public string Path { get; internal set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string ResourceName { get; private set; } = "";
|
public string ResourceName { get; internal set; } = "";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -186,11 +201,11 @@ public class FileNode : DataNode
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public CopyToOutput CopyToOutput { get; private set; } = CopyToOutput.Never;
|
public CopyToOutput CopyToOutput { get; internal set; } = CopyToOutput.Never;
|
||||||
|
|
||||||
public bool IsLink { get; private set; }
|
public bool IsLink { get; internal set; }
|
||||||
|
|
||||||
public string LinkPath { get; private set; } = string.Empty;
|
public string LinkPath { get; internal set; } = string.Empty;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -206,13 +221,13 @@ public class FileNode : DataNode
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool IsValid { get; private set; }
|
public bool IsValid { get; internal set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="file"></param>
|
/// <param name="file"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public bool PreservePath { get; private set; }
|
public bool PreservePath { get; internal set; }
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
|
@ -40,16 +40,9 @@ public class FilesNode : DataNode
|
||||||
{
|
{
|
||||||
#region Fields
|
#region Fields
|
||||||
|
|
||||||
private readonly List<string> m_Files = new();
|
|
||||||
private readonly Dictionary<string, BuildAction> m_BuildActions = new();
|
private readonly Dictionary<string, FileNode> m_Files = new();
|
||||||
private readonly Dictionary<string, SubType> m_SubTypes = new();
|
private readonly Dictionary<string, MatchNode> m_Matches = new();
|
||||||
private readonly Dictionary<string, string> m_ResourceNames = new();
|
|
||||||
private readonly Dictionary<string, CopyToOutput> m_CopyToOutputs = new();
|
|
||||||
private readonly Dictionary<string, bool> m_Links = new();
|
|
||||||
private readonly Dictionary<string, string> m_LinkPaths = new();
|
|
||||||
private readonly Dictionary<string, bool> m_PreservePaths = new();
|
|
||||||
private readonly Dictionary<string, string> m_DestinationPath = new();
|
|
||||||
private readonly NameValueCollection m_CopyFiles = new();
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
@ -57,9 +50,37 @@ public class FilesNode : DataNode
|
||||||
|
|
||||||
public int Count => m_Files.Count;
|
public int Count => m_Files.Count;
|
||||||
|
|
||||||
public string[] Destinations => m_CopyFiles.AllKeys;
|
public int CopyFiles
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
int cur = 0;
|
||||||
|
foreach (var item in m_Files)
|
||||||
|
{
|
||||||
|
if(item.Value.BuildAction == BuildAction.Copy) cur++;
|
||||||
|
}
|
||||||
|
foreach(var item in m_Matches)
|
||||||
|
{
|
||||||
|
if(item.Value.BuildAction == BuildAction.Copy) cur++;
|
||||||
|
}
|
||||||
|
|
||||||
public int CopyFiles => m_CopyFiles.Count;
|
return cur;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public string[] Destinations
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
List<string> dests = new();
|
||||||
|
foreach(var item in m_Matches)
|
||||||
|
{
|
||||||
|
dests.Add(item.Value.DestinationPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
return dests.ToArray();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
@ -67,64 +88,84 @@ public class FilesNode : DataNode
|
||||||
|
|
||||||
public BuildAction GetBuildAction(string file)
|
public BuildAction GetBuildAction(string file)
|
||||||
{
|
{
|
||||||
if (!m_BuildActions.ContainsKey(file)) return BuildAction.Compile;
|
if(m_Files.ContainsKey(file))
|
||||||
|
{
|
||||||
return m_BuildActions[file];
|
return m_Files[file].BuildAction;
|
||||||
|
}
|
||||||
|
if(m_Matches.ContainsKey(file))
|
||||||
|
{
|
||||||
|
return (BuildAction)m_Matches[file].BuildAction;
|
||||||
|
}
|
||||||
|
return BuildAction.Compile;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string GetDestinationPath(string file)
|
public string GetDestinationPath(string file)
|
||||||
{
|
{
|
||||||
if (!m_DestinationPath.ContainsKey(file)) return null;
|
if (!m_Matches.ContainsKey(file)) return null;
|
||||||
return m_DestinationPath[file];
|
return m_Matches[file].DestinationPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string[] SourceFiles(string dest)
|
public string[] SourceFiles(string dest)
|
||||||
{
|
{
|
||||||
return m_CopyFiles.GetValues(dest);
|
List<string> files = new();
|
||||||
|
foreach(MatchNode node in m_Matches.Values)
|
||||||
|
{
|
||||||
|
if (node.DestinationPath.Equals(dest))
|
||||||
|
{
|
||||||
|
files.AddRange(node.Files);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return files.ToArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
public CopyToOutput GetCopyToOutput(string file)
|
public CopyToOutput GetCopyToOutput(string file)
|
||||||
{
|
{
|
||||||
if (!m_CopyToOutputs.ContainsKey(file)) return CopyToOutput.Never;
|
if (m_Files.ContainsKey(file)) return m_Files[file].CopyToOutput;
|
||||||
return m_CopyToOutputs[file];
|
if(m_Matches.ContainsKey(file))return m_Matches[file].CopyToOutput;
|
||||||
|
return CopyToOutput.Never;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool GetIsLink(string file)
|
public bool GetIsLink(string file)
|
||||||
{
|
{
|
||||||
if (!m_Links.ContainsKey(file)) return false;
|
if (m_Files.ContainsKey(file)) return m_Files[file].IsLink;
|
||||||
return m_Links[file];
|
if (m_Matches.ContainsKey(file)) return m_Matches[file].IsLink;
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Contains(string file)
|
public bool Contains(string file)
|
||||||
{
|
{
|
||||||
return m_Files.Contains(file);
|
return m_Files.ContainsKey(file) || m_Matches.ContainsKey(file);
|
||||||
}
|
}
|
||||||
|
|
||||||
public string GetLinkPath(string file)
|
public string GetLinkPath(string file)
|
||||||
{
|
{
|
||||||
if (!m_LinkPaths.ContainsKey(file)) return string.Empty;
|
if (m_Files.ContainsKey(file)) return m_Files[file].LinkPath;
|
||||||
return m_LinkPaths[file];
|
if (m_Matches.ContainsKey(file)) return m_Matches[file].LinkPath;
|
||||||
|
return string.Empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
public SubType GetSubType(string file)
|
public SubType GetSubType(string file)
|
||||||
{
|
{
|
||||||
if (!m_SubTypes.ContainsKey(file)) return SubType.Code;
|
if (m_Files.ContainsKey(file)) return m_Files[file].SubType;
|
||||||
|
if (m_Matches.ContainsKey(file)) return (SubType)m_Matches[file].SubType;
|
||||||
|
|
||||||
return m_SubTypes[file];
|
return SubType.Code;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string GetResourceName(string file)
|
public string GetResourceName(string file)
|
||||||
{
|
{
|
||||||
if (!m_ResourceNames.ContainsKey(file)) return string.Empty;
|
if (m_Files.ContainsKey(file)) return m_Files[file].ResourceName;
|
||||||
|
if (m_Matches.ContainsKey(file)) return m_Matches[file].ResourceName;
|
||||||
|
|
||||||
return m_ResourceNames[file];
|
return string.Empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool GetPreservePath(string file)
|
public bool GetPreservePath(string file)
|
||||||
{
|
{
|
||||||
if (!m_PreservePaths.ContainsKey(file)) return false;
|
if (m_Files.ContainsKey(file)) return m_Files[file].PreservePath;
|
||||||
|
if (m_Matches.ContainsKey(file)) return m_Matches[file].PreservePath;
|
||||||
|
|
||||||
return m_PreservePaths[file];
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Parse(XmlNode node)
|
public override void Parse(XmlNode node)
|
||||||
|
@ -133,60 +174,51 @@ public class FilesNode : DataNode
|
||||||
foreach (XmlNode child in node.ChildNodes)
|
foreach (XmlNode child in node.ChildNodes)
|
||||||
{
|
{
|
||||||
var dataNode = Kernel.Instance.ParseNode(child, this);
|
var dataNode = Kernel.Instance.ParseNode(child, this);
|
||||||
if (dataNode is FileNode)
|
if (dataNode is FileNode fn)
|
||||||
{
|
{
|
||||||
var fileNode = (FileNode)dataNode;
|
if (fn.IsValid)
|
||||||
if (fileNode.IsValid)
|
if (!m_Files.ContainsKey(fn.Path))
|
||||||
if (!m_Files.Contains(fileNode.Path))
|
|
||||||
{
|
{
|
||||||
m_Files.Add(fileNode.Path);
|
m_Files.Add(fn.Path, fn);
|
||||||
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)
|
else if (dataNode is MatchNode mn)
|
||||||
{
|
{
|
||||||
foreach (var file in ((MatchNode)dataNode).Files)
|
foreach (var file in mn.Files)
|
||||||
{
|
{
|
||||||
var matchNode = (MatchNode)dataNode;
|
m_Matches.Add(file, mn);
|
||||||
if (!m_Files.Contains(file))
|
|
||||||
{
|
|
||||||
m_Files.Add(file);
|
|
||||||
if (matchNode.BuildAction == null)
|
|
||||||
m_BuildActions[file] = GetBuildActionByFileName(file);
|
|
||||||
else
|
|
||||||
m_BuildActions[file] = matchNode.BuildAction.Value;
|
|
||||||
|
|
||||||
if (matchNode.BuildAction == BuildAction.Copy)
|
|
||||||
{
|
|
||||||
m_CopyFiles.Add(matchNode.DestinationPath, file);
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override void Write(XmlDocument doc, XmlElement current)
|
||||||
|
{
|
||||||
|
XmlElement main = doc.CreateElement("Files");
|
||||||
|
foreach(FileNode fi in m_Files.Values)
|
||||||
|
{
|
||||||
|
fi.Write(doc, main);
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach(MatchNode mn in m_Matches.Values)
|
||||||
|
{
|
||||||
|
mn.Write(doc, main);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
current.AppendChild(main);
|
||||||
|
}
|
||||||
|
|
||||||
// TODO: Check in to why StringCollection's enumerator doesn't implement
|
// TODO: Check in to why StringCollection's enumerator doesn't implement
|
||||||
// IEnumerator?
|
// IEnumerator?
|
||||||
public IEnumerator<string> GetEnumerator()
|
public IEnumerator<string> GetEnumerator()
|
||||||
{
|
{
|
||||||
return m_Files.GetEnumerator();
|
List<string> concat = new();
|
||||||
|
concat.AddRange(m_Files.Keys);
|
||||||
|
concat.AddRange(m_Matches.Keys);
|
||||||
|
|
||||||
|
return concat.GetEnumerator();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
|
@ -12,7 +12,7 @@ namespace Prebuild.Core.Nodes
|
||||||
[DataNode("InternalsVisibleTo")]
|
[DataNode("InternalsVisibleTo")]
|
||||||
public class InternalsNode : DataNode
|
public class InternalsNode : DataNode
|
||||||
{
|
{
|
||||||
public string Name { get; private set; }
|
public string Name { get; internal set; }
|
||||||
|
|
||||||
#region Methods
|
#region Methods
|
||||||
public override void Parse(XmlNode node)
|
public override void Parse(XmlNode node)
|
||||||
|
@ -20,6 +20,14 @@ namespace Prebuild.Core.Nodes
|
||||||
base.Parse(node);
|
base.Parse(node);
|
||||||
Name = Helper.AttributeValue(node, "name", "");
|
Name = Helper.AttributeValue(node, "name", "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override void Write(XmlDocument doc, XmlElement current)
|
||||||
|
{
|
||||||
|
XmlElement main = doc.CreateElement("InternalsVisibleTo");
|
||||||
|
main.SetAttribute("name", Name);
|
||||||
|
|
||||||
|
current.AppendChild(main);
|
||||||
|
}
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -171,12 +171,12 @@ public class MatchNode : DataNode
|
||||||
public override void Parse(XmlNode node)
|
public override void Parse(XmlNode node)
|
||||||
{
|
{
|
||||||
if (node == null) throw new ArgumentNullException("node");
|
if (node == null) throw new ArgumentNullException("node");
|
||||||
var path = Helper.AttributeValue(node, "path", ".");
|
path = Helper.AttributeValue(node, "path", ".");
|
||||||
var pattern = Helper.AttributeValue(node, "pattern", "*");
|
pattern = Helper.AttributeValue(node, "pattern", "*");
|
||||||
var destination = Helper.AttributeValue(node, "destination", string.Empty);
|
destination = Helper.AttributeValue(node, "destination", string.Empty);
|
||||||
var recurse = (bool)Helper.TranslateValue(typeof(bool), Helper.AttributeValue(node, "recurse", "false"));
|
recurse = (bool)Helper.TranslateValue(typeof(bool), Helper.AttributeValue(node, "recurse", "false"));
|
||||||
var useRegex = (bool)Helper.TranslateValue(typeof(bool), Helper.AttributeValue(node, "useRegex", "false"));
|
useRegex = (bool)Helper.TranslateValue(typeof(bool), Helper.AttributeValue(node, "useRegex", "false"));
|
||||||
var buildAction = Helper.AttributeValue(node, "buildAction", string.Empty);
|
buildAction = Helper.AttributeValue(node, "buildAction", string.Empty);
|
||||||
if (buildAction != string.Empty)
|
if (buildAction != string.Empty)
|
||||||
BuildAction = (BuildAction)Enum.Parse(typeof(BuildAction), buildAction);
|
BuildAction = (BuildAction)Enum.Parse(typeof(BuildAction), buildAction);
|
||||||
|
|
||||||
|
@ -242,6 +242,33 @@ public class MatchNode : DataNode
|
||||||
m_Regex = null;
|
m_Regex = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override void Write(XmlDocument doc, XmlElement current)
|
||||||
|
{
|
||||||
|
XmlElement main = doc.CreateElement("Match");
|
||||||
|
|
||||||
|
main.SetAttribute("path", path);
|
||||||
|
main.SetAttribute("pattern", pattern);
|
||||||
|
main.SetAttribute("destination", destination);
|
||||||
|
main.SetAttribute("recurse", recurse ? bool.TrueString : bool.FalseString);
|
||||||
|
main.SetAttribute("useRegex", useRegex ? bool.TrueString : bool.FalseString);
|
||||||
|
main.SetAttribute("buildAction", buildAction);
|
||||||
|
main.SetAttribute("resourceName", ResourceName);
|
||||||
|
main.SetAttribute("copyToOutput", CopyToOutput.ToString());
|
||||||
|
main.SetAttribute("link", IsLink ? bool.TrueString : bool.FalseString);
|
||||||
|
main.SetAttribute("linkPath", LinkPath);
|
||||||
|
main.SetAttribute("preservePath", PreservePath ? bool.TrueString : bool.FalseString);
|
||||||
|
|
||||||
|
|
||||||
|
foreach(ExcludeNode exclude in m_Exclusions)
|
||||||
|
{
|
||||||
|
exclude.Write(doc, main);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
current.AppendChild(main);
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Fields
|
#region Fields
|
||||||
|
@ -250,6 +277,13 @@ public class MatchNode : DataNode
|
||||||
private Regex m_Regex;
|
private Regex m_Regex;
|
||||||
private readonly List<ExcludeNode> m_Exclusions = new();
|
private readonly List<ExcludeNode> m_Exclusions = new();
|
||||||
|
|
||||||
|
private string path;
|
||||||
|
private string pattern;
|
||||||
|
private string destination;
|
||||||
|
private bool recurse;
|
||||||
|
private bool useRegex;
|
||||||
|
private string buildAction;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Properties
|
#region Properties
|
||||||
|
@ -260,25 +294,25 @@ public class MatchNode : DataNode
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public BuildAction? BuildAction { get; private set; }
|
public BuildAction? BuildAction { get; internal set; }
|
||||||
|
|
||||||
public string DestinationPath { get; private set; } = "";
|
public string DestinationPath { get; internal set; } = "";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public SubType? SubType { get; }
|
public SubType? SubType { get; }
|
||||||
|
|
||||||
public CopyToOutput CopyToOutput { get; private set; }
|
public CopyToOutput CopyToOutput { get; internal set; }
|
||||||
|
|
||||||
public bool IsLink { get; private set; }
|
public bool IsLink { get; internal set; }
|
||||||
|
|
||||||
public string LinkPath { get; private set; }
|
public string LinkPath { get; internal set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string ResourceName { get; private set; } = "";
|
public string ResourceName { get; internal set; } = "";
|
||||||
|
|
||||||
public bool PreservePath { get; private set; }
|
public bool PreservePath { get; internal set; }
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
|
@ -11,7 +11,7 @@ namespace Prebuild.Core.Nodes
|
||||||
[DataNode("Maui")]
|
[DataNode("Maui")]
|
||||||
public class MauiNode : DataNode
|
public class MauiNode : DataNode
|
||||||
{
|
{
|
||||||
public MauiTitle applicationTitle { get; private set; } = null;
|
public MauiTitle applicationTitle { get; internal set; } = null;
|
||||||
|
|
||||||
public override void Parse(XmlNode node)
|
public override void Parse(XmlNode node)
|
||||||
{
|
{
|
||||||
|
@ -25,6 +25,14 @@ namespace Prebuild.Core.Nodes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override void Write(XmlDocument doc, XmlElement current)
|
||||||
|
{
|
||||||
|
XmlElement maui = doc.CreateElement("Maui");
|
||||||
|
applicationTitle.Write(doc, maui);
|
||||||
|
|
||||||
|
current.AppendChild(maui);
|
||||||
|
}
|
||||||
|
|
||||||
public override string ToString()
|
public override string ToString()
|
||||||
{
|
{
|
||||||
string ret = "<UseMaui>true</UseMaui>\n";
|
string ret = "<UseMaui>true</UseMaui>\n";
|
||||||
|
|
|
@ -11,12 +11,19 @@ namespace Prebuild.Core.Nodes
|
||||||
[DataNode("Title")]
|
[DataNode("Title")]
|
||||||
public class MauiTitle : DataNode
|
public class MauiTitle : DataNode
|
||||||
{
|
{
|
||||||
public string value { get; private set; } = string.Empty;
|
public string value { get; internal set; } = string.Empty;
|
||||||
public override void Parse(XmlNode node)
|
public override void Parse(XmlNode node)
|
||||||
{
|
{
|
||||||
value = node.InnerText;
|
value = node.InnerText;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override void Write(XmlDocument doc, XmlElement current)
|
||||||
|
{
|
||||||
|
XmlElement main = doc.CreateElement("Title");
|
||||||
|
main.InnerText = value;
|
||||||
|
current.AppendChild(main);
|
||||||
|
}
|
||||||
|
|
||||||
public override string ToString()
|
public override string ToString()
|
||||||
{
|
{
|
||||||
return $"<ApplicationTitle>{value}</ApplicationTitle>";
|
return $"<ApplicationTitle>{value}</ApplicationTitle>";
|
||||||
|
|
|
@ -16,5 +16,11 @@ namespace Prebuild.Core.Nodes
|
||||||
{
|
{
|
||||||
base.Parse(node);
|
base.Parse(node);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override void Write(XmlDocument doc, XmlElement current)
|
||||||
|
{
|
||||||
|
XmlElement nullable = doc.CreateElement("Nullable");
|
||||||
|
current.AppendChild(nullable);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,6 +30,7 @@ using System.Collections.Generic;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Xml;
|
using System.Xml;
|
||||||
|
using System.Xml.Serialization;
|
||||||
using Prebuild.Core.Attributes;
|
using Prebuild.Core.Attributes;
|
||||||
using Prebuild.Core.Utilities;
|
using Prebuild.Core.Utilities;
|
||||||
|
|
||||||
|
@ -73,47 +74,48 @@ public class OptionsNode : DataNode
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[field: OptionNode("OptimizeCode")]
|
[field: OptionNode("OptimizeCode")]
|
||||||
public bool OptimizeCode { get; set; }
|
public bool OptimizeCode { get; set; } = true;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[field: OptionNode("CheckUnderflowOverflow")]
|
[field: OptionNode("CheckUnderflowOverflow")]
|
||||||
public bool CheckUnderflowOverflow { get; set; }
|
public bool CheckUnderflowOverflow { get; set; } = true;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[field: OptionNode("AllowUnsafe")]
|
[field: OptionNode("AllowUnsafe")]
|
||||||
public bool AllowUnsafe { get; set; }
|
public bool AllowUnsafe { get; set; } = true;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[field: OptionNode("PreBuildEvent")]
|
[field: OptionNode("PreBuildEvent")]
|
||||||
public string PreBuildEvent { get; set; }
|
public string PreBuildEvent { get; set; } = "";
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[field: OptionNode("PostBuildEvent")]
|
[field: OptionNode("PostBuildEvent")]
|
||||||
public string PostBuildEvent { get; set; }
|
public string PostBuildEvent { get; set; } = "";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[field: OptionNode("PreBuildEventArgs")]
|
[field: OptionNode("PreBuildEventArgs")]
|
||||||
public string PreBuildEventArgs { get; set; }
|
public string PreBuildEventArgs { get; set; } = "";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[field: OptionNode("PostBuildEventArgs")]
|
[field: OptionNode("PostBuildEventArgs")]
|
||||||
public string PostBuildEventArgs { get; set; }
|
public string PostBuildEventArgs { get; set; } = "";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[field: OptionNode("RunPostBuildEvent")]
|
[field: OptionNode("RunPostBuildEvent")]
|
||||||
public string RunPostBuildEvent { get; set; }
|
public string RunPostBuildEvent { get; set; } = "";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[field: OptionNode("RunScript")]
|
[field: OptionNode("RunScript")]
|
||||||
public string RunScript { get; set; }
|
public string RunScript { get; set; } = "";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -123,7 +125,7 @@ public class OptionsNode : DataNode
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[field: OptionNode("WarningsAsErrors")]
|
[field: OptionNode("WarningsAsErrors")]
|
||||||
public bool WarningsAsErrors { get; set; }
|
public bool WarningsAsErrors { get; set; } = false;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -133,7 +135,7 @@ public class OptionsNode : DataNode
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[field: OptionNode("Prefer32Bit")]
|
[field: OptionNode("Prefer32Bit")]
|
||||||
public bool Prefer32Bit { get; set; }
|
public bool Prefer32Bit { get; set; } = false;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -171,12 +173,12 @@ public class OptionsNode : DataNode
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[field: OptionNode("GenerateDocumentation")]
|
[field: OptionNode("GenerateDocumentation")]
|
||||||
public bool GenerateDocumentation { get; set; }
|
public bool GenerateDocumentation { get; set; } = true;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[field: OptionNode("GenerateXmlDocFile")]
|
[field: OptionNode("GenerateXmlDocFile")]
|
||||||
public bool GenerateXmlDocFile { get; set; }
|
public bool GenerateXmlDocFile { get; set; } = false;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -191,22 +193,22 @@ public class OptionsNode : DataNode
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[field: OptionNode("DebugInformation")]
|
[field: OptionNode("DebugInformation")]
|
||||||
public bool DebugInformation { get; set; }
|
public bool DebugInformation { get; set; } = true;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[field: OptionNode("RegisterComInterop")]
|
[field: OptionNode("RegisterComInterop")]
|
||||||
public bool RegisterComInterop { get; set; }
|
public bool RegisterComInterop { get; set; } = true;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[field: OptionNode("RemoveIntegerChecks")]
|
[field: OptionNode("RemoveIntegerChecks")]
|
||||||
public bool RemoveIntegerChecks { get; set; }
|
public bool RemoveIntegerChecks { get; set; } = false;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[field: OptionNode("IncrementalBuild")]
|
[field: OptionNode("IncrementalBuild")]
|
||||||
public bool IncrementalBuild { get; set; }
|
public bool IncrementalBuild { get; set; } = true;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -221,15 +223,17 @@ public class OptionsNode : DataNode
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[field: OptionNode("NoStdLib")]
|
[field: OptionNode("NoStdLib")]
|
||||||
public bool NoStdLib { get; set; }
|
public bool NoStdLib { get; set; } = false;
|
||||||
|
|
||||||
[field: OptionNode("UseDependencyFile")]
|
[field: OptionNode("UseDependencyFile")]
|
||||||
public bool UseDepsFile { get; }
|
public bool UseDepsFile { get; } = true;
|
||||||
|
|
||||||
[field: OptionNode("SelfContained")] public bool SelfContained { get; }
|
|
||||||
|
[field: OptionNode("SelfContained")]
|
||||||
|
public bool SelfContained { get; } = true;
|
||||||
|
|
||||||
[field: OptionNode("UseRuntimeIdentifier")]
|
[field: OptionNode("UseRuntimeIdentifier")]
|
||||||
public bool UseRuntimeIdentifier { get; }
|
public bool UseRuntimeIdentifier { get; } = false;
|
||||||
|
|
||||||
private readonly List<string> m_FieldsDefined = new();
|
private readonly List<string> m_FieldsDefined = new();
|
||||||
|
|
||||||
|
@ -303,6 +307,21 @@ public class OptionsNode : DataNode
|
||||||
SetOption(child.Name, Helper.InterpolateForEnvironmentVariables(child.InnerText));
|
SetOption(child.Name, Helper.InterpolateForEnvironmentVariables(child.InnerText));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override void Write(XmlDocument doc, XmlElement current)
|
||||||
|
{
|
||||||
|
XmlElement options = doc.CreateElement("Options");
|
||||||
|
foreach(var def in m_OptionFields.Keys)
|
||||||
|
{
|
||||||
|
var E = doc.CreateElement(def);
|
||||||
|
E.InnerText = m_OptionFields[def].GetValue(this).ToString();
|
||||||
|
|
||||||
|
options.AppendChild(E);
|
||||||
|
}
|
||||||
|
|
||||||
|
current.AppendChild(options);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Return 'true' if the option symbol has had a value set
|
/// Return 'true' if the option symbol has had a value set
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -60,6 +60,16 @@ public class PackageReferenceNode : DataNode, IComparable
|
||||||
PrivateAssets = Helper.AttributeValue(node, "private", PrivateAssets);
|
PrivateAssets = Helper.AttributeValue(node, "private", PrivateAssets);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override void Write(XmlDocument doc, XmlElement current)
|
||||||
|
{
|
||||||
|
XmlElement reference = doc.CreateElement("PackageReference");
|
||||||
|
reference.SetAttribute("name", Name);
|
||||||
|
reference.SetAttribute("version", Version);
|
||||||
|
reference.SetAttribute("private", PrivateAssets);
|
||||||
|
|
||||||
|
current.AppendChild(reference);
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Fields
|
#region Fields
|
||||||
|
@ -72,15 +82,15 @@ public class PackageReferenceNode : DataNode, IComparable
|
||||||
/// Gets the name.
|
/// Gets the name.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The name.</value>
|
/// <value>The name.</value>
|
||||||
public string Name { get; private set; } = "unknown";
|
public string Name { get; internal set; } = "unknown";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the version.
|
/// Gets the version.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The version.</value>
|
/// <value>The version.</value>
|
||||||
public string Version { get; private set; }
|
public string Version { get; internal set; }
|
||||||
|
|
||||||
public string PrivateAssets { get; private set; }
|
public string PrivateAssets { get; internal set; }
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
|
@ -61,6 +61,14 @@ public class ProcessNode : DataNode
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override void Write(XmlDocument doc, XmlElement current)
|
||||||
|
{
|
||||||
|
XmlElement proc = doc.CreateElement("Process");
|
||||||
|
proc.InnerText = Path;
|
||||||
|
|
||||||
|
current.AppendChild(proc);
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Fields
|
#region Fields
|
||||||
|
@ -73,13 +81,13 @@ public class ProcessNode : DataNode
|
||||||
/// Gets the path.
|
/// Gets the path.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The path.</value>
|
/// <value>The path.</value>
|
||||||
public string Path { get; private set; }
|
public string Path { get; internal set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets a value indicating whether this instance is valid.
|
/// Gets a value indicating whether this instance is valid.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value><c>true</c> if this instance is valid; otherwise, <c>false</c>.</value>
|
/// <value><c>true</c> if this instance is valid; otherwise, <c>false</c>.</value>
|
||||||
public bool IsValid { get; private set; } = true;
|
public bool IsValid { get; internal set; } = true;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
|
@ -261,6 +261,85 @@ public class ProjectNode : DataNode, IComparable
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override void Write(XmlDocument doc, XmlElement current)
|
||||||
|
{
|
||||||
|
XmlElement proj = doc.CreateElement("Project");
|
||||||
|
|
||||||
|
proj.SetAttribute("name", Name);
|
||||||
|
proj.SetAttribute("path", Path);
|
||||||
|
proj.SetAttribute("filterGroups", FilterGroups);
|
||||||
|
proj.SetAttribute("version", Version);
|
||||||
|
proj.SetAttribute("icon", AppIcon);
|
||||||
|
proj.SetAttribute("appmanifest", ApplicationManifest);
|
||||||
|
proj.SetAttribute("configFile", ConfigFile);
|
||||||
|
proj.SetAttribute("designerFolder", DesignerFolder);
|
||||||
|
proj.SetAttribute("assemblyName", AssemblyName);
|
||||||
|
proj.SetAttribute("scanFiles", ScanFiles ? bool.TrueString : bool.FalseString);
|
||||||
|
proj.SetAttribute("language", Language);
|
||||||
|
proj.SetAttribute("type", Type.ToString());
|
||||||
|
proj.SetAttribute("runtime", Runtime.ToString());
|
||||||
|
proj.SetAttribute("frameworkVersion", m_Framework.ToString());
|
||||||
|
proj.SetAttribute("startupObject", StartupObject);
|
||||||
|
proj.SetAttribute("rootNamespace", RootNamespace);
|
||||||
|
proj.SetAttribute("copyDependencies", CopyLocalLockFileAssemblies ? bool.TrueString : bool.FalseString);
|
||||||
|
proj.SetAttribute("guid", Guid.ToString());
|
||||||
|
proj.SetAttribute("generateAssemblyInfoFile", GenerateAssemblyInfoFile ? bool.TrueString : bool.FalseString);
|
||||||
|
proj.SetAttribute("winforms", UseWindowsForms ? bool.TrueString : bool.FalseString);
|
||||||
|
proj.SetAttribute("debugStartParameters", DebugStartParameters);
|
||||||
|
|
||||||
|
foreach(ConfigurationNode conf in Configurations)
|
||||||
|
{
|
||||||
|
conf.Write(doc, proj);
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach(ReferencePathNode rpn in ReferencePaths)
|
||||||
|
{
|
||||||
|
rpn.Write(doc, proj);
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach(ReferenceNode refer in References)
|
||||||
|
{
|
||||||
|
refer.Write(doc, proj);
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach(PackageReferenceNode pkg in PackageReferences)
|
||||||
|
{
|
||||||
|
pkg.Write(doc, proj);
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach(ProjectReferenceNode prj in ProjectReferences)
|
||||||
|
{
|
||||||
|
prj.Write(doc, proj);
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach(AuthorNode auth in Authors)
|
||||||
|
{
|
||||||
|
auth.Write(doc, proj);
|
||||||
|
}
|
||||||
|
|
||||||
|
Files.Write(doc, proj);
|
||||||
|
foreach(TextGenNode gen in TextGenNodes)
|
||||||
|
{
|
||||||
|
gen.Write(doc, proj);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(MauiSettings!=null)
|
||||||
|
MauiSettings.Write(doc, proj);
|
||||||
|
if (Nullable)
|
||||||
|
{
|
||||||
|
XmlElement nu = doc.CreateElement("Nullable");
|
||||||
|
proj.AppendChild(nu);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(InternalsVisible!=null)
|
||||||
|
InternalsVisible.Write(doc, proj);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
current.AppendChild(proj);
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Fields
|
#region Fields
|
||||||
|
@ -303,28 +382,28 @@ public class ProjectNode : DataNode, IComparable
|
||||||
/// Gets the name.
|
/// Gets the name.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The name.</value>
|
/// <value>The name.</value>
|
||||||
public string Name { get; private set; } = "unknown";
|
public string Name { get; internal set; } = "unknown";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Contains settings for DotNet Maui (7.0+)
|
/// Contains settings for DotNet Maui (7.0+)
|
||||||
/// Default is null, which indicates not to include any Maui content in the project file.
|
/// Default is null, which indicates not to include any Maui content in the project file.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public MauiNode MauiSettings { get; private set; } = null;
|
public MauiNode MauiSettings { get; internal set; } = null;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Marks the visibility for internals
|
/// Marks the visibility for internals
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public InternalsNode InternalsVisible { get; private set; }
|
public InternalsNode InternalsVisible { get; internal set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Enables Windows forms on a dotnet project.
|
/// Enables Windows forms on a dotnet project.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool UseWindowsForms { get; private set; } = false;
|
public bool UseWindowsForms { get; internal set; } = false;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Scans the directory for files
|
/// Scans the directory for files
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool ScanFiles {get;private set;} = true;
|
public bool ScanFiles {get;internal set;} = true;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The version of the .NET Framework to compile under
|
/// The version of the .NET Framework to compile under
|
||||||
|
@ -353,18 +432,18 @@ public class ProjectNode : DataNode, IComparable
|
||||||
/// Gets the path.
|
/// Gets the path.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The path.</value>
|
/// <value>The path.</value>
|
||||||
public string Path { get; private set; } = "";
|
public string Path { get; internal set; } = "";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the filter groups.
|
/// Gets the filter groups.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The filter groups.</value>
|
/// <value>The filter groups.</value>
|
||||||
public string FilterGroups { get; private set; } = "";
|
public string FilterGroups { get; internal set; } = "";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Indicates project nullable attribute
|
/// Indicates project nullable attribute
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool Nullable { get; private set; } = false;
|
public bool Nullable { get; internal set; } = false;
|
||||||
public string NullableStr
|
public string NullableStr
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
@ -377,65 +456,65 @@ public class ProjectNode : DataNode, IComparable
|
||||||
/// Gets the project's version
|
/// Gets the project's version
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The project's version.</value>
|
/// <value>The project's version.</value>
|
||||||
public string Version { get; private set; } = "";
|
public string Version { get; internal set; } = "";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the full path.
|
/// Gets the full path.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The full path.</value>
|
/// <value>The full path.</value>
|
||||||
public string FullPath { get; private set; } = "";
|
public string FullPath { get; internal set; } = "";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the name of the assembly.
|
/// Gets the name of the assembly.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The name of the assembly.</value>
|
/// <value>The name of the assembly.</value>
|
||||||
public string AssemblyName { get; private set; }
|
public string AssemblyName { get; internal set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Copies the local dependencies to the output on build.
|
/// Copies the local dependencies to the output on build.
|
||||||
/// This is the same behavior as publish.
|
/// This is the same behavior as publish.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool CopyLocalLockFileAssemblies { get; private set; }
|
public bool CopyLocalLockFileAssemblies { get; internal set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the app icon.
|
/// Gets the app icon.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The app icon.</value>
|
/// <value>The app icon.</value>
|
||||||
public string AppIcon { get; private set; } = "";
|
public string AppIcon { get; internal set; } = "";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the Application Manifest.
|
/// Gets the Application Manifest.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The Application Manifest.</value>
|
/// <value>The Application Manifest.</value>
|
||||||
public string ApplicationManifest { get; private set; } = "";
|
public string ApplicationManifest { get; internal set; } = "";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the app icon.
|
/// Gets the app icon.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The app icon.</value>
|
/// <value>The app icon.</value>
|
||||||
public string ConfigFile { get; private set; } = "";
|
public string ConfigFile { get; internal set; } = "";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string DesignerFolder { get; private set; } = "";
|
public string DesignerFolder { get; internal set; } = "";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the language.
|
/// Gets the language.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The language.</value>
|
/// <value>The language.</value>
|
||||||
public string Language { get; private set; } = "C#";
|
public string Language { get; internal set; } = "C#";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the type.
|
/// Gets the type.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The type.</value>
|
/// <value>The type.</value>
|
||||||
public ProjectType Type { get; private set; } = ProjectType.Exe;
|
public ProjectType Type { get; internal set; } = ProjectType.Exe;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the runtime.
|
/// Gets the runtime.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The runtime.</value>
|
/// <value>The runtime.</value>
|
||||||
public ClrRuntime Runtime { get; private set; } = ClrRuntime.Microsoft;
|
public ClrRuntime Runtime { get; internal set; } = ClrRuntime.Microsoft;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -445,13 +524,13 @@ public class ProjectNode : DataNode, IComparable
|
||||||
/// Gets the startup object.
|
/// Gets the startup object.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The startup object.</value>
|
/// <value>The startup object.</value>
|
||||||
public string StartupObject { get; private set; } = "";
|
public string StartupObject { get; internal set; } = "";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the root namespace.
|
/// Gets the root namespace.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The root namespace.</value>
|
/// <value>The root namespace.</value>
|
||||||
public string RootNamespace { get; private set; }
|
public string RootNamespace { get; internal set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the configurations.
|
/// Gets the configurations.
|
||||||
|
@ -470,7 +549,7 @@ public class ProjectNode : DataNode, IComparable
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the text generator nodes
|
/// Gets the text generator nodes
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public List<TextGenNode> TextGenNodes { get; private set; } = new();
|
public List<TextGenNode> TextGenNodes { get; internal set; } = new();
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -545,7 +624,7 @@ public class ProjectNode : DataNode, IComparable
|
||||||
/// Gets the files.
|
/// Gets the files.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The files.</value>
|
/// <value>The files.</value>
|
||||||
public FilesNode Files { get; private set; } = new();
|
public FilesNode Files { get; internal set; } = new();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the parent.
|
/// Gets or sets the parent.
|
||||||
|
@ -584,9 +663,9 @@ public class ProjectNode : DataNode, IComparable
|
||||||
/// Gets the GUID.
|
/// Gets the GUID.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The GUID.</value>
|
/// <value>The GUID.</value>
|
||||||
public Guid Guid { get; private set; }
|
public Guid Guid { get; internal set; }
|
||||||
|
|
||||||
public string DebugStartParameters { get; private set; }
|
public string DebugStartParameters { get; internal set; }
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
|
@ -59,6 +59,15 @@ public class ProjectReferenceNode : DataNode, IComparable
|
||||||
Include = Helper.AttributeValue(node, "include", Include);
|
Include = Helper.AttributeValue(node, "include", Include);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override void Write(XmlDocument doc, XmlElement current)
|
||||||
|
{
|
||||||
|
XmlElement cur = doc.CreateElement("ProjectReference");
|
||||||
|
cur.SetAttribute("name", Name);
|
||||||
|
cur.SetAttribute("include", Include);
|
||||||
|
|
||||||
|
current.AppendChild(cur);
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Fields
|
#region Fields
|
||||||
|
@ -71,13 +80,13 @@ public class ProjectReferenceNode : DataNode, IComparable
|
||||||
/// Gets the name.
|
/// Gets the name.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The name.</value>
|
/// <value>The name.</value>
|
||||||
public string Name { get; private set; } = "unknown";
|
public string Name { get; internal set; } = "unknown";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the path.
|
/// Gets the path.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The path.</value>
|
/// <value>The path.</value>
|
||||||
public string Include { get; private set; }
|
public string Include { get; internal set; }
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
|
@ -61,6 +61,18 @@ public class ReferenceNode : DataNode, IComparable
|
||||||
Version = Helper.AttributeValue(node, "version", Version);
|
Version = Helper.AttributeValue(node, "version", Version);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override void Write(XmlDocument doc, XmlElement current)
|
||||||
|
{
|
||||||
|
XmlElement cur = doc.CreateElement("Reference");
|
||||||
|
cur.SetAttribute("name", Name);
|
||||||
|
cur.SetAttribute("path", Path);
|
||||||
|
cur.SetAttribute("version", Version);
|
||||||
|
cur.SetAttribute("localCopy", m_LocalCopy);
|
||||||
|
|
||||||
|
|
||||||
|
current.AppendChild(cur);
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Fields
|
#region Fields
|
||||||
|
@ -75,13 +87,13 @@ public class ReferenceNode : DataNode, IComparable
|
||||||
/// Gets the name.
|
/// Gets the name.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The name.</value>
|
/// <value>The name.</value>
|
||||||
public string Name { get; private set; } = "unknown";
|
public string Name { get; internal set; } = "unknown";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the path.
|
/// Gets the path.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The path.</value>
|
/// <value>The path.</value>
|
||||||
public string Path { get; private set; }
|
public string Path { get; internal set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets a value indicating whether [local copy specified].
|
/// Gets a value indicating whether [local copy specified].
|
||||||
|
@ -106,7 +118,7 @@ public class ReferenceNode : DataNode, IComparable
|
||||||
/// Gets the version.
|
/// Gets the version.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The version.</value>
|
/// <value>The version.</value>
|
||||||
public string Version { get; private set; }
|
public string Version { get; internal set; }
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
|
@ -47,7 +47,7 @@ public class ReferencePathNode : DataNode, IComparable
|
||||||
/// Gets the path.
|
/// Gets the path.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The path.</value>
|
/// <value>The path.</value>
|
||||||
public string Path { get; private set; }
|
public string Path { get; internal set; }
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
@ -77,5 +77,13 @@ public class ReferencePathNode : DataNode, IComparable
|
||||||
Path = Path.Trim();
|
Path = Path.Trim();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override void Write(XmlDocument doc, XmlElement current)
|
||||||
|
{
|
||||||
|
XmlElement cur = doc.CreateElement("ReferencePath");
|
||||||
|
cur.InnerText = Path;
|
||||||
|
|
||||||
|
current.AppendChild(cur);
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
|
@ -29,6 +29,7 @@ using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Xml;
|
using System.Xml;
|
||||||
|
using System.Xml.Serialization;
|
||||||
using Prebuild.Core.Attributes;
|
using Prebuild.Core.Attributes;
|
||||||
using Prebuild.Core.Interfaces;
|
using Prebuild.Core.Interfaces;
|
||||||
using Prebuild.Core.Utilities;
|
using Prebuild.Core.Utilities;
|
||||||
|
@ -136,6 +137,46 @@ public class SolutionNode : DataNode
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override void Write(XmlDocument doc, XmlElement current)
|
||||||
|
{
|
||||||
|
XmlElement sol = doc.CreateElement("Solution");
|
||||||
|
sol.SetAttribute("name", Name);
|
||||||
|
sol.SetAttribute("activeConfig", ActiveConfig);
|
||||||
|
sol.SetAttribute("path", Path);
|
||||||
|
sol.SetAttribute("version", Version);
|
||||||
|
sol.SetAttribute("frameworkVersion", DefaultFramework.ToString());
|
||||||
|
if(Options != null)
|
||||||
|
Options.Write(doc, sol);
|
||||||
|
|
||||||
|
if (Files != null) Files.Write(doc, sol);
|
||||||
|
|
||||||
|
if(Configurations != null)
|
||||||
|
foreach(ConfigurationNode conf in Configurations)
|
||||||
|
{
|
||||||
|
conf.Write(doc, sol);
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach(ProjectNode proj in Projects)
|
||||||
|
{
|
||||||
|
proj.Write(doc, sol);
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach(SolutionNode solX in Solutions)
|
||||||
|
{
|
||||||
|
solX.Write(doc, sol);
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach(DatabaseProjectNode db in DatabaseProjects)
|
||||||
|
{
|
||||||
|
db.Write(doc, sol);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(Cleanup != null)
|
||||||
|
Cleanup.Write(doc, sol);
|
||||||
|
|
||||||
|
current.AppendChild(sol);
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Fields
|
#region Fields
|
||||||
|
@ -179,37 +220,37 @@ public class SolutionNode : DataNode
|
||||||
/// Gets the name.
|
/// Gets the name.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The name.</value>
|
/// <value>The name.</value>
|
||||||
public string Name { get; private set; } = "unknown";
|
public string Name { get; internal set; } = "unknown";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the path.
|
/// Gets the path.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The path.</value>
|
/// <value>The path.</value>
|
||||||
public string Path { get; private set; } = "";
|
public string Path { get; internal set; } = "";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the full path.
|
/// Gets the full path.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The full path.</value>
|
/// <value>The full path.</value>
|
||||||
public string FullPath { get; private set; } = "";
|
public string FullPath { get; internal set; } = "";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the version.
|
/// Gets the version.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The version.</value>
|
/// <value>The version.</value>
|
||||||
public string Version { get; private set; } = "1.0.0";
|
public string Version { get; internal set; } = "1.0.0";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the options.
|
/// Gets the options.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The options.</value>
|
/// <value>The options.</value>
|
||||||
public OptionsNode Options { get; private set; }
|
public OptionsNode Options { get; internal set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the files.
|
/// Gets the files.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The files.</value>
|
/// <value>The files.</value>
|
||||||
public FilesNode Files { get; private set; }
|
public FilesNode Files { get; internal set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the configurations.
|
/// Gets the configurations.
|
||||||
|
|
|
@ -16,7 +16,7 @@ namespace Prebuild.Core.Nodes
|
||||||
#region Values
|
#region Values
|
||||||
private string m_Name;
|
private string m_Name;
|
||||||
private string m_OutputName;
|
private string m_OutputName;
|
||||||
private List<string> m_Libs = new();
|
private List<ReferenceNode> m_Libs = new();
|
||||||
private string m_Tool;
|
private string m_Tool;
|
||||||
|
|
||||||
|
|
||||||
|
@ -32,9 +32,9 @@ namespace Prebuild.Core.Nodes
|
||||||
foreach (XmlNode childNode in node.ChildNodes)
|
foreach (XmlNode childNode in node.ChildNodes)
|
||||||
{
|
{
|
||||||
var data = Kernel.Instance.ParseNode(childNode, this);
|
var data = Kernel.Instance.ParseNode(childNode, this);
|
||||||
if(data is ReferenceNode)
|
if(data is ReferenceNode rn)
|
||||||
{
|
{
|
||||||
m_Libs.Add(((ReferenceNode)data).Name);
|
m_Libs.Add(rn);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,6 +53,22 @@ namespace Prebuild.Core.Nodes
|
||||||
else m_OutputName = Path.ChangeExtension(m_OutputName, ".SnapWrap.cs");
|
else m_OutputName = Path.ChangeExtension(m_OutputName, ".SnapWrap.cs");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override void Write(XmlDocument doc, XmlElement current)
|
||||||
|
{
|
||||||
|
XmlElement cur = doc.CreateElement("TextGen");
|
||||||
|
cur.SetAttribute("name", m_Name);
|
||||||
|
cur.SetAttribute("output", m_OutputName);
|
||||||
|
cur.SetAttribute("tool", m_Tool);
|
||||||
|
|
||||||
|
foreach(var reference in m_Libs)
|
||||||
|
{
|
||||||
|
reference.Write(doc, cur);
|
||||||
|
}
|
||||||
|
cur.SetAttribute("sourceInSolution", SourceInSolution ? bool.TrueString : bool.FalseString);
|
||||||
|
|
||||||
|
current.AppendChild(cur);
|
||||||
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Fields
|
#region Fields
|
||||||
|
@ -76,11 +92,17 @@ namespace Prebuild.Core.Nodes
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return String.Join("..", m_Libs);
|
List<string> tmp = new();
|
||||||
|
foreach(var rn in m_Libs)
|
||||||
|
{
|
||||||
|
tmp.Add(rn.Name);
|
||||||
|
}
|
||||||
|
|
||||||
|
return String.Join("..", tmp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool SourceInSolution { get; private set; } = false;
|
public bool SourceInSolution { get; internal set; } = false;
|
||||||
|
|
||||||
public string SourceDirectory
|
public string SourceDirectory
|
||||||
{
|
{
|
||||||
|
|
|
@ -104,7 +104,7 @@ public class IfContext
|
||||||
/// Gets a value indicating whether [ever kept].
|
/// Gets a value indicating whether [ever kept].
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value><c>true</c> if [ever kept]; otherwise, <c>false</c>.</value>
|
/// <value><c>true</c> if [ever kept]; otherwise, <c>false</c>.</value>
|
||||||
public bool EverKept { get; private set; }
|
public bool EverKept { get; internal set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the state.
|
/// Gets or sets the state.
|
||||||
|
|
|
@ -95,22 +95,22 @@ public enum ClrVersion
|
||||||
|
|
||||||
public class SystemPackage
|
public class SystemPackage
|
||||||
{
|
{
|
||||||
public string Name { get; private set; }
|
public string Name { get; internal set; }
|
||||||
|
|
||||||
public string Version { get; private set; }
|
public string Version { get; internal set; }
|
||||||
|
|
||||||
public string Description { get; private set; }
|
public string Description { get; internal set; }
|
||||||
|
|
||||||
public ClrVersion TargetVersion { get; private set; }
|
public ClrVersion TargetVersion { get; internal set; }
|
||||||
|
|
||||||
// The package is part of the mono SDK
|
// The package is part of the mono SDK
|
||||||
public bool IsCorePackage => Name == "mono";
|
public bool IsCorePackage => Name == "mono";
|
||||||
|
|
||||||
// The package has been registered by an add-in, and is not installed
|
// The package has been registered by an add-in, and is not installed
|
||||||
// in the system.
|
// in the system.
|
||||||
public bool IsInternalPackage { get; private set; }
|
public bool IsInternalPackage { get; internal set; }
|
||||||
|
|
||||||
public string[] Assemblies { get; private set; }
|
public string[] Assemblies { get; internal set; }
|
||||||
|
|
||||||
public void Initialize(string name,
|
public void Initialize(string name,
|
||||||
string version,
|
string version,
|
||||||
|
|
|
@ -105,6 +105,7 @@ internal class Prebuild
|
||||||
Console.WriteLine("/ppo Pre-process the file, but perform no other processing");
|
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("/pause Pauses the application after execution to view the output");
|
||||||
Console.WriteLine("/yes Default to yes to any questions asked");
|
Console.WriteLine("/yes Default to yes to any questions asked");
|
||||||
|
Console.WriteLine("/init Initializes a skeleton Prebuild file");
|
||||||
Console.WriteLine();
|
Console.WriteLine();
|
||||||
Console.WriteLine("See 'prebuild /showtargets for a list of available targets");
|
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("See readme.txt or check out http://dnpb.sourceforge.net for more information");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue