* reverted the revert of the revert. What can I say? I'm calling this a day, and will get back up on the horse tomorrow.

GenericGridServerConcept
lbsa71 2009-02-19 14:54:21 +00:00
parent 5af465a364
commit 549c615e0e
61 changed files with 2003 additions and 2813 deletions

View File

@ -4,7 +4,4 @@ Dan Moorehead (dan05a@gmail.com)
Rob Loach (http://www.robloach.net) Rob Loach (http://www.robloach.net)
C.J. Adams-Collier (cjac@colliertech.org) C.J. Adams-Collier (cjac@colliertech.org)
Patch Contributers
lbsa71
chi11ken
sdague

View File

@ -1,90 +1,3 @@
2008-12-09T02:15 D. Moonfire <d.moonfire@mfgames.com>
* src/Core/Kernel.cs
- Added a /ppi target to get the results of processing but before
processing the actual results.
* src/Core/Preprocessor.cs
- Applied the patch from kanato with formatting changes.
- Uses the <?include file="" ?> format.
* tests/
- Added some lightweight tests to test the functionality of the
include patch.
2008-06-19T09:37 John Anderson <sontek@gmail.com>
* src/Core/Kernel.cs
- Only Loop through targets that are not abstract.
* src/Core/Targets/VSGenericTarget.cs
- Marked abstract and removed the Target attribute.
2008-06-16T17:37 John Anderson <sontek@gmail.com>
* src/Core/Nodes/ProjectNode.cs,data/prebuild-1.7.xsd
- Added the ability to hardcode guid's in the projects
2008-05-21T0737 C.J. Adams-Collier <cjac@colliertech.org>
* src/Core/Targets/AutotoolsTarget.cs
- catch exception when unable to compile AssemblyInfo.cs
2008-05-07T17:29 John Anderson <sontek@gmail.com>
* src/Core/Targets/VSGenericTarget.cs
- Generate asp.net output in bin\ folder (asp.net requires it there)
2008-04-30T17:29 John Anderson <sontek@gmail.com>
* src/Core/Nodes/DatabaseReferenceNode.cs,
src/Core/Nodes/Datanode.cs,
src/Core/Nodes/FileNode.cs,
src/Core/Nodes/FileNodes.cs,
src/Core/Nodes/MatchNode.cs,
src/Core/Targets/VS2008Target.cs,
src/data/prebuild-1.7.xsd
- Refactored the project generation code to handle web projects and more
logically handle embedded resources and designer files.
2008-04-30T17:29 Joseph Lombrozo <digitaljeebus@gmail.com>
* src/Core/Nodes/SolutionNode.cs
- Had solutions inherit Configurations in the same way that Projects do.
2008-04-29T06:35 Joseph Lombrozo <digitaljeebus@gmail.com>
* src/Core/Targets/VS2008Target.cs,
src/Core/Nodes/DatabaseProjectNode.cs,
src/Core/Nodes/DatabaseReferenceNode.cs,
src/data/prebuild-1.7.xsd
- Added database references to database projects.
- Prevented nested solutions from being written to disk.
2008-04-29T05:43 Joseph Lombrozo <digitaljeebus@gmail.com>
* src/Core/Targets/VS2008Target.cs
- Enabled embedded solutions to contain Files.
2008-04-29T04:13 Joseph Lombrozo <digitaljeebus@gmail.com>
* src/Core/VSVersion.cs
- Fixed spelling mistake in enum comment.
* src/Core/Attributes/DataNodeAttribute.cs
- Allowed the DataNodeAttribute to be attached to a single class
more than once, allowing one class to be used to parse more than
one node at a time.
* src/Core/Kernel.cs
- Changed CacheNodeTypes() to allow for multiple DataNodeAttribute
instances in one class. Refactored ProcessFile(...) to return Solutions,
rather than adding them to the Kernel.
* src/Core/Nodes/SolutionNode.cs
- Added Guid (for embedded folders)
- Added DatabaseProjects, Solutions and Processes to the SolutionNode
when parsing.
* src/Core/Nodes/ProjectNode.cs
- Added FrameworkVersion property to allow for 2.0/3.0/3.5 differentiation.
* src/Core/Targets/VS2008Target.cs, src/data/prebuild-1.7.xsd
- Added ability to have embedded solutions, and externally referenced
prebuild scripts.
2008-04-24T04:33 John M. Anderson <sontek@gmail.com>
* src/Core/Targets/VS2003Target.cs, src/Core/Targets/VSVersion.cs
- Moved the VSVersion enum into its own file.
* src/Core/Targets/VS2008Target.cs
- added support for VS2008
* src/Core/Nodes/ProjectNode.cs
- Added initial support for ASP.NET projects
* src/Core/Nodes/DatabaseProjectNode.cs
- Added support for Visual Studio database projects
2008-02-19T07:08 C.J. Adams-Collier <cjac@colliertech.org> 2008-02-19T07:08 C.J. Adams-Collier <cjac@colliertech.org>
* TODO * TODO
- added some tasks from Sam Hocevar - added some tasks from Sam Hocevar

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?> <?xml version="1.0" encoding="utf-8" ?>
<Prebuild xmlns="http://dnpb.sourceforge.net/schemas/prebuild-1.7.xsd" version="1.7"> <Prebuild xmlns="http://dnpb.sourceforge.net/schemas/prebuild-1.7.xsd" version="1.7">
<Solution name="Prebuild" version="2.0.4"> <Solution name="Prebuild" version="2.0.3">
<Configuration name="Debug"> <Configuration name="Debug">
<Options> <Options>
<CompilerDefines>DEBUG;TRACE</CompilerDefines> <CompilerDefines>DEBUG;TRACE</CompilerDefines>

View File

@ -1,4 +0,0 @@
@rem Generates a solution (.sln) and a set of project files (.csproj, .vbproj, etc.)
@rem for Microsoft Visual Studio .NET 2008
cd ..
Prebuild.exe /target vs2008 /file prebuild.xml /pause

View File

@ -23,6 +23,15 @@ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY O
*/ */
#endregion #endregion
#region CVS Information
/*
* $Source$
* $Author: jendave $
* $Date: 2006-01-28 09:49:58 +0900 (Sat, 28 Jan 2006) $
* $Revision: 71 $
*/
#endregion
using System; using System;
using System.Collections.Specialized; using System.Collections.Specialized;
@ -31,7 +40,7 @@ namespace Prebuild.Core.Attributes
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct, AllowMultiple=true)] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct)]
public sealed class DataNodeAttribute : Attribute public sealed class DataNodeAttribute : Attribute
{ {
#region Fields #region Fields

View File

@ -23,6 +23,15 @@ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY O
*/ */
#endregion #endregion
#region CVS Information
/*
* $Source$
* $Author: jendave $
* $Date: 2006-01-28 09:49:58 +0900 (Sat, 28 Jan 2006) $
* $Revision: 71 $
*/
#endregion
using System; using System;
namespace Prebuild.Core.Attributes namespace Prebuild.Core.Attributes

View File

@ -23,6 +23,15 @@ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY O
*/ */
#endregion #endregion
#region CVS Information
/*
* $Source$
* $Author: jendave $
* $Date: 2006-01-28 09:49:58 +0900 (Sat, 28 Jan 2006) $
* $Revision: 71 $
*/
#endregion
using System; using System;
namespace Prebuild.Core.Attributes namespace Prebuild.Core.Attributes

View File

@ -23,6 +23,15 @@ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY O
*/ */
#endregion #endregion
#region CVS Information
/*
* $Source$
* $Author: jendave $
* $Date: 2006-01-28 09:49:58 +0900 (Sat, 28 Jan 2006) $
* $Revision: 71 $
*/
#endregion
using System; using System;
using System.Runtime.Serialization; using System.Runtime.Serialization;

View File

@ -23,6 +23,15 @@ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY O
*/ */
#endregion #endregion
#region CVS Information
/*
* $Source$
* $Author: jendave $
* $Date: 2006-01-28 09:49:58 +0900 (Sat, 28 Jan 2006) $
* $Revision: 71 $
*/
#endregion
using System; using System;
using System.Xml; using System.Xml;

View File

@ -23,6 +23,15 @@ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY O
*/ */
#endregion #endregion
#region CVS Information
/*
* $Source$
* $Author: jendave $
* $Date: 2006-01-28 09:49:58 +0900 (Sat, 28 Jan 2006) $
* $Revision: 71 $
*/
#endregion
using System; using System;
namespace Prebuild.Core.Interfaces namespace Prebuild.Core.Interfaces

View File

@ -36,8 +36,16 @@ POSSIBILITY OF SUCH DAMAGE.
*/ */
#endregion #endregion
#region CVS Information
/*
* $Source$
* $Author: cjcollier $
* $Date: 2008-02-08 01:31:29 +0900 (Fri, 08 Feb 2008) $
* $Revision: 256 $
*/
#endregion
using System; using System;
using System.Collections.Generic;
using System.Diagnostics; using System.Diagnostics;
using System.Collections; using System.Collections;
using System.Collections.Specialized; using System.Collections.Specialized;
@ -72,17 +80,17 @@ namespace Prebuild.Core
#region Fields #region Fields
private static readonly Kernel m_Instance = new Kernel(); private static Kernel m_Instance = new Kernel();
/// <summary> /// <summary>
/// This must match the version of the schema that is embeeded /// This must match the version of the schema that is embeeded
/// </summary> /// </summary>
private const string m_SchemaVersion = "1.7"; private static string m_SchemaVersion = "1.7";
private const string m_Schema = "prebuild-" + m_SchemaVersion + ".xsd"; private static string m_Schema = "prebuild-" + m_SchemaVersion + ".xsd";
private const string m_SchemaURI = "http://dnpb.sourceforge.net/schemas/" + m_Schema; private static string m_SchemaURI = "http://dnpb.sourceforge.net/schemas/" + m_Schema;
bool disposed; bool disposed;
private Version m_Version; private Version m_Version;
private const string m_Revision = ""; private string m_Revision = "";
private CommandLineCollection m_CommandLine; private CommandLineCollection m_CommandLine;
private Log m_Log; private Log m_Log;
private CurrentDirectory m_CurrentWorkingDirectory; private CurrentDirectory m_CurrentWorkingDirectory;
@ -90,16 +98,19 @@ namespace Prebuild.Core
private Hashtable m_Targets; private Hashtable m_Targets;
private Hashtable m_Nodes; private Hashtable m_Nodes;
readonly List<SolutionNode> m_Solutions = new List<SolutionNode>(); ArrayList m_Solutions;
string m_Target; string m_Target;
string m_Clean; string m_Clean;
string[] m_RemoveDirectories; string[] m_RemoveDirectories;
XmlDocument m_CurrentDoc; string m_CurrentFile;
XmlDocument m_CurrentDoc;
bool m_PauseAfterFinish; bool m_PauseAfterFinish;
string[] m_ProjectGroups; string[] m_ProjectGroups;
StringCollection m_Refs;
#endregion
#endregion
#region Constructors #region Constructors
@ -199,7 +210,7 @@ namespace Prebuild.Core
/// Gets the solutions. /// Gets the solutions.
/// </summary> /// </summary>
/// <value>The solutions.</value> /// <value>The solutions.</value>
public List<SolutionNode> Solutions public ArrayList Solutions
{ {
get get
{ {
@ -224,7 +235,7 @@ namespace Prebuild.Core
#region Private Methods #region Private Methods
private static void RemoveDirectories(string rootDir, string[] dirNames) private void RemoveDirectories(string rootDir, string[] dirNames)
{ {
foreach(string dir in Directory.GetDirectories(rootDir)) foreach(string dir in Directory.GetDirectories(rootDir))
{ {
@ -286,15 +297,13 @@ namespace Prebuild.Core
foreach(Type t in assm.GetTypes()) foreach(Type t in assm.GetTypes())
{ {
TargetAttribute ta = (TargetAttribute)Helper.CheckType(t, typeof(TargetAttribute), typeof(ITarget)); TargetAttribute ta = (TargetAttribute)Helper.CheckType(t, typeof(TargetAttribute), typeof(ITarget));
if(ta == null) if(ta == null)
{
continue; continue;
}
if (t.IsAbstract)
continue;
ITarget target = (ITarget)assm.CreateInstance(t.FullName); ITarget target = (ITarget)assm.CreateInstance(t.FullName);
if (target == null) if(target == null)
{ {
throw new MissingMethodException("Could not create ITarget instance"); throw new MissingMethodException("Could not create ITarget instance");
} }
@ -307,13 +316,16 @@ namespace Prebuild.Core
{ {
foreach(Type t in assm.GetTypes()) foreach(Type t in assm.GetTypes())
{ {
foreach (DataNodeAttribute dna in t.GetCustomAttributes(typeof(DataNodeAttribute), true)) DataNodeAttribute dna = (DataNodeAttribute)Helper.CheckType(t, typeof(DataNodeAttribute), typeof(IDataNode));
{ if(dna == null)
NodeEntry ne = new NodeEntry(); {
ne.Type = t; continue;
ne.Attribute = dna; }
m_Nodes[dna.Name] = ne;
} NodeEntry ne = new NodeEntry();
ne.Type = t;
ne.Attribute = dna;
m_Nodes[dna.Name] = ne;
} }
} }
@ -331,32 +343,7 @@ namespace Prebuild.Core
m_Log.Write(); m_Log.Write();
} }
private void ProcessFile(string file)
private void ProcessFile(string file)
{
ProcessFile(file, this.m_Solutions);
}
public void ProcessFile(ProcessNode node, SolutionNode parent)
{
if (node.IsValid)
{
List<SolutionNode> list = new List<SolutionNode>();
ProcessFile(node.Path, list);
foreach (SolutionNode solution in list)
parent.SolutionsTable[solution.Name] = solution;
}
}
/// <summary>
///
/// </summary>
/// <param name="file"></param>
/// <param name="solutions"></param>
/// <returns></returns>
public void ProcessFile(string file, IList<SolutionNode> solutions)
{ {
m_CurrentWorkingDirectory.Push(); m_CurrentWorkingDirectory.Push();
@ -374,7 +361,8 @@ namespace Prebuild.Core
return; return;
} }
Helper.SetCurrentDir(Path.GetDirectoryName(path)); m_CurrentFile = path;
Helper.SetCurrentDir(Path.GetDirectoryName(path));
XmlTextReader reader = new XmlTextReader(path); XmlTextReader reader = new XmlTextReader(path);
@ -391,33 +379,6 @@ namespace Prebuild.Core
string xml = pre.Process(reader);//remove script and evaulate pre-proccessing to get schema-conforming XML string xml = pre.Process(reader);//remove script and evaulate pre-proccessing to get schema-conforming XML
// See if the user put into a pseudo target of "prebuild:preprocessed-input" to indicate they want to see the
// output before the system processes it.
if (m_CommandLine.WasPassed("ppi"))
{
// Get the filename if there is one, otherwise use a default.
string ppiFile = m_CommandLine["ppi"];
if (ppiFile == null || ppiFile.Trim().Length == 0)
{
ppiFile = "preprocessed-input.xml";
}
// Write out the string to the given stream.
try
{
using (StreamWriter ppiWriter = new StreamWriter(ppiFile))
{
ppiWriter.WriteLine(xml);
}
}
catch(IOException ex)
{
Console.WriteLine("Could not write PPI file '{0}': {1}", ppiFile, ex.Message);
}
// Finish processing this special tag.
return;
}
m_CurrentDoc = new XmlDocument(); m_CurrentDoc = new XmlDocument();
try try
@ -482,7 +443,7 @@ namespace Prebuild.Core
} }
else if(dataNode is SolutionNode) else if(dataNode is SolutionNode)
{ {
solutions.Add((SolutionNode)dataNode); m_Solutions.Add(dataNode);
} }
} }
} }
@ -566,7 +527,7 @@ namespace Prebuild.Core
/// <returns></returns> /// <returns></returns>
public IDataNode ParseNode(XmlNode node, IDataNode parent, IDataNode preNode) public IDataNode ParseNode(XmlNode node, IDataNode parent, IDataNode preNode)
{ {
IDataNode dataNode; IDataNode dataNode = null;
try try
{ {
@ -668,6 +629,9 @@ namespace Prebuild.Core
m_PauseAfterFinish = m_CommandLine.WasPassed("pause"); m_PauseAfterFinish = m_CommandLine.WasPassed("pause");
LoadSchema(); LoadSchema();
m_Solutions = new ArrayList();
m_Refs = new StringCollection();
} }
/// <summary> /// <summary>
@ -700,18 +664,17 @@ namespace Prebuild.Core
m_Log.Write(LogType.Error, "The options /target and /clean cannot be passed together"); m_Log.Write(LogType.Error, "The options /target and /clean cannot be passed together");
return; return;
} }
else if(m_Target == null && m_Clean == null)
if(m_Target == null && m_Clean == null) {
{ if(perfomedOtherTask) //finished
if(perfomedOtherTask) //finished {
{ return;
return; }
} m_Log.Write(LogType.Error, "Must pass either /target or /clean to process a Prebuild file");
m_Log.Write(LogType.Error, "Must pass either /target or /clean to process a Prebuild file"); return;
return; }
}
string file = "./prebuild.xml"; string file = "./prebuild.xml";
if(m_CommandLine.WasPassed("file")) if(m_CommandLine.WasPassed("file"))
{ {
file = m_CommandLine["file"]; file = m_CommandLine["file"];

View File

@ -23,6 +23,15 @@ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY O
*/ */
#endregion #endregion
#region CVS Information
/*
* $Source $
* $Author: $
* $Date: $
* $Revision: $
*/
#endregion
using System; using System;
using System.Collections; using System.Collections;
using System.Collections.Specialized; using System.Collections.Specialized;

View File

@ -23,6 +23,15 @@ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY O
*/ */
#endregion #endregion
#region CVS Information
/*
* $Source$
* $Author: jendave $
* $Date: 2006-01-28 09:49:58 +0900 (Sat, 28 Jan 2006) $
* $Revision: 71 $
*/
#endregion
using System; using System;
using System.Xml; using System.Xml;

View File

@ -23,24 +23,31 @@ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY O
*/ */
#endregion #endregion
#region CVS Information
/*
* $Source$
* $Author: jendave $
* $Date: 2006-01-28 09:49:58 +0900 (Sat, 28 Jan 2006) $
* $Revision: 71 $
*/
#endregion
using System; using System;
using System.Xml; using System.Xml;
using Prebuild.Core.Attributes; using Prebuild.Core.Attributes;
using Prebuild.Core.Interfaces; using Prebuild.Core.Interfaces;
using System.IO;
namespace Prebuild.Core.Nodes namespace Prebuild.Core.Nodes
{ {
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
public abstract class DataNode : IDataNode public class DataNode : IDataNode
{ {
#region Fields #region Fields
private IDataNode parent; private IDataNode parent;
string[] m_WebTypes = new string[] { "aspx", "ascx", "master", "ashx", "asmx" };
#endregion #endregion
@ -61,10 +68,7 @@ namespace Prebuild.Core.Nodes
parent = value; parent = value;
} }
} }
public string[] WebTypes
{
get { return m_WebTypes; }
}
/// <summary> /// <summary>
/// Parses the specified node. /// Parses the specified node.
/// </summary> /// </summary>
@ -72,46 +76,7 @@ namespace Prebuild.Core.Nodes
public virtual void Parse(XmlNode node) public virtual void Parse(XmlNode node)
{ {
} }
public BuildAction GetBuildActionByFileName(string fileName)
{
string extension = Path.GetExtension(fileName).ToLower();
foreach (string type in WebTypes)
{
if (extension == type)
return BuildAction.Content;
}
return BuildAction.Compile;
}
/// <summary>
/// Parses the file type to figure out what type it is
/// </summary>
/// <returns></returns>
public SubType GetSubTypeByFileName(string fileName)
{
string extension = System.IO.Path.GetExtension(fileName).ToLower();
string designer = String.Format(".designer{0}", extension);
string path = fileName.ToLower();
if (extension == ".resx")
{
return SubType.Designer;
}
else if (path.EndsWith(".settings"))
{
return SubType.Settings;
}
else
{
foreach (string type in WebTypes)
{
if (path.EndsWith(string.Format("{0}{1}", type, extension)))
{
return SubType.CodeBehind;
}
}
}
return SubType.Code;
}
#endregion #endregion
} }
} }

View File

@ -1,94 +0,0 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Xml;
using Prebuild.Core.Attributes;
using Prebuild.Core.Interfaces;
using Prebuild.Core.Utilities;
namespace Prebuild.Core.Nodes
{
[DataNode("DatabaseProject")]
public class DatabaseProjectNode : DataNode
{
string name;
string path;
string fullpath;
Guid guid = Guid.NewGuid();
readonly List<AuthorNode> authors = new List<AuthorNode>();
readonly List<DatabaseReferenceNode> references = new List<DatabaseReferenceNode>();
public Guid Guid
{
get { return guid; }
}
public string Name
{
get { return name; }
}
public string Path
{
get { return path; }
}
public string FullPath
{
get { return fullpath; }
}
public IEnumerable<DatabaseReferenceNode> References
{
get { return references; }
}
public override void Parse(XmlNode node)
{
name = Helper.AttributeValue(node, "name", name);
path = Helper.AttributeValue(node, "path", name);
try
{
fullpath = Helper.ResolvePath(path);
}
catch
{
throw new WarningException("Could not resolve Solution path: {0}", path);
}
Kernel.Instance.CurrentWorkingDirectory.Push();
try
{
Helper.SetCurrentDir(fullpath);
if (node == null)
{
throw new ArgumentNullException("node");
}
foreach (XmlNode child in node.ChildNodes)
{
IDataNode dataNode = Kernel.Instance.ParseNode(child, this);
if (dataNode == null)
continue;
if (dataNode is AuthorNode)
authors.Add((AuthorNode)dataNode);
else if (dataNode is DatabaseReferenceNode)
references.Add((DatabaseReferenceNode)dataNode);
}
}
finally
{
Kernel.Instance.CurrentWorkingDirectory.Pop();
}
base.Parse(node);
}
}
}

View File

@ -1,63 +0,0 @@
using System;
using Prebuild.Core.Attributes;
using Prebuild.Core.Utilities;
namespace Prebuild.Core.Nodes
{
[DataNode("DatabaseReference")]
public class DatabaseReferenceNode : DataNode
{
string name;
Guid providerId;
string connectionString;
public string Name
{
get { return name; }
}
public Guid ProviderId
{
get { return providerId; }
}
public string ConnectionString
{
get { return connectionString; }
}
public override void Parse(System.Xml.XmlNode node)
{
name = Helper.AttributeValue(node, "name", name);
string providerName = Helper.AttributeValue(node, "providerName", string.Empty);
if (providerName != null)
{
switch (providerName)
{
// digitaljeebus: pulled from HKLM\SOFTWARE\Microsoft\VisualStudio\9.0\DataProviders\*
// Not sure if these will help other operating systems, or if there's a better way.
case "Microsoft.SqlServerCe.Client.3.5":
providerId = new Guid("7C602B5B-ACCB-4acd-9DC0-CA66388C1533"); break;
case "System.Data.OleDb":
providerId = new Guid("7F041D59-D76A-44ed-9AA2-FBF6B0548B80"); break;
case "System.Data.OracleClient":
providerId = new Guid("8F5C5018-AE09-42cf-B2CC-2CCCC7CFC2BB"); break;
case "System.Data.SqlClient":
providerId = new Guid("91510608-8809-4020-8897-FBA057E22D54"); break;
case "System.Data.Odbc":
providerId = new Guid("C3D4F4CE-2C48-4381-B4D6-34FA50C51C86"); break;
default:
throw new ArgumentOutOfRangeException("providerName", providerName, "Could not provider name to an id.");
}
}
else
providerId = new Guid(Helper.AttributeValue(node, "providerId", Guid.Empty.ToString("B")));
connectionString = Helper.AttributeValue(node, "connectionString", connectionString);
base.Parse(node);
}
}
}

View File

@ -23,6 +23,15 @@ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY O
*/ */
#endregion #endregion
#region CVS Information
/*
* $Source $
* $Author: $
* $Date: $
* $Revision: $
*/
#endregion
using System; using System;
using System.Collections; using System.Collections;
using System.Collections.Specialized; using System.Collections.Specialized;

View File

@ -23,6 +23,15 @@ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY O
*/ */
#endregion #endregion
#region CVS Information
/*
* $Source$
* $Author: borrillis $
* $Date: 2007-05-25 01:03:16 +0900 (Fri, 25 May 2007) $
* $Revision: 243 $
*/
#endregion
using System; using System;
using System.Xml; using System.Xml;

View File

@ -23,6 +23,15 @@ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY O
*/ */
#endregion #endregion
#region CVS Information
/*
* $Source$
* $Author: borrillis $
* $Date: 2007-05-25 01:03:16 +0900 (Fri, 25 May 2007) $
* $Revision: 243 $
*/
#endregion
using System; using System;
using System.IO; using System.IO;
using System.Xml; using System.Xml;
@ -30,7 +39,6 @@ using System.Xml;
using Prebuild.Core.Attributes; using Prebuild.Core.Attributes;
using Prebuild.Core.Interfaces; using Prebuild.Core.Interfaces;
using Prebuild.Core.Utilities; using Prebuild.Core.Utilities;
using Prebuild.Core.Targets;
namespace Prebuild.Core.Nodes namespace Prebuild.Core.Nodes
{ {
@ -85,11 +93,7 @@ namespace Prebuild.Core.Nodes
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
UserControl, UserControl
/// <summary>
///
/// </summary>
CodeBehind,
} }
public enum CopyToOutput public enum CopyToOutput
@ -109,9 +113,9 @@ namespace Prebuild.Core.Nodes
private string m_Path; private string m_Path;
private string m_ResourceName = ""; private string m_ResourceName = "";
private BuildAction? m_BuildAction; private BuildAction m_BuildAction = BuildAction.Compile;
private bool m_Valid; private bool m_Valid;
private SubType? m_SubType; private SubType m_SubType = SubType.Code;
private CopyToOutput m_CopyToOutput = CopyToOutput.Never; private CopyToOutput m_CopyToOutput = CopyToOutput.Never;
private bool m_Link = false; private bool m_Link = false;
private string m_LinkPath = string.Empty; private string m_LinkPath = string.Empty;
@ -151,11 +155,7 @@ namespace Prebuild.Core.Nodes
{ {
get get
{ {
if (m_BuildAction != null) return m_BuildAction;
return m_BuildAction.Value;
else
return GetBuildActionByFileName(this.Path);
} }
} }
@ -189,10 +189,7 @@ namespace Prebuild.Core.Nodes
{ {
get get
{ {
if (m_SubType != null) return m_SubType;
return m_SubType.Value;
else
return GetSubTypeByFileName(this.Path);
} }
} }
@ -230,13 +227,10 @@ namespace Prebuild.Core.Nodes
/// <param name="node"></param> /// <param name="node"></param>
public override void Parse(XmlNode node) public override void Parse(XmlNode node)
{ {
string buildAction = Helper.AttributeValue(node, "buildAction", String.Empty); m_BuildAction = (BuildAction)Enum.Parse(typeof(BuildAction),
if (buildAction != string.Empty) Helper.AttributeValue(node, "buildAction", m_BuildAction.ToString()));
m_BuildAction = (BuildAction)Enum.Parse(typeof(BuildAction), buildAction); m_SubType = (SubType)Enum.Parse(typeof(SubType),
string subType = Helper.AttributeValue(node, "subType", string.Empty); Helper.AttributeValue(node, "subType", m_SubType.ToString()));
if (subType != String.Empty)
m_SubType = (SubType)Enum.Parse(typeof(SubType), subType);
m_ResourceName = Helper.AttributeValue(node, "resourceName", m_ResourceName.ToString()); m_ResourceName = Helper.AttributeValue(node, "resourceName", m_ResourceName.ToString());
this.m_Link = bool.Parse(Helper.AttributeValue(node, "link", bool.FalseString)); this.m_Link = bool.Parse(Helper.AttributeValue(node, "link", bool.FalseString));
if ( this.m_Link == true ) if ( this.m_Link == true )

View File

@ -23,6 +23,15 @@ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY O
*/ */
#endregion #endregion
#region CVS Information
/*
* $Source$
* $Author: borrillis $
* $Date: 2007-05-25 01:03:16 +0900 (Fri, 25 May 2007) $
* $Revision: 243 $
*/
#endregion
using System; using System;
using System.Collections; using System.Collections;
using System.Collections.Specialized; using System.Collections.Specialized;
@ -30,7 +39,6 @@ using System.Xml;
using Prebuild.Core.Attributes; using Prebuild.Core.Attributes;
using Prebuild.Core.Interfaces; using Prebuild.Core.Interfaces;
using System.IO;
namespace Prebuild.Core.Nodes namespace Prebuild.Core.Nodes
{ {
@ -216,8 +224,8 @@ namespace Prebuild.Core.Nodes
if (!m_Files.Contains(file)) if (!m_Files.Contains(file))
{ {
m_Files.Add(file); m_Files.Add(file);
m_BuildActions[ file ] = matchNode.BuildAction == null ? GetBuildActionByFileName(file) : matchNode.BuildAction; m_BuildActions[ file ] = matchNode.BuildAction;
m_SubTypes[file] = matchNode.SubType == null ? GetSubTypeByFileName(file) : matchNode.SubType.Value; m_SubTypes[ file ] = matchNode.SubType;
m_ResourceNames[ file ] = matchNode.ResourceName; m_ResourceNames[ file ] = matchNode.ResourceName;
this.m_PreservePaths[ file ] = matchNode.PreservePath; this.m_PreservePaths[ file ] = matchNode.PreservePath;
this.m_Links[ file ] = matchNode.IsLink; this.m_Links[ file ] = matchNode.IsLink;

View File

@ -23,8 +23,16 @@ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY O
*/ */
#endregion #endregion
#region CVS Information
/*
* $Source$
* $Author: borrillis $
* $Date: 2007-05-25 01:03:16 +0900 (Fri, 25 May 2007) $
* $Revision: 243 $
*/
#endregion
using System; using System;
using System.Collections.Generic;
using System.Collections.Specialized; using System.Collections.Specialized;
using System.IO; using System.IO;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
@ -45,16 +53,29 @@ namespace Prebuild.Core.Nodes
{ {
#region Fields #region Fields
private readonly StringCollection m_Files = new StringCollection(); private StringCollection m_Files;
private Regex m_Regex; private Regex m_Regex;
private BuildAction? m_BuildAction; private BuildAction m_BuildAction = BuildAction.Compile;
private SubType? m_SubType; private SubType m_SubType = SubType.Code;
string m_ResourceName = ""; string m_ResourceName = "";
private CopyToOutput m_CopyToOutput; private CopyToOutput m_CopyToOutput;
private bool m_Link; private bool m_Link;
private string m_LinkPath; private string m_LinkPath;
private bool m_PreservePath; private bool m_PreservePath;
private readonly List<ExcludeNode> m_Exclusions = new List<ExcludeNode>(); private ArrayList m_Exclusions;
#endregion
#region Constructors
/// <summary>
///
/// </summary>
public MatchNode()
{
m_Files = new StringCollection();
m_Exclusions = new ArrayList();
}
#endregion #endregion
@ -74,7 +95,7 @@ namespace Prebuild.Core.Nodes
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
public BuildAction? BuildAction public BuildAction BuildAction
{ {
get get
{ {
@ -85,7 +106,7 @@ namespace Prebuild.Core.Nodes
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
public SubType? SubType public SubType SubType
{ {
get get
{ {
@ -146,7 +167,7 @@ namespace Prebuild.Core.Nodes
/// <param name="pattern">The pattern.</param> /// <param name="pattern">The pattern.</param>
/// <param name="recurse">if set to <c>true</c> [recurse].</param> /// <param name="recurse">if set to <c>true</c> [recurse].</param>
/// <param name="useRegex">if set to <c>true</c> [use regex].</param> /// <param name="useRegex">if set to <c>true</c> [use regex].</param>
private void RecurseDirectories(string path, string pattern, bool recurse, bool useRegex, List<ExcludeNode> exclusions) private void RecurseDirectories(string path, string pattern, bool recurse, bool useRegex, ArrayList exclusions)
{ {
Match match; Match match;
Boolean excludeFile; Boolean excludeFile;
@ -258,14 +279,10 @@ namespace Prebuild.Core.Nodes
string pattern = Helper.AttributeValue(node, "pattern", "*"); string pattern = Helper.AttributeValue(node, "pattern", "*");
bool recurse = (bool)Helper.TranslateValue(typeof(bool), Helper.AttributeValue(node, "recurse", "false")); bool recurse = (bool)Helper.TranslateValue(typeof(bool), Helper.AttributeValue(node, "recurse", "false"));
bool useRegex = (bool)Helper.TranslateValue(typeof(bool), Helper.AttributeValue(node, "useRegex", "false")); bool useRegex = (bool)Helper.TranslateValue(typeof(bool), Helper.AttributeValue(node, "useRegex", "false"));
string buildAction = Helper.AttributeValue(node, "buildAction", String.Empty); m_BuildAction = (BuildAction)Enum.Parse(typeof(BuildAction),
if (buildAction != string.Empty) Helper.AttributeValue(node, "buildAction", m_BuildAction.ToString()));
m_BuildAction = (BuildAction)Enum.Parse(typeof(BuildAction), buildAction); m_SubType = (SubType)Enum.Parse(typeof(SubType),
Helper.AttributeValue(node, "subType", m_SubType.ToString()));
//TODO: Figure out where the subtype node is being assigned
//string subType = Helper.AttributeValue(node, "subType", string.Empty);
//if (subType != String.Empty)
// m_SubType = (SubType)Enum.Parse(typeof(SubType), subType);
m_ResourceName = Helper.AttributeValue(node, "resourceName", m_ResourceName.ToString()); 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_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)); this.m_Link = bool.Parse(Helper.AttributeValue(node, "link", bool.FalseString));
@ -312,7 +329,7 @@ namespace Prebuild.Core.Nodes
if(dataNode is ExcludeNode) if(dataNode is ExcludeNode)
{ {
ExcludeNode excludeNode = (ExcludeNode)dataNode; ExcludeNode excludeNode = (ExcludeNode)dataNode;
m_Exclusions.Add( excludeNode ); m_Exclusions.Add( dataNode );
} }
} }

View File

@ -23,6 +23,17 @@ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY O
*/ */
#endregion #endregion
#region CVS Information
/*
* $Source$
* $Author: jendave $
* $Date: 2007-01-09 01:55:40 +0900 (Tue, 09 Jan 2007) $
* $Revision: 197 $
*/
#endregion
using System; using System;
using System.Collections; using System.Collections;
using System.Collections.Specialized; using System.Collections.Specialized;

View File

@ -23,6 +23,15 @@ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY O
*/ */
#endregion #endregion
#region CVS Information
/*
* $Source$
* $Author: jendave $
* $Date: 2006-01-28 09:49:58 +0900 (Sat, 28 Jan 2006) $
* $Revision: 71 $
*/
#endregion
using System; using System;
using System.Collections; using System.Collections;
using System.Collections.Specialized; using System.Collections.Specialized;

View File

@ -23,9 +23,17 @@ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY O
*/ */
#endregion #endregion
#region CVS Information
/*
* $Source$
* $Author: jendave $
* $Date: 2007-05-26 06:58:26 +0900 (Sat, 26 May 2007) $
* $Revision: 244 $
*/
#endregion
using System; using System;
using System.Collections; using System.Collections;
using System.Collections.Generic;
using System.IO; using System.IO;
using System.Xml; using System.Xml;
@ -51,11 +59,7 @@ namespace Prebuild.Core.Nodes
/// <summary> /// <summary>
/// The project is a library /// The project is a library
/// </summary> /// </summary>
Library, Library
/// <summary>
/// The project is a website
/// </summary>
Web,
} }
/// <summary> /// <summary>
@ -72,25 +76,7 @@ namespace Prebuild.Core.Nodes
/// </summary> /// </summary>
Mono Mono
} }
/// <summary>
/// The version of the .NET framework to use (Required for VS2008)
/// <remarks>We don't need .NET 1.1 in here, it'll default when using vs2003.</remarks>
/// </summary>
public enum FrameworkVersion
{
/// <summary>
/// .NET 2.0
/// </summary>
v2_0,
/// <summary>
/// .NET 3.0
/// </summary>
v3_0,
/// <summary>
/// .NET 3.5
/// </summary>
v3_5,
}
/// <summary> /// <summary>
/// The Node object representing /Prebuild/Solution/Project elements /// The Node object representing /Prebuild/Solution/Project elements
/// </summary> /// </summary>
@ -109,22 +95,35 @@ namespace Prebuild.Core.Nodes
private string m_Language = "C#"; private string m_Language = "C#";
private ProjectType m_Type = ProjectType.Exe; private ProjectType m_Type = ProjectType.Exe;
private ClrRuntime m_Runtime = ClrRuntime.Microsoft; private ClrRuntime m_Runtime = ClrRuntime.Microsoft;
private FrameworkVersion m_Framework = FrameworkVersion.v2_0;
private string m_StartupObject = ""; private string m_StartupObject = "";
private string m_RootNamespace; private string m_RootNamespace;
private string m_FilterGroups = ""; private string m_FilterGroups = "";
private string m_Version = ""; private string m_Version = "";
private Guid m_Guid; private Guid m_Guid;
private string m_DebugStartParameters;
private Hashtable m_Configurations = new Hashtable(); private Hashtable m_Configurations;
private readonly List<ReferencePathNode> m_ReferencePaths = new List<ReferencePathNode>(); private ArrayList m_ReferencePaths;
private readonly List<ReferenceNode> m_References = new List<ReferenceNode>(); private ArrayList m_References;
private readonly List<AuthorNode> m_Authors = new List<AuthorNode>(); private ArrayList m_Authors;
private FilesNode m_Files; private FilesNode m_Files;
#endregion #endregion
#region Constructors
/// <summary>
/// Initializes a new instance of the <see cref="ProjectNode"/> class.
/// </summary>
public ProjectNode()
{
m_Configurations = new Hashtable();
m_ReferencePaths = new ArrayList();
m_References = new ArrayList();
m_Authors = new ArrayList();
}
#endregion
#region Properties #region Properties
/// <summary> /// <summary>
@ -135,19 +134,10 @@ namespace Prebuild.Core.Nodes
{ {
get get
{ {
return m_Name; return m_Name;
}
}
/// <summary>
/// The version of the .NET Framework to compile under
/// </summary>
public FrameworkVersion FrameworkVersion
{
get
{
return this.m_Framework;
} }
} }
/// <summary> /// <summary>
/// Gets the path. /// Gets the path.
/// </summary> /// </summary>
@ -220,17 +210,17 @@ namespace Prebuild.Core.Nodes
} }
} }
/// <summary> /// <summary>
/// Gets the app icon. /// Gets the app icon.
/// </summary> /// </summary>
/// <value>The app icon.</value> /// <value>The app icon.</value>
public string ConfigFile public string ConfigFile
{ {
get get
{ {
return m_ConfigFile; return m_ConfigFile;
} }
} }
/// <summary> /// <summary>
/// ///
@ -279,22 +269,22 @@ namespace Prebuild.Core.Nodes
} }
} }
private bool m_GenerateAssemblyInfoFile = false; private bool m_GenerateAssemblyInfoFile = false;
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
public bool GenerateAssemblyInfoFile public bool GenerateAssemblyInfoFile
{ {
get get
{ {
return m_GenerateAssemblyInfoFile; return m_GenerateAssemblyInfoFile;
} }
set set
{ {
m_GenerateAssemblyInfoFile = value; m_GenerateAssemblyInfoFile = value;
} }
} }
/// <summary> /// <summary>
/// Gets the startup object. /// Gets the startup object.
@ -324,7 +314,7 @@ namespace Prebuild.Core.Nodes
/// Gets the configurations. /// Gets the configurations.
/// </summary> /// </summary>
/// <value>The configurations.</value> /// <value>The configurations.</value>
public IList Configurations public ICollection Configurations
{ {
get get
{ {
@ -350,11 +340,11 @@ namespace Prebuild.Core.Nodes
/// Gets the reference paths. /// Gets the reference paths.
/// </summary> /// </summary>
/// <value>The reference paths.</value> /// <value>The reference paths.</value>
public List<ReferencePathNode> ReferencePaths public ArrayList ReferencePaths
{ {
get get
{ {
List<ReferencePathNode> tmp = new List<ReferencePathNode>(m_ReferencePaths); ArrayList tmp = new ArrayList(m_ReferencePaths);
tmp.Sort(); tmp.Sort();
return tmp; return tmp;
} }
@ -364,11 +354,11 @@ namespace Prebuild.Core.Nodes
/// Gets the references. /// Gets the references.
/// </summary> /// </summary>
/// <value>The references.</value> /// <value>The references.</value>
public List<ReferenceNode> References public ArrayList References
{ {
get get
{ {
List<ReferenceNode> tmp = new List<ReferenceNode>(m_References); ArrayList tmp = new ArrayList(m_References);
tmp.Sort(); tmp.Sort();
return tmp; return tmp;
} }
@ -378,7 +368,7 @@ namespace Prebuild.Core.Nodes
/// Gets the Authors list. /// Gets the Authors list.
/// </summary> /// </summary>
/// <value>The list of the project's authors.</value> /// <value>The list of the project's authors.</value>
public List<AuthorNode> Authors public ArrayList Authors
{ {
get get
{ {
@ -434,15 +424,7 @@ namespace Prebuild.Core.Nodes
} }
} }
public string DebugStartParameters #endregion
{
get
{
return m_DebugStartParameters;
}
}
#endregion
#region Private Methods #region Private Methods
@ -488,18 +470,13 @@ namespace Prebuild.Core.Nodes
m_Language = Helper.AttributeValue(node, "language", m_Language); m_Language = Helper.AttributeValue(node, "language", m_Language);
m_Type = (ProjectType)Helper.EnumAttributeValue(node, "type", typeof(ProjectType), m_Type); m_Type = (ProjectType)Helper.EnumAttributeValue(node, "type", typeof(ProjectType), m_Type);
m_Runtime = (ClrRuntime)Helper.EnumAttributeValue(node, "runtime", typeof(ClrRuntime), m_Runtime); m_Runtime = (ClrRuntime)Helper.EnumAttributeValue(node, "runtime", typeof(ClrRuntime), m_Runtime);
m_Framework = (FrameworkVersion)Helper.EnumAttributeValue(node, "frameworkVersion", typeof(FrameworkVersion), m_Framework);
m_StartupObject = Helper.AttributeValue(node, "startupObject", m_StartupObject); m_StartupObject = Helper.AttributeValue(node, "startupObject", m_StartupObject);
m_RootNamespace = Helper.AttributeValue(node, "rootNamespace", m_RootNamespace); m_RootNamespace = Helper.AttributeValue(node, "rootNamespace", m_RootNamespace);
int hash = m_Name.GetHashCode();
Guid guidByHash = new Guid(hash, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
string guid = Helper.AttributeValue(node, "guid", guidByHash.ToString());
m_Guid = new Guid(guid);
m_GenerateAssemblyInfoFile = Helper.ParseBoolean(node, "generateAssemblyInfoFile", false); m_GenerateAssemblyInfoFile = Helper.ParseBoolean(node, "generateAssemblyInfoFile", false);
m_DebugStartParameters = Helper.AttributeValue(node, "debugStartParameters", string.Empty);
int hash = m_Name.GetHashCode();
m_Guid = new Guid(hash, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
if(m_AssemblyName == null || m_AssemblyName.Length < 1) if(m_AssemblyName == null || m_AssemblyName.Length < 1)
{ {
m_AssemblyName = m_Name; m_AssemblyName = m_Name;
@ -539,15 +516,15 @@ namespace Prebuild.Core.Nodes
} }
else if(dataNode is ReferencePathNode) else if(dataNode is ReferencePathNode)
{ {
m_ReferencePaths.Add((ReferencePathNode)dataNode); m_ReferencePaths.Add(dataNode);
} }
else if(dataNode is ReferenceNode) else if(dataNode is ReferenceNode)
{ {
m_References.Add((ReferenceNode)dataNode); m_References.Add(dataNode);
} }
else if(dataNode is AuthorNode) else if(dataNode is AuthorNode)
{ {
m_Authors.Add((AuthorNode)dataNode); m_Authors.Add(dataNode);
} }
else if(dataNode is FilesNode) else if(dataNode is FilesNode)
{ {
@ -571,6 +548,6 @@ namespace Prebuild.Core.Nodes
return this.m_Name.CompareTo(that.m_Name); return this.m_Name.CompareTo(that.m_Name);
} }
#endregion #endregion
} }
} }

View File

@ -23,6 +23,15 @@ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY O
*/ */
#endregion #endregion
#region CVS Information
/*
* $Source$
* $Author: jendave $
* $Date: 2006-07-26 01:56:49 +0900 (Wed, 26 Jul 2006) $
* $Revision: 132 $
*/
#endregion
using System; using System;
using System.Xml; using System.Xml;

View File

@ -23,6 +23,15 @@ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY O
*/ */
#endregion #endregion
#region CVS Information
/*
* $Source$
* $Author: jendave $
* $Date: 2006-01-28 09:49:58 +0900 (Sat, 28 Jan 2006) $
* $Revision: 71 $
*/
#endregion
using System; using System;
using System.Collections; using System.Collections;
using System.Collections.Specialized; using System.Collections.Specialized;

View File

@ -23,9 +23,17 @@ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY O
*/ */
#endregion #endregion
#region CVS Information
/*
* $Source$
* $Author: jendave $
* $Date: 2006-03-01 01:15:42 +0900 (Wed, 01 Mar 2006) $
* $Revision: 92 $
*/
#endregion
using System; using System;
using System.Collections; using System.Collections;
using System.Collections.Generic;
using System.Diagnostics; using System.Diagnostics;
using System.IO; using System.IO;
using System.Xml; using System.Xml;
@ -40,62 +48,40 @@ namespace Prebuild.Core.Nodes
/// ///
/// </summary> /// </summary>
[DataNode("Solution")] [DataNode("Solution")]
[DataNode("EmbeddedSolution")]
[DebuggerDisplay("{Name}")]
public class SolutionNode : DataNode public class SolutionNode : DataNode
{ {
#region Fields #region Fields
private Guid m_Guid = Guid.NewGuid();
private string m_Name = "unknown"; private string m_Name = "unknown";
private string m_Path = ""; private string m_Path = "";
private string m_FullPath = ""; private string m_FullPath = "";
private string m_ActiveConfig = "Debug"; private string m_ActiveConfig = "Debug";
private string m_Version = "1.0.0"; private string m_Version = "1.0.0";
private OptionsNode m_Options; private OptionsNode m_Options;
private FilesNode m_Files; private FilesNode m_Files;
private readonly Hashtable m_Configurations = new Hashtable(); private Hashtable m_Configurations;
private readonly Hashtable m_Projects = new Hashtable(); private Hashtable m_Projects;
private readonly Hashtable m_DatabaseProjects = new Hashtable(); private ArrayList m_ProjectsOrder;
private readonly List<ProjectNode> m_ProjectsOrder = new List<ProjectNode>();
private readonly Hashtable m_Solutions = new Hashtable(); #endregion
#region Constructors
/// <summary>
/// Initializes a new instance of the <see cref="SolutionNode"/> class.
/// </summary>
public SolutionNode()
{
m_Configurations = new Hashtable();
m_Projects = new Hashtable();
m_ProjectsOrder = new ArrayList();
}
#endregion #endregion
#region Properties #region Properties
public override IDataNode Parent
{
get
{
return base.Parent;
}
set
{
if (value is SolutionNode)
{
SolutionNode solution = (SolutionNode)value;
foreach (ConfigurationNode conf in solution.Configurations)
{
m_Configurations[conf.Name] = conf.Clone();
}
}
base.Parent = value;
}
}
public Guid Guid
{
get
{
return m_Guid;
}
set
{
m_Guid = value;
}
}
/// <summary> /// <summary>
/// Gets or sets the active config. /// Gets or sets the active config.
/// </summary> /// </summary>
@ -209,36 +195,7 @@ namespace Prebuild.Core.Nodes
return m_Configurations; return m_Configurations;
} }
} }
/// <summary>
/// Gets the database projects.
/// </summary>
public ICollection DatabaseProjects
{
get
{
return m_DatabaseProjects.Values;
}
}
/// <summary>
/// Gets the nested solutions.
/// </summary>
public ICollection Solutions
{
get
{
return m_Solutions.Values;
}
}
/// <summary>
/// Gets the nested solutions hash table.
/// </summary>
public Hashtable SolutionsTable
{
get
{
return this.m_Solutions;
}
}
/// <summary> /// <summary>
/// Gets the projects. /// Gets the projects.
/// </summary> /// </summary>
@ -269,7 +226,7 @@ namespace Prebuild.Core.Nodes
/// Gets the projects table. /// Gets the projects table.
/// </summary> /// </summary>
/// <value>The projects table.</value> /// <value>The projects table.</value>
public List<ProjectNode> ProjectsTableOrder public ArrayList ProjectsTableOrder
{ {
get get
{ {
@ -330,21 +287,8 @@ namespace Prebuild.Core.Nodes
else if(dataNode is ProjectNode) else if(dataNode is ProjectNode)
{ {
m_Projects[((ProjectNode)dataNode).Name] = dataNode; m_Projects[((ProjectNode)dataNode).Name] = dataNode;
m_ProjectsOrder.Add((ProjectNode)dataNode); m_ProjectsOrder.Add(dataNode);
} }
else if(dataNode is SolutionNode)
{
m_Solutions[((SolutionNode)dataNode).Name] = dataNode;
}
else if (dataNode is ProcessNode)
{
ProcessNode p = (ProcessNode)dataNode;
Kernel.Instance.ProcessFile(p, this);
}
else if (dataNode is DatabaseProjectNode)
{
m_DatabaseProjects[((DatabaseProjectNode)dataNode).Name] = dataNode;
}
} }
} }
finally finally

View File

@ -23,6 +23,15 @@ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY O
*/ */
#endregion #endregion
#region CVS Information
/*
* $Source$
* $Author: jendave $
* $Date: 2006-01-28 09:49:58 +0900 (Sat, 28 Jan 2006) $
* $Revision: 71 $
*/
#endregion
using System; using System;
namespace Prebuild.Core.Parse namespace Prebuild.Core.Parse

View File

@ -23,10 +23,18 @@ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY O
*/ */
#endregion #endregion
#region CVS Information
/*
* $Source$
* $Author: jendave $
* $Date: 2007-04-26 17:10:27 +0900 (Thu, 26 Apr 2007) $
* $Revision: 236 $
*/
#endregion
using System; using System;
using System.Collections; using System.Collections;
using System.IO; using System.IO;
using System.Text.RegularExpressions;
using System.Xml; using System.Xml;
namespace Prebuild.Core.Parse namespace Prebuild.Core.Parse
@ -71,16 +79,6 @@ namespace Prebuild.Core.Parse
/// </summary> /// </summary>
public class Preprocessor public class Preprocessor
{ {
#region Constants
/// <summary>
/// Includes the regex to look for file tags in the <?include
/// ?> processing instruction.
/// </summary>
private static readonly Regex includeFileRegex = new Regex("file=\"(.+?)\"");
#endregion
#region Fields #region Fields
XmlDocument m_OutDoc; XmlDocument m_OutDoc;
@ -140,10 +138,10 @@ namespace Prebuild.Core.Parse
return "Win32"; return "Win32";
} }
if (File.Exists("/System/Library/Frameworks/Cocoa.framework/Cocoa")) if (File.Exists("/System/Library/Frameworks/Cocoa.framework/Cocoa"))
{ {
return "MACOSX"; return "MACOSX";
} }
/* /*
* .NET 1.x, under Mono, the UNIX code is 128. Under * .NET 1.x, under Mono, the UNIX code is 128. Under
@ -238,7 +236,7 @@ namespace Prebuild.Core.Parse
OperatorSymbol oper = OperatorSymbol.None; OperatorSymbol oper = OperatorSymbol.None;
bool inStr = false; bool inStr = false;
char c; char c;
for(int i = 0; i < exp.Length; i++) for(int i = 0; i < exp.Length; i++)
{ {
c = exp[i]; c = exp[i];
@ -285,7 +283,7 @@ namespace Prebuild.Core.Parse
{ {
oper = OperatorSymbol.NotEqual; oper = OperatorSymbol.NotEqual;
} }
break; break;
case '<': case '<':
@ -297,7 +295,7 @@ namespace Prebuild.Core.Parse
{ {
oper = OperatorSymbol.LessThan; oper = OperatorSymbol.LessThan;
} }
break; break;
case '>': case '>':
@ -316,7 +314,7 @@ namespace Prebuild.Core.Parse
} }
} }
if(inStr) if(inStr)
{ {
throw new WarningException("Expected end of string in expression"); throw new WarningException("Expected end of string in expression");
@ -394,9 +392,9 @@ namespace Prebuild.Core.Parse
/// <exception cref="ArgumentException">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</exception> /// <exception cref="ArgumentException">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</exception>
/// <param name="reader"></param> /// <param name="reader"></param>
/// <returns>the output xml </returns> /// <returns>the output xml </returns>
public string Process(XmlReader initialReader) public string Process(XmlReader reader)
{ {
if(initialReader == null) if(reader == null)
{ {
throw new ArgumentException("Invalid XML reader to pre-process"); throw new ArgumentException("Invalid XML reader to pre-process");
} }
@ -405,175 +403,119 @@ namespace Prebuild.Core.Parse
StringWriter xmlText = new StringWriter(); StringWriter xmlText = new StringWriter();
XmlTextWriter writer = new XmlTextWriter(xmlText); XmlTextWriter writer = new XmlTextWriter(xmlText);
writer.Formatting = Formatting.Indented; writer.Formatting = Formatting.Indented;
while(reader.Read())
// Create a queue of XML readers and add the initial
// reader to it. Then we process until we run out of
// readers which lets the <?include?> operation add more
// readers to generate a multi-file parser and not require
// XML fragments that a recursive version would use.
Stack readerStack = new Stack();
readerStack.Push(initialReader);
while(readerStack.Count > 0)
{ {
// Pop off the next reader. if(reader.NodeType == XmlNodeType.ProcessingInstruction)
XmlReader reader = (XmlReader) readerStack.Pop();
// Process through this XML reader until it is
// completed (or it is replaced by the include
// operation).
while(reader.Read())
{ {
// The prebuild file has a series of processing bool ignore = false;
// instructions which allow for specific switch(reader.LocalName)
// inclusions based on operating system or to
// include additional files.
if(reader.NodeType == XmlNodeType.ProcessingInstruction)
{ {
bool ignore = false; case "if":
m_IfStack.Push(context);
context = new IfContext(context.Keep & context.Active, ParseExpression(reader.Value), IfState.If);
ignore = true;
break;
switch(reader.LocalName) case "elseif":
{ if(m_IfStack.Count == 0)
case "include": {
// use regular expressions to parse out the attributes. throw new WarningException("Unexpected 'elseif' outside of 'if'");
MatchCollection matches = includeFileRegex.Matches(reader.Value); }
else if(context.State != IfState.If && context.State != IfState.ElseIf)
// make sure there is only one file attribute. {
if(matches.Count > 1) throw new WarningException("Unexpected 'elseif' outside of 'if'");
{ }
throw new WarningException("An <?include ?> node was found, but it specified more than one file.");
}
if(matches.Count == 0) context.State = IfState.ElseIf;
{ if(!context.EverKept)
throw new WarningException("An <?include ?> node was found, but it did not specify the file attribute."); {
} context.Keep = ParseExpression(reader.Value);
}
// Pull the file out from the regex and make sure it is a valid file before using it. else
string filename = matches[0].Groups[1].Value; {
FileInfo includeFile = new FileInfo(filename); context.Keep = false;
}
if(!includeFile.Exists) ignore = true;
{ break;
throw new WarningException("Cannot include file: " + includeFile.FullName);
}
// Create a new reader object for this file. Then put the old reader back on the stack and start case "else":
// processing using this new XML reader. if(m_IfStack.Count == 0)
XmlReader newReader = new XmlTextReader(includeFile.Open(FileMode.Open, FileAccess.Read, FileShare.Read)); {
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'");
}
readerStack.Push(reader); context.State = IfState.Else;
reader = newReader; context.Keep = !context.EverKept;
ignore = true; ignore = true;
break; break;
case "if": case "endif":
m_IfStack.Push(context); if(m_IfStack.Count == 0)
context = new IfContext(context.Keep & context.Active, ParseExpression(reader.Value), IfState.If); {
ignore = true; throw new WarningException("Unexpected 'endif' outside of 'if'");
break; }
case "elseif": context = (IfContext)m_IfStack.Pop();
if(m_IfStack.Count == 0) ignore = true;
{ break;
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(ignore)
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; continue;
} }
}//end pre-proc instruction
switch(reader.NodeType) if(!context.Active || !context.Keep)
{ {
case XmlNodeType.Element: continue;
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) switch(reader.NodeType)
{ {
throw new WarningException("Mismatched 'if', 'endif' pair"); 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(); return xmlText.ToString();
} }

View File

@ -65,9 +65,18 @@ POSSIBILITY OF SUCH DAMAGE.
*/ */
#endregion #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;
using System.Collections; using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized; using System.Collections.Specialized;
using System.IO; using System.IO;
using System.Reflection; using System.Reflection;
@ -173,7 +182,8 @@ namespace Prebuild.Core.Targets
Hashtable assemblyPathToPackage = new Hashtable(); Hashtable assemblyPathToPackage = new Hashtable();
Hashtable assemblyFullNameToPath = new Hashtable(); Hashtable assemblyFullNameToPath = new Hashtable();
Hashtable packagesHash = new Hashtable(); Hashtable packagesHash = new Hashtable();
readonly List<SystemPackage> packages = new List<SystemPackage>(); ArrayList packages = new ArrayList();
ClrVersion currentVersion;
#endregion #endregion
@ -193,6 +203,22 @@ namespace Prebuild.Core.Targets
di.Create(); di.Create();
} }
private void mkStubFiles(string dirName, ArrayList fileNames)
{
for (int i = 0; i < fileNames.Count; i++)
{
string tmpFile = dirName + "/" + (string)fileNames[i];
FileStream tmpFileStream =
new FileStream(tmpFile, FileMode.Create);
StreamWriter sw = new StreamWriter(tmpFileStream);
sw.WriteLine("These are not the files you are looking for.");
sw.Flush();
tmpFileStream.Close();
}
}
private void chkMkDir(string dirName) private void chkMkDir(string dirName)
{ {
System.IO.DirectoryInfo di = System.IO.DirectoryInfo di =
@ -247,11 +273,11 @@ namespace Prebuild.Core.Targets
} }
} }
private List<string> GetAssembliesWithLibInfo(string line, string file) private ArrayList GetAssembliesWithLibInfo(string line, string file)
{ {
List<string> references = new List<string>(); ArrayList references = new ArrayList();
List<string> libdirs = new List<string>(); ArrayList libdirs = new ArrayList();
List<string> retval = new List<string>(); ArrayList retval = new ArrayList();
foreach (string piece in line.Split(' ')) foreach (string piece in line.Split(' '))
{ {
if (piece.ToLower().Trim().StartsWith("/r:") || piece.ToLower().Trim().StartsWith("-r:")) if (piece.ToLower().Trim().StartsWith("/r:") || piece.ToLower().Trim().StartsWith("-r:"))
@ -278,9 +304,9 @@ namespace Prebuild.Core.Targets
return retval; return retval;
} }
private List<string> GetAssembliesWithoutLibInfo(string line, string file) private ArrayList GetAssembliesWithoutLibInfo(string line, string file)
{ {
List<string> references = new List<string>(); ArrayList references = new ArrayList();
foreach (string reference in line.Split(' ')) foreach (string reference in line.Split(' '))
{ {
if (reference.ToLower().Trim().StartsWith("/r:") || reference.ToLower().Trim().StartsWith("-r:")) if (reference.ToLower().Trim().StartsWith("/r:") || reference.ToLower().Trim().StartsWith("-r:"))
@ -330,7 +356,7 @@ namespace Prebuild.Core.Targets
if (packagesHash.Contains(pname)) if (packagesHash.Contains(pname))
return; return;
List<string> fullassemblies = null; ArrayList fullassemblies = null;
string version = ""; string version = "";
string desc = ""; string desc = "";
@ -378,7 +404,7 @@ namespace Prebuild.Core.Targets
package.Initialize(pname, package.Initialize(pname,
version, version,
desc, desc,
fullassemblies.ToArray(), (string[])fullassemblies.ToArray(typeof(string)),
ClrVersion.Default, ClrVersion.Default,
false); false);
packages.Add(package); packages.Add(package);
@ -388,7 +414,7 @@ namespace Prebuild.Core.Targets
void RegisterSystemAssemblies(string prefix, string version, ClrVersion ver) void RegisterSystemAssemblies(string prefix, string version, ClrVersion ver)
{ {
SystemPackage package = new SystemPackage(); SystemPackage package = new SystemPackage();
List<string> list = new List<string>(); ArrayList list = new ArrayList();
string dir = Path.Combine(prefix, version); string dir = Path.Combine(prefix, version);
if (!Directory.Exists(dir)) if (!Directory.Exists(dir))
@ -405,7 +431,7 @@ namespace Prebuild.Core.Targets
package.Initialize("mono", package.Initialize("mono",
version, version,
"The Mono runtime", "The Mono runtime",
list.ToArray(), (string[])list.ToArray(typeof(string)),
ver, ver,
false); false);
packages.Add(package); packages.Add(package);
@ -418,10 +444,12 @@ namespace Prebuild.Core.Targets
if (Environment.Version.Major == 1) if (Environment.Version.Major == 1)
{ {
versionDir = "1.0"; versionDir = "1.0";
currentVersion = ClrVersion.Net_1_1;
} }
else else
{ {
versionDir = "2.0"; versionDir = "2.0";
currentVersion = ClrVersion.Net_2_0;
} }
//Pull up assemblies from the installed mono system. //Pull up assemblies from the installed mono system.
@ -455,9 +483,9 @@ namespace Prebuild.Core.Targets
} }
} }
search_dirs += Path.PathSeparator + libpath; search_dirs += Path.PathSeparator + libpath;
if (!string.IsNullOrEmpty(search_dirs)) if (search_dirs != null && search_dirs.Length > 0)
{ {
List<string> scanDirs = new List<string>(); ArrayList scanDirs = new ArrayList();
foreach (string potentialDir in search_dirs.Split(Path.PathSeparator)) foreach (string potentialDir in search_dirs.Split(Path.PathSeparator))
{ {
if (!scanDirs.Contains(potentialDir)) if (!scanDirs.Contains(potentialDir))
@ -735,22 +763,20 @@ namespace Prebuild.Core.Targets
bool hasAssemblyConfig = false; bool hasAssemblyConfig = false;
chkMkDir(projectDir); chkMkDir(projectDir);
List<string> ArrayList
compiledFiles = new List<string>(), compiledFiles = new ArrayList(),
contentFiles = new List<string>(), contentFiles = new ArrayList(),
embeddedFiles = new List<string>(), embeddedFiles = new ArrayList(),
binaryLibs = new List<string>(), binaryLibs = new ArrayList(),
pkgLibs = new List<string>(), pkgLibs = new ArrayList(),
systemLibs = new List<string>(), systemLibs = new ArrayList(),
runtimeLibs = new List<string>(), runtimeLibs = new ArrayList(),
extraDistFiles = new List<string>(), extraDistFiles = new ArrayList(),
localCopyTargets = new List<string>(); localCopyTargets = new ArrayList();
// If there exists a .config file for this assembly, copy
// it to the project folder
// If there exists a .config file for this assembly, copy it to the project folder
// TODO: Support copying .config.osx files // TODO: Support copying .config.osx files
// TODO: support processing the .config file for native library deps // TODO: support processing the .config file for native library deps
string projectAssemblyName = project.Name; string projectAssemblyName = project.Name;
@ -813,15 +839,11 @@ namespace Prebuild.Core.Targets
foreach (System.CodeDom.Compiler.CompilerError error in cr.Errors) foreach (System.CodeDom.Compiler.CompilerError error in cr.Errors)
Console.WriteLine("Error! '{0}'", error.ErrorText); Console.WriteLine("Error! '{0}'", error.ErrorText);
try { string projectFullName = cr.CompiledAssembly.FullName;
string projectFullName = cr.CompiledAssembly.FullName; Regex verRegex = new Regex("Version=([\\d\\.]+)");
Regex verRegex = new Regex("Version=([\\d\\.]+)"); Match verMatch = verRegex.Match(projectFullName);
Match verMatch = verRegex.Match(projectFullName); if (verMatch.Success)
if (verMatch.Success)
projectVersion = verMatch.Groups[1].Value; projectVersion = verMatch.Groups[1].Value;
}catch{
Console.WriteLine("Couldn't compile AssemblyInfo.cs");
}
// Clean up the temp file // Clean up the temp file
try try
@ -831,7 +853,7 @@ namespace Prebuild.Core.Targets
} }
catch catch
{ {
Console.WriteLine("Error! '{0}'", e.ToString()); //Console.WriteLine("Error! '{0}'", e.ToString());
} }
} }
@ -991,46 +1013,46 @@ namespace Prebuild.Core.Targets
} }
} }
const string lineSep = " \\\n\t"; string lineSep = " \\\n\t";
string compiledFilesString = string.Empty; string compiledFilesString = string.Empty;
if (compiledFiles.Count > 0) if (compiledFiles.Count > 0)
compiledFilesString = compiledFilesString =
lineSep + string.Join(lineSep, compiledFiles.ToArray()); lineSep + string.Join(lineSep, (string[])compiledFiles.ToArray(typeof(string)));
string embeddedFilesString = ""; string embeddedFilesString = "";
if (embeddedFiles.Count > 0) if (embeddedFiles.Count > 0)
embeddedFilesString = embeddedFilesString =
lineSep + string.Join(lineSep, embeddedFiles.ToArray()); lineSep + string.Join(lineSep, (string[])embeddedFiles.ToArray(typeof(string)));
string contentFilesString = ""; string contentFilesString = "";
if (contentFiles.Count > 0) if (contentFiles.Count > 0)
contentFilesString = contentFilesString =
lineSep + string.Join(lineSep, contentFiles.ToArray()); lineSep + string.Join(lineSep, (string[])contentFiles.ToArray(typeof(string)));
string extraDistFilesString = ""; string extraDistFilesString = "";
if (extraDistFiles.Count > 0) if (extraDistFiles.Count > 0)
extraDistFilesString = extraDistFilesString =
lineSep + string.Join(lineSep, extraDistFiles.ToArray()); lineSep + string.Join(lineSep, (string[])extraDistFiles.ToArray(typeof(string)));
string pkgLibsString = ""; string pkgLibsString = "";
if (pkgLibs.Count > 0) if (pkgLibs.Count > 0)
pkgLibsString = pkgLibsString =
lineSep + string.Join(lineSep, pkgLibs.ToArray()); lineSep + string.Join(lineSep, (string[])pkgLibs.ToArray(typeof(string)));
string binaryLibsString = ""; string binaryLibsString = "";
if (binaryLibs.Count > 0) if (binaryLibs.Count > 0)
binaryLibsString = binaryLibsString =
lineSep + string.Join(lineSep, binaryLibs.ToArray()); lineSep + string.Join(lineSep, (string[])binaryLibs.ToArray(typeof(string)));
string systemLibsString = ""; string systemLibsString = "";
if (systemLibs.Count > 0) if (systemLibs.Count > 0)
systemLibsString = systemLibsString =
lineSep + string.Join(lineSep, systemLibs.ToArray()); lineSep + string.Join(lineSep, (string[])systemLibs.ToArray(typeof(string)));
string localCopyTargetsString = ""; string localCopyTargetsString = "";
if (localCopyTargets.Count > 0) if (localCopyTargets.Count > 0)
localCopyTargetsString = localCopyTargetsString =
string.Join("\n", localCopyTargets.ToArray()); string.Join("\n", (string[])localCopyTargets.ToArray(typeof(string)));
string monoPath = ""; string monoPath = "";
foreach (string runtimeLib in runtimeLibs) foreach (string runtimeLib in runtimeLibs)

View File

@ -27,7 +27,7 @@ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY O
/* /*
* $Source$ * $Source$
* $Author: jendave $ * $Author: jendave $
* $Date: 2006-09-20 09:42:51 +0200 (on, 20 sep 2006) $ * $Date: 2006-09-20 16:42:51 +0900 (Wed, 20 Sep 2006) $
* $Revision: 164 $ * $Revision: 164 $
*/ */
#endregion #endregion

View File

@ -23,6 +23,15 @@ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY O
*/ */
#endregion #endregion
#region CVS Information
/*
* $Source$
* $Author: cjcollier $
* $Date: 2007-04-11 07:10:35 +0900 (Wed, 11 Apr 2007) $
* $Revision: 231 $
*/
#endregion
using System; using System;
using System.Collections; using System.Collections;
using System.Collections.Specialized; using System.Collections.Specialized;

View File

@ -1,9 +1,9 @@
#region BSD License #region BSD License
/* /*
Copyright (c) 2004 - 2008 Copyright (c) 2004 - 2008
Matthew Holmes (matthew@wildfiregames.com), Matthew Holmes (matthew@wildfiregames.com),
Dan Moorehead (dan05a@gmail.com), Dan Moorehead (dan05a@gmail.com),
C.J. Adams-Collier (cjac@colliertech.org), C.J. Adams-Collier (cjac@colliertech.org),
Redistribution and use in source and binary forms, with or without Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are modification, are permitted provided that the following conditions are
@ -35,6 +35,15 @@ POSSIBILITY OF SUCH DAMAGE.
#endregion #endregion
#region CVS Information
/*
* $Source$
* $Author: cjcollier $
* $Date: 2008-02-07 10:22:36 +0900 (Thu, 07 Feb 2008) $
* $Revision: 255 $
*/
#endregion
using System; using System;
using System.Collections; using System.Collections;
using System.Collections.Specialized; using System.Collections.Specialized;
@ -49,73 +58,85 @@ using Prebuild.Core.Utilities;
namespace Prebuild.Core.Targets namespace Prebuild.Core.Targets
{ {
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
[Target("nant")] [Target("nant")]
public class NAntTarget : ITarget public class NAntTarget : ITarget
{ {
#region Fields #region Fields
private Kernel m_Kernel; private Kernel m_Kernel;
#endregion #endregion
#region Private Methods #region Private Methods
private static string PrependPath(string path) private static string PrependPath(string path)
{ {
string tmpPath = Helper.NormalizePath(path, '/'); string tmpPath = Helper.NormalizePath(path, '/');
Regex regex = new Regex(@"(\w):/(\w+)"); Regex regex = new Regex(@"(\w):/(\w+)");
Match match = regex.Match(tmpPath); Match match = regex.Match(tmpPath);
//if(match.Success || tmpPath[0] == '.' || tmpPath[0] == '/') //if(match.Success || tmpPath[0] == '.' || tmpPath[0] == '/')
//{ //{
tmpPath = Helper.NormalizePath(tmpPath); tmpPath = Helper.NormalizePath(tmpPath);
//} //}
// else // else
// { // {
// tmpPath = Helper.NormalizePath("./" + tmpPath); // tmpPath = Helper.NormalizePath("./" + tmpPath);
// } // }
return tmpPath; return tmpPath;
} }
private static string BuildReference(SolutionNode solution, ProjectNode currentProject, ReferenceNode refr) private static string BuildReference(SolutionNode solution, ProjectNode currentProject, ReferenceNode refr)
{ {
string ret = "";
string referencePath = ((ReferencePathNode)currentProject.ReferencePaths[0]).Path;
if (!String.IsNullOrEmpty(refr.Path)) if (String.IsNullOrEmpty(refr.Path))
{
if (solution.ProjectsTable.ContainsKey(refr.Name))
{
ProjectNode project = (ProjectNode) solution.ProjectsTable[refr.Name];
string finalPath =
Helper.NormalizePath(referencePath + refr.Name + GetProjectExtension(project), '/');
return finalPath;
}
else
{
ProjectNode project = (ProjectNode) refr.Parent;
// Do we have an explicit file reference?
string fileRef = FindFileReference(refr.Name, project);
if (fileRef != null)
{
return fileRef;
}
// Is there an explicit path in the project ref?
if (refr.Path != null)
{
return Helper.NormalizePath(refr.Path + "/" + refr.Name + GetProjectExtension(project), '/');
}
// Is it a specified extension (dll or exe?)
if (ExtensionSpecified(refr.Name))
{
return Helper.NormalizePath(referencePath + GetRefFileName(refr.Name), '/');
}
// No, it's an extensionless GAC ref, but nant needs the .dll extension anyway
return refr.Name + ".dll";
}
}
else
{ {
return refr.Path; return refr.Path;
} }
if (solution.ProjectsTable.ContainsKey(refr.Name))
{
ProjectNode projectRef = (ProjectNode) solution.ProjectsTable[refr.Name];
string finalPath =
Helper.NormalizePath(refr.Name + GetProjectExtension(projectRef), '/');
return finalPath;
}
ProjectNode project = (ProjectNode) refr.Parent;
// Do we have an explicit file reference?
string fileRef = FindFileReference(refr.Name, project);
if (fileRef != null)
{
return fileRef;
}
// Is there an explicit path in the project ref?
if (refr.Path != null)
{
return Helper.NormalizePath(refr.Path + "/" + refr.Name + GetProjectExtension(project), '/');
}
// No, it's an extensionless GAC ref, but nant needs the .dll extension anyway
return refr.Name + ".dll";
} }
public static string GetRefFileName(string refName) public static string GetRefFileName(string refName)
{ {
if (ExtensionSpecified(refName)) if (ExtensionSpecified(refName))
{ {
@ -123,7 +144,7 @@ namespace Prebuild.Core.Targets
} }
else else
{ {
return refName + ".dll"; return refName + ".dll";
} }
} }
@ -135,235 +156,268 @@ namespace Prebuild.Core.Targets
private static string GetProjectExtension(ProjectNode project) private static string GetProjectExtension(ProjectNode project)
{ {
string extension = ".dll"; string extension = ".dll";
if (project.Type == ProjectType.Exe || project.Type == ProjectType.WinExe) if (project.Type == ProjectType.Exe)
{ {
extension = ".exe"; extension = ".exe";
} }
return extension; return extension;
} }
private static string FindFileReference(string refName, ProjectNode project) //private static string BuildReferencePath(SolutionNode solution, ReferenceNode refr)
{ //{
foreach (ReferencePathNode refPath in project.ReferencePaths) // string ret = "";
{ // if (solution.ProjectsTable.ContainsKey(refr.Name))
string fullPath = Helper.MakeFilePath(refPath.Path, refName); // {
// ProjectNode project = (ProjectNode)solution.ProjectsTable[refr.Name];
// string finalPath = Helper.NormalizePath(((ReferencePathNode)project.ReferencePaths[0]).Path, '/');
// return finalPath;
// }
// else
// {
// if (refr.Path == null)
// {
// 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 += "";
// }
// }
// else
// {
// ret = refr.Path;
// }
// }
// 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)) if (File.Exists(fullPath))
{ {
return fullPath; return fullPath;
} }
fullPath = Helper.MakeFilePath(refPath.Path, refName, "dll");
if (File.Exists(fullPath))
{
return fullPath;
}
fullPath = Helper.MakeFilePath(refPath.Path, refName, "exe"); fullPath = Helper.MakeFilePath(refPath.Path, refName, "exe");
if (File.Exists(fullPath)) if (File.Exists(fullPath))
{ {
return fullPath; return fullPath;
} }
} }
return null; return null;
} }
/// <summary> /// <summary>
/// Gets the XML doc file. /// Gets the XML doc file.
/// </summary> /// </summary>
/// <param name="project">The project.</param> /// <param name="project">The project.</param>
/// <param name="conf">The conf.</param> /// <param name="conf">The conf.</param>
/// <returns></returns> /// <returns></returns>
public static string GetXmlDocFile(ProjectNode project, ConfigurationNode conf) public static string GetXmlDocFile(ProjectNode project, ConfigurationNode conf)
{ {
if (conf == null) if (conf == null)
{ {
throw new ArgumentNullException("conf"); throw new ArgumentNullException("conf");
} }
if (project == null) if (project == null)
{ {
throw new ArgumentNullException("project"); throw new ArgumentNullException("project");
} }
string docFile = (string)conf.Options["XmlDocFile"]; string docFile = (string)conf.Options["XmlDocFile"];
// if(docFile != null && docFile.Length == 0)//default to assembly name if not specified // if(docFile != null && docFile.Length == 0)//default to assembly name if not specified
// { // {
// return Path.GetFileNameWithoutExtension(project.AssemblyName) + ".xml"; // return Path.GetFileNameWithoutExtension(project.AssemblyName) + ".xml";
// } // }
return docFile; return docFile;
} }
private void WriteProject(SolutionNode solution, ProjectNode project) private void WriteProject(SolutionNode solution, ProjectNode project)
{ {
string projFile = Helper.MakeFilePath(project.FullPath, project.Name + GetProjectExtension(project), "build"); string projFile = Helper.MakeFilePath(project.FullPath, project.Name + GetProjectExtension(project), "build");
StreamWriter ss = new StreamWriter(projFile); StreamWriter ss = new StreamWriter(projFile);
m_Kernel.CurrentWorkingDirectory.Push(); m_Kernel.CurrentWorkingDirectory.Push();
Helper.SetCurrentDir(Path.GetDirectoryName(projFile)); Helper.SetCurrentDir(Path.GetDirectoryName(projFile));
bool hasDoc = false; bool hasDoc = false;
using (ss) using (ss)
{ {
ss.WriteLine("<?xml version=\"1.0\" ?>"); ss.WriteLine("<?xml version=\"1.0\" ?>");
ss.WriteLine("<project name=\"{0}\" default=\"build\">", project.Name); ss.WriteLine("<project name=\"{0}\" default=\"build\">", project.Name);
ss.WriteLine(" <target name=\"{0}\">", "build"); ss.WriteLine(" <target name=\"{0}\">", "build");
ss.WriteLine(" <echo message=\"Build Directory is ${project::get-base-directory()}/${build.dir}\" />"); ss.WriteLine(" <echo message=\"Build Directory is ${project::get-base-directory()}/${build.dir}\" />");
ss.WriteLine(" <mkdir dir=\"${project::get-base-directory()}/${build.dir}\" />"); ss.WriteLine(" <mkdir dir=\"${project::get-base-directory()}/${build.dir}\" />");
ss.WriteLine(" <copy todir=\"${project::get-base-directory()}/${build.dir}\" flatten=\"true\">"); ss.WriteLine(" <copy todir=\"${project::get-base-directory()}/${build.dir}\" flatten=\"true\">");
ss.WriteLine(" <fileset basedir=\"${project::get-base-directory()}\">"); ss.WriteLine(" <fileset basedir=\"${project::get-base-directory()}\">");
foreach (ReferenceNode refr in project.References) foreach (ReferenceNode refr in project.References)
{
if (refr.LocalCopy)
{
ss.WriteLine(" <include name=\"{0}", Helper.NormalizePath(Helper.MakePathRelativeTo(project.FullPath, BuildReference(solution, project, refr)) + "\" />", '/'));
}
}
ss.WriteLine(" </fileset>");
ss.WriteLine(" </copy>");
if (project.ConfigFile != null && project.ConfigFile.Length!=0)
{
ss.Write(" <copy file=\"" + project.ConfigFile + "\" tofile=\"${project::get-base-directory()}/${build.dir}/${project::get-name()}");
if (project.Type == ProjectType.Library)
{
ss.Write(".dll.config\"");
}
else
{
ss.Write(".exe.config\"");
}
ss.WriteLine(" />");
}
// Add the content files to just be copied
ss.WriteLine(" {0}", "<copy todir=\"${project::get-base-directory()}/${build.dir}\">");
ss.WriteLine(" {0}", "<fileset basedir=\".\">");
foreach (string file in project.Files)
{
// Ignore if we aren't content
if (project.Files.GetBuildAction(file) != BuildAction.Content)
continue;
// Create a include tag
ss.WriteLine(" {0}", "<include name=\"" + Helper.NormalizePath(PrependPath(file), '/') + "\" />");
}
ss.WriteLine(" {0}", "</fileset>");
ss.WriteLine(" {0}", "</copy>");
ss.Write(" <csc");
ss.Write(" target=\"{0}\"", project.Type.ToString().ToLower());
ss.Write(" debug=\"{0}\"", "${build.debug}");
foreach (ConfigurationNode conf in project.Configurations)
{
if (conf.Options.KeyFile != "")
{
ss.Write(" keyfile=\"{0}\"", conf.Options.KeyFile);
break;
}
}
foreach (ConfigurationNode conf in project.Configurations)
{
ss.Write(" unsafe=\"{0}\"", conf.Options.AllowUnsafe);
break;
}
foreach (ConfigurationNode conf in project.Configurations)
{
ss.Write(" warnaserror=\"{0}\"", conf.Options.WarningsAsErrors);
break;
}
foreach (ConfigurationNode conf in project.Configurations)
{
ss.Write(" define=\"{0}\"", conf.Options.CompilerDefines);
break;
}
foreach (ConfigurationNode conf in project.Configurations)
{
ss.Write(" nostdlib=\"{0}\"", conf.Options["NoStdLib"]);
break;
}
ss.Write(" main=\"{0}\"", project.StartupObject);
foreach (ConfigurationNode conf in project.Configurations)
{
if (GetXmlDocFile(project, conf) != "")
{
ss.Write(" doc=\"{0}\"", "${project::get-base-directory()}/${build.dir}/" + GetXmlDocFile(project, conf));
hasDoc = true;
}
break;
}
ss.Write(" output=\"{0}", "${project::get-base-directory()}/${build.dir}/${project::get-name()}");
if (project.Type == ProjectType.Library)
{
ss.Write(".dll\"");
}
else
{
ss.Write(".exe\"");
}
if (project.AppIcon != null && project.AppIcon.Length != 0)
{
ss.Write(" win32icon=\"{0}\"", Helper.NormalizePath(project.AppIcon, '/'));
}
ss.WriteLine(">");
ss.WriteLine(" <resources prefix=\"{0}\" dynamicprefix=\"true\" >", project.RootNamespace);
foreach (string file in project.Files)
{
switch (project.Files.GetBuildAction(file))
{
case BuildAction.EmbeddedResource:
ss.WriteLine(" {0}", "<include name=\"" + Helper.NormalizePath(PrependPath(file), '/') + "\" />");
break;
default:
if (project.Files.GetSubType(file) != SubType.Code && project.Files.GetSubType(file) != SubType.Settings)
{
ss.WriteLine(" <include name=\"{0}\" />", file.Substring(0, file.LastIndexOf('.')) + ".resx");
}
break;
}
}
//if (project.Files.GetSubType(file).ToString() != "Code")
//{
// ps.WriteLine(" <EmbeddedResource Include=\"{0}\">", file.Substring(0, file.LastIndexOf('.')) + ".resx");
ss.WriteLine(" </resources>");
ss.WriteLine(" <sources failonempty=\"true\">");
foreach (string file in project.Files)
{
switch (project.Files.GetBuildAction(file))
{
case BuildAction.Compile:
ss.WriteLine(" <include name=\"" + Helper.NormalizePath(PrependPath(file), '/') + "\" />");
break;
default:
break;
}
}
ss.WriteLine(" </sources>");
ss.WriteLine(" <references basedir=\"${project::get-base-directory()}\">");
ss.WriteLine(" <lib>");
ss.WriteLine(" <include name=\"${project::get-base-directory()}\" />");
foreach(ReferencePathNode refPath in project.ReferencePaths)
{ {
ss.WriteLine(" <include name=\"${project::get-base-directory()}/" + refPath.Path.TrimEnd('/', '\\') + "\" />"); if (refr.LocalCopy)
{
ss.WriteLine(" <include name=\"{0}", Helper.NormalizePath(Helper.MakePathRelativeTo(project.FullPath, BuildReference(solution, project, refr)) + "\" />", '/'));
}
} }
ss.WriteLine(" </lib>");
foreach (ReferenceNode refr in project.References) ss.WriteLine(" </fileset>");
{ ss.WriteLine(" </copy>");
string path = Helper.NormalizePath(Helper.MakePathRelativeTo(project.FullPath, BuildReference(solution, project, refr)), '/'); if (project.ConfigFile != null && project.ConfigFile.Length!=0)
{
ss.Write(" <copy file=\"" + project.ConfigFile + "\" tofile=\"${project::get-base-directory()}/${build.dir}/${project::get-name()}");
if (project.Type == ProjectType.Library)
{
ss.Write(".dll.config\"");
}
else
{
ss.Write(".exe.config\"");
}
ss.WriteLine(" />");
}
// Add the content files to just be copied
ss.WriteLine(" {0}", "<copy todir=\"${project::get-base-directory()}/${build.dir}\">");
ss.WriteLine(" {0}", "<fileset basedir=\".\">");
foreach (string file in project.Files)
{
// Ignore if we aren't content
if (project.Files.GetBuildAction(file) != BuildAction.Content)
continue;
// Create a include tag
ss.WriteLine(" {0}", "<include name=\"" + Helper.NormalizePath(PrependPath(file), '/') + "\" />");
}
ss.WriteLine(" {0}", "</fileset>");
ss.WriteLine(" {0}", "</copy>");
ss.Write(" <csc");
ss.Write(" target=\"{0}\"", project.Type.ToString().ToLower());
ss.Write(" debug=\"{0}\"", "${build.debug}");
foreach (ConfigurationNode conf in project.Configurations)
{
if (conf.Options.KeyFile != "")
{
ss.Write(" keyfile=\"{0}\"", conf.Options.KeyFile);
break;
}
}
foreach (ConfigurationNode conf in project.Configurations)
{
ss.Write(" unsafe=\"{0}\"", conf.Options.AllowUnsafe);
break;
}
foreach (ConfigurationNode conf in project.Configurations)
{
ss.Write(" warnaserror=\"{0}\"", conf.Options.WarningsAsErrors);
break;
}
foreach (ConfigurationNode conf in project.Configurations)
{
ss.Write(" define=\"{0}\"", conf.Options.CompilerDefines);
break;
}
ss.Write(" main=\"{0}\"", project.StartupObject);
foreach (ConfigurationNode conf in project.Configurations)
{
if (GetXmlDocFile(project, conf) != "")
{
ss.Write(" doc=\"{0}\"", "${project::get-base-directory()}/${build.dir}/" + GetXmlDocFile(project, conf));
hasDoc = true;
}
break;
}
ss.Write(" output=\"{0}", "${project::get-base-directory()}/${build.dir}/${project::get-name()}");
if (project.Type == ProjectType.Library)
{
ss.Write(".dll\"");
}
else
{
ss.Write(".exe\"");
}
if (project.AppIcon != null && project.AppIcon.Length != 0)
{
ss.Write(" win32icon=\"{0}\"", Helper.NormalizePath(project.AppIcon, '/'));
}
ss.WriteLine(">");
ss.WriteLine(" <resources prefix=\"{0}\" dynamicprefix=\"true\" >", project.RootNamespace);
foreach (string file in project.Files)
{
switch (project.Files.GetBuildAction(file))
{
case BuildAction.EmbeddedResource:
ss.WriteLine(" {0}", "<include name=\"" + Helper.NormalizePath(PrependPath(file), '/') + "\" />");
break;
default:
if (project.Files.GetSubType(file) != SubType.Code && project.Files.GetSubType(file) != SubType.Settings)
{
ss.WriteLine(" <include name=\"{0}\" />", file.Substring(0, file.LastIndexOf('.')) + ".resx");
}
break;
}
}
//if (project.Files.GetSubType(file).ToString() != "Code")
//{
// ps.WriteLine(" <EmbeddedResource Include=\"{0}\">", file.Substring(0, file.LastIndexOf('.')) + ".resx");
ss.WriteLine(" </resources>");
ss.WriteLine(" <sources failonempty=\"true\">");
foreach (string file in project.Files)
{
switch (project.Files.GetBuildAction(file))
{
case BuildAction.Compile:
ss.WriteLine(" <include name=\"" + Helper.NormalizePath(PrependPath(file), '/') + "\" />");
break;
default:
break;
}
}
ss.WriteLine(" </sources>");
ss.WriteLine(" <references basedir=\"${project::get-base-directory()}\">");
ss.WriteLine(" <lib>");
ss.WriteLine(" <include name=\"${project::get-base-directory()}\" />");
ss.WriteLine(" <include name=\"${project::get-base-directory()}/${build.dir}\" />");
ss.WriteLine(" </lib>");
foreach (ReferenceNode refr in project.References)
{
string path = Helper.NormalizePath(Helper.MakePathRelativeTo(project.FullPath, BuildReference(solution, project, refr)), '/');
ss.WriteLine(" <include name=\"" + path + "\" />"); ss.WriteLine(" <include name=\"" + path + "\" />");
} }
ss.WriteLine(" </references>"); ss.WriteLine(" </references>");
ss.WriteLine(" </csc>"); ss.WriteLine(" </csc>");
foreach (ConfigurationNode conf in project.Configurations) foreach (ConfigurationNode conf in project.Configurations)
{ {
if (!String.IsNullOrEmpty(conf.Options.OutputPath)) if (!String.IsNullOrEmpty(conf.Options.OutputPath))
{ {
@ -378,160 +432,149 @@ namespace Prebuild.Core.Targets
ss.WriteLine(" <include name=\"*.dll\"/>"); ss.WriteLine(" <include name=\"*.dll\"/>");
ss.WriteLine(" <include name=\"*.exe\"/>"); ss.WriteLine(" <include name=\"*.exe\"/>");
ss.WriteLine(" <include name=\"*.mdb\" if='${build.debug}'/>"); ss.WriteLine(" <include name=\"*.mdb\" if='${build.debug}'/>");
ss.WriteLine(" <include name=\"*.pdb\" if='${build.debug}'/>");
ss.WriteLine(" </fileset>"); ss.WriteLine(" </fileset>");
ss.WriteLine(" </copy>"); ss.WriteLine(" </copy>");
break; break;
} }
} }
ss.WriteLine(" </target>"); ss.WriteLine(" </target>");
ss.WriteLine(" <target name=\"clean\">"); ss.WriteLine(" <target name=\"clean\">");
ss.WriteLine(" <delete dir=\"${bin.dir}\" failonerror=\"false\" />"); ss.WriteLine(" <delete dir=\"${obj.dir}\" failonerror=\"false\" />");
ss.WriteLine(" <delete dir=\"${obj.dir}\" failonerror=\"false\" />"); ss.WriteLine(" <delete dir=\"${bin.dir}\" failonerror=\"false\" />");
ss.WriteLine(" </target>"); ss.WriteLine(" </target>");
ss.WriteLine(" <target name=\"doc\" description=\"Creates documentation.\">"); ss.WriteLine(" <target name=\"doc\" description=\"Creates documentation.\">");
if (hasDoc) if (hasDoc)
{ {
ss.WriteLine(" <property name=\"doc.target\" value=\"\" />"); ss.WriteLine(" <property name=\"doc.target\" value=\"\" />");
ss.WriteLine(" <if test=\"${platform::is-unix()}\">"); ss.WriteLine(" <if test=\"${platform::is-unix()}\">");
ss.WriteLine(" <property name=\"doc.target\" value=\"Web\" />"); ss.WriteLine(" <property name=\"doc.target\" value=\"Web\" />");
ss.WriteLine(" </if>"); ss.WriteLine(" </if>");
ss.WriteLine(" <ndoc failonerror=\"false\" verbose=\"true\">"); ss.WriteLine(" <ndoc failonerror=\"false\" verbose=\"true\">");
ss.WriteLine(" <assemblies basedir=\"${project::get-base-directory()}\">"); ss.WriteLine(" <assemblies basedir=\"${project::get-base-directory()}\">");
ss.Write(" <include name=\"${build.dir}/${project::get-name()}"); ss.Write(" <include name=\"${build.dir}/${project::get-name()}");
if (project.Type == ProjectType.Library) if (project.Type == ProjectType.Library)
{ {
ss.WriteLine(".dll\" />"); ss.WriteLine(".dll\" />");
} }
else else
{ {
ss.WriteLine(".exe\" />"); ss.WriteLine(".exe\" />");
} }
ss.WriteLine(" </assemblies>"); ss.WriteLine(" </assemblies>");
ss.WriteLine(" <summaries basedir=\"${project::get-base-directory()}\">"); ss.WriteLine(" <summaries basedir=\"${project::get-base-directory()}\">");
ss.WriteLine(" <include name=\"${build.dir}/${project::get-name()}.xml\"/>"); ss.WriteLine(" <include name=\"${build.dir}/${project::get-name()}.xml\"/>");
ss.WriteLine(" </summaries>"); ss.WriteLine(" </summaries>");
ss.WriteLine(" <referencepaths basedir=\"${project::get-base-directory()}\">"); ss.WriteLine(" <referencepaths basedir=\"${project::get-base-directory()}\">");
ss.WriteLine(" <include name=\"${build.dir}\" />"); ss.WriteLine(" <include name=\"${build.dir}\" />");
// foreach(ReferenceNode refr in project.References) // foreach(ReferenceNode refr in project.References)
// { // {
// string path = Helper.NormalizePath(Helper.MakePathRelativeTo(project.FullPath, BuildReferencePath(solution, refr)), '/'); // string path = Helper.NormalizePath(Helper.MakePathRelativeTo(project.FullPath, BuildReferencePath(solution, refr)), '/');
// if (path != "") // if (path != "")
// { // {
// ss.WriteLine(" <include name=\"{0}\" />", path); // ss.WriteLine(" <include name=\"{0}\" />", path);
// } // }
// } // }
ss.WriteLine(" </referencepaths>"); ss.WriteLine(" </referencepaths>");
ss.WriteLine(" <documenters>"); ss.WriteLine(" <documenters>");
ss.WriteLine(" <documenter name=\"MSDN\">"); ss.WriteLine(" <documenter name=\"MSDN\">");
ss.WriteLine(" <property name=\"OutputDirectory\" value=\"${project::get-base-directory()}/${build.dir}/doc/${project::get-name()}\" />"); ss.WriteLine(" <property name=\"OutputDirectory\" value=\"${project::get-base-directory()}/${build.dir}/doc/${project::get-name()}\" />");
ss.WriteLine(" <property name=\"OutputTarget\" value=\"${doc.target}\" />"); ss.WriteLine(" <property name=\"OutputTarget\" value=\"${doc.target}\" />");
ss.WriteLine(" <property name=\"HtmlHelpName\" value=\"${project::get-name()}\" />"); ss.WriteLine(" <property name=\"HtmlHelpName\" value=\"${project::get-name()}\" />");
ss.WriteLine(" <property name=\"IncludeFavorites\" value=\"False\" />"); ss.WriteLine(" <property name=\"IncludeFavorites\" value=\"False\" />");
ss.WriteLine(" <property name=\"Title\" value=\"${project::get-name()} SDK Documentation\" />"); ss.WriteLine(" <property name=\"Title\" value=\"${project::get-name()} SDK Documentation\" />");
ss.WriteLine(" <property name=\"SplitTOCs\" value=\"False\" />"); ss.WriteLine(" <property name=\"SplitTOCs\" value=\"False\" />");
ss.WriteLine(" <property name=\"DefaulTOC\" value=\"\" />"); ss.WriteLine(" <property name=\"DefaulTOC\" value=\"\" />");
ss.WriteLine(" <property name=\"ShowVisualBasic\" value=\"True\" />"); ss.WriteLine(" <property name=\"ShowVisualBasic\" value=\"True\" />");
ss.WriteLine(" <property name=\"AutoDocumentConstructors\" value=\"True\" />"); ss.WriteLine(" <property name=\"AutoDocumentConstructors\" value=\"True\" />");
ss.WriteLine(" <property name=\"ShowMissingSummaries\" value=\"${build.debug}\" />"); ss.WriteLine(" <property name=\"ShowMissingSummaries\" value=\"${build.debug}\" />");
ss.WriteLine(" <property name=\"ShowMissingRemarks\" value=\"${build.debug}\" />"); ss.WriteLine(" <property name=\"ShowMissingRemarks\" value=\"${build.debug}\" />");
ss.WriteLine(" <property name=\"ShowMissingParams\" value=\"${build.debug}\" />"); ss.WriteLine(" <property name=\"ShowMissingParams\" value=\"${build.debug}\" />");
ss.WriteLine(" <property name=\"ShowMissingReturns\" value=\"${build.debug}\" />"); ss.WriteLine(" <property name=\"ShowMissingReturns\" value=\"${build.debug}\" />");
ss.WriteLine(" <property name=\"ShowMissingValues\" value=\"${build.debug}\" />"); ss.WriteLine(" <property name=\"ShowMissingValues\" value=\"${build.debug}\" />");
ss.WriteLine(" <property name=\"DocumentInternals\" value=\"False\" />"); ss.WriteLine(" <property name=\"DocumentInternals\" value=\"False\" />");
ss.WriteLine(" <property name=\"DocumentPrivates\" value=\"False\" />"); ss.WriteLine(" <property name=\"DocumentPrivates\" value=\"False\" />");
ss.WriteLine(" <property name=\"DocumentProtected\" value=\"True\" />"); ss.WriteLine(" <property name=\"DocumentProtected\" value=\"True\" />");
ss.WriteLine(" <property name=\"DocumentEmptyNamespaces\" value=\"${build.debug}\" />"); ss.WriteLine(" <property name=\"DocumentEmptyNamespaces\" value=\"${build.debug}\" />");
ss.WriteLine(" <property name=\"IncludeAssemblyVersion\" value=\"True\" />"); ss.WriteLine(" <property name=\"IncludeAssemblyVersion\" value=\"True\" />");
ss.WriteLine(" </documenter>"); ss.WriteLine(" </documenter>");
ss.WriteLine(" </documenters>"); ss.WriteLine(" </documenters>");
ss.WriteLine(" </ndoc>"); ss.WriteLine(" </ndoc>");
} }
ss.WriteLine(" </target>"); ss.WriteLine(" </target>");
ss.WriteLine("</project>"); ss.WriteLine("</project>");
} }
m_Kernel.CurrentWorkingDirectory.Pop(); m_Kernel.CurrentWorkingDirectory.Pop();
} }
private void WriteCombine(SolutionNode solution) private void WriteCombine(SolutionNode solution)
{ {
m_Kernel.Log.Write("Creating NAnt build files"); m_Kernel.Log.Write("Creating NAnt build files");
foreach (ProjectNode project in solution.Projects) foreach (ProjectNode project in solution.Projects)
{ {
if (m_Kernel.AllowProject(project.FilterGroups)) if (m_Kernel.AllowProject(project.FilterGroups))
{ {
m_Kernel.Log.Write("...Creating project: {0}", project.Name); m_Kernel.Log.Write("...Creating project: {0}", project.Name);
WriteProject(solution, project); WriteProject(solution, project);
} }
} }
m_Kernel.Log.Write(""); m_Kernel.Log.Write("");
string combFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "build"); string combFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "build");
StreamWriter ss = new StreamWriter(combFile); StreamWriter ss = new StreamWriter(combFile);
m_Kernel.CurrentWorkingDirectory.Push(); m_Kernel.CurrentWorkingDirectory.Push();
Helper.SetCurrentDir(Path.GetDirectoryName(combFile)); Helper.SetCurrentDir(Path.GetDirectoryName(combFile));
using (ss) using (ss)
{ {
ss.WriteLine("<?xml version=\"1.0\" ?>"); ss.WriteLine("<?xml version=\"1.0\" ?>");
ss.WriteLine("<project name=\"{0}\" default=\"build\">", solution.Name); ss.WriteLine("<project name=\"{0}\" default=\"build\">", solution.Name);
ss.WriteLine(" <echo message=\"Using '${nant.settings.currentframework}' Framework\"/>"); ss.WriteLine(" <echo message=\"Using '${nant.settings.currentframework}' Framework\"/>");
ss.WriteLine(); ss.WriteLine();
//ss.WriteLine(" <property name=\"dist.dir\" value=\"dist\" />"); //ss.WriteLine(" <property name=\"dist.dir\" value=\"dist\" />");
//ss.WriteLine(" <property name=\"source.dir\" value=\"source\" />"); //ss.WriteLine(" <property name=\"source.dir\" value=\"source\" />");
ss.WriteLine(" <property name=\"bin.dir\" value=\"bin\" />"); ss.WriteLine(" <property name=\"bin.dir\" value=\"bin\" />");
ss.WriteLine(" <property name=\"obj.dir\" value=\"obj\" />"); ss.WriteLine(" <property name=\"obj.dir\" value=\"obj\" />");
ss.WriteLine(" <property name=\"doc.dir\" value=\"doc\" />"); ss.WriteLine(" <property name=\"doc.dir\" value=\"doc\" />");
ss.WriteLine(" <property name=\"project.main.dir\" value=\"${project::get-base-directory()}\" />"); ss.WriteLine(" <property name=\"project.main.dir\" value=\"${project::get-base-directory()}\" />");
// actually use active config out of prebuild.xml // actually use active config out of prebuild.xml
ss.WriteLine(" <property name=\"project.config\" value=\"{0}\" />", solution.ActiveConfig); ss.WriteLine(" <property name=\"project.config\" value=\"{0}\" />", solution.ActiveConfig);
foreach (ConfigurationNode conf in solution.Configurations) foreach (ConfigurationNode conf in solution.Configurations)
{ {
ss.WriteLine(); ss.WriteLine();
ss.WriteLine(" <target name=\"{0}\" description=\"\">", conf.Name); ss.WriteLine(" <target name=\"{0}\" description=\"\">", conf.Name);
ss.WriteLine(" <property name=\"project.config\" value=\"{0}\" />", conf.Name); ss.WriteLine(" <property name=\"project.config\" value=\"{0}\" />", conf.Name);
ss.WriteLine(" <property name=\"build.debug\" value=\"{0}\" />", conf.Options["DebugInformation"].ToString().ToLower()); ss.WriteLine(" <property name=\"build.debug\" value=\"{0}\" />", conf.Options["DebugInformation"].ToString().ToLower());
ss.WriteLine(" </target>"); ss.WriteLine(" </target>");
ss.WriteLine(); ss.WriteLine();
} }
ss.WriteLine(" <target name=\"net-1.1\" description=\"Sets framework to .NET 1.1\">"); ss.WriteLine(" <target name=\"net-1.1\" description=\"Sets framework to .NET 1.1\">");
ss.WriteLine(" <property name=\"nant.settings.currentframework\" value=\"net-1.1\" />"); ss.WriteLine(" <property name=\"nant.settings.currentframework\" value=\"net-1.1\" />");
ss.WriteLine(" </target>"); ss.WriteLine(" </target>");
ss.WriteLine(); ss.WriteLine();
ss.WriteLine(" <target name=\"net-2.0\" description=\"Sets framework to .NET 2.0\">"); ss.WriteLine(" <target name=\"net-2.0\" description=\"Sets framework to .NET 2.0\">");
ss.WriteLine(" <property name=\"nant.settings.currentframework\" value=\"net-2.0\" />"); ss.WriteLine(" <property name=\"nant.settings.currentframework\" value=\"net-2.0\" />");
ss.WriteLine(" </target>"); ss.WriteLine(" </target>");
ss.WriteLine(); ss.WriteLine();
ss.WriteLine(" <target name=\"net-3.5\" description=\"Sets framework to .NET 3.5\">"); ss.WriteLine(" <target name=\"mono-2.0\" description=\"Sets framework to mono 2.0\">");
ss.WriteLine(" <property name=\"nant.settings.currentframework\" value=\"net-3.5\" />"); ss.WriteLine(" <property name=\"nant.settings.currentframework\" value=\"mono-2.0\" />");
ss.WriteLine(" </target>"); ss.WriteLine(" </target>");
ss.WriteLine(); ss.WriteLine();
ss.WriteLine(" <target name=\"mono-1.0\" description=\"Sets framework to mono 1.0\">"); ss.WriteLine(" <target name=\"mono-1.0\" description=\"Sets framework to mono 1.0\">");
ss.WriteLine(" <property name=\"nant.settings.currentframework\" value=\"mono-1.0\" />"); ss.WriteLine(" <property name=\"nant.settings.currentframework\" value=\"mono-1.0\" />");
ss.WriteLine(" </target>"); ss.WriteLine(" </target>");
ss.WriteLine(); ss.WriteLine();
ss.WriteLine(" <target name=\"mono-2.0\" description=\"Sets framework to mono 2.0\">");
ss.WriteLine(" <property name=\"nant.settings.currentframework\" value=\"mono-2.0\" />");
ss.WriteLine(" </target>");
ss.WriteLine();
ss.WriteLine(" <target name=\"mono-3.5\" description=\"Sets framework to mono 3.5\">");
ss.WriteLine(" <property name=\"nant.settings.currentframework\" value=\"mono-3.5\" />");
ss.WriteLine(" </target>");
ss.WriteLine();
ss.WriteLine(" <target name=\"init\" description=\"\">"); ss.WriteLine(" <target name=\"init\" description=\"\">");
ss.WriteLine(" <call target=\"${project.config}\" />"); ss.WriteLine(" <call target=\"${project.config}\" />");

View File

@ -23,6 +23,15 @@ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY O
*/ */
#endregion #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 System;
using Prebuild.Core.Attributes; using Prebuild.Core.Attributes;
@ -34,37 +43,17 @@ namespace Prebuild.Core.Targets
/// </summary> /// </summary>
[Target("sharpdev2")] [Target("sharpdev2")]
public class SharpDevelop2Target : VS2005Target public class SharpDevelop2Target : VS2005Target
{ {
#region Properties protected override string VersionName
public override string VersionName
{ {
get get
{ {
return "SharpDevelop2"; return "SharpDevelop2";
} }
} }
#endregion
#region Public Methods #region Public Methods
/// <summary>
/// Writes the specified kern.
/// </summary>
/// <param name="kern">The kern.</param>
public override void Write(Kernel kern)
{
base.Write(kern);
}
/// <summary>
/// Cleans the specified kern.
/// </summary>
/// <param name="kern">The kern.</param>
public override void Clean(Kernel kern)
{
base.Clean(kern);
}
/// <summary> /// <summary>
/// Gets the name. /// Gets the name.
/// </summary> /// </summary>

View File

@ -23,6 +23,15 @@ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY O
*/ */
#endregion #endregion
#region CVS Information
/*
* $Source$
* $Author: jendave $
* $Date: 2007-02-14 05:58:03 +0900 (Wed, 14 Feb 2007) $
* $Revision: 205 $
*/
#endregion
using System; using System;
using System.Collections; using System.Collections;
using System.Collections.Specialized; using System.Collections.Specialized;

View File

@ -1,197 +0,0 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Prebuild.Core.Targets
{
/// <summary>
///
/// </summary>
public struct ToolInfo
{
string name;
string guid;
string fileExtension;
string xmlTag;
string importProject;
/// <summary>
/// Gets or sets the name.
/// </summary>
/// <value>The name.</value>
public string Name
{
get
{
return name;
}
set
{
name = value;
}
}
/// <summary>
/// Gets or sets the GUID.
/// </summary>
/// <value>The GUID.</value>
public string Guid
{
get
{
return guid;
}
set
{
guid = value;
}
}
/// <summary>
/// Gets or sets the file extension.
/// </summary>
/// <value>The file extension.</value>
public string FileExtension
{
get
{
return fileExtension;
}
set
{
fileExtension = value;
}
}
public string LanguageExtension
{
get
{
switch (this.Name)
{
case "C#":
return ".cs";
case "VisualBasic":
return ".vb";
case "Boo":
return ".boo";
default:
return ".cs";
}
}
}
/// <summary>
/// Gets or sets the XML tag.
/// </summary>
/// <value>The XML tag.</value>
public string XmlTag
{
get
{
return xmlTag;
}
set
{
xmlTag = value;
}
}
/// <summary>
/// Gets or sets the import project property.
/// </summary>
/// <value>The ImportProject tag.</value>
public string ImportProject
{
get
{
return importProject;
}
set
{
importProject = value;
}
}
/// <summary>
/// Initializes a new instance of the <see cref="ToolInfo"/> class.
/// </summary>
/// <param name="name">The name.</param>
/// <param name="guid">The GUID.</param>
/// <param name="fileExtension">The file extension.</param>
/// <param name="xml">The XML.</param>
/// <param name="importProject">The import project.</param>
public ToolInfo(string name, string guid, string fileExtension, string xml, string importProject)
{
this.name = name;
this.guid = guid;
this.fileExtension = fileExtension;
this.xmlTag = xml;
this.importProject = importProject;
}
/// <summary>
/// Initializes a new instance of the <see cref="ToolInfo"/> class.
/// </summary>
/// <param name="name">The name.</param>
/// <param name="guid">The GUID.</param>
/// <param name="fileExtension">The file extension.</param>
/// <param name="xml">The XML.</param>
public ToolInfo(string name, string guid, string fileExtension, string xml)
{
this.name = name;
this.guid = guid;
this.fileExtension = fileExtension;
this.xmlTag = xml;
this.importProject = "$(MSBuildBinPath)\\Microsoft." + xml + ".Targets";
}
/// <summary>
/// Equals operator
/// </summary>
/// <param name="obj">ToolInfo to compare</param>
/// <returns>true if toolInfos are equal</returns>
public override bool Equals(object obj)
{
if (obj == null)
{
throw new ArgumentNullException("obj");
}
if (obj.GetType() != typeof(ToolInfo))
return false;
ToolInfo c = (ToolInfo)obj;
return ((this.name == c.name) && (this.guid == c.guid) && (this.fileExtension == c.fileExtension) && (this.importProject == c.importProject));
}
/// <summary>
/// Equals operator
/// </summary>
/// <param name="c1">ToolInfo to compare</param>
/// <param name="c2">ToolInfo to compare</param>
/// <returns>True if toolInfos are equal</returns>
public static bool operator ==(ToolInfo c1, ToolInfo c2)
{
return ((c1.name == c2.name) && (c1.guid == c2.guid) && (c1.fileExtension == c2.fileExtension) && (c1.importProject == c2.importProject) && (c1.xmlTag == c2.xmlTag));
}
/// <summary>
/// Not equals operator
/// </summary>
/// <param name="c1">ToolInfo to compare</param>
/// <param name="c2">ToolInfo to compare</param>
/// <returns>True if toolInfos are not equal</returns>
public static bool operator !=(ToolInfo c1, ToolInfo c2)
{
return !(c1 == c2);
}
/// <summary>
/// Hash Code
/// </summary>
/// <returns>Hash code</returns>
public override int GetHashCode()
{
return name.GetHashCode() ^ guid.GetHashCode() ^ this.fileExtension.GetHashCode() ^ this.importProject.GetHashCode() ^ this.xmlTag.GetHashCode();
}
}
}

View File

@ -23,6 +23,15 @@ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY O
*/ */
#endregion #endregion
#region CVS Information
/*
* $Source$
* $Author: jendave $
* $Date: 2006-01-28 09:49:58 +0900 (Sat, 28 Jan 2006) $
* $Revision: 71 $
*/
#endregion
using System; using System;
using Prebuild.Core.Attributes; using Prebuild.Core.Attributes;

View File

@ -23,6 +23,15 @@ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY O
*/ */
#endregion #endregion
#region CVS Information
/*
* $Source$
* $Author: jendave $
* $Date: 2006-09-30 04:11:40 +0900 (Sat, 30 Sep 2006) $
* $Revision: 177 $
*/
#endregion
using System; using System;
using System.Collections; using System.Collections;
using System.Collections.Specialized; using System.Collections.Specialized;
@ -35,6 +44,28 @@ using Prebuild.Core.Utilities;
namespace Prebuild.Core.Targets namespace Prebuild.Core.Targets
{ {
/// <summary>
///
/// </summary>
public enum VSVersion
{
/// <summary>
///
/// </summary>
VS70,
/// <summary>
///
/// </summary>
VS71,
/// <summary>
///
/// </summary>
VS80
}
/// <summary>
///
/// </summary>
[Target("vs2003")] [Target("vs2003")]
public class VS2003Target : ITarget public class VS2003Target : ITarget
{ {

View File

@ -23,6 +23,15 @@ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY O
*/ */
#endregion #endregion
#region CVS Information
/*
* $Source$
* $Author: borrillis $
* $Date: 2007-05-25 01:03:16 +0900 (Fri, 25 May 2007) $
* $Revision: 243 $
*/
#endregion
using System; using System;
using System.Collections; using System.Collections;
using System.Collections.Specialized; using System.Collections.Specialized;
@ -36,11 +45,185 @@ using Prebuild.Core.Utilities;
namespace Prebuild.Core.Targets namespace Prebuild.Core.Targets
{ {
/// <summary>
///
/// </summary>
public struct ToolInfo
{
string name;
string guid;
string fileExtension;
string xmlTag;
string importProject;
/// <summary>
/// Gets or sets the name.
/// </summary>
/// <value>The name.</value>
public string Name
{
get
{
return name;
}
set
{
name = value;
}
}
/// <summary>
/// Gets or sets the GUID.
/// </summary>
/// <value>The GUID.</value>
public string Guid
{
get
{
return guid;
}
set
{
guid = value;
}
}
/// <summary>
/// Gets or sets the file extension.
/// </summary>
/// <value>The file extension.</value>
public string FileExtension
{
get
{
return fileExtension;
}
set
{
fileExtension = value;
}
}
/// <summary>
/// Gets or sets the XML tag.
/// </summary>
/// <value>The XML tag.</value>
public string XmlTag
{
get
{
return xmlTag;
}
set
{
xmlTag = value;
}
}
/// <summary>
/// Gets or sets the import project property.
/// </summary>
/// <value>The ImportProject tag.</value>
public string ImportProject
{
get
{
return importProject;
}
set
{
importProject = value;
}
}
/// <summary>
/// Initializes a new instance of the <see cref="ToolInfo"/> class.
/// </summary>
/// <param name="name">The name.</param>
/// <param name="guid">The GUID.</param>
/// <param name="fileExtension">The file extension.</param>
/// <param name="xml">The XML.</param>
/// <param name="importProject">The import project.</param>
public ToolInfo(string name, string guid, string fileExtension, string xml, string importProject)
{
this.name = name;
this.guid = guid;
this.fileExtension = fileExtension;
this.xmlTag = xml;
this.importProject = importProject;
}
/// <summary>
/// Initializes a new instance of the <see cref="ToolInfo"/> class.
/// </summary>
/// <param name="name">The name.</param>
/// <param name="guid">The GUID.</param>
/// <param name="fileExtension">The file extension.</param>
/// <param name="xml">The XML.</param>
public ToolInfo(string name, string guid, string fileExtension, string xml)
{
this.name = name;
this.guid = guid;
this.fileExtension = fileExtension;
this.xmlTag = xml;
this.importProject = "$(MSBuildBinPath)\\Microsoft." + xml + ".Targets";
}
/// <summary>
/// Equals operator
/// </summary>
/// <param name="obj">ToolInfo to compare</param>
/// <returns>true if toolInfos are equal</returns>
public override bool Equals(object obj)
{
if (obj == null)
{
throw new ArgumentNullException("obj");
}
if (obj.GetType() != typeof(ToolInfo))
return false;
ToolInfo c = (ToolInfo)obj;
return ((this.name == c.name) && (this.guid == c.guid) && (this.fileExtension == c.fileExtension) && (this.importProject == c.importProject));
}
/// <summary>
/// Equals operator
/// </summary>
/// <param name="c1">ToolInfo to compare</param>
/// <param name="c2">ToolInfo to compare</param>
/// <returns>True if toolInfos are equal</returns>
public static bool operator ==(ToolInfo c1, ToolInfo c2)
{
return ((c1.name == c2.name) && (c1.guid == c2.guid) && (c1.fileExtension == c2.fileExtension) && (c1.importProject == c2.importProject) && (c1.xmlTag == c2.xmlTag));
}
/// <summary>
/// Not equals operator
/// </summary>
/// <param name="c1">ToolInfo to compare</param>
/// <param name="c2">ToolInfo to compare</param>
/// <returns>True if toolInfos are not equal</returns>
public static bool operator !=(ToolInfo c1, ToolInfo c2)
{
return !(c1 == c2);
}
/// <summary>
/// Hash Code
/// </summary>
/// <returns>Hash code</returns>
public override int GetHashCode()
{
return name.GetHashCode() ^ guid.GetHashCode() ^ this.fileExtension.GetHashCode() ^ this.importProject.GetHashCode() ^ this.xmlTag.GetHashCode();
}
}
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
[Target("vs2005")] [Target("vs2005")]
public class VS2005Target : VSGenericTarget public class VS2005Target : ITarget
{ {
#region Inner Classes #region Inner Classes
@ -48,87 +231,90 @@ namespace Prebuild.Core.Targets
#region Fields #region Fields
string solutionVersion = "9.00";
string productVersion = "8.0.50727";
string schemaVersion = "2.0"; string schemaVersion = "2.0";
string versionName = "Visual C# 2005";
string name = "vs2005";
VSVersion version = VSVersion.VS80; VSVersion version = VSVersion.VS80;
public override string SolutionTag Hashtable tools;
Kernel kernel;
protected virtual string ToolsVersionXml
{
get
{
return String.Empty;
}
}
protected virtual string SolutionTag
{ {
get { return "# Visual Studio 2005"; } get { return "# Visual Studio 2005"; }
} }
protected override string GetToolsVersionXml(FrameworkVersion frameworkVersion)
{
return string.Empty;
}
/// <summary> /// <summary>
/// Gets or sets the solution version. /// Gets or sets the solution version.
/// </summary> /// </summary>
/// <value>The solution version.</value> /// <value>The solution version.</value>
public override string SolutionVersion protected virtual string SolutionVersion
{ {
get get
{ {
return solutionVersion; return "9.00";
} }
} }
/// <summary> /// <summary>
/// Gets or sets the product version. /// Gets or sets the product version.
/// </summary> /// </summary>
/// <value>The product version.</value> /// <value>The product version.</value>
public override string ProductVersion protected virtual string ProductVersion
{ {
get get
{ {
return productVersion; return "8.0.50727";
} }
} }
/// <summary> /// <summary>
/// Gets or sets the schema version. /// Gets or sets the schema version.
/// </summary> /// </summary>
/// <value>The schema version.</value> /// <value>The schema version.</value>
public override string SchemaVersion protected string SchemaVersion
{ {
get get
{ {
return schemaVersion; return this.schemaVersion;
}
set
{
this.schemaVersion = value;
} }
} }
/// <summary> /// <summary>
/// Gets or sets the name of the version. /// Gets or sets the name of the version.
/// </summary> /// </summary>
/// <value>The name of the version.</value> /// <value>The name of the version.</value>
public override string VersionName protected virtual string VersionName
{ {
get get
{ {
return versionName; return "Visual C# 2005";
} }
} }
/// <summary> /// <summary>
/// Gets or sets the version. /// Gets or sets the version.
/// </summary> /// </summary>
/// <value>The version.</value> /// <value>The version.</value>
public override VSVersion Version protected VSVersion Version
{ {
get get
{ {
return version; return this.version;
} }
} set
/// <summary>
/// Gets the name.
/// </summary>
/// <value>The name.</value>
public override string Name
{
get
{ {
return name; this.version = value;
} }
} }
@ -139,9 +325,600 @@ namespace Prebuild.Core.Targets
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="VS2005Target"/> class. /// Initializes a new instance of the <see cref="VS2005Target"/> class.
/// </summary> /// </summary>
public VS2005Target() public VS2005Target()
: base() {
{ 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 static bool ExtensionSpecified(string refName)
{
return refName.EndsWith(".dll") || refName.EndsWith(".exe");
}
private static string GetProjectExtension(ProjectNode project)
{
string extension = ".dll";
if (project.Type == ProjectType.Exe)
{
extension = ".exe";
}
return extension;
}
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("<Project DefaultTargets=\"Build\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\"{0}>", ToolsVersionXml);
//ps.WriteLine(" <{0}", toolInfo.XMLTag);
ps.WriteLine(" <PropertyGroup>");
ps.WriteLine(" <ProjectType>Local</ProjectType>");
ps.WriteLine(" <ProductVersion>{0}</ProductVersion>", this.ProductVersion);
ps.WriteLine(" <SchemaVersion>{0}</SchemaVersion>", this.SchemaVersion);
ps.WriteLine(" <ProjectGuid>{{{0}}}</ProjectGuid>", project.Guid.ToString().ToUpper());
ps.WriteLine(" <Configuration Condition=\" '$(Configuration)' == '' \">Debug</Configuration>");
ps.WriteLine(" <Platform Condition=\" '$(Platform)' == '' \">AnyCPU</Platform>");
//ps.WriteLine(" <Build>");
//ps.WriteLine(" <Settings");
ps.WriteLine(" <ApplicationIcon>{0}</ApplicationIcon>", project.AppIcon);
ps.WriteLine(" <AssemblyKeyContainerName>");
ps.WriteLine(" </AssemblyKeyContainerName>");
ps.WriteLine(" <AssemblyName>{0}</AssemblyName>", project.AssemblyName);
foreach (ConfigurationNode conf in project.Configurations)
{
if (conf.Options.KeyFile != "")
{
ps.WriteLine(" <AssemblyOriginatorKeyFile>{0}</AssemblyOriginatorKeyFile>", conf.Options.KeyFile);
ps.WriteLine(" <SignAssembly>true</SignAssembly>");
break;
}
}
ps.WriteLine(" <DefaultClientScript>JScript</DefaultClientScript>");
ps.WriteLine(" <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>");
ps.WriteLine(" <DefaultTargetSchema>IE50</DefaultTargetSchema>");
ps.WriteLine(" <DelaySign>false</DelaySign>");
//if(m_Version == VSVersion.VS70)
// ps.WriteLine(" NoStandardLibraries = \"false\"");
ps.WriteLine(" <OutputType>{0}</OutputType>", project.Type.ToString());
ps.WriteLine(" <AppDesignerFolder>{0}</AppDesignerFolder>", project.DesignerFolder);
ps.WriteLine(" <RootNamespace>{0}</RootNamespace>", project.RootNamespace);
ps.WriteLine(" <StartupObject>{0}</StartupObject>", project.StartupObject);
//ps.WriteLine(" >");
ps.WriteLine(" <FileUpgradeFlags>");
ps.WriteLine(" </FileUpgradeFlags>");
ps.WriteLine(" </PropertyGroup>");
foreach (ConfigurationNode conf in project.Configurations)
{
ps.Write(" <PropertyGroup ");
ps.WriteLine("Condition=\" '$(Configuration)|$(Platform)' == '{0}|AnyCPU' \">", conf.Name);
ps.WriteLine(" <AllowUnsafeBlocks>{0}</AllowUnsafeBlocks>", conf.Options["AllowUnsafe"]);
ps.WriteLine(" <BaseAddress>{0}</BaseAddress>", conf.Options["BaseAddress"]);
ps.WriteLine(" <CheckForOverflowUnderflow>{0}</CheckForOverflowUnderflow>", conf.Options["CheckUnderflowOverflow"]);
ps.WriteLine(" <ConfigurationOverrideFile>");
ps.WriteLine(" </ConfigurationOverrideFile>");
ps.WriteLine(" <DefineConstants>{0}</DefineConstants>", conf.Options["CompilerDefines"]);
ps.WriteLine(" <DocumentationFile>{0}</DocumentationFile>", Helper.NormalizePath(conf.Options["XmlDocFile"].ToString()));
ps.WriteLine(" <DebugSymbols>{0}</DebugSymbols>", conf.Options["DebugInformation"]);
ps.WriteLine(" <FileAlignment>{0}</FileAlignment>", conf.Options["FileAlignment"]);
// ps.WriteLine(" <IncrementalBuild = \"{0}\"", conf.Options["IncrementalBuild"]);
// if(m_Version == VSVersion.VS71)
// {
// ps.WriteLine(" NoStdLib = \"{0}\"", conf.Options["NoStdLib"]);
// ps.WriteLine(" NoWarn = \"{0}\"", conf.Options["SuppressWarnings"]);
// }
ps.WriteLine(" <Optimize>{0}</Optimize>", conf.Options["OptimizeCode"]);
ps.WriteLine(" <OutputPath>{0}</OutputPath>",
Helper.EndPath(Helper.NormalizePath(conf.Options["OutputPath"].ToString())));
ps.WriteLine(" <RegisterForComInterop>{0}</RegisterForComInterop>", conf.Options["RegisterComInterop"]);
ps.WriteLine(" <RemoveIntegerChecks>{0}</RemoveIntegerChecks>", conf.Options["RemoveIntegerChecks"]);
ps.WriteLine(" <TreatWarningsAsErrors>{0}</TreatWarningsAsErrors>", conf.Options["WarningsAsErrors"]);
ps.WriteLine(" <WarningLevel>{0}</WarningLevel>", conf.Options["WarningLevel"]);
ps.WriteLine(" <NoWarn>{0}</NoWarn>", conf.Options["SuppressWarnings"]);
ps.WriteLine(" </PropertyGroup>");
}
//ps.WriteLine(" </Settings>");
// Assembly References
ps.WriteLine(" <ItemGroup>");
string refPath = ((ReferencePathNode) project.ReferencePaths[0]).Path;
foreach (ReferenceNode refr in project.References)
{
if (!solution.ProjectsTable.ContainsKey(refr.Name))
{
ps.Write(" <Reference");
ps.Write(" Include=\"");
ps.Write(refr.Name);
ps.WriteLine("\" >");
string path;
if (String.IsNullOrEmpty(refr.Path))
{
if ( ExtensionSpecified( refr.Name ) )
{
path = Helper.NormalizePath(Path.Combine(refPath, refr.Name), '\\');
}
else
{
path = refr.Name + ".dll";
}
}
else
{
path = refr.Path;
}
// TODO: Allow reference to *.exe files
ps.WriteLine(" <HintPath>{0}</HintPath>", path );
ps.WriteLine(" <Private>{0}</Private>", refr.LocalCopy);
ps.WriteLine(" </Reference>");
}
}
ps.WriteLine(" </ItemGroup>");
//Project References
ps.WriteLine(" <ItemGroup>");
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(" <ProjectReference Include=\"{0}\">", path );
//<ProjectReference Include="..\..\RealmForge\Utility\RealmForge.Utility.csproj">
ps.WriteLine(" <Name>{0}</Name>", refProject.Name);
// <Name>RealmForge.Utility</Name>
ps.WriteLine(" <Project>{{{0}}}</Project>", refProject.Guid.ToString().ToUpper());
// <Project>{6880D1D3-69EE-461B-B841-5319845B20D3}</Project>
ps.WriteLine(" <Package>{0}</Package>", toolInfo.Guid.ToString().ToUpper());
// <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
ps.WriteLine("\t\t\t<Private>{0}</Private>", refr.LocalCopy);
ps.WriteLine(" </ProjectReference>");
//</ProjectReference>
}
else
{
}
}
ps.WriteLine(" </ItemGroup>");
// ps.WriteLine(" </Build>");
ps.WriteLine(" <ItemGroup>");
// ps.WriteLine(" <Include>");
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(" <EmbeddedResource Include=\"{0}\">", file.Substring(0, file.LastIndexOf('.')) + ".resx");
int slash = file.LastIndexOf('\\');
if (slash == -1)
{
ps.WriteLine(" <DependentUpon>{0}</DependentUpon>", file);
}
else
{
ps.WriteLine(" <DependentUpon>{0}</DependentUpon>", file.Substring(slash + 1, file.Length - slash - 1));
}
ps.WriteLine(" <SubType>Designer</SubType>");
ps.WriteLine(" </EmbeddedResource>");
//
}
if (project.Files.GetSubType(file) != SubType.Code && project.Files.GetSubType(file) == SubType.Designer)
{
ps.WriteLine(" <EmbeddedResource Include=\"{0}\">", file.Substring(0, file.LastIndexOf('.')) + ".resx");
ps.WriteLine(" <SubType>" + project.Files.GetSubType(file) + "</SubType>");
ps.WriteLine(" <Generator>ResXFileCodeGenerator</Generator>");
ps.WriteLine(" <LastGenOutput>Resources.Designer.cs</LastGenOutput>");
ps.WriteLine(" </EmbeddedResource>");
ps.WriteLine(" <Compile Include=\"{0}\">", file.Substring(0, file.LastIndexOf('.')) + ".Designer.cs");
ps.WriteLine(" <AutoGen>True</AutoGen>");
ps.WriteLine(" <DesignTime>True</DesignTime>");
ps.WriteLine(" <DependentUpon>Resources.resx</DependentUpon>");
ps.WriteLine(" </Compile>");
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(" <Generator>SettingsSingleFileGenerator</Generator>");
//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(" <LastGenOutput>{0}</LastGenOutput>", fileName.Substring(0, fileName.LastIndexOf('.')) + ".Designer.cs");
}
else
{
ps.WriteLine(" <LastGenOutput>{0}</LastGenOutput>", fileName.Substring(0, fileName.LastIndexOf('.')) + ".Designer.cs");
}
}
else
{
ps.WriteLine(" <SubType>Code</SubType>");
ps.WriteLine(" <AutoGen>True</AutoGen>");
ps.WriteLine(" <DesignTimeSharedInput>True</DesignTimeSharedInput>");
string fileNameShort = fileName.Substring(0, fileName.LastIndexOf('.'));
string fileNameShorter = fileNameShort.Substring(0, fileNameShort.LastIndexOf('.'));
ps.WriteLine(" <DependentUpon>{0}</DependentUpon>", 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));
int startPos = 0;
if ( project.Files.GetPreservePath( file ) )
{
while ( ( @"./\" ).IndexOf( file.Substring( startPos, 1 ) ) != -1 )
startPos++;
}
else
{
startPos = file.LastIndexOf( Path.GetFileName( file ) );
}
ps.WriteLine("Include=\"{0}\">", Helper.NormalizePath(file));
if (file.Contains("Designer.cs"))
{
string d = ".Designer.cs";
int index = file.Contains("\\") ? file.IndexOf("\\") + 1 : 0;
ps.WriteLine(" <DependentUpon>{0}</DependentUpon>", file.Substring(index, file.Length - index - d.Length) + ".cs");
}
if (project.Files.GetIsLink(file))
{
string alias = project.Files.GetLinkPath( file );
alias += file.Substring( startPos );
alias = Helper.NormalizePath( alias );
ps.WriteLine( " <Link>{0}</Link>", alias );
}
else if (project.Files.GetBuildAction(file) != BuildAction.None)
{
if (project.Files.GetBuildAction(file) != BuildAction.EmbeddedResource)
{
ps.WriteLine(" <SubType>{0}</SubType>", project.Files.GetSubType(file));
}
}
if (project.Files.GetCopyToOutput(file) != CopyToOutput.Never)
{
ps.WriteLine(" <CopyToOutputDirectory>{0}</CopyToOutputDirectory>", project.Files.GetCopyToOutput(file));
}
ps.WriteLine(" </{0}>", project.Files.GetBuildAction(file));
}
}
}
// ps.WriteLine(" </Include>");
ps.WriteLine(" </ItemGroup>");
ps.WriteLine(" <Import Project=\"" + toolInfo.ImportProject + "\" />");
ps.WriteLine(" <PropertyGroup>");
ps.WriteLine(" <PreBuildEvent>");
ps.WriteLine(" </PreBuildEvent>");
ps.WriteLine(" <PostBuildEvent>");
ps.WriteLine(" </PostBuildEvent>");
ps.WriteLine(" </PropertyGroup>");
// ps.WriteLine(" </{0}>", toolInfo.XMLTag);
ps.WriteLine("</Project>");
}
#endregion
#region User File
ps = new StreamWriter(projectFile + ".user");
using (ps)
{
ps.WriteLine("<Project xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">");
//ps.WriteLine( "<VisualStudioProject>" );
//ps.WriteLine(" <{0}>", toolInfo.XMLTag);
//ps.WriteLine(" <Build>");
ps.WriteLine(" <PropertyGroup>");
//ps.WriteLine(" <Settings ReferencePath=\"{0}\">", MakeRefPath(project));
ps.WriteLine(" <Configuration Condition=\" '$(Configuration)' == '' \">Debug</Configuration>");
if (projectFile.Contains( "OpenSim.csproj" ))
{
ps.WriteLine(" <StartArguments>-loginserver -sandbox -accounts</StartArguments>");
}
ps.WriteLine(" <Platform Condition=\" '$(Platform)' == '' \">AnyCPU</Platform>");
ps.WriteLine(" <ReferencePath>{0}</ReferencePath>", MakeRefPath(project));
ps.WriteLine(" <LastOpenVersion>{0}</LastOpenVersion>", this.ProductVersion);
ps.WriteLine(" <ProjectView>ProjectFiles</ProjectView>");
ps.WriteLine(" <ProjectTrust>0</ProjectTrust>");
ps.WriteLine(" </PropertyGroup>");
foreach (ConfigurationNode conf in project.Configurations)
{
ps.Write(" <PropertyGroup");
ps.Write(" Condition = \" '$(Configuration)|$(Platform)' == '{0}|AnyCPU' \"", conf.Name);
ps.WriteLine(" />");
}
ps.WriteLine("</Project>");
}
#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");
using (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(SolutionTag);
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
/// <summary>
/// Writes the specified kern.
/// </summary>
/// <param name="kern">The kern.</param>
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;
}
/// <summary>
/// Cleans the specified kern.
/// </summary>
/// <param name="kern">The kern.</param>
public virtual void Clean(Kernel kern)
{
if (kern == null)
{
throw new ArgumentNullException("kern");
}
kernel = kern;
foreach (SolutionNode sol in kernel.Solutions)
{
CleanSolution(sol);
}
kernel = null;
}
/// <summary>
/// Gets the name.
/// </summary>
/// <value>The name.</value>
public virtual string Name
{
get
{
return "vs2005";
}
} }
#endregion #endregion

View File

@ -1,132 +1,56 @@
using System; using System;
using System.Collections; using System.Collections.Generic;
using System.Collections.Specialized;
using System.IO;
using System.Text; using System.Text;
using Prebuild.Core.Attributes; using Prebuild.Core.Attributes;
using Prebuild.Core.Interfaces;
using Prebuild.Core.Nodes;
using Prebuild.Core.Utilities;
using System.CodeDom.Compiler;
namespace Prebuild.Core.Targets namespace Prebuild.Core.Targets
{ {
[Target("vs2008")]
/// <summary> public class VS2008Target : VS2005Target
/// {
/// </summary> protected override string SolutionTag
[Target("vs2008")]
public class VS2008Target : VSGenericTarget
{
#region Fields
string solutionVersion = "10.00";
string productVersion = "9.0.21022";
string schemaVersion = "2.0";
string versionName = "Visual Studio 2008";
string name = "vs2008";
VSVersion version = VSVersion.VS90;
Hashtable tools;
Kernel kernel;
/// <summary>
/// Gets or sets the solution version.
/// </summary>
/// <value>The solution version.</value>
public override string SolutionVersion
{
get
{
return solutionVersion;
}
}
/// <summary>
/// Gets or sets the product version.
/// </summary>
/// <value>The product version.</value>
public override string ProductVersion
{
get
{
return productVersion;
}
}
/// <summary>
/// Gets or sets the schema version.
/// </summary>
/// <value>The schema version.</value>
public override string SchemaVersion
{
get
{
return schemaVersion;
}
}
/// <summary>
/// Gets or sets the name of the version.
/// </summary>
/// <value>The name of the version.</value>
public override string VersionName
{
get
{
return versionName;
}
}
/// <summary>
/// Gets or sets the version.
/// </summary>
/// <value>The version.</value>
public override VSVersion Version
{
get
{
return version;
}
}
/// <summary>
/// Gets the name.
/// </summary>
/// <value>The name.</value>
public override string Name
{
get
{
return name;
}
}
protected override string GetToolsVersionXml(FrameworkVersion frameworkVersion)
{
switch (frameworkVersion)
{
case FrameworkVersion.v3_5:
return "ToolsVersion=\"3.5\"";
case FrameworkVersion.v3_0:
return "ToolsVersion=\"3.0\"";
default:
return "ToolsVersion=\"2.0\"";
}
}
public override string SolutionTag
{ {
get { return "# Visual Studio 2008"; } get { return "# Visual Studio 2008"; }
} }
#endregion protected override string SolutionVersion
{
get
{
return "10.00";
}
}
#region Constructors protected override string VersionName
{
get
{
return "Visual C# 2008";
}
}
/// <summary> protected override string ToolsVersionXml
/// Initializes a new instance of the <see cref="VS2005Target"/> class. {
/// </summary> get
public VS2008Target() {
: base() return " ToolsVersion=\"3.5\"";
{ }
} }
#endregion protected override string ProductVersion
} {
get
{
return "9.0.21022";
}
}
public override string Name
{
get
{
return "vs2008";
}
}
}
} }

View File

@ -1,881 +0,0 @@
#region BSD License
/*
Copyright (c) 2008 Matthew Holmes (matthew@wildfiregames.com), John Anderson (sontek@gmail.com)
Redistribution and use in source and binary forms, with or without modification, are permitted
provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions
and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
and the following disclaimer in the documentation and/or other materials provided with the
distribution.
* The name of the author may not be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#endregion
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.IO;
using System.Text;
using Prebuild.Core.Attributes;
using Prebuild.Core.Interfaces;
using Prebuild.Core.Nodes;
using Prebuild.Core.Utilities;
using System.CodeDom.Compiler;
namespace Prebuild.Core.Targets
{
/// <summary>
///
/// </summary>
public abstract class VSGenericTarget : ITarget
{
#region Fields
readonly Hashtable tools = new Hashtable();
Kernel kernel;
#endregion
#region Properties
/// <summary>
/// Gets or sets the solution version.
/// </summary>
/// <value>The solution version.</value>
public abstract string SolutionVersion { get; }
/// <summary>
/// Gets or sets the product version.
/// </summary>
/// <value>The product version.</value>
public abstract string ProductVersion { get; }
/// <summary>
/// Gets or sets the schema version.
/// </summary>
/// <value>The schema version.</value>
public abstract string SchemaVersion { get; }
/// <summary>
/// Gets or sets the name of the version.
/// </summary>
/// <value>The name of the version.</value>
public abstract string VersionName { get; }
/// <summary>
/// Gets or sets the version.
/// </summary>
/// <value>The version.</value>
public abstract VSVersion Version { get; }
/// <summary>
/// Gets the name.
/// </summary>
/// <value>The name.</value>
public abstract string Name { get; }
protected abstract string GetToolsVersionXml(FrameworkVersion version);
public abstract string SolutionTag { get; }
#endregion
#region Constructors
/// <summary>
/// Initializes a new instance of the <see cref="VSGenericTarget"/> class.
/// </summary>
protected VSGenericTarget()
{
this.tools["C#"] = new ToolInfo("C#", "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}", "csproj", "CSHARP", "$(MSBuildBinPath)\\Microsoft.CSHARP.Targets");
this.tools["Database"] = new ToolInfo("Database", "{4F174C21-8C12-11D0-8340-0000F80270F8}", "dbp", "UNKNOWN");
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");
this.tools["Folder"] = new ToolInfo("Folder", "{2150E333-8FDC-42A3-9474-1A3956D46DE8}", null, null);
}
#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 static ProjectNode FindProjectInSolution(string name, SolutionNode solution)
{
SolutionNode node = solution;
while (node.Parent is SolutionNode)
node = node.Parent as SolutionNode;
return FindProjectInSolutionRecursively(name, node);
}
private static ProjectNode FindProjectInSolutionRecursively(string name, SolutionNode solution)
{
if (solution.ProjectsTable.ContainsKey(name))
return (ProjectNode)solution.ProjectsTable[name];
foreach (SolutionNode child in solution.Solutions)
{
ProjectNode node = FindProjectInSolutionRecursively(name, child);
if (node != null)
return node;
}
return null;
}
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("<Project DefaultTargets=\"Build\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\" {0}>", GetToolsVersionXml(project.FrameworkVersion));
ps.WriteLine(" <PropertyGroup>");
ps.WriteLine(" <ProjectType>Local</ProjectType>");
ps.WriteLine(" <ProductVersion>{0}</ProductVersion>", this.ProductVersion);
ps.WriteLine(" <SchemaVersion>{0}</SchemaVersion>", this.SchemaVersion);
ps.WriteLine(" <ProjectGuid>{{{0}}}</ProjectGuid>", project.Guid.ToString().ToUpper());
// Visual Studio has a hard coded guid for the project type
if (project.Type == ProjectType.Web)
ps.WriteLine(" <ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>");
ps.WriteLine(" <Configuration Condition=\" '$(Configuration)' == '' \">Debug</Configuration>");
ps.WriteLine(" <Platform Condition=\" '$(Platform)' == '' \">AnyCPU</Platform>");
ps.WriteLine(" <ApplicationIcon>{0}</ApplicationIcon>", project.AppIcon);
ps.WriteLine(" <AssemblyKeyContainerName>");
ps.WriteLine(" </AssemblyKeyContainerName>");
ps.WriteLine(" <AssemblyName>{0}</AssemblyName>", project.AssemblyName);
foreach (ConfigurationNode conf in project.Configurations)
{
if (conf.Options.KeyFile != "")
{
ps.WriteLine(" <AssemblyOriginatorKeyFile>{0}</AssemblyOriginatorKeyFile>", conf.Options.KeyFile);
ps.WriteLine(" <SignAssembly>true</SignAssembly>");
break;
}
}
ps.WriteLine(" <DefaultClientScript>JScript</DefaultClientScript>");
ps.WriteLine(" <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>");
ps.WriteLine(" <DefaultTargetSchema>IE50</DefaultTargetSchema>");
ps.WriteLine(" <DelaySign>false</DelaySign>");
ps.WriteLine(" <TargetFrameworkVersion>{0}</TargetFrameworkVersion>", project.FrameworkVersion.ToString().Replace("_", "."));
ps.WriteLine(" <OutputType>{0}</OutputType>", project.Type == ProjectType.Web ? ProjectType.Library.ToString() : project.Type.ToString());
ps.WriteLine(" <AppDesignerFolder>{0}</AppDesignerFolder>", project.DesignerFolder);
ps.WriteLine(" <RootNamespace>{0}</RootNamespace>", project.RootNamespace);
ps.WriteLine(" <StartupObject>{0}</StartupObject>", project.StartupObject);
if (string.IsNullOrEmpty(project.DebugStartParameters))
{
ps.WriteLine(" <StartArguments>{0}</StartArguments>", project.DebugStartParameters);
}
ps.WriteLine(" <FileUpgradeFlags>");
ps.WriteLine(" </FileUpgradeFlags>");
ps.WriteLine(" </PropertyGroup>");
foreach (ConfigurationNode conf in project.Configurations)
{
ps.Write(" <PropertyGroup ");
ps.WriteLine("Condition=\" '$(Configuration)|$(Platform)' == '{0}|AnyCPU' \">", conf.Name);
ps.WriteLine(" <AllowUnsafeBlocks>{0}</AllowUnsafeBlocks>", conf.Options["AllowUnsafe"]);
ps.WriteLine(" <BaseAddress>{0}</BaseAddress>", conf.Options["BaseAddress"]);
ps.WriteLine(" <CheckForOverflowUnderflow>{0}</CheckForOverflowUnderflow>", conf.Options["CheckUnderflowOverflow"]);
ps.WriteLine(" <ConfigurationOverrideFile>");
ps.WriteLine(" </ConfigurationOverrideFile>");
ps.WriteLine(" <DefineConstants>{0}</DefineConstants>", conf.Options["CompilerDefines"]);
ps.WriteLine(" <DocumentationFile>{0}</DocumentationFile>", Helper.NormalizePath(conf.Options["XmlDocFile"].ToString()));
ps.WriteLine(" <DebugSymbols>{0}</DebugSymbols>", conf.Options["DebugInformation"]);
ps.WriteLine(" <FileAlignment>{0}</FileAlignment>", conf.Options["FileAlignment"]);
ps.WriteLine(" <Optimize>{0}</Optimize>", conf.Options["OptimizeCode"]);
if (project.Type != ProjectType.Web)
ps.WriteLine(" <OutputPath>{0}</OutputPath>",
Helper.EndPath(Helper.NormalizePath(conf.Options["OutputPath"].ToString())));
else
ps.WriteLine(" <OutputPath>{0}</OutputPath>",
Helper.EndPath(Helper.NormalizePath("bin\\")));
ps.WriteLine(" <RegisterForComInterop>{0}</RegisterForComInterop>", conf.Options["RegisterComInterop"]);
ps.WriteLine(" <RemoveIntegerChecks>{0}</RemoveIntegerChecks>", conf.Options["RemoveIntegerChecks"]);
ps.WriteLine(" <TreatWarningsAsErrors>{0}</TreatWarningsAsErrors>", conf.Options["WarningsAsErrors"]);
ps.WriteLine(" <WarningLevel>{0}</WarningLevel>", conf.Options["WarningLevel"]);
ps.WriteLine(" <NoStdLib>{0}</NoStdLib>", conf.Options["NoStdLib"]);
ps.WriteLine(" <NoWarn>{0}</NoWarn>", conf.Options["SuppressWarnings"]);
ps.WriteLine(" </PropertyGroup>");
}
//ps.WriteLine(" </Settings>");
List<ProjectNode> projectReferences = new List<ProjectNode>();
List<ReferenceNode> otherReferences = new List<ReferenceNode>();
foreach (ReferenceNode refr in project.References)
{
ProjectNode projectNode = FindProjectInSolution(refr.Name, solution);
if (projectNode == null)
otherReferences.Add(refr);
else
projectReferences.Add(projectNode);
}
// Assembly References
ps.WriteLine(" <ItemGroup>");
foreach (ReferenceNode refr in otherReferences)
{
ps.Write(" <Reference");
ps.Write(" Include=\"");
ps.Write(refr.Name);
ps.WriteLine("\" >");
ps.Write(" <Name>");
ps.Write(refr.Name);
ps.WriteLine("</Name>");
// TODO: Allow reference to *.exe files
ps.WriteLine(" <Private>{0}</Private>", refr.LocalCopy);
ps.WriteLine(" </Reference>");
}
ps.WriteLine(" </ItemGroup>");
//Project References
ps.WriteLine(" <ItemGroup>");
foreach (ProjectNode projectReference in projectReferences)
{
ToolInfo tool = (ToolInfo)tools[projectReference.Language];
if (tools == null)
throw new UnknownLanguageException();
string path =
Helper.MakePathRelativeTo(project.FullPath,
Helper.MakeFilePath(projectReference.FullPath, projectReference.Name, tool.FileExtension));
ps.WriteLine(" <ProjectReference Include=\"{0}\">", path);
// TODO: Allow reference to visual basic projects
ps.WriteLine(" <Name>{0}</Name>", projectReference.Name);
ps.WriteLine(" <Project>{0}</Project>", projectReference.Guid.ToString("B").ToUpper());
ps.WriteLine(" <Package>{0}</Package>", tool.Guid.ToUpper());
ps.WriteLine(" </ProjectReference>");
}
ps.WriteLine(" </ItemGroup>");
// ps.WriteLine(" </Build>");
ps.WriteLine(" <ItemGroup>");
// ps.WriteLine(" <Include>");
List<string> list = new List<string>();
foreach (string path in project.Files)
{
string lower = path.ToLower();
if (lower.EndsWith(".resx"))
{
string codebehind = String.Format("{0}.Designer{1}", path.Substring(0, path.LastIndexOf('.')), toolInfo.LanguageExtension);
if (!list.Contains(codebehind))
list.Add(codebehind);
}
}
foreach (string file in project.Files)
{
// if (file == "Properties\\Bind.Designer.cs")
// {
// Console.WriteLine("Wait a minute!");
// Console.WriteLine(project.Files.GetSubType(file).ToString());
// }
SubType subType = project.Files.GetSubType(file);
if (subType != SubType.Code && subType != SubType.Settings && subType != SubType.Designer
&& subType != SubType.CodeBehind)
{
ps.WriteLine(" <EmbeddedResource Include=\"{0}\">", file.Substring(0, file.LastIndexOf('.')) + ".resx");
ps.WriteLine(" <DependentUpon>{0}</DependentUpon>", Path.GetFileName(file));
ps.WriteLine(" <SubType>Designer</SubType>");
ps.WriteLine(" </EmbeddedResource>");
//
}
if (subType == SubType.Designer)
{
ps.WriteLine(" <EmbeddedResource Include=\"{0}\">", file);
ps.WriteLine(" <SubType>" + subType + "</SubType>");
ps.WriteLine(" <Generator>ResXFileCodeGenerator</Generator>");
string autogen_name = file.Substring(0, file.LastIndexOf('.')) + ".Designer.cs";
string dependent_name = file.Substring(0, file.LastIndexOf('.')) + ".cs";
ps.WriteLine(" <LastGenOutput>{0}</LastGenOutput>", autogen_name);
// Check for a parent .cs file with the same name as this designer file
if (File.Exists(dependent_name))
ps.WriteLine(" <DependentUpon>{0}</DependentUpon>", Path.GetFileName(dependent_name));
ps.WriteLine(" </EmbeddedResource>");
if (File.Exists(autogen_name))
{
ps.WriteLine(" <Compile Include=\"{0}\">", autogen_name);
ps.WriteLine(" <AutoGen>True</AutoGen>");
ps.WriteLine(" <DesignTime>True</DesignTime>");
// If a parent .cs file exists, link this autogen file to it. Otherwise link
// to the designer file
if (File.Exists(dependent_name))
ps.WriteLine(" <DependentUpon>{0}</DependentUpon>", Path.GetFileName(dependent_name));
else
ps.WriteLine(" <DependentUpon>{0}</DependentUpon>", Path.GetFileName(file));
ps.WriteLine(" </Compile>");
}
list.Add(autogen_name);
}
if (subType == SubType.Settings)
{
ps.Write(" <{0} ", project.Files.GetBuildAction(file));
ps.WriteLine("Include=\"{0}\">", file);
string fileName = Path.GetFileName(file);
if (project.Files.GetBuildAction(file) == BuildAction.None)
{
ps.WriteLine(" <Generator>SettingsSingleFileGenerator</Generator>");
ps.WriteLine(" <LastGenOutput>{0}</LastGenOutput>", fileName.Substring(0, fileName.LastIndexOf('.')) + ".Designer.cs");
}
else
{
ps.WriteLine(" <SubType>Code</SubType>");
ps.WriteLine(" <AutoGen>True</AutoGen>");
ps.WriteLine(" <DesignTimeSharedInput>True</DesignTimeSharedInput>");
string fileNameShort = fileName.Substring(0, fileName.LastIndexOf('.'));
string fileNameShorter = fileNameShort.Substring(0, fileNameShort.LastIndexOf('.'));
ps.WriteLine(" <DependentUpon>{0}</DependentUpon>", Path.GetFileName(fileNameShorter + ".settings"));
}
ps.WriteLine(" </{0}>", project.Files.GetBuildAction(file));
}
else if (subType != SubType.Designer)
{
string path = Helper.NormalizePath(file);
string path_lower = path.ToLower();
if (!list.Contains(file))
{
ps.Write(" <{0} ", project.Files.GetBuildAction(path));
int startPos = 0;
if (project.Files.GetPreservePath(file))
{
while ((@"./\").IndexOf(file.Substring(startPos, 1)) != -1)
startPos++;
}
else
{
startPos = file.LastIndexOf(Path.GetFileName(path));
}
ps.WriteLine("Include=\"{0}\">", path);
int last_period_index = file.LastIndexOf('.');
string short_file_name = file.Substring(0, last_period_index);
string extension = Path.GetExtension(path);
string designer_format = string.Format(".designer{0}", extension);
if (path_lower.EndsWith(designer_format))
{
int designer_index = path_lower.IndexOf(designer_format);
string file_name = path.Substring(0, designer_index);
if (File.Exists(file_name))
ps.WriteLine(" <DependentUpon>{0}</DependentUpon>", Path.GetFileName(file_name));
else if (File.Exists(file_name + ".resx"))
ps.WriteLine(" <DependentUpon>{0}</DependentUpon>", Path.GetFileName(file_name + ".resx"));
}
else if (subType == SubType.CodeBehind)
{
ps.WriteLine(" <DependentUpon>{0}</DependentUpon>", Path.GetFileName(short_file_name));
}
if (project.Files.GetIsLink(file))
{
string alias = project.Files.GetLinkPath(file);
alias += file.Substring(startPos);
alias = Helper.NormalizePath(alias);
ps.WriteLine(" <Link>{0}</Link>", alias);
}
else if (project.Files.GetBuildAction(file) != BuildAction.None)
{
if (project.Files.GetBuildAction(file) != BuildAction.EmbeddedResource)
{
ps.WriteLine(" <SubType>{0}</SubType>", subType);
}
}
if (project.Files.GetCopyToOutput(file) != CopyToOutput.Never)
{
ps.WriteLine(" <CopyToOutputDirectory>{0}</CopyToOutputDirectory>", project.Files.GetCopyToOutput(file));
}
ps.WriteLine(" </{0}>", project.Files.GetBuildAction(file));
}
}
}
ps.WriteLine(" </ItemGroup>");
ps.WriteLine(" <Import Project=\"" + toolInfo.ImportProject + "\" />");
ps.WriteLine(" <PropertyGroup>");
ps.WriteLine(" <PreBuildEvent>");
ps.WriteLine(" </PreBuildEvent>");
ps.WriteLine(" <PostBuildEvent>");
ps.WriteLine(" </PostBuildEvent>");
ps.WriteLine(" </PropertyGroup>");
ps.WriteLine("</Project>");
}
#endregion
#region User File
ps = new StreamWriter(projectFile + ".user");
using (ps)
{
ps.WriteLine("<Project xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">");
//ps.WriteLine( "<VisualStudioProject>" );
//ps.WriteLine(" <{0}>", toolInfo.XMLTag);
//ps.WriteLine(" <Build>");
ps.WriteLine(" <PropertyGroup>");
//ps.WriteLine(" <Settings ReferencePath=\"{0}\">", MakeRefPath(project));
ps.WriteLine(" <Configuration Condition=\" '$(Configuration)' == '' \">Debug</Configuration>");
ps.WriteLine(" <Platform Condition=\" '$(Platform)' == '' \">AnyCPU</Platform>");
ps.WriteLine(" <ReferencePath>{0}</ReferencePath>", MakeRefPath(project));
ps.WriteLine(" <LastOpenVersion>{0}</LastOpenVersion>", this.ProductVersion);
ps.WriteLine(" <ProjectView>ProjectFiles</ProjectView>");
ps.WriteLine(" <ProjectTrust>0</ProjectTrust>");
ps.WriteLine(" </PropertyGroup>");
foreach (ConfigurationNode conf in project.Configurations)
{
ps.Write(" <PropertyGroup");
ps.Write(" Condition = \" '$(Configuration)|$(Platform)' == '{0}|AnyCPU' \"", conf.Name);
ps.WriteLine(" />");
}
ps.WriteLine("</Project>");
}
#endregion
kernel.CurrentWorkingDirectory.Pop();
}
private void WriteSolution(SolutionNode solution, bool writeSolutionToDisk)
{
kernel.Log.Write("Creating {0} solution and project files", this.VersionName);
foreach (SolutionNode child in solution.Solutions)
{
kernel.Log.Write("...Creating folder: {0}", child.Name);
WriteSolution(child, false);
}
foreach (ProjectNode project in solution.Projects)
{
kernel.Log.Write("...Creating project: {0}", project.Name);
WriteProject(solution, project);
}
foreach (DatabaseProjectNode project in solution.DatabaseProjects)
{
kernel.Log.Write("...Creating database project: {0}", project.Name);
WriteDatabaseProject(solution, project);
}
if (writeSolutionToDisk) // only write main solution
{
kernel.Log.Write("");
string solutionFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "sln");
using (StreamWriter ss = new StreamWriter(solutionFile))
{
kernel.CurrentWorkingDirectory.Push();
Helper.SetCurrentDir(Path.GetDirectoryName(solutionFile));
ss.WriteLine("Microsoft Visual Studio Solution File, Format Version {0}", this.SolutionVersion);
ss.WriteLine(SolutionTag);
WriteProjectDeclarations(ss, solution, solution);
ss.WriteLine("Global");
ss.WriteLine("\tGlobalSection(SolutionConfigurationPlatforms) = preSolution");
foreach (ConfigurationNode conf in solution.Configurations)
{
ss.WriteLine("\t\t{0}|Any CPU = {0}|Any CPU", conf.Name);
}
ss.WriteLine("\tEndGlobalSection");
ss.WriteLine("\tGlobalSection(ProjectConfigurationPlatforms) = postSolution");
WriteConfigurationLines(solution.Configurations, solution, ss);
ss.WriteLine("\tEndGlobalSection");
if (solution.Solutions.Count > 0)
{
ss.WriteLine("\tGlobalSection(NestedProjects) = preSolution");
foreach (SolutionNode embeddedSolution in solution.Solutions)
{
WriteNestedProjectMap(ss, embeddedSolution);
}
ss.WriteLine("\tEndGlobalSection");
}
ss.WriteLine("EndGlobal");
}
kernel.CurrentWorkingDirectory.Pop();
}
}
private void WriteProjectDeclarations(StreamWriter writer, SolutionNode actualSolution, SolutionNode embeddedSolution)
{
foreach (SolutionNode childSolution in embeddedSolution.Solutions)
{
WriteEmbeddedSolution(writer, childSolution);
WriteProjectDeclarations(writer, actualSolution, childSolution);
}
foreach (ProjectNode project in embeddedSolution.Projects)
{
WriteProject(actualSolution, writer, project);
}
foreach (DatabaseProjectNode dbProject in embeddedSolution.DatabaseProjects)
{
WriteProject(actualSolution, writer, dbProject);
}
if (actualSolution.Guid == embeddedSolution.Guid)
{
WriteSolutionFiles(actualSolution, writer);
}
}
private static void WriteNestedProjectMap(StreamWriter writer, SolutionNode embeddedSolution)
{
foreach (ProjectNode project in embeddedSolution.Projects)
{
WriteNestedProject(writer, embeddedSolution, project.Guid);
}
foreach (DatabaseProjectNode dbProject in embeddedSolution.DatabaseProjects)
{
WriteNestedProject(writer, embeddedSolution, dbProject.Guid);
}
foreach (SolutionNode child in embeddedSolution.Solutions)
{
WriteNestedProject(writer, embeddedSolution, child.Guid);
WriteNestedProjectMap(writer, child);
}
}
private static void WriteNestedProject(StreamWriter writer, SolutionNode solution, Guid projectGuid)
{
WriteNestedFolder(writer, solution.Guid, projectGuid);
}
private static void WriteNestedFolder(StreamWriter writer, Guid parentGuid, Guid childGuid)
{
writer.WriteLine("\t\t{0} = {1}",
childGuid.ToString("B").ToUpper(),
parentGuid.ToString("B").ToUpper());
}
private static void WriteConfigurationLines(ICollection configurations, SolutionNode solution, StreamWriter ss)
{
foreach (ProjectNode project in solution.Projects)
{
foreach (ConfigurationNode conf in configurations)
{
ss.WriteLine("\t\t{0}.{1}|Any CPU.ActiveCfg = {1}|Any CPU",
project.Guid.ToString("B").ToUpper(),
conf.Name);
ss.WriteLine("\t\t{0}.{1}|Any CPU.Build.0 = {1}|Any CPU",
project.Guid.ToString("B").ToUpper(),
conf.Name);
}
}
foreach (SolutionNode child in solution.Solutions)
{
WriteConfigurationLines(configurations, child, ss);
}
}
private void WriteSolutionFiles(SolutionNode solution, StreamWriter ss)
{
WriteProject(ss, "Folder", solution.Guid, "Solution Files", "Solution Files", solution.Files);
}
private void WriteEmbeddedSolution(StreamWriter writer, SolutionNode embeddedSolution)
{
WriteProject(writer, "Folder", embeddedSolution.Guid, embeddedSolution.Name, embeddedSolution.Name, embeddedSolution.Files);
}
private void WriteProject(SolutionNode solution, StreamWriter ss, ProjectNode project)
{
WriteProject(ss, solution, project.Language, project.Guid, project.Name, project.FullPath);
}
private void WriteProject(SolutionNode solution, StreamWriter ss, DatabaseProjectNode dbProject)
{
if (solution.Files != null && solution.Files.Count > 0)
WriteProject(ss, solution, "Database", dbProject.Guid, dbProject.Name, dbProject.FullPath);
}
private static bool ExtensionSpecified(string refName)
{
return refName.EndsWith(".dll") || refName.EndsWith(".exe");
}
private static string GetProjectExtension(ProjectNode project)
{
string extension = ".dll";
if (project.Type == ProjectType.Exe)
{
extension = ".exe";
}
return extension;
}
const string ProjectDeclarationBeginFormat = "Project(\"{0}\") = \"{1}\", \"{2}\", \"{3}\"";
const string ProjectDeclarationEndFormat = "EndProject";
private void WriteProject(StreamWriter ss, SolutionNode solution, string language, Guid guid, string name, string projectFullPath)
{
if (!tools.ContainsKey(language))
throw new UnknownLanguageException("Unknown .NET language: " + language);
ToolInfo toolInfo = (ToolInfo)tools[language];
string path = Helper.MakePathRelativeTo(solution.FullPath, projectFullPath);
path = Helper.MakeFilePath(path, name, toolInfo.FileExtension);
WriteProject(ss, language, guid, name, path);
}
private void WriteProject(StreamWriter writer, string language, Guid projectGuid, string name, string location)
{
WriteProject(writer, language, projectGuid, name, location, null);
}
private void WriteProject(StreamWriter writer, string language, Guid projectGuid, string name, string location, FilesNode files)
{
if (!tools.ContainsKey(language))
throw new UnknownLanguageException("Unknown .NET language: " + language);
ToolInfo toolInfo = (ToolInfo)tools[language];
writer.WriteLine(ProjectDeclarationBeginFormat,
toolInfo.Guid,
name,
location,
projectGuid.ToString("B").ToUpper());
if (files != null)
{
writer.WriteLine("\tProjectSection(SolutionItems) = preProject");
foreach (string file in files)
writer.WriteLine("\t\t{0} = {0}", file);
writer.WriteLine("\tEndProjectSection");
}
writer.WriteLine(ProjectDeclarationEndFormat);
}
private void WriteDatabaseProject(SolutionNode solution, DatabaseProjectNode project)
{
string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, "dbp");
IndentedTextWriter ps = new IndentedTextWriter(new StreamWriter(projectFile), " ");
kernel.CurrentWorkingDirectory.Push();
Helper.SetCurrentDir(Path.GetDirectoryName(projectFile));
using (ps)
{
ps.WriteLine("# Microsoft Developer Studio Project File - Database Project");
ps.WriteLine("Begin DataProject = \"{0}\"", project.Name);
ps.Indent++;
ps.WriteLine("MSDTVersion = \"80\"");
// TODO: Use the project.Files property
if (ContainsSqlFiles(Path.GetDirectoryName(projectFile)))
WriteDatabaseFoldersAndFiles(ps, Path.GetDirectoryName(projectFile));
ps.WriteLine("Begin DBRefFolder = \"Database References\"");
ps.Indent++;
foreach (DatabaseReferenceNode reference in project.References)
{
ps.WriteLine("Begin DBRefNode = \"{0}\"", reference.Name);
ps.Indent++;
ps.WriteLine("ConnectStr = \"{0}\"", reference.ConnectionString);
ps.WriteLine("Provider = \"{0}\"", reference.ProviderId.ToString("B").ToUpper());
//ps.WriteLine("Colorizer = 5");
ps.Indent--;
ps.WriteLine("End");
}
ps.Indent--;
ps.WriteLine("End");
ps.Indent--;
ps.WriteLine("End");
ps.Flush();
}
kernel.CurrentWorkingDirectory.Pop();
}
private bool ContainsSqlFiles(string folder)
{
foreach (string file in Directory.GetFiles(folder, "*.sql"))
{
return true; // if the folder contains 1 .sql file, that's good enough
}
foreach (string child in Directory.GetDirectories(folder))
{
if (ContainsSqlFiles(child))
return true; // if 1 child folder contains a .sql file, still good enough
}
return false;
}
private void WriteDatabaseFoldersAndFiles(IndentedTextWriter writer, string folder)
{
foreach (string child in Directory.GetDirectories(folder))
{
if (ContainsSqlFiles(child))
{
writer.WriteLine("Begin Folder = \"{0}\"", Path.GetFileName(child));
writer.Indent++;
WriteDatabaseFoldersAndFiles(writer, child);
writer.Indent--;
writer.WriteLine("End");
}
}
foreach (string file in Directory.GetFiles(folder, "*.sql"))
{
writer.WriteLine("Script = \"{0}\"", Path.GetFileName(file));
}
}
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
/// <summary>
/// Writes the specified kern.
/// </summary>
/// <param name="kern">The kern.</param>
public virtual void Write(Kernel kern)
{
if (kern == null)
{
throw new ArgumentNullException("kern");
}
kernel = kern;
foreach (SolutionNode sol in kernel.Solutions)
{
WriteSolution(sol, true);
}
kernel = null;
}
/// <summary>
/// Cleans the specified kern.
/// </summary>
/// <param name="kern">The kern.</param>
public virtual void Clean(Kernel kern)
{
if (kern == null)
{
throw new ArgumentNullException("kern");
}
kernel = kern;
foreach (SolutionNode sol in kernel.Solutions)
{
CleanSolution(sol);
}
kernel = null;
}
#endregion
}
}

View File

@ -1,50 +0,0 @@
#region BSD License
/*
Copyright (c) 2008-2009 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com), John Anderson (sontek@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
namespace Prebuild.Core.Targets
{
/// <summary>
///
/// </summary>
public enum VSVersion
{
/// <summary>
/// Visual Studio 2002
/// </summary>
VS70,
/// <summary>
/// Visual Studio 2003
/// </summary>
VS71,
/// <summary>
/// Visual Studio 2005
/// </summary>
VS80,
/// <summary>
/// Visual Studio 2008
/// </summary>
VS90
}
}

View File

@ -23,6 +23,15 @@ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY O
*/ */
#endregion #endregion
#region CVS Information
/*
* $Source$
* $Author: jendave $
* $Date: 2007-02-13 12:58:03 -0800 (Tue, 13 Feb 2007) $
* $Revision: 205 $
*/
#endregion
using System; using System;
using System.Collections; using System.Collections;
using System.Collections.Specialized; using System.Collections.Specialized;

View File

@ -23,6 +23,15 @@ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY O
*/ */
#endregion #endregion
#region CVS Information
/*
* $Source$
* $Author: robloach $
* $Date: 2006-09-26 07:30:53 +0900 (Tue, 26 Sep 2006) $
* $Revision: 165 $
*/
#endregion
using System; using System;
using System.Collections; using System.Collections;
using System.Collections.Specialized; using System.Collections.Specialized;

View File

@ -23,6 +23,15 @@ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY O
*/ */
#endregion #endregion
#region CVS Information
/*
* $Source$
* $Author: jendave $
* $Date: 2006-01-28 09:49:58 +0900 (Sat, 28 Jan 2006) $
* $Revision: 71 $
*/
#endregion
using System; using System;
using System.Collections; using System.Collections;

View File

@ -23,6 +23,15 @@ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY O
*/ */
#endregion #endregion
#region CVS Information
/*
* $Source$
* $Author: jendave $
* $Date: 2007-02-14 05:58:03 +0900 (Wed, 14 Feb 2007) $
* $Revision: 205 $
*/
#endregion
using System; using System;
using System.Collections; using System.Collections;
using System.Diagnostics; using System.Diagnostics;
@ -280,8 +289,6 @@ namespace Prebuild.Core.Utilities
return true; return true;
} }
static readonly char seperator = Path.DirectorySeparatorChar;
// This little gem was taken from the NeL source, thanks guys! // This little gem was taken from the NeL source, thanks guys!
/// <summary> /// <summary>
/// Makes a relative path /// Makes a relative path
@ -291,8 +298,8 @@ namespace Prebuild.Core.Utilities
/// <returns>Path that will get from startPath to endPath</returns> /// <returns>Path that will get from startPath to endPath</returns>
public static string MakePathRelativeTo(string startPath, string endPath) public static string MakePathRelativeTo(string startPath, string endPath)
{ {
string tmp = NormalizePath(startPath, seperator); string tmp = NormalizePath(startPath, '/');
string src = NormalizePath(endPath, seperator); string src = NormalizePath(endPath, '/');
string prefix = ""; string prefix = "";
while(true) while(true)
@ -305,14 +312,14 @@ namespace Prebuild.Core.Utilities
{ {
return "./"; return "./";
} }
if((src.Length > tmp.Length) && src[tmp.Length - 1] != seperator) if ((src.Length > tmp.Length) && src[tmp.Length-1] != '/' && src[tmp.Length-1] != '\\')
{ {
} }
else else
{ {
ret = prefix + endPath.Substring(size, endPath.Length - size); ret = prefix + endPath.Substring(size, endPath.Length - size);
ret = ret.Trim(); ret = ret.Trim();
if(ret[0] == seperator) if(ret[0] == '/' || ret[0] == '\\')
{ {
ret = "." + ret; ret = "." + ret;
} }
@ -327,8 +334,8 @@ namespace Prebuild.Core.Utilities
break; break;
} }
int lastPos = tmp.LastIndexOf(seperator, tmp.Length - 2); int lastPos = tmp.LastIndexOf('/', tmp.Length - 2);
int prevPos = tmp.IndexOf(seperator); int prevPos = tmp.IndexOf('/');
if((lastPos == prevPos) || (lastPos == -1)) if((lastPos == prevPos) || (lastPos == -1))
{ {
@ -336,7 +343,7 @@ namespace Prebuild.Core.Utilities
} }
tmp = tmp.Substring(0, lastPos + 1); tmp = tmp.Substring(0, lastPos + 1);
prefix += ".." + seperator.ToString(); prefix += "../";
} }
return endPath; return endPath;

View File

@ -23,6 +23,15 @@ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY O
*/ */
#endregion #endregion
#region CVS Information
/*
* $Source$
* $Author: jendave $
* $Date: 2006-01-28 09:49:58 +0900 (Sat, 28 Jan 2006) $
* $Revision: 71 $
*/
#endregion
using System; using System;
using System.IO; using System.IO;

View File

@ -27,7 +27,7 @@ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY O
/* /*
* $Source$ * $Source$
* $Author: jendave $ * $Author: jendave $
* $Date: 2006-09-26 23:43:35 +0200 (ti, 26 sep 2006) $ * $Date: 2006-09-27 06:43:35 +0900 (Wed, 27 Sep 2006) $
* $Revision: 168 $ * $Revision: 168 $
*/ */
#endregion #endregion

View File

@ -38,6 +38,15 @@ POSSIBILITY OF SUCH DAMAGE.
*/ */
#endregion #endregion
#region CVS Information
/*
* $Source$
* $Author: cjcollier $
* $Date: 2008-02-08 01:31:29 +0900 (Fri, 08 Feb 2008) $
* $Revision: 256 $
*/
#endregion
using System; using System;
using System.Reflection; using System.Reflection;
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
@ -70,7 +79,7 @@ using System.Resources;
[assembly: AssemblyTrademark("")] [assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")] [assembly: AssemblyCulture("")]
[assembly: NeutralResourcesLanguageAttribute("en-US")] [assembly: NeutralResourcesLanguageAttribute("en-US")]
[assembly: AssemblyVersion("2.0.4.*")] [assembly: AssemblyVersion("2.0.3.*")]
// //
// Version information for an assembly consists of the following four values: // Version information for an assembly consists of the following four values:

View File

@ -2,40 +2,39 @@
<xs:schema elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://dnpb.sourceforge.net/schemas/prebuild-1.7.xsd" xmlns="http://dnpb.sourceforge.net/schemas/prebuild-1.7.xsd"> <xs:schema elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://dnpb.sourceforge.net/schemas/prebuild-1.7.xsd" xmlns="http://dnpb.sourceforge.net/schemas/prebuild-1.7.xsd">
<xs:annotation> <xs:annotation>
<xs:documentation> <xs:documentation>
Copyright (c) 2004-2007 Copyright (c) 2004-2007
Matthew Holmes (calefaction at houston . rr . com), Matthew Holmes (calefaction at houston . rr . com),
Dan Moorehead (dan05a at gmail . com), Dan Moorehead (dan05a at gmail . com),
David Hudson (jendave at yahoo dot com), David Hudson (jendave at yahoo dot com),
C.J. Adams-Collier (cjac at colliertech dot com) C.J. Adams-Collier (cjac at colliertech dot com)
.NET Prebuild is a cross-platform XML-driven pre-build tool which .NET Prebuild is a cross-platform XML-driven pre-build tool which
allows developers to easily generate project or make files for major allows developers to easily generate project or make files for major
IDE's and .NET development tools including: Visual Studio .NET 2002, IDE's and .NET development tools including: Visual Studio .NET 2002,
2003, and 2005, SharpDevelop, MonoDevelop, NAnt, Xcode and the GNU Autotools. 2003, and 2005, SharpDevelop, MonoDevelop, NAnt, Xcode and the GNU Autotools.
BSD License: BSD License:
Redistribution and use in source and binary forms, with or without modification, are permitted
provided that the following conditions are met:
Redistribution and use in source and binary forms, with or without modification, are permitted * Redistributions of source code must retain the above copyright notice, this list of conditions
provided that the following conditions are met: 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.
* Redistributions of source code must retain the above copyright notice, this list of conditions THIS SOFTWARE IS PROVIDED BY THE AUTHOR 'AS IS' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
and the following disclaimer. BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
and the following disclaimer in the documentation and/or other materials provided with the EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
distribution. OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* The name of the author may not be used to endorse or promote products derived from this software OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
without specific prior written permission. IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
</xs:documentation>
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.
</xs:documentation>
</xs:annotation> </xs:annotation>
<xs:element name="Prebuild"> <xs:element name="Prebuild">
<xs:complexType> <xs:complexType>
<xs:sequence> <xs:sequence>
@ -46,19 +45,14 @@
<xs:attribute name="checkOsVars" /> <xs:attribute name="checkOsVars" />
</xs:complexType> </xs:complexType>
</xs:element> </xs:element>
<xs:element name="Process" type="xs:string" /> <xs:element name="Process" type="xs:string" />
<xs:element name="Solution"> <xs:element name="Solution">
<xs:complexType> <xs:complexType>
<xs:sequence> <xs:sequence>
<xs:element ref="Configuration" minOccurs="1" maxOccurs="unbounded" />
<xs:element ref="Process" minOccurs="0" maxOccurs="unbounded" />
<xs:element ref="Options" minOccurs="0" /> <xs:element ref="Options" minOccurs="0" />
<xs:element ref="Configuration" minOccurs="1" maxOccurs="unbounded" />
<xs:element ref="Files" minOccurs="0" /> <xs:element ref="Files" minOccurs="0" />
<xs:element ref="Project" minOccurs="0" maxOccurs="unbounded" /> <xs:element ref="Project" minOccurs="1" maxOccurs="unbounded" />
<xs:element ref="DatabaseProject" minOccurs="0" maxOccurs="unbounded" />
<xs:element ref="EmbeddedSolution" minOccurs="0" maxOccurs="unbounded" />
</xs:sequence> </xs:sequence>
<xs:attribute name="name" type="xs:string" use="required" /> <xs:attribute name="name" type="xs:string" use="required" />
<xs:attribute name="activeConfig" type="xs:string" default="Debug" /> <xs:attribute name="activeConfig" type="xs:string" default="Debug" />
@ -66,49 +60,12 @@
<xs:attribute name="version" type="xs:string" default="1.0.0" /> <xs:attribute name="version" type="xs:string" default="1.0.0" />
</xs:complexType> </xs:complexType>
</xs:element> </xs:element>
<xs:element name="EmbeddedSolution">
<xs:complexType>
<xs:sequence>
<xs:element ref="Process" minOccurs="0" maxOccurs="unbounded" />
<xs:element ref="Files" minOccurs="0" />
<xs:element ref="Project" minOccurs="0" maxOccurs="unbounded" />
<xs:element ref="DatabaseProject" minOccurs="0" maxOccurs="unbounded" />
<xs:element ref="EmbeddedSolution" minOccurs="0" maxOccurs="unbounded" />
</xs:sequence>
<xs:attribute name="name" type="xs:string" use="required" />
<xs:attribute name="activeConfig" type="xs:string" default="Debug" />
<xs:attribute name="path" type="xs:string" default="" />
<xs:attribute name="version" type="xs:string" default="1.0.0" />
</xs:complexType>
</xs:element>
<xs:element name="DatabaseProject">
<xs:complexType>
<xs:sequence>
<xs:element name="Author" type="xs:string" minOccurs="0" maxOccurs="unbounded" />
<xs:element ref="DatabaseReference" minOccurs="0" maxOccurs="unbounded" />
</xs:sequence>
<xs:attribute name="name" type="xs:string" use="required" />
<xs:attribute name="path" type="xs:string" />
</xs:complexType>
</xs:element>
<xs:element name="DatabaseReference">
<xs:complexType>
<xs:attribute name="name" type="xs:string" use="required" />
<xs:attribute name="providerId" type="xs:string" />
<xs:attribute name="providerName" type="xs:string" />
<xs:attribute name="connectionString" type="xs:string" use="required" />
</xs:complexType>
</xs:element>
<xs:element name="Project"> <xs:element name="Project">
<xs:complexType> <xs:complexType>
<xs:sequence> <xs:sequence>
<xs:element name="Author" type="xs:string" minOccurs="0" maxOccurs="unbounded" /> <xs:element name="Author" type="xs:string" minOccurs="0" maxOccurs="unbounded" />
<xs:element name="Description" type="xs:string" minOccurs="0" maxOccurs="1" /> <xs:element name="Description" type="xs:string" minOccurs="0" maxOccurs="1" />
<xs:element ref="Configuration" minOccurs="1" maxOccurs="unbounded" /> <xs:element ref="Configuration" minOccurs="0" maxOccurs="unbounded" />
<xs:element name="ReferencePath" type="xs:string" minOccurs="0" maxOccurs="unbounded" /> <xs:element name="ReferencePath" type="xs:string" minOccurs="0" maxOccurs="unbounded" />
<xs:element name="Reference" minOccurs="0" maxOccurs="unbounded"> <xs:element name="Reference" minOccurs="0" maxOccurs="unbounded">
<xs:complexType> <xs:complexType>
@ -127,7 +84,6 @@
<xs:attribute name="icon" type="xs:string" default="" /> <xs:attribute name="icon" type="xs:string" default="" />
<xs:attribute name="configFile" type="xs:string" default="" /> <xs:attribute name="configFile" type="xs:string" default="" />
<xs:attribute name="version" type="xs:string" default="1.0.0" /> <xs:attribute name="version" type="xs:string" default="1.0.0" />
<xs:attribute name="guid" type="xs:string"/>
<xs:attribute name="language" default="C#"> <xs:attribute name="language" default="C#">
<xs:simpleType> <xs:simpleType>
<xs:restriction base="xs:string"> <xs:restriction base="xs:string">
@ -142,7 +98,6 @@
<xs:enumeration value="Exe" /> <xs:enumeration value="Exe" />
<xs:enumeration value="WinExe" /> <xs:enumeration value="WinExe" />
<xs:enumeration value="Library" /> <xs:enumeration value="Library" />
<xs:enumeration value="Web" />
</xs:restriction> </xs:restriction>
</xs:simpleType> </xs:simpleType>
</xs:attribute> </xs:attribute>
@ -154,23 +109,12 @@
</xs:restriction> </xs:restriction>
</xs:simpleType> </xs:simpleType>
</xs:attribute> </xs:attribute>
<xs:attribute name="frameworkVersion" default="v2_0">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="v2_0" />
<xs:enumeration value="v3_0" />
<xs:enumeration value="v3_5" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="startupObject" type="xs:string" default="" /> <xs:attribute name="startupObject" type="xs:string" default="" />
<xs:attribute name="rootNamespace" type="xs:string" /> <xs:attribute name="rootNamespace" type="xs:string" />
<xs:attribute name="debugStartParameters" type="xs:string" />
<xs:attribute name="assemblyName" type="xs:string" /> <xs:attribute name="assemblyName" type="xs:string" />
<xs:attribute name="generateAssemblyInfoFile" type="xs:boolean" default="false" /> <xs:attribute name="generateAssemblyInfoFile" type="xs:boolean" default="false" />
</xs:complexType> </xs:complexType>
</xs:element> </xs:element>
<xs:element name="Configuration"> <xs:element name="Configuration">
<xs:complexType> <xs:complexType>
<xs:sequence> <xs:sequence>
@ -251,7 +195,6 @@
<xs:simpleType> <xs:simpleType>
<xs:restriction base="xs:string"> <xs:restriction base="xs:string">
<xs:enumeration value="Code" /> <xs:enumeration value="Code" />
<xs:enumeration value="CodeBehind" />
<xs:enumeration value="Component" /> <xs:enumeration value="Component" />
<xs:enumeration value="Form" /> <xs:enumeration value="Form" />
<xs:enumeration value="Settings" /> <xs:enumeration value="Settings" />
@ -299,7 +242,6 @@
<xs:simpleType> <xs:simpleType>
<xs:restriction base="xs:string"> <xs:restriction base="xs:string">
<xs:enumeration value="Code" /> <xs:enumeration value="Code" />
<xs:enumeration value="CodeBehind" />
<xs:enumeration value="Component" /> <xs:enumeration value="Component" />
<xs:enumeration value="Designer" /> <xs:enumeration value="Designer" />
<xs:enumeration value="Form" /> <xs:enumeration value="Form" />

View File

@ -1,24 +0,0 @@
#
# Executable
#
# Executables
PREBUILD = mono ../src/bin/Release/prebuild.exe /target makefile
# Files
PREBUILDS = $(wildcard *.prebuild)
RESULTS = $(PREBUILDS:prebuild=results)
TESTS = $(PREBUILDS:prebuild=test)
all: $(TESTS)
clean:
rm -f *~ *.log
rm -f $(RESULTS)
%.test: %.prebuild
$(PREBUILD) /log $*.log /file $*.prebuild /ppi $*.results >& /dev/null
if ! cmp $*.expected $*.results; then \
echo $*.prebuild failed; \
false; \
fi

View File

@ -1,5 +0,0 @@
There are some tests that are run via a Makfile in this
directory. They haven't been included in any form of unit tests, but
they are there to help test the functionality in some what. Simply
build prebuild (so there is a src/bin/Release/prebuild.exe) and type
`make` in this directory. Everything should pass without errors.

View File

@ -1,46 +0,0 @@
<Prebuild xmlns="http://dnpb.sourceforge.net/schemas/prebuild-1.7.xsd" version="1.7">
<Solution name="include-001" version="1.2.3">
<Configuration name="Debug">
<Options>
<CompilerDefines>DEBUG;TRACE</CompilerDefines>
<OptimizeCode>false</OptimizeCode>
<OutputPath>bin/Debug</OutputPath>
<DebugInformation>true</DebugInformation>
</Options>
</Configuration>
<Configuration name="Release">
<Options>
<CompilerDefines>TRACE</CompilerDefines>
<OutputPath>bin/Release</OutputPath>
<OptimizeCode>true</OptimizeCode>
<DebugInformation>false</DebugInformation>
</Options>
</Configuration>
<Project name="Prebuild" path="src" language="C#" assemblyName="include-001" type="Exe" version="1.2.3" xmlns="http://dnpb.sourceforge.net/schemas/prebuild-1.7.xsd">
<Configuration name="Debug">
<Options>
<CompilerDefines>DEBUG;TRACE</CompilerDefines>
<OptimizeCode>false</OptimizeCode>
<OutputPath>bin/Debug</OutputPath>
<DebugInformation>true</DebugInformation>
<KeyFile>Prebuild.snk</KeyFile>
<SuppressWarnings>1595</SuppressWarnings>
</Options>
</Configuration>
<Configuration name="Release">
<Options>
<CompilerDefines>TRACE</CompilerDefines>
<OutputPath>bin/Release</OutputPath>
<OptimizeCode>true</OptimizeCode>
<DebugInformation>false</DebugInformation>
<KeyFile>Prebuild.snk</KeyFile>
<SuppressWarnings>1595</SuppressWarnings>
</Options>
</Configuration>
<Reference name="System" />
<Files>
<Match pattern="*.cs" recurse="true" />
</Files>
</Project>
</Solution>
</Prebuild>

View File

@ -1,33 +0,0 @@
<Project name="Prebuild"
path="src"
language="C#"
assemblyName="include-001"
type="Exe"
version="1.2.3"
xmlns="http://dnpb.sourceforge.net/schemas/prebuild-1.7.xsd"
>
<Configuration name="Debug">
<Options>
<CompilerDefines>DEBUG;TRACE</CompilerDefines>
<OptimizeCode>false</OptimizeCode>
<OutputPath>bin/Debug</OutputPath>
<DebugInformation>true</DebugInformation>
<KeyFile>Prebuild.snk</KeyFile>
<SuppressWarnings>1595</SuppressWarnings>
</Options>
</Configuration>
<Configuration name="Release">
<Options>
<CompilerDefines>TRACE</CompilerDefines>
<OutputPath>bin/Release</OutputPath>
<OptimizeCode>true</OptimizeCode>
<DebugInformation>false</DebugInformation>
<KeyFile>Prebuild.snk</KeyFile>
<SuppressWarnings>1595</SuppressWarnings>
</Options>
</Configuration>
<Reference name="System" />
<Files>
<Match pattern="*.cs" recurse="true"/>
</Files>
</Project>

View File

@ -1,22 +0,0 @@
<?xml version="1.0" encoding="utf-8" ?>
<Prebuild xmlns="http://dnpb.sourceforge.net/schemas/prebuild-1.7.xsd" version="1.7">
<Solution name="include-001" version="1.2.3">
<Configuration name="Debug">
<Options>
<CompilerDefines>DEBUG;TRACE</CompilerDefines>
<OptimizeCode>false</OptimizeCode>
<OutputPath>bin/Debug</OutputPath>
<DebugInformation>true</DebugInformation>
</Options>
</Configuration>
<Configuration name="Release">
<Options>
<CompilerDefines>TRACE</CompilerDefines>
<OutputPath>bin/Release</OutputPath>
<OptimizeCode>true</OptimizeCode>
<DebugInformation>false</DebugInformation>
</Options>
</Configuration>
<?include file="include-001.include"?>
</Solution>
</Prebuild>

View File

@ -1,8 +0,0 @@
<Configuration name="Debug" xmlns="http://dnpb.sourceforge.net/schemas/prebuild-1.7.xsd">
<Options>
<CompilerDefines>DEBUG;TRACE</CompilerDefines>
<OptimizeCode>false</OptimizeCode>
<OutputPath>bin/Debug</OutputPath>
<DebugInformation>true</DebugInformation>
</Options>
</Configuration>

View File

@ -1,26 +0,0 @@
<Prebuild xmlns="http://dnpb.sourceforge.net/schemas/prebuild-1.7.xsd" version="1.7">
<Solution name="include-002" version="1.2.3">
<Configuration name="Debug" xmlns="http://dnpb.sourceforge.net/schemas/prebuild-1.7.xsd">
<Options>
<CompilerDefines>DEBUG;TRACE</CompilerDefines>
<OptimizeCode>false</OptimizeCode>
<OutputPath>bin/Debug</OutputPath>
<DebugInformation>true</DebugInformation>
</Options>
</Configuration>
<Project name="Prebuild" path="src" language="C#" assemblyName="include-001" type="Exe" version="1.2.3" xmlns="http://dnpb.sourceforge.net/schemas/prebuild-1.7.xsd">
<Configuration name="Debug" xmlns="http://dnpb.sourceforge.net/schemas/prebuild-1.7.xsd">
<Options>
<CompilerDefines>DEBUG;TRACE</CompilerDefines>
<OptimizeCode>false</OptimizeCode>
<OutputPath>bin/Debug</OutputPath>
<DebugInformation>true</DebugInformation>
</Options>
</Configuration>
<Reference name="System" />
<Files>
<Match pattern="*.cs" recurse="true" />
</Files>
</Project>
</Solution>
</Prebuild>

View File

@ -1,14 +0,0 @@
<Project name="Prebuild"
path="src"
language="C#"
assemblyName="include-001"
type="Exe"
version="1.2.3"
xmlns="http://dnpb.sourceforge.net/schemas/prebuild-1.7.xsd"
>
<?include file="include-002-2.include"?>
<Reference name="System" />
<Files>
<Match pattern="*.cs" recurse="true"/>
</Files>
</Project>

View File

@ -1,7 +0,0 @@
<?xml version="1.0" encoding="utf-8" ?>
<Prebuild xmlns="http://dnpb.sourceforge.net/schemas/prebuild-1.7.xsd" version="1.7">
<Solution name="include-002" version="1.2.3">
<?include file="include-002-2.include"?>
<?include file="include-002.include"?>
</Solution>
</Prebuild>

Binary file not shown.

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8" ?> <?xml version="1.0" encoding="utf-8" ?>
<Prebuild version="1.7"> <Prebuild xmlns="http://dnpb.sourceforge.net/schemas/prebuild-1.7.xsd" version="1.7">
<Solution name="OpenSim" activeConfig="Debug" path="./" version="0.5.0-$Rev$"> <Solution name="OpenSim" activeConfig="Debug" path="./" version="0.5.0-$Rev$">
<Configuration name="Debug"> <Configuration name="Debug">
<Options> <Options>