/
Xenko.build
482 lines (413 loc) · 27.6 KB
/
Xenko.build
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
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
<?xml version="1.0" encoding="utf-8"?>
<!--
Build file used to build Xenko and package it from the command line.
Example of use:
"C:\Program Files (x86)\MSBuild\14.0\Bin\MSBuild" Xenko.build /t:Package
-->
<Project ToolsVersion="15.0" DefaultTarget="Help" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<XenkoRoot>$(MSBuildThisFileDirectory)..\</XenkoRoot>
<XenkoRootBin>$(XenkoRoot)Bin\Windows\</XenkoRootBin>
<XenkoSolution>$(XenkoRoot)build\Xenko</XenkoSolution>
<XenkoSolutionLauncher>$(XenkoRoot)build\Xenko.Launcher</XenkoSolutionLauncher>
<XenkoPlatforms Condition="'$(XenkoPlatforms)' == ''">Windows</XenkoPlatforms>
<BuildProperties>Configuration=Release;NoWarn=1591;DeployExtension=false;XenkoPlatforms=$(XenkoPlatforms)</BuildProperties>
<BuildProperties Condition="'$(XenkoSign)' != ''">$(BuildProperties);XenkoSign=$(XenkoSign)</BuildProperties>
<BuildProperties Condition="'$(XenkoOfficialBuild)' != ''">$(BuildProperties);XenkoOfficialBuild=$(XenkoOfficialBuild)</BuildProperties>
<NuGetPath>$(MSBuildThisFileDirectory).nuget\NuGet.exe</NuGetPath>
<XunitRunnerConsoleVersion>2.3.1</XunitRunnerConsoleVersion>
<XenkoStoreUrl Condition="'$(XenkoStoreUrl)' == ''">https://xenko-packages.azurewebsites.net/api/v2/package</XenkoStoreUrl>
<AdvancedInstallerPath Condition="'$(AdvancedInstallerPath)' == '' And Exists('$(MSBuildProgramFiles32)\Caphyon\Advanced Installer 14.4.2\bin\x86\advinst.exe')">$(MSBuildProgramFiles32)\Caphyon\Advanced Installer 14.4.2\bin\x86\advinst.exe</AdvancedInstallerPath>
</PropertyGroup>
<UsingTask TaskName="Xenko.Core.Tasks.PackageUpdateVersionTask" AssemblyFile="$(XenkoRoot)sources\core\Xenko.Core.Tasks\bin\Release\Xenko.Core.Tasks.exe" />
<!-- TODO: those tasks will work only if the Direct3D11 files have been copied to top folder (currently works thanks to BuildEditorShaders being run before) -->
<UsingTask TaskName="Xenko.Assets.Tasks.PackageGetVersionTask" AssemblyFile="$(XenkoRootBin)Xenko.Assets.dll" />
<Target Name="Help">
<Message Importance="high" Text="TODO"/>
</Target>
<!--
VSIX Xenko plugin
Don't forget to build for VS2013 by using MSBuild 12.0,
or if you're using a newer version of MSBuild, pass the flag /p:VisualStudioVersion=12.0 when calling MSBuild in the command line.
-->
<Target Name="VSIXPlugin" DependsOnTargets="RestoreWindows">
<ItemGroup>
<FilesToDeleteVSIX Include="$(MSBuildThisFileDirectory)Xenko.VisualStudio.Package.*.nupkg"/>
</ItemGroup>
<Delete Files="@(FilesToDeleteVSIX)"/>
<MSBuild Targets="91-VisualStudio\Xenko_VisualStudio_Package;91-VisualStudio\Xenko_VisualStudio_PackageInstall" Projects="$(XenkoSolution).sln" Properties="$(BuildProperties);Platform=Mixed Platforms"/>
<Exec Command='"$(NuGetPath)" pack "$(XenkoRoot)sources\tools\Xenko.VisualStudio.Package\Xenko.VisualStudio.Package.nuspec" -BasePath "$(XenkoRoot)sources\tools\Xenko.VisualStudio.Package"' />
</Target>
<!--
Package Installer: install-prerequisites.exe
-->
<Target Name="PrerequisitesInstaller">
<Delete Files="$(XenkoRoot)Bin\Prerequisites\install-prerequisites.exe"/>
<Exec Command='"$(AdvancedInstallerPath)" /rebuild "$(XenkoRoot)sources\prerequisites\prerequisites.aip"'/>
<Copy SourceFiles="$(XenkoRoot)sources\prerequisites\install-prerequisites.exe" DestinationFolder="$(XenkoRoot)Bin\Prerequisites"/>
</Target>
<!--
Perform a full build: Build, Package
-->
<Target Name="FullBuild">
<CallTarget Targets="Build"/>
<CallTarget Targets="Package"/>
<CallTarget Targets="PrerequisitesInstaller"/>
<CallTarget Targets="VSIXPlugin"/>
</Target>
<!--
Publish Xenko nupkg from this folder to the store
-->
<Target Name="Publish">
<Error Condition="'$(XenkoStoreApiKey)' == ''" Text="Missing env variable XenkoStoreApiKey"/>
<!-- Waiting 30min in case NuGet.Gallery/Server takes time to process -->
<Exec Command='"$(NuGetPath)" push Xenko.?.*.nupkg -ApiKey $(XenkoStoreApiKey) -Source $(XenkoStoreUrl) -Timeout 1800 '/>
</Target>
<!--
Publish VSIX nupkg from this folder to the store
-->
<Target Name="PublishVSIX">
<Error Condition="'$(XenkoStoreApiKey)' == ''" Text="Missing env variable XenkoStoreApiKey"/>
<Exec Command='"$(NuGetPath)" push Xenko.VisualStudio.Package.*.nupkg -ApiKey $(XenkoStoreApiKey) -Source $(XenkoStoreUrl) "'/>
</Target>
<!--
Build Xenko: Windows, Android, iOS, Windows 10 (UWP)
-->
<Target Name="Clean">
<Exec Command="RMDIR /Q /S $(XenkoRoot)\Bin"/>
</Target>
<!-- Package -->
<Target Name="PreparePackageBuild" DependsOnTargets="RestoreWindows">
<PropertyGroup>
<BuildProperties>$(BuildProperties);XenkoGenerateDoc=true;XenkoPackageBuild=true</BuildProperties>
</PropertyGroup>
<!-- Make sure Xenko.Core.Assets is built to run the task to update package version.
It might be better to move it to a prebuilt assembly if that becomes a problem.
-->
<MSBuild Targets="30-CoreDesign\Xenko_Core_Tasks" Projects="$(XenkoSolution).sln" Properties="$(BuildProperties);Platform=Mixed Platforms"/>
<!-- Create SharedAssemblyInfo.NuGet.cs with Git information (different between official build and internal builds) -->
<PackageUpdateVersionTask Condition="'$(XenkoOfficialBuild)' == 'true'" RootDirectory="$(XenkoRoot)" VersionFile="$(XenkoRoot)sources\shared\SharedAssemblyInfo.cs" GeneratedVersionFile="$(XenkoRoot)sources\shared\SharedAssemblyInfo.NuGet.cs" />
<PackageUpdateVersionTask Condition="'$(XenkoOfficialBuild)' != 'true'" RootDirectory="$(XenkoRoot)" VersionFile="$(XenkoRoot)sources\shared\SharedAssemblyInfo.cs" GeneratedVersionFile="$(XenkoRoot)sources\shared\SharedAssemblyInfo.NuGet.cs" SpecialVersion="beta" SpecialVersionGitHeight="true" SpecialVersionGitCommit="true" />
</Target>
<Target Name="BuildForPackage" DependsOnTargets="PreparePackageBuild;BuildWindows;BuildEditorShaders;VSIXPlugin"/>
<Target Name="GeneratePackage" DependsOnTargets="PreparePackageBuild;PrerequisitesInstaller;Package;WritePackageVersionToFile"/>
<Target Name="CopyXenkoKey">
<Copy Condition="'$(XenkoSign)' == 'true' And Exists('$(LOCALAPPDATA)\Xenko\XenkoBuildKey\xenko.snk')" SourceFiles="$(LOCALAPPDATA)\Xenko\XenkoBuildKey\xenko.snk" DestinationFolder="$(MSBuildThisFileDirectory)"/>
</Target>
<Target Name="BuildEditorShaders">
<Exec Command="$(XenkoRoot)sources\editor\Xenko.Assets.Presentation\EditorPackage\generate-editor-package.bat" WorkingDirectory="$(XenkoRoot)sources\editor\Xenko.Assets.Presentation\EditorPackage"/>
</Target>
<Target Name="RestoreWindows">
<PropertyGroup>
<RestoreExec><![CDATA[
set XenkoPlatforms=$(XenkoPlatforms)
"$(NuGetPath)" restore "$(XenkoSolution).sln"
]]></RestoreExec>
</PropertyGroup>
<Exec Command="$(RestoreExec)" />
</Target>
<Target Name="BuildWindows" DependsOnTargets="CopyXenkoKey;RestoreWindows">
<MSBuild Targets="Build" Projects="$(XenkoSolution).sln" Properties="$(BuildProperties);Platform=Mixed Platforms"/>
</Target>
<Target Name="BuildWindowsDirect3D11" DependsOnTargets="CopyXenkoKey">
<Exec Command='"$(NuGetPath)" restore "$(XenkoSolution).Direct3D.sln"' />
<MSBuild Targets="Build" Projects="$(XenkoSolution).Direct3D.sln" Properties="$(BuildProperties);Platform=Mixed Platforms"/>
</Target>
<Target Name="BuildWindowsDirect3D12" DependsOnTargets="CopyXenkoKey">
<Exec Command='"$(NuGetPath)" restore "$(XenkoSolution).Direct3D12.sln"' />
<MSBuild Targets="Build" Projects="$(XenkoSolution).Direct3D12.sln" Properties="$(BuildProperties);Platform=Mixed Platforms"/>
</Target>
<Target Name="BuildWindowsOpenGL" DependsOnTargets="CopyXenkoKey">
<Exec Command='"$(NuGetPath)" restore "$(XenkoSolution).OpenGL.sln"' />
<MSBuild Targets="Build" Projects="$(XenkoSolution).OpenGL.sln" Properties="$(BuildProperties);Platform=Mixed Platforms"/>
</Target>
<Target Name="BuildWindowsOpenGLES" DependsOnTargets="CopyXenkoKey">
<Exec Command='"$(NuGetPath)" restore "$(XenkoSolution).OpenGLES.sln"' />
<MSBuild Targets="Build" Projects="$(XenkoSolution).OpenGLES.sln" Properties="$(BuildProperties);Platform=Mixed Platforms"/>
</Target>
<Target Name="BuildAndroid" DependsOnTargets="CopyXenkoKey">
<Exec Command='"$(NuGetPath)" restore "$(XenkoSolution).Android.sln"' />
<MSBuild Targets="Build" Projects="$(XenkoSolution).Android.sln" Properties="$(BuildProperties);Platform=Android"/>
</Target>
<Target Name="BuildiOS" DependsOnTargets="CopyXenkoKey">
<Exec Command='"$(NuGetPath)" restore "$(XenkoSolution).iOS.sln"' />
<MSBuild Targets="Build" Projects="$(XenkoSolution).iOS.sln" Properties="$(BuildProperties);Platform=iPhone"/>
</Target>
<Target Name="BuildWindowsStore" DependsOnTargets="CopyXenkoKey">
<!-- Only a warning since build servers might still call this target for old branches -->
<Warning Text="Windows Store doesn't exist anymore"/>
</Target>
<Target Name="BuildWindows10" DependsOnTargets="BuildUWP" />
<Target Name="BuildUWP" DependsOnTargets="CopyXenkoKey">
<Exec Command='"$(NuGetPath)" restore "$(XenkoSolution).UWP.sln"' />
<MSBuild Targets="Build" Projects="$(XenkoSolution).UWP.sln" Properties="$(BuildProperties);Platform=UWP"/>
</Target>
<Target Name="BuildWindowsPhone" DependsOnTargets="CopyXenkoKey">
<!-- Only a warning since build servers might still call this target for old branches -->
<Warning Text="Windows Phone doesn't exist anymore"/>
</Target>
<Target Name="BuildWindowsVulkan" DependsOnTargets="CopyXenkoKey">
<Exec Command='"$(NuGetPath)" restore "$(XenkoSolution).Vulkan.sln"' />
<MSBuild Targets="Build" Projects="$(XenkoSolution).Vulkan.sln" Properties="$(BuildProperties);Platform=Mixed Platforms"/>
</Target>
<Target Name="BuildLinux" DependsOnTargets="CopyXenkoKey">
<Exec Command='"$(NuGetPath)" restore "$(XenkoSolution).Linux.sln"' />
<MSBuild Targets="Build" Projects="$(XenkoSolution).Linux.sln" Properties="$(BuildProperties);Platform=Linux"/>
</Target>
<Target Name="BuildLinuxVulkan" DependsOnTargets="CopyXenkoKey">
<Exec Command='"$(NuGetPath)" restore "$(XenkoSolution).Linux.Vulkan.sln"' />
<MSBuild Targets="Build" Projects="$(XenkoSolution).Linux.Vulkan.sln" Properties="$(BuildProperties);Platform=Linux"/>
</Target>
<Target Name="BuildmacOS" DependsOnTargets="CopyXenkoKey">
<Exec Command='"$(NuGetPath)" restore "$(XenkoSolution).macOS.sln"' />
<MSBuild Targets="Build" Projects="$(XenkoSolution).macOS.sln" Properties="$(BuildProperties);Platform=macOS"/>
</Target>
<Target Name="WritePackageVersionToFile">
<PackageGetVersionTask>
<Output TaskParameter="NuGetVersion" PropertyName="XenkoPackageVersion"/>
</PackageGetVersionTask>
<Delete Files="$(MSBuildThisFileDirectory)Xenko.version"/>
<WriteLinesToFile File="$(MSBuildThisFileDirectory)Xenko.version" Lines="$(XenkoPackageVersion)" />
</Target>
<Target Name="DownloadXunitRunnerConsole">
<MakeDir Directories="$(MSBuildThisFileDirectory)packages"/>
<PropertyGroup>
<XunitRunnerConsolePath>$(MSBuildThisFileDirectory)packages\xunit.runner.console.$(XunitRunnerConsoleVersion)\tools\net452\xunit.console.exe</XunitRunnerConsolePath>
</PropertyGroup>
<Exec Command='"$(NuGetPath)" install xunit.runner.console -Version $(XunitRunnerConsoleVersion)' Condition="!Exists('$(XunitRunnerConsolePath)')" WorkingDirectory="$(MSBuildThisFileDirectory)packages" />
<Error Text="Could not find xunit.runner at expected location [$(XunitRunnerConsolePath)]" Condition="!Exists('$(XunitRunnerConsolePath)')"/>
</Target>
<Target Name="RunTestsWindows" DependsOnTargets="DownloadXunitRunnerConsole">
<!-- By default, enable all known categories -->
<PropertyGroup>
<XenkoTestCategories Condition="'$(XenkoTestCategories)' == ''">Simple;Game;VSPackage</XenkoTestCategories>
<!-- We enclose everything with ;, so that we could do full word matches more easily with string.Contains() -->
<XenkoTestCategories>;$(XenkoTestCategories);</XenkoTestCategories>
<XenkoTestExtraTargets></XenkoTestExtraTargets>
<XenkoTestExtraTargets Condition="$(XenkoTestCategories.Contains(';GameAndroid;'))">$(XenkoTestExtraTargets);SignAndroidPackage</XenkoTestExtraTargets>
</PropertyGroup>
<!-- Simple standalone unit tests -->
<ItemGroup Condition="$(XenkoTestCategories.Contains(';Simple;'))">
<UnitTest Include="11-CoreRuntime.Tests\Xenko.Core.Tests"/>
<UnitTest Include="21-XenkoRuntime.Tests\Xenko.Shaders.Tests.Windows"/>
<UnitTest Include="31-CoreDesign.Tests\Xenko.Core.BuildEngine.Tests"/>
<UnitTest Include="31-CoreDesign.Tests\Xenko.Core.Design.Tests"/>
<UnitTest Include="31-CoreDesign.Tests\Xenko.Core.Yaml.Tests"/>
<UnitTest Include="41-Assets.Tests\Xenko.Core.Assets.Quantum.Tests"/>
<UnitTest Include="41-Assets.Tests\Xenko.Core.Assets.Tests"/>
<UnitTest Include="51-Presentation.Tests\Xenko.Core.Presentation.Quantum.Tests"/>
<UnitTest Include="51-Presentation.Tests\Xenko.Core.Presentation.Tests"/>
<UnitTest Include="51-Presentation.Tests\Xenko.Core.Quantum.Tests"/>
<UnitTest Include="61-Editor.Tests\Xenko.Core.Assets.Editor.Tests"/>
<UnitTest Include="61-Editor.Tests\Xenko.GameStudio.Tests"/>
<UnitTest Include="71-XenkoAssets.Tests\Xenko.Assets.Tests2"/>
</ItemGroup>
<ItemGroup>
<UnitTestGame Include="21-XenkoRuntime.Tests\Xenko.Engine.Tests.Windows"/>
<UnitTestGame Include="21-XenkoRuntime.Tests\Xenko.Graphics.Tests.10_0.Windows"/>
<UnitTestGame Include="21-XenkoRuntime.Tests\Xenko.Graphics.Tests.Windows"/>
<UnitTestGame Include="21-XenkoRuntime.Tests\Xenko.Navigation.Tests.Windows"/>
<UnitTestGame Include="21-XenkoRuntime.Tests\Xenko.Input.Tests.Windows"/>
<UnitTestGame Include="21-XenkoRuntime.Tests\Xenko.Particles.Tests.Windows"/>
<UnitTestGame Include="21-XenkoRuntime.Tests\Xenko.Physics.Tests.Windows"/>
<UnitTestGame Include="21-XenkoRuntime.Tests\Xenko.UI.Tests.Windows"/>
</ItemGroup>
<ItemGroup>
<UnitTestGameAndroid Include="21-XenkoRuntime.Tests\Xenko.Engine.Tests.Android"/>
<UnitTestGameAndroid Include="21-XenkoRuntime.Tests\Xenko.Graphics.Tests.10_0.Android"/>
<UnitTestGameAndroid Include="21-XenkoRuntime.Tests\Xenko.Graphics.Tests.Android"/>
<UnitTestGameAndroid Include="21-XenkoRuntime.Tests\Xenko.Input.Tests.Android"/>
<UnitTestGameAndroid Include="21-XenkoRuntime.Tests\Xenko.Particles.Tests.Android"/>
<UnitTestGameAndroid Include="21-XenkoRuntime.Tests\Xenko.Physics.Tests.Android"/>
<UnitTestGameAndroid Include="21-XenkoRuntime.Tests\Xenko.UI.Tests.Android"/>
</ItemGroup>
<!-- Direct3D11 unit tests -->
<ItemGroup Condition="$(XenkoTestCategories.Contains(';Game;'))">
<UnitTest Include="@(UnitTestGame)"/>
<!-- Other graphics platforms don't support compute shaders and tessellation yet -->
<UnitTest Include="21-XenkoRuntime.Tests\Xenko.Graphics.Tests.11_0.Windows"/>
<UnitTest Include="21-XenkoRuntime.Tests\Xenko.Audio.Tests.Windows"/>
<UnitTest Include="71-XenkoAssets.Tests\Xenko.Assets.Tests"/>
</ItemGroup>
<!-- Unit tests for Visual Studio -->
<ItemGroup Condition="$(XenkoTestCategories.Contains(';VSPackage;'))">
<UnitTest Include="91-VisualStudio\Xenko.VisualStudio.Package.Tests"/>
</ItemGroup>
<!-- Direct3D12 unit tests -->
<ItemGroup Condition="$(XenkoTestCategories.Contains(';GameDirect3D12;'))">
<UnitTestPrerequisites Include="@(UnitTestGame)"/>
<UnitTest Include="@(UnitTestGame)"><Solution>$(XenkoSolution).Direct3D12.sln</Solution></UnitTest>
</ItemGroup>
<!-- OpenGL unit tests -->
<ItemGroup Condition="$(XenkoTestCategories.Contains(';GameOpenGL;'))">
<UnitTestPrerequisites Include="@(UnitTestGame)"/>
<UnitTest Include="@(UnitTestGame)"><Solution>$(XenkoSolution).OpenGL.sln</Solution></UnitTest>
</ItemGroup>
<!-- OpenGLES unit tests -->
<ItemGroup Condition="$(XenkoTestCategories.Contains(';GameOpenGLES;'))">
<UnitTestPrerequisites Include="@(UnitTestGame)"/>
<UnitTest Include="@(UnitTestGame)"><Solution>$(XenkoSolution).OpenGLES.sln</Solution></UnitTest>
</ItemGroup>
<!-- Vulkan unit tests -->
<ItemGroup Condition="$(XenkoTestCategories.Contains(';GameVulkan;'))">
<UnitTestPrerequisites Include="@(UnitTestGame)"/>
<UnitTest Include="@(UnitTestGame)"><Solution>$(XenkoSolution).Vulkan.sln</Solution></UnitTest>
</ItemGroup>
<!-- Android unit tests -->
<ItemGroup Condition="$(XenkoTestCategories.Contains(';GameAndroid;'))">
<UnitTestPrerequisites Include="@(UnitTestGame)"/>
<UnitTest Include="@(UnitTestGameAndroid)"><Solution>$(XenkoSolution).Android.sln</Solution></UnitTest>
</ItemGroup>
<!-- Samples unit tests -->
<ItemGroup Condition="$(XenkoTestCategories.Contains(';Samples;'))">
<UnitTest Include="72-XenkoSamples\Xenko.Samples.Tests"/>
</ItemGroup>
<!-- Compute TargetName and default Solution -->
<ItemGroup>
<UnitTestPrerequisites>
<!-- Replace . into _ (needed for .sln targets) -->
<TargetName>$([System.String]::Copy('%(Identity)').Replace('.','_'))</TargetName>
<!-- Default solution -->
<Solution Condition="'%(UnitTestPrerequisites.Solution)' == ''">$(XenkoSolution).sln</Solution>
</UnitTestPrerequisites>
<UnitTest>
<!-- Replace . into _ (needed for .sln targets) -->
<TargetName>$([System.String]::Copy('%(Identity)').Replace('.','_'))</TargetName>
<!-- Default solution -->
<Solution Condition="'%(UnitTest.Solution)' == ''">$(XenkoSolution).sln</Solution>
</UnitTest>
</ItemGroup>
<!-- Restore NuGet packages -->
<Message Importance="High" Text="Restoring NuGet packages"/>
<Exec Condition="'%(UnitTestPrerequisites.Solution)' != ''" Command='"$(NuGetPath)" restore "%(UnitTestPrerequisites.Solution)"' />
<Exec Condition="'%(UnitTest.Solution)' != ''" Command='"$(NuGetPath)" restore "%(UnitTest.Solution)"' />
<!-- First, build prerequisites -->
<Message Importance="High" Text="Building unit test prerequisites from solution %(Solution): @(UnitTestPrerequisites->'%(TargetName)')"/>
<MSBuild Targets="@(UnitTestPrerequisites->'%(TargetName)')" Projects="%(Solution)" Properties="$(BuildProperties);Platform=Mixed Platforms;DeployExtension=true"/>
<!-- Build unit tests -->
<Message Importance="High" Text="Building unit test from solution %(Solution): @(UnitTest->'%(TargetName)')"/>
<MSBuild Targets="@(UnitTest->'%(TargetName)');$(XenkoTestExtraTargets)" Projects="%(Solution)" Properties="$(BuildProperties);DeployExtension=true">
<Output TaskParameter="TargetOutputs" ItemName="AssembliesToTest" />
</MSBuild>
<!-- Run unit tests -->
<MakeDir Directories="$(MSBuildThisFileDirectory)TestResults"/>
<Exec Command=""$(XunitRunnerConsolePath)" @(AssembliesToTest->'%(Identity)', ' ')" WorkingDirectory="$(XenkoRootBin)"/>
</Target>
<ItemGroup>
<MobileUnitTestProject Include="$(XenkoRoot)sources\engine\Xenko.Engine.Tests\Xenko.Engine.Tests.$(PlatformToBuild).csproj"/>
<MobileUnitTestProject Include="$(XenkoRoot)sources\engine\Xenko.Audio.Tests\Xenko.Audio.Tests.$(PlatformToBuild).csproj"/>
<MobileUnitTestProject Include="$(XenkoRoot)sources\engine\Xenko.Graphics.Tests\Xenko.Graphics.Tests.$(PlatformToBuild).csproj"/>
<MobileUnitTestProject Include="$(XenkoRoot)sources\engine\Xenko.Graphics.Tests.10_0\Xenko.Graphics.Tests.10_0.$(PlatformToBuild).csproj"/>
<MobileUnitTestProject Include="$(XenkoRoot)sources\engine\Xenko.Input.Tests\Xenko.Input.Tests.$(PlatformToBuild).csproj"/>
<MobileUnitTestProject Include="$(XenkoRoot)sources\engine\Xenko.Particles.Tests\Xenko.Particles.Tests.$(PlatformToBuild).csproj"/>
<MobileUnitTestProject Include="$(XenkoRoot)sources\engine\Xenko.Physics.Tests\Xenko.Physics.Tests.$(PlatformToBuild).csproj"/>
</ItemGroup>
<ItemGroup>
<MobileUnitTestApk Include="$(XenkoRoot)\Bin\Android\Tests\OpenGLES\Xenko.Engine.Tests\Xenko.Engine.Tests-Signed.apk"/>
<MobileUnitTestApk Include="$(XenkoRoot)\Bin\Android\Tests\OpenGLES\Xenko.Physics.Tests\Xenko.Physics.Tests-Signed.apk"/>
<MobileUnitTestApk Include="$(XenkoRoot)\Bin\Android\Tests\OpenGLES\Xenko.Audio.Tests\Xenko.Audio.Tests-Signed.apk"/>
<MobileUnitTestApk Include="$(XenkoRoot)\Bin\Android\Tests\OpenGLES\Xenko.Graphics.Tests.10_0\Xenko.Graphics.Tests_10_0-Signed.apk"/>
<MobileUnitTestApk Include="$(XenkoRoot)\Bin\Android\Tests\OpenGLES\Xenko.Graphics.Tests\Xenko.Graphics.Tests-Signed.apk"/>
<MobileUnitTestApk Include="$(XenkoRoot)\Bin\Android\Tests\OpenGLES\Xenko.Input.Tests\Xenko.Input.Tests-Signed.apk"/>
<MobileUnitTestApk Include="$(XenkoRoot)\Bin\Android\Tests\OpenGLES\Xenko.Particles.Tests\Xenko.Particles.Tests-Signed.apk"/>
</ItemGroup>
<Target Name="RunTestsMobile" DependsOnTargets="DownloadXunitRunnerConsole" Outputs="%(MobileUnitTestProject.Identity)">
<PropertyGroup>
<XenkoRoot>$(MSBuildThisFileDirectory)..\</XenkoRoot>
<XenkoRootBin>$(XenkoRoot)Bin\Windows\</XenkoRootBin>
<XenkoPlatform></XenkoPlatform>
<XenkoPlatform Condition="'$(PlatformToBuild)' == 'iOS'">Platform=iPhone</XenkoPlatform>
<XenkoPlatform Condition="'$(PlatformToBuild)' == 'Android'">Platform=Android</XenkoPlatform>
<XenkoBuildOptions></XenkoBuildOptions>
<XenkoBuildOptions Condition="'$(PlatformToBuild)' == 'iOS'">ServerAddress=pc13095;ServerUser=virgile;BuildIpa=true;MtouchUseLlvm=true</XenkoBuildOptions>
<XenkoBuildTargets>Rebuild</XenkoBuildTargets>
<XenkoBuildTargets Condition="'$(PlatformToBuild)' == 'Android'">SignAndroidPackage</XenkoBuildTargets>
<XenkoBuildConfig>Release</XenkoBuildConfig>
<XenkoBuildConfig Condition="'$(PlatformToBuild)' == 'Windows'">Debug</XenkoBuildConfig>
</PropertyGroup>
<MSBuild Projects ="%(MobileUnitTestProject.Identity)" Targets="SignAndroidPackage"
Properties="SolutionName=Xenko.Android; SolutionDir=$(MSBuildThisFileDirectory);$(XenkoPlatform);Configuration=$(XenkoBuildConfig);$(XenkoBuildOptions)">
</MSBuild>
<Exec IgnoreExitCode="True" Command='taskkill /F /FI "Imagename eq Xenko.Core.Assets.CompilerApp*"' />
<Exec Condition="'$(PlatformToBuild)' == 'Android'" Command="$(XenkoRootBin)Xenko.TestRunner.exe %(MobileUnitTestApk.Identity)" WorkingDirectory="$(XenkoRootBin)">
<Output TaskParameter="ExitCode" ItemName="exitCode" />
</Exec>
</Target>
<!--
Package Launcher
-->
<Target Name="PackageLauncher" DependsOnTargets="LauncherPrerequisitesInstaller">
<ItemGroup>
<FilesToDeleteLauncher Include="$(MSBuildThisFileDirectory)Xenko.Launcher*.nupkg"/>
</ItemGroup>
<!-- Note: we avoid building again if BuildWindows was already ran just before -->
<Delete Files="@(FilesToDeleteLauncher)"/>
<!-- Generate the nuget package for the launcher application -->
<Exec Command='"$(NuGetPath)" pack "$(XenkoRoot)sources\launcher\Xenko.LauncherApp\Xenko.LauncherApp.nuspec" -BasePath "$(XenkoRoot)sources\launcher\Xenko.LauncherApp\bin\Release"' />
</Target>
<!--
Package Installer: XenkoSetup.exe
-->
<Target Name="PackageInstallerSimple" DependsOnTargets="PackageLauncher">
<Delete Files="XenkoSetup.exe"/>
<!-- Run advanced installer -->
<Exec Command='"$(AdvancedInstallerPath)" /rebuild "$(XenkoRoot)sources\launcher\Setup\setup.aip"'/>
<Copy SourceFiles="$(XenkoRoot)sources\launcher\Setup\setup-SetupFiles\XenkoSetup.exe" DestinationFolder="$(MSBuildThisFileDirectory)"/>
</Target>
<Target Name="PackageInstallerCustom" DependsOnTargets="PackageLauncher">
<Error Condition="'$(CustomInstaller)' == '' Or '$(CustomInstallerStoreUrl)' == ''" Text="When CustomInstaller is set, CustomInstallerStoreUrl also needs to be defined"/>
<PropertyGroup>
<CustomInstallerNoSpace>$(CustomInstaller.Replace(' ', ''))</CustomInstallerNoSpace>
</PropertyGroup>
<Delete Files="XenkoSetup$(CustomInstallerNoSpace).exe"/>
<!-- Make sure it is deleted otherwise Advanced Installer complains (in case previous run didn't complete -->
<Delete Files="$(XenkoRoot)sources\launcher\Setup\setup-$(CustomInstallerNoSpace).aip"/>
<!-- Duplicate setup.aip with different IDs -->
<Exec Command='"$(AdvancedInstallerPath)" /edit "$(XenkoRoot)sources\launcher\Setup\setup.aip" /DuplicateProject "$(XenkoRoot)sources\launcher\Setup\setup-$(CustomInstallerNoSpace).aip"'/>
<!-- Edit a few parameters -->
<Exec Command='"$(AdvancedInstallerPath)" /edit "$(XenkoRoot)sources\launcher\Setup\setup-$(CustomInstallerNoSpace).aip" /SetProperty BuildExeName="XenkoSetup$(CustomInstallerNoSpace)"'/>
<Exec Command='"$(AdvancedInstallerPath)" /edit "$(XenkoRoot)sources\launcher\Setup\setup-$(CustomInstallerNoSpace).aip" /SetProperty ProductName="Xenko $(CustomInstaller)"'/>
<Exec Command='"$(AdvancedInstallerPath)" /edit "$(XenkoRoot)sources\launcher\Setup\setup-$(CustomInstallerNoSpace).aip" /SetProperty AI_PRODUCTNAME_ARP="Xenko $(CustomInstaller)"'/>
<!-- Backup store.config -->
<Copy SourceFiles="$(XenkoRoot)sources\launcher\Xenko.LauncherApp\bin\Release\store.config" DestinationFiles="$(XenkoRoot)sources\launcher\Xenko.LauncherApp\bin\Release\store.config.backup"/>
<!-- Update store.config with additional parameters -->
<Exec Command='"$(NuGetPath)" sources Add -Name "Xenko $(CustomInstaller)" -Source "$(CustomInstallerStoreUrl)" -ConfigFile "$(XenkoRoot)sources\launcher\Xenko.LauncherApp\bin\Release\store.config"'/>
<!-- Run advanced installer -->
<Exec Command='"$(AdvancedInstallerPath)" /rebuild "$(XenkoRoot)sources\launcher\Setup\setup-$(CustomInstallerNoSpace).aip"'/>
<Copy SourceFiles="$(XenkoRoot)sources\launcher\Setup\setup-$(CustomInstallerNoSpace)-SetupFiles\XenkoSetup$(CustomInstallerNoSpace).exe" DestinationFolder="$(MSBuildThisFileDirectory)"/>
<Delete Files="$(XenkoRoot)sources\launcher\Setup\setup-$(CustomInstallerNoSpace).aip"/>
<!-- Restore store.config -->
<Copy SourceFiles="$(XenkoRoot)sources\launcher\Xenko.LauncherApp\bin\Release\store.config.backup" DestinationFiles="$(XenkoRoot)Xenko.LauncherApp\bin\Release\store.config"/>
<Delete Files="$(XenkoRoot)sources\launcher\Xenko.LauncherApp\bin\Release\store.config.backup"/>
</Target>
<PropertyGroup>
<!-- Choose proper target to execute -->
<PackageInstallerTarget Condition="'$(CustomInstaller)' == ''">PackageInstallerSimple</PackageInstallerTarget>
<PackageInstallerTarget Condition="'$(CustomInstaller)' != ''">PackageInstallerCustom</PackageInstallerTarget>
</PropertyGroup>
<Target Name="PackageInstaller" DependsOnTargets="$(PackageInstallerTarget)"/>
<!--
Package Installer: launcher-prerequisites.exe
-->
<Target Name="LauncherPrerequisitesInstaller">
<Exec Command='"$(AdvancedInstallerPath)" /rebuild "$(XenkoRoot)sources\launcher\Prerequisites\launcher-prerequisites.aip"'/>
</Target>
<!--
Perform a full build: Build, Package and PackageInstaller
-->
<Target Name="FullBuildLauncher">
<CallTarget Targets="BuildLauncher"/>
<CallTarget Targets="PackageInstaller"/>
</Target>
<!--
Publish Launcher nupkg from this folder to the store
-->
<Target Name="PublishLauncher">
<Error Condition="'$(XenkoStoreApiKey)' == ''" Text="Missing env variable XenkoStoreApiKey"/>
<Exec Command='"$(NuGetPath)" push Xenko.Launcher*.nupkg -ApiKey $(XenkoStoreApiKey) -Source $(XenkoStoreUrl) "'/>
</Target>
<Target Name="BuildLauncher" DependsOnTargets="CopyXenkoKey">
<Exec Command='"$(NuGetPath)" restore "$(XenkoSolutionLauncher).sln"' />
<MSBuild Targets="Build" Projects="$(XenkoSolutionLauncher).sln" Properties="$(BuildProperties);Platform=Any CPU"/>
</Target>
</Project>