From 646bbbc84b8010e0dacbeed5342cdb045f46cc49 Mon Sep 17 00:00:00 2001
From: MW
Date: Wed, 27 Jun 2007 15:28:52 +0000
Subject: Some work on restructuring the namespaces / project names. Note this
doesn't compile yet as not all the code has been changed to use the new
namespaces. Am committing it now for feedback on the namespaces.
---
Prebuild/src/App.ico | Bin 0 -> 4286 bytes
Prebuild/src/Core/Attributes/DataNodeAttribute.cs | 81 ++
.../src/Core/Attributes/OptionNodeAttribute.cs | 80 ++
Prebuild/src/Core/Attributes/TargetAttribute.cs | 80 ++
Prebuild/src/Core/FatalException.cs | 94 +++
Prebuild/src/Core/Interfaces/IDataNode.cs | 56 ++
Prebuild/src/Core/Interfaces/ITarget.cs | 60 ++
Prebuild/src/Core/Kernel.cs | 758 +++++++++++++++++
Prebuild/src/Core/Nodes/ConfigurationNode.cs | 187 +++++
Prebuild/src/Core/Nodes/DataNode.cs | 82 ++
Prebuild/src/Core/Nodes/ExcludeNode.cs | 85 ++
Prebuild/src/Core/Nodes/FileNode.cs | 238 ++++++
Prebuild/src/Core/Nodes/FilesNode.cs | 223 +++++
Prebuild/src/Core/Nodes/MatchNode.cs | 299 +++++++
Prebuild/src/Core/Nodes/OptionsNode.cs | 655 +++++++++++++++
Prebuild/src/Core/Nodes/ProcessNode.cs | 119 +++
Prebuild/src/Core/Nodes/ProjectNode.cs | 510 ++++++++++++
Prebuild/src/Core/Nodes/ReferenceNode.cs | 153 ++++
Prebuild/src/Core/Nodes/ReferencePathNode.cs | 108 +++
Prebuild/src/Core/Nodes/SolutionNode.cs | 288 +++++++
Prebuild/src/Core/Parse/IfContext.cs | 163 ++++
Prebuild/src/Core/Parse/Preprocessor.cs | 519 ++++++++++++
Prebuild/src/Core/Targets/AutotoolsTarget.cs | 926 +++++++++++++++++++++
Prebuild/src/Core/Targets/DebugTarget.cs | 102 +++
Prebuild/src/Core/Targets/MonoDevelopTarget.cs | 458 ++++++++++
Prebuild/src/Core/Targets/NAntTarget.cs | 621 ++++++++++++++
Prebuild/src/Core/Targets/SharpDevelop2Target.cs | 90 ++
Prebuild/src/Core/Targets/SharpDevelopTarget.cs | 437 ++++++++++
Prebuild/src/Core/Targets/VS2002Target.cs | 96 +++
Prebuild/src/Core/Targets/VS2003Target.cs | 633 ++++++++++++++
Prebuild/src/Core/Targets/VS2005Target.cs | 883 ++++++++++++++++++++
Prebuild/src/Core/UnknownLanguageException.cs | 63 ++
.../src/Core/Utilities/CommandLineCollection.cs | 162 ++++
Prebuild/src/Core/Utilities/CurrentDirectory.cs | 89 ++
Prebuild/src/Core/Utilities/Helper.cs | 661 +++++++++++++++
Prebuild/src/Core/Utilities/Log.cs | 279 +++++++
Prebuild/src/Core/WarningException.cs | 93 +++
Prebuild/src/Prebuild.cs | 165 ++++
Prebuild/src/Prebuild.csproj | 205 +++++
Prebuild/src/Prebuild.csproj.user | 12 +
Prebuild/src/Prebuild.exe.build | 80 ++
Prebuild/src/Prebuild.snk | Bin 0 -> 596 bytes
Prebuild/src/Properties/AssemblyInfo.cs | 101 +++
Prebuild/src/data/dnpb-1.0.xsd | 183 ++++
Prebuild/src/data/dnpb-1.1.xsd | 184 ++++
Prebuild/src/data/dnpb-1.2.xsd | 198 +++++
Prebuild/src/data/dnpb-1.3.xsd | 206 +++++
Prebuild/src/data/dnpb-1.4.xsd | 212 +++++
Prebuild/src/data/dnpb-1.5.xsd | 215 +++++
Prebuild/src/data/prebuild-1.6.xsd | 231 +++++
Prebuild/src/data/prebuild-1.7.xsd | 261 ++++++
51 files changed, 12684 insertions(+)
create mode 100644 Prebuild/src/App.ico
create mode 100644 Prebuild/src/Core/Attributes/DataNodeAttribute.cs
create mode 100644 Prebuild/src/Core/Attributes/OptionNodeAttribute.cs
create mode 100644 Prebuild/src/Core/Attributes/TargetAttribute.cs
create mode 100644 Prebuild/src/Core/FatalException.cs
create mode 100644 Prebuild/src/Core/Interfaces/IDataNode.cs
create mode 100644 Prebuild/src/Core/Interfaces/ITarget.cs
create mode 100644 Prebuild/src/Core/Kernel.cs
create mode 100644 Prebuild/src/Core/Nodes/ConfigurationNode.cs
create mode 100644 Prebuild/src/Core/Nodes/DataNode.cs
create mode 100644 Prebuild/src/Core/Nodes/ExcludeNode.cs
create mode 100644 Prebuild/src/Core/Nodes/FileNode.cs
create mode 100644 Prebuild/src/Core/Nodes/FilesNode.cs
create mode 100644 Prebuild/src/Core/Nodes/MatchNode.cs
create mode 100644 Prebuild/src/Core/Nodes/OptionsNode.cs
create mode 100644 Prebuild/src/Core/Nodes/ProcessNode.cs
create mode 100644 Prebuild/src/Core/Nodes/ProjectNode.cs
create mode 100644 Prebuild/src/Core/Nodes/ReferenceNode.cs
create mode 100644 Prebuild/src/Core/Nodes/ReferencePathNode.cs
create mode 100644 Prebuild/src/Core/Nodes/SolutionNode.cs
create mode 100644 Prebuild/src/Core/Parse/IfContext.cs
create mode 100644 Prebuild/src/Core/Parse/Preprocessor.cs
create mode 100644 Prebuild/src/Core/Targets/AutotoolsTarget.cs
create mode 100644 Prebuild/src/Core/Targets/DebugTarget.cs
create mode 100644 Prebuild/src/Core/Targets/MonoDevelopTarget.cs
create mode 100644 Prebuild/src/Core/Targets/NAntTarget.cs
create mode 100644 Prebuild/src/Core/Targets/SharpDevelop2Target.cs
create mode 100644 Prebuild/src/Core/Targets/SharpDevelopTarget.cs
create mode 100644 Prebuild/src/Core/Targets/VS2002Target.cs
create mode 100644 Prebuild/src/Core/Targets/VS2003Target.cs
create mode 100644 Prebuild/src/Core/Targets/VS2005Target.cs
create mode 100644 Prebuild/src/Core/UnknownLanguageException.cs
create mode 100644 Prebuild/src/Core/Utilities/CommandLineCollection.cs
create mode 100644 Prebuild/src/Core/Utilities/CurrentDirectory.cs
create mode 100644 Prebuild/src/Core/Utilities/Helper.cs
create mode 100644 Prebuild/src/Core/Utilities/Log.cs
create mode 100644 Prebuild/src/Core/WarningException.cs
create mode 100644 Prebuild/src/Prebuild.cs
create mode 100644 Prebuild/src/Prebuild.csproj
create mode 100644 Prebuild/src/Prebuild.csproj.user
create mode 100644 Prebuild/src/Prebuild.exe.build
create mode 100644 Prebuild/src/Prebuild.snk
create mode 100644 Prebuild/src/Properties/AssemblyInfo.cs
create mode 100644 Prebuild/src/data/dnpb-1.0.xsd
create mode 100644 Prebuild/src/data/dnpb-1.1.xsd
create mode 100644 Prebuild/src/data/dnpb-1.2.xsd
create mode 100644 Prebuild/src/data/dnpb-1.3.xsd
create mode 100644 Prebuild/src/data/dnpb-1.4.xsd
create mode 100644 Prebuild/src/data/dnpb-1.5.xsd
create mode 100644 Prebuild/src/data/prebuild-1.6.xsd
create mode 100644 Prebuild/src/data/prebuild-1.7.xsd
(limited to 'Prebuild/src')
diff --git a/Prebuild/src/App.ico b/Prebuild/src/App.ico
new file mode 100644
index 0000000..ac4ea6f
Binary files /dev/null and b/Prebuild/src/App.ico differ
diff --git a/Prebuild/src/Core/Attributes/DataNodeAttribute.cs b/Prebuild/src/Core/Attributes/DataNodeAttribute.cs
new file mode 100644
index 0000000..dbdaf0b
--- /dev/null
+++ b/Prebuild/src/Core/Attributes/DataNodeAttribute.cs
@@ -0,0 +1,81 @@
+#region BSD License
+/*
+Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com)
+
+Redistribution and use in source and binary forms, with or without modification, are permitted
+provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice, this list of conditions
+ and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
+ and the following disclaimer in the documentation and/or other materials provided with the
+ distribution.
+* The name of the author may not be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
+BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+#endregion
+
+#region CVS Information
+/*
+ * $Source$
+ * $Author: jendave $
+ * $Date: 2006-01-28 01:49:58 +0100 (lö, 28 jan 2006) $
+ * $Revision: 71 $
+ */
+#endregion
+
+using System;
+using System.Collections.Specialized;
+
+namespace Prebuild.Core.Attributes
+{
+ ///
+ ///
+ ///
+ [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct)]
+ public sealed class DataNodeAttribute : Attribute
+ {
+ #region Fields
+
+ private string m_Name = "unknown";
+
+ #endregion
+
+ #region Constructors
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The name.
+ public DataNodeAttribute(string name)
+ {
+ m_Name = name;
+ }
+
+ #endregion
+
+ #region Properties
+
+ ///
+ /// Gets the name.
+ ///
+ /// The name.
+ public string Name
+ {
+ get
+ {
+ return m_Name;
+ }
+ }
+
+ #endregion
+ }
+}
diff --git a/Prebuild/src/Core/Attributes/OptionNodeAttribute.cs b/Prebuild/src/Core/Attributes/OptionNodeAttribute.cs
new file mode 100644
index 0000000..edda56d
--- /dev/null
+++ b/Prebuild/src/Core/Attributes/OptionNodeAttribute.cs
@@ -0,0 +1,80 @@
+#region BSD License
+/*
+Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com)
+
+Redistribution and use in source and binary forms, with or without modification, are permitted
+provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice, this list of conditions
+ and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
+ and the following disclaimer in the documentation and/or other materials provided with the
+ distribution.
+* The name of the author may not be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
+BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+#endregion
+
+#region CVS Information
+/*
+ * $Source$
+ * $Author: jendave $
+ * $Date: 2006-01-28 01:49:58 +0100 (lö, 28 jan 2006) $
+ * $Revision: 71 $
+ */
+#endregion
+
+using System;
+
+namespace Prebuild.Core.Attributes
+{
+ ///
+ ///
+ ///
+ [AttributeUsage(AttributeTargets.Field)]
+ public sealed class OptionNodeAttribute : Attribute
+ {
+ #region Fields
+
+ private string m_NodeName;
+
+ #endregion
+
+ #region Constructors
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// Name of the node.
+ public OptionNodeAttribute(string nodeName)
+ {
+ m_NodeName = nodeName;
+ }
+
+ #endregion
+
+ #region Properties
+
+ ///
+ /// Gets the name of the node.
+ ///
+ /// The name of the node.
+ public string NodeName
+ {
+ get
+ {
+ return m_NodeName;
+ }
+ }
+
+ #endregion
+ }
+}
diff --git a/Prebuild/src/Core/Attributes/TargetAttribute.cs b/Prebuild/src/Core/Attributes/TargetAttribute.cs
new file mode 100644
index 0000000..985f180
--- /dev/null
+++ b/Prebuild/src/Core/Attributes/TargetAttribute.cs
@@ -0,0 +1,80 @@
+#region BSD License
+/*
+Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com)
+
+Redistribution and use in source and binary forms, with or without modification, are permitted
+provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice, this list of conditions
+ and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
+ and the following disclaimer in the documentation and/or other materials provided with the
+ distribution.
+* The name of the author may not be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
+BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+#endregion
+
+#region CVS Information
+/*
+ * $Source$
+ * $Author: jendave $
+ * $Date: 2006-01-28 01:49:58 +0100 (lö, 28 jan 2006) $
+ * $Revision: 71 $
+ */
+#endregion
+
+using System;
+
+namespace Prebuild.Core.Attributes
+{
+ ///
+ ///
+ ///
+ [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct)]
+ public sealed class TargetAttribute : Attribute
+ {
+ #region Fields
+
+ private string m_Name;
+
+ #endregion
+
+ #region Constructors
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The name.
+ public TargetAttribute(string name)
+ {
+ m_Name = name;
+ }
+
+ #endregion
+
+ #region Properties
+
+ ///
+ /// Gets the name.
+ ///
+ /// The name.
+ public string Name
+ {
+ get
+ {
+ return m_Name;
+ }
+ }
+
+ #endregion
+ }
+}
diff --git a/Prebuild/src/Core/FatalException.cs b/Prebuild/src/Core/FatalException.cs
new file mode 100644
index 0000000..92aad3d
--- /dev/null
+++ b/Prebuild/src/Core/FatalException.cs
@@ -0,0 +1,94 @@
+#region BSD License
+/*
+Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com)
+
+Redistribution and use in source and binary forms, with or without modification, are permitted
+provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice, this list of conditions
+ and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
+ and the following disclaimer in the documentation and/or other materials provided with the
+ distribution.
+* The name of the author may not be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
+BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+#endregion
+
+#region CVS Information
+/*
+ * $Source$
+ * $Author: jendave $
+ * $Date: 2006-01-28 01:49:58 +0100 (lö, 28 jan 2006) $
+ * $Revision: 71 $
+ */
+#endregion
+
+using System;
+using System.Runtime.Serialization;
+
+namespace Prebuild.Core
+{
+ ///
+ ///
+ ///
+ [Serializable()]
+ public class FatalException : Exception
+ {
+ #region Constructors
+
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ public FatalException()
+ {
+ }
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The format.
+ /// The args.
+ public FatalException(string format, params object[] args)
+ : base(String.Format(format, args))
+ {
+ }
+
+ ///
+ /// Exception with specified string
+ ///
+ /// Exception message
+ public FatalException(string message): base(message)
+ {
+ }
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ public FatalException(string message, Exception exception) : base(message, exception)
+ {
+ }
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ protected FatalException(SerializationInfo info, StreamingContext context) : base( info, context )
+ {
+ }
+
+ #endregion
+ }
+}
diff --git a/Prebuild/src/Core/Interfaces/IDataNode.cs b/Prebuild/src/Core/Interfaces/IDataNode.cs
new file mode 100644
index 0000000..0bad97c
--- /dev/null
+++ b/Prebuild/src/Core/Interfaces/IDataNode.cs
@@ -0,0 +1,56 @@
+#region BSD License
+/*
+Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com)
+
+Redistribution and use in source and binary forms, with or without modification, are permitted
+provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice, this list of conditions
+ and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
+ and the following disclaimer in the documentation and/or other materials provided with the
+ distribution.
+* The name of the author may not be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
+BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+#endregion
+
+#region CVS Information
+/*
+ * $Source$
+ * $Author: jendave $
+ * $Date: 2006-01-28 01:49:58 +0100 (lö, 28 jan 2006) $
+ * $Revision: 71 $
+ */
+#endregion
+
+using System;
+using System.Xml;
+
+namespace Prebuild.Core.Interfaces
+{
+ ///
+ ///
+ ///
+ public interface IDataNode
+ {
+ ///
+ /// Gets or sets the parent.
+ ///
+ /// The parent.
+ IDataNode Parent { get; set; }
+ ///
+ /// Parses the specified node.
+ ///
+ /// The node.
+ void Parse(XmlNode node);
+ }
+}
diff --git a/Prebuild/src/Core/Interfaces/ITarget.cs b/Prebuild/src/Core/Interfaces/ITarget.cs
new file mode 100644
index 0000000..dac6cd6
--- /dev/null
+++ b/Prebuild/src/Core/Interfaces/ITarget.cs
@@ -0,0 +1,60 @@
+#region BSD License
+/*
+Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com)
+
+Redistribution and use in source and binary forms, with or without modification, are permitted
+provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice, this list of conditions
+ and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
+ and the following disclaimer in the documentation and/or other materials provided with the
+ distribution.
+* The name of the author may not be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
+BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+#endregion
+
+#region CVS Information
+/*
+ * $Source$
+ * $Author: jendave $
+ * $Date: 2006-01-28 01:49:58 +0100 (lö, 28 jan 2006) $
+ * $Revision: 71 $
+ */
+#endregion
+
+using System;
+
+namespace Prebuild.Core.Interfaces
+{
+ ///
+ ///
+ ///
+ public interface ITarget
+ {
+ ///
+ /// Writes the specified kern.
+ ///
+ /// The kern.
+ void Write(Kernel kern);
+ ///
+ /// Cleans the specified kern.
+ ///
+ /// The kern.
+ void Clean(Kernel kern);
+ ///
+ /// Gets the name.
+ ///
+ /// The name.
+ string Name { get; }
+ }
+}
\ No newline at end of file
diff --git a/Prebuild/src/Core/Kernel.cs b/Prebuild/src/Core/Kernel.cs
new file mode 100644
index 0000000..3117e7c
--- /dev/null
+++ b/Prebuild/src/Core/Kernel.cs
@@ -0,0 +1,758 @@
+#region BSD License
+/*
+Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com)
+
+Redistribution and use in source and binary forms, with or without modification, are permitted
+provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice, this list of conditions
+ and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
+ and the following disclaimer in the documentation and/or other materials provided with the
+ distribution.
+* The name of the author may not be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
+BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+#endregion
+
+#region CVS Information
+/*
+ * $Source$
+ * $Author: robloach $
+ * $Date: 2006-09-26 00:30:53 +0200 (ti, 26 sep 2006) $
+ * $Revision: 165 $
+ */
+#endregion
+
+using System;
+using System.Diagnostics;
+using System.Collections;
+using System.Collections.Specialized;
+using System.IO;
+using System.Reflection;
+using System.Xml;
+using System.Xml.Schema;
+using System.Text;
+
+using Prebuild.Core.Attributes;
+using Prebuild.Core.Interfaces;
+using Prebuild.Core.Nodes;
+using Prebuild.Core.Parse;
+using Prebuild.Core.Utilities;
+
+namespace Prebuild.Core
+{
+ ///
+ ///
+ ///
+ public class Kernel : IDisposable
+ {
+ #region Inner Classes
+
+ private struct NodeEntry
+ {
+ public Type Type;
+ public DataNodeAttribute Attribute;
+ }
+
+ #endregion
+
+ #region Fields
+
+ private static Kernel m_Instance = new Kernel();
+
+ ///
+ /// This must match the version of the schema that is embeeded
+ ///
+ private static string m_SchemaVersion = "1.7";
+ private static string m_Schema = "prebuild-" + m_SchemaVersion + ".xsd";
+ private static string m_SchemaURI = "http://dnpb.sourceforge.net/schemas/" + m_Schema;
+ bool disposed;
+ private Version m_Version;
+ private string m_Revision = "";
+ private CommandLineCollection m_CommandLine;
+ private Log m_Log;
+ private CurrentDirectory m_CurrentWorkingDirectory;
+ private XmlSchemaCollection m_Schemas;
+
+ private Hashtable m_Targets;
+ private Hashtable m_Nodes;
+
+ ArrayList m_Solutions;
+ string m_Target;
+ string m_Clean;
+ string[] m_RemoveDirectories;
+ string m_CurrentFile;
+ bool m_PauseAfterFinish;
+ string[] m_ProjectGroups;
+ StringCollection m_Refs;
+
+
+ #endregion
+
+ #region Constructors
+
+ private Kernel()
+ {
+ }
+
+ #endregion
+
+ #region Properties
+
+ ///
+ /// Gets a value indicating whether [pause after finish].
+ ///
+ /// true if [pause after finish]; otherwise, false.
+ public bool PauseAfterFinish
+ {
+ get
+ {
+ return m_PauseAfterFinish;
+ }
+ }
+
+ ///
+ /// Gets the instance.
+ ///
+ /// The instance.
+ public static Kernel Instance
+ {
+ get
+ {
+ return m_Instance;
+ }
+ }
+
+ ///
+ /// Gets the version.
+ ///
+ /// The version.
+ public string Version
+ {
+ get
+ {
+ return String.Format("{0}.{1}.{2}{3}", m_Version.Major, m_Version.Minor, m_Version.Build, m_Revision);
+ }
+ }
+
+ ///
+ /// Gets the command line.
+ ///
+ /// The command line.
+ public CommandLineCollection CommandLine
+ {
+ get
+ {
+ return m_CommandLine;
+ }
+ }
+
+ ///
+ /// Gets the targets.
+ ///
+ /// The targets.
+ public Hashtable Targets
+ {
+ get
+ {
+ return m_Targets;
+ }
+ }
+
+ ///
+ /// Gets the log.
+ ///
+ /// The log.
+ public Log Log
+ {
+ get
+ {
+ return m_Log;
+ }
+ }
+
+ ///
+ /// Gets the current working directory.
+ ///
+ /// The current working directory.
+ public CurrentDirectory CurrentWorkingDirectory
+ {
+ get
+ {
+ return m_CurrentWorkingDirectory;
+ }
+ }
+
+ ///
+ /// Gets the solutions.
+ ///
+ /// The solutions.
+ public ArrayList Solutions
+ {
+ get
+ {
+ return m_Solutions;
+ }
+ }
+
+ #endregion
+
+ #region Private Methods
+
+ private void RemoveDirectories(string rootDir, string[] dirNames)
+ {
+ foreach(string dir in Directory.GetDirectories(rootDir))
+ {
+ string simpleName = Path.GetFileName(dir);
+
+ if(Array.IndexOf(dirNames, simpleName) != -1)
+ {
+ //delete if the name matches one of the directory names to delete
+ string fullDirPath = Path.GetFullPath(dir);
+ Directory.Delete(fullDirPath,true);
+ }
+ else//not a match, so check children
+ {
+ RemoveDirectories(dir,dirNames);
+ //recurse, checking children for them
+ }
+ }
+ }
+
+// private void RemoveDirectoryMatches(string rootDir, string dirPattern)
+// {
+// foreach(string dir in Directory.GetDirectories(rootDir))
+// {
+// foreach(string match in Directory.GetDirectories(dir))
+// {//delete all child directories that match
+// Directory.Delete(Path.GetFullPath(match),true);
+// }
+// //recure through the rest checking for nested matches to delete
+// RemoveDirectoryMatches(dir,dirPattern);
+// }
+// }
+
+ private void LoadSchema()
+ {
+ Assembly assembly = this.GetType().Assembly;
+ Stream stream = assembly.GetManifestResourceStream("Prebuild.data." + m_Schema);
+ if(stream == null)
+ {
+ //try without the default namespace prepending to it in case was compiled with SharpDevelop or MonoDevelop instead of Visual Studio .NET
+ stream = assembly.GetManifestResourceStream(m_Schema);
+ if(stream == null)
+ {
+ throw new System.Reflection.TargetException(string.Format("Could not find the scheme embedded resource file '{0}'.", m_Schema));
+ }
+ }
+ XmlReader schema = new XmlTextReader(stream);
+
+ m_Schemas = new XmlSchemaCollection();
+ m_Schemas.Add(m_SchemaURI, schema);
+ }
+
+ private void CacheVersion()
+ {
+ m_Version = Assembly.GetEntryAssembly().GetName().Version;
+ }
+
+ private void CacheTargets(Assembly assm)
+ {
+ foreach(Type t in assm.GetTypes())
+ {
+ TargetAttribute ta = (TargetAttribute)Helper.CheckType(t, typeof(TargetAttribute), typeof(ITarget));
+ if(ta == null)
+ {
+ continue;
+ }
+
+ ITarget target = (ITarget)assm.CreateInstance(t.FullName);
+ if(target == null)
+ {
+ throw new MissingMethodException("Could not create ITarget instance");
+ }
+
+ m_Targets[ta.Name] = target;
+ }
+ }
+
+ private void CacheNodeTypes(Assembly assm)
+ {
+ foreach(Type t in assm.GetTypes())
+ {
+ DataNodeAttribute dna = (DataNodeAttribute)Helper.CheckType(t, typeof(DataNodeAttribute), typeof(IDataNode));
+ if(dna == null)
+ {
+ continue;
+ }
+
+ NodeEntry ne = new NodeEntry();
+ ne.Type = t;
+ ne.Attribute = dna;
+ m_Nodes[dna.Name] = ne;
+ }
+ }
+
+ private void LogBanner()
+ {
+ m_Log.Write("Prebuild v" + this.Version);
+ m_Log.Write("Copyright (c) Matthew Holmes, Dan Moorehead and David Hudson");
+ m_Log.Write("See 'prebuild /usage' for help");
+ m_Log.Write();
+ }
+
+ private void ProcessFile(string file)
+ {
+ m_CurrentWorkingDirectory.Push();
+
+ string path = file;
+ try
+ {
+ try
+ {
+ path = Helper.ResolvePath(path);
+ }
+ catch(ArgumentException)
+ {
+ m_Log.Write("Could not open Prebuild file: " + path);
+ m_CurrentWorkingDirectory.Pop();
+ return;
+ }
+
+ m_CurrentFile = path;
+ Helper.SetCurrentDir(Path.GetDirectoryName(path));
+
+
+ XmlTextReader reader = new XmlTextReader(path);
+
+ Core.Parse.Preprocessor pre = new Core.Parse.Preprocessor();
+
+ //register command line arguments as XML variables
+ IDictionaryEnumerator dict = m_CommandLine.GetEnumerator();
+ while (dict.MoveNext())
+ {
+ string name = dict.Key.ToString().Trim();
+ if (name.Length > 0)
+ pre.RegisterVariable(name, dict.Value.ToString());
+ }
+
+ string xml = pre.Process(reader);//remove script and evaulate pre-proccessing to get schema-conforming XML
+
+
+ XmlDocument doc = new XmlDocument();
+ try
+ {
+ XmlValidatingReader validator = new XmlValidatingReader(new XmlTextReader(new StringReader(xml)));
+
+ //validate while reading from string into XmlDocument DOM structure in memory
+ foreach(XmlSchema schema in m_Schemas)
+ {
+ validator.Schemas.Add(schema);
+ }
+ doc.Load(validator);
+ }
+ catch(XmlException e)
+ {
+ throw new XmlException(e.ToString());
+ }
+
+ //is there a purpose to writing it? An syntax/schema problem would have been found during pre.Process() and reported with details
+ if(m_CommandLine.WasPassed("ppo"))
+ {
+ string ppoFile = m_CommandLine["ppo"];
+ if(ppoFile == null || ppoFile.Trim().Length < 1)
+ {
+ ppoFile = "preprocessed.xml";
+ }
+
+ StreamWriter writer = null;
+ try
+ {
+ writer = new StreamWriter(ppoFile);
+ writer.Write(xml);
+ }
+ catch(IOException ex)
+ {
+ Console.WriteLine("Could not write PPO file '{0}': {1}", ppoFile, ex.Message);
+ }
+ finally
+ {
+ if(writer != null)
+ {
+ writer.Close();
+ }
+ }
+ return;
+ }
+ //start reading the xml config file
+ XmlElement rootNode = doc.DocumentElement;
+ //string suggestedVersion = Helper.AttributeValue(rootNode,"version","1.0");
+ Helper.CheckForOSVariables = Helper.ParseBoolean(rootNode,"checkOsVars",false);
+
+ foreach(XmlNode node in rootNode.ChildNodes)//solutions or if pre-proc instructions
+ {
+ IDataNode dataNode = ParseNode(node, null);
+ if(dataNode is ProcessNode)
+ {
+ ProcessNode proc = (ProcessNode)dataNode;
+ if(proc.IsValid)
+ {
+ ProcessFile(proc.Path);
+ }
+ }
+ else if(dataNode is SolutionNode)
+ {
+ m_Solutions.Add(dataNode);
+ }
+ }
+ }
+ catch(XmlSchemaException xse)
+ {
+ m_Log.Write("XML validation error at line {0} in {1}:\n\n{2}",
+ xse.LineNumber, path, xse.Message);
+ }
+ finally
+ {
+ m_CurrentWorkingDirectory.Pop();
+ }
+ }
+
+ #endregion
+
+ #region Public Methods
+
+ ///
+ /// Allows the project.
+ ///
+ /// The project groups flags.
+ ///
+ public bool AllowProject(string projectGroupsFlags)
+ {
+ if(m_ProjectGroups != null && m_ProjectGroups.Length > 0)
+ {
+ if(projectGroupsFlags != null && projectGroupsFlags.Length == 0)
+ {
+ foreach(string group in projectGroupsFlags.Split('|'))
+ {
+ if(Array.IndexOf(m_ProjectGroups, group) != -1) //if included in the filter list
+ {
+ return true;
+ }
+ }
+ }
+ return false;//not included in the list or no groups specified for the project
+ }
+ return true;//no filter specified in the command line args
+ }
+
+ ///
+ /// Gets the type of the node.
+ ///
+ /// The node.
+ ///
+ public Type GetNodeType(XmlNode node)
+ {
+ if( node == null )
+ {
+ throw new ArgumentNullException("node");
+ }
+ if(!m_Nodes.ContainsKey(node.Name))
+ {
+ return null;
+ }
+
+ NodeEntry ne = (NodeEntry)m_Nodes[node.Name];
+ return ne.Type;
+ }
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public IDataNode ParseNode(XmlNode node, IDataNode parent)
+ {
+ return ParseNode(node, parent, null);
+ }
+
+ //Create an instance of the data node type that is mapped to the name of the xml DOM node
+ ///
+ /// Parses the node.
+ ///
+ /// The node.
+ /// The parent.
+ /// The pre node.
+ ///
+ public IDataNode ParseNode(XmlNode node, IDataNode parent, IDataNode preNode)
+ {
+ IDataNode dataNode = null;
+
+ try
+ {
+ if( node == null )
+ {
+ throw new ArgumentNullException("node");
+ }
+ if(preNode == null)
+ {
+ if(!m_Nodes.ContainsKey(node.Name))
+ {
+ //throw new XmlException("Unknown XML node: " + node.Name);
+ return null;
+ }
+
+ NodeEntry ne = (NodeEntry)m_Nodes[node.Name];
+ Type type = ne.Type;
+ //DataNodeAttribute dna = ne.Attribute;
+
+ dataNode = (IDataNode)type.Assembly.CreateInstance(type.FullName);
+ if(dataNode == null)
+ {
+ throw new System.Reflection.TargetException("Could not create new parser instance: " + type.FullName);
+ }
+ }
+ else
+ dataNode = preNode;
+
+ dataNode.Parent = parent;
+ dataNode.Parse(node);
+ }
+ catch(WarningException wex)
+ {
+ m_Log.Write(LogType.Warning, wex.Message);
+ return null;
+ }
+ catch(FatalException fex)
+ {
+ m_Log.WriteException(LogType.Error, fex);
+ throw;
+ }
+ catch(Exception ex)
+ {
+ m_Log.WriteException(LogType.Error, ex);
+ throw;
+ }
+
+ return dataNode;
+ }
+
+ ///
+ /// Initializes the specified target.
+ ///
+ /// The target.
+ /// The args.
+ public void Initialize(LogTargets target, string[] args)
+ {
+ m_Targets = new Hashtable();
+ CacheTargets(this.GetType().Assembly);
+ m_Nodes = new Hashtable();
+ CacheNodeTypes(this.GetType().Assembly);
+ CacheVersion();
+
+ m_CommandLine = new CommandLineCollection(args);
+
+ string logFile = null;
+ if(m_CommandLine.WasPassed("log"))
+ {
+ logFile = m_CommandLine["log"];
+
+ if(logFile != null && logFile.Length == 0)
+ {
+ logFile = "Prebuild.log";
+ }
+ }
+ else
+ {
+ target = target & ~LogTargets.File; //dont output to a file
+ }
+
+ m_Log = new Log(target, logFile);
+ LogBanner();
+
+ m_CurrentWorkingDirectory = new CurrentDirectory();
+
+ m_Target = m_CommandLine["target"];
+ m_Clean = m_CommandLine["clean"];
+ string removeDirs = m_CommandLine["removedir"];
+ if(removeDirs != null && removeDirs.Length == 0)
+ {
+ m_RemoveDirectories = removeDirs.Split('|');
+ }
+
+ string flags = m_CommandLine["allowedgroups"];//allows filtering by specifying a pipe-delimited list of groups to include
+ if(flags != null && flags.Length == 0)
+ {
+ m_ProjectGroups = flags.Split('|');
+ }
+ m_PauseAfterFinish = m_CommandLine.WasPassed("pause");
+
+ LoadSchema();
+
+ m_Solutions = new ArrayList();
+ m_Refs = new StringCollection();
+ }
+
+ ///
+ /// Processes this instance.
+ ///
+ public void Process()
+ {
+ bool perfomedOtherTask = false;
+ if(m_RemoveDirectories != null && m_RemoveDirectories.Length > 0)
+ {
+ try
+ {
+ RemoveDirectories(".",m_RemoveDirectories);
+ }
+ catch(IOException e)
+ {
+ m_Log.Write("Failed to remove directories named {0}",m_RemoveDirectories);
+ m_Log.WriteException(LogType.Error,e);
+ }
+ catch(UnauthorizedAccessException e)
+ {
+ m_Log.Write("Failed to remove directories named {0}",m_RemoveDirectories);
+ m_Log.WriteException(LogType.Error,e);
+ }
+ perfomedOtherTask = true;
+ }
+
+ if(m_Target != null && m_Clean != null)
+ {
+ m_Log.Write(LogType.Error, "The options /target and /clean cannot be passed together");
+ return;
+ }
+ else if(m_Target == null && m_Clean == null)
+ {
+ if(perfomedOtherTask) //finished
+ {
+ return;
+ }
+ m_Log.Write(LogType.Error, "Must pass either /target or /clean to process a Prebuild file");
+ return;
+ }
+
+ string file = "./prebuild.xml";
+ if(m_CommandLine.WasPassed("file"))
+ {
+ file = m_CommandLine["file"];
+ }
+
+ ProcessFile(file);
+
+ string target = (m_Target != null ? m_Target.ToLower() : m_Clean.ToLower());
+ bool clean = (m_Target == null);
+ if(clean && target != null && target.Length == 0)
+ {
+ target = "all";
+ }
+ if(clean && target == "all")//default to all if no target was specified for clean
+ {
+ //check if they passed yes
+ if (!m_CommandLine.WasPassed("yes"))
+ {
+ Console.WriteLine("WARNING: This operation will clean ALL project files for all targets, are you sure? (y/n):");
+ string ret = Console.ReadLine();
+ if(ret == null)
+ {
+ return;
+ }
+ ret = ret.Trim().ToLower();
+ if((ret.ToLower() != "y" && ret.ToLower() != "yes"))
+ {
+ return;
+ }
+ }
+ //clean all targets (just cleaning vs2002 target didn't clean nant)
+ foreach(ITarget targ in m_Targets.Values)
+ {
+ targ.Clean(this);
+ }
+ }
+ else
+ {
+ ITarget targ = (ITarget)m_Targets[target];
+
+ if(clean)
+ {
+ targ.Clean(this);
+ }
+ else
+ {
+ targ.Write(this);
+ }
+ }
+
+ m_Log.Flush();
+ }
+
+ #endregion
+
+ #region IDisposable Members
+
+ ///
+ ///
+ ///
+ public void Dispose()
+ {
+ Dispose(true);
+ GC.SuppressFinalize(this);
+ }
+
+ ///
+ /// Dispose objects
+ ///
+ ///
+ /// If true, it will dispose close the handle
+ ///
+ ///
+ /// Will dispose managed and unmanaged resources.
+ ///
+ protected virtual void Dispose(bool disposing)
+ {
+ if (!this.disposed)
+ {
+ if (disposing)
+ {
+ if (this.m_Log != null)
+ {
+ this.m_Log.Close();
+ this.m_Log = null;
+ }
+ }
+ }
+ this.disposed = true;
+ }
+
+ ///
+ ///
+ ///
+ ~Kernel()
+ {
+ this.Dispose(false);
+ }
+
+ ///
+ /// Closes and destroys this object
+ ///
+ ///
+ /// Same as Dispose(true)
+ ///
+ public void Close()
+ {
+ Dispose();
+ }
+
+ #endregion
+ }
+}
\ No newline at end of file
diff --git a/Prebuild/src/Core/Nodes/ConfigurationNode.cs b/Prebuild/src/Core/Nodes/ConfigurationNode.cs
new file mode 100644
index 0000000..390794f
--- /dev/null
+++ b/Prebuild/src/Core/Nodes/ConfigurationNode.cs
@@ -0,0 +1,187 @@
+#region BSD License
+/*
+Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com)
+
+Redistribution and use in source and binary forms, with or without modification, are permitted
+provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice, this list of conditions
+ and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
+ and the following disclaimer in the documentation and/or other materials provided with the
+ distribution.
+* The name of the author may not be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
+BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+#endregion
+
+#region CVS Information
+/*
+ * $Source$
+ * $Author: jendave $
+ * $Date: 2006-01-28 01:49:58 +0100 (lö, 28 jan 2006) $
+ * $Revision: 71 $
+ */
+#endregion
+
+using System;
+using System.Xml;
+
+using Prebuild.Core.Attributes;
+using Prebuild.Core.Interfaces;
+using Prebuild.Core.Utilities;
+
+namespace Prebuild.Core.Nodes
+{
+ ///
+ ///
+ ///
+ [DataNode("Configuration")]
+ public class ConfigurationNode : DataNode, ICloneable, IComparable
+ {
+ #region Fields
+
+ private string m_Name = "unknown";
+ private OptionsNode m_Options;
+
+ #endregion
+
+ #region Constructors
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ public ConfigurationNode()
+ {
+ m_Options = new OptionsNode();
+ }
+
+ #endregion
+
+ #region Properties
+
+ ///
+ /// Gets or sets the parent.
+ ///
+ /// The parent.
+ 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);
+ }
+ }
+ }
+ }
+
+ ///
+ /// Gets the name.
+ ///
+ /// The name.
+ public string Name
+ {
+ get
+ {
+ return m_Name;
+ }
+ }
+
+ ///
+ /// Gets or sets the options.
+ ///
+ /// The options.
+ public OptionsNode Options
+ {
+ get
+ {
+ return m_Options;
+ }
+ set
+ {
+ m_Options = value;
+ }
+ }
+
+ #endregion
+
+ #region Public Methods
+
+ ///
+ /// Parses the specified node.
+ ///
+ /// The node.
+ public override void Parse(XmlNode node)
+ {
+ m_Name = Helper.AttributeValue(node, "name", m_Name);
+ 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);
+ }
+ }
+ }
+
+ ///
+ /// Copies to.
+ ///
+ /// The conf.
+ public void CopyTo(ConfigurationNode conf)
+ {
+ m_Options.CopyTo(conf.m_Options);
+ }
+
+ #endregion
+
+ #region ICloneable Members
+
+ ///
+ /// Creates a new object that is a copy of the current instance.
+ ///
+ ///
+ /// A new object that is a copy of this instance.
+ ///
+ public object Clone()
+ {
+ ConfigurationNode ret = new ConfigurationNode();
+ ret.m_Name = m_Name;
+ m_Options.CopyTo(ret.m_Options);
+ return ret;
+ }
+
+ #endregion
+
+ #region IComparable Members
+
+ public int CompareTo(object obj)
+ {
+ ConfigurationNode that = (ConfigurationNode) obj;
+ return this.m_Name.CompareTo(that.m_Name);
+ }
+
+ #endregion
+ }
+}
diff --git a/Prebuild/src/Core/Nodes/DataNode.cs b/Prebuild/src/Core/Nodes/DataNode.cs
new file mode 100644
index 0000000..ef5f7ee
--- /dev/null
+++ b/Prebuild/src/Core/Nodes/DataNode.cs
@@ -0,0 +1,82 @@
+#region BSD License
+/*
+Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com)
+
+Redistribution and use in source and binary forms, with or without modification, are permitted
+provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice, this list of conditions
+ and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
+ and the following disclaimer in the documentation and/or other materials provided with the
+ distribution.
+* The name of the author may not be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
+BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+#endregion
+
+#region CVS Information
+/*
+ * $Source$
+ * $Author: jendave $
+ * $Date: 2006-01-28 01:49:58 +0100 (lö, 28 jan 2006) $
+ * $Revision: 71 $
+ */
+#endregion
+
+using System;
+using System.Xml;
+
+using Prebuild.Core.Attributes;
+using Prebuild.Core.Interfaces;
+
+namespace Prebuild.Core.Nodes
+{
+ ///
+ ///
+ ///
+ public class DataNode : IDataNode
+ {
+ #region Fields
+
+ private IDataNode parent;
+
+ #endregion
+
+ #region IDataNode Members
+
+ ///
+ /// Gets or sets the parent.
+ ///
+ /// The parent.
+ public virtual IDataNode Parent
+ {
+ get
+ {
+ return parent;
+ }
+ set
+ {
+ parent = value;
+ }
+ }
+
+ ///
+ /// Parses the specified node.
+ ///
+ /// The node.
+ public virtual void Parse(XmlNode node)
+ {
+ }
+
+ #endregion
+ }
+}
diff --git a/Prebuild/src/Core/Nodes/ExcludeNode.cs b/Prebuild/src/Core/Nodes/ExcludeNode.cs
new file mode 100644
index 0000000..bfcebca
--- /dev/null
+++ b/Prebuild/src/Core/Nodes/ExcludeNode.cs
@@ -0,0 +1,85 @@
+#region BSD License
+/*
+Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com)
+
+Redistribution and use in source and binary forms, with or without modification, are permitted
+provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice, this list of conditions
+ and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
+ and the following disclaimer in the documentation and/or other materials provided with the
+ distribution.
+* The name of the author may not be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
+BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+#endregion
+
+#region CVS Information
+/*
+ * $Source$
+ * $Author: jendave $
+ * $Date: 2006-01-31 16:35:39 +0100 (ti, 31 jan 2006) $
+ * $Revision: 74 $
+ */
+#endregion
+
+using System;
+using System.Xml;
+
+using Prebuild.Core.Attributes;
+using Prebuild.Core.Interfaces;
+using Prebuild.Core.Utilities;
+
+namespace Prebuild.Core.Nodes
+{
+ ///
+ ///
+ ///
+ [DataNode("Exclude")]
+ public class ExcludeNode : DataNode
+ {
+ #region Fields
+
+ private string m_Name = "unknown";
+
+ #endregion
+
+ #region Properties
+
+ ///
+ /// Gets the name.
+ ///
+ /// The name.
+ public string Name
+ {
+ get
+ {
+ return m_Name;
+ }
+ }
+
+ #endregion
+
+ #region Public Methods
+
+ ///
+ /// Parses the specified node.
+ ///
+ /// The node.
+ public override void Parse(XmlNode node)
+ {
+ m_Name = Helper.AttributeValue(node, "name", m_Name);
+ }
+
+ #endregion
+ }
+}
diff --git a/Prebuild/src/Core/Nodes/FileNode.cs b/Prebuild/src/Core/Nodes/FileNode.cs
new file mode 100644
index 0000000..de3b69e
--- /dev/null
+++ b/Prebuild/src/Core/Nodes/FileNode.cs
@@ -0,0 +1,238 @@
+#region BSD License
+/*
+Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com)
+
+Redistribution and use in source and binary forms, with or without modification, are permitted
+provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice, this list of conditions
+ and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
+ and the following disclaimer in the documentation and/or other materials provided with the
+ distribution.
+* The name of the author may not be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
+BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+#endregion
+
+#region CVS Information
+/*
+ * $Source$
+ * $Author: jendave $
+ * $Date: 2007-01-08 17:55:40 +0100 (må, 08 jan 2007) $
+ * $Revision: 197 $
+ */
+#endregion
+
+using System;
+using System.IO;
+using System.Xml;
+
+using Prebuild.Core.Attributes;
+using Prebuild.Core.Interfaces;
+using Prebuild.Core.Utilities;
+
+namespace Prebuild.Core.Nodes
+{
+ ///
+ ///
+ ///
+ public enum BuildAction
+ {
+ ///
+ ///
+ ///
+ None,
+ ///
+ ///
+ ///
+ Compile,
+ ///
+ ///
+ ///
+ Content,
+ ///
+ ///
+ ///
+ EmbeddedResource
+ }
+
+ ///
+ ///
+ ///
+ public enum SubType
+ {
+ ///
+ ///
+ ///
+ Code,
+ ///
+ ///
+ ///
+ Component,
+ ///
+ ///
+ ///
+ Designer,
+ ///
+ ///
+ ///
+ Form,
+ ///
+ ///
+ ///
+ Settings,
+ ///
+ ///
+ ///
+ UserControl
+ }
+
+ public enum CopyToOutput
+ {
+ Never,
+ Always,
+ PreserveNewest
+ }
+
+ ///
+ ///
+ ///
+ [DataNode("File")]
+ public class FileNode : DataNode
+ {
+ #region Fields
+
+ private string m_Path;
+ private string m_ResourceName = "";
+ private BuildAction m_BuildAction = BuildAction.Compile;
+ private bool m_Valid;
+ private SubType m_SubType = SubType.Code;
+ private CopyToOutput m_CopyToOutput = CopyToOutput.Never;
+ private bool m_Link = false;
+
+
+ #endregion
+
+ #region Properties
+
+ ///
+ ///
+ ///
+ public string Path
+ {
+ get
+ {
+ return m_Path;
+ }
+ }
+
+ ///
+ ///
+ ///
+ public string ResourceName
+ {
+ get
+ {
+ return m_ResourceName;
+ }
+ }
+
+ ///
+ ///
+ ///
+ public BuildAction BuildAction
+ {
+ get
+ {
+ return m_BuildAction;
+ }
+ }
+
+ public CopyToOutput CopyToOutput
+ {
+ get
+ {
+ return this.m_CopyToOutput;
+ }
+ }
+
+ public bool IsLink
+ {
+ get
+ {
+ return this.m_Link;
+ }
+ }
+
+ ///
+ ///
+ ///
+ public SubType SubType
+ {
+ get
+ {
+ return m_SubType;
+ }
+ }
+
+ ///
+ ///
+ ///
+ public bool IsValid
+ {
+ get
+ {
+ return m_Valid;
+ }
+ }
+
+ #endregion
+
+ #region Public Methods
+
+ ///
+ ///
+ ///
+ ///
+ public override void Parse(XmlNode node)
+ {
+ m_BuildAction = (BuildAction)Enum.Parse(typeof(BuildAction),
+ Helper.AttributeValue(node, "buildAction", m_BuildAction.ToString()));
+ m_SubType = (SubType)Enum.Parse(typeof(SubType),
+ Helper.AttributeValue(node, "subType", m_SubType.ToString()));
+ m_ResourceName = Helper.AttributeValue(node, "resourceName", m_ResourceName.ToString());
+ this.m_Link = bool.Parse(Helper.AttributeValue(node, "link", bool.FalseString));
+ this.m_CopyToOutput = (CopyToOutput) Enum.Parse(typeof(CopyToOutput), Helper.AttributeValue(node, "copyToOutput", this.m_CopyToOutput.ToString()));
+
+ if( node == null )
+ {
+ throw new ArgumentNullException("node");
+ }
+
+ 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);
+ }
+ }
+
+ #endregion
+ }
+}
diff --git a/Prebuild/src/Core/Nodes/FilesNode.cs b/Prebuild/src/Core/Nodes/FilesNode.cs
new file mode 100644
index 0000000..d31307b
--- /dev/null
+++ b/Prebuild/src/Core/Nodes/FilesNode.cs
@@ -0,0 +1,223 @@
+#region BSD License
+/*
+Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com)
+
+Redistribution and use in source and binary forms, with or without modification, are permitted
+provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice, this list of conditions
+ and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
+ and the following disclaimer in the documentation and/or other materials provided with the
+ distribution.
+* The name of the author may not be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
+BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+#endregion
+
+#region CVS Information
+/*
+ * $Source$
+ * $Author: jendave $
+ * $Date: 2006-09-20 09:42:51 +0200 (on, 20 sep 2006) $
+ * $Revision: 164 $
+ */
+#endregion
+
+using System;
+using System.Collections;
+using System.Collections.Specialized;
+using System.Xml;
+
+using Prebuild.Core.Attributes;
+using Prebuild.Core.Interfaces;
+
+namespace Prebuild.Core.Nodes
+{
+ ///
+ ///
+ ///
+ [DataNode("Files")]
+ public class FilesNode : DataNode
+ {
+ #region Fields
+
+ private StringCollection m_Files;
+ private Hashtable m_BuildActions;
+ private Hashtable m_SubTypes;
+ private Hashtable m_ResourceNames;
+ private Hashtable m_CopyToOutputs;
+ private Hashtable m_Links;
+
+
+ #endregion
+
+ #region Constructors
+
+ ///
+ ///
+ ///
+ public FilesNode()
+ {
+ m_Files = new StringCollection();
+ m_BuildActions = new Hashtable();
+ m_SubTypes = new Hashtable();
+ m_ResourceNames = new Hashtable();
+ m_CopyToOutputs = new Hashtable();
+ m_Links = new Hashtable();
+ }
+
+ #endregion
+
+ #region Properties
+
+ ///
+ ///
+ ///
+ public int Count
+ {
+ get
+ {
+ return m_Files.Count;
+ }
+ }
+
+ #endregion
+
+ #region Public Methods
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ public BuildAction GetBuildAction(string file)
+ {
+ if(!m_BuildActions.ContainsKey(file))
+ {
+ return BuildAction.Compile;
+ }
+
+ return (BuildAction)m_BuildActions[file];
+ }
+
+ public CopyToOutput GetCopyToOutput(string file)
+ {
+ if (!this.m_CopyToOutputs.ContainsKey(file))
+ {
+ return CopyToOutput.Never;
+ }
+ return (CopyToOutput) this.m_CopyToOutputs[file];
+ }
+
+ public bool GetIsLink(string file)
+ {
+ if (!this.m_Links.ContainsKey(file))
+ {
+ return false;
+ }
+ return (bool) this.m_Links[file];
+ }
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ public SubType GetSubType(string file)
+ {
+ if(!m_SubTypes.ContainsKey(file))
+ {
+ return SubType.Code;
+ }
+
+ return (SubType)m_SubTypes[file];
+ }
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ public string GetResourceName(string file)
+ {
+ if(!m_ResourceNames.ContainsKey(file))
+ {
+ return "";
+ }
+
+ return (string)m_ResourceNames[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;
+ this.m_Links[fileNode.Path] = fileNode.IsLink;
+ this.m_CopyToOutputs[fileNode.Path] = fileNode.CopyToOutput;
+
+ }
+ }
+ }
+ else if(dataNode is MatchNode)
+ {
+ foreach(string file in ((MatchNode)dataNode).Files)
+ {
+ if (!m_Files.Contains(file))
+ {
+ m_Files.Add(file);
+ m_BuildActions[file] = ((MatchNode)dataNode).BuildAction;
+ m_SubTypes[file] = ((MatchNode)dataNode).SubType;
+ m_ResourceNames[file] = ((MatchNode)dataNode).ResourceName;
+ this.m_Links[file] = ((MatchNode) dataNode).IsLink;
+ this.m_CopyToOutputs[file] = ((MatchNode) dataNode).CopyToOutput;
+
+ }
+ }
+ }
+ }
+ }
+
+ // TODO: Check in to why StringCollection's enumerator doesn't implement
+ // IEnumerator?
+ ///
+ ///
+ ///
+ ///
+ public StringEnumerator GetEnumerator()
+ {
+ return m_Files.GetEnumerator();
+ }
+
+ #endregion
+
+ }
+}
diff --git a/Prebuild/src/Core/Nodes/MatchNode.cs b/Prebuild/src/Core/Nodes/MatchNode.cs
new file mode 100644
index 0000000..e0d2fa8
--- /dev/null
+++ b/Prebuild/src/Core/Nodes/MatchNode.cs
@@ -0,0 +1,299 @@
+#region BSD License
+/*
+Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com)
+
+Redistribution and use in source and binary forms, with or without modification, are permitted
+provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice, this list of conditions
+ and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
+ and the following disclaimer in the documentation and/or other materials provided with the
+ distribution.
+* The name of the author may not be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
+BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+#endregion
+
+#region CVS Information
+/*
+ * $Source$
+ * $Author: jendave $
+ * $Date: 2006-09-20 09:42:51 +0200 (on, 20 sep 2006) $
+ * $Revision: 164 $
+ */
+#endregion
+
+using System;
+using System.Collections.Specialized;
+using System.IO;
+using System.Text.RegularExpressions;
+using System.Xml;
+
+using Prebuild.Core.Attributes;
+using Prebuild.Core.Interfaces;
+using Prebuild.Core.Utilities;
+
+namespace Prebuild.Core.Nodes
+{
+ ///
+ ///
+ ///
+ [DataNode("Match")]
+ public class MatchNode : DataNode
+ {
+ #region Fields
+
+ private StringCollection m_Files;
+ private Regex m_Regex;
+ private BuildAction m_BuildAction = BuildAction.Compile;
+ private SubType m_SubType = SubType.Code;
+ string m_ResourceName = "";
+ private CopyToOutput m_CopyToOutput;
+ private bool m_Link;
+
+
+ #endregion
+
+ #region Constructors
+
+ ///
+ ///
+ ///
+ public MatchNode()
+ {
+ m_Files = new StringCollection();
+ }
+
+ #endregion
+
+ #region Properties
+
+ ///
+ ///
+ ///
+ public StringCollection Files
+ {
+ get
+ {
+ return m_Files;
+ }
+ }
+
+ ///
+ ///
+ ///
+ public BuildAction BuildAction
+ {
+ get
+ {
+ return m_BuildAction;
+ }
+ }
+
+ ///
+ ///
+ ///
+ public SubType SubType
+ {
+ get
+ {
+ return m_SubType;
+ }
+ }
+
+ public CopyToOutput CopyToOutput
+ {
+ get
+ {
+ return this.m_CopyToOutput;
+ }
+ }
+
+ public bool IsLink
+ {
+ get
+ {
+ return this.m_Link;
+ }
+ }
+
+ ///
+ ///
+ ///
+ public string ResourceName
+ {
+ get
+ {
+ return m_ResourceName;
+ }
+ }
+
+
+ #endregion
+
+ #region Private Methods
+
+ ///
+ /// Recurses the directories.
+ ///
+ /// The path.
+ /// The pattern.
+ /// if set to true [recurse].
+ /// if set to true [use regex].
+ private void RecurseDirectories(string path, string pattern, bool recurse, bool useRegex)
+ {
+ try
+ {
+ string[] files;
+
+ if(!useRegex)
+ {
+ files = Directory.GetFiles(path, pattern);
+ if(files != null)
+ {
+ string fileTemp;
+ foreach (string file in files)
+ {
+ if (file.Substring(0,2) == "./" || file.Substring(0,2) == ".\\")
+ {
+ fileTemp = file.Substring(2);
+ }
+ else
+ {
+ fileTemp = file;
+ }
+
+ m_Files.Add(fileTemp);
+ }
+ }
+ else
+ {
+ return;
+ }
+ }
+ else
+ {
+ Match match;
+ files = Directory.GetFiles(path);
+ foreach(string file in files)
+ {
+ match = m_Regex.Match(file);
+ if(match.Success)
+ {
+ m_Files.Add(file);
+ }
+ }
+ }
+
+ if(recurse)
+ {
+ string[] dirs = Directory.GetDirectories(path);
+ if(dirs != null && dirs.Length > 0)
+ {
+ foreach(string str in dirs)
+ {
+ RecurseDirectories(Helper.NormalizePath(str), pattern, recurse, useRegex);
+ }
+ }
+ }
+ }
+ catch(DirectoryNotFoundException)
+ {
+ return;
+ }
+ catch(ArgumentException)
+ {
+ return;
+ }
+ }
+
+ #endregion
+
+ #region Public Methods
+
+ ///
+ ///
+ ///
+ ///
+ 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", "*");
+ bool recurse = (bool)Helper.TranslateValue(typeof(bool), Helper.AttributeValue(node, "recurse", "false"));
+ bool useRegex = (bool)Helper.TranslateValue(typeof(bool), Helper.AttributeValue(node, "useRegex", "false"));
+ m_BuildAction = (BuildAction)Enum.Parse(typeof(BuildAction),
+ Helper.AttributeValue(node, "buildAction", m_BuildAction.ToString()));
+ m_SubType = (SubType)Enum.Parse(typeof(SubType),
+ Helper.AttributeValue(node, "subType", m_SubType.ToString()));
+ m_ResourceName = Helper.AttributeValue(node, "resourceName", m_ResourceName.ToString());
+ this.m_CopyToOutput = (CopyToOutput) Enum.Parse(typeof(CopyToOutput), Helper.AttributeValue(node, "copyToOutput", this.m_CopyToOutput.ToString()));
+ this.m_Link = bool.Parse(Helper.AttributeValue(node, "link", bool.FalseString));
+
+
+ if(path != null && path.Length == 0)
+ {
+ path = ".";//use current directory
+ }
+ //throw new WarningException("Match must have a 'path' attribute");
+
+ if(pattern == null)
+ {
+ throw new WarningException("Match must have a 'pattern' attribute");
+ }
+
+ 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);
+ }
+
+ RecurseDirectories(path, pattern, recurse, useRegex);
+
+ foreach(XmlNode child in node.ChildNodes)
+ {
+ IDataNode dataNode = Kernel.Instance.ParseNode(child, this);
+ if(dataNode is ExcludeNode)
+ {
+ ExcludeNode excludeNode = (ExcludeNode)dataNode;
+ if (m_Files.Contains(Helper.NormalizePath(excludeNode.Name)))
+ {
+ m_Files.Remove(Helper.NormalizePath(excludeNode.Name));
+ }
+ }
+ }
+
+ if(m_Files.Count < 1)
+ {
+ throw new WarningException("Match returned no files: {0}{1}", Helper.EndPath(path), pattern);
+ }
+ m_Regex = null;
+ }
+
+ #endregion
+ }
+}
diff --git a/Prebuild/src/Core/Nodes/OptionsNode.cs b/Prebuild/src/Core/Nodes/OptionsNode.cs
new file mode 100644
index 0000000..b5a2f60
--- /dev/null
+++ b/Prebuild/src/Core/Nodes/OptionsNode.cs
@@ -0,0 +1,655 @@
+#region BSD License
+/*
+Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com)
+
+Redistribution and use in source and binary forms, with or without modification, are permitted
+provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice, this list of conditions
+ and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
+ and the following disclaimer in the documentation and/or other materials provided with the
+ distribution.
+* The name of the author may not be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
+BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+#endregion
+
+#region CVS Information
+/*
+ * $Source$
+ * $Author: jendave $
+ * $Date: 2007-01-08 17:55:40 +0100 (må, 08 jan 2007) $
+ * $Revision: 197 $
+ */
+#endregion
+
+
+
+using System;
+using System.Collections;
+using System.Collections.Specialized;
+using System.Reflection;
+using System.Xml;
+
+using Prebuild.Core.Attributes;
+using Prebuild.Core.Interfaces;
+using Prebuild.Core.Utilities;
+
+namespace Prebuild.Core.Nodes
+{
+ ///
+ ///
+ ///
+ [DataNode("Options")]
+ public class OptionsNode : DataNode
+ {
+ #region Fields
+
+ private static Hashtable m_OptionFields;
+
+ [OptionNode("CompilerDefines")]
+ private string m_CompilerDefines = "";
+
+ ///
+ ///
+ ///
+ public string CompilerDefines
+ {
+ get
+ {
+ return m_CompilerDefines;
+ }
+ set
+ {
+ m_CompilerDefines = value;
+ }
+ }
+
+ [OptionNode("OptimizeCode")]
+ private bool m_OptimizeCode;
+
+ ///
+ ///
+ ///
+ public bool OptimizeCode
+ {
+ get
+ {
+ return m_OptimizeCode;
+ }
+ set
+ {
+ m_OptimizeCode = value;
+ }
+ }
+
+ [OptionNode("CheckUnderflowOverflow")]
+ private bool m_CheckUnderflowOverflow;
+
+ ///
+ ///
+ ///
+ public bool CheckUnderflowOverflow
+ {
+ get
+ {
+ return m_CheckUnderflowOverflow;
+ }
+ set
+ {
+ m_CheckUnderflowOverflow = value;
+ }
+ }
+
+ [OptionNode("AllowUnsafe")]
+ private bool m_AllowUnsafe;
+
+ ///
+ ///
+ ///
+ public bool AllowUnsafe
+ {
+ get
+ {
+ return m_AllowUnsafe;
+ }
+ set
+ {
+ m_AllowUnsafe = value;
+ }
+ }
+
+ [OptionNode("PreBuildEvent")]
+ private string m_PreBuildEvent;
+
+ ///
+ ///
+ ///
+ public string PreBuildEvent
+ {
+ get
+ {
+ return m_PreBuildEvent;
+ }
+ set
+ {
+ m_PreBuildEvent = value;
+ }
+ }
+
+ [OptionNode("PostBuildEvent")]
+ private string m_PostBuildEvent;
+
+ ///
+ ///
+ ///
+ public string PostBuildEvent
+ {
+ get
+ {
+ return m_PostBuildEvent;
+ }
+ set
+ {
+ m_PostBuildEvent = value;
+ }
+ }
+
+ [OptionNode("PreBuildEventArgs")]
+ private string m_PreBuildEventArgs;
+
+ ///
+ ///
+ ///
+ public string PreBuildEventArgs
+ {
+ get
+ {
+ return m_PreBuildEventArgs;
+ }
+ set
+ {
+ m_PreBuildEventArgs = value;
+ }
+ }
+
+ [OptionNode("PostBuildEventArgs")]
+ private string m_PostBuildEventArgs;
+
+ ///
+ ///
+ ///
+ public string PostBuildEventArgs
+ {
+ get
+ {
+ return m_PostBuildEventArgs;
+ }
+ set
+ {
+ m_PostBuildEventArgs = value;
+ }
+ }
+
+ [OptionNode("RunPostBuildEvent")]
+ private string m_RunPostBuildEvent;
+
+ ///
+ ///
+ ///
+ public string RunPostBuildEvent
+ {
+ get
+ {
+ return m_RunPostBuildEvent;
+ }
+ set
+ {
+ m_RunPostBuildEvent = value;
+ }
+ }
+
+ [OptionNode("RunScript")]
+ private string m_RunScript;
+
+ ///
+ ///
+ ///
+ public string RunScript
+ {
+ get
+ {
+ return m_RunScript;
+ }
+ set
+ {
+ m_RunScript = value;
+ }
+ }
+
+ [OptionNode("WarningLevel")]
+ private int m_WarningLevel = 4;
+
+ ///
+ ///
+ ///
+ public int WarningLevel
+ {
+ get
+ {
+ return m_WarningLevel;
+ }
+ set
+ {
+ m_WarningLevel = value;
+ }
+ }
+
+ [OptionNode("WarningsAsErrors")]
+ private bool m_WarningsAsErrors;
+
+ ///
+ ///
+ ///
+ public bool WarningsAsErrors
+ {
+ get
+ {
+ return m_WarningsAsErrors;
+ }
+ set
+ {
+ m_WarningsAsErrors = value;
+ }
+ }
+
+ [OptionNode("SuppressWarnings")]
+ private string m_SuppressWarnings = "";
+
+ ///
+ ///
+ ///
+ public string SuppressWarnings
+ {
+ get
+ {
+ return m_SuppressWarnings;
+ }
+ set
+ {
+ m_SuppressWarnings = value;
+ }
+ }
+
+ [OptionNode("OutputPath")]
+ private string m_OutputPath = "bin/";
+
+ ///
+ ///
+ ///
+ public string OutputPath
+ {
+ get
+ {
+ return m_OutputPath;
+ }
+ set
+ {
+ m_OutputPath = value;
+ }
+ }
+
+ [OptionNode("GenerateDocumentation")]
+ private bool m_GenerateDocumentation;
+
+ ///
+ ///
+ ///
+ public bool GenerateDocumentation
+ {
+ get
+ {
+ return m_GenerateDocumentation;
+ }
+ set
+ {
+ m_GenerateDocumentation = value;
+ }
+ }
+
+ [OptionNode("GenerateXmlDocFile")]
+ private bool m_GenerateXmlDocFile;
+
+ ///
+ ///
+ ///
+ public bool GenerateXmlDocFile
+ {
+ get
+ {
+ return m_GenerateXmlDocFile;
+ }
+ set
+ {
+ m_GenerateXmlDocFile = value;
+ }
+ }
+
+ [OptionNode("XmlDocFile")]
+ private string m_XmlDocFile = "";
+
+ ///
+ ///
+ ///
+ public string XmlDocFile
+ {
+ get
+ {
+ return m_XmlDocFile;
+ }
+ set
+ {
+ m_XmlDocFile = value;
+ }
+ }
+
+ [OptionNode("KeyFile")]
+ private string m_KeyFile = "";
+
+ ///
+ ///
+ ///
+ public string KeyFile
+ {
+ get
+ {
+ return m_KeyFile;
+ }
+ set
+ {
+ m_KeyFile = value;
+ }
+ }
+
+ [OptionNode("DebugInformation")]
+ private bool m_DebugInformation;
+
+ ///
+ ///
+ ///
+ public bool DebugInformation
+ {
+ get
+ {
+ return m_DebugInformation;
+ }
+ set
+ {
+ m_DebugInformation = value;
+ }
+ }
+
+ [OptionNode("RegisterComInterop")]
+ private bool m_RegisterComInterop;
+
+ ///
+ ///
+ ///
+ public bool RegisterComInterop
+ {
+ get
+ {
+ return m_RegisterComInterop;
+ }
+ set
+ {
+ m_RegisterComInterop = value;
+ }
+ }
+
+ [OptionNode("RemoveIntegerChecks")]
+ private bool m_RemoveIntegerChecks;
+
+ ///
+ ///
+ ///
+ public bool RemoveIntegerChecks
+ {
+ get
+ {
+ return m_RemoveIntegerChecks;
+ }
+ set
+ {
+ m_RemoveIntegerChecks = value;
+ }
+ }
+
+ [OptionNode("IncrementalBuild")]
+ private bool m_IncrementalBuild;
+
+ ///
+ ///
+ ///
+ public bool IncrementalBuild
+ {
+ get
+ {
+ return m_IncrementalBuild;
+ }
+ set
+ {
+ m_IncrementalBuild = value;
+ }
+ }
+
+ [OptionNode("BaseAddress")]
+ private string m_BaseAddress = "285212672";
+
+ ///
+ ///
+ ///
+ public string BaseAddress
+ {
+ get
+ {
+ return m_BaseAddress;
+ }
+ set
+ {
+ m_BaseAddress = value;
+ }
+ }
+
+ [OptionNode("FileAlignment")]
+ private int m_FileAlignment = 4096;
+
+ ///
+ ///
+ ///
+ public int FileAlignment
+ {
+ get
+ {
+ return m_FileAlignment;
+ }
+ set
+ {
+ m_FileAlignment = value;
+ }
+ }
+
+ [OptionNode("NoStdLib")]
+ private bool m_NoStdLib;
+
+ ///
+ ///
+ ///
+ public bool NoStdLib
+ {
+ get
+ {
+ return m_NoStdLib;
+ }
+ set
+ {
+ m_NoStdLib = value;
+ }
+ }
+
+ private StringCollection m_FieldsDefined;
+
+ #endregion
+
+ #region Constructors
+
+ ///
+ /// Initializes the class.
+ ///
+ static OptionsNode()
+ {
+ Type t = typeof(OptionsNode);
+
+ m_OptionFields = new Hashtable();
+ foreach(FieldInfo f in t.GetFields(BindingFlags.NonPublic | BindingFlags.Instance))
+ {
+ object[] attrs = f.GetCustomAttributes(typeof(OptionNodeAttribute), false);
+ if(attrs == null || attrs.Length < 1)
+ {
+ continue;
+ }
+
+ OptionNodeAttribute ona = (OptionNodeAttribute)attrs[0];
+ m_OptionFields[ona.NodeName] = f;
+ }
+ }
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ public OptionsNode()
+ {
+ m_FieldsDefined = new StringCollection();
+ }
+
+ #endregion
+
+ #region Properties
+
+ ///
+ /// Gets the at the specified index.
+ ///
+ ///
+ public object this[string index]
+ {
+ get
+ {
+ if(!m_OptionFields.ContainsKey(index))
+ {
+ return null;
+ }
+
+ FieldInfo f = (FieldInfo)m_OptionFields[index];
+ return f.GetValue(this);
+ }
+ }
+
+ ///
+ /// Gets the at the specified index.
+ ///
+ ///
+ public object this[string index, object defaultValue]
+ {
+ get
+ {
+ object valueObject = this[index];
+ if(valueObject != null && valueObject is string && ((string)valueObject).Length == 0)
+ {
+ return defaultValue;
+ }
+ return valueObject;
+ }
+ }
+
+
+ #endregion
+
+ #region Private Methods
+
+ private void FlagDefined(string name)
+ {
+ if(!m_FieldsDefined.Contains(name))
+ {
+ m_FieldsDefined.Add(name);
+ }
+ }
+
+ private void SetOption(string nodeName, string val)
+ {
+ lock(m_OptionFields)
+ {
+ if(!m_OptionFields.ContainsKey(nodeName))
+ {
+ return;
+ }
+
+ FieldInfo f = (FieldInfo)m_OptionFields[nodeName];
+ f.SetValue(this, Helper.TranslateValue(f.FieldType, val));
+ FlagDefined(f.Name);
+ }
+ }
+
+ #endregion
+
+ #region Public Methods
+
+ ///
+ /// Parses the specified node.
+ ///
+ /// The node.
+ public override void Parse(XmlNode node)
+ {
+ if( node == null )
+ {
+ throw new ArgumentNullException("node");
+ }
+
+ foreach(XmlNode child in node.ChildNodes)
+ {
+ SetOption(child.Name, Helper.InterpolateForEnvironmentVariables(child.InnerText));
+ }
+ }
+
+ ///
+ /// Copies to.
+ ///
+ /// The opt.
+ public void CopyTo(OptionsNode opt)
+ {
+ if(opt == null)
+ {
+ return;
+ }
+
+ foreach(FieldInfo f in m_OptionFields.Values)
+ {
+ if(m_FieldsDefined.Contains(f.Name))
+ {
+ f.SetValue(opt, f.GetValue(this));
+ opt.m_FieldsDefined.Add(f.Name);
+ }
+ }
+ }
+
+ #endregion
+ }
+}
diff --git a/Prebuild/src/Core/Nodes/ProcessNode.cs b/Prebuild/src/Core/Nodes/ProcessNode.cs
new file mode 100644
index 0000000..f546a4b
--- /dev/null
+++ b/Prebuild/src/Core/Nodes/ProcessNode.cs
@@ -0,0 +1,119 @@
+#region BSD License
+/*
+Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com)
+
+Redistribution and use in source and binary forms, with or without modification, are permitted
+provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice, this list of conditions
+ and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
+ and the following disclaimer in the documentation and/or other materials provided with the
+ distribution.
+* The name of the author may not be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
+BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+#endregion
+
+#region CVS Information
+/*
+ * $Source$
+ * $Author: jendave $
+ * $Date: 2006-01-28 01:49:58 +0100 (lö, 28 jan 2006) $
+ * $Revision: 71 $
+ */
+#endregion
+
+using System;
+using System.Collections;
+using System.Collections.Specialized;
+using System.Xml;
+
+using Prebuild.Core.Attributes;
+using Prebuild.Core.Interfaces;
+using Prebuild.Core.Utilities;
+
+namespace Prebuild.Core.Nodes
+{
+ ///
+ ///
+ ///
+ [DataNode("Process")]
+ public class ProcessNode : DataNode
+ {
+ #region Fields
+
+ private string m_Path;
+ private bool m_IsValid = true;
+
+ #endregion
+
+ #region Properties
+
+ ///
+ /// Gets the path.
+ ///
+ /// The path.
+ public string Path
+ {
+ get
+ {
+ return m_Path;
+ }
+ }
+
+ ///
+ /// Gets a value indicating whether this instance is valid.
+ ///
+ /// true if this instance is valid; otherwise, false.
+ public bool IsValid
+ {
+ get
+ {
+ return m_IsValid;
+ }
+ }
+
+ #endregion
+
+ #region Public Methods
+
+ ///
+ /// Parses the specified node.
+ ///
+ /// The node.
+ 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 = "";
+ }
+
+ 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
+ }
+}
diff --git a/Prebuild/src/Core/Nodes/ProjectNode.cs b/Prebuild/src/Core/Nodes/ProjectNode.cs
new file mode 100644
index 0000000..c56dacc
--- /dev/null
+++ b/Prebuild/src/Core/Nodes/ProjectNode.cs
@@ -0,0 +1,510 @@
+#region BSD License
+/*
+Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com)
+
+Redistribution and use in source and binary forms, with or without modification, are permitted
+provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice, this list of conditions
+ and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
+ and the following disclaimer in the documentation and/or other materials provided with the
+ distribution.
+* The name of the author may not be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
+BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+#endregion
+
+#region CVS Information
+/*
+ * $Source$
+ * $Author: jendave $
+ * $Date: 2006-11-11 05:43:20 +0100 (lö, 11 nov 2006) $
+ * $Revision: 192 $
+ */
+#endregion
+
+using System;
+using System.Collections;
+using System.IO;
+using System.Xml;
+
+using Prebuild.Core.Attributes;
+using Prebuild.Core.Interfaces;
+using Prebuild.Core.Utilities;
+
+namespace Prebuild.Core.Nodes
+{
+ ///
+ ///
+ ///
+ public enum ProjectType
+ {
+ ///
+ ///
+ ///
+ Exe,
+ ///
+ ///
+ ///
+ WinExe,
+ ///
+ ///
+ ///
+ Library
+ }
+
+ ///
+ ///
+ ///
+ public enum ClrRuntime
+ {
+ ///
+ ///
+ ///
+ Microsoft,
+ ///
+ ///
+ ///
+ Mono
+ }
+
+ ///
+ ///
+ ///
+ [DataNode("Project")]
+ public class ProjectNode : DataNode, IComparable
+ {
+ #region Fields
+
+ private string m_Name = "unknown";
+ private string m_Path = "";
+ private string m_FullPath = "";
+ private string m_AssemblyName;
+ private string m_AppIcon = "";
+ private string m_DesignerFolder = "";
+ private string m_Language = "C#";
+ private ProjectType m_Type = ProjectType.Exe;
+ private ClrRuntime m_Runtime = ClrRuntime.Microsoft;
+ private string m_StartupObject = "";
+ private string m_RootNamespace;
+ private string m_FilterGroups = "";
+ private Guid m_Guid;
+
+ private Hashtable m_Configurations;
+ private ArrayList m_ReferencePaths;
+ private ArrayList m_References;
+ private FilesNode m_Files;
+
+ #endregion
+
+ #region Constructors
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ public ProjectNode()
+ {
+ m_Configurations = new Hashtable();
+ m_ReferencePaths = new ArrayList();
+ m_References = new ArrayList();
+ }
+
+ #endregion
+
+ #region Properties
+
+ ///
+ /// Gets the name.
+ ///
+ /// The name.
+ public string Name
+ {
+ get
+ {
+ return m_Name;
+ }
+ }
+
+ ///
+ /// Gets the path.
+ ///
+ /// The path.
+ public string Path
+ {
+ get
+ {
+ return m_Path;
+ }
+ }
+
+ ///
+ /// Gets the filter groups.
+ ///
+ /// The filter groups.
+ public string FilterGroups
+ {
+ get
+ {
+ return m_FilterGroups;
+ }
+ }
+
+ ///
+ /// Gets the full path.
+ ///
+ /// The full path.
+ public string FullPath
+ {
+ get
+ {
+ return m_FullPath;
+ }
+ }
+
+ ///
+ /// Gets the name of the assembly.
+ ///
+ /// The name of the assembly.
+ public string AssemblyName
+ {
+ get
+ {
+ return m_AssemblyName;
+ }
+ }
+
+ ///
+ /// Gets the app icon.
+ ///
+ /// The app icon.
+ public string AppIcon
+ {
+ get
+ {
+ return m_AppIcon;
+ }
+ }
+
+ ///
+ ///
+ ///
+ public string DesignerFolder
+ {
+ get
+ {
+ return m_DesignerFolder;
+ }
+ }
+
+ ///
+ /// Gets the language.
+ ///
+ /// The language.
+ public string Language
+ {
+ get
+ {
+ return m_Language;
+ }
+ }
+
+ ///
+ /// Gets the type.
+ ///
+ /// The type.
+ public ProjectType Type
+ {
+ get
+ {
+ return m_Type;
+ }
+ }
+
+ ///
+ /// Gets the runtime.
+ ///
+ /// The runtime.
+ public ClrRuntime Runtime
+ {
+ get
+ {
+ return m_Runtime;
+ }
+ }
+
+ private bool m_GenerateAssemblyInfoFile = false;
+
+ ///
+ ///
+ ///
+ public bool GenerateAssemblyInfoFile
+ {
+ get
+ {
+ return m_GenerateAssemblyInfoFile;
+ }
+ set
+ {
+ m_GenerateAssemblyInfoFile = value;
+ }
+ }
+
+ ///
+ /// Gets the startup object.
+ ///
+ /// The startup object.
+ public string StartupObject
+ {
+ get
+ {
+ return m_StartupObject;
+ }
+ }
+
+ ///
+ /// Gets the root namespace.
+ ///
+ /// The root namespace.
+ public string RootNamespace
+ {
+ get
+ {
+ return m_RootNamespace;
+ }
+ }
+
+ ///
+ /// Gets the configurations.
+ ///
+ /// The configurations.
+ public ICollection Configurations
+ {
+ get
+ {
+ ArrayList tmp = new ArrayList( ConfigurationsTable.Values);
+ tmp.Sort();
+ return tmp;
+ }
+ }
+
+ ///
+ /// Gets the configurations table.
+ ///
+ /// The configurations table.
+ public Hashtable ConfigurationsTable
+ {
+ get
+ {
+ return m_Configurations;
+ }
+ }
+
+ ///
+ /// Gets the reference paths.
+ ///
+ /// The reference paths.
+ public ArrayList ReferencePaths
+ {
+ get
+ {
+ ArrayList tmp = new ArrayList(m_ReferencePaths);
+ tmp.Sort();
+ return tmp;
+ }
+ }
+
+ ///
+ /// Gets the references.
+ ///
+ /// The references.
+ public ArrayList References
+ {
+ get
+ {
+ ArrayList tmp = new ArrayList(m_References);
+ tmp.Sort();
+ return tmp;
+ }
+ }
+
+ ///
+ /// Gets the files.
+ ///
+ /// The files.
+ public FilesNode Files
+ {
+ get
+ {
+ return m_Files;
+ }
+ }
+
+ ///
+ /// Gets or sets the parent.
+ ///
+ /// The parent.
+ public override IDataNode Parent
+ {
+ get
+ {
+ return base.Parent;
+ }
+ set
+ {
+ base.Parent = value;
+ if(base.Parent is SolutionNode && m_Configurations.Count < 1)
+ {
+ SolutionNode parent = (SolutionNode)base.Parent;
+ foreach(ConfigurationNode conf in parent.Configurations)
+ {
+ m_Configurations[conf.Name] = conf.Clone();
+ }
+ }
+ }
+ }
+
+ ///
+ /// Gets the GUID.
+ ///
+ /// The GUID.
+ public Guid Guid
+ {
+ get
+ {
+ return m_Guid;
+ }
+ }
+
+ #endregion
+
+ #region Private Methods
+
+ private void HandleConfiguration(ConfigurationNode conf)
+ {
+ if(String.Compare(conf.Name, "all", true) == 0) //apply changes to all, this may not always be applied first,
+ //so it *may* override changes to the same properties for configurations defines at the project level
+ {
+ foreach(ConfigurationNode confNode in this.m_Configurations.Values)
+ {
+ conf.CopyTo(confNode);//update the config templates defines at the project level with the overrides
+ }
+ }
+ if(m_Configurations.ContainsKey(conf.Name))
+ {
+ ConfigurationNode parentConf = (ConfigurationNode)m_Configurations[conf.Name];
+ conf.CopyTo(parentConf);//update the config templates defines at the project level with the overrides
+ }
+ else
+ {
+ m_Configurations[conf.Name] = conf;
+ }
+ }
+
+ #endregion
+
+ #region Public Methods
+
+ ///
+ /// Parses the specified node.
+ ///
+ /// The node.
+ public override void Parse(XmlNode node)
+ {
+ m_Name = Helper.AttributeValue(node, "name", m_Name);
+ m_Path = Helper.AttributeValue(node, "path", m_Path);
+ m_FilterGroups = Helper.AttributeValue(node, "filterGroups", m_FilterGroups);
+ m_AppIcon = Helper.AttributeValue(node, "icon", m_AppIcon);
+ m_DesignerFolder = Helper.AttributeValue(node, "designerFolder", m_DesignerFolder);
+ m_AssemblyName = Helper.AttributeValue(node, "assemblyName", m_AssemblyName);
+ m_Language = Helper.AttributeValue(node, "language", m_Language);
+ m_Type = (ProjectType)Helper.EnumAttributeValue(node, "type", typeof(ProjectType), m_Type);
+ m_Runtime = (ClrRuntime)Helper.EnumAttributeValue(node, "runtime", typeof(ClrRuntime), m_Runtime);
+ m_StartupObject = Helper.AttributeValue(node, "startupObject", m_StartupObject);
+ m_RootNamespace = Helper.AttributeValue(node, "rootNamespace", m_RootNamespace);
+
+ int hash = m_Name.GetHashCode();
+
+ m_Guid = new Guid( hash, 0, 0, 0, 0, 0, 0,0,0,0,0 );
+
+ m_GenerateAssemblyInfoFile = Helper.ParseBoolean(node, "generateAssemblyInfoFile", false);
+
+ if(m_AssemblyName == null || m_AssemblyName.Length < 1)
+ {
+ m_AssemblyName = m_Name;
+ }
+
+ if(m_RootNamespace == null || m_RootNamespace.Length < 1)
+ {
+ m_RootNamespace = m_Name;
+ }
+
+ m_FullPath = m_Path;
+ try
+ {
+ m_FullPath = Helper.ResolvePath(m_FullPath);
+ }
+ catch
+ {
+ throw new WarningException("Could not resolve Solution path: {0}", m_Path);
+ }
+
+ Kernel.Instance.CurrentWorkingDirectory.Push();
+ try
+ {
+ Helper.SetCurrentDir(m_FullPath);
+
+ if( node == null )
+ {
+ throw new ArgumentNullException("node");
+ }
+
+ foreach(XmlNode child in node.ChildNodes)
+ {
+ IDataNode dataNode = Kernel.Instance.ParseNode(child, this);
+ if(dataNode is ConfigurationNode)
+ {
+ HandleConfiguration((ConfigurationNode)dataNode);
+ }
+ else if(dataNode is ReferencePathNode)
+ {
+ m_ReferencePaths.Add(dataNode);
+ }
+ else if(dataNode is ReferenceNode)
+ {
+ m_References.Add(dataNode);
+ }
+ else if(dataNode is FilesNode)
+ {
+ m_Files = (FilesNode)dataNode;
+ }
+ }
+ }
+ finally
+ {
+ Kernel.Instance.CurrentWorkingDirectory.Pop();
+ }
+ }
+
+
+ #endregion
+
+ #region IComparable Members
+
+ public int CompareTo(object obj)
+ {
+ ProjectNode that = (ProjectNode)obj;
+ return this.m_Name.CompareTo(that.m_Name);
+ }
+
+ #endregion
+ }
+}
diff --git a/Prebuild/src/Core/Nodes/ReferenceNode.cs b/Prebuild/src/Core/Nodes/ReferenceNode.cs
new file mode 100644
index 0000000..a2880c0
--- /dev/null
+++ b/Prebuild/src/Core/Nodes/ReferenceNode.cs
@@ -0,0 +1,153 @@
+#region BSD License
+/*
+Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com)
+
+Redistribution and use in source and binary forms, with or without modification, are permitted
+provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice, this list of conditions
+ and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
+ and the following disclaimer in the documentation and/or other materials provided with the
+ distribution.
+* The name of the author may not be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
+BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+#endregion
+
+#region CVS Information
+/*
+ * $Source$
+ * $Author: jendave $
+ * $Date: 2006-07-25 18:56:49 +0200 (ti, 25 jul 2006) $
+ * $Revision: 132 $
+ */
+#endregion
+
+using System;
+using System.Xml;
+
+using Prebuild.Core.Attributes;
+using Prebuild.Core.Interfaces;
+using Prebuild.Core.Utilities;
+
+namespace Prebuild.Core.Nodes
+{
+ ///
+ ///
+ ///
+ [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;
+
+ #endregion
+
+ #region Properties
+
+ ///
+ /// Gets the name.
+ ///
+ /// The name.
+ public string Name
+ {
+ get
+ {
+ return m_Name;
+ }
+ }
+
+ ///
+ /// Gets the path.
+ ///
+ /// The path.
+ public string Path
+ {
+ get
+ {
+ return m_Path;
+ }
+ }
+
+ ///
+ /// Gets a value indicating whether [local copy specified].
+ ///
+ /// true if [local copy specified]; otherwise, false.
+ public bool LocalCopySpecified
+ {
+ get
+ {
+ return ( m_LocalCopy != null && m_LocalCopy.Length == 0);
+ }
+ }
+
+ ///
+ /// Gets a value indicating whether [local copy].
+ ///
+ /// true if [local copy]; otherwise, false.
+ public bool LocalCopy
+ {
+ get
+ {
+ if( m_LocalCopy == null)
+ {
+ return false;
+ }
+ return bool.Parse(m_LocalCopy);
+ }
+ }
+
+ ///
+ /// Gets the version.
+ ///
+ /// The version.
+ public string Version
+ {
+ get
+ {
+ return m_Version;
+ }
+ }
+
+ #endregion
+
+ #region Public Methods
+
+ ///
+ /// Parses the specified node.
+ ///
+ /// The node.
+ public override void Parse(XmlNode node)
+ {
+ m_Name = Helper.AttributeValue(node, "name", m_Name);
+ m_Path = Helper.AttributeValue(node, "path", m_Path);
+ m_LocalCopy = Helper.AttributeValue(node, "localCopy", m_LocalCopy);
+ m_Version = Helper.AttributeValue(node, "version", m_Version);
+ }
+
+ #endregion
+
+ #region IComparable Members
+
+ public int CompareTo(object obj)
+ {
+ ReferenceNode that = (ReferenceNode)obj;
+ return this.m_Name.CompareTo(that.m_Name);
+ }
+
+ #endregion
+ }
+}
diff --git a/Prebuild/src/Core/Nodes/ReferencePathNode.cs b/Prebuild/src/Core/Nodes/ReferencePathNode.cs
new file mode 100644
index 0000000..0563c1b
--- /dev/null
+++ b/Prebuild/src/Core/Nodes/ReferencePathNode.cs
@@ -0,0 +1,108 @@
+#region BSD License
+/*
+Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com)
+
+Redistribution and use in source and binary forms, with or without modification, are permitted
+provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice, this list of conditions
+ and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
+ and the following disclaimer in the documentation and/or other materials provided with the
+ distribution.
+* The name of the author may not be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
+BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+#endregion
+
+#region CVS Information
+/*
+ * $Source$
+ * $Author: jendave $
+ * $Date: 2006-01-28 01:49:58 +0100 (lö, 28 jan 2006) $
+ * $Revision: 71 $
+ */
+#endregion
+
+using System;
+using System.Collections;
+using System.Collections.Specialized;
+using System.Xml;
+
+using Prebuild.Core.Attributes;
+using Prebuild.Core.Interfaces;
+using Prebuild.Core.Utilities;
+
+namespace Prebuild.Core.Nodes
+{
+ ///
+ ///
+ ///
+ [DataNode("ReferencePath")]
+ public class ReferencePathNode : DataNode, IComparable
+ {
+ #region Fields
+
+ private string m_Path;
+
+ #endregion
+
+ #region Properties
+
+ ///
+ /// Gets the path.
+ ///
+ /// The path.
+ public string Path
+ {
+ get
+ {
+ return m_Path;
+ }
+ }
+
+ #endregion
+
+ #region Public Methods
+
+ ///
+ /// Parses the specified node.
+ ///
+ /// The node.
+ 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 = m_Path.Trim();
+ }
+
+ #endregion
+
+ #region IComparable Members
+
+ public int CompareTo(object obj)
+ {
+ ReferencePathNode that = (ReferencePathNode)obj;
+ return this.m_Path.CompareTo(that.m_Path);
+ }
+
+ #endregion
+ }
+}
diff --git a/Prebuild/src/Core/Nodes/SolutionNode.cs b/Prebuild/src/Core/Nodes/SolutionNode.cs
new file mode 100644
index 0000000..c777fa4
--- /dev/null
+++ b/Prebuild/src/Core/Nodes/SolutionNode.cs
@@ -0,0 +1,288 @@
+#region BSD License
+/*
+Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com)
+
+Redistribution and use in source and binary forms, with or without modification, are permitted
+provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice, this list of conditions
+ and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
+ and the following disclaimer in the documentation and/or other materials provided with the
+ distribution.
+* The name of the author may not be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
+BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+#endregion
+
+#region CVS Information
+/*
+ * $Source$
+ * $Author: jendave $
+ * $Date: 2006-02-28 17:15:42 +0100 (ti, 28 feb 2006) $
+ * $Revision: 92 $
+ */
+#endregion
+
+using System;
+using System.Collections;
+using System.Diagnostics;
+using System.IO;
+using System.Xml;
+
+using Prebuild.Core.Attributes;
+using Prebuild.Core.Interfaces;
+using Prebuild.Core.Utilities;
+
+namespace Prebuild.Core.Nodes
+{
+ ///
+ ///
+ ///
+ [DataNode("Solution")]
+ public class SolutionNode : DataNode
+ {
+ #region Fields
+
+ private string m_Name = "unknown";
+ private string m_Path = "";
+ private string m_FullPath = "";
+ private string m_ActiveConfig = "Debug";
+
+ private OptionsNode m_Options;
+ private FilesNode m_Files;
+ private Hashtable m_Configurations;
+ private Hashtable m_Projects;
+ private ArrayList m_ProjectsOrder;
+
+ #endregion
+
+ #region Constructors
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ public SolutionNode()
+ {
+ m_Configurations = new Hashtable();
+ m_Projects = new Hashtable();
+ m_ProjectsOrder = new ArrayList();
+ }
+
+ #endregion
+
+ #region Properties
+
+ ///
+ /// Gets or sets the active config.
+ ///
+ /// The active config.
+ public string ActiveConfig
+ {
+ get
+ {
+ return m_ActiveConfig;
+ }
+ set
+ {
+ m_ActiveConfig = value;
+ }
+ }
+
+ ///
+ /// Gets the name.
+ ///
+ /// The name.
+ public string Name
+ {
+ get
+ {
+ return m_Name;
+ }
+ }
+
+ ///
+ /// Gets the path.
+ ///
+ /// The path.
+ public string Path
+ {
+ get
+ {
+ return m_Path;
+ }
+ }
+
+ ///
+ /// Gets the full path.
+ ///
+ /// The full path.
+ public string FullPath
+ {
+ get
+ {
+ return m_FullPath;
+ }
+ }
+
+ ///
+ /// Gets the options.
+ ///
+ /// The options.
+ public OptionsNode Options
+ {
+ get
+ {
+ return m_Options;
+ }
+ }
+
+ ///
+ /// Gets the files.
+ ///
+ /// The files.
+ public FilesNode Files
+ {
+ get
+ {
+ return m_Files;
+ }
+ }
+
+ ///
+ /// Gets the configurations.
+ ///
+ /// The configurations.
+ public ICollection Configurations
+ {
+ get
+ {
+ ArrayList tmp = new ArrayList(ConfigurationsTable.Values);
+ tmp.Sort();
+ return tmp;
+ }
+ }
+
+ ///
+ /// Gets the configurations table.
+ ///
+ /// The configurations table.
+ public Hashtable ConfigurationsTable
+ {
+ get
+ {
+ return m_Configurations;
+ }
+ }
+
+ ///
+ /// Gets the projects.
+ ///
+ /// The projects.
+ public ICollection Projects
+ {
+ get
+ {
+ ArrayList tmp = new ArrayList(m_Projects.Values);
+ tmp.Sort();
+ return tmp;
+ }
+ }
+
+ ///
+ /// Gets the projects table.
+ ///
+ /// The projects table.
+ public Hashtable ProjectsTable
+ {
+ get
+ {
+ return m_Projects;
+ }
+ }
+
+ ///
+ /// Gets the projects table.
+ ///
+ /// The projects table.
+ public ArrayList ProjectsTableOrder
+ {
+ get
+ {
+ return m_ProjectsOrder;
+ }
+ }
+
+ #endregion
+
+ #region Public Methods
+
+ ///
+ /// Parses the specified node.
+ ///
+ /// The node.
+ public override void Parse(XmlNode node)
+ {
+ m_Name = Helper.AttributeValue(node, "name", m_Name);
+ m_ActiveConfig = Helper.AttributeValue(node, "activeConfig", m_ActiveConfig);
+ m_Path = Helper.AttributeValue(node, "path", 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);
+
+ 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)
+ {
+ m_Configurations[((ConfigurationNode)dataNode).Name] = dataNode;
+ }
+ else if(dataNode is ProjectNode)
+ {
+ m_Projects[((ProjectNode)dataNode).Name] = dataNode;
+ m_ProjectsOrder.Add(dataNode);
+ }
+ }
+ }
+ finally
+ {
+ Kernel.Instance.CurrentWorkingDirectory.Pop();
+ }
+ }
+
+ #endregion
+ }
+}
diff --git a/Prebuild/src/Core/Parse/IfContext.cs b/Prebuild/src/Core/Parse/IfContext.cs
new file mode 100644
index 0000000..383049d
--- /dev/null
+++ b/Prebuild/src/Core/Parse/IfContext.cs
@@ -0,0 +1,163 @@
+#region BSD License
+/*
+Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com)
+
+Redistribution and use in source and binary forms, with or without modification, are permitted
+provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice, this list of conditions
+ and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
+ and the following disclaimer in the documentation and/or other materials provided with the
+ distribution.
+* The name of the author may not be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
+BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+#endregion
+
+#region CVS Information
+/*
+ * $Source$
+ * $Author: jendave $
+ * $Date: 2006-01-28 01:49:58 +0100 (lö, 28 jan 2006) $
+ * $Revision: 71 $
+ */
+#endregion
+
+using System;
+
+namespace Prebuild.Core.Parse
+{
+ ///
+ ///
+ ///
+ public enum IfState
+ {
+ ///
+ ///
+ ///
+ None,
+ ///
+ ///
+ ///
+ If,
+ ///
+ ///
+ ///
+ ElseIf,
+ ///
+ ///
+ ///
+ Else
+ }
+
+ ///
+ /// Summary description for IfContext.
+ ///
+ // 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;
+
+ #endregion
+
+ #region Constructors
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// if set to true [active].
+ /// if set to true [keep].
+ /// The state.
+ public IfContext(bool active, bool keep, IfState state)
+ {
+ m_Active = active;
+ m_Keep = keep;
+ m_EverKept = keep;
+ m_State = state;
+ }
+
+ #endregion
+
+ #region Properties
+
+ ///
+ /// Gets or sets a value indicating whether this is active.
+ ///
+ /// true if active; otherwise, false.
+ public bool Active
+ {
+ get
+ {
+ return m_Active;
+ }
+ set
+ {
+ m_Active = value;
+ }
+ }
+
+ ///
+ /// Gets or sets a value indicating whether this is keep.
+ ///
+ /// true if keep; otherwise, false.
+ public bool Keep
+ {
+ get
+ {
+ return m_Keep;
+ }
+ set
+ {
+ m_Keep = value;
+ if(m_Keep)
+ {
+ m_EverKept = true;
+ }
+ }
+ }
+
+ ///
+ /// Gets a value indicating whether [ever kept].
+ ///
+ /// true if [ever kept]; otherwise, false.
+ public bool EverKept
+ {
+ get
+ {
+ return m_EverKept;
+ }
+ }
+
+ ///
+ /// Gets or sets the state.
+ ///
+ /// The state.
+ public IfState State
+ {
+ get
+ {
+ return m_State;
+ }
+ set
+ {
+ m_State = value;
+ }
+ }
+
+ #endregion
+ }
+}
diff --git a/Prebuild/src/Core/Parse/Preprocessor.cs b/Prebuild/src/Core/Parse/Preprocessor.cs
new file mode 100644
index 0000000..85e92c3
--- /dev/null
+++ b/Prebuild/src/Core/Parse/Preprocessor.cs
@@ -0,0 +1,519 @@
+#region BSD License
+/*
+Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com)
+
+Redistribution and use in source and binary forms, with or without modification, are permitted
+provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice, this list of conditions
+ and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
+ and the following disclaimer in the documentation and/or other materials provided with the
+ distribution.
+* The name of the author may not be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
+BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+#endregion
+
+#region CVS Information
+/*
+ * $Source$
+ * $Author: jendave $
+ * $Date: 2006-09-01 19:55:06 +0200 (fr, 01 sep 2006) $
+ * $Revision: 147 $
+ */
+#endregion
+
+using System;
+using System.Collections;
+using System.IO;
+using System.Xml;
+
+namespace Prebuild.Core.Parse
+{
+ ///
+ ///
+ ///
+ public enum OperatorSymbol
+ {
+ ///
+ ///
+ ///
+ None,
+ ///
+ ///
+ ///
+ Equal,
+ ///
+ ///
+ ///
+ NotEqual,
+ ///
+ ///
+ ///
+ LessThan,
+ ///
+ ///
+ ///
+ GreaterThan,
+ ///
+ ///
+ ///
+ LessThanEqual,
+ ///
+ ///
+ ///
+ GreaterThanEqual
+ }
+
+ ///
+ ///
+ ///
+ public class Preprocessor
+ {
+ #region Fields
+
+ XmlDocument m_OutDoc;
+ Stack m_IfStack;
+ Hashtable m_Variables;
+
+ #endregion
+
+ #region Constructors
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ public Preprocessor()
+ {
+ m_OutDoc = new XmlDocument();
+ m_IfStack = new Stack();
+ m_Variables = new Hashtable();
+
+ RegisterVariable("OS", GetOS());
+ RegisterVariable("RuntimeVersion", Environment.Version.Major);
+ RegisterVariable("RuntimeMajor", Environment.Version.Major);
+ RegisterVariable("RuntimeMinor", Environment.Version.Minor);
+ RegisterVariable("RuntimeRevision", Environment.Version.Revision);
+ }
+
+ #endregion
+
+ #region Properties
+
+ ///
+ /// Gets the processed doc.
+ ///
+ /// The processed doc.
+ public XmlDocument ProcessedDoc
+ {
+ get
+ {
+ return m_OutDoc;
+ }
+ }
+
+ #endregion
+
+ #region Private Methods
+
+ ///
+ /// Parts of this code were taken from NAnt and is subject to the GPL
+ /// as per NAnt's license. Thanks to the NAnt guys for this little gem.
+ ///
+ ///
+ public static string GetOS()
+ {
+ PlatformID platId = Environment.OSVersion.Platform;
+ if(platId == PlatformID.Win32NT || platId == PlatformID.Win32Windows)
+ {
+ return "Win32";
+ }
+
+ /*
+ * .NET 1.x, under Mono, the UNIX code is 128. Under
+ * .NET 2.x, Mono or MS, the UNIX code is 4
+ */
+ if(Environment.Version.Major == 1)
+ {
+ if((int)platId == 128)
+ {
+ return "UNIX";
+ }
+ }
+ else if((int)platId == 4)
+ {
+ return "UNIX";
+ }
+
+ return "Unknown";
+ }
+
+ private static bool CompareNum(OperatorSymbol oper, int val1, int val2)
+ {
+ switch(oper)
+ {
+ case OperatorSymbol.Equal:
+ return (val1 == val2);
+ case OperatorSymbol.NotEqual:
+ return (val1 != val2);
+ case OperatorSymbol.LessThan:
+ return (val1 < val2);
+ case OperatorSymbol.LessThanEqual:
+ return (val1 <= val2);
+ case OperatorSymbol.GreaterThan:
+ return (val1 > val2);
+ case OperatorSymbol.GreaterThanEqual:
+ return (val1 >= val2);
+ }
+
+ throw new WarningException("Unknown operator type");
+ }
+
+ private static bool CompareStr(OperatorSymbol oper, string val1, string val2)
+ {
+ switch(oper)
+ {
+ case OperatorSymbol.Equal:
+ return (val1 == val2);
+ case OperatorSymbol.NotEqual:
+ return (val1 != val2);
+ case OperatorSymbol.LessThan:
+ return (val1.CompareTo(val2) < 0);
+ case OperatorSymbol.LessThanEqual:
+ return (val1.CompareTo(val2) <= 0);
+ case OperatorSymbol.GreaterThan:
+ return (val1.CompareTo(val2) > 0);
+ case OperatorSymbol.GreaterThanEqual:
+ return (val1.CompareTo(val2) >= 0);
+ }
+
+ throw new WarningException("Unknown operator type");
+ }
+
+ private static char NextChar(int idx, string str)
+ {
+ if((idx + 1) >= str.Length)
+ {
+ return Char.MaxValue;
+ }
+
+ return str[idx + 1];
+ }
+ // Very very simple expression parser. Can only match expressions of the form
+ // :
+ // OS = Windows
+ // OS != Linux
+ // RuntimeMinor > 0
+ private bool ParseExpression(string exp)
+ {
+ if(exp == null)
+ {
+ throw new ArgumentException("Invalid expression, cannot be null");
+ }
+
+ exp = exp.Trim();
+ if(exp.Length < 1)
+ {
+ throw new ArgumentException("Invalid expression, cannot be 0 length");
+ }
+
+ string id = "";
+ string str = "";
+ OperatorSymbol oper = OperatorSymbol.None;
+ bool inStr = false;
+ char c;
+
+ for(int i = 0; i < exp.Length; i++)
+ {
+ c = exp[i];
+ if(Char.IsWhiteSpace(c))
+ {
+ continue;
+ }
+
+ if(Char.IsLetterOrDigit(c) || c == '_')
+ {
+ if(inStr)
+ {
+ str += c;
+ }
+ else
+ {
+ id += c;
+ }
+ }
+ else if(c == '\"')
+ {
+ inStr = !inStr;
+ if(inStr)
+ {
+ str = "";
+ }
+ }
+ else
+ {
+ if(inStr)
+ {
+ str += c;
+ }
+ else
+ {
+ switch(c)
+ {
+ case '=':
+ oper = OperatorSymbol.Equal;
+ break;
+
+ case '!':
+ if(NextChar(i, exp) == '=')
+ {
+ oper = OperatorSymbol.NotEqual;
+ }
+
+ break;
+
+ case '<':
+ if(NextChar(i, exp) == '=')
+ {
+ oper = OperatorSymbol.LessThanEqual;
+ }
+ else
+ {
+ oper = OperatorSymbol.LessThan;
+ }
+
+ break;
+
+ case '>':
+ if(NextChar(i, exp) == '=')
+ {
+ oper = OperatorSymbol.GreaterThanEqual;
+ }
+ else
+ {
+ oper = OperatorSymbol.GreaterThan;
+ }
+
+ break;
+ }
+ }
+ }
+ }
+
+
+ if(inStr)
+ {
+ throw new WarningException("Expected end of string in expression");
+ }
+
+ if(oper == OperatorSymbol.None)
+ {
+ throw new WarningException("Expected operator in expression");
+ }
+ else if(id.Length < 1)
+ {
+ throw new WarningException("Expected identifier in expression");
+ }
+ else if(str.Length < 1)
+ {
+ throw new WarningException("Expected value in expression");
+ }
+
+ bool ret = false;
+ try
+ {
+ object val = m_Variables[id.ToLower()];
+ if(val == null)
+ {
+ throw new WarningException("Unknown identifier '{0}'", id);
+ }
+
+ int numVal, numVal2;
+ string strVal, strVal2;
+ Type t = val.GetType();
+ if(t.IsAssignableFrom(typeof(int)))
+ {
+ numVal = (int)val;
+ numVal2 = Int32.Parse(str);
+ ret = CompareNum(oper, numVal, numVal2);
+ }
+ else
+ {
+ strVal = val.ToString();
+ strVal2 = str;
+ ret = CompareStr(oper, strVal, strVal2);
+ }
+ }
+ catch(ArgumentException ex)
+ {
+ ex.ToString();
+ throw new WarningException("Invalid value type for system variable '{0}', expected int", id);
+ }
+
+ return ret;
+ }
+
+ #endregion
+
+ #region Public Methods
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ public void RegisterVariable(string name, object variableValue)
+ {
+ if(name == null || variableValue == null)
+ {
+ return;
+ }
+
+ m_Variables[name.ToLower()] = variableValue;
+ }
+
+ ///
+ /// Performs validation on the xml source as well as evaluates conditional and flow expresions
+ ///
+ /// For invalid use of conditional expressions or for invalid XML syntax. If a XmlValidatingReader is passed, then will also throw exceptions for non-schema-conforming xml
+ ///
+ /// the output xml
+ public string Process(XmlReader reader)
+ {
+ if(reader == null)
+ {
+ throw new ArgumentException("Invalid XML reader to pre-process");
+ }
+
+ IfContext context = new IfContext(true, true, IfState.None);
+ StringWriter xmlText = new StringWriter();
+ XmlTextWriter writer = new XmlTextWriter(xmlText);
+ writer.Formatting = Formatting.Indented;
+ while(reader.Read())
+ {
+ if(reader.NodeType == XmlNodeType.ProcessingInstruction)
+ {
+ bool ignore = false;
+ switch(reader.LocalName)
+ {
+ case "if":
+ m_IfStack.Push(context);
+ context = new IfContext(context.Keep & context.Active, ParseExpression(reader.Value), IfState.If);
+ ignore = true;
+ break;
+
+ case "elseif":
+ if(m_IfStack.Count == 0)
+ {
+ throw new WarningException("Unexpected 'elseif' outside of 'if'");
+ }
+ else if(context.State != IfState.If && context.State != IfState.ElseIf)
+ {
+ throw new WarningException("Unexpected 'elseif' outside of 'if'");
+ }
+
+ context.State = IfState.ElseIf;
+ if(!context.EverKept)
+ {
+ context.Keep = ParseExpression(reader.Value);
+ }
+ else
+ {
+ context.Keep = false;
+ }
+
+ ignore = true;
+ break;
+
+ case "else":
+ if(m_IfStack.Count == 0)
+ {
+ throw new WarningException("Unexpected 'else' outside of 'if'");
+ }
+ else if(context.State != IfState.If && context.State != IfState.ElseIf)
+ {
+ throw new WarningException("Unexpected 'else' outside of 'if'");
+ }
+
+ context.State = IfState.Else;
+ context.Keep = !context.EverKept;
+ ignore = true;
+ break;
+
+ case "endif":
+ if(m_IfStack.Count == 0)
+ {
+ throw new WarningException("Unexpected 'endif' outside of 'if'");
+ }
+
+ context = (IfContext)m_IfStack.Pop();
+ ignore = true;
+ break;
+ }
+
+ if(ignore)
+ {
+ continue;
+ }
+ }//end pre-proc instruction
+
+ if(!context.Active || !context.Keep)
+ {
+ continue;
+ }
+
+ switch(reader.NodeType)
+ {
+ case XmlNodeType.Element:
+ bool empty = reader.IsEmptyElement;
+ writer.WriteStartElement(reader.Name);
+
+ while (reader.MoveToNextAttribute())
+ {
+ writer.WriteAttributeString(reader.Name, reader.Value);
+ }
+
+ if(empty)
+ {
+ writer.WriteEndElement();
+ }
+
+ break;
+
+ case XmlNodeType.EndElement:
+ writer.WriteEndElement();
+ break;
+
+ case XmlNodeType.Text:
+ writer.WriteString(reader.Value);
+ break;
+
+ case XmlNodeType.CDATA:
+ writer.WriteCData(reader.Value);
+ break;
+
+ default:
+ break;
+ }
+ }
+
+ if(m_IfStack.Count != 0)
+ {
+ throw new WarningException("Mismatched 'if', 'endif' pair");
+ }
+
+ return xmlText.ToString();
+ }
+
+ #endregion
+ }
+}
diff --git a/Prebuild/src/Core/Targets/AutotoolsTarget.cs b/Prebuild/src/Core/Targets/AutotoolsTarget.cs
new file mode 100644
index 0000000..2b4a678
--- /dev/null
+++ b/Prebuild/src/Core/Targets/AutotoolsTarget.cs
@@ -0,0 +1,926 @@
+#region BSD License
+/*
+
+Copyright (c) 2004 - 2006
+Matthew Holmes (matthew@wildfiregames.com),
+Dan Moorehead (dan05a@gmail.com),
+Dave Hudson (jendave@yahoo.com),
+C.J. Adams-Collier (cjcollier@colliertech.org),
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+* The name of the author may not be used to endorse or promote
+products derived from this software without specific prior written
+permission.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
+INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+
+*/
+#endregion
+
+#region CVS Information
+/*
+ * $Source$
+ * $Author: jendave $
+ * $Date: 2006-07-28 22:43:24 -0700 (Fri, 28 Jul 2006) $
+ * $Revision: 136 $
+ */
+#endregion
+
+using System;
+using System.Collections;
+using System.Collections.Specialized;
+using System.IO;
+using System.Reflection;
+using System.Text;
+using System.Text.RegularExpressions;
+
+using Prebuild.Core.Attributes;
+using Prebuild.Core.Interfaces;
+using Prebuild.Core.Nodes;
+using Prebuild.Core.Parse;
+using Prebuild.Core.Utilities;
+
+namespace Prebuild.Core.Targets
+{
+ ///
+ ///
+ ///
+ [Target("autotools")]
+ public class AutotoolsTarget : ITarget
+ {
+ #region Fields
+
+ private Kernel m_Kernel;
+
+ #endregion
+
+ #region Private Methods
+
+ private static string PrependPath(string path)
+ {
+ string tmpPath = Helper.NormalizePath(path, '/');
+ Regex regex = new Regex(@"(\w):/(\w+)");
+ Match match = regex.Match(tmpPath);
+ if(match.Success || tmpPath[0] == '.' || tmpPath[0] == '/')
+ {
+ tmpPath = Helper.NormalizePath(tmpPath);
+ }
+ else
+ {
+ tmpPath = Helper.NormalizePath("./" + tmpPath);
+ }
+
+ return tmpPath;
+ }
+
+ private static string BuildReference(SolutionNode solution, ReferenceNode refr)
+ {
+ string ret = "";
+ if(solution.ProjectsTable.ContainsKey(refr.Name))
+ {
+ ProjectNode project = (ProjectNode)solution.ProjectsTable[refr.Name];
+ string fileRef = FindFileReference(refr.Name, project);
+ string finalPath = Helper.NormalizePath(Helper.MakeFilePath(project.FullPath + "/$(BUILD_DIR)/$(CONFIG)/", refr.Name, "dll"), '/');
+ ret += finalPath;
+ return ret;
+ }
+ else
+ {
+ ProjectNode project = (ProjectNode)refr.Parent;
+ string fileRef = FindFileReference(refr.Name, project);
+
+ if(refr.Path != null || fileRef != null)
+ {
+ string finalPath = (refr.Path != null) ? Helper.NormalizePath(refr.Path + "/" + refr.Name + ".dll", '/') : fileRef;
+ ret += Path.Combine(project.Path, finalPath);
+ return ret;
+ }
+
+ try
+ {
+ //Assembly assem = Assembly.Load(refr.Name);
+ //if (assem != null)
+ //{
+ // int index = refr.Name.IndexOf(",");
+ // if ( index > 0)
+ // {
+ // ret += assem.Location;
+ // //Console.WriteLine("Location1: " + assem.Location);
+ // }
+ // else
+ // {
+ // ret += (refr.Name + ".dll");
+ // //Console.WriteLine("Location2: " + assem.Location);
+ // }
+ //}
+ //else
+ //{
+ int index = refr.Name.IndexOf(",");
+ if ( index > 0)
+ {
+ ret += refr.Name.Substring(0, index) + ".dll";
+ //Console.WriteLine("Location3: " + assem.Location);
+ }
+ else
+ {
+ ret += (refr.Name + ".dll");
+ //Console.WriteLine("Location4: " + assem.Location);
+ }
+ //}
+ }
+ catch (System.NullReferenceException e)
+ {
+ e.ToString();
+ int index = refr.Name.IndexOf(",");
+ if ( index > 0)
+ {
+ ret += refr.Name.Substring(0, index) + ".dll";
+ //Console.WriteLine("Location5: " + assem.Location);
+ }
+ else
+ {
+ ret += (refr.Name + ".dll");
+ //Console.WriteLine("Location6: " + assem.Location);
+ }
+ }
+ }
+ return ret;
+ }
+
+ private static string BuildReferencePath(SolutionNode solution, ReferenceNode refr)
+ {
+ string ret = "";
+ if(solution.ProjectsTable.ContainsKey(refr.Name))
+ {
+ ProjectNode project = (ProjectNode)solution.ProjectsTable[refr.Name];
+ string finalPath = Helper.NormalizePath(Helper.MakeReferencePath(project.FullPath + "/${build.dir}/"), '/');
+ ret += finalPath;
+ return ret;
+ }
+ else
+ {
+ ProjectNode project = (ProjectNode)refr.Parent;
+ string fileRef = FindFileReference(refr.Name, project);
+
+
+ if(refr.Path != null || fileRef != null)
+ {
+ string finalPath = (refr.Path != null) ? Helper.NormalizePath(refr.Path, '/') : fileRef;
+ ret += finalPath;
+ return ret;
+ }
+
+ try
+ {
+ Assembly assem = Assembly.Load(refr.Name);
+ if (assem != null)
+ {
+ ret += "";
+ }
+ else
+ {
+ ret += "";
+ }
+ }
+ catch (System.NullReferenceException e)
+ {
+ e.ToString();
+ 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");
+
+ if(File.Exists(fullPath))
+ {
+ return fullPath;
+ }
+ }
+
+ return null;
+ }
+
+ ///
+ /// Gets the XML doc file.
+ ///
+ /// The project.
+ /// The conf.
+ ///
+ public static string GetXmlDocFile(ProjectNode project, ConfigurationNode conf)
+ {
+ if( conf == null )
+ {
+ 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;
+ }
+
+ ///
+ /// Normalizes the path.
+ ///
+ /// The path.
+ ///
+ public static string NormalizePath(string path)
+ {
+ if(path == null)
+ {
+ return "";
+ }
+
+ StringBuilder tmpPath;
+
+ if (Core.Parse.Preprocessor.GetOS() == "Win32")
+ {
+ tmpPath = new StringBuilder(path.Replace('\\', '/'));
+ tmpPath.Replace("/", @"\\");
+ }
+ else
+ {
+ tmpPath = new StringBuilder(path.Replace('\\', '/'));
+ tmpPath = tmpPath.Replace('/', Path.DirectorySeparatorChar);
+ }
+ return tmpPath.ToString();
+ }
+
+ private void WriteProject(SolutionNode solution, ProjectNode project)
+ {
+ string projFile = Helper.MakeFilePath(project.FullPath, "Include", "am");
+ StreamWriter ss = new StreamWriter(projFile);
+ ss.NewLine = "\n";
+
+ m_Kernel.CurrentWorkingDirectory.Push();
+ Helper.SetCurrentDir(Path.GetDirectoryName(projFile));
+
+ using(ss)
+ {
+ ss.WriteLine(Helper.AssemblyFullName(project.AssemblyName, project.Type) + ":");
+ ss.WriteLine("\tmkdir -p " + Helper.MakePathRelativeTo(solution.FullPath, project.Path) + "/$(BUILD_DIR)/$(CONFIG)/");
+ foreach(string file in project.Files)
+ {
+ if (project.Files.GetSubType(file) != SubType.Code && project.Files.GetSubType(file) != SubType.Settings)
+ {
+ ss.Write("\tresgen ");
+ ss.Write(Helper.NormalizePath(Path.Combine(project.Path, file.Substring(0, file.LastIndexOf('.')) + ".resx "), '/'));
+ if (project.Files.GetResourceName(file) != "")
+ {
+ ss.WriteLine(Helper.NormalizePath(Path.Combine(project.Path, project.RootNamespace + "." + project.Files.GetResourceName(file) + ".resources"), '/'));
+ }
+ else
+ {
+ ss.WriteLine(Helper.NormalizePath(Path.Combine(project.Path, project.RootNamespace + "." + file.Substring(0, file.LastIndexOf('.')) + ".resources"), '/'));
+ }
+ }
+ }
+ ss.WriteLine("\t$(CSC)\t/out:" + Helper.MakePathRelativeTo(solution.FullPath, project.Path) + "/$(BUILD_DIR)/$(CONFIG)/" + Helper.AssemblyFullName(project.AssemblyName, project.Type) + " \\");
+ ss.WriteLine("\t\t/target:" + project.Type.ToString().ToLower() + " \\");
+ if (project.References.Count > 0)
+ {
+ ss.Write("\t\t/reference:");
+ bool firstref = true;
+ foreach(ReferenceNode refr in project.References)
+ {
+ if (firstref)
+ {
+ firstref = false;
+ }
+ else
+ {
+ ss.Write(",");
+ }
+ ss.Write("{0}", Helper.NormalizePath(Helper.MakePathRelativeTo(solution.FullPath, BuildReference(solution, refr)), '/'));
+ }
+ ss.WriteLine(" \\");
+ }
+ //ss.WriteLine("\t\tProperties/AssemblyInfo.cs \\");
+
+ foreach(string file in project.Files)
+ {
+ switch(project.Files.GetBuildAction(file))
+ {
+ case BuildAction.EmbeddedResource:
+ ss.Write("\t\t/resource:");
+ ss.WriteLine(Helper.NormalizePath(Path.Combine(project.Path, file), '/') + " \\");
+ break;
+ default:
+ if (project.Files.GetSubType(file) != SubType.Code && project.Files.GetSubType(file) != SubType.Settings)
+ {
+ ss.Write("\t\t/resource:");
+ if (project.Files.GetResourceName(file) != "")
+ {
+ ss.WriteLine(Helper.NormalizePath(Path.Combine(project.Path, project.RootNamespace + "." + project.Files.GetResourceName(file) + ".resources"), '/') + "," + project.RootNamespace + "." + project.Files.GetResourceName(file) + ".resources" + " \\");
+ }
+ else
+ {
+ ss.WriteLine(Helper.NormalizePath(Path.Combine(project.Path, project.RootNamespace + "." + file.Substring(0, file.LastIndexOf('.')) + ".resources"), '/') + "," + project.RootNamespace + "." + file.Substring(0, file.LastIndexOf('.')) + ".resources" + " \\");
+ }
+ }
+ break;
+ }
+ }
+
+ foreach(ConfigurationNode conf in project.Configurations)
+ {
+ if (conf.Options.KeyFile !="")
+ {
+ ss.WriteLine("\t\t/keyfile:" + Helper.NormalizePath(Path.Combine(project.Path, conf.Options.KeyFile), '/') + " \\");
+ break;
+ }
+ }
+ foreach(ConfigurationNode conf in project.Configurations)
+ {
+ if (conf.Options.AllowUnsafe)
+ {
+ ss.WriteLine("\t\t/unsafe \\");
+ break;
+ }
+ }
+ if (project.AppIcon != "")
+ {
+ ss.WriteLine("\t\t/win32icon:" + Helper.NormalizePath(Path.Combine(project.Path, project.AppIcon), '/') + " \\");
+ }
+
+ foreach(ConfigurationNode conf in project.Configurations)
+ {
+ ss.WriteLine("\t\t/define:{0}", conf.Options.CompilerDefines.Replace(';', ',') + " \\");
+ break;
+ }
+
+ foreach(ConfigurationNode conf in project.Configurations)
+ {
+ if (GetXmlDocFile(project, conf) !="")
+ {
+ ss.WriteLine("\t\t/doc:" + Helper.MakePathRelativeTo(solution.FullPath, project.Path) + "/$(BUILD_DIR)/$(CONFIG)/" + project.Name + ".xml \\");
+ break;
+ }
+ }
+ foreach(string file in project.Files)
+ {
+ switch(project.Files.GetBuildAction(file))
+ {
+ case BuildAction.Compile:
+ ss.WriteLine("\t\t\\");
+ ss.Write("\t\t" + NormalizePath(Path.Combine(Helper.MakePathRelativeTo(solution.FullPath, project.Path), file)));
+ break;
+ default:
+ break;
+ }
+ }
+ ss.WriteLine();
+ ss.WriteLine();
+
+ if (project.Type == ProjectType.Library)
+ {
+ ss.WriteLine("install-data-local:");
+ ss.WriteLine(" echo \"$(GACUTIL) /i bin/Release/" + project.Name + ".dll /f $(GACUTIL_FLAGS)\"; \\");
+ ss.WriteLine(" $(GACUTIL) /i bin/Release/" + project.Name + ".dll /f $(GACUTIL_FLAGS) || exit 1;");
+ ss.WriteLine();
+ ss.WriteLine("uninstall-local:");
+ ss.WriteLine(" echo \"$(GACUTIL) /u " + project.Name + " $(GACUTIL_FLAGS)\"; \\");
+ ss.WriteLine(" $(GACUTIL) /u " + project.Name + " $(GACUTIL_FLAGS) || exit 1;");
+ ss.WriteLine();
+ }
+ ss.WriteLine("CLEANFILES = $(BUILD_DIR)/$(CONFIG)/" + Helper.AssemblyFullName(project.AssemblyName, project.Type) + " $(BUILD_DIR)/$(CONFIG)/" + project.AssemblyName + ".mdb $(BUILD_DIR)/$(CONFIG)/" + project.AssemblyName + ".pdb " + project.AssemblyName + ".xml");
+ ss.WriteLine("EXTRA_DIST = \\");
+ ss.Write(" $(FILES)");
+ foreach(ConfigurationNode conf in project.Configurations)
+ {
+ if (conf.Options.KeyFile != "")
+ {
+ ss.Write(" \\");
+ ss.WriteLine("\t" + conf.Options.KeyFile);
+ }
+ break;
+ }
+ }
+ m_Kernel.CurrentWorkingDirectory.Pop();
+ }
+ bool hasLibrary = false;
+
+ private void WriteCombine(SolutionNode solution)
+ {
+
+ /* TODO: These vars should be pulled from the prebuild.xml file */
+ string releaseVersion = "2.0.0";
+ string assemblyVersion = "2.1.0.0";
+ string description =
+ "Tao Framework " + solution.Name + " Binding For .NET";
+
+ hasLibrary = false;
+ m_Kernel.Log.Write("Creating Autotools make files");
+ foreach(ProjectNode project in solution.Projects)
+ {
+ if(m_Kernel.AllowProject(project.FilterGroups))
+ {
+ m_Kernel.Log.Write("...Creating makefile: {0}", project.Name);
+ WriteProject(solution, project);
+ }
+ }
+
+ m_Kernel.Log.Write("");
+ string combFile = Helper.MakeFilePath(solution.FullPath, "Makefile", "am");
+ StreamWriter ss = new StreamWriter(combFile);
+ ss.NewLine = "\n";
+
+ m_Kernel.CurrentWorkingDirectory.Push();
+ Helper.SetCurrentDir(Path.GetDirectoryName(combFile));
+
+ using(ss)
+ {
+ foreach(ProjectNode project in solution.ProjectsTableOrder)
+ {
+ if (project.Type == ProjectType.Library)
+ {
+ hasLibrary = true;
+ break;
+ }
+ }
+
+ if (hasLibrary)
+ {
+ ss.Write("pkgconfig_in_files = ");
+ foreach(ProjectNode project in solution.ProjectsTableOrder)
+ {
+ if (project.Type == ProjectType.Library)
+ {
+ string combFilepc = Helper.MakeFilePath(solution.FullPath, project.Name, "pc.in");
+ ss.Write(" " + project.Name + ".pc.in ");
+ StreamWriter sspc = new StreamWriter(combFilepc);
+ sspc.NewLine = "\n";
+ using(sspc)
+ {
+ sspc.WriteLine("prefix=@prefix@");
+ sspc.WriteLine("exec_prefix=${prefix}");
+ sspc.WriteLine("libdir=${exec_prefix}/lib");
+ sspc.WriteLine();
+ sspc.WriteLine("Name: @PACKAGE_NAME@");
+ sspc.WriteLine("Description: @DESCRIPTION@");
+ sspc.WriteLine("Version: @ASSEMBLY_VERSION@");
+ sspc.WriteLine("Libs: -r:${libdir}/mono/gac/@PACKAGE_NAME@/@ASSEMBLY_VERSION@__@PUBKEY@/@PACKAGE_NAME@.dll");
+ }
+ }
+ }
+
+ ss.WriteLine();
+ ss.WriteLine("pkgconfigdir=$(prefix)/lib/pkgconfig");
+ ss.WriteLine("pkgconfig_DATA=$(pkgconfig_in_files:.pc.in=.pc)");
+ }
+ ss.WriteLine();
+ foreach(ProjectNode project in solution.ProjectsTableOrder)
+ {
+ string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath);
+ ss.WriteLine("-include x {0}",
+ Helper.NormalizePath(Helper.MakeFilePath(path, "Include", "am"),'/'));
+ }
+ ss.WriteLine();
+ ss.WriteLine("all: \\");
+ ss.Write("\t");
+ foreach(ProjectNode project in solution.ProjectsTableOrder)
+ {
+ string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath);
+ ss.Write(Helper.AssemblyFullName(project.AssemblyName, project.Type) + " ");
+
+ }
+ ss.WriteLine();
+ if (hasLibrary)
+ {
+ ss.WriteLine("EXTRA_DIST = \\");
+ ss.WriteLine("\t$(pkgconfig_in_files)");
+ }
+ else
+ {
+ ss.WriteLine("EXTRA_DIST = ");
+ }
+ ss.WriteLine();
+ ss.WriteLine("DISTCLEANFILES = \\");
+ ss.WriteLine("\tconfigure \\");
+ ss.WriteLine("\tMakefile.in \\");
+ ss.WriteLine("\taclocal.m4");
+ }
+ combFile = Helper.MakeFilePath(solution.FullPath, "configure", "ac");
+ StreamWriter ts = new StreamWriter(combFile);
+ ts.NewLine = "\n";
+ using(ts)
+ {
+ if (this.hasLibrary)
+ {
+ foreach(ProjectNode project in solution.ProjectsTableOrder)
+ {
+ if (project.Type == ProjectType.Library)
+ {
+ ts.WriteLine("AC_INIT(" + project.Name + ".pc.in)");
+ break;
+ }
+ }
+ }
+ else
+ {
+ ts.WriteLine("AC_INIT(Makefile.am)");
+ }
+ ts.WriteLine("AC_PREREQ(2.53)");
+ ts.WriteLine("AC_CANONICAL_SYSTEM");
+
+ ts.WriteLine("PACKAGE_NAME={0}", solution.Name);
+ ts.WriteLine("PACKAGE_VERSION={0}", releaseVersion);
+ ts.WriteLine("DESCRIPTION=\"{0}\"", description);
+ ts.WriteLine("AC_SUBST(DESCRIPTION)");
+ ts.WriteLine("AM_INIT_AUTOMAKE([$PACKAGE_NAME],[$PACKAGE_VERSION],[$DESCRIPTION])");
+
+ ts.WriteLine("ASSEMBLY_VERSION={0}", assemblyVersion);
+ ts.WriteLine("AC_SUBST(ASSEMBLY_VERSION)");
+
+ ts.WriteLine("PUBKEY=`sn -t $PACKAGE_NAME.snk | grep 'Public Key Token' | awk -F: '{print $2}' | sed -e 's/^ //'`");
+ ts.WriteLine("AC_SUBST(PUBKEY)");
+
+ ts.WriteLine();
+ ts.WriteLine("AM_MAINTAINER_MODE");
+ ts.WriteLine();
+ ts.WriteLine("dnl AC_PROG_INTLTOOL([0.25])");
+ ts.WriteLine();
+ ts.WriteLine("AC_PROG_INSTALL");
+ ts.WriteLine();
+ ts.WriteLine("MONO_REQUIRED_VERSION=1.1");
+ ts.WriteLine();
+ ts.WriteLine("AC_MSG_CHECKING([whether we're compiling from CVS])");
+ ts.WriteLine("if test -f \"$srcdir/.cvs_version\" ; then");
+ ts.WriteLine(" from_cvs=yes");
+ ts.WriteLine("else");
+ ts.WriteLine(" if test -f \"$srcdir/.svn\" ; then");
+ ts.WriteLine(" from_cvs=yes");
+ ts.WriteLine(" else");
+ ts.WriteLine(" from_cvs=no");
+ ts.WriteLine(" fi");
+ ts.WriteLine("fi");
+ ts.WriteLine();
+ ts.WriteLine("AC_MSG_RESULT($from_cvs)");
+ ts.WriteLine();
+ ts.WriteLine("AC_PATH_PROG(MONO, mono)");
+ ts.WriteLine("AC_PATH_PROG(GMCS, gmcs)");
+ ts.WriteLine("AC_PATH_PROG(GACUTIL, gacutil)");
+ ts.WriteLine();
+ ts.WriteLine("AC_MSG_CHECKING([for mono])");
+ ts.WriteLine("dnl if test \"x$MONO\" = \"x\" ; then");
+ ts.WriteLine("dnl AC_MSG_ERROR([Can't find \"mono\" in your PATH])");
+ ts.WriteLine("dnl else");
+ ts.WriteLine(" AC_MSG_RESULT([found])");
+ ts.WriteLine("dnl fi");
+ ts.WriteLine();
+ ts.WriteLine("AC_MSG_CHECKING([for gmcs])");
+ ts.WriteLine("dnl if test \"x$GMCS\" = \"x\" ; then");
+ ts.WriteLine("dnl AC_MSG_ERROR([Can't find \"gmcs\" in your PATH])");
+ ts.WriteLine("dnl else");
+ ts.WriteLine(" AC_MSG_RESULT([found])");
+ ts.WriteLine("dnl fi");
+ ts.WriteLine();
+ //ts.WriteLine("AC_MSG_CHECKING([for gacutil])");
+ //ts.WriteLine("if test \"x$GACUTIL\" = \"x\" ; then");
+ //ts.WriteLine(" AC_MSG_ERROR([Can't find \"gacutil\" in your PATH])");
+ //ts.WriteLine("else");
+ //ts.WriteLine(" AC_MSG_RESULT([found])");
+ //ts.WriteLine("fi");
+ ts.WriteLine();
+ ts.WriteLine("AC_SUBST(PATH)");
+ ts.WriteLine("AC_SUBST(LD_LIBRARY_PATH)");
+ ts.WriteLine();
+ ts.WriteLine("dnl CSFLAGS=\"-debug -nowarn:1574\"");
+ ts.WriteLine("CSFLAGS=\"\"");
+ ts.WriteLine("AC_SUBST(CSFLAGS)");
+ ts.WriteLine();
+ // ts.WriteLine("AC_MSG_CHECKING(--disable-sdl argument)");
+ // ts.WriteLine("AC_ARG_ENABLE(sdl,");
+ // ts.WriteLine(" [ --disable-sdl Disable Sdl interface.],");
+ // ts.WriteLine(" [disable_sdl=$disableval],");
+ // ts.WriteLine(" [disable_sdl=\"no\"])");
+ // ts.WriteLine("AC_MSG_RESULT($disable_sdl)");
+ // ts.WriteLine("if test \"$disable_sdl\" = \"yes\"; then");
+ // ts.WriteLine(" AC_DEFINE(FEAT_SDL)");
+ // ts.WriteLine("fi");
+ ts.WriteLine();
+ ts.WriteLine("dnl Find pkg-config");
+ ts.WriteLine("AC_PATH_PROG(PKGCONFIG, pkg-config, no)");
+ ts.WriteLine("if test \"x$PKG_CONFIG\" = \"xno\"; then");
+ ts.WriteLine(" AC_MSG_ERROR([You need to install pkg-config])");
+ ts.WriteLine("fi");
+ ts.WriteLine();
+ ts.WriteLine("PKG_CHECK_MODULES(MONO_DEPENDENCY, mono >= $MONO_REQUIRED_VERSION, has_mono=true, has_mono=false)");
+ ts.WriteLine("BUILD_DIR=\"bin\"");
+ ts.WriteLine("AC_SUBST(BUILD_DIR)");
+ ts.WriteLine("CONFIG=\"Release\"");
+ ts.WriteLine("AC_SUBST(CONFIG)");
+ ts.WriteLine();
+ ts.WriteLine("if test \"x$has_mono\" = \"xtrue\"; then");
+ ts.WriteLine(" AC_PATH_PROG(RUNTIME, mono, no)");
+ ts.WriteLine(" AC_PATH_PROG(CSC, gmcs, no)");
+ ts.WriteLine(" if test `uname -s` = \"Darwin\"; then");
+ ts.WriteLine(" LIB_PREFIX=");
+ ts.WriteLine(" LIB_SUFFIX=.dylib");
+ ts.WriteLine(" else");
+ ts.WriteLine(" LIB_PREFIX=.so");
+ ts.WriteLine(" LIB_SUFFIX=");
+ ts.WriteLine(" fi");
+ ts.WriteLine("else");
+ ts.WriteLine(" AC_PATH_PROG(CSC, csc.exe, no)");
+ ts.WriteLine(" if test x$CSC = \"xno\"; then");
+ ts.WriteLine(" AC_MSG_ERROR([You need to install either mono or .Net])");
+ ts.WriteLine(" else");
+ ts.WriteLine(" RUNTIME=");
+ ts.WriteLine(" LIB_PREFIX=");
+ ts.WriteLine(" LIB_SUFFIX=.dylib");
+ ts.WriteLine(" fi");
+ ts.WriteLine("fi");
+ ts.WriteLine();
+ ts.WriteLine("AC_SUBST(LIB_PREFIX)");
+ ts.WriteLine("AC_SUBST(LIB_SUFFIX)");
+ ts.WriteLine();
+ ts.WriteLine("AC_SUBST(BASE_DEPENDENCIES_CFLAGS)");
+ ts.WriteLine("AC_SUBST(BASE_DEPENDENCIES_LIBS)");
+ ts.WriteLine();
+ ts.WriteLine("dnl Find monodoc");
+ ts.WriteLine("MONODOC_REQUIRED_VERSION=1.0");
+ ts.WriteLine("AC_SUBST(MONODOC_REQUIRED_VERSION)");
+ ts.WriteLine("PKG_CHECK_MODULES(MONODOC_DEPENDENCY, monodoc >= $MONODOC_REQUIRED_VERSION, enable_monodoc=yes, enable_monodoc=no)");
+ ts.WriteLine();
+ ts.WriteLine("if test \"x$enable_monodoc\" = \"xyes\"; then");
+ ts.WriteLine(" AC_PATH_PROG(MONODOC, monodoc, no)");
+ ts.WriteLine(" if test x$MONODOC = xno; then");
+ ts.WriteLine(" enable_monodoc=no");
+ ts.WriteLine(" fi");
+ ts.WriteLine("else");
+ ts.WriteLine(" MONODOC=");
+ ts.WriteLine("fi");
+ ts.WriteLine();
+ ts.WriteLine("AC_SUBST(MONODOC)");
+ ts.WriteLine("AM_CONDITIONAL(ENABLE_MONODOC, test \"x$enable_monodoc\" = \"xyes\")");
+ ts.WriteLine();
+ ts.WriteLine("AC_PATH_PROG(GACUTIL, gacutil, no)");
+ ts.WriteLine("if test \"x$GACUTIL\" = \"xno\" ; then");
+ ts.WriteLine(" AC_MSG_ERROR([No gacutil tool found])");
+ ts.WriteLine("fi");
+ ts.WriteLine();
+ // foreach(ProjectNode project in solution.ProjectsTableOrder)
+ // {
+ // if (project.Type == ProjectType.Library)
+ // {
+ // }
+ // }
+ ts.WriteLine("GACUTIL_FLAGS='/package $(PACKAGE_NAME) /gacdir $(DESTDIR)$(prefix)'");
+ ts.WriteLine("AC_SUBST(GACUTIL_FLAGS)");
+ ts.WriteLine();
+ ts.WriteLine("winbuild=no");
+ ts.WriteLine("case \"$host\" in");
+ ts.WriteLine(" *-*-mingw*|*-*-cygwin*)");
+ ts.WriteLine(" winbuild=yes");
+ ts.WriteLine(" ;;");
+ ts.WriteLine("esac");
+ ts.WriteLine("AM_CONDITIONAL(WINBUILD, test x$winbuild = xyes)");
+ ts.WriteLine();
+ // ts.WriteLine("dnl Check for SDL");
+ // ts.WriteLine();
+ // ts.WriteLine("AC_PATH_PROG([SDL_CONFIG], [sdl-config])");
+ // ts.WriteLine("have_sdl=no");
+ // ts.WriteLine("if test -n \"${SDL_CONFIG}\"; then");
+ // ts.WriteLine(" have_sdl=yes");
+ // ts.WriteLine(" SDL_CFLAGS=`$SDL_CONFIG --cflags`");
+ // ts.WriteLine(" SDL_LIBS=`$SDL_CONFIG --libs`");
+ // ts.WriteLine(" #");
+ // ts.WriteLine(" # sdl-config sometimes emits an rpath flag pointing at its library");
+ // ts.WriteLine(" # installation directory. We don't want this, as it prevents users from");
+ // ts.WriteLine(" # linking sdl-viewer against, for example, a locally compiled libGL when a");
+ // ts.WriteLine(" # version of the library also exists in SDL's library installation");
+ // ts.WriteLine(" # directory, typically /usr/lib.");
+ // ts.WriteLine(" #");
+ // ts.WriteLine(" SDL_LIBS=`echo $SDL_LIBS | sed 's/-Wl,-rpath,[[^ ]]* //'`");
+ // ts.WriteLine("fi");
+ // ts.WriteLine("AC_SUBST([SDL_CFLAGS])");
+ // ts.WriteLine("AC_SUBST([SDL_LIBS])");
+ ts.WriteLine();
+ ts.WriteLine("AC_OUTPUT([");
+ ts.WriteLine("Makefile");
+ // TODO: this does not work quite right.
+ //ts.WriteLine("Properties/AssemblyInfo.cs");
+ foreach(ProjectNode project in solution.ProjectsTableOrder)
+ {
+ if (project.Type == ProjectType.Library)
+ {
+ ts.WriteLine(project.Name + ".pc");
+ }
+ // string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath);
+ // ts.WriteLine(Helper.NormalizePath(Helper.MakeFilePath(path, "Include"),'/'));
+ }
+ ts.WriteLine("])");
+ ts.WriteLine();
+ ts.WriteLine("#po/Makefile.in");
+ ts.WriteLine();
+ ts.WriteLine("echo \"---\"");
+ ts.WriteLine("echo \"Configuration summary\"");
+ ts.WriteLine("echo \"\"");
+ ts.WriteLine("echo \" * Installation prefix: $prefix\"");
+ ts.WriteLine("echo \" * compiler: $CSC\"");
+ ts.WriteLine("echo \" * Documentation: $enable_monodoc ($MONODOC)\"");
+ ts.WriteLine("echo \" * Package Name: $PACKAGE_NAME\"");
+ ts.WriteLine("echo \" * Version: $PACKAGE_VERSION\"");
+ ts.WriteLine("echo \" * Public Key: $PUBKEY\"");
+ ts.WriteLine("echo \"\"");
+ ts.WriteLine("echo \"---\"");
+ ts.WriteLine();
+ }
+
+ ts.NewLine = "\n";
+ foreach (ProjectNode project in solution.ProjectsTableOrder)
+ {
+ if (project.GenerateAssemblyInfoFile)
+ {
+ GenerateAssemblyInfoFile(solution, combFile);
+ }
+ }
+ }
+
+ private static void GenerateAssemblyInfoFile(SolutionNode solution, string combFile)
+ {
+ System.IO.Directory.CreateDirectory(Helper.MakePathRelativeTo(solution.FullPath, "Properties"));
+ combFile = Helper.MakeFilePath(solution.FullPath + "/Properties/", "AssemblyInfo.cs", "in");
+ StreamWriter ai = new StreamWriter(combFile);
+
+ using (ai)
+ {
+ ai.WriteLine("#region License");
+ ai.WriteLine("/*");
+ ai.WriteLine("MIT License");
+ ai.WriteLine("Copyright (c)2003-2006 Tao Framework Team");
+ ai.WriteLine("http://www.taoframework.com");
+ ai.WriteLine("All rights reserved.");
+ ai.WriteLine("");
+ ai.WriteLine("Permission is hereby granted, free of charge, to any person obtaining a copy");
+ ai.WriteLine("of this software and associated documentation files (the \"Software\"), to deal");
+ ai.WriteLine("in the Software without restriction, including without limitation the rights");
+ ai.WriteLine("to use, copy, modify, merge, publish, distribute, sublicense, and/or sell");
+ ai.WriteLine("copies of the Software, and to permit persons to whom the Software is");
+ ai.WriteLine("furnished to do so, subject to the following conditions:");
+ ai.WriteLine("");
+ ai.WriteLine("The above copyright notice and this permission notice shall be included in all");
+ ai.WriteLine("copies or substantial portions of the Software.");
+ ai.WriteLine("");
+ ai.WriteLine("THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR");
+ ai.WriteLine("IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,");
+ ai.WriteLine("FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE");
+ ai.WriteLine("AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER");
+ ai.WriteLine("LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,");
+ ai.WriteLine("OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE");
+ ai.WriteLine("SOFTWARE.");
+ ai.WriteLine("*/");
+ ai.WriteLine("#endregion License");
+ ai.WriteLine("");
+ ai.WriteLine("using System;");
+ ai.WriteLine("using System.Reflection;");
+ ai.WriteLine("using System.Runtime.InteropServices;");
+ ai.WriteLine("using System.Security;");
+ ai.WriteLine("using System.Security.Permissions;");
+ ai.WriteLine("");
+ ai.WriteLine("[assembly: AllowPartiallyTrustedCallers]");
+ ai.WriteLine("[assembly: AssemblyCompany(\"Tao Framework -- http://www.taoframework.com\")]");
+ ai.WriteLine("[assembly: AssemblyConfiguration(\"Retail\")]");
+ ai.WriteLine("[assembly: AssemblyCopyright(\"Copyright (c)2003-2006 Tao Framework Team. All rights reserved.\")]");
+ ai.WriteLine("[assembly: AssemblyCulture(\"\")]");
+ ai.WriteLine("[assembly: AssemblyDefaultAlias(\"@PACKAGE_NAME@\")]");
+ ai.WriteLine("[assembly: AssemblyDelaySign(false)]");
+ ai.WriteLine("[assembly: AssemblyDescription(\"@DESCRIPTION@\")]");
+ ai.WriteLine("[assembly: AssemblyFileVersion(\"@ASSEMBLY_VERSION@\")]");
+ ai.WriteLine("[assembly: AssemblyInformationalVersion(\"@ASSEMBLY_VERSION@\")]");
+ ai.WriteLine("[assembly: AssemblyKeyName(\"\")]");
+ ai.WriteLine("[assembly: AssemblyProduct(\"@PACKAGE_NAME@.dll\")]");
+ ai.WriteLine("[assembly: AssemblyTitle(\"@DESCRIPTION@\")]");
+ ai.WriteLine("[assembly: AssemblyTrademark(\"Tao Framework -- http://www.taoframework.com\")]");
+ ai.WriteLine("[assembly: AssemblyVersion(\"@ASSEMBLY_VERSION@\")]");
+ ai.WriteLine("[assembly: CLSCompliant(true)]");
+ ai.WriteLine("[assembly: ComVisible(false)]");
+ ai.WriteLine("[assembly: SecurityPermission(SecurityAction.RequestMinimum, Flags = SecurityPermissionFlag.Execution)]");
+ ai.WriteLine("[assembly: SecurityPermission(SecurityAction.RequestMinimum, Flags = SecurityPermissionFlag.SkipVerification)]");
+ ai.WriteLine("[assembly: SecurityPermission(SecurityAction.RequestMinimum, Flags = SecurityPermissionFlag.UnmanagedCode)]");
+
+ }
+ //return combFile;
+ }
+
+ private void CleanProject(ProjectNode project)
+ {
+ m_Kernel.Log.Write("...Cleaning project: {0}", project.Name);
+ string projectFile = Helper.MakeFilePath(project.FullPath, "Include", "am");
+ Helper.DeleteIfExists(projectFile);
+ }
+
+ private void CleanSolution(SolutionNode solution)
+ {
+ m_Kernel.Log.Write("Cleaning Autotools make files for", solution.Name);
+
+ string slnFile = Helper.MakeFilePath(solution.FullPath, "Makefile", "am");
+ Helper.DeleteIfExists(slnFile);
+
+ slnFile = Helper.MakeFilePath(solution.FullPath, "Makefile", "in");
+ Helper.DeleteIfExists(slnFile);
+
+ slnFile = Helper.MakeFilePath(solution.FullPath, "configure", "ac");
+ Helper.DeleteIfExists(slnFile);
+
+ slnFile = Helper.MakeFilePath(solution.FullPath, "configure");
+ Helper.DeleteIfExists(slnFile);
+
+ slnFile = Helper.MakeFilePath(solution.FullPath, "Makefile");
+ Helper.DeleteIfExists(slnFile);
+
+ foreach(ProjectNode project in solution.Projects)
+ {
+ CleanProject(project);
+ }
+
+ m_Kernel.Log.Write("");
+ }
+
+ #endregion
+
+ #region ITarget Members
+
+ ///
+ /// Writes the specified kern.
+ ///
+ /// The kern.
+ public void Write(Kernel kern)
+ {
+ if( kern == null )
+ {
+ throw new ArgumentNullException("kern");
+ }
+ m_Kernel = kern;
+ foreach(SolutionNode solution in kern.Solutions)
+ {
+ WriteCombine(solution);
+ }
+ m_Kernel = null;
+ }
+
+ ///
+ /// Cleans the specified kern.
+ ///
+ /// The kern.
+ public virtual void Clean(Kernel kern)
+ {
+ if( kern == null )
+ {
+ throw new ArgumentNullException("kern");
+ }
+ m_Kernel = kern;
+ foreach(SolutionNode sol in kern.Solutions)
+ {
+ CleanSolution(sol);
+ }
+ m_Kernel = null;
+ }
+
+ ///
+ /// Gets the name.
+ ///
+ /// The name.
+ public string Name
+ {
+ get
+ {
+ return "autotools";
+ }
+ }
+
+ #endregion
+ }
+}
diff --git a/Prebuild/src/Core/Targets/DebugTarget.cs b/Prebuild/src/Core/Targets/DebugTarget.cs
new file mode 100644
index 0000000..6baa623
--- /dev/null
+++ b/Prebuild/src/Core/Targets/DebugTarget.cs
@@ -0,0 +1,102 @@
+#region BSD License
+/*
+Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com)
+
+Redistribution and use in source and binary forms, with or without modification, are permitted
+provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice, this list of conditions
+ and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
+ and the following disclaimer in the documentation and/or other materials provided with the
+ distribution.
+* The name of the author may not be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
+BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+#endregion
+
+#region CVS Information
+/*
+ * $Source$
+ * $Author: jendave $
+ * $Date: 2006-09-20 09:42:51 +0200 (on, 20 sep 2006) $
+ * $Revision: 164 $
+ */
+#endregion
+
+using System;
+
+using Prebuild.Core.Attributes;
+using Prebuild.Core.Interfaces;
+using Prebuild.Core.Nodes;
+
+#if (DEBUG && _DEBUG_TARGET)
+namespace Prebuild.Core.Targets
+{
+ [Target("debug")]
+ public class DebugTarget : ITarget
+ {
+#region Fields
+
+ private Kernel m_Kernel = null;
+
+#endregion
+
+#region ITarget Members
+
+ public void Write()
+ {
+ foreach(SolutionNode s in m_Kernel.Solutions)
+ {
+ Console.WriteLine("Solution [ {0}, {1} ]", s.Name, s.Path);
+ foreach(string file in s.Files)
+{
+ Console.WriteLine("\tFile [ {0} ]", file);
+}
+
+ foreach(ProjectNode proj in s.Projects)
+ {
+ Console.WriteLine("\tProject [ {0}, {1}. {2} ]", proj.Name, proj.Path, proj.Language);
+ foreach(string file in proj.Files)
+ Console.WriteLine("\t\tFile [ {0} ]", file);
+ }
+ }
+ }
+
+ public void Clean()
+ {
+ Console.WriteLine("Not implemented");
+ }
+
+ public string Name
+ {
+ get
+ {
+ return "debug";
+ }
+ }
+
+ public Kernel Kernel
+ {
+ get
+ {
+ return m_Kernel;
+ }
+ set
+ {
+ m_Kernel = value;
+ }
+ }
+
+#endregion
+ }
+}
+#endif
diff --git a/Prebuild/src/Core/Targets/MonoDevelopTarget.cs b/Prebuild/src/Core/Targets/MonoDevelopTarget.cs
new file mode 100644
index 0000000..8620e4b
--- /dev/null
+++ b/Prebuild/src/Core/Targets/MonoDevelopTarget.cs
@@ -0,0 +1,458 @@
+#region BSD License
+/*
+Copyright (c) 2004 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com)
+
+Redistribution and use in source and binary forms, with or without modification, are permitted
+provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice, this list of conditions
+ and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
+ and the following disclaimer in the documentation and/or other materials provided with the
+ distribution.
+* The name of the author may not be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
+BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+#endregion
+
+#region CVS Information
+/*
+ * $Source$
+ * $Author: jendave $
+ * $Date: 2007-02-13 22:07:07 +0100 (ti, 13 feb 2007) $
+ * $Revision: 206 $
+ */
+#endregion
+
+using System;
+using System.Collections;
+using System.Collections.Specialized;
+using System.IO;
+using System.Reflection;
+using System.Text.RegularExpressions;
+
+using Prebuild.Core.Attributes;
+using Prebuild.Core.Interfaces;
+using Prebuild.Core.Nodes;
+using Prebuild.Core.Utilities;
+
+namespace Prebuild.Core.Targets
+{
+ ///
+ ///
+ ///
+ [Target("monodev")]
+ public class MonoDevelopTarget : ITarget
+ {
+ #region Fields
+
+ private Kernel m_Kernel;
+
+ #endregion
+
+ #region Private Methods
+
+ private static string PrependPath(string path)
+ {
+ string tmpPath = Helper.NormalizePath(path, '/');
+ Regex regex = new Regex(@"(\w):/(\w+)");
+ Match match = regex.Match(tmpPath);
+ if(match.Success || tmpPath[0] == '.' || tmpPath[0] == '/')
+ {
+ tmpPath = Helper.NormalizePath(tmpPath);
+ }
+ else
+ {
+ tmpPath = Helper.NormalizePath("./" + tmpPath);
+ }
+
+ return tmpPath;
+ }
+
+ private static string BuildReference(SolutionNode solution, ReferenceNode refr)
+ {
+ string ret = "";
+ }
+ else
+ {
+ ProjectNode project = (ProjectNode)refr.Parent;
+ string fileRef = FindFileReference(refr.Name, project);
+
+ if(refr.Path != null || fileRef != null)
+ {
+ ret += "Assembly\" refto=\"";
+
+ string finalPath = (refr.Path != null) ? Helper.MakeFilePath(refr.Path, refr.Name, "dll") : fileRef;
+
+ ret += finalPath;
+ ret += "\" localcopy=\"" + refr.LocalCopy.ToString() + "\" />";
+ return ret;
+ }
+
+ ret += "Gac\"";
+ ret += " localcopy=\"" + refr.LocalCopy.ToString() + "\"";
+ ret += " refto=\"";
+ try
+ {
+ //Assembly assem = Assembly.Load(refr.Name);
+ //ret += assem.FullName;
+ ret += refr.Name;
+ }
+ catch (System.NullReferenceException e)
+ {
+ e.ToString();
+ ret += refr.Name;
+ }
+ 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");
+
+ if(File.Exists(fullPath))
+ {
+ return fullPath;
+ }
+ }
+
+ return null;
+ }
+
+ ///
+ /// Gets the XML doc file.
+ ///
+ /// The project.
+ /// The conf.
+ ///
+ 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";
+ }
+
+ string projFile = Helper.MakeFilePath(project.FullPath, project.Name, "mdp");
+ StreamWriter ss = new StreamWriter(projFile);
+
+ m_Kernel.CurrentWorkingDirectory.Push();
+ Helper.SetCurrentDir(Path.GetDirectoryName(projFile));
+
+ using(ss)
+ {
+ ss.WriteLine(
+ "",
+ project.Name,
+ project.RootNamespace
+ );
+
+ int count = 0;
+
+ ss.WriteLine(" ", solution.ActiveConfig);
+
+ foreach(ConfigurationNode conf in project.Configurations)
+ {
+ ss.WriteLine(" ", conf.Name);
+ ss.Write(" ");
+
+ ss.Write(" ");
+
+ ss.Write(" ");
+
+ ss.Write(" ");
+ ss.WriteLine(" ");
+
+ count++;
+ }
+ ss.WriteLine(" ");
+
+ ss.Write(" ");
+ ss.WriteLine(" ");
+ ss.WriteLine(" ");
+
+ ss.WriteLine(" ");
+ 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.EmbeddedResource:
+ buildAction = "EmbedAsResource";
+ 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(" ", filePath, buildAction);
+ }
+ ss.WriteLine(" ");
+
+ ss.WriteLine(" ");
+ foreach(ReferenceNode refr in project.References)
+ {
+ ss.WriteLine(" {0}", BuildReference(solution, refr));
+ }
+ ss.WriteLine(" ");
+
+
+ ss.WriteLine("");
+ }
+
+ 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);
+ }
+ }
+
+ 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));
+
+ int count = 0;
+
+ using(ss)
+ {
+ ss.WriteLine("", solution.Name);
+
+ count = 0;
+ foreach(ConfigurationNode conf in solution.Configurations)
+ {
+ if(count == 0)
+ {
+ ss.WriteLine(" ", conf.Name);
+ }
+
+ ss.WriteLine(" ", conf.Name);
+ foreach(ProjectNode project in solution.Projects)
+ {
+ ss.WriteLine(" ", project.Name, conf.Name);
+ }
+ ss.WriteLine(" ");
+
+ count++;
+ }
+ ss.WriteLine(" ");
+
+ count = 0;
+
+ foreach(ProjectNode project in solution.Projects)
+ {
+ if(count == 0)
+ ss.WriteLine(" ", project.Name);
+
+ ss.WriteLine(" ", project.Name);
+ count++;
+ }
+ ss.WriteLine(" ");
+
+ ss.WriteLine(" ");
+ foreach(ProjectNode project in solution.Projects)
+ {
+ string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath);
+ ss.WriteLine(" ",
+ Helper.MakeFilePath(path, project.Name, "mdp"));
+ }
+ ss.WriteLine(" ");
+
+ ss.WriteLine("");
+ }
+
+ m_Kernel.CurrentWorkingDirectory.Pop();
+ }
+
+ private void CleanProject(ProjectNode project)
+ {
+ m_Kernel.Log.Write("...Cleaning project: {0}", project.Name);
+ string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, "mdp");
+ Helper.DeleteIfExists(projectFile);
+ }
+
+ private void CleanSolution(SolutionNode solution)
+ {
+ m_Kernel.Log.Write("Cleaning MonoDevelop combine and project files for", solution.Name);
+
+ string slnFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "mds");
+ Helper.DeleteIfExists(slnFile);
+
+ foreach(ProjectNode project in solution.Projects)
+ {
+ CleanProject(project);
+ }
+
+ m_Kernel.Log.Write("");
+ }
+
+ #endregion
+
+ #region ITarget Members
+
+ ///
+ /// Writes the specified kern.
+ ///
+ /// The kern.
+ public void Write(Kernel kern)
+ {
+ if( kern == null )
+ {
+ throw new ArgumentNullException("kern");
+ }
+ m_Kernel = kern;
+ foreach(SolutionNode solution in kern.Solutions)
+ {
+ WriteCombine(solution);
+ }
+ m_Kernel = null;
+ }
+
+ ///
+ /// Cleans the specified kern.
+ ///
+ /// The kern.
+ public virtual void Clean(Kernel kern)
+ {
+ if( kern == null )
+ {
+ throw new ArgumentNullException("kern");
+ }
+ m_Kernel = kern;
+ foreach(SolutionNode sol in kern.Solutions)
+ {
+ CleanSolution(sol);
+ }
+ m_Kernel = null;
+ }
+
+ ///
+ /// Gets the name.
+ ///
+ /// The name.
+ public string Name
+ {
+ get
+ {
+ return "sharpdev";
+ }
+ }
+
+ #endregion
+ }
+}
diff --git a/Prebuild/src/Core/Targets/NAntTarget.cs b/Prebuild/src/Core/Targets/NAntTarget.cs
new file mode 100644
index 0000000..0f0deb2
--- /dev/null
+++ b/Prebuild/src/Core/Targets/NAntTarget.cs
@@ -0,0 +1,621 @@
+#region BSD License
+/*
+Copyright (c) 2004 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com)
+
+Redistribution and use in source and binary forms, with or without modification, are permitted
+provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice, this list of conditions
+ and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
+ and the following disclaimer in the documentation and/or other materials provided with the
+ distribution.
+* The name of the author may not be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
+BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+#endregion
+
+#region CVS Information
+/*
+ * $Source$
+ * $Author: jendave $
+ * $Date: 2007-02-13 21:58:03 +0100 (ti, 13 feb 2007) $
+ * $Revision: 205 $
+ */
+#endregion
+
+using System;
+using System.Collections;
+using System.Collections.Specialized;
+using System.IO;
+using System.Reflection;
+using System.Text.RegularExpressions;
+
+using Prebuild.Core.Attributes;
+using Prebuild.Core.Interfaces;
+using Prebuild.Core.Nodes;
+using Prebuild.Core.Utilities;
+
+namespace Prebuild.Core.Targets
+{
+ ///
+ ///
+ ///
+ [Target("nant")]
+ public class NAntTarget : ITarget
+ {
+ #region Fields
+
+ private Kernel m_Kernel;
+
+ #endregion
+
+ #region Private Methods
+
+ private static string PrependPath(string path)
+ {
+ string tmpPath = Helper.NormalizePath(path, '/');
+ Regex regex = new Regex(@"(\w):/(\w+)");
+ Match match = regex.Match(tmpPath);
+ //if(match.Success || tmpPath[0] == '.' || tmpPath[0] == '/')
+ //{
+ tmpPath = Helper.NormalizePath(tmpPath);
+ //}
+// else
+// {
+// tmpPath = Helper.NormalizePath("./" + tmpPath);
+// }
+
+ return tmpPath;
+ }
+
+ private static string BuildReference(SolutionNode solution, ProjectNode currentProject, ReferenceNode refr)
+ {
+ string ret = "";
+ if(solution.ProjectsTable.ContainsKey(refr.Name))
+ {
+ ProjectNode project = (ProjectNode)solution.ProjectsTable[refr.Name];
+
+ string finalPath = Helper.NormalizePath(((ReferencePathNode)currentProject.ReferencePaths[0]).Path + refr.Name + ".dll", '/');
+
+ return finalPath;
+ }
+ else
+ {
+ ProjectNode project = (ProjectNode)refr.Parent;
+ string fileRef = FindFileReference(refr.Name, project);
+
+ if(refr.Path != null || fileRef != null)
+ {
+ string finalPath = (refr.Path != null) ? Helper.NormalizePath(refr.Path + "/" + refr.Name + ".dll", '/') : fileRef;
+ ret += finalPath;
+ return ret;
+ }
+
+ try
+ {
+ //Assembly assem = Assembly.Load(refr.Name);
+ //if (assem != null)
+ //{
+ //ret += (refr.Name + ".dll");
+ //}
+ //else
+ //{
+ ret += (refr.Name + ".dll");
+ //}
+ }
+ catch (System.NullReferenceException e)
+ {
+ e.ToString();
+ ret += refr.Name + ".dll";
+ }
+ }
+ return ret;
+ }
+
+ private static string BuildReferencePath(SolutionNode solution, ReferenceNode refr)
+ {
+ string ret = "";
+ if(solution.ProjectsTable.ContainsKey(refr.Name))
+ {
+ ProjectNode project = (ProjectNode)solution.ProjectsTable[refr.Name];
+ string finalPath = Helper.NormalizePath(((ReferencePathNode)project.ReferencePaths[0]).Path, '/');
+
+ return finalPath;
+ }
+ else
+ {
+ ProjectNode project = (ProjectNode)refr.Parent;
+ string fileRef = FindFileReference(refr.Name, project);
+
+ if(refr.Path != null || fileRef != null)
+ {
+ string finalPath = (refr.Path != null) ? Helper.NormalizePath(refr.Path, '/') : fileRef;
+ ret += finalPath;
+ return ret;
+ }
+
+ try
+ {
+ Assembly assem = Assembly.Load(refr.Name);
+ if (assem != null)
+ {
+ ret += "";
+ }
+ else
+ {
+ ret += "";
+ }
+ }
+ catch (System.NullReferenceException e)
+ {
+ e.ToString();
+ 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");
+
+ if(File.Exists(fullPath))
+ {
+ return fullPath;
+ }
+ }
+
+ return null;
+ }
+
+ ///
+ /// Gets the XML doc file.
+ ///
+ /// The project.
+ /// The conf.
+ ///
+ public static string GetXmlDocFile(ProjectNode project, ConfigurationNode conf)
+ {
+ if( conf == null )
+ {
+ 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)
+ {
+ string projFile = Helper.MakeFilePath(project.FullPath, project.Name + (project.Type == ProjectType.Library ? ".dll" : ".exe"), "build");
+ StreamWriter ss = new StreamWriter(projFile);
+
+ m_Kernel.CurrentWorkingDirectory.Push();
+ Helper.SetCurrentDir(Path.GetDirectoryName(projFile));
+ bool hasDoc = false;
+
+ using(ss)
+ {
+ ss.WriteLine("");
+ ss.WriteLine("", project.Name);
+ ss.WriteLine(" ", "build");
+ ss.WriteLine(" ");
+ ss.WriteLine(" ");
+ ss.WriteLine(" ");
+ ss.WriteLine(" ");
+ foreach(ReferenceNode refr in project.References)
+ {
+ if (refr.LocalCopy)
+ {
+ ss.WriteLine(" ", '/'));
+ }
+ }
+ ss.WriteLine(" ");
+ ss.WriteLine(" ");
+ ss.Write(" ");
+ ss.WriteLine(" ", project.RootNamespace);
+ foreach (string file in project.Files)
+ {
+ switch (project.Files.GetBuildAction(file))
+ {
+ case BuildAction.EmbeddedResource:
+ ss.WriteLine(" {0}", "");
+ break;
+ default:
+ if (project.Files.GetSubType(file) != SubType.Code && project.Files.GetSubType(file) != SubType.Settings)
+ {
+ ss.WriteLine(" ", file.Substring(0, file.LastIndexOf('.')) + ".resx");
+ }
+ break;
+ }
+ }
+ //if (project.Files.GetSubType(file).ToString() != "Code")
+ //{
+ // ps.WriteLine(" ", file.Substring(0, file.LastIndexOf('.')) + ".resx");
+
+ ss.WriteLine(" ");
+ ss.WriteLine(" ");
+ foreach(string file in project.Files)
+ {
+ switch(project.Files.GetBuildAction(file))
+ {
+ case BuildAction.Compile:
+ ss.WriteLine(" ");
+ break;
+ default:
+ break;
+ }
+ }
+ ss.WriteLine(" ");
+ ss.WriteLine(" ");
+ ss.WriteLine(" ");
+ ss.WriteLine(" ");
+ ss.WriteLine(" ");
+ ss.WriteLine(" ");
+ foreach(ReferenceNode refr in project.References)
+ {
+ string path = Helper.NormalizePath(Helper.MakePathRelativeTo(project.FullPath, BuildReference(solution, project, refr)), '/');
+ ss.WriteLine(" " );
+ }
+ ss.WriteLine(" ");
+
+ ss.WriteLine(" ");
+
+ foreach (ConfigurationNode conf in project.Configurations)
+ {
+ if (!String.IsNullOrEmpty(conf.Options.OutputPath))
+ {
+ string targetDir = Helper.NormalizePath(conf.Options.OutputPath, '/');
+
+ ss.WriteLine(" ");
+
+ ss.WriteLine(" ");
+
+ ss.WriteLine(" ");
+ ss.WriteLine(" ");
+ ss.WriteLine(" ");
+ ss.WriteLine(" ");
+ ss.WriteLine(" ");
+ ss.WriteLine(" ");
+ break;
+ }
+ }
+
+ ss.WriteLine(" ");
+
+ ss.WriteLine(" ");
+ ss.WriteLine(" ");
+ ss.WriteLine(" ");
+ ss.WriteLine(" ");
+
+ ss.WriteLine(" ");
+ if (hasDoc)
+ {
+ ss.WriteLine(" ");
+ ss.WriteLine(" ");
+ ss.WriteLine(" ");
+ ss.WriteLine(" ");
+ ss.WriteLine(" ");
+ ss.WriteLine(" ");
+ ss.Write(" ");
+ }
+ else
+ {
+ ss.WriteLine(".exe\" />");
+ }
+
+ ss.WriteLine(" ");
+ ss.WriteLine(" ");
+ ss.WriteLine(" ");
+ ss.WriteLine(" ");
+ ss.WriteLine(" ");
+ ss.WriteLine(" ");
+ // foreach(ReferenceNode refr in project.References)
+ // {
+ // string path = Helper.NormalizePath(Helper.MakePathRelativeTo(project.FullPath, BuildReferencePath(solution, refr)), '/');
+ // if (path != "")
+ // {
+ // ss.WriteLine(" ", path);
+ // }
+ // }
+ ss.WriteLine(" ");
+ ss.WriteLine(" ");
+ ss.WriteLine(" ");
+ ss.WriteLine(" ");
+ ss.WriteLine(" ");
+ ss.WriteLine(" ");
+ ss.WriteLine(" ");
+ ss.WriteLine(" ");
+ ss.WriteLine(" ");
+ ss.WriteLine(" ");
+ ss.WriteLine(" ");
+ ss.WriteLine(" ");
+ ss.WriteLine(" ");
+ ss.WriteLine(" ");
+ ss.WriteLine(" ");
+ ss.WriteLine(" ");
+ ss.WriteLine(" ");
+ ss.WriteLine(" ");
+ ss.WriteLine(" ");
+ ss.WriteLine(" ");
+ ss.WriteLine(" ");
+ ss.WriteLine(" ");
+ ss.WriteLine(" ");
+ ss.WriteLine(" ");
+ ss.WriteLine(" ");
+ }
+ ss.WriteLine(" ");
+ ss.WriteLine("");
+ }
+ 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);
+ }
+ }
+
+ m_Kernel.Log.Write("");
+ string combFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "build");
+ StreamWriter ss = new StreamWriter(combFile);
+
+ m_Kernel.CurrentWorkingDirectory.Push();
+ Helper.SetCurrentDir(Path.GetDirectoryName(combFile));
+
+ using(ss)
+ {
+ ss.WriteLine("");
+ ss.WriteLine("", solution.Name);
+ ss.WriteLine(" ");
+ ss.WriteLine();
+
+ //ss.WriteLine(" ");
+ //ss.WriteLine(" ");
+ ss.WriteLine(" ");
+ ss.WriteLine(" ");
+ ss.WriteLine(" ");
+ ss.WriteLine(" ");
+
+ foreach(ConfigurationNode conf in solution.Configurations)
+ {
+ // Set the project.config to a non-debug configuration
+ if( conf.Options["DebugInformation"].ToString().ToLower() != "true" )
+ {
+ ss.WriteLine(" ", conf.Name);
+ }
+ ss.WriteLine();
+ ss.WriteLine(" ", conf.Name);
+ ss.WriteLine(" ", conf.Name);
+ ss.WriteLine(" ", conf.Options["DebugInformation"].ToString().ToLower());
+ ss.WriteLine(" ");
+ ss.WriteLine();
+ }
+
+ ss.WriteLine(" ");
+ ss.WriteLine(" ");
+ ss.WriteLine(" ");
+ ss.WriteLine();
+
+ ss.WriteLine(" ");
+ ss.WriteLine(" ");
+ ss.WriteLine(" ");
+ ss.WriteLine();
+
+ ss.WriteLine(" ");
+ ss.WriteLine(" ");
+ ss.WriteLine(" ");
+ ss.WriteLine();
+
+ ss.WriteLine(" ");
+ ss.WriteLine(" ");
+ ss.WriteLine(" ");
+ ss.WriteLine();
+
+ ss.WriteLine(" ");
+ ss.WriteLine(" ");
+ ss.WriteLine(" ");
+ ss.WriteLine(" ");
+ ss.WriteLine(" ");
+ ss.WriteLine(" ");
+ ss.WriteLine();
+
+ ss.WriteLine(" ");
+ ss.WriteLine(" ");
+ //ss.WriteLine(" ");
+ ss.WriteLine(" ");
+ ss.WriteLine(" ");
+ foreach(ProjectNode project in solution.Projects)
+ {
+ string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath);
+ ss.Write(" ");
+ }
+ ss.WriteLine(" ");
+ ss.WriteLine();
+
+ ss.WriteLine(" ");
+
+ foreach(ProjectNode project in solution.ProjectsTableOrder)
+ {
+ string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath);
+ ss.Write(" ");
+ }
+ ss.WriteLine(" ");
+ ss.WriteLine();
+
+ ss.WriteLine(" ");
+ ss.WriteLine();
+ ss.WriteLine(" ");
+ ss.WriteLine();
+ //ss.WriteLine(" ");
+ ss.WriteLine(" ");
+ ss.WriteLine();
+
+ ss.WriteLine(" ");
+ ss.WriteLine(" ");
+ foreach (ProjectNode project in solution.Projects)
+ {
+ string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath);
+ ss.Write(" ");
+ }
+ ss.WriteLine(" ");
+ ss.WriteLine();
+ ss.WriteLine("");
+ }
+
+ m_Kernel.CurrentWorkingDirectory.Pop();
+ }
+
+ private void CleanProject(ProjectNode project)
+ {
+ m_Kernel.Log.Write("...Cleaning project: {0}", project.Name);
+ string projectFile = Helper.MakeFilePath(project.FullPath, project.Name + (project.Type == ProjectType.Library ? ".dll" : ".exe"), "build");
+ Helper.DeleteIfExists(projectFile);
+ }
+
+ private void CleanSolution(SolutionNode solution)
+ {
+ m_Kernel.Log.Write("Cleaning NAnt build files for", solution.Name);
+
+ string slnFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "build");
+ Helper.DeleteIfExists(slnFile);
+
+ foreach(ProjectNode project in solution.Projects)
+ {
+ CleanProject(project);
+ }
+
+ m_Kernel.Log.Write("");
+ }
+
+ #endregion
+
+ #region ITarget Members
+
+ ///
+ /// Writes the specified kern.
+ ///
+ /// The kern.
+ public void Write(Kernel kern)
+ {
+ if( kern == null )
+ {
+ throw new ArgumentNullException("kern");
+ }
+ m_Kernel = kern;
+ foreach(SolutionNode solution in kern.Solutions)
+ {
+ WriteCombine(solution);
+ }
+ m_Kernel = null;
+ }
+
+ ///
+ /// Cleans the specified kern.
+ ///
+ /// The kern.
+ public virtual void Clean(Kernel kern)
+ {
+ if( kern == null )
+ {
+ throw new ArgumentNullException("kern");
+ }
+ m_Kernel = kern;
+ foreach(SolutionNode sol in kern.Solutions)
+ {
+ CleanSolution(sol);
+ }
+ m_Kernel = null;
+ }
+
+ ///
+ /// Gets the name.
+ ///
+ /// The name.
+ public string Name
+ {
+ get
+ {
+ return "nant";
+ }
+ }
+
+ #endregion
+ }
+}
diff --git a/Prebuild/src/Core/Targets/SharpDevelop2Target.cs b/Prebuild/src/Core/Targets/SharpDevelop2Target.cs
new file mode 100644
index 0000000..bc84b96
--- /dev/null
+++ b/Prebuild/src/Core/Targets/SharpDevelop2Target.cs
@@ -0,0 +1,90 @@
+#region BSD License
+/*
+Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com)
+
+Redistribution and use in source and binary forms, with or without modification, are permitted
+provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice, this list of conditions
+ and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
+ and the following disclaimer in the documentation and/or other materials provided with the
+ distribution.
+* The name of the author may not be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
+BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+#endregion
+
+#region CVS Information
+/*
+ * $Source$
+ * $Author: jendave $
+ * $Date: 2006-01-27 16:49:58 -0800 (Fri, 27 Jan 2006) $
+ * $Revision: 71 $
+ */
+#endregion
+
+using System;
+
+using Prebuild.Core.Attributes;
+
+namespace Prebuild.Core.Targets
+{
+ ///
+ ///
+ ///
+ [Target("sharpdev2")]
+ public class SharpDevelop2Target : VS2005Target
+ {
+ #region Private Methods
+ private void SetSharpDevelop2()
+ {
+ this.VersionName = "SharpDevelop2";
+ }
+ #endregion
+
+ #region Public Methods
+
+ ///
+ /// Writes the specified kern.
+ ///
+ /// The kern.
+ public override void Write(Kernel kern)
+ {
+ SetSharpDevelop2();
+ base.Write(kern);
+ }
+
+ ///
+ /// Cleans the specified kern.
+ ///
+ /// The kern.
+ public override void Clean(Kernel kern)
+ {
+ SetSharpDevelop2();
+ base.Clean(kern);
+ }
+
+ ///
+ /// Gets the name.
+ ///
+ /// The name.
+ public override string Name
+ {
+ get
+ {
+ return "sharpdev2";
+ }
+ }
+
+ #endregion
+ }
+}
diff --git a/Prebuild/src/Core/Targets/SharpDevelopTarget.cs b/Prebuild/src/Core/Targets/SharpDevelopTarget.cs
new file mode 100644
index 0000000..c725730
--- /dev/null
+++ b/Prebuild/src/Core/Targets/SharpDevelopTarget.cs
@@ -0,0 +1,437 @@
+#region BSD License
+/*
+Copyright (c) 2004 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com)
+
+Redistribution and use in source and binary forms, with or without modification, are permitted
+provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice, this list of conditions
+ and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
+ and the following disclaimer in the documentation and/or other materials provided with the
+ distribution.
+* The name of the author may not be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
+BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+#endregion
+
+#region CVS Information
+/*
+ * $Source$
+ * $Author: jendave $
+ * $Date: 2007-02-13 21:58:03 +0100 (ti, 13 feb 2007) $
+ * $Revision: 205 $
+ */
+#endregion
+
+using System;
+using System.Collections;
+using System.Collections.Specialized;
+using System.IO;
+using System.Text.RegularExpressions;
+using System.Reflection;
+
+using Prebuild.Core.Attributes;
+using Prebuild.Core.Interfaces;
+using Prebuild.Core.Nodes;
+using Prebuild.Core.Utilities;
+
+namespace Prebuild.Core.Targets
+{
+ ///
+ ///
+ ///
+ [Target("sharpdev")]
+ public class SharpDevelopTarget : ITarget
+ {
+ #region Fields
+
+ private Kernel m_Kernel;
+
+ #endregion
+
+ #region Private Methods
+
+ private static string PrependPath(string path)
+ {
+ string tmpPath = Helper.NormalizePath(path, '/');
+ Regex regex = new Regex(@"(\w):/(\w+)");
+ Match match = regex.Match(tmpPath);
+ if(match.Success || tmpPath[0] == '.' || tmpPath[0] == '/')
+ {
+ tmpPath = Helper.NormalizePath(tmpPath);
+ }
+ else
+ {
+ tmpPath = Helper.NormalizePath("./" + tmpPath);
+ }
+
+ return tmpPath;
+ }
+
+ private static string BuildReference(SolutionNode solution, ReferenceNode refr)
+ {
+ string ret = "";
+ }
+ else
+ {
+ ProjectNode project = (ProjectNode)refr.Parent;
+ string fileRef = FindFileReference(refr.Name, project);
+
+ if(refr.Path != null || fileRef != null)
+ {
+ ret += "Assembly\" refto=\"";
+
+ string finalPath = (refr.Path != null) ? Helper.MakeFilePath(refr.Path, refr.Name, "dll") : fileRef;
+
+ ret += finalPath;
+ ret += "\" localcopy=\"" + refr.LocalCopy.ToString() + "\" />";
+ return ret;
+ }
+
+ 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() + "\" />";
+ }
+
+ return ret;
+ }
+
+ 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;
+ }
+ }
+
+ return null;
+ }
+
+ ///
+ /// Gets the XML doc file.
+ ///
+ /// The project.
+ /// The conf.
+ ///
+ 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";
+ }
+
+ string projFile = Helper.MakeFilePath(project.FullPath, project.Name, "prjx");
+ StreamWriter ss = new StreamWriter(projFile);
+
+ m_Kernel.CurrentWorkingDirectory.Push();
+ Helper.SetCurrentDir(Path.GetDirectoryName(projFile));
+
+ using(ss)
+ {
+ ss.WriteLine(
+ "",
+ project.Name,
+ project.RootNamespace
+ );
+
+ ss.WriteLine(" ");
+ 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.EmbeddedResource:
+ buildAction = "EmbedAsResource";
+ 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(" ", filePath, buildAction);
+ }
+ ss.WriteLine(" ");
+
+ ss.WriteLine(" ");
+ foreach(ReferenceNode refr in project.References)
+ {
+ ss.WriteLine(" {0}", BuildReference(solution, refr));
+ }
+ ss.WriteLine(" ");
+
+ ss.Write(" ");
+
+ int count = 0;
+
+ ss.WriteLine(" ", solution.ActiveConfig);
+
+ foreach(ConfigurationNode conf in project.Configurations)
+ {
+ ss.Write(" ");
+ ss.Write(" ");
+
+ ss.Write(" ");
+
+ ss.Write(" ");
+ ss.WriteLine(" ");
+
+ count++;
+ }
+ ss.WriteLine(" ");
+ ss.WriteLine("");
+ }
+
+ m_Kernel.CurrentWorkingDirectory.Pop();
+ }
+
+ 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.Log.Write("");
+ string combFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "cmbx");
+ StreamWriter ss = new StreamWriter(combFile);
+
+ m_Kernel.CurrentWorkingDirectory.Push();
+ Helper.SetCurrentDir(Path.GetDirectoryName(combFile));
+
+ using(ss)
+ {
+ ss.WriteLine("", solution.Name);
+
+ int count = 0;
+ foreach(ProjectNode project in solution.Projects)
+ {
+ if(count == 0)
+ ss.WriteLine(" ", project.Name);
+
+ ss.WriteLine(" ", project.Name);
+ count++;
+ }
+ ss.WriteLine(" ");
+
+ ss.WriteLine(" ");
+ foreach(ProjectNode project in solution.Projects)
+ {
+ string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath);
+ ss.WriteLine(" ",
+ Helper.MakeFilePath(path, project.Name, "prjx"));
+ }
+ ss.WriteLine(" ");
+
+ count = 0;
+ foreach(ConfigurationNode conf in solution.Configurations)
+ {
+ if(count == 0)
+ {
+ ss.WriteLine(" ", conf.Name);
+ }
+
+ ss.WriteLine(" ", conf.Name);
+ foreach(ProjectNode project in solution.Projects)
+ {
+ ss.WriteLine(" ", project.Name, conf.Name);
+ }
+ ss.WriteLine(" ");
+
+ count++;
+ }
+ ss.WriteLine(" ");
+ ss.WriteLine("");
+ }
+
+ m_Kernel.CurrentWorkingDirectory.Pop();
+ }
+
+ private void CleanProject(ProjectNode project)
+ {
+ m_Kernel.Log.Write("...Cleaning project: {0}", project.Name);
+ string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, "prjx");
+ Helper.DeleteIfExists(projectFile);
+ }
+
+ private void CleanSolution(SolutionNode solution)
+ {
+ m_Kernel.Log.Write("Cleaning SharpDevelop combine and project files for", solution.Name);
+
+ string slnFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "cmbx");
+ Helper.DeleteIfExists(slnFile);
+
+ foreach(ProjectNode project in solution.Projects)
+ {
+ CleanProject(project);
+ }
+
+ m_Kernel.Log.Write("");
+ }
+
+ #endregion
+
+ #region ITarget Members
+
+ ///
+ /// Writes the specified kern.
+ ///
+ /// The kern.
+ public void Write(Kernel kern)
+ {
+ if( kern == null )
+ {
+ throw new ArgumentNullException("kern");
+ }
+ m_Kernel = kern;
+ foreach(SolutionNode solution in kern.Solutions)
+ {
+ WriteCombine(solution);
+ }
+ m_Kernel = null;
+ }
+
+ ///
+ /// Cleans the specified kern.
+ ///
+ /// The kern.
+ public virtual void Clean(Kernel kern)
+ {
+ if( kern == null )
+ {
+ throw new ArgumentNullException("kern");
+ }
+ m_Kernel = kern;
+ foreach(SolutionNode sol in kern.Solutions)
+ {
+ CleanSolution(sol);
+ }
+ m_Kernel = null;
+ }
+
+ ///
+ /// Gets the name.
+ ///
+ /// The name.
+ public string Name
+ {
+ get
+ {
+ return "sharpdev";
+ }
+ }
+
+ #endregion
+ }
+}
diff --git a/Prebuild/src/Core/Targets/VS2002Target.cs b/Prebuild/src/Core/Targets/VS2002Target.cs
new file mode 100644
index 0000000..66216dc
--- /dev/null
+++ b/Prebuild/src/Core/Targets/VS2002Target.cs
@@ -0,0 +1,96 @@
+#region BSD License
+/*
+Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com)
+
+Redistribution and use in source and binary forms, with or without modification, are permitted
+provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice, this list of conditions
+ and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
+ and the following disclaimer in the documentation and/or other materials provided with the
+ distribution.
+* The name of the author may not be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
+BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+#endregion
+
+#region CVS Information
+/*
+ * $Source$
+ * $Author: jendave $
+ * $Date: 2006-01-28 01:49:58 +0100 (lö, 28 jan 2006) $
+ * $Revision: 71 $
+ */
+#endregion
+
+using System;
+
+using Prebuild.Core.Attributes;
+
+namespace Prebuild.Core.Targets
+{
+ ///
+ ///
+ ///
+ [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;
+ }
+
+ #endregion
+
+ #region Public Methods
+
+ ///
+ /// Writes the specified kern.
+ ///
+ /// The kern.
+ public override void Write(Kernel kern)
+ {
+ SetVS2002();
+ base.Write(kern);
+ }
+
+ ///
+ /// Cleans the specified kern.
+ ///
+ /// The kern.
+ public override void Clean(Kernel kern)
+ {
+ SetVS2002();
+ base.Clean(kern);
+ }
+
+ ///
+ /// Gets the name.
+ ///
+ /// The name.
+ public override string Name
+ {
+ get
+ {
+ return "vs2002";
+ }
+ }
+
+ #endregion
+ }
+}
diff --git a/Prebuild/src/Core/Targets/VS2003Target.cs b/Prebuild/src/Core/Targets/VS2003Target.cs
new file mode 100644
index 0000000..b3236a8
--- /dev/null
+++ b/Prebuild/src/Core/Targets/VS2003Target.cs
@@ -0,0 +1,633 @@
+#region BSD License
+/*
+Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com)
+
+Redistribution and use in source and binary forms, with or without modification, are permitted
+provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice, this list of conditions
+ and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
+ and the following disclaimer in the documentation and/or other materials provided with the
+ distribution.
+* The name of the author may not be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
+BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+#endregion
+
+#region CVS Information
+/*
+ * $Source$
+ * $Author: jendave $
+ * $Date: 2006-09-29 21:11:40 +0200 (fr, 29 sep 2006) $
+ * $Revision: 177 $
+ */
+#endregion
+
+using System;
+using System.Collections;
+using System.Collections.Specialized;
+using System.IO;
+
+using Prebuild.Core.Attributes;
+using Prebuild.Core.Interfaces;
+using Prebuild.Core.Nodes;
+using Prebuild.Core.Utilities;
+
+namespace Prebuild.Core.Targets
+{
+ ///
+ ///
+ ///
+ public enum VSVersion
+ {
+ ///
+ ///
+ ///
+ VS70,
+ ///
+ ///
+ ///
+ VS71,
+ ///
+ ///
+ ///
+ VS80
+ }
+
+ ///
+ ///
+ ///
+ [Target("vs2003")]
+ public class VS2003Target : ITarget
+ {
+
+ #region Fields
+
+ string solutionVersion = "8.00";
+ string productVersion = "7.10.3077";
+ string schemaVersion = "2.0";
+ string versionName = "2003";
+ VSVersion version = VSVersion.VS71;
+
+ Hashtable m_Tools;
+ Kernel m_Kernel;
+
+ ///
+ /// Gets or sets the solution version.
+ ///
+ /// The solution version.
+ protected string SolutionVersion
+ {
+ get
+ {
+ return this.solutionVersion;
+ }
+ set
+ {
+ this.solutionVersion = value;
+ }
+ }
+ ///
+ /// Gets or sets the product version.
+ ///
+ /// The product version.
+ protected string ProductVersion
+ {
+ get
+ {
+ return this.productVersion;
+ }
+ set
+ {
+ this.productVersion = value;
+ }
+ }
+ ///
+ /// Gets or sets the schema version.
+ ///
+ /// The schema version.
+ protected string SchemaVersion
+ {
+ get
+ {
+ return this.schemaVersion;
+ }
+ set
+ {
+ this.schemaVersion = value;
+ }
+ }
+ ///
+ /// Gets or sets the name of the version.
+ ///
+ /// The name of the version.
+ protected string VersionName
+ {
+ get
+ {
+ return this.versionName;
+ }
+ set
+ {
+ this.versionName = value;
+ }
+ }
+ ///
+ /// Gets or sets the version.
+ ///
+ /// The version.
+ protected VSVersion Version
+ {
+ get
+ {
+ return this.version;
+ }
+ set
+ {
+ this.version = value;
+ }
+ }
+
+ #endregion
+
+ #region Constructors
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ public VS2003Target()
+ {
+ m_Tools = new Hashtable();
+
+ m_Tools["C#"] = new ToolInfo("C#", "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}", "csproj", "CSHARP");
+ m_Tools["VB.NET"] = new ToolInfo("VB.NET", "{F184B08F-C81C-45F6-A57F-5ABD9991F28F}", "vbproj", "VisualBasic");
+ }
+
+ #endregion
+
+ #region Private Methods
+
+ private string MakeRefPath(ProjectNode project)
+ {
+ string ret = "";
+ foreach(ReferencePathNode node in project.ReferencePaths)
+ {
+ try
+ {
+ string fullPath = Helper.ResolvePath(node.Path);
+ if(ret.Length < 1)
+ {
+ ret = fullPath;
+ }
+ else
+ {
+ ret += ";" + fullPath;
+ }
+ }
+ catch(ArgumentException)
+ {
+ m_Kernel.Log.Write(LogType.Warning, "Could not resolve reference path: {0}", node.Path);
+ }
+ }
+
+ return ret;
+ }
+
+ private void WriteProject(SolutionNode solution, ProjectNode project)
+ {
+ if(!m_Tools.ContainsKey(project.Language))
+ {
+ throw new UnknownLanguageException("Unknown .NET language: " + project.Language);
+ }
+
+ ToolInfo toolInfo = (ToolInfo)m_Tools[project.Language];
+ string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, toolInfo.FileExtension);
+ StreamWriter ps = new StreamWriter(projectFile);
+
+ m_Kernel.CurrentWorkingDirectory.Push();
+ Helper.SetCurrentDir(Path.GetDirectoryName(projectFile));
+
+ IEnumerator enumerator;
+ //ConfigurationNode scripts;
+
+ using(ps)
+ {
+ ps.WriteLine("");
+ ps.WriteLine(" <{0}", toolInfo.XmlTag);
+ ps.WriteLine("\t\t\t\tProjectType = \"Local\"");
+ ps.WriteLine("\t\t\t\tProductVersion = \"{0}\"", this.ProductVersion);
+ ps.WriteLine("\t\t\t\tSchemaVersion = \"{0}\"", this.SchemaVersion);
+ ps.WriteLine("\t\t\t\tProjectGuid = \"{{{0}}}\"", project.Guid.ToString().ToUpper());
+ ps.WriteLine("\t\t>");
+
+ ps.WriteLine("\t\t\t\t");
+ ps.WriteLine(" ");
+
+ foreach(ConfigurationNode conf in project.Configurations)
+ {
+ ps.WriteLine("\t\t\t\t ");
+ }
+
+ ps.WriteLine(" ");
+
+ ps.WriteLine(" ");
+ foreach(ReferenceNode refr in project.References)
+ {
+ ps.WriteLine(" ");
+ }
+ ps.WriteLine(" ");
+
+ ps.WriteLine(" ");
+ ps.WriteLine(" ");
+
+ ps.WriteLine(" ");
+
+ foreach(string file in project.Files)
+ {
+ string fileName = file.Replace(".\\", "");
+ ps.WriteLine(" ");
+
+ if (project.Files.GetSubType(file) != SubType.Code && project.Files.GetSubType(file) != SubType.Settings)
+ {
+ ps.WriteLine(" ");
+
+ }
+ }
+ ps.WriteLine(" ");
+
+ ps.WriteLine(" ");
+ ps.WriteLine(" {0}>", toolInfo.XmlTag);
+ ps.WriteLine("");
+ }
+
+ ps = new StreamWriter(projectFile + ".user");
+ using(ps)
+ {
+ ps.WriteLine("");
+ ps.WriteLine(" <{0}>", toolInfo.XmlTag);
+ ps.WriteLine(" ");
+
+ ps.WriteLine(" ", MakeRefPath(project));
+ foreach(ConfigurationNode conf in project.Configurations)
+ {
+ ps.WriteLine(" ");
+ }
+ ps.WriteLine(" ");
+
+ ps.WriteLine(" ");
+ ps.WriteLine(" {0}>", toolInfo.XmlTag);
+ ps.WriteLine("");
+ }
+
+ m_Kernel.CurrentWorkingDirectory.Pop();
+ }
+
+ ///
+ /// Gets the XML doc file.
+ ///
+ /// The project.
+ /// The conf.
+ ///
+ public static string GetXmlDocFile(ProjectNode project, ConfigurationNode conf)
+ {
+ if( conf == null )
+ {
+ throw new ArgumentNullException("conf");
+ }
+ if( project == null )
+ {
+ throw new ArgumentNullException("project");
+ }
+ // if(!(bool)conf.Options["GenerateXmlDocFile"]) //default to none, if the generate option is false
+ // {
+ // return string.Empty;
+ // }
+
+ //default to "AssemblyName.xml"
+ //string defaultValue = Path.GetFileNameWithoutExtension(project.AssemblyName) + ".xml";
+ //return (string)conf.Options["XmlDocFile", defaultValue];
+
+ //default to no XmlDocFile file
+ return (string)conf.Options["XmlDocFile", ""];
+ }
+
+ private void WriteSolution(SolutionNode solution)
+ {
+ m_Kernel.Log.Write("Creating Visual Studio {0} solution and project files", this.VersionName);
+
+ 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 solutionFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "sln");
+ StreamWriter ss = new StreamWriter(solutionFile);
+
+ m_Kernel.CurrentWorkingDirectory.Push();
+ Helper.SetCurrentDir(Path.GetDirectoryName(solutionFile));
+
+ using(ss)
+ {
+ ss.WriteLine("Microsoft Visual Studio Solution File, Format Version {0}", this.SolutionVersion);
+ foreach(ProjectNode project in solution.Projects)
+ {
+ if(!m_Tools.ContainsKey(project.Language))
+ {
+ throw new UnknownLanguageException("Unknown .NET language: " + project.Language);
+ }
+
+ ToolInfo toolInfo = (ToolInfo)m_Tools[project.Language];
+
+ string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath);
+ ss.WriteLine("Project(\"{0}\") = \"{1}\", \"{2}\", \"{{{3}}}\"",
+ toolInfo.Guid, project.Name, Helper.MakeFilePath(path, project.Name,
+ toolInfo.FileExtension), project.Guid.ToString().ToUpper());
+
+ ss.WriteLine("\tProjectSection(ProjectDependencies) = postProject");
+ ss.WriteLine("\tEndProjectSection");
+
+ ss.WriteLine("EndProject");
+ }
+
+ ss.WriteLine("Global");
+
+ ss.WriteLine("\tGlobalSection(SolutionConfiguration) = preSolution");
+ foreach(ConfigurationNode conf in solution.Configurations)
+ {
+ ss.WriteLine("\t\t{0} = {0}", conf.Name);
+ }
+ ss.WriteLine("\tEndGlobalSection");
+
+ ss.WriteLine("\tGlobalSection(ProjectDependencies) = postSolution");
+ foreach(ProjectNode project in solution.Projects)
+ {
+ for(int i = 0; i < project.References.Count; i++)
+ {
+ ReferenceNode refr = (ReferenceNode)project.References[i];
+ if(solution.ProjectsTable.ContainsKey(refr.Name))
+ {
+ ProjectNode refProject = (ProjectNode)solution.ProjectsTable[refr.Name];
+ ss.WriteLine("\t\t({{{0}}}).{1} = ({{{2}}})",
+ project.Guid.ToString().ToUpper()
+ , i,
+ refProject.Guid.ToString().ToUpper()
+ );
+ }
+ }
+ }
+ ss.WriteLine("\tEndGlobalSection");
+
+ ss.WriteLine("\tGlobalSection(ProjectConfiguration) = postSolution");
+ foreach(ProjectNode project in solution.Projects)
+ {
+ foreach(ConfigurationNode conf in solution.Configurations)
+ {
+ ss.WriteLine("\t\t{{{0}}}.{1}.ActiveCfg = {1}|.NET",
+ project.Guid.ToString().ToUpper(),
+ conf.Name);
+
+ ss.WriteLine("\t\t{{{0}}}.{1}.Build.0 = {1}|.NET",
+ project.Guid.ToString().ToUpper(),
+ conf.Name);
+ }
+ }
+ ss.WriteLine("\tEndGlobalSection");
+
+ if(solution.Files != null)
+ {
+ ss.WriteLine("\tGlobalSection(SolutionItems) = postSolution");
+ foreach(string file in solution.Files)
+ {
+ ss.WriteLine("\t\t{0} = {0}", file);
+ }
+ ss.WriteLine("\tEndGlobalSection");
+ }
+
+ ss.WriteLine("\tGlobalSection(ExtensibilityGlobals) = postSolution");
+ ss.WriteLine("\tEndGlobalSection");
+ ss.WriteLine("\tGlobalSection(ExtensibilityAddIns) = postSolution");
+ ss.WriteLine("\tEndGlobalSection");
+
+ ss.WriteLine("EndGlobal");
+ }
+
+ m_Kernel.CurrentWorkingDirectory.Pop();
+ }
+
+ private void CleanProject(ProjectNode project)
+ {
+ m_Kernel.Log.Write("...Cleaning project: {0}", project.Name);
+
+ ToolInfo toolInfo = (ToolInfo)m_Tools[project.Language];
+ string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, toolInfo.FileExtension);
+ string userFile = projectFile + ".user";
+
+ Helper.DeleteIfExists(projectFile);
+ Helper.DeleteIfExists(userFile);
+ }
+
+ private void CleanSolution(SolutionNode solution)
+ {
+ m_Kernel.Log.Write("Cleaning Visual Studio {0} solution and project files", this.VersionName, solution.Name);
+
+ string slnFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "sln");
+ string suoFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "suo");
+
+ Helper.DeleteIfExists(slnFile);
+ Helper.DeleteIfExists(suoFile);
+
+ foreach(ProjectNode project in solution.Projects)
+ {
+ CleanProject(project);
+ }
+
+ m_Kernel.Log.Write("");
+ }
+
+ #endregion
+
+ #region ITarget Members
+
+ ///
+ /// Writes the specified kern.
+ ///
+ /// The kern.
+ public virtual void Write(Kernel kern)
+ {
+ if( kern == null )
+ {
+ throw new ArgumentNullException("kern");
+ }
+ m_Kernel = kern;
+ foreach(SolutionNode sol in m_Kernel.Solutions)
+ {
+ WriteSolution(sol);
+ }
+ m_Kernel = null;
+ }
+
+ ///
+ /// Cleans the specified kern.
+ ///
+ /// The kern.
+ public virtual void Clean(Kernel kern)
+ {
+ if( kern == null )
+ {
+ throw new ArgumentNullException("kern");
+ }
+ m_Kernel = kern;
+ foreach(SolutionNode sol in m_Kernel.Solutions)
+ {
+ CleanSolution(sol);
+ }
+ m_Kernel = null;
+ }
+
+ ///
+ /// Gets the name.
+ ///
+ /// The name.
+ public virtual string Name
+ {
+ get
+ {
+ return "vs2003";
+ }
+ }
+
+ #endregion
+ }
+}
diff --git a/Prebuild/src/Core/Targets/VS2005Target.cs b/Prebuild/src/Core/Targets/VS2005Target.cs
new file mode 100644
index 0000000..23b6116
--- /dev/null
+++ b/Prebuild/src/Core/Targets/VS2005Target.cs
@@ -0,0 +1,883 @@
+#region BSD License
+/*
+Copyright (c) 2004 Matthew Holmes (matthew@wildfiregames.com)
+
+Redistribution and use in source and binary forms, with or without modification, are permitted
+provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice, this list of conditions
+ and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
+ and the following disclaimer in the documentation and/or other materials provided with the
+ distribution.
+* The name of the author may not be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
+BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+#endregion
+
+#region CVS Information
+/*
+ * $Source$
+ * $Author: robloach $
+ * $Date: 2007-02-27 19:52:34 +0100 (ti, 27 feb 2007) $
+ * $Revision: 207 $
+ */
+#endregion
+
+using System;
+using System.Collections;
+using System.Collections.Specialized;
+using System.IO;
+
+using Prebuild.Core.Attributes;
+using Prebuild.Core.Interfaces;
+using Prebuild.Core.Nodes;
+using Prebuild.Core.Utilities;
+
+namespace Prebuild.Core.Targets
+{
+ ///
+ ///
+ ///
+ public struct ToolInfo
+ {
+ string name;
+ string guid;
+ string fileExtension;
+ string xmlTag;
+ string importProject;
+
+ ///
+ /// Gets or sets the name.
+ ///
+ /// The name.
+ public string Name
+ {
+ get
+ {
+ return name;
+ }
+ set
+ {
+ name = value;
+ }
+ }
+
+ ///
+ /// Gets or sets the GUID.
+ ///
+ /// The GUID.
+ public string Guid
+ {
+ get
+ {
+ return guid;
+ }
+ set
+ {
+ guid = value;
+ }
+ }
+
+ ///
+ /// Gets or sets the file extension.
+ ///
+ /// The file extension.
+ public string FileExtension
+ {
+ get
+ {
+ return fileExtension;
+ }
+ set
+ {
+ fileExtension = value;
+ }
+ }
+ ///
+ /// Gets or sets the XML tag.
+ ///
+ /// The XML tag.
+ public string XmlTag
+ {
+ get
+ {
+ return xmlTag;
+ }
+ set
+ {
+ xmlTag = value;
+ }
+ }
+
+ ///
+ /// Gets or sets the import project property.
+ ///
+ /// The ImportProject tag.
+ public string ImportProject
+ {
+ get
+ {
+ return importProject;
+ }
+ set
+ {
+ importProject = value;
+ }
+ }
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The name.
+ /// The GUID.
+ /// The file extension.
+ /// The XML.
+ /// The import project.
+ 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;
+ }
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The name.
+ /// The GUID.
+ /// The file extension.
+ /// The XML.
+ 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";
+ }
+
+ ///
+ /// Equals operator
+ ///
+ /// ToolInfo to compare
+ /// true if toolInfos are equal
+ 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));
+ }
+
+ ///
+ /// Equals operator
+ ///
+ /// ToolInfo to compare
+ /// ToolInfo to compare
+ /// True if toolInfos are equal
+ 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));
+ }
+
+ ///
+ /// Not equals operator
+ ///
+ /// ToolInfo to compare
+ /// ToolInfo to compare
+ /// True if toolInfos are not equal
+ public static bool operator !=(ToolInfo c1, ToolInfo c2)
+ {
+ return !(c1 == c2);
+ }
+
+ ///
+ /// Hash Code
+ ///
+ /// Hash code
+ public override int GetHashCode()
+ {
+ return name.GetHashCode() ^ guid.GetHashCode() ^ this.fileExtension.GetHashCode() ^ this.importProject.GetHashCode() ^ this.xmlTag.GetHashCode();
+
+ }
+ }
+
+ ///
+ ///
+ ///
+ [Target("vs2005")]
+ public class VS2005Target : ITarget
+ {
+ #region Inner Classes
+
+ #endregion
+
+ #region Fields
+
+ string solutionVersion = "9.00";
+ string productVersion = "8.0.50727";
+ string schemaVersion = "2.0";
+ string versionName = "Visual C# 2005";
+ VSVersion version = VSVersion.VS80;
+
+ Hashtable tools;
+ Kernel kernel;
+
+ ///
+ /// Gets or sets the solution version.
+ ///
+ /// The solution version.
+ protected string SolutionVersion
+ {
+ get
+ {
+ return this.solutionVersion;
+ }
+ set
+ {
+ this.solutionVersion = value;
+ }
+ }
+ ///
+ /// Gets or sets the product version.
+ ///
+ /// The product version.
+ protected string ProductVersion
+ {
+ get
+ {
+ return this.productVersion;
+ }
+ set
+ {
+ this.productVersion = value;
+ }
+ }
+ ///
+ /// Gets or sets the schema version.
+ ///
+ /// The schema version.
+ protected string SchemaVersion
+ {
+ get
+ {
+ return this.schemaVersion;
+ }
+ set
+ {
+ this.schemaVersion = value;
+ }
+ }
+ ///
+ /// Gets or sets the name of the version.
+ ///
+ /// The name of the version.
+ protected string VersionName
+ {
+ get
+ {
+ return this.versionName;
+ }
+ set
+ {
+ this.versionName = value;
+ }
+ }
+ ///
+ /// Gets or sets the version.
+ ///
+ /// The version.
+ protected VSVersion Version
+ {
+ get
+ {
+ return this.version;
+ }
+ set
+ {
+ this.version = value;
+ }
+ }
+
+ #endregion
+
+ #region Constructors
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ public VS2005Target()
+ {
+ this.tools = new Hashtable();
+
+ this.tools["C#"] = new ToolInfo("C#", "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}", "csproj", "CSHARP", "$(MSBuildBinPath)\\Microsoft.CSHARP.Targets");
+ this.tools["Boo"] = new ToolInfo("Boo", "{45CEA7DC-C2ED-48A6-ACE0-E16144C02365}", "booproj", "Boo", "$(BooBinPath)\\Boo.Microsoft.Build.targets");
+ this.tools["VisualBasic"] = new ToolInfo("VisualBasic", "{F184B08F-C81C-45F6-A57F-5ABD9991F28F}", "vbproj", "VisualBasic", "$(MSBuildBinPath)\\Microsoft.VisualBasic.Targets");
+ }
+
+ #endregion
+
+ #region Private Methods
+
+ private string MakeRefPath(ProjectNode project)
+ {
+ string ret = "";
+ foreach (ReferencePathNode node in project.ReferencePaths)
+ {
+ try
+ {
+ string fullPath = Helper.ResolvePath(node.Path);
+ if (ret.Length < 1)
+ {
+ ret = fullPath;
+ }
+ else
+ {
+ ret += ";" + fullPath;
+ }
+ }
+ catch (ArgumentException)
+ {
+ this.kernel.Log.Write(LogType.Warning, "Could not resolve reference path: {0}", node.Path);
+ }
+ }
+
+ return ret;
+ }
+
+ private void WriteProject(SolutionNode solution, ProjectNode project)
+ {
+ if (!tools.ContainsKey(project.Language))
+ {
+ throw new UnknownLanguageException("Unknown .NET language: " + project.Language);
+ }
+
+ ToolInfo toolInfo = (ToolInfo)tools[project.Language];
+ string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, toolInfo.FileExtension);
+ StreamWriter ps = new StreamWriter(projectFile);
+
+ kernel.CurrentWorkingDirectory.Push();
+ Helper.SetCurrentDir(Path.GetDirectoryName(projectFile));
+
+ #region Project File
+ using (ps)
+ {
+ ps.WriteLine("");
+ //ps.WriteLine(" <{0}", toolInfo.XMLTag);
+ ps.WriteLine(" ");
+ ps.WriteLine(" Local");
+ ps.WriteLine(" {0}", this.ProductVersion);
+ ps.WriteLine(" {0}", this.SchemaVersion);
+ ps.WriteLine(" {{{0}}}", project.Guid.ToString().ToUpper());
+
+ ps.WriteLine(" Debug");
+ ps.WriteLine(" AnyCPU");
+ //ps.WriteLine(" ");
+
+ //ps.WriteLine(" {0}", project.AppIcon);
+ ps.WriteLine(" ");
+ ps.WriteLine(" ");
+ ps.WriteLine(" {0}", project.AssemblyName);
+ foreach (ConfigurationNode conf in project.Configurations)
+ {
+ if (conf.Options.KeyFile != "")
+ {
+ ps.WriteLine(" {0}", conf.Options.KeyFile);
+ ps.WriteLine(" true");
+ break;
+ }
+ }
+ ps.WriteLine(" JScript");
+ ps.WriteLine(" Grid");
+ ps.WriteLine(" IE50");
+ ps.WriteLine(" false");
+
+ //if(m_Version == VSVersion.VS70)
+ // ps.WriteLine(" NoStandardLibraries = \"false\"");
+
+ ps.WriteLine(" {0}", project.Type.ToString());
+ ps.WriteLine(" {0}", project.DesignerFolder);
+ ps.WriteLine(" {0}", project.RootNamespace);
+ ps.WriteLine(" {0}", project.StartupObject);
+ //ps.WriteLine(" >");
+ ps.WriteLine(" ");
+ ps.WriteLine(" ");
+
+ ps.WriteLine(" ");
+
+ foreach (ConfigurationNode conf in project.Configurations)
+ {
+ ps.Write(" ", conf.Name);
+ ps.WriteLine(" {0}", conf.Options["AllowUnsafe"]);
+ ps.WriteLine(" {0}", conf.Options["BaseAddress"]);
+ ps.WriteLine(" {0}", conf.Options["CheckUnderflowOverflow"]);
+ ps.WriteLine(" ");
+ ps.WriteLine(" ");
+ ps.WriteLine(" {0}", conf.Options["CompilerDefines"]);
+ ps.WriteLine(" {0}", conf.Options["XmlDocFile"]);
+ ps.WriteLine(" {0}", conf.Options["DebugInformation"]);
+ ps.WriteLine(" {0}", conf.Options["FileAlignment"]);
+ // ps.WriteLine(" {0}", conf.Options["OptimizeCode"]);
+ ps.WriteLine(" {0}",
+ Helper.EndPath(Helper.NormalizePath(conf.Options["OutputPath"].ToString())));
+ ps.WriteLine(" {0}", conf.Options["RegisterComInterop"]);
+ ps.WriteLine(" {0}", conf.Options["RemoveIntegerChecks"]);
+ ps.WriteLine(" {0}", conf.Options["WarningsAsErrors"]);
+ ps.WriteLine(" {0}", conf.Options["WarningLevel"]);
+ ps.WriteLine(" {0}", conf.Options["SuppressWarnings"]);
+ ps.WriteLine(" ");
+ }
+
+ //ps.WriteLine(" ");
+
+ // Assembly References
+ ps.WriteLine(" ");
+ string refPath = ((ReferencePathNode) project.ReferencePaths[0]).Path;
+
+ foreach (ReferenceNode refr in project.References)
+ {
+ if (!solution.ProjectsTable.ContainsKey(refr.Name))
+ {
+ ps.Write(" ");
+
+ string path;
+
+ if( refr.Name.EndsWith(".dll", StringComparison.InvariantCultureIgnoreCase ))
+ {
+ path = Helper.NormalizePath(Path.Combine( refPath, refr.Name), '\\');
+ }
+ else
+ {
+ path = refr.Name + ".dll";
+ }
+
+ // TODO: Allow reference to *.exe files
+ ps.WriteLine(" {0}", path );
+ ps.WriteLine(" {0}", refr.LocalCopy);
+ ps.WriteLine(" ");
+ }
+ }
+ ps.WriteLine(" ");
+
+ //Project References
+ ps.WriteLine(" ");
+ foreach (ReferenceNode refr in project.References)
+ {
+ if (solution.ProjectsTable.ContainsKey(refr.Name))
+ {
+ ProjectNode refProject = (ProjectNode)solution.ProjectsTable[refr.Name];
+ // TODO: Allow reference to visual basic projects
+ string path =
+ Helper.MakePathRelativeTo(project.FullPath,
+ Helper.MakeFilePath(refProject.FullPath, refProject.Name, "csproj"));
+ ps.WriteLine(" ", path );
+ //
+ ps.WriteLine(" {0}", refProject.Name);
+ // RealmForge.Utility
+ ps.WriteLine(" {{{0}}}", refProject.Guid.ToString().ToUpper());
+ // {6880D1D3-69EE-461B-B841-5319845B20D3}
+ ps.WriteLine(" {0}", toolInfo.Guid.ToString().ToUpper());
+ // {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
+ ps.WriteLine("\t\t\t{0}", refr.LocalCopy);
+ ps.WriteLine(" ");
+ //
+ }
+ else
+ {
+ }
+ }
+ ps.WriteLine(" ");
+
+ // ps.WriteLine(" ");
+ ps.WriteLine(" ");
+
+ // ps.WriteLine(" ");
+ ArrayList list = new ArrayList();
+ foreach (string file in project.Files)
+ {
+ // if (file == "Properties\\Bind.Designer.cs")
+ // {
+ // Console.WriteLine("Wait a minute!");
+ // Console.WriteLine(project.Files.GetSubType(file).ToString());
+ // }
+
+ if (project.Files.GetSubType(file) != SubType.Code && project.Files.GetSubType(file) != SubType.Settings && project.Files.GetSubType(file) != SubType.Designer)
+ {
+ ps.WriteLine(" ", file.Substring(0, file.LastIndexOf('.')) + ".resx");
+
+ int slash = file.LastIndexOf('\\');
+ if (slash == -1)
+ {
+ ps.WriteLine(" {0}", file);
+ }
+ else
+ {
+ ps.WriteLine(" {0}", file.Substring(slash + 1, file.Length - slash - 1));
+ }
+ ps.WriteLine(" Designer");
+ ps.WriteLine(" ");
+ //
+ }
+
+ if (project.Files.GetSubType(file) != SubType.Code && project.Files.GetSubType(file) == SubType.Designer)
+ {
+ ps.WriteLine(" ", file.Substring(0, file.LastIndexOf('.')) + ".resx");
+ ps.WriteLine(" " + project.Files.GetSubType(file) + "");
+ ps.WriteLine(" ResXFileCodeGenerator");
+ ps.WriteLine(" Resources.Designer.cs");
+ ps.WriteLine(" ");
+ ps.WriteLine(" ", file.Substring(0, file.LastIndexOf('.')) + ".Designer.cs");
+ ps.WriteLine(" True");
+ ps.WriteLine(" True");
+ ps.WriteLine(" Resources.resx");
+ ps.WriteLine(" ");
+ list.Add(file.Substring(0, file.LastIndexOf('.')) + ".Designer.cs");
+ }
+ if (project.Files.GetSubType(file).ToString() == "Settings")
+ {
+ //Console.WriteLine("File: " + file);
+ //Console.WriteLine("Last index: " + file.LastIndexOf('.'));
+ //Console.WriteLine("Length: " + file.Length);
+ ps.Write(" <{0} ", project.Files.GetBuildAction(file));
+ ps.WriteLine("Include=\"{0}\">", file);
+ int slash = file.LastIndexOf('\\');
+ string fileName = file.Substring(slash + 1, file.Length - slash - 1);
+ if (project.Files.GetBuildAction(file) == BuildAction.None)
+ {
+ ps.WriteLine(" SettingsSingleFileGenerator");
+
+ //Console.WriteLine("FileName: " + fileName);
+ //Console.WriteLine("FileNameMain: " + fileName.Substring(0, fileName.LastIndexOf('.')));
+ //Console.WriteLine("FileNameExt: " + fileName.Substring(fileName.LastIndexOf('.'), fileName.Length - fileName.LastIndexOf('.')));
+ if (slash == -1)
+ {
+ ps.WriteLine(" {0}", fileName.Substring(0, fileName.LastIndexOf('.')) + ".Designer.cs");
+ }
+ else
+ {
+ ps.WriteLine(" {0}", fileName.Substring(0, fileName.LastIndexOf('.')) + ".Designer.cs");
+ }
+ }
+ else
+ {
+ ps.WriteLine(" Code");
+ ps.WriteLine(" True");
+ ps.WriteLine(" True");
+ string fileNameShort = fileName.Substring(0, fileName.LastIndexOf('.'));
+ string fileNameShorter = fileNameShort.Substring(0, fileNameShort.LastIndexOf('.'));
+ ps.WriteLine(" {0}", fileNameShorter + ".settings");
+ }
+ ps.WriteLine(" {0}>", project.Files.GetBuildAction(file));
+ }
+ else if (project.Files.GetSubType(file) != SubType.Designer)
+ {
+ if (!list.Contains(file))
+ {
+ ps.Write(" <{0} ", project.Files.GetBuildAction(file));
+ ps.WriteLine("Include=\"{0}\">", file);
+
+
+ if (file.Contains("Designer.cs"))
+ {
+ ps.WriteLine(" {0}", file.Substring(0, file.IndexOf(".Designer.cs")) + ".cs");
+ }
+
+ if (project.Files.GetIsLink(file))
+ {
+ ps.WriteLine(" {0}", Path.GetFileName(file));
+ }
+ else if (project.Files.GetBuildAction(file) != BuildAction.None)
+ {
+ if (project.Files.GetBuildAction(file) != BuildAction.EmbeddedResource)
+ {
+ ps.WriteLine(" {0}", project.Files.GetSubType(file));
+ }
+ }
+ if (project.Files.GetCopyToOutput(file) != CopyToOutput.Never)
+ {
+ ps.WriteLine(" {0}", project.Files.GetCopyToOutput(file));
+ }
+
+ ps.WriteLine(" {0}>", project.Files.GetBuildAction(file));
+ }
+ }
+ }
+ // ps.WriteLine(" ");
+
+ ps.WriteLine(" ");
+ ps.WriteLine(" ");
+ ps.WriteLine(" ");
+ ps.WriteLine(" ");
+ ps.WriteLine(" ");
+ ps.WriteLine(" ");
+ ps.WriteLine(" ");
+ ps.WriteLine(" ");
+ // ps.WriteLine(" {0}>", toolInfo.XMLTag);
+ ps.WriteLine("");
+ }
+ #endregion
+
+ #region User File
+
+ ps = new StreamWriter(projectFile + ".user");
+ using (ps)
+ {
+ ps.WriteLine("");
+ //ps.WriteLine( "" );
+ //ps.WriteLine(" <{0}>", toolInfo.XMLTag);
+ //ps.WriteLine(" ");
+ ps.WriteLine(" ");
+ //ps.WriteLine(" ", MakeRefPath(project));
+
+
+ ps.WriteLine(" Debug");
+ ps.WriteLine(" AnyCPU");
+
+ if (projectFile.Contains( "OpenSim.csproj" ))
+ {
+ ps.WriteLine(" -loginserver -sandbox -accounts");
+ }
+
+ ps.WriteLine(" {0}", MakeRefPath(project));
+ ps.WriteLine(" {0}", this.ProductVersion);
+ ps.WriteLine(" ProjectFiles");
+ ps.WriteLine(" 0");
+ ps.WriteLine(" ");
+ foreach (ConfigurationNode conf in project.Configurations)
+ {
+ ps.Write(" ");
+ }
+
+ ps.WriteLine("");
+ }
+ #endregion
+
+ kernel.CurrentWorkingDirectory.Pop();
+ }
+
+ private void WriteSolution(SolutionNode solution)
+ {
+ kernel.Log.Write("Creating {0} solution and project files", this.VersionName);
+
+ foreach (ProjectNode project in solution.Projects)
+ {
+ kernel.Log.Write("...Creating project: {0}", project.Name);
+ WriteProject(solution, project);
+ }
+
+ kernel.Log.Write("");
+ string solutionFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "sln");
+ StreamWriter ss = new StreamWriter(solutionFile);
+
+ kernel.CurrentWorkingDirectory.Push();
+ Helper.SetCurrentDir(Path.GetDirectoryName(solutionFile));
+
+ using (ss)
+ {
+ ss.WriteLine("Microsoft Visual Studio Solution File, Format Version {0}", this.SolutionVersion);
+ ss.WriteLine("# Visual Studio 2005");
+ foreach (ProjectNode project in solution.Projects)
+ {
+ if (!tools.ContainsKey(project.Language))
+ {
+ throw new UnknownLanguageException("Unknown .NET language: " + project.Language);
+ }
+
+ ToolInfo toolInfo = (ToolInfo)tools[project.Language];
+
+ string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath);
+ ss.WriteLine("Project(\"{0}\") = \"{1}\", \"{2}\", \"{{{3}}}\"",
+ toolInfo.Guid, project.Name, Helper.MakeFilePath(path, project.Name,
+ toolInfo.FileExtension), project.Guid.ToString().ToUpper());
+
+ //ss.WriteLine(" ProjectSection(ProjectDependencies) = postProject");
+ //ss.WriteLine(" EndProjectSection");
+
+ ss.WriteLine("EndProject");
+ }
+
+ if (solution.Files != null)
+ {
+ ss.WriteLine("Project(\"{0}\") = \"Solution Items\", \"Solution Items\", \"{1}\"", "{2150E333-8FDC-42A3-9474-1A3956D46DE8}", "{468F1D07-AD17-4CC3-ABD0-2CA268E4E1A6}");
+ ss.WriteLine("\tProjectSection(SolutionItems) = preProject");
+ foreach (string file in solution.Files)
+ ss.WriteLine("\t\t{0} = {0}", file);
+ ss.WriteLine("\tEndProjectSection");
+ ss.WriteLine("EndProject");
+ }
+
+ ss.WriteLine("Global");
+
+ ss.WriteLine(" GlobalSection(SolutionConfigurationPlatforms) = preSolution");
+ foreach (ConfigurationNode conf in solution.Configurations)
+ {
+ ss.WriteLine(" {0}|Any CPU = {0}|Any CPU", conf.Name);
+ }
+ ss.WriteLine(" EndGlobalSection");
+
+ if (solution.Projects.Count > 1)
+ {
+ ss.WriteLine(" GlobalSection(ProjectDependencies) = postSolution");
+ }
+ foreach (ProjectNode project in solution.Projects)
+ {
+ for (int i = 0; i < project.References.Count; i++)
+ {
+ ReferenceNode refr = (ReferenceNode)project.References[i];
+ if (solution.ProjectsTable.ContainsKey(refr.Name))
+ {
+ ProjectNode refProject = (ProjectNode)solution.ProjectsTable[refr.Name];
+ ss.WriteLine(" ({{{0}}}).{1} = ({{{2}}})",
+ project.Guid.ToString().ToUpper()
+ , i,
+ refProject.Guid.ToString().ToUpper()
+ );
+ }
+ }
+ }
+ if (solution.Projects.Count > 1)
+ {
+ ss.WriteLine(" EndGlobalSection");
+ }
+ ss.WriteLine(" GlobalSection(ProjectConfigurationPlatforms) = postSolution");
+ foreach (ProjectNode project in solution.Projects)
+ {
+ foreach (ConfigurationNode conf in solution.Configurations)
+ {
+ ss.WriteLine(" {{{0}}}.{1}|Any CPU.ActiveCfg = {1}|Any CPU",
+ project.Guid.ToString().ToUpper(),
+ conf.Name);
+
+ ss.WriteLine(" {{{0}}}.{1}|Any CPU.Build.0 = {1}|Any CPU",
+ project.Guid.ToString().ToUpper(),
+ conf.Name);
+ }
+ }
+ ss.WriteLine(" EndGlobalSection");
+ ss.WriteLine(" GlobalSection(SolutionProperties) = preSolution");
+ ss.WriteLine(" HideSolutionNode = FALSE");
+ ss.WriteLine(" EndGlobalSection");
+
+ ss.WriteLine("EndGlobal");
+ }
+
+ kernel.CurrentWorkingDirectory.Pop();
+ }
+
+ private void CleanProject(ProjectNode project)
+ {
+ kernel.Log.Write("...Cleaning project: {0}", project.Name);
+
+ ToolInfo toolInfo = (ToolInfo)tools[project.Language];
+ string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, toolInfo.FileExtension);
+ string userFile = projectFile + ".user";
+
+ Helper.DeleteIfExists(projectFile);
+ Helper.DeleteIfExists(userFile);
+ }
+
+ private void CleanSolution(SolutionNode solution)
+ {
+ kernel.Log.Write("Cleaning {0} solution and project files", this.VersionName, solution.Name);
+
+ string slnFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "sln");
+ string suoFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "suo");
+
+ Helper.DeleteIfExists(slnFile);
+ Helper.DeleteIfExists(suoFile);
+
+ foreach (ProjectNode project in solution.Projects)
+ {
+ CleanProject(project);
+ }
+
+ kernel.Log.Write("");
+ }
+
+ #endregion
+
+ #region ITarget Members
+
+ ///
+ /// Writes the specified kern.
+ ///
+ /// The kern.
+ public virtual void Write(Kernel kern)
+ {
+ if (kern == null)
+ {
+ throw new ArgumentNullException("kern");
+ }
+ kernel = kern;
+ foreach (SolutionNode sol in kernel.Solutions)
+ {
+ WriteSolution(sol);
+ }
+ kernel = null;
+ }
+
+ ///
+ /// Cleans the specified kern.
+ ///
+ /// The kern.
+ public virtual void Clean(Kernel kern)
+ {
+ if (kern == null)
+ {
+ throw new ArgumentNullException("kern");
+ }
+ kernel = kern;
+ foreach (SolutionNode sol in kernel.Solutions)
+ {
+ CleanSolution(sol);
+ }
+ kernel = null;
+ }
+
+ ///
+ /// Gets the name.
+ ///
+ /// The name.
+ public virtual string Name
+ {
+ get
+ {
+ return "vs2005";
+ }
+ }
+
+ #endregion
+ }
+}
diff --git a/Prebuild/src/Core/UnknownLanguageException.cs b/Prebuild/src/Core/UnknownLanguageException.cs
new file mode 100644
index 0000000..cbd1dc1
--- /dev/null
+++ b/Prebuild/src/Core/UnknownLanguageException.cs
@@ -0,0 +1,63 @@
+/*
+ * $RCSfile$
+ * Copyright (C) 2004, 2005 David Hudson (jendave@yahoo.com)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+using System;
+using System.Runtime.Serialization;
+
+namespace Prebuild.Core
+{
+ ///
+ ///
+ [Serializable()]
+ public class UnknownLanguageException : Exception
+ {
+ ///
+ /// Basic exception.
+ ///
+ public UnknownLanguageException()
+ {
+ }
+
+ ///
+ /// Exception with specified string
+ ///
+ /// Exception message
+ public UnknownLanguageException(string message): base(message)
+ {
+ }
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ public UnknownLanguageException(string message, Exception exception) : base(message, exception)
+ {
+ }
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ protected UnknownLanguageException(SerializationInfo info, StreamingContext context) : base( info, context )
+ {
+ }
+ }
+}
diff --git a/Prebuild/src/Core/Utilities/CommandLineCollection.cs b/Prebuild/src/Core/Utilities/CommandLineCollection.cs
new file mode 100644
index 0000000..496731f
--- /dev/null
+++ b/Prebuild/src/Core/Utilities/CommandLineCollection.cs
@@ -0,0 +1,162 @@
+#region BSD License
+/*
+Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com)
+
+Redistribution and use in source and binary forms, with or without modification, are permitted
+provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice, this list of conditions
+ and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
+ and the following disclaimer in the documentation and/or other materials provided with the
+ distribution.
+* The name of the author may not be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
+BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+#endregion
+
+#region CVS Information
+/*
+ * $Source$
+ * $Author: robloach $
+ * $Date: 2006-09-26 00:30:53 +0200 (ti, 26 sep 2006) $
+ * $Revision: 165 $
+ */
+#endregion
+
+using System;
+using System.Collections;
+using System.Collections.Specialized;
+using System.Diagnostics;
+
+namespace Prebuild.Core.Utilities
+{
+ ///
+ /// The CommandLine class parses and interprets the command-line arguments passed to
+ /// prebuild.
+ ///
+ public class CommandLineCollection
+ {
+ #region Fields
+
+ // The raw OS arguments
+ private string[] m_RawArgs;
+
+ // Command-line argument storage
+ private Hashtable m_Arguments;
+
+ #endregion
+
+ #region Constructors
+
+ ///
+ /// Create a new CommandLine instance and set some internal variables.
+ ///
+ public CommandLineCollection(string[] args)
+ {
+ m_RawArgs = args;
+ m_Arguments = new Hashtable();
+
+ Parse();
+ }
+
+ #endregion
+
+ #region Private Methods
+
+ private void Parse()
+ {
+ if(m_RawArgs.Length < 1)
+ return;
+
+ int idx = 0;
+ string arg = null, lastArg = null;
+
+ while(idx 2 && arg[0] == '/')
+ {
+ arg = arg.Substring(1);
+ lastArg = arg;
+ m_Arguments[arg] = "";
+ }
+ else
+ {
+ if(lastArg != null)
+ {
+ m_Arguments[lastArg] = arg;
+ lastArg = null;
+ }
+ }
+
+ idx++;
+ }
+ }
+
+ #endregion
+
+ #region Public Methods
+
+ ///
+ /// Wases the passed.
+ ///
+ /// The arg.
+ ///
+ public bool WasPassed(string arg)
+ {
+ return (m_Arguments.ContainsKey(arg));
+ }
+
+ #endregion
+
+ #region Properties
+
+ ///
+ /// Gets the parameter associated with the command line option
+ ///
+ /// Returns null if option was not specified,
+ /// null string if no parameter was specified, and the value if a parameter was specified
+ public string this[string index]
+ {
+ get
+ {
+ if(m_Arguments.ContainsKey(index))
+ {
+ return (string)(m_Arguments[index]);
+ }
+ else
+ {
+ return null;
+ }
+ }
+ }
+
+ #endregion
+
+ #region IEnumerable Members
+
+ ///
+ /// Returns an enumerator that can iterate through a collection.
+ ///
+ ///
+ /// An
+ /// that can be used to iterate through the collection.
+ ///
+ public IDictionaryEnumerator GetEnumerator()
+ {
+ return m_Arguments.GetEnumerator();
+ }
+
+ #endregion
+ }
+}
diff --git a/Prebuild/src/Core/Utilities/CurrentDirectory.cs b/Prebuild/src/Core/Utilities/CurrentDirectory.cs
new file mode 100644
index 0000000..a76d844
--- /dev/null
+++ b/Prebuild/src/Core/Utilities/CurrentDirectory.cs
@@ -0,0 +1,89 @@
+#region BSD License
+/*
+Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com)
+
+Redistribution and use in source and binary forms, with or without modification, are permitted
+provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice, this list of conditions
+ and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
+ and the following disclaimer in the documentation and/or other materials provided with the
+ distribution.
+* The name of the author may not be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
+BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+#endregion
+
+#region CVS Information
+/*
+ * $Source$
+ * $Author: jendave $
+ * $Date: 2006-01-28 01:49:58 +0100 (lö, 28 jan 2006) $
+ * $Revision: 71 $
+ */
+#endregion
+
+using System;
+using System.Collections;
+
+namespace Prebuild.Core.Utilities
+{
+ ///
+ ///
+ ///
+ public class CurrentDirectory
+ {
+ #region Fields
+
+ private Stack m_Stack;
+
+ #endregion
+
+ #region Constructors
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ public CurrentDirectory()
+ {
+ m_Stack = new Stack();
+ }
+
+ #endregion
+
+ #region Public Methods
+
+ ///
+ /// Pushes this instance.
+ ///
+ public void Push()
+ {
+ m_Stack.Push(Environment.CurrentDirectory);
+ }
+
+ ///
+ /// Pops this instance.
+ ///
+ public void Pop()
+ {
+ if(m_Stack.Count < 1)
+ {
+ return;
+ }
+
+ string cwd = (string)m_Stack.Pop();
+ Helper.SetCurrentDir(cwd);
+ }
+
+ #endregion
+ }
+}
diff --git a/Prebuild/src/Core/Utilities/Helper.cs b/Prebuild/src/Core/Utilities/Helper.cs
new file mode 100644
index 0000000..33c9618
--- /dev/null
+++ b/Prebuild/src/Core/Utilities/Helper.cs
@@ -0,0 +1,661 @@
+#region BSD License
+/*
+Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com)
+
+Redistribution and use in source and binary forms, with or without modification, are permitted
+provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice, this list of conditions
+ and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
+ and the following disclaimer in the documentation and/or other materials provided with the
+ distribution.
+* The name of the author may not be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
+BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+#endregion
+
+#region CVS Information
+/*
+ * $Source$
+ * $Author: jendave $
+ * $Date: 2007-02-13 21:58:03 +0100 (ti, 13 feb 2007) $
+ * $Revision: 205 $
+ */
+#endregion
+
+using System;
+using System.Collections;
+using System.Diagnostics;
+using System.IO;
+using System.Runtime.InteropServices;
+using System.Text.RegularExpressions;
+using System.Collections.Specialized;
+using System.Xml;
+using Prebuild.Core.Nodes;
+
+namespace Prebuild.Core.Utilities
+{
+ ///
+ ///
+ ///
+ public class Helper
+ {
+ #region Fields
+
+ private static Stack dirStack;
+ private static Regex varRegex;
+ static bool checkForOSVariables;
+
+ ///
+ ///
+ ///
+ public static bool CheckForOSVariables
+ {
+ get
+ {
+ return checkForOSVariables;
+ }
+ set
+ {
+ checkForOSVariables = value;
+ }
+ }
+
+ #endregion
+
+ #region Constructors
+
+ ///
+ /// Initializes the class.
+ ///
+ static Helper()
+ {
+ dirStack = new Stack();
+ //m_VarRegex = new Regex(@"\${(?[\w|_]+)}");
+ }
+
+ #endregion
+
+ #region Properties
+
+ ///
+ ///
+ ///
+ public static Stack DirStack
+ {
+ get
+ {
+ return dirStack;
+ }
+ }
+
+ ///
+ ///
+ ///
+ public static Regex VarRegex
+ {
+ get
+ {
+ return varRegex;
+ }
+ set
+ {
+ varRegex = value;
+ }
+ }
+
+ #endregion
+
+ #region Public Methods
+
+ #region String Parsing
+ #region Inner Classes and Delegates
+ ///
+ ///
+ ///
+ public delegate string StringLookup(string key);
+
+ #endregion
+
+ ///
+ /// Gets a collection of StringLocationPair objects that represent the matches
+ ///
+ /// The target.
+ /// The before group.
+ /// The after group.
+ /// if set to true [include delimiters in substrings].
+ ///
+ public static StringCollection FindGroups(string target, string beforeGroup, string afterGroup, bool includeDelimitersInSubstrings)
+ {
+ if( beforeGroup == null )
+ {
+ throw new ArgumentNullException("beforeGroup");
+ }
+ if( afterGroup == null )
+ {
+ throw new ArgumentNullException("afterGroup");
+ }
+ StringCollection results = new StringCollection();
+ if(target == null || target.Length == 0)
+ {
+ return results;
+ }
+
+ int beforeMod = 0;
+ int afterMod = 0;
+ if(includeDelimitersInSubstrings)
+ {
+ //be sure to not exlude the delims
+ beforeMod = beforeGroup.Length;
+ afterMod = afterGroup.Length;
+ }
+ int startIndex = 0;
+ while((startIndex = target.IndexOf(beforeGroup,startIndex)) != -1) {
+ int endIndex = target.IndexOf(afterGroup,startIndex);//the index of the char after it
+ if(endIndex == -1)
+ {
+ break;
+ }
+ int length = endIndex - startIndex - beforeGroup.Length;//move to the first char in the string
+ string substring = substring = target.Substring(startIndex + beforeGroup.Length - beforeMod,
+ length - afterMod);
+
+ results.Add(substring);
+ //results.Add(new StringLocationPair(substring,startIndex));
+ startIndex = endIndex + 1;
+ //the Interpolate*() methods will not work if expressions are expandded inside expression due to an optimization
+ //so start after endIndex
+
+ }
+ return results;
+ }
+
+ ///
+ /// Replaces the groups.
+ ///
+ /// The target.
+ /// The before group.
+ /// The after group.
+ /// The lookup.
+ ///
+ public static string ReplaceGroups(string target, string beforeGroup, string afterGroup, StringLookup lookup) {
+ if( target == null )
+ {
+ throw new ArgumentNullException("target");
+ }
+ //int targetLength = target.Length;
+ StringCollection strings = FindGroups(target,beforeGroup,afterGroup,false);
+ if( lookup == null )
+ {
+ throw new ArgumentNullException("lookup");
+ }
+ foreach(string substring in strings)
+ {
+ target = target.Replace(beforeGroup + substring + afterGroup, lookup(substring) );
+ }
+ return target;
+ }
+
+ ///
+ /// Replaces ${var} statements in a string with the corresonding values as detirmined by the lookup delegate
+ ///
+ /// The target.
+ /// The lookup.
+ ///
+ public static string InterpolateForVariables(string target, StringLookup lookup)
+ {
+ return ReplaceGroups(target, "${" , "}" , lookup);
+ }
+
+ ///
+ /// Replaces ${var} statements in a string with the corresonding environment variable with name var
+ ///
+ ///
+ ///
+ public static string InterpolateForEnvironmentVariables(string target)
+ {
+ return InterpolateForVariables(target, new StringLookup(Environment.GetEnvironmentVariable));
+ }
+
+ #endregion
+
+ ///
+ /// Translates the value.
+ ///
+ /// Type of the translate.
+ /// The translation item.
+ ///
+ public static object TranslateValue(Type translateType, string translationItem)
+ {
+ if(translationItem == null)
+ {
+ return null;
+ }
+
+ try
+ {
+ string lowerVal = translationItem.ToLower();
+ if(translateType == typeof(bool))
+ {
+ return (lowerVal == "true" || lowerVal == "1" || lowerVal == "y" || lowerVal == "yes" || lowerVal == "on");
+ }
+ else if(translateType == typeof(int))
+ {
+ return (Int32.Parse(translationItem));
+ }
+ else
+ {
+ return translationItem;
+ }
+ }
+ catch(FormatException)
+ {
+ return null;
+ }
+ }
+
+ ///
+ /// Deletes if exists.
+ ///
+ /// The file.
+ ///
+ public static bool DeleteIfExists(string file)
+ {
+ string resFile = null;
+ try
+ {
+ resFile = ResolvePath(file);
+ }
+ catch(ArgumentException)
+ {
+ return false;
+ }
+
+ if(!File.Exists(resFile))
+ {
+ return false;
+ }
+
+ File.Delete(resFile);
+ return true;
+ }
+
+ // This little gem was taken from the NeL source, thanks guys!
+ ///
+ /// Makes a relative path
+ ///
+ /// Path to start from
+ /// Path to end at
+ /// Path that will get from startPath to endPath
+ public static string MakePathRelativeTo(string startPath, string endPath)
+ {
+ string tmp = NormalizePath(startPath, '/');
+ string src = NormalizePath(endPath, '/');
+ string prefix = "";
+
+ while(true)
+ {
+ if((String.Compare(tmp, 0, src, 0, tmp.Length) == 0))
+ {
+ string ret;
+ int size = tmp.Length;
+ if(size == src.Length)
+ {
+ return "./";
+ }
+ if ((src.Length > tmp.Length) && src[tmp.Length-1] != '/' && src[tmp.Length-1] != '\\')
+ {
+ }
+ else
+ {
+ ret = prefix + endPath.Substring(size, endPath.Length - size);
+ ret = ret.Trim();
+ if(ret[0] == '/' || ret[0] == '\\')
+ {
+ ret = "." + ret;
+ }
+
+ return NormalizePath(ret);
+ }
+
+ }
+
+ if(tmp.Length < 2)
+ {
+ break;
+ }
+
+ int lastPos = tmp.LastIndexOf('/', tmp.Length - 2);
+ int prevPos = tmp.IndexOf('/');
+
+ if((lastPos == prevPos) || (lastPos == -1))
+ {
+ break;
+ }
+
+ tmp = tmp.Substring(0, lastPos + 1);
+ prefix += "../";
+ }
+
+ return endPath;
+ }
+
+ ///
+ /// Resolves the path.
+ ///
+ /// The path.
+ ///
+ public static string ResolvePath(string path)
+ {
+ string tmpPath = NormalizePath(path);
+ if(tmpPath.Length < 1)
+ {
+ tmpPath = ".";
+ }
+
+ tmpPath = Path.GetFullPath(tmpPath);
+ if(!File.Exists(tmpPath) && !Directory.Exists(tmpPath))
+ {
+ throw new ArgumentException("Path could not be resolved: " + tmpPath);
+ }
+
+ return tmpPath;
+ }
+
+ ///
+ /// Normalizes the path.
+ ///
+ /// The path.
+ /// The separator character.
+ ///
+ public static string NormalizePath(string path, char separatorCharacter)
+ {
+ if(path == null || path == "" || path.Length < 1)
+ {
+ return "";
+ }
+
+ string tmpPath = path.Replace('\\', '/');
+ tmpPath = tmpPath.Replace('/', separatorCharacter);
+ return tmpPath;
+ }
+
+ ///
+ /// Normalizes the path.
+ ///
+ /// The path.
+ ///
+ public static string NormalizePath(string path)
+ {
+ return NormalizePath(path, Path.DirectorySeparatorChar);
+ }
+
+ ///
+ /// Ends the path.
+ ///
+ /// The path.
+ /// The separator character.
+ ///
+ public static string EndPath(string path, char separatorCharacter)
+ {
+ if(path == null || path == "" || path.Length < 1)
+ {
+ return "";
+ }
+
+ if(!path.EndsWith(separatorCharacter.ToString()))
+ {
+ return (path + separatorCharacter);
+ }
+
+ return path;
+ }
+
+ ///
+ /// Ends the path.
+ ///
+ /// The path.
+ ///
+ public static string EndPath(string path)
+ {
+ return EndPath(path, Path.DirectorySeparatorChar);
+ }
+
+ ///
+ /// Makes the file path.
+ ///
+ /// The path.
+ /// The name.
+ /// The ext.
+ ///
+ public static string MakeFilePath(string path, string name, string ext)
+ {
+ string ret = EndPath(NormalizePath(path));
+
+ if( name == null )
+ {
+ throw new ArgumentNullException("name");
+ }
+
+ ret += name;
+ if(!name.EndsWith("." + ext))
+ {
+ ret += "." + ext;
+ }
+
+ //foreach(char c in Path.GetInvalidPathChars())
+ //{
+ // ret = ret.Replace(c, '_');
+ //}
+
+ return ret;
+ }
+
+ ///
+ /// Makes the file path.
+ ///
+ /// The path.
+ /// The name.
+ ///
+ public static string MakeFilePath(string path, string name)
+ {
+ string ret = EndPath(NormalizePath(path));
+
+ if( name == null )
+ {
+ throw new ArgumentNullException("name");
+ }
+
+ ret += name;
+
+ //foreach (char c in Path.GetInvalidPathChars())
+ //{
+ // ret = ret.Replace(c, '_');
+ //}
+
+ return ret;
+ }
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ public static string MakeReferencePath(string path)
+ {
+ string ret = EndPath(NormalizePath(path));
+
+ //foreach (char c in Path.GetInvalidPathChars())
+ //{
+ // ret = ret.Replace(c, '_');
+ //}
+
+ return ret;
+ }
+
+ ///
+ /// Sets the current dir.
+ ///
+ /// The path.
+ public static void SetCurrentDir(string path)
+ {
+ if( path == null )
+ {
+ throw new ArgumentNullException("path");
+ }
+ if(path.Length < 1)
+ {
+ return;
+ }
+
+ Environment.CurrentDirectory = path;
+ }
+
+ ///
+ /// Checks the type.
+ ///
+ /// The type to check.
+ /// The attr.
+ /// The inter.
+ ///
+ public static object CheckType(Type typeToCheck, Type attr, Type inter)
+ {
+ if(typeToCheck == null || attr == null)
+ {
+ return null;
+ }
+
+ object[] attrs = typeToCheck.GetCustomAttributes(attr, false);
+ if(attrs == null || attrs.Length < 1)
+ {
+ return null;
+ }
+ if( inter == null )
+ {
+ throw new ArgumentNullException("inter");
+ }
+
+ if(typeToCheck.GetInterface(inter.FullName) == null)
+ {
+ return null;
+ }
+
+ return attrs[0];
+ }
+
+ /* A bit of overhead for simple group parsing, there are problems with Regex in Mono
+ public static string ParseValue(string val)
+ {
+ if(val == null || val.Length < 1 || !CheckForOSVariables)
+ return val;
+
+ string tmp = val;
+ Match m = m_VarRegex.Match(val);
+ while(m.Success)
+ {
+ if(m.Groups["var"] == null)
+ continue;
+
+ Capture c = m.Groups["var"].Captures[0];
+ if(c == null)
+ continue;
+
+ string var = c.Value;
+ string envVal = Environment.GetEnvironmentVariable(var);
+ if(envVal == null)
+ envVal = "";
+
+ tmp = tmp.Replace("${" + var + "}", envVal);
+ m = m.NextMatch();
+ }
+
+ return tmp;
+ }*/
+
+ ///
+ /// Attributes the value.
+ ///
+ /// The node.
+ /// The attr.
+ /// The def.
+ ///
+ public static string AttributeValue(XmlNode node, string attr, string def)
+ {
+ if( node == null )
+ {
+ throw new ArgumentNullException("node");
+ }
+ if(node.Attributes[attr] == null)
+ {
+ return def;
+ }
+ string val = node.Attributes[attr].Value;
+ if(!CheckForOSVariables)
+ {
+ return val;
+ }
+
+ return InterpolateForEnvironmentVariables(val);
+ }
+
+ ///
+ /// Parses the boolean.
+ ///
+ /// The node.
+ /// The attr.
+ /// if set to true [default value].
+ ///
+ public static bool ParseBoolean(XmlNode node, string attr, bool defaultValue)
+ {
+ if( node == null )
+ {
+ throw new ArgumentNullException("node");
+ }
+ if(node.Attributes[attr] == null)
+ {
+ return defaultValue;
+ }
+ return bool.Parse(node.Attributes[attr].Value);
+ }
+
+ ///
+ /// Enums the attribute value.
+ ///
+ /// The node.
+ /// The attr.
+ /// Type of the enum.
+ /// The def.
+ ///
+ public static object EnumAttributeValue(XmlNode node, string attr, Type enumType, object def)
+ {
+ if( def == null )
+ {
+ throw new ArgumentNullException("def");
+ }
+ string val = AttributeValue(node, attr, def.ToString());
+ return Enum.Parse(enumType, val, true);
+ }
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public static string AssemblyFullName(string assemblyName, ProjectType projectType)
+ {
+ return assemblyName + (projectType == ProjectType.Library ? ".dll" : ".exe");
+ }
+
+ #endregion
+ }
+}
diff --git a/Prebuild/src/Core/Utilities/Log.cs b/Prebuild/src/Core/Utilities/Log.cs
new file mode 100644
index 0000000..da2cc96
--- /dev/null
+++ b/Prebuild/src/Core/Utilities/Log.cs
@@ -0,0 +1,279 @@
+#region BSD License
+/*
+Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com)
+
+Redistribution and use in source and binary forms, with or without modification, are permitted
+provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice, this list of conditions
+ and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
+ and the following disclaimer in the documentation and/or other materials provided with the
+ distribution.
+* The name of the author may not be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
+BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+#endregion
+
+#region CVS Information
+/*
+ * $Source$
+ * $Author: jendave $
+ * $Date: 2006-01-28 01:49:58 +0100 (lö, 28 jan 2006) $
+ * $Revision: 71 $
+ */
+#endregion
+
+using System;
+using System.IO;
+
+namespace Prebuild.Core.Utilities
+{
+ ///
+ ///
+ ///
+ public enum LogType
+ {
+ ///
+ ///
+ ///
+ None,
+ ///
+ ///
+ ///
+ Info,
+ ///
+ ///
+ ///
+ Warning,
+ ///
+ ///
+ ///
+ Error
+ }
+
+ ///
+ ///
+ ///
+ [Flags]
+ public enum LogTargets
+ {
+ ///
+ ///
+ ///
+ None = 0,
+ ///
+ ///
+ ///
+ Null = 1,
+ ///
+ ///
+ ///
+ File = 2,
+ ///
+ ///
+ ///
+ Console = 4
+ }
+
+ ///
+ /// Summary description for Log.
+ ///
+ public class Log : IDisposable
+ {
+ #region Fields
+
+ private StreamWriter m_Writer;
+ private LogTargets m_Target = LogTargets.Null;
+ bool disposed;
+
+ #endregion
+
+ #region Constructors
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The target.
+ /// Name of the file.
+ public Log(LogTargets target, string fileName)
+ {
+ m_Target = target;
+
+ if((m_Target & LogTargets.File) != 0)
+ {
+ m_Writer = new StreamWriter(fileName, false);
+ }
+ }
+
+ #endregion
+
+ #region Public Methods
+
+ ///
+ /// Writes this instance.
+ ///
+ public void Write()
+ {
+ Write(string.Empty);
+ }
+
+ ///
+ /// Writes the specified MSG.
+ ///
+ /// The MSG.
+ 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);
+ }
+ }
+
+ ///
+ /// Writes the specified format.
+ ///
+ /// The format.
+ /// The args.
+ public void Write(string format, params object[] args)
+ {
+ Write(string.Format(format,args));
+ }
+
+ ///
+ /// Writes the specified type.
+ ///
+ /// The type.
+ /// The format.
+ /// The args.
+ 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;
+ }
+
+ Write(str + format,args);
+ }
+
+ ///
+ /// Writes the exception.
+ ///
+ /// The type.
+ /// The ex.
+ 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
+ }
+ }
+
+ ///
+ /// Flushes this instance.
+ ///
+ public void Flush()
+ {
+ if(m_Writer != null)
+ {
+ m_Writer.Flush();
+ }
+ }
+
+ #endregion
+
+ #region IDisposable Members
+
+ ///
+ /// Performs application-defined tasks associated with freeing, releasing, or
+ /// resetting unmanaged resources.
+ ///
+ public void Dispose()
+ {
+ Dispose(true);
+ GC.SuppressFinalize(this);
+ }
+
+ ///
+ /// Dispose objects
+ ///
+ ///
+ /// If true, it will dispose close the handle
+ ///
+ ///
+ /// Will dispose managed and unmanaged resources.
+ ///
+ protected virtual void Dispose(bool disposing)
+ {
+ if (!this.disposed)
+ {
+ if (disposing)
+ {
+ if (m_Writer != null)
+ {
+ m_Writer.Close();
+ m_Writer = null;
+ }
+ }
+ }
+ this.disposed = true;
+ }
+
+ ///
+ ///
+ ///
+ ~Log()
+ {
+ this.Dispose(false);
+ }
+
+ ///
+ /// Closes and destroys this object
+ ///
+ ///
+ /// Same as Dispose(true)
+ ///
+ public void Close()
+ {
+ Dispose();
+ }
+
+ #endregion
+ }
+}
diff --git a/Prebuild/src/Core/WarningException.cs b/Prebuild/src/Core/WarningException.cs
new file mode 100644
index 0000000..a200bdc
--- /dev/null
+++ b/Prebuild/src/Core/WarningException.cs
@@ -0,0 +1,93 @@
+#region BSD License
+/*
+Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com)
+
+Redistribution and use in source and binary forms, with or without modification, are permitted
+provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice, this list of conditions
+ and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
+ and the following disclaimer in the documentation and/or other materials provided with the
+ distribution.
+* The name of the author may not be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
+BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+#endregion
+
+#region CVS Information
+/*
+ * $Source$
+ * $Author: jendave $
+ * $Date: 2006-01-28 01:49:58 +0100 (lö, 28 jan 2006) $
+ * $Revision: 71 $
+ */
+#endregion
+
+using System;
+using System.Runtime.Serialization;
+
+namespace Prebuild.Core
+{
+ ///
+ ///
+ ///
+ [Serializable()]
+ public class WarningException : Exception
+ {
+ #region Constructors
+
+ ///
+ ///
+ ///
+ public WarningException()
+ {
+ }
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ public WarningException(string format, params object[] args)
+ : base(String.Format(format, args))
+ {
+ }
+
+ ///
+ /// Exception with specified string
+ ///
+ /// Exception message
+ public WarningException(string message): base(message)
+ {
+ }
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ public WarningException(string message, Exception exception) : base(message, exception)
+ {
+ }
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ protected WarningException(SerializationInfo info, StreamingContext context) : base( info, context )
+ {
+ }
+
+ #endregion
+ }
+}
diff --git a/Prebuild/src/Prebuild.cs b/Prebuild/src/Prebuild.cs
new file mode 100644
index 0000000..597db68
--- /dev/null
+++ b/Prebuild/src/Prebuild.cs
@@ -0,0 +1,165 @@
+#region BSD License
+/*
+Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com)
+
+Redistribution and use in source and binary forms, with or without modification, are permitted
+provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice, this list of conditions
+ and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
+ and the following disclaimer in the documentation and/or other materials provided with the
+ distribution.
+* The name of the author may not be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
+BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+#endregion
+
+#region CVS Information
+/*
+ * $Source$
+ * $Author: jendave $
+ * $Date: 2006-09-26 23:43:35 +0200 (ti, 26 sep 2006) $
+ * $Revision: 168 $
+ */
+#endregion
+
+using System;
+using System.Collections.Specialized;
+using System.IO;
+using System.Reflection;
+using System.Runtime.InteropServices;
+using System.EnterpriseServices.Internal;
+
+using Prebuild.Core;
+using Prebuild.Core.Utilities;
+
+namespace Prebuild
+{
+ ///
+ ///
+ ///
+ 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;
+
+ 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();
+ }
+ }
+ catch(Exception ex)
+ {
+ Console.WriteLine("Unhandled error: {0}", ex.Message);
+ //#if DEBUG
+ Console.WriteLine("{0}", ex.StackTrace);
+ //#endif
+ }
+ finally
+ {
+ if(kernel.PauseAfterFinish)
+ {
+ Console.WriteLine("\nPress enter to continue...");
+ Console.ReadLine();
+ }
+ }
+ }
+
+ #endregion
+
+ #region Private Methods
+
+ private static void InstallAssembly(Kernel kernel)
+ {
+ Publish publish = new Publish();
+ string file = kernel.CommandLine["install"];
+ //Console.WriteLine(".."+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 OutputUsage()
+ {
+ Console.WriteLine("Usage: prebuild /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
+ }
+}
diff --git a/Prebuild/src/Prebuild.csproj b/Prebuild/src/Prebuild.csproj
new file mode 100644
index 0000000..c8b859c
--- /dev/null
+++ b/Prebuild/src/Prebuild.csproj
@@ -0,0 +1,205 @@
+
+
+ Local
+ 8.0.50727
+ 2.0
+ {92E80C1C-0000-0000-0000-000000000000}
+ Debug
+ AnyCPU
+ App.ico
+
+
+ Prebuild
+ Prebuild.snk
+ true
+ JScript
+ Grid
+ IE50
+ false
+ Exe
+
+ Prebuild
+ Prebuild.Prebuild
+
+
+
+
+ False
+ 285212672
+ False
+
+
+ DEBUG;TRACE
+
+ True
+ 4096
+ False
+ ..\..\bin\
+ False
+ False
+ False
+ 4
+ 1595
+
+
+ False
+ 285212672
+ False
+
+
+ TRACE
+
+ False
+ 4096
+ True
+ ..\..\bin\
+ False
+ False
+ False
+ 4
+ 1595
+
+
+
+ System.dll
+ False
+
+
+ System.EnterpriseServices.dll
+ False
+
+
+ System.Xml.dll
+ False
+
+
+
+
+
+
+
+
+
+
+ Code
+
+
+ Code
+
+
+ Code
+
+
+ Code
+
+
+ Code
+
+
+ Code
+
+
+ Code
+
+
+ Code
+
+
+ Code
+
+
+ Code
+
+
+ Code
+
+
+ Code
+
+
+ Code
+
+
+ Code
+
+
+ Code
+
+
+ Code
+
+
+ Code
+
+
+ Code
+
+
+ Code
+
+
+ Code
+
+
+ Code
+
+
+ Code
+
+
+ Code
+
+
+ Code
+
+
+ Code
+
+
+ Code
+
+
+ Code
+
+
+ Code
+
+
+ Code
+
+
+ Code
+
+
+ Code
+
+
+ Code
+
+
+ Code
+
+
+ Code
+
+
+ Code
+
+
+ Code
+
+
+ Code
+
+
+ Code
+
+
+
+
+
+
+
+
+
+
diff --git a/Prebuild/src/Prebuild.csproj.user b/Prebuild/src/Prebuild.csproj.user
new file mode 100644
index 0000000..6841907
--- /dev/null
+++ b/Prebuild/src/Prebuild.csproj.user
@@ -0,0 +1,12 @@
+
+
+ Debug
+ AnyCPU
+ C:\New Folder\second-life-viewer\opensim-dailys2\opensim15-06\NameSpaceChanges\bin\
+ 8.0.50727
+ ProjectFiles
+ 0
+
+
+
+
diff --git a/Prebuild/src/Prebuild.exe.build b/Prebuild/src/Prebuild.exe.build
new file mode 100644
index 0000000..2851125
--- /dev/null
+++ b/Prebuild/src/Prebuild.exe.build
@@ -0,0 +1,80 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Prebuild/src/Prebuild.snk b/Prebuild/src/Prebuild.snk
new file mode 100644
index 0000000..f9dce05
Binary files /dev/null and b/Prebuild/src/Prebuild.snk differ
diff --git a/Prebuild/src/Properties/AssemblyInfo.cs b/Prebuild/src/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..bfa9829
--- /dev/null
+++ b/Prebuild/src/Properties/AssemblyInfo.cs
@@ -0,0 +1,101 @@
+#region BSD License
+/*
+Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com)
+
+Redistribution and use in source and binary forms, with or without modification, are permitted
+provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice, this list of conditions
+ and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
+ and the following disclaimer in the documentation and/or other materials provided with the
+ distribution.
+* The name of the author may not be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
+BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+#endregion
+
+#region CVS Information
+/*
+ * $Source$
+ * $Author: jendave $
+ * $Date: 2007-01-26 19:31:34 +0100 (fr, 26 jan 2007) $
+ * $Revision: 203 $
+ */
+#endregion
+
+using System;
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Security.Permissions;
+using System.Resources;
+
+
+// FxCop recommended attributes
+[assembly: ComVisible(false)]
+[assembly: FileIOPermission(SecurityAction.RequestMinimum, Unrestricted=true)]
+[assembly: CLSCompliant(true)]
+
+//
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+//
+[assembly: AssemblyTitle(".NET Prebuild")]
+[assembly: AssemblyDescription("A .NET project file build tool")]
+[assembly: AssemblyConfiguration(".NET CLR")]
+[assembly: AssemblyCompany("The Prebuild Project")]
+[assembly: AssemblyProduct("")]
+[assembly: AssemblyCopyright("Copyright 2004-2006 Matthew Holmes, Dan Moorehead and David Hudson")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+[assembly: NeutralResourcesLanguageAttribute("en-US")]
+[assembly: AssemblyVersion("2.0.0.*")]
+
+//
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Revision and Build Numbers
+// by using the '*' as shown below:
+
+//
+// In order to sign your assembly you must specify a key to use. Refer to the
+// Microsoft .NET Framework documentation for more information on assembly signing.
+//
+// Use the attributes below to control which key is used for signing.
+//
+// Notes:
+// (*) If no key is specified, the assembly is not signed.
+// (*) KeyName refers to a key that has been installed in the Crypto Service
+// Provider (CSP) on your machine. KeyFile refers to a file which contains
+// a key.
+// (*) If the KeyFile and the KeyName values are both specified, the
+// following processing occurs:
+// (1) If the KeyName can be found in the CSP, that key is used.
+// (2) If the KeyName does not exist and the KeyFile does exist, the key
+// in the KeyFile is installed into the CSP and used.
+// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility.
+// When specifying the KeyFile, the location of the KeyFile should be
+// relative to the project output directory which is
+// %Project Directory%\obj\. For example, if your KeyFile is
+// located in the project directory, you would specify the AssemblyKeyFile
+// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")]
+// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework
+// documentation for more information on this.
+//
+[assembly: AssemblyDelaySign(false)]
+[assembly: AssemblyKeyName("")]
diff --git a/Prebuild/src/data/dnpb-1.0.xsd b/Prebuild/src/data/dnpb-1.0.xsd
new file mode 100644
index 0000000..45cab86
--- /dev/null
+++ b/Prebuild/src/data/dnpb-1.0.xsd
@@ -0,0 +1,183 @@
+
+
+
+
+ Copyright (c) 2004 Matthew Holmes (kerion@houston.rr.com)
+
+ Redistribution and use in source and binary forms, with or without modification, are permitted
+ provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice, this list of conditions
+ and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright notice, this list of conditions
+ and the following disclaimer in the documentation and/or other materials provided with the
+ distribution.
+ * The name of the author may not be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
+ BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Prebuild/src/data/dnpb-1.1.xsd b/Prebuild/src/data/dnpb-1.1.xsd
new file mode 100644
index 0000000..c402ceb
--- /dev/null
+++ b/Prebuild/src/data/dnpb-1.1.xsd
@@ -0,0 +1,184 @@
+
+
+
+
+ Copyright (c) 2004 Matthew Holmes (kerion@houston.rr.com)
+
+ Redistribution and use in source and binary forms, with or without modification, are permitted
+ provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice, this list of conditions
+ and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright notice, this list of conditions
+ and the following disclaimer in the documentation and/or other materials provided with the
+ distribution.
+ * The name of the author may not be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
+ BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Prebuild/src/data/dnpb-1.2.xsd b/Prebuild/src/data/dnpb-1.2.xsd
new file mode 100644
index 0000000..8004af7
--- /dev/null
+++ b/Prebuild/src/data/dnpb-1.2.xsd
@@ -0,0 +1,198 @@
+
+
+
+
+ Copyright (c) 2004 Matthew Holmes (calefaction _at_ houston _._ rr _._ com)
+
+ Redistribution and use in source and binary forms, with or without modification, are permitted
+ provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice, this list of conditions
+ and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright notice, this list of conditions
+ and the following disclaimer in the documentation and/or other materials provided with the
+ distribution.
+ * The name of the author may not be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
+ BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Prebuild/src/data/dnpb-1.3.xsd b/Prebuild/src/data/dnpb-1.3.xsd
new file mode 100644
index 0000000..5f8ada1
--- /dev/null
+++ b/Prebuild/src/data/dnpb-1.3.xsd
@@ -0,0 +1,206 @@
+
+
+
+
+ Copyright (c) 2004-2005 Matthew Holmes (calefaction at houston . rr . com), Dan Moorehead (dan05a at gmail . com)
+
+ .NET Pre-Build is an XML-driven pre-build tool allowing developers to
+ easily generate project or make files for major IDE's and .NET
+ development tools including: Visual Studio 2003, Visual Studio 2002,
+ SharpDevelop, MonoDevelop, and NAnt.
+
+ BSD License:
+
+ Redistribution and use in source and binary forms, with or without modification, are permitted
+ provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice, this list of conditions
+ and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright notice, this list of conditions
+ and the following disclaimer in the documentation and/or other materials provided with the
+ distribution.
+ * The name of the author may not be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE AUTHOR 'AS IS' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
+ BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Prebuild/src/data/dnpb-1.4.xsd b/Prebuild/src/data/dnpb-1.4.xsd
new file mode 100644
index 0000000..54f9ac0
--- /dev/null
+++ b/Prebuild/src/data/dnpb-1.4.xsd
@@ -0,0 +1,212 @@
+
+
+
+
+ Copyright (c) 2004-2005 Matthew Holmes (calefaction at houston . rr . com), Dan Moorehead (dan05a at gmail . com)
+
+ .NET Prebuild is a cross-platform XML-driven pre-build tool which
+ allows developers to easily generate project or make files for major
+ IDE's and .NET development tools including: Visual Studio .NET 2002 and
+ 2003, SharpDevelop, MonoDevelop, and NAnt.
+
+ BSD License:
+
+ Redistribution and use in source and binary forms, with or without modification, are permitted
+ provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice, this list of conditions
+ and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright notice, this list of conditions
+ and the following disclaimer in the documentation and/or other materials provided with the
+ distribution.
+ * The name of the author may not be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE AUTHOR 'AS IS' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
+ BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Prebuild/src/data/dnpb-1.5.xsd b/Prebuild/src/data/dnpb-1.5.xsd
new file mode 100644
index 0000000..2270e83
--- /dev/null
+++ b/Prebuild/src/data/dnpb-1.5.xsd
@@ -0,0 +1,215 @@
+
+
+
+
+ Copyright (c) 2004-2005 Matthew Holmes (calefaction at houston . rr . com), Dan Moorehead (dan05a at gmail . com)
+
+ .NET Prebuild is a cross-platform XML-driven pre-build tool which
+ allows developers to easily generate project or make files for major
+ IDE's and .NET development tools including: Visual Studio .NET 2002 and
+ 2003, SharpDevelop, MonoDevelop, and NAnt.
+
+ BSD License:
+
+ Redistribution and use in source and binary forms, with or without modification, are permitted
+ provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice, this list of conditions
+ and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright notice, this list of conditions
+ and the following disclaimer in the documentation and/or other materials provided with the
+ distribution.
+ * The name of the author may not be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE AUTHOR 'AS IS' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
+ BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Prebuild/src/data/prebuild-1.6.xsd b/Prebuild/src/data/prebuild-1.6.xsd
new file mode 100644
index 0000000..f944faf
--- /dev/null
+++ b/Prebuild/src/data/prebuild-1.6.xsd
@@ -0,0 +1,231 @@
+
+
+
+
+ Copyright (c) 2004-2005 Matthew Holmes (calefaction at houston . rr . com), Dan Moorehead (dan05a at gmail . com)
+
+ .NET Prebuild is a cross-platform XML-driven pre-build tool which
+ allows developers to easily generate project or make files for major
+ IDE's and .NET development tools including: Visual Studio .NET 2002 and
+ 2003, SharpDevelop, MonoDevelop, and NAnt.
+
+ BSD License:
+
+ Redistribution and use in source and binary forms, with or without modification, are permitted
+ provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice, this list of conditions
+ and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright notice, this list of conditions
+ and the following disclaimer in the documentation and/or other materials provided with the
+ distribution.
+ * The name of the author may not be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE AUTHOR 'AS IS' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
+ BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Prebuild/src/data/prebuild-1.7.xsd b/Prebuild/src/data/prebuild-1.7.xsd
new file mode 100644
index 0000000..9d63ce6
--- /dev/null
+++ b/Prebuild/src/data/prebuild-1.7.xsd
@@ -0,0 +1,261 @@
+
+
+
+
+ Copyright (c) 2004-2005 Matthew Holmes (calefaction at houston . rr . com), Dan Moorehead (dan05a at gmail . com), David Hudson (jendave at yahoo dot com)
+
+ .NET Prebuild is a cross-platform XML-driven pre-build tool which
+ allows developers to easily generate project or make files for major
+ IDE's and .NET development tools including: Visual Studio .NET 2002 and
+ 2003, SharpDevelop, MonoDevelop, and NAnt.
+
+ BSD License:
+
+ Redistribution and use in source and binary forms, with or without modification, are permitted
+ provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice, this list of conditions
+ and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright notice, this list of conditions
+ and the following disclaimer in the documentation and/or other materials provided with the
+ distribution.
+ * The name of the author may not be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE AUTHOR 'AS IS' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
+ BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
--
cgit v1.1