Orchard/AzurePackage.proj

143 lines
6.1 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!-- Initialization -->
<PropertyGroup>
<LibFolder>$(MSBuildProjectDirectory)\lib</LibFolder>
<SrcFolder>$(MSBuildProjectDirectory)\src</SrcFolder>
<BuildFolder>$(MSBuildProjectDirectory)\buildazure</BuildFolder>
<ArtifactsFolder>$(MSBuildProjectDirectory)\artifacts\Azure</ArtifactsFolder>
<StageFolder>$(BuildFolder)\Stage</StageFolder>
<CloudRootFolder>$(SrcFolder)\Orchard.Azure\Orchard.Azure.Web\obj\Release</CloudRootFolder>
<MsDeployFolder>$(CloudRootFolder)\Package\PackageTmp</MsDeployFolder>
</PropertyGroup>
<Import Project="$(LibFolder)\msbuild\MSBuild.Community.Tasks.Targets"/>
<!-- look for C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\Windows Azure Tools -->
<Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v10.0\Windows Azure Tools\2.0\Microsoft.WindowsAzure.targets" Condition="exists('$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v10.0\Windows Azure Tools\2.0\Microsoft.WindowsAzure.targets')"/>
<Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v11.0\Windows Azure Tools\2.0\Microsoft.WindowsAzure.targets" Condition="exists('$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v11.0\Windows Azure Tools\2.0\Microsoft.WindowsAzure.targets')"/>
<!-- Coordinating Targets -->
<Target Name ="Build">
<CallTarget Targets="Clean"/>
<CallTarget Targets="Compile"/>
<CallTarget Targets="Test"/>
<CallTarget Targets="Package"/>
</Target>
<Target Name ="CIBuild">
<CallTarget Targets="Clean"/>
<CallTarget Targets="Compile"/>
<CallTarget Targets="Package"/>
</Target>
<Target Name="Package">
<CallTarget Targets="Package-ForCloud"/>
<CallTarget Targets="Package-SqlCe" />
<CallTarget Targets="Package-Stage"/>
<CallTarget Targets="Package-Zip"/>
</Target>
<!-- Building -->
<Target Name="Clean">
<MSBuild Projects="$(SrcFolder)\Orchard.Azure\Orchard.Azure.sln" Targets="Clean" />
<RemoveDir Directories="$(BuildFolder)" ContinueOnError="true" />
<RemoveDir Directories="$(MsDeployFolder)" ContinueOnError="true" />
</Target>
<Target Name ="Compile">
<!-- behaves like MsDeploy since Azure SDK 1.4, output is $(MsDeployFolder) -->
<MSBuild
Projects="$(SrcFolder)\Orchard.Azure\Orchard.Azure.sln"
Targets="Build"
Properties="Configuration=Release;DeployOnBuild=true;DeployTarget=Package;Platform=Any CPU"
/>
<MSBuild
Projects="$(SrcFolder)\Orchard.Azure.Tests\Orchard.Azure.Tests.sln"
Targets="Build"
Properties="Configuration=Release;OutputPath=$(CloudRootFolder)\Tests;Platform=Any CPU"
/>
</Target>
<!-- Testing - Azure only -->
<Target Name ="Test">
<CreateItem Include="$(CloudRootFolder)\Tests\*Azure.Tests.*dll">
<Output TaskParameter="Include" ItemName="TestAssemblies" />
</CreateItem>
<NUnit Assemblies="@(TestAssemblies)" ToolPath="$(LibFolder)\nunit" WorkingDirectory="$(MsDeployFolder)\bin" />
</Target>
<!-- Packaging -->
<Target Name="Package-ForCloud">
<ItemGroup>
<!-- filter to exclude any binary from a folder -->
<Excluded Include="$(SrcFolder)\**\bin\**\*;$(SrcFolder)\**\obj\**\*;$(SrcFolder)\**\*.user; $(SrcFolder)\**\*.cs;$(SrcFolder)\**\*.csproj;$(SrcFolder)\**\.hg\**\*" />
<!-- list of files from Themes, Core and Modules to export -->
<Stage-Themes Include="$(SrcFolder)\Orchard.Web\Themes\**\*" Exclude="@(Excluded)" />
<Stage-Core Include="$(SrcFolder)\Orchard.Web\Core\**\*" Exclude="@(Excluded)" />
<Stage-Modules Include="$(SrcFolder)\Orchard.Web\Modules\**\*" Exclude="@(Excluded)" />
</ItemGroup>
<Copy SourceFiles="@(Stage-Themes)" DestinationFolder="$(MsDeployFolder)\Themes\%(RecursiveDir)" />
<Copy SourceFiles="@(Stage-Core)" DestinationFolder="$(MsDeployFolder)\Core\%(RecursiveDir)" />
<Copy SourceFiles="@(Stage-Modules)" DestinationFolder="$(MsDeployFolder)\Modules\%(RecursiveDir)" />
<ItemGroup>
<WebConfigs Include="$(MsDeployFolder)\Modules\*\web.config;$(MsDeployFolder)\Core\web.config" />
</ItemGroup>
<Delete Files="@(WebConfigs)" />
<Copy
SourceFiles="$(SrcFolder)\Orchard.Azure\Orchard.Azure.CloudService\ServiceConfiguration.cscfg"
DestinationFolder="$(StageFolder)"
/>
<Copy
SourceFiles="$(SrcFolder)\Orchard.Azure\Orchard.Azure.CloudService\Properties.txt"
DestinationFolder="$(CloudRootFolder)"
/>
</Target>
<Target Name="Package-SqlCe">
<ItemGroup>
<SqlCeBinariesx86 Include="$(LibFolder)\sqlce\x86\**\*" />
<SqlCeBinariesx64 Include="$(LibFolder)\sqlce\amd64\**\*" />
</ItemGroup>
<Copy SourceFiles="@(SqlCeBinariesx86)" DestinationFolder="$(MsDeployFolder)\bin\x86\%(RecursiveDir)" SkipUnchangedFiles="true" />
<Copy SourceFiles="@(SqlCeBinariesx64)" DestinationFolder="$(MsDeployFolder)\bin\amd64\%(RecursiveDir)" SkipUnchangedFiles="true" />
</Target>
<Target Name="Package-Stage">
<Exec
Command="&quot;$(ServiceHostingSDKBinDir)cspack&quot; &quot;$(SrcFolder)\Orchard.Azure\Orchard.Azure.CloudService\ServiceDefinition.csdef&quot; /role:Orchard.Azure.Web;&quot;$(MsDeployFolder)&quot;;Orchard.Azure.Web.dll /sites:Orchard.Azure.Web;Web;&quot;$(MsDeployFolder)&quot; /rolePropertiesFile:Orchard.Azure.Web;&quot;$(CloudRootFolder)\Properties.txt&quot; /out:&quot;$(StageFolder)\Orchard.Azure.Web.cspkg&quot;"
WorkingDirectory="$(MsDeployFolder)"
/>
</Target>
<Target Name="Package-Zip">
<ItemGroup>
<Zip-Stage Include="$(StageFolder)\ServiceConfiguration.cscfg;$(StageFolder)\Orchard.Azure.Web.cspkg" />
</ItemGroup>
<MakeDir Directories="$(ArtifactsFolder)" />
<Zip Files="@(Zip-Stage)" WorkingDirectory="$(StageFolder)" ZipFileName="$(ArtifactsFolder)\AzurePackage.zip" />
</Target>
</Project>