This repository has been archived by the owner on Nov 16, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 79
/
Copy pathbuild.proj
468 lines (423 loc) · 17.5 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
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
<Project InitialTargets="Configure" DefaultTargets="Build">
<Import Project="Directory.Build.props"/>
<Import Project="Directory.Build.targets"/>
<Import Project="build\Environment.targets"/>
<Import Project="build\Utility.targets"/>
<PropertyGroup>
<ReleaseVersion_SemVer>2.0.0-dev</ReleaseVersion_SemVer>
<CommonGitInfo_SetMinRevisionFromMostRecentTagRegex>true</CommonGitInfo_SetMinRevisionFromMostRecentTagRegex>
<CommonGitInfo_MostRecentTagRegex>^v\d+</CommonGitInfo_MostRecentTagRegex>
<WorkbooksIntegrationNuGetPackageVersion>2.0.0-rc1</WorkbooksIntegrationNuGetPackageVersion>
</PropertyGroup>
<PropertyGroup>
<SolutionFile>$(MSBuildThisFileDirectory)build\Xamarin.Interactive.sln</SolutionFile>
<SolutionFileRelative>$([MSBuild]::MakeRelative($(MSBuildThisFileDirectory), $(SolutionFile)))</SolutionFileRelative>
<SolutionBasePath>$([System.IO.Path]::GetDirectoryName($(SolutionFile)))\</SolutionBasePath>
<RestoreStampFile>$([MSBuild]::NormalizePath('$(MSBuildThisFileDirectory)_build\Restore.stamp'))</RestoreStampFile>
</PropertyGroup>
<!-- Profiles -->
<Target
Name="WebProfile"
DependsOnTargets="CoreProfile;WorkbookAppsProfile">
<ItemGroup>
<ProjectsToBuild Include="Clients\Xamarin.Interactive.Client.Web\*.csproj">
<HasPackageTarget>true</HasPackageTarget>
</ProjectsToBuild>
<ProjectsToBuild Include="WorkbookApps\Xamarin.Workbooks.WebAssembly\*.csproj" />
</ItemGroup>
</Target>
<Target
Name="ConsoleProfile"
DependsOnTargets="CoreProfile;WorkbookAppsProfile">
<ItemGroup>
<ProjectsToBuild Include="Clients\Xamarin.Interactive.Client.Console\*.csproj"/>
</ItemGroup>
</Target>
<Target
Name="DesktopProfile"
Condition="!$(IsDotNetCoreMSBuild)"
DependsOnTargets="CoreProfile;WorkbookAppsProfile">
<ItemGroup>
<ProjectsToBuild
Condition="$(IsMac)"
Include="Clients\Xamarin.Interactive.Client.Mac\*.csproj">
<HasPackageTarget>true</HasPackageTarget>
</ProjectsToBuild>
<ProjectsToBuild
Condition="$(IsWindows)"
Include="Clients\Xamarin.Interactive.Client.Windows\*.csproj">
<HasPackageTarget>true</HasPackageTarget>
</ProjectsToBuild>
<ProjectsToBuild
Condition="$(IsWindows)"
Include="Tools\InstallerVerifier\*.csproj"/>
<ProjectsToBuild
Include="Tests\Xamarin.Interactive.Tests\*.csproj" />
<ProjectsToBuild
Condition="$(IsMac)"
Include="Tests\Xamarin.Interactive.Tests.InspectorSupport.Mac\*.csproj"/>
</ItemGroup>
</Target>
<Target
Name="CoreProfile">
<ItemGroup>
<ProjectsToBuild Include="Agents\Xamarin.Interactive\*.csproj">
<HasPublicApi>true</HasPublicApi>
<HasPackageTarget>true</HasPackageTarget>
</ProjectsToBuild>
<ProjectsToBuild Include="Agents\Xamarin.Interactive.Tests\*.csproj">
<HasXunitTests>true</HasXunitTests>
</ProjectsToBuild>
<ProjectsToBuild Include="CodeAnalysis\Xamarin.Interactive.CodeAnalysis\*.csproj">
<HasPublicApi>true</HasPublicApi>
</ProjectsToBuild>
<ProjectsToBuild Include="CodeAnalysis\Xamarin.Interactive.CodeAnalysis.Tests\*.csproj">
<HasXunitTests>true</HasXunitTests>
</ProjectsToBuild>
<ProjectsToBuild Include="CodeAnalysis\Xamarin.Interactive.CodeAnalysis.Roslyn\*.csproj"/>
<ProjectsToBuild Include="CodeAnalysis\Xamarin.Interactive.CodeAnalysis.Roslyn.Tests\*.csproj">
<HasXunitTests>true</HasXunitTests>
</ProjectsToBuild>
<ProjectsToBuild Include="Clients\Xamarin.Interactive.Client\*.csproj">
<HasPublicApi>true</HasPublicApi>
</ProjectsToBuild>
</ItemGroup>
</Target>
<PropertyGroup>
<WorkbookAppsProfileDependsOnTargets>
CoreProfile;
DotNetCoreWorkbookAppsProfile;
DesktopWorkbookAppsProfile;
XamarinAndroidWorkbookAppsProfile;
XamarinIosWorkbookAppsProfile;
XamarinMacWorkbookAppsProfile
</WorkbookAppsProfileDependsOnTargets>
</PropertyGroup>
<Target
Name="WorkbookAppsProfile"
DependsOnTargets="$(WorkbookAppsProfileDependsOnTargets)"/>
<Target
Name="DotNetCoreWorkbookAppsProfile">
<ItemGroup>
<ProjectsToBuild Include="WorkbookApps\Xamarin.Workbooks.DotNetCore\*.csproj"/>
</ItemGroup>
</Target>
<Target
Name="DesktopWorkbookAppsProfile"
Condition="!$(IsDotNetCoreMSBuild)">
<ItemGroup>
<ProjectsToBuild
Condition="$(IsWindows) Or $(HaveMono)"
Include="Agents\Xamarin.Interactive.Console\*.csproj"/>
<ProjectsToBuild
Condition="$(IsWindows)"
Include="WorkbookApps\Xamarin.Workbooks.Wpf\*.csproj"/>
</ItemGroup>
</Target>
<Target
Name="XamarinAndroidWorkbookAppsProfile"
Condition="!$(IsDotNetCoreMSBuild) And $(HaveXamarinAndroid)">
<ItemGroup>
<ProjectsToBuild Include="WorkbookApps\Xamarin.Workbooks.Android\*.csproj"/>
<ProjectsToBuild Include="Agents\Xamarin.Interactive.Android.ActivityTrackerShim\*.csproj"/>
<ProjectsToBuild Include="Agents\Xamarin.Interactive.Forms.Android\*.csproj"/>
<ProjectsToBuild
Condition="Exists($(ProprietaryDirectory))"
Include="$(ProprietaryDirectory)ClientIntegrations\Xamarin.Workbooks.Client.Android\*.csproj"/>
</ItemGroup>
</Target>
<Target
Name="XamarinIosWorkbookAppsProfile"
Condition="!$(IsDotNetCoreMSBuild) And $(HaveXamarinIos)">
<ItemGroup>
<ProjectsToBuild Include="WorkbookApps\Xamarin.Workbooks.iOS\*.csproj">
<Platform>iPhoneSimulator</Platform>
</ProjectsToBuild>
<ProjectsToBuild Include="Agents\Xamarin.Interactive.Forms.iOS\*.csproj"/>
<ProjectsToBuild
Condition="$(IsWindows)"
Include="Clients\Xamarin.Interactive.Client.Mac.SimChecker\*.csproj"/>
<ProjectsToBuild
Condition="$(IsWindows)"
Include="ClientIntegrations\Xamarin.Workbooks.Client.iOS\*.csproj"/>
</ItemGroup>
</Target>
<Target
Name="XamarinMacWorkbookAppsProfile"
Condition="!$(IsDotNetCoreMSBuild) And $(HaveXamarinMac)">
<ItemGroup>
<ProjectsToBuild Include="WorkbookApps\Xamarin.Workbooks.Mac\*.csproj"/>
</ItemGroup>
</Target>
<!-- Solution Targets -->
<Target
Name="CheckRestore"
BeforeTargets="Build">
<Error
Condition="!Exists('$(RestoreStampFile)')"
Text="When building with MSBuild directly, The 'Restore' target must be run first. Run 'msbuild /restore' or 'msbuild /t:Restore'."/>
</Target>
<Target
Name="Build"
DependsOnTargets="@(ProfileTargets)">
<Exec Condition="$(IsWindows) And Exists('$(Adb)')" Command="$(Adb) kill-server"/>
<Exec Condition="$(IsMac)" Command="xcrun -k"/>
<MSBuild
Projects="$(SolutionFile)"
Targets="Build"/>
</Target>
<Target
Name="Restore"
DependsOnTargets="@(ProfileTargets)">
<Message Importance="High" Text="Restoring NuGet packages for $(SolutionFileRelative)..."/>
<MSBuild
Projects="$(SolutionFile)"
Targets="Restore"/>
<WriteLinesToFile
File="$(RestoreStampFile)"
Overwrite="true"
Lines="$([System.DateTime]::Now)"/>
</Target>
<!-- Profile Targets -->
<Target
Name="Package"
DependsOnTargets="@(ProfileTargets)">
<MakeDir Directories="$(ArtifactsBasePath)"/>
<PropertyGroup>
<XamarinUpdaterProductGuid Condition="$(IsMac)">42a8c70f-b3dc-42f4-b8a5-435a1bb2410c</XamarinUpdaterProductGuid>
<XamarinUpdaterProductGuid Condition="$(IsWindows)">201185fb-fefe-4996-bdfe-4b6ac311a73b</XamarinUpdaterProductGuid>
</PropertyGroup>
<WriteLinesToFile
Condition="'$(XamarinUpdaterProductGuid)' != ''"
File="$(ArtifactsBasePath)updateinfo"
Lines="$(XamarinUpdaterProductGuid) $(ReleaseVersion_UpdateInfo)"
Overwrite="true"/>
<ItemGroup>
<BuildInfoLines Include="Version: $(ReleaseVersion_SemVer)"/>
<BuildInfoLines Include="Hash: $(CommonGitInfo_MaxRevisionShort)"/>
<BuildInfoLines Include="Branch: $(BuildEnvironment_Branch)"/>
<BuildInfoLines Include="Build date: $([System.DateTime]::UtcNow.ToString('r'))"/>
<BuildInfoLines Include="Client compatibility: 1"/>
</ItemGroup>
<WriteLinesToFile
File="$(ArtifactsBasePath)buildinfo"
Lines="@(BuildInfoLines)"
Overwrite="true"/>
<ItemGroup>
<PackageProjectsToBuild
Include="@(ProjectsToBuild)"
Condition="'%(ProjectsToBuild.HasPackageTarget)' != ''"/>
</ItemGroup>
<MSBuild
Projects="@(PackageProjectsToBuild)"
Targets="Package"/>
</Target>
<Target
Name="Test"
DependsOnTargets="@(ProfileTargets)">
<ItemGroup>
<ProjectsToTest
Include="@(ProjectsToBuild)"
Condition="'%(ProjectsToBuild.HasXunitTests)' != ''"/>
</ItemGroup>
<Message Importance="High" Text="Selected xUnit Tests:"/>
<Message Importance="High" Text=" %(ProjectsToTest.Filename)"/>
<Exec
WorkingDirectory="%(ProjectsToTest.RootDir)%(ProjectsToTest.Directory)"
Command="dotnet xunit -nocolor -nobuild -c $(Configuration) -xml %(ProjectsToTest.Filename).xml"/>
</Target>
<!-- Configuration / Solution Generation -->
<Target
Name="GenerateReleaseVersions"
DependsOnTargets="
Xamarin_Build_ReadBuildEnvironment;
Xamarin_Build_ReadCommonGitInfo">
<PropertyGroup>
<CommonGitInfo_MaxRevision Condition="'$(BuildEnvironment_Revision)' != ''">$(BuildEnvironment_Revision)</CommonGitInfo_MaxRevision>
<ReleaseVersion_SemVer>$(ReleaseVersion_SemVer)+$(CommonGitInfo_MinMaxCommitDistance)</ReleaseVersion_SemVer>
<ReleaseVersion_UpdateInfo>$(CommonGitInfo_MaxRevisionTimestamp)</ReleaseVersion_UpdateInfo>
</PropertyGroup>
<ItemGroup>
<PropertiesToPersist Include="CommonGitInfo_MaxRevision">
<Value>$(CommonGitInfo_MaxRevision)</Value>
</PropertiesToPersist>
<PropertiesToPersist Include="ReleaseVersion_SemVer">
<Value>$(ReleaseVersion_SemVer)</Value>
</PropertiesToPersist>
<PropertiesToPersist Include="ReleaseVersion_UpdateInfo">
<Value>$(ReleaseVersion_UpdateInfo)</Value>
</PropertiesToPersist>
</ItemGroup>
</Target>
<Target
Name="Configure"
DependsOnTargets="
GenerateReleaseVersions;
Xamarin_Build_ReadReleaseVersions;
ResolveExternalTools">
<PropertyGroup>
<Profile Condition="'$(Profile.ToLowerInvariant())' == 'full'"></Profile>
<Profile Condition="'$(Profile.ToLowerInvariant())' == 'fullprofile'"></Profile>
<Profile Condition="'$(Profile)' == ''">Desktop+Web+Console</Profile>
</PropertyGroup>
<ItemGroup>
<Profiles Include="$(Profile.Replace('|', '+').Replace(',', '+').Replace(';', '+').Split('+'))"/>
<Profiles>
<ProfileName>$([System.Text.RegularExpressions.Regex]::Replace(
%(Identity),
'Profile$',
'',
System.Text.RegularExpressions.RegexOptions.IgnoreCase))</ProfileName>
</Profiles>
<ProfileTargets Include="@(Profiles -> '%(ProfileName)Profile')"/>
</ItemGroup>
<ItemGroup>
<PropertiesToPersist Include="Configuration">
<Value>$(Configuration)</Value>
</PropertiesToPersist>
<PropertiesToPersist Include="Profile">
<Value>$(Profile)</Value>
</PropertiesToPersist>
<PropertiesToPersist Include="WorkbooksIntegrationNuGetPackageVersion">
<Value>$(WorkbooksIntegrationNuGetPackageVersion)</Value>
</PropertiesToPersist>
</ItemGroup>
<UpdateMSBuildProject
Project="$(GlobalConfigurationPropsFile)"
AsNewProject="true"
Properties="@(PropertiesToPersist)"/>
</Target>
<Target
Name="ConfigurationSummary"
BeforeTargets="Restore;Build">
<ItemGroup>
<ConfigurationSummary Include="%20%20Resolved Tools:"/>
<ConfigurationSummary Condition="'$(Adb)' != ''" Include="%20%20%20%20Adb: $(Adb)"/>
<ConfigurationSummary Include="%20%20%20%20NuGet: $(NuGet)"/>
<ConfigurationSummary Include="%20%20%20%20Node: $(Node)"/>
<ConfigurationSummary Include="%20%20%20%20Yarn: $(Yarn)"/>
<ConfigurationSummary Include="%20%20%20%20Npm: $(Npm)"/>
</ItemGroup>
<Message Importance="High" Text="%(ConfigurationSummary.Identity)"/>
<Message Importance="High" Text="Projects To Build ($(Configuration)):"/>
<Message Importance="High" Text=" %(ProjectsToBuild.Filename)"/>
</Target>
<Target
Name="GenerateSolution"
BeforeTargets="Restore;Build"
Inputs="
$(MSBuildThisFileFullPath);
$(GlobalConfigurationPropsFile);
$(SolutionBasePath)SolutionGlobalSections"
Outputs="$(SolutionFile)">
<Message Importance="High" Text="Generating $(SolutionFileRelative)..."/>
<GenerateSolution
ProjectsRelativeToPath="$(MSBuildThisFile)"
Projects="@(ProjectsToBuild)"
SolutionConfiguration="$(Configuration)"
GlobalSectionsFiles="$(SolutionBasePath)SolutionGlobalSections"
OutputFile="$(SolutionFile)"/>
</Target>
<!-- Utility Targets -->
<Target Name="Clean">
<FindDirectories
BasePath="$(TopDirectory)"
Recurse="false"
SearchPattern="_*">
<Output
TaskParameter="Directories"
ItemName="DirectoriesToRemove"/>
</FindDirectories>
<FindDirectories
BasePath="$(TopDirectory)"
IncludeNames="obj;bin"
ExcludeNames="node_modules;Xamarin.Build">
<Output
TaskParameter="Directories"
ItemName="DirectoriesToRemove"/>
</FindDirectories>
<RemoveDir Directories="@(DirectoriesToRemove)"/>
</Target>
<Target
Name="UpdatePublicApiDefinitions"
DependsOnTargets="@(ProfileTargets)">
<PropertyGroup>
<ApiConfiguration>Release</ApiConfiguration>
</PropertyGroup>
<ItemGroup>
<PublicApiProjectsToBuild
Include="@(ProjectsToBuild)"
Condition="'%(ProjectsToBuild.HasPublicApi)' != ''"/>
</ItemGroup>
<MakeDir Directories="docs"/>
<MSBuild
Projects="Tools\ApiDump\ApiDump.csproj;@(PublicApiProjectsToBuild)"
Properties="Configuration=$(ApiConfiguration)"
Targets="Restore;Build"/>
<ItemGroup>
<PublicApiAssembly Include="%(PublicApiProjectsToBuild.RelativeDir)bin\$(ApiConfiguration)\*\%(Filename).dll">
<ApiFile>docs\%(Filename).api.cs</ApiFile>
</PublicApiAssembly>
</ItemGroup>
<Exec Command="Tools\ApiDump\ApiDump.exe %(PublicApiAssembly.FullPath) -o %(PublicApiAssembly.ApiFile)"/>
</Target>
<Target
Name="TestDesktop"
Condition="!$(IsDotNetCoreMSBuild) And $(SkipDesktopTests) == ''"
AfterTargets="Test">
<PropertyGroup>
<TestDriver Condition="$(IsMac)">Clients\Xamarin.Interactive.Client.Mac\bin\$(Configuration)\Xamarin Workbooks.app\Contents\MacOS\Xamarin Workbooks</TestDriver>
<TestDriver Condition="$(IsWindows)">Clients\Xamarin.Interactive.Client.Windows\bin\$(Configuration)\Workbooks\Xamarin Workbooks.exe</TestDriver>
<TestAssembly>Tests\Xamarin.Interactive.Tests\bin\$(Configuration)\net461\Xamarin.Interactive.Tests.dll</TestAssembly>
<TestCommand Condition="'$(TestToRun)' != ''">-test:$(TestToRun)</TestCommand>
</PropertyGroup>
<Error
Condition="!Exists($(TestDriver))"
Text="Desktop test driver does not exist: $(TestDriver)"/>
<Error
Condition="!Exists($(TestAssembly))"
Text="Desktop test assembly does not exist: $(TestAssembly)"/>
<Exec Command=""$(TestDriver)" cli test $(TestAssembly) "-result:$(TopDirectory)Tests/Regressions.$(Configuration).xml" $(TestCommand)"/>
</Target>
<Target
Name="TestInspectorInjector"
Condition="$(IsMac)">
<Exec Command="Tests/Xamarin.Interactive.Tests.InspectorSupport.Mac/bin/$(Configuration)/Xamarin.Interactive.Tests.InspectorSupport.Mac.app/Contents/MacOS/Xamarin.Interactive.Tests.InspectorSupport.Mac"/>
</Target>
<Target
Name="ArchiveSymbolFiles"
BeforeTargets="Package">
<PropertyGroup>
<SymbolFilesArchive>$(ArtifactsBasePath)XamarinInteractive-$(ReleaseVersion_SemVer).$(RuntimeIdentifierPlatformBase).symbols.zip</SymbolFilesArchive>
</PropertyGroup>
<ItemGroup>
<SymbolFilesToArchive Include="Agents\**\bin\$(Configuration)\**\*.pdb" />
<SymbolFilesToArchive Include="Clients\**\bin\$(Configuration)\**\*.pdb" />
<SymbolFilesToArchive Include="WorkbookApps\**\bin\$(Configuration)\*.pdb" />
</ItemGroup>
<MakeDir Directories="$([System.IO.Path]::GetDirectoryName($(SymbolFilesArchive)))"/>
<Message Text="Archiving symbol files to "$(SymbolFilesArchive)"."/>
<ZipArchive
SourceFiles="@(SymbolFilesToArchive)"
DestinationArchiveFileName="$(SymbolFilesArchive)"/>
</Target>
<Target
Name="GenerateReleaseNotes"
AfterTargets="Package"
Inputs="$(TopDirectory)UPDATES.md"
Outputs="$(ArtifactsBasePath)updater-release-notes-$(ReleaseVersion_SemVer).html">
<CommonMarkToHtml
CommonMarkFile="$(TopDirectory)UPDATES.md"
HtmlTemplateFile="$(TopDirectory)Package\release-notes-template.html"
HtmlOutputFile="$(ArtifactsBasePath)updater-release-notes-$(ReleaseVersion_SemVer).html" />
</Target>
<Target
Name="UpdatePublicApiDocs"
DependsOnTargets="UpdatePublicApiDefinitions">
<Exec Command="mdoc update --delete Agents\Xamarin.Interactive\bin\Release\netstandard2.0\Xamarin.Interactive.dll -out Agents\Xamarin.Interactive\API\en -r /Library/Frameworks/Mono.framework/Versions/Current/lib/mono/4.5/Facades/netstandard.dll"/>
</Target>
<Target
Name="AssemblePublicApiDocs">
<Exec Command="mdoc assemble -o Agents\Xamarin.Interactive\API\interactive-api Agents\Xamarin.Interactive\API\en"/>
</Target>
</Project>