Prebuild:
* Don't add duplicate assembly references * Create a HintPath for assembly references that exist in a project reference directory (fixes an xbuild issue) * Add a VS2010 target git-svn-id: http://libopenmetaverse.googlecode.com/svn/libopenmetaverse/trunk@3075 52acb1d6-8a22-11de-b505-999d5b087335
This commit is contained in:
113
Programs/Prebuild/src/Core/Targets/VS2010Target.cs
Normal file
113
Programs/Prebuild/src/Core/Targets/VS2010Target.cs
Normal file
@@ -0,0 +1,113 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
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>
|
||||
[Target("vs2010")]
|
||||
public class VS2010Target : VSGenericTarget
|
||||
{
|
||||
#region Fields
|
||||
string solutionVersion = "11.00";
|
||||
string productVersion = "10.0.20506";
|
||||
string schemaVersion = "2.0";
|
||||
string versionName = "Visual Studio 2010";
|
||||
string name = "vs2010";
|
||||
VSVersion version = VSVersion.VS10;
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="VS2010Target"/> class.
|
||||
/// </summary>
|
||||
public VS2010Target()
|
||||
: base()
|
||||
{
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -207,7 +207,7 @@ namespace Prebuild.Core.Targets
|
||||
#region Project File
|
||||
using (ps)
|
||||
{
|
||||
ps.WriteLine("<Project DefaultTargets=\"Build\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\" ToolsVersion=\"3.5\">");
|
||||
ps.WriteLine("<Project DefaultTargets=\"Build\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\" ToolsVersion=\"{0}\">", this.Version == VSVersion.VS10 ? "4.0" : "3.5");
|
||||
ps.WriteLine(" <PropertyGroup>");
|
||||
ps.WriteLine(" <ProjectType>Local</ProjectType>");
|
||||
ps.WriteLine(" <ProductVersion>{0}</ProductVersion>", this.ProductVersion);
|
||||
@@ -292,7 +292,8 @@ namespace Prebuild.Core.Targets
|
||||
|
||||
if (projectNode == null)
|
||||
{
|
||||
otherReferences.Add(refr);
|
||||
if (!otherReferences.Contains(refr))
|
||||
otherReferences.Add(refr);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -313,8 +314,32 @@ namespace Prebuild.Core.Targets
|
||||
ps.WriteLine("</Name>");
|
||||
|
||||
// TODO: Allow reference to *.exe files
|
||||
if (!String.IsNullOrEmpty(refr.Path))
|
||||
ps.WriteLine(" <HintPath>{0}</HintPath>", Helper.MakePathRelativeTo(project.FullPath, refr.Path + "\\" + refr.Name + ".dll"));
|
||||
if (!String.IsNullOrEmpty(refr.Path))
|
||||
{
|
||||
ps.WriteLine(" <HintPath>{0}</HintPath>", Helper.MakePathRelativeTo(project.FullPath, refr.Path + "\\" + refr.Name + ".dll"));
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (ReferencePathNode node in project.ReferencePaths)
|
||||
{
|
||||
try
|
||||
{
|
||||
string fullRefPath = Helper.ResolvePath(node.Path);
|
||||
if (File.Exists(fullRefPath + refr.Name + ".dll"))
|
||||
{
|
||||
ps.WriteLine(" <HintPath>{0}</HintPath>", fullRefPath + refr.Name + ".dll");
|
||||
break;
|
||||
}
|
||||
else if (File.Exists(fullRefPath + refr.Name + ".exe"))
|
||||
{
|
||||
ps.WriteLine(" <HintPath>{0}</HintPath>", fullRefPath + refr.Name + ".exe");
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{ }
|
||||
}
|
||||
}
|
||||
ps.WriteLine(" </Reference>");
|
||||
}
|
||||
ps.WriteLine(" </ItemGroup>");
|
||||
@@ -616,6 +641,9 @@ namespace Prebuild.Core.Targets
|
||||
case VSVersion.VS90:
|
||||
ss.WriteLine("# Visual Studio 2008");
|
||||
break;
|
||||
case VSVersion.VS10:
|
||||
ss.WriteLine("# Visual Studio 10");
|
||||
break;
|
||||
}
|
||||
|
||||
WriteProjectDeclarations(ss, solution, solution);
|
||||
|
||||
@@ -54,6 +54,10 @@ namespace Prebuild.Core.Targets
|
||||
/// <summary>
|
||||
/// Visual Studio 2008
|
||||
/// </summary>
|
||||
VS90
|
||||
VS90,
|
||||
/// <summary>
|
||||
/// Visual Studio 2010
|
||||
/// </summary>
|
||||
VS10
|
||||
}
|
||||
}
|
||||
|
||||
BIN
bin/Prebuild.exe
BIN
bin/Prebuild.exe
Binary file not shown.
@@ -15,12 +15,11 @@
|
||||
::
|
||||
|
||||
echo ##########################################
|
||||
echo creating prebuild files for: nant, vs2008
|
||||
echo creating prebuild files for: vs2008
|
||||
echo Parameters: %1 %2
|
||||
echo ##########################################
|
||||
|
||||
:: run prebuild to generate solution/project files from prebuild.xml configuration file
|
||||
bin\Prebuild.exe /target nant
|
||||
bin\Prebuild.exe /target vs2008
|
||||
|
||||
:: build compile.bat file based on command line parameters
|
||||
|
||||
65
runprebuild2010.bat
Normal file
65
runprebuild2010.bat
Normal file
@@ -0,0 +1,65 @@
|
||||
@echo off
|
||||
::
|
||||
:: Prebuild generator for the OpenMetaverse Library
|
||||
::
|
||||
:: Command Line Options:
|
||||
:: (none) - create solution/project files and create compile.bat file to build solution
|
||||
:: msbuild - Create project files, compile solution
|
||||
:: msbuild runtests - create project files, compile solution, run unit tests
|
||||
:: msbuild docs - create project files, compile solution, build API documentation
|
||||
:: msbuild docs dist - Create project files, compile solution, run unit tests, build api documentation, create binary zip
|
||||
:: - and exe installer
|
||||
::
|
||||
:: nant - Create project files, run nant to compile solution
|
||||
:: nant runtests - Create project files, run nant to compile solution, run unit tests
|
||||
::
|
||||
|
||||
echo ##########################################
|
||||
echo creating prebuild files for: vs2010
|
||||
echo Parameters: %1 %2
|
||||
echo ##########################################
|
||||
|
||||
:: run prebuild to generate solution/project files from prebuild.xml configuration file
|
||||
bin\Prebuild.exe /target vs2010
|
||||
|
||||
:: build compile.bat file based on command line parameters
|
||||
echo @echo off > compile.bat
|
||||
if(.%1)==(.) echo C:\WINDOWS\Microsoft.NET\Framework\v3.5\msbuild OpenMetaverse.sln >> compile.bat
|
||||
|
||||
if(.%1)==(.msbuild) echo echo ==== COMPILE BEGIN ==== >> compile.bat
|
||||
if(.%1)==(.msbuild) echo %SystemRoot%\Microsoft.NET\Framework\v3.5\MSBuild.exe /p:Configuration=Release OpenMetaverse.sln >> compile.bat
|
||||
if(.%1)==(.msbuild) echo IF ERRORLEVEL 1 GOTO FAIL >> compile.bat
|
||||
|
||||
if(.%1)==(.nant) echo nant >> compile.bat
|
||||
if(.%1)==(.nant) echo IF ERRORLEVEL 1 GOTO FAIL >> compile.bat
|
||||
|
||||
if(.%3)==(.docs) echo echo ==== GENERATE DOCUMENTATION BEGIN ==== >> compile.bat
|
||||
if(.%2)==(.docs) echo %SystemRoot%\Microsoft.NET\Framework\v3.5\MSBuild.exe /p:Configuration=Release docs\OpenMetaverse.shfbproj >> compile.bat
|
||||
if(.%2)==(.docs) echo IF ERRORLEVEL 1 GOTO FAIL >> compile.bat
|
||||
if(.%2)==(.docs) echo 7z.exe a -tzip docs\documentation.zip docs\trunk >> compile.bat
|
||||
if(.%2)==(.docs) echo IF ERRORLEVEL 1 GOTO FAIL >> compile.bat
|
||||
|
||||
if(.%2)==(.runtests) echo echo ==== UNIT TESTS BEGIN ==== >> compile.bat
|
||||
if(.%2)==(.runtests) echo nunit-console bin\OpenMetaverse.Tests.dll /exclude:Network /nodots /labels /xml:testresults.xml >> compile.bat
|
||||
|
||||
if(.%2)==(.runtests) echo IF ERRORLEVEL 1 GOTO FAIL >> compile.bat
|
||||
|
||||
:: nsis compiler needs to be in path
|
||||
if(.%3)==(.dist) echo echo ==== GENERATE DISTRIBUTION BEGIN ==== >> compile.bat
|
||||
if(.%3)==(.dist) echo makensis.exe /DPlatform=test docs\OpenMetaverse-installer.nsi >> compile.bat
|
||||
if(.%3)==(.dist) echo IF ERRORLEVEL 1 GOTO FAIL >> compile.bat
|
||||
if(.%3)==(.dist) echo 7z.exe a -tzip dist\openmetaverse-dist.zip @docs\distfiles.lst >> compile.bat
|
||||
if(.%3)==(.dist) echo IF ERRORLEVEL 1 GOTO FAIL >> compile.bat
|
||||
|
||||
echo :SUCCESS >> compile.bat
|
||||
echo echo Build Successful! >> compile.bat
|
||||
echo exit /B 0 >> compile.bat
|
||||
echo :FAIL >> compile.bat
|
||||
echo echo Build Failed, check log for reason >> compile.bat
|
||||
echo exit /B 1 >> compile.bat
|
||||
|
||||
:: perform the appropriate action
|
||||
if(.%1)==(.msbuild) compile.bat
|
||||
if(.%1)==(.nant) compile.bat
|
||||
if(.%1)==(.dist) compile.bat
|
||||
|
||||
Reference in New Issue
Block a user