forked from Azure/azure-powershell
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.proj
219 lines (195 loc) · 8.23 KB
/
build.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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
<?xml version="1.0" encoding="utf-8"?>
<Project
xmlns="http://schemas.microsoft.com/developer/msbuild/2003"
ToolsVersion="4.0"
DefaultTargets="ForceRestorePackages;Clean;BuildDebug;BuildRelease;BuildSetupDebug">
<!-- Define build properties -->
<PropertyGroup>
<ManagementCmdletBinDirectory>.\src\ServiceManagement\Services\Commands\bin</ManagementCmdletBinDirectory>
<ManagementTestDirectory>.\src\ServiceManagement\Services\Commands.Test\bin</ManagementTestDirectory>
<ManagementTestAssemblyName>Microsoft.WindowsAzure.Commands.Test.dll</ManagementTestAssemblyName>
<SetupDirectory>.\setup\build</SetupDirectory>
<PublishDirectory>.\src\Publish</PublishDirectory>
<PackageDirectory>.\src\Package</PackageDirectory>
<BuildOutputDirectory>$(PublishDirectory)\Build</BuildOutputDirectory>
<SetupOutputDirectory>$(PublishDirectory)\Setup</SetupOutputDirectory>
<TestOutputDirectory>$(PublishDirectory)\TestResults</TestOutputDirectory>
<DebugBuildConfig>Configuration=Debug;Platform=Any CPU</DebugBuildConfig>
<ReleaseBuildConfig>Configuration=Release;Platform=Any CPU</ReleaseBuildConfig>
<BuildInParallel Condition="'$(BuildInParallel)' == ''">true</BuildInParallel>
</PropertyGroup>
<ItemGroup>
<AzurePowerShellSln Include=".\src\AzurePowerShell.sln" />
<SetupSln Include=".\setup\azurepowershell.sln" />
</ItemGroup>
<UsingTask
AssemblyFile="$(MSBuildProjectDirectory)\packages\xunit.runner.console.2.0.0\tools\xunit.runner.msbuild.dll"
TaskName="Xunit.Runner.MSBuild.xunit" />
<!-- Clean the build in all configurations -->
<Target Name="Clean">
<!-- Clean the solutions -->
<Message Importance="high" Text="Cleaning Cmdlets..." ContinueOnError="false" />
<MSBuild
Projects="@(AzurePowerShellSln)"
Targets="Clean"
Properties="$(DebugBuildConfig)"
ContinueOnError="false" />
<MSBuild
Projects="@(AzurePowerShellSln)"
Targets="Clean"
Properties="$(ReleaseBuildConfig)"
ContinueOnError="false" />
<MSBuild
Projects="@(SetupSln)"
Targets="Clean"
Properties="$(DebugBuildConfig)"
ContinueOnError="false" />
<!-- Delete the publish files -->
<Message Importance="high" Text="Cleaning publish files..." ContinueOnError="false" />
<ItemGroup>
<PublishFiles Include="$(PublishDirectory)\**\*.*" />
</ItemGroup>
<Delete
Files="@(PublishFiles)"
ContinueOnError="false" />
<RemoveDir
Directories="$(PublishDirectory)"
ContinueOnError="false" />
<!-- Delete the package files -->
<Message Importance="high" Text="Cleaning package files..." ContinueOnError="false" />
<ItemGroup>
<PackageFiles Include="$(PackageDirectory)\**\*.*" />
</ItemGroup>
<Delete
Files="@(PackageFiles)"
ContinueOnError="false" />
<RemoveDir
Directories="$(PackageDirectory)"
ContinueOnError="false" />
</Target>
<PropertyGroup>
<NuGetCommand>$(MSBuildProjectDirectory)\src\.nuget\NuGet.exe</NuGetCommand>
<NuGetRestoreConfigFile>$(MSBuildProjectDirectory)\restore.config</NuGetRestoreConfigFile>
<NuGetRestoreConfigSwitch>-ConfigFile "$(NuGetRestoreConfigFile)"</NuGetRestoreConfigSwitch>
</PropertyGroup>
<!--
Force nuget package restore so that packages that include .targets files
don't need to be checked into source control.
-->
<Target Name="ForceRestorePackages">
<ItemGroup>
<NuGetCache Include="$(LOCALAPPDATA)\NuGet\Cache\*.nupkg"/>
</ItemGroup>
<!-- Delete NuGet cache-->
<Delete Files="@(NuGetCache)" />
<Delete Files="$(NuGetRestoreConfigFile)" />
<WriteLinesToFile
File="$(NuGetRestoreConfigFile)"
Lines="<configuration></configuration>"
Overwrite="true"
Encoding="Unicode"/>
<Exec Command="$(NuGetCommand) sources add -Name LocalFeed -Source "$(MSBuildProjectDirectory)\tools\LocalFeed" $(NuGetRestoreConfigSwitch)"/>
<!-- Restore packages -->
<Exec Command="$(NuGetCommand) restore $(MSBuildProjectDirectory)\src\AzurePowerShell.sln $(NuGetRestoreConfigSwitch)" ContinueOnError="false" />
<!--Restore the xunit runner needed to run unit tests-->
<Exec Command="$(NuGetCommand) restore $(MSBuildProjectDirectory)\packages.config -PackagesDirectory $(MSBuildProjectDirectory)\packages" />
<Delete Files="$(NuGetRestoreConfigFile)" />
</Target>
<!-- Build all flavors of the Cmdlets -->
<Target Name="BuildCmdlets" DependsOnTargets="ForceRestorePackages">
<Message Importance="high" Text="Building Cmdlets..." />
<MSBuild
Projects="@(AzurePowerShellSln)"
Targets="Build"
Properties="$(DebugBuildConfig)"
BuildInParallel="$(BuildInParallel)"
ContinueOnError="false" />
<MSBuild
Projects="@(AzurePowerShellSln)"
Targets="Build"
Properties="$(ReleaseBuildConfig)"
BuildInParallel="$(BuildInParallel)"
ContinueOnError="false" />
</Target>
<!-- Build the Setup -->
<Target Name="BuildSetupDebug">
<Message
Importance="high"
Text="Building Setup..."
ContinueOnError="false" />
<Message
Importance="high"
Text="You are required to have installed the WiX Toolset at http://wix.codeplex.com/releases/view/115492 (Wix38.msi)"
ContinueOnError="false" />
<MSBuild
Projects="@(SetupSln)"
Targets="Build"
Properties="$(DebugBuildConfig)"
ContinueOnError="false" />
</Target>
<!-- Build the Setup -->
<Target Name="BuildSetupRelease">
<Message
Importance="high"
Text="Building Setup..."
ContinueOnError="false" />
<Message
Importance="high"
Text="You are required to have installed the WiX Toolset at http://wix.codeplex.com/releases/view/115492 (Wix38.msi)"
ContinueOnError="false" />
<MSBuild
Projects="@(SetupSln)"
Targets="Build"
Properties="$(ReleaseBuildConfig)"
ContinueOnError="false" />
</Target>
<!-- Build the Cmdlets and Setup in all configurations -->
<Target Name="Build" DependsOnTargets="BuildCmdlets;BuildSetupRelease" />
<!-- Do everything possible -->
<Target
Name="Full"
DependsOnTargets="ForceRestorePackages;Clean;BuildDebug;Test;BuildSetupDebug" />
<!-- Build the Cmdlets in Release configuration -->
<Target Name="BuildRelease" DependsOnTargets="ForceRestorePackages">
<Message Importance="high" Text="Building Cmdlets in Release config..." />
<MSBuild
Projects="@(AzurePowerShellSln)"
Targets="Build"
Properties="$(ReleaseBuildConfig)"
BuildInParallel="$(BuildInParallel)"
ContinueOnError="false" />
</Target>
<!-- Build the Cmdlets in Debug configuration -->
<Target Name="BuildDebug" DependsOnTargets="ForceRestorePackages">
<Message Importance="high" Text="Building Cmdlets in Debug config..." />
<MSBuild
Projects="@(AzurePowerShellSln)"
Targets="Build"
Properties="$(DebugBuildConfig)"
BuildInParallel="$(BuildInParallel)"
ContinueOnError="false" />
</Target>
<PropertyGroup>
<RunTestLive Condition="'$(RunTestLive)' == ''">false</RunTestLive>
<XUnitIncludedTrait Condition="!$(RunTestLive)">AcceptanceType=CheckIn</XUnitIncludedTrait>
</PropertyGroup>
<!-- Note: all testing related target should go to 'AzurePowershell.test.targets' file except the one used by CI run -->
<Import Project="$(MSBuildThisFileDirectory)AzurePowershell.test.targets"/>
<!-- Run checkin tests for each pull request -->
<Target Name="Test" DependsOnTargets="BuildDebug;BeforeRunTests">
<Message Importance="high" Text="Running check in tests..." />
<CallTarget Targets="InvokeXUnit"/>
</Target>
<!-- Run Full switch with scenario tests -->
<Target
Name="FullWithScenarioTests"
DependsOnTargets="ForceRestorePackages;Clean;BuildDebug;BuildRelease;Test;BuildSetupDebug;BuildSetupRelease;RunOneSDKCIT" />
<!-- Run live tests and record mocks -->
<Target
Name="RunLiveTests"
DependsOnTargets="ForceRestorePackages;Clean;BuildDebug;BuildRelease;LiveTestsFilter;BuildSetupDebug;BuildSetupRelease" />
<Target Name="LiveTestsFilter" DependsOnTargets="BuildDebug;BeforeRunTests">
<Message Importance="high" Text="Running live tests..." />
<CallTarget Targets="LiveTests"/>
</Target>
</Project>