Orchard/Orchard.proj
Renaud Paquay 0153bf1218 Use TeamCity AddIn to report NUnit results
--HG--
branch : dev
2010-07-12 21:45:53 -07:00

193 lines
7.1 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!-- Initialization -->
<PropertyGroup>
<LibFolder>$(MSBuildProjectDirectory)\lib</LibFolder>
<SrcFolder>$(MSBuildProjectDirectory)\src</SrcFolder>
<BuildFolder>$(MSBuildProjectDirectory)\build</BuildFolder>
<SourceFolder>$(MSBuildProjectDirectory)\artifacts\Source</SourceFolder>
<WebPIFolder>$(MSBuildProjectDirectory)\artifacts\WebPI</WebPIFolder>
<CompileFolder>$(BuildFolder)\Compile</CompileFolder>
<WebSitesFolder>$(CompileFolder)\_PublishedWebsites</WebSitesFolder>
<StageFolder>$(BuildFolder)\Stage</StageFolder>
<ProfilingFolder>$(BuildFolder)\Profiling</ProfilingFolder>
<BuildPlatform Condition="$(ProgramW6432) != ''">x64</BuildPlatform>
<BuildPlatform Condition="$(BuildPlatform) == ''">x86</BuildPlatform>
</PropertyGroup>
<Import Project="$(LibFolder)\msbuild\MSBuild.Community.Tasks.Targets"/>
<!-- Coordinating Targets -->
<Target Name ="Build">
<CallTarget Targets="Clean"/>
<CallTarget Targets="Compile"/>
<CallTarget Targets="Test"/>
<CallTarget Targets="Package"/>
</Target>
<Target Name="Package">
<CallTarget Targets="Package-Stage"/>
<CallTarget Targets="Package-Zip"/>
</Target>
<Target Name="Profiling">
<CallTarget Targets="Clean"/>
<CallTarget Targets="Compile"/>
<CallTarget Targets="Package-Stage"/>
<CallTarget Targets="Profiling-Stage"/>
<CallTarget Targets="Profiling-Setup"/>
</Target>
<!-- Building -->
<Target Name="Clean">
<MSBuild Projects="$(SrcFolder)\Orchard.sln" Targets="Clean" />
<RemoveDir Directories="$(BuildFolder)" />
</Target>
<Target Name ="Compile">
<MSBuild
Projects="$(SrcFolder)\Orchard.sln"
Targets="Build"
Properties="Configuration=Release;OutputPath=$(CompileFolder)" />
</Target>
<!-- Testing -->
<Target Name ="Test">
<!-- We only support running test in 32-bit environement for now (because of SQLite) -->
<!-- Copy nunit to a temporaty directory and rename nunit-console-x86 -->
<ItemGroup>
<Test-NUnit-Include Include="$(LibFolder)\nunit\**\*" />
</ItemGroup>
<Copy
SourceFiles="@(Test-NUnit-Include)"
DestinationFolder="$(BuildFolder)\Test\nunit" />
<Copy
SourceFiles="$(BuildFolder)\Test\nunit\nunit-console-x86.exe"
DestinationFiles="$(BuildFolder)\Test\nunit\nunit-console.exe" />
<!-- TeamCity support -->
<ItemGroup>
<NUnitAddinFiles Include="$(teamcity_dotnet_nunitaddin)-2.5.2.*" />
</ItemGroup>
<Copy SourceFiles="@(NUnitAddinFiles)" DestinationFolder="$(BuildFolder)\Test\nunit\addins" />
<!-- Copy and run unit test assemblies -->
<CreateItem Include="$(CompileFolder)\*.Tests.*dll">
<Output TaskParameter="Include" ItemName="TestAssemblies" />
</CreateItem>
<NUnit Assemblies="@(TestAssemblies)" ToolPath="$(BuildFolder)\Test\nunit" WorkingDirectory="$(CompileFolder)" OutputXmlFile="$(BuildFolder)\Orchard.Tests.xml" />
</Target>
<Target Name ="Spec">
<CreateItem Include="$(CompileFolder)\*.Specs.dll">
<Output TaskParameter="Include" ItemName="SpecAssemblies" />
</CreateItem>
<NUnit Assemblies="@(SpecAssemblies)" ToolPath="$(LibFolder)\nunit" />
</Target>
<!-- Packaging -->
<UsingTask AssemblyFile="$(CompileFolder)\MSBuild.Orchard.Tasks.dll" TaskName="MSBuild.Orchard.Tasks.StageProjectAlteration" />
<Target Name="Package-Stage">
<ItemGroup>
<Stage-Bin-Exclude Include="$(WebSitesFolder)\**\bin\**\*" />
<Stage-Web Include="$(WebSitesFolder)\Orchard.Web\**\*;$(SrcFolder)\Orchard.Web\*.csproj" />
<Stage-Core Include="$(WebSitesFolder)\Orchard.Core\**\*" Exclude="@(Stage-Bin-Exclude)" />
<Stage-Modules Include="$(WebSitesFolder)\**\*" Exclude="@(Stage-Web);@(Stage-Core);@(Stage-Bin-Exclude)" />
<Stage-License Include="$(MSBuildProjectDirectory)\*.txt" />
</ItemGroup>
<Copy SourceFiles="@(Stage-Web);@(Stage-License)" DestinationFolder="$(StageFolder)\%(RecursiveDir)" />
<Copy SourceFiles="@(Stage-Core)" DestinationFolder="$(StageFolder)\Core\%(RecursiveDir)" />
<Copy SourceFiles="@(Stage-Modules)" DestinationFolder="$(StageFolder)\Modules\%(RecursiveDir)" />
<!-- extra processing of the staged csproj file -->
<StageProjectAlteration ProjectFileName="$(StageFolder)\Orchard.Web.csproj" AddContentFiles="
@(Stage-Modules->'Modules\%(RecursiveDir)%(Filename)%(Extension)');
@(Stage-Core->'Core\%(RecursiveDir)%(Filename)%(Extension)')">
<Output TaskParameter="ExtraFiles" ItemName="StageProjectAlteration-ExtraFiles"/>
</StageProjectAlteration>
<!-- extra processing of the staged config files -->
<XmlUpdate XmlFileName="$(StageFolder)\web.config"
XPath="/configuration/system.web/compilation/@debug"
Value="false" />
<XmlUpdate XmlFileName="$(StageFolder)\Config\Diagnostics.config"
XPath="/system.diagnostics/trace/@autoflush"
Value="false" />
<XmlUpdate XmlFileName="$(StageFolder)\Config\Diagnostics.config"
XPath="/system.diagnostics/sources/source/@switchValue"
Value="Error" />
<!-- move over extra non-content files the csproj referenced -->
<Copy SourceFiles="@(StageProjectAlteration-ExtraFiles->'$(SrcFolder)\Orchard.Web\%(Identity)')"
DestinationFolder="$(StageFolder)\%(RecursiveDir)"/>
</Target>
<Target Name="Package-Zip">
<ItemGroup>
<Zip-Exclude Include="
$(MSBuildProjectDirectory)\src\**\bin\**\*;
$(MSBuildProjectDirectory)\src\**\obj\**\*;
$(MSBuildProjectDirectory)\**\App_Data\**\*;
$(MSBuildProjectDirectory)\**\_ReSharper*\**\*;
$(MSBuildProjectDirectory)\**\*.sln.cache;
$(MSBuildProjectDirectory)\**\*.suo;
$(MSBuildProjectDirectory)\**\*.user;
$(MSBuildProjectDirectory)\**\*.patch;
$(MSBuildProjectDirectory)\**\*.hg;
" />
<Zip-Stage Include="$(StageFolder)\**\*" />
<Zip-Source Include="
$(MSBuildProjectDirectory)\lib\**\*;
$(MSBuildProjectDirectory)\src\**\*;
$(MSBuildProjectDirectory)\*.txt;
" Exclude="@(Zip-Exclude)" />
</ItemGroup>
<MakeDir Directories="$(WebPIFolder);$(SourceFolder)"/>
<Zip Files="@(Zip-Stage)" WorkingDirectory="$(StageFolder)" ZipFileName="$(WebPIFolder)\Orchard.Web.zip" />
<Zip Files="@(Zip-Source)" WorkingDirectory="$(MSBuildProjectDirectory)" ZipFileName="$(SourceFolder)\Orchard.Source.zip" />
</Target>
<!-- Profiling -->
<Target Name="Profiling-Stage">
<ItemGroup>
<Profiling-Web Include="$(StageFolder)\**\*" />
</ItemGroup>
<Copy SourceFiles="@(Profiling-Web)" DestinationFolder="$(ProfilingFolder)\%(RecursiveDir)"/>
</Target>
<Target Name="Profiling-Setup">
<Exec Command="$(ProfilingFolder)\bin\Orchard.exe @$(SrcFolder)\Orchard.Profile\profiling-setup-commands.txt" WorkingDirectory="$(ProfilingFolder)"/>
</Target>
</Project>