-
Notifications
You must be signed in to change notification settings - Fork 0
/
AzurePackage.proj
158 lines (120 loc) · 6.43 KB
/
AzurePackage.proj
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
<?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"/>
<Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v10.0\Windows Azure Tools\1.7\Microsoft.WindowsAzure.targets" Condition="exists('$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v10.0\Windows Azure Tools\1.7\Microsoft.WindowsAzure.targets')"/>
<Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v11.0\Windows Azure Tools\1.7\Microsoft.WindowsAzure.targets" Condition="exists('$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v11.0\Windows Azure Tools\1.7\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)" />
<!-- extra processing of the staged config files -->
<XmlUpdate XmlFileName="$(MsDeployFolder)\web.config"
XPath="/configuration/system.web/compilation/@debug"
Value="false" />
<XmlUpdate XmlFileName="$(MsDeployFolder)\Config\log4net.config"
XPath="/log4net/appender/immediateFlush/@value"
Value="false" />
<XmlUpdate XmlFileName="$(MsDeployFolder)\Config\log4net.config"
XPath="/log4net/logger/priority/@value"
Value="ERROR" />
<XmlUpdate XmlFileName="$(MsDeployFolder)\Config\log4net.config"
XPath="/log4net/root/priority/@value"
Value="ERROR" />
<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=""$(ServiceHostingSDKBinDir)cspack" "$(SrcFolder)\Orchard.Azure\Orchard.Azure.CloudService\ServiceDefinition.build.csdef" /role:Orchard.Azure.Web;"$(MsDeployFolder)";Orchard.Azure.Web.dll /sites:Orchard.Azure.Web;Web;"$(MsDeployFolder)" /rolePropertiesFile:Orchard.Azure.Web;"$(CloudRootFolder)\Properties.txt" /out:"$(StageFolder)\Orchard.Azure.Web.cspkg""
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>