-
Notifications
You must be signed in to change notification settings - Fork 285
/
Microsoft.WindowsAzure.Mobile.Build.msbuild
307 lines (255 loc) · 15.1 KB
/
Microsoft.WindowsAzure.Mobile.Build.msbuild
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
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Full" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildProjectDirectory)\tools\Microsoft.WindowsAzure.Mobile.Build.targets" />
<Import Project="$(MSBuildProjectDirectory)\tools\NuGet.targets" />
<PropertyGroup>
<SDKRootPath>$(MSBuildThisFileDirectory)</SDKRootPath>
<QuickStartsSourceDirectory>$(SDKRootPath)\client</QuickStartsSourceDirectory>
<ZipPath>$(SDKRootPath)\packages\7-Zip.CommandLine.9.20.0\tools\7za</ZipPath>
<OutputPath>$(MSBuildThisFileDirectory)\bin</OutputPath>
<DownloadNuGetExe>true</DownloadNuGetExe>
<NugetExe>$(MSBuildProjectDirectory)\.nuget\NuGet.exe</NugetExe>
<DefaultNugetPackageSource>https://www.nuget.org/api/v2/</DefaultNugetPackageSource>
<NugetPackageSource Condition=" '$(NugetPackageSource)' == '' ">$(DefaultNugetPackageSource)</NugetPackageSource>
<!-- Define default configuration (so building from command line is consistent) -->
<Configuration Condition=" '$(Configuration)' == '' ">Release</Configuration>
<!--TODO : Detect JS SDK version-->
<JSSDKVersion>2.0.0-beta</JSSDKVersion>
<!--TODO : Detect Android SDK version-->
<AndroidSDKVersion>2.0.3</AndroidSDKVersion>
<!--Variable to override iOS SDK-->
<iOSSDK></iOSSDK>
</PropertyGroup>
<!-- Quickstarts -->
<ItemGroup>
<!-- Node quickstarts -->
<QuickStart Include="$(MSBuildProjectFile)" >
<Runtime>Node</Runtime>
<SourcePath>web</SourcePath>
<ZipFileName>Html_JavaScript.zip</ZipFileName>
</QuickStart>
<QuickStart Include="$(MSBuildProjectFile)">
<Runtime>Node</Runtime>
<SourcePath>windows-universal-cs</SourcePath>
<ZipFileName>Windows_Universal_CS.zip</ZipFileName>
</QuickStart>
<QuickStart Include="Android">
<Runtime>Java</Runtime>
<SourcePath>android</SourcePath>
<ZipFileName>Android_Java.zip</ZipFileName>
</QuickStart>
<QuickStart Include="Windows_Universal_JS">
<Runtime>Node</Runtime>
<SourcePath>windows-universal-js</SourcePath>
<ZipFileName>Windows_Universal_JS.zip</ZipFileName>
</QuickStart>
<QuickStart Include="Xamarin_iOS" >
<Runtime>Node</Runtime>
<SourcePath>xamarin.iOS</SourcePath>
<ZipFileName>Xamarin_iOS.zip</ZipFileName>
</QuickStart>
<QuickStart Include=">Xamarin_Android" >
<Runtime>Node</Runtime>
<SourcePath>xamarin.android</SourcePath>
<ZipFileName>Xamarin_Android.zip</ZipFileName>
</QuickStart>
<QuickStart Include=">Xamarin_Forms" >
<Runtime>Node</Runtime>
<SourcePath>xamarin.forms</SourcePath>
<ZipFileName>Xamarin_Forms.zip</ZipFileName>
</QuickStart>
<!-- DotNet quickstarts -->
<QuickStart Include="Existing_DotNet">
<Runtime>DotNet</Runtime>
<SourcePath>dotnet-service</SourcePath>
<ZipFileName>Existing_DotNet.zip</ZipFileName>
</QuickStart>
<QuickStart Include="Html_JavaScript_DotNet" >
<Runtime>DotNet</Runtime>
<SourcePath>web-dotnet</SourcePath>
<ZipFileName>Html_JavaScript_DotNet.zip</ZipFileName>
</QuickStart>
<QuickStart Include="Windows_Universal_CS_DotNet">
<Runtime>DotNet</Runtime>
<SourcePath>windows-universal-cs</SourcePath>
<ZipFileName>Windows_Universal_CS_DotNet.zip</ZipFileName>
</QuickStart>
<QuickStart Include="Windows_Universal_JS_DotNet">
<Runtime>DotNet</Runtime>
<SourcePath>windows-universal-js</SourcePath>
<ZipFileName>Windows_Universal_JS_DotNet.zip</ZipFileName>
</QuickStart>
<QuickStart Include="Xamarin_iOS_DotNet" >
<Runtime>DotNet</Runtime>
<SourcePath>xamarin.iOS</SourcePath>
<ZipFileName>Xamarin_iOS_DotNet.zip</ZipFileName>
</QuickStart>
<QuickStart Include="Xamarin_Android_DotNet" >
<Runtime>DotNet</Runtime>
<SourcePath>xamarin.android</SourcePath>
<ZipFileName>Xamarin_Android_DotNet.zip</ZipFileName>
</QuickStart>
<!--iOS quickstarts-->
<QuickStart Include="iOS" >
<Runtime>iOS</Runtime>
<SourcePath>iOS</SourcePath>
<ZipFileName>iOS_ObjC.zip</ZipFileName>
</QuickStart>
<QuickStart Include="iOS-Swift" >
<Runtime>iOS</Runtime>
<SourcePath>iOS-Swift</SourcePath>
<ZipFileName>iOS_Swift.zip</ZipFileName>
</QuickStart>
</ItemGroup>
<Target Name="DownloadSDK">
<!-- Create the Quickstarts directory in bin folder -->
<MakeDir Directories="$(OutputPath)\Quickstarts"/>
<!--Download Nuget.exe (CheckPrerequisistes defined in NuGet.targets)-->
<MakeDir Directories="$(MSBuildProjectDirectory)\.nuget" />
<CallTarget Targets="CheckPrerequisites" />
<!--Restore required nuget packages-->
<Exec Command='"$(NugetExe)" install 7-Zip.CommandLine -source $(DefaultNugetPackageSource) -o "$(MSBuildProjectDirectory)\packages" -Version 9.20.0' LogStandardErrorAsError="true" />
<Exec Command='"$(NugetExe)" install Microsoft.Azure.Mobile.Server.Quickstart -source $(NugetPackageSource) -o "$(MSBuildProjectDirectory)\backend\dotnet\packages"' LogStandardErrorAsError="true" />
<Exec Command='"$(NugetExe)" install Microsoft.Azure.Mobile.Client -Prerelease -source $(NugetPackageSource) -o "$(MSBuildProjectDirectory)\packages\sdk"' LogStandardErrorAsError="true" />
<Exec Command='"$(NugetExe)" install Microsoft.Azure.Mobile.Client.SQLiteStore -Prerelease -source $(NugetPackageSource) -o "$(MSBuildProjectDirectory)\packages\sqllitestore"' LogStandardErrorAsError="true" />
<Exec Command='"$(NugetExe)" install WindowsAzure.MobileServices.WinJS -source $(NugetPackageSource) -o "$(MSBuildProjectDirectory)\packages"' LogStandardErrorAsError="true" />
<Exec Command='"$(NugetExe)" install "$(MSBuildProjectDirectory)\backend\try-mobile-apps\packages.config" -source $(NugetPackageSource) -o "$(MSBuildProjectDirectory)\backend\try-mobile-apps\packages"' LogStandardErrorAsError="true" />
<!--Download iOS SDK-->
<HttpDownload DownloadUrl="https://go.microsoft.com/fwLink/?LinkID=529823" PackageDirectory="$(SDKRootPath)\packages" SDKPackage="iOS" Condition=" '$(iOSSDK)' == ''" />
<Exec Command='"$(ZipPath)" x "$(iOSSDK)" -o"$(SDKRootPath)\packages\iOS" * -r -y' Condition=" '$(iOSSDK)' != ''" />
</Target>
<Target Name="BuildQuickStarts">
<!--Find NugetVersion from NugetPackages-->
<GetNugetVersion PackageDirectory="$(MSBuildProjectDirectory)\packages\sdk" NugetId="Microsoft.Azure.Mobile.Client*" >
<Output TaskParameter="NugetVersion" PropertyName="SDKPackageVersion" />
</GetNugetVersion>
<Message Text="SDKPackageVersion = $(SDKPackageVersion)" />
<GetNugetVersion PackageDirectory="$(MSBuildProjectDirectory)\packages\sqllitestore" NugetId="Microsoft.Azure.Mobile.Client.SQLiteStore*">
<Output TaskParameter="NugetVersion" PropertyName="StorePackageVersion" />
</GetNugetVersion>
<Message Text="StorePackageVersion = $(StorePackageVersion)" />
<GetNugetVersion PackageDirectory="$(MSBuildProjectDirectory)\packages" NugetId="WindowsAzure.MobileServices.WinJS*">
<Output TaskParameter="NugetVersion" PropertyName="WinJSPackageVersion" />
</GetNugetVersion>
<Message Text="WinJSPackageVersion = $(WinJSPackageVersion)" />
<!-- Build DotNet service quickstart -->
<MSBuild Projects="$(MSBuildProjectDirectory)\backend\dotnet\Quickstart.csproj"
Properties="Configuration=$(Configuration)"/>
<!-- Copy the DotNet service quickstart from network share to the bin directory -->
<ItemGroup>
<DotNetService Include="$(MSBuildProjectDirectory)\backend\dotnet\bin\$(Configuration)\Quickstart\**\*.*" />
</ItemGroup>
<Copy SourceFiles="@(DotNetService)"
DestinationFiles="@(DotNetService->'$(QuickStartsSourceDirectory)\dotnet-service\%(RecursiveDir)%(Filename)%(Extension)')" />
<!-- Build "Try Mobile Apps" service quickstart -->
<MSBuild Projects="$(MSBuildProjectDirectory)\backend\try-mobile-apps\TryMobileApps.csproj" Properties="Configuration=$(Configuration)"/>
<!-- Copy the SQL CE native binaries to the bin folder - don't do this as a post build event as this will break online editing with Monaco -->
<ItemGroup>
<TryMobileApps Include="$(MSBuildProjectDirectory)\backend\try-mobile-apps\packages\Microsoft.SqlServer.Compact.4.0.8876.1\NativeBinaries\x86\*.*" />
</ItemGroup>
<Copy SourceFiles="@(TryMobileApps)"
DestinationFiles="@(TryMobileApps->'$(MSBuildProjectDirectory)\backend\try-mobile-apps\bin\x86\%(RecursiveDir)%(Filename)%(Extension)')" />
<Exec Command='"$(ZipPath)" a -tzip $(OutputPath)\QuickStarts\TryMobileApps.zip $(MSBuildProjectDirectory)\backend\try-mobile-apps\* -xr!obj -xr!packages -x!"bin\*.xml" -xr!de -xr!es -xr!fr -xr!it -xr!ja -xr!ko -xr!ru -xr!zh-Hans -xr!zh-Hant'/>
<MSBuild Projects="$(QuickStartsSourceDirectory)\setup\Setup.csproj" Targets="TransformAll"
Properties="Runtime=NODE;ManagedSDKVersion=$(SDKPackageVersion);JSSDKVersion=$(JSSDKVersion);AndroidSDKVersion=$(AndroidSDKVersion);StoreSDKVersion=$(StorePackageVersion);WinJSPackageVersion=$(WinJSPackageVersion);" />
<!-- We don't want to dublicate web QS files so copy them from Node.js runtime QS to NET runtime QS -->
<ItemGroup>
<WebFiles Include="$(QuickStartsSourceDirectory)\web\*.*" />
</ItemGroup>
<Copy SourceFiles="@(WebFiles)"
DestinationFiles="@(WebFiles->'$(QuickStartsSourceDirectory)\web-dotnet\ZUMOAPPNAME\%(RecursiveDir)%(Filename)%(Extension)')"/>
<!-- Execute the private BuildQuickStart task for each quickstart -->
<ItemGroup Condition="'@(QuickStart)' != '' ">
<_BuildQuickStartsNode Include="$(MSBuildProjectFile)" Condition="'%(QuickStart.Runtime)' == 'Node'">
<AdditionalProperties>
QuickStartPath=%(QuickStart.SourcePath);
QuickStartZipFileName=%(QuickStart.ZipFileName);
QuickStartRuntime=%(QuickStart.Runtime)
</AdditionalProperties>
</_BuildQuickStartsNode>
</ItemGroup>
<MSBuild Projects="@(_BuildQuickStartsNode)" Targets="_BuildQuickStartParallel"
Properties="Runtime=NODE;ManagedSDKVersion=$(SDKPackageVersion);JSSDKVersion=$(JSSDKVersion);StoreSDKVersion=$(StorePackageVersion);WinJSPackageVersion=$(WinJSPackageVersion);" />
<!-- Execute the private BuildQuickStart task for each quickstart -->
<ItemGroup Condition="'@(QuickStart)' != ''">
<_BuildQuickStartsDotNet Include="$(MSBuildProjectFile)" Condition="'%(QuickStart.Runtime)' == 'DotNet'">
<AdditionalProperties>
QuickStartPath=%(QuickStart.SourcePath);
QuickStartZipFileName=%(QuickStart.ZipFileName);
QuickStartRuntime=%(QuickStart.Runtime)
</AdditionalProperties>
</_BuildQuickStartsDotNet>
</ItemGroup>
<MSBuild Projects="$(QuickStartsSourceDirectory)\setup\Setup.csproj" Targets="TransformAll"
Properties="Runtime=DOTNET;ManagedSDKVersion=$(SDKPackageVersion);JSSDKVersion=$(JSSDKVersion);AndroidSDKVersion=$(AndroidSDKVersion);StoreSDKVersion=$(StorePackageVersion);WinJSPackageVersion=$(WinJSPackageVersion);" />
<MSBuild Projects="@(_BuildQuickStartsDotNet)" Targets="_BuildQuickStartParallel"
Properties="Runtime=DOTNET;ManagedSDKVersion=$(SDKPackageVersion);JSSDKVersion=$(JSSDKVersion);StoreSDKVersion=$(StorePackageVersion);WinJSPackageVersion=$(WinJSPackageVersion);" />
<ItemGroup Condition="'@(QuickStart)' != ''">
<_BuildQuickStartsJava Include="$(MSBuildProjectFile)" Condition="'%(QuickStart.Runtime)' == 'Java'">
<AdditionalProperties>
QuickStartPath=%(QuickStart.SourcePath);
QuickStartZipFileName=%(QuickStart.ZipFileName);
QuickStartRuntime=%(QuickStart.Runtime)
</AdditionalProperties>
</_BuildQuickStartsJava>
</ItemGroup>
<MSBuild Projects="@(_BuildQuickStartsJava)" Targets="_BuildQuickStartParallel" Properties="" />
<!-- Execute the private BuildQuickStart task for each quickstart -->
<ItemGroup Condition="'@(QuickStart)' != ''">
<_BuildQuickStartsiOS Include="$(MSBuildProjectFile)" Condition="'%(QuickStart.Runtime)' == 'iOS'">
<AdditionalProperties>
QuickStartPath=%(QuickStart.SourcePath);
QuickStartZipFileName=%(QuickStart.ZipFileName);
QuickStartRuntime=%(QuickStart.Runtime)
</AdditionalProperties>
</_BuildQuickStartsiOS>
</ItemGroup>
<MSBuild Projects="@(_BuildQuickStartsiOS)" Targets="_BuildQuickStartParallel"
Properties="Runtime=iOS;ManagedSDKVersion=$(SDKPackageVersion);JSSDKVersion=$(JSSDKVersion);StoreSDKVersion=$(StorePackageVersion);WinJSPackageVersion=$(WinJSPackageVersion);" />
</Target>
<Target Name="_BuildQuickStartParallel">
<PropertyGroup>
<QuickStartSourceDirectory>$(QuickStartsSourceDirectory)\$(QuickStartPath)</QuickStartSourceDirectory>
<QuickStartOutputDirectory>$(OutputPath)\QuickStarts\$(QuickStartRuntime)\$(QuickStartPath)</QuickStartOutputDirectory>
</PropertyGroup>
<!-- Copy the quickstart from the source directory to the bin directory -->
<ItemGroup>
<QuickStartCopyFiles Include="$(QuickStartSourceDirectory)\**\*.*"/>
</ItemGroup>
<Copy SourceFiles="@(QuickStartCopyFiles)"
DestinationFiles="@(QuickStartCopyFiles->'$(QuickStartOutputDirectory)\%(RecursiveDir)%(Filename)%(Extension)')"/>
<!-- WinJS is special so we need to copy over the .js files from nuget source -->
<ItemGroup>
<WinJSQuickStartCopyFiles Include="$(SDKRootPath)\packages\WindowsAzure.MobileServices.WinJS.$(WinJSPackageVersion)\content\js\*.*"/>
</ItemGroup>
<Copy Condition="'$(QuickStartPath)' == 'windows-universal-js'"
SourceFiles="@(WinJSQuickStartCopyFiles)"
DestinationFolder="$(QuickStartOutputDirectory)\ZUMOAPPNAME\ZUMOAPPNAME.Windows\js"/>
<Copy Condition="'$(QuickStartPath)' == 'windows-universal-js'"
SourceFiles="@(WinJSQuickStartCopyFiles)"
DestinationFolder="$(QuickStartOutputDirectory)\ZUMOAPPNAME\ZUMOAPPNAME.WindowsPhone\js"/>
<!-- Copy iOS SDK -->
<ItemGroup>
<iOSSDK Include="$(SDKRootPath)\packages\iOS\MicrosoftAzureMobile.framework\**\*.*" />
</ItemGroup>
<Copy SourceFiles="@(iOSSDK)"
Condition="'$(QuickStartRuntime)' == 'iOS'"
DestinationFiles="@(iOSSDK->'$(QuickStartOutputDirectory)\ZUMOAPPNAME\MicrosoftAzureMobile.framework\%(RecursiveDir)%(Filename)%(Extension)')"/>
<!-- Delete any .tt & .gitignore files -->
<ItemGroup>
<FilesToDelete Include="$(QuickStartOutputDirectory)\**\*.tt" />
<FilesToDelete Include="$(QuickStartOutputDirectory)\.gitignore" />
</ItemGroup>
<Delete Files="@(FilesToDelete)"/>
<!-- Zip up the quickstart -->
<Exec Command='"$(ZipPath)" a -tzip $(OutputPath)\QuickStarts\$(QuickStartZipFileName) $(QuickStartOutputDirectory)\* '/>
</Target>
<!-- Clean -->
<Target Name="Clean">
<RemoveDir Directories="$(OutputPath)"/>
<RemoveDir Directories="$(MSBuildThisFileDirectory)\packages" />
<RemoveDir Directories="$(MSBuildThisFileDirectory)\backend\dotnet\packages" />
</Target>
<!-- Full -->
<Target Name="Full" DependsOnTargets="Clean;DownloadSDK;BuildQuickStarts;" />
</Project>