-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.proj
More file actions
557 lines (481 loc) · 28.3 KB
/
build.proj
File metadata and controls
557 lines (481 loc) · 28.3 KB
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
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" DefaultTargets="BuildAllConfigurations" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="src/Directory.Build.props" />
<Import Project="$(ToolsDir)targets\GenerateMdsPackage.targets" />
<Import Project="$(ToolsDir)targets\add-ons\GenerateAkvPackage.targets" />
<Import Project="$(ToolsDir)targets\CompareMdsRefAssemblies.targets" />
<PropertyGroup>
<!-- SourceLink variable-->
<DisableSourceLink>false</DisableSourceLink>
<Configuration Condition="'$(Configuration)' == ''">Debug</Configuration>
<Platform Condition="'$(Platform)' == ''">AnyCPU</Platform>
<!-- Flag to control whether or not to build Microsoft.DotNet.GenAPI project in tools -->
<BuildTools Condition="'$(BuildTools)' == ''">true</BuildTools>
<!-- Flag to control if Windows drivers should be built or not -->
<IsEnabledWindows Condition="'$(IsEnabledWindows)' == '' AND '$(TargetsWindows)' == 'true'">true</IsEnabledWindows>
<IsEnabledWindows Condition="'$(TargetsUnix)' == 'true'">false</IsEnabledWindows>
<TestOS Condition="'$(TestTargetOS)' == '' AND '$(TargetsWindows)' == 'true'">Windows</TestOS>
<TestOS Condition="'$(TestTargetOS)' == '' AND '$(TargetsUnix)' == 'true'">Unix</TestOS>
<TF Condition="$(TF) == ''">net9.0</TF> <!-- Default Target Framework -->
<TFGroup Condition="'$([MSBuild]::GetTargetFrameworkIdentifier($(TF)))' == '.NETFramework'">netfx</TFGroup>
<TFGroup Condition="'$([MSBuild]::GetTargetFrameworkIdentifier($(TF)))' == '.NETCoreApp'">netcore</TFGroup>
<TargetGroup Condition="'$(TFGroup)' == 'netfx'">netfx</TargetGroup>
<TargetGroup Condition="'$(TFGroup)' == 'netcore'">netcoreapp</TargetGroup>
<TargetNetCoreVersion Condition="$(TargetGroup) == 'netcoreapp' AND $(TargetNetCoreVersion) == ''">$(TF)</TargetNetCoreVersion>
<TargetNetFxVersion Condition="$(TargetGroup) == 'netfx' AND $(TargetNetFxVersion) == ''">$(TF)</TargetNetFxVersion>
<GenerateNuget Condition="'$(GenerateNuget)' == '' AND '$(IsEnabledWindows)' == 'true'">true</GenerateNuget>
<CommonProperties>Configuration=$(Configuration);ReferenceType=$(ReferenceType);</CommonProperties>
<ProjectProperties>$(CommonProperties);AssemblyFileVersion=$(AssemblyFileVersion);TargetsWindows=$(TargetsWindows);TargetsUnix=$(TargetsUnix);</ProjectProperties>
<TestProjectProperties>$(ProjectProperties);BuildForRelease=false;TargetNetCoreVersion=$(TargetNetCoreVersion);TargetNetFxVersion=$(TargetNetFxVersion)</TestProjectProperties>
<ResultsDirectory Condition="$(ResultsDirectory) == ''">TestResults</ResultsDirectory>
<!--
Path to a `dotnet` version like a x86 or any especific versions in addition to a default installed version.
This property is empty by default to use the default path of the system's path variable.
The provided path should be ended to a `\` character without white spaces: Ex. C:\x86\
-->
<DotnetPath></DotnetPath>
<!-- Using these properties to compile and pack netfx dll fixes nuget package explorer error "Compiler flags: missing" -->
<NugetPackProperties>DebugType=portable;DebugSymbols=true;IncludeSymbols=true;SymbolPackageFormat=snupkg;PublishRepositoryUrl=true;RepositoryUrl=https://github.com/dotnet/sqlclient;RepositoryType=git;EmbedUnTrackedSources=true;Deterministic=true;</NugetPackProperties>
<!-- TF_BUILD is enabled only within AzureDevOps pipeline to support continuous integation build. -->
<NugetPackProperties Condition="'$(TF_BUILD)' == 'true'">$(NugetPackProperties);ContinuousIntegrationBuild=true;</NugetPackProperties>
</PropertyGroup>
<!-- Test configuration properties -->
<PropertyGroup>
<!-- Set up default filters for tests to exclude failing and flaky tests -->
<Filter Condition="'$(Filter)' == ''">category!=failing&category!=flaky&category!=interactive</Filter>
<FilterArgument>--filter "$(Filter)"</FilterArgument>
<!-- Collect code coverage unless explicitly disabled -->
<CollectCodeCoverage Condition="'$(CollectCodeCoverage)' == ''">true</CollectCodeCoverage>
<CodeCoverageRunSettings>$(TestsPath)/tools/Microsoft.Data.SqlClient.TestUtilities/CodeCoverage.runsettings</CodeCoverageRunSettings>
<CollectArgument Condition="'$(CollectCodeCoverage)' == 'true'">--collect "Code coverage" --settings "$(CodeCoverageRunSettings)"</CollectArgument>
<!-- Set up tests to fail after hangs and report via blame -->
<BlameArgument>$(Blame)</BlameArgument>
<BlameArgument Condition="'$(BlameArgument)' == ''">
--blame-hang
--blame-hang-dump-type full
--blame-hang-timeout 10m
</BlameArgument>
</PropertyGroup>
<!-- Release Build properties must be turned on for Release purposes, and turned off for Code Coverage calculations -->
<PropertyGroup>
<BuildForRelease Condition="$(BuildForRelease) == ''">true</BuildForRelease>
<CI>ContinuousIntegrationBuild=$(BuildForRelease);EmbedUntrackedSources=$(BuildForRelease)</CI>
</PropertyGroup>
<!-- Populate all managed projects -->
<ItemGroup>
<Tools Include="tools/GenAPI/Microsoft.DotNet.GenAPI/Microsoft.DotNet.GenAPI.csproj" />
<SqlServer Include="**/Microsoft.SqlServer.Server.csproj" />
<Abstractions Include="src/Microsoft.Data.SqlClient.Extensions/Abstractions/src/Abstractions.csproj" />
<Azure Include="src/Microsoft.Data.SqlClient.Extensions/Azure/src/Azure.csproj" />
<Logging Include="src/Microsoft.Data.SqlClient.Extensions/Logging/src/Logging.csproj" />
<NetFxDriver Include="**/netfx/**/Microsoft.Data.SqlClient*.csproj" Condition="'$(IsEnabledWindows)' == 'true'" />
<NetCoreDriver Include="**/netcore/**/Microsoft.Data.SqlClient*.csproj" />
<!-- Used to build .NET Standard DLL for lib folder from this project. -->
<NetStandardDriver Include="**/netcore/ref/Microsoft.Data.SqlClient*.csproj" />
<AKVProvider Include="**/add-ons/**/AzureKeyVaultProvider/*.csproj" />
<UnitTests Include="**/UnitTests/Microsoft.Data.SqlClient.UnitTests.csproj" />
<UnitTestsProj Include="**/UnitTests/Microsoft.Data.SqlClient.UnitTests.csproj" />
<FunctionalTests Include="**/FunctionalTests/Microsoft.Data.SqlClient.FunctionalTests.csproj" />
<FunctionalTestsProj Include="**/FunctionalTests/Microsoft.Data.SqlClient.FunctionalTests.csproj" />
<ManualTests Include="**/ManualTests/Microsoft.Data.SqlClient.ManualTests.csproj" />
<ManualTestsProj Include="**/ManualTests/Microsoft.Data.SqlClient.ManualTests.csproj" />
</ItemGroup>
<!-- Top Level Build targets -->
<Target Name="Restore" DependsOnTargets="RestoreNetCore;RestoreNetFx" />
<Target Name="BuildSqlClient" DependsOnTargets="BuildSqlServer;BuildLogging;BuildAbstractions;BuildNetFx;BuildNetCore;BuildNetStandard" />
<!-- TODO: This doesn't really build everything; just the SqlClient driver and its NuGet package. -->
<Target Name="BuildAllConfigurations" DependsOnTargets="Restore;BuildTools;BuildSqlServer;BuildLogging;BuildAbstractions;BuildNetFx;BuildNetCoreAllOS;BuildNetStandard;GenerateMdsPackage" />
<!-- SqlServer Targets -->
<PropertyGroup>
<SqlServerProperties>$(CommonProperties)</SqlServerProperties>
<SqlServerProperties
Condition="'$(SqlServerPackageVersion)' != ''">
$(SqlServerProperties);SqlServerPackageVersion=$(SqlServerPackageVersion)
</SqlServerProperties>
<SqlServerProperties
Condition="'$(SqlServerAssemblyFileVersion)' != ''">
$(SqlServerProperties);SqlServerAssemblyFileVersion=$(SqlServerAssemblyFileVersion)
</SqlServerProperties>
</PropertyGroup>
<Target Name="RestoreSqlServer">
<MSBuild Projects="@(SqlServer)" Targets="restore" Properties="$(SqlServerProperties)" />
</Target>
<Target Name="BuildSqlServer" DependsOnTargets="RestoreSqlServer">
<MSBuild
Projects="@(SqlServer)"
Targets="Build"
Properties="$(CI);$(SqlServerProperties)" />
</Target>
<Target Name="PackSqlServer">
<MSBuild
Projects="@(SqlServer)"
Targets="Pack"
Properties="$(SqlServerProperties);NoBuild=true" />
</Target>
<!-- Abstractions Targets -->
<PropertyGroup>
<AbstractionsProperties>$(CommonProperties)</AbstractionsProperties>
<!--
If the AbstractionsPackageVersion property was supplied on the
command-line, then pass it along to the Abstractions build. Otherwise,
omit it entirely to avoid it expanding as empty here and thus overriding
the default behaviour in the Abstractions project. Command-line
properties take precedence over project defaults, even if their value is
empty. For example:
dotnet build -p:AbstractionsPackageVersion=
That results in $(AbstractionsPackageVersion) being defined as empty,
and cannot be overridden by the project.
-->
<AbstractionsProperties
Condition="'$(AbstractionsPackageVersion)' != ''">
$(AbstractionsProperties);AbstractionsPackageVersion=$(AbstractionsPackageVersion)
</AbstractionsProperties>
<!-- Do the same for the AbstractionsAssemblyFileVersion property. -->
<AbstractionsProperties
Condition="'$(AbstractionsAssemblyFileVersion)' != ''">
$(AbstractionsProperties);AbstractionsAssemblyFileVersion=$(AbstractionsAssemblyFileVersion)
</AbstractionsProperties>
</PropertyGroup>
<Target Name="RestoreAbstractions" DependsOnTargets="RestoreLogging">
<MSBuild
Projects="@(Abstractions)"
Targets="Restore"
Properties="$(AbstractionsProperties)" />
</Target>
<Target Name="BuildAbstractions" DependsOnTargets="RestoreAbstractions;BuildLogging">
<MSBuild
Projects="@(Abstractions)"
Targets="Build"
Properties="$(CI);$(AbstractionsProperties)" />
</Target>
<Target Name="PackAbstractions">
<MSBuild
Projects="@(Abstractions)"
Targets="Pack"
Properties="$(AbstractionsProperties);NoBuild=true" />
</Target>
<!-- Logging Targets -->
<PropertyGroup>
<LoggingProperties>$(CommonProperties)</LoggingProperties>
<!--
If the LoggingPackageVersion property was supplied on the command-line,
then pass it along to the Logging build. Otherwise, omit it entirely
to avoid it expanding as empty here and thus overriding the default
behaviour in the Logging project.
-->
<LoggingProperties
Condition="'$(LoggingPackageVersion)' != ''">
$(LoggingProperties);LoggingPackageVersion=$(LoggingPackageVersion)
</LoggingProperties>
<!-- Do the same for the LoggingAssemblyFileVersion property. -->
<LoggingProperties
Condition="'$(LoggingAssemblyFileVersion)' != ''">
$(LoggingProperties);LoggingAssemblyFileVersion=$(LoggingAssemblyFileVersion)
</LoggingProperties>
</PropertyGroup>
<Target Name="RestoreLogging">
<MSBuild
Projects="@(Logging)"
Targets="Restore"
Properties="$(LoggingProperties)" />
</Target>
<Target Name="BuildLogging" DependsOnTargets="RestoreLogging">
<MSBuild
Projects="@(Logging)"
Targets="Build"
Properties="$(CI);$(LoggingProperties)" />
</Target>
<Target Name="PackLogging">
<MSBuild
Projects="@(Logging)"
Targets="Pack"
Properties="$(LoggingProperties);NoBuild=true" />
</Target>
<!-- Azure Targets -->
<PropertyGroup>
<AzureProperties>$(CommonProperties)</AzureProperties>
<!--
If the AzurePackageVersion property was supplied on the command-line, then
pass it along to the Azure build. Otherwise, omit it entirely to avoid it
expanding as empty here and thus overriding the default behaviour in the
Azure project. Command-line properties take precedence over project
defaults, even if their value is empty. For example:
dotnet build -p:AzurePackageVersion=
That results in $(AzurePackageVersion) being defined as empty, and cannot
be overridden by the project.
-->
<AzureProperties
Condition="'$(AzurePackageVersion)' != ''">
$(AzureProperties);AzurePackageVersion=$(AzurePackageVersion)
</AzureProperties>
<!-- Do the same for the AzureAssemblyFileVersion property. -->
<AzureProperties
Condition="'$(AzureAssemblyFileVersion)' != ''">
$(AzureProperties);AzureAssemblyFileVersion=$(AzureAssemblyFileVersion)
</AzureProperties>
</PropertyGroup>
<Target Name="RestoreAzure">
<MSBuild
Projects="@(Azure)"
Targets="Restore"
Properties="$(AzureProperties)" />
</Target>
<Target Name="BuildAzure" DependsOnTargets="RestoreAzure">
<MSBuild
Projects="@(Azure)"
Targets="Build"
Properties="$(CI);$(AzureProperties)" />
</Target>
<Target Name="PackAzure">
<MSBuild
Projects="@(Azure)"
Targets="Pack"
Properties="$(AzureProperties);NoBuild=true" />
</Target>
<!-- Other Targets -->
<Target Name="RestoreNetCore" DependsOnTargets="RestoreSqlServer;RestoreAbstractions;RestoreLogging">
<MSBuild Projects="@(NetCoreDriver)" Targets="restore" Properties="$(ProjectProperties)" />
</Target>
<Target Name="RestoreNetFx" DependsOnTargets="RestoreSqlServer;RestoreAbstractions;RestoreLogging" Condition="'$(IsEnabledWindows)' == 'true'">
<MSBuild Projects="@(NetFxDriver)" Targets="restore" Properties="$(ProjectProperties)" />
</Target>
<Target Name="RestoreTools" Condition="'$(BuildTools)' == 'true'">
<MSBuild Projects="@(Tools)" Targets="restore" Properties="$(CommonProperties)" />
</Target>
<Target Name="BuildTools" DependsOnTargets="RestoreTools" Condition="'$(BuildTools)' == 'true'">
<MSBuild Projects="@(Tools)" Properties="$(CommonProperties)" />
</Target>
<Target Name="BuildNetFx" DependsOnTargets="RestoreNetFx;BuildSqlServer;BuildAbstractions;BuildLogging" Condition="'$(IsEnabledWindows)' == 'true'">
<MSBuild Projects="@(NetFxDriver)" Properties="$(CI);Platform=AnyCPU;$(ProjectProperties);$(NugetPackProperties);" />
</Target>
<Target Name="BuildNetCore" DependsOnTargets="RestoreNetCore;BuildSqlServer;BuildAbstractions;BuildLogging">
<MSBuild Projects="@(NetCoreDriver)" Properties="$(CI);Platform=AnyCPU;$(ProjectProperties)" />
</Target>
<Target Name="BuildNetCoreAllOS" DependsOnTargets="RestoreNetCore;BuildSqlServer;BuildAbstractions;BuildLogging">
<MSBuild Projects="@(NetCoreDriver)" Properties="$(CI);$(ProjectProperties);Platform=AnyCPU;OSGroup=Unix;" RemoveProperties="TargetsWindows;TargetsUnix;" />
<MSBuild Projects="@(NetCoreDriver)" Properties="$(CI);$(ProjectProperties);Platform=AnyCPU;OSGroup=Windows_NT;" RemoveProperties="TargetsWindows;TargetsUnix;" Condition="'$(IsEnabledWindows)' == 'true'" />
<MSBuild Projects="@(NetCoreDriver)" Properties="$(CI);$(ProjectProperties);Platform=AnyCPU;OSGroup=AnyOS;" RemoveProperties="TargetsWindows;TargetsUnix;" />
</Target>
<Target Name="BuildNetCoreUnix" DependsOnTargets="RestoreNetCore">
<MSBuild Projects="@(NetCoreDriver)" Properties="$(CI);$(ProjectProperties);Platform=AnyCPU;OSGroup=Unix;" RemoveProperties="TargetsWindows;TargetsUnix;" />
</Target>
<!-- Build .NET Standard target DLLs for Lib folder from here.
This target enables BuildForLib for the NetCore ref project. -->
<Target Name="BuildNetStandard">
<MSBuild Projects="@(NetStandardDriver)" Properties="$(CI);$(ProjectProperties);Platform=AnyCPU;OSGroup=AnyOS;BuildForLib=True" RemoveProperties="TargetsWindows;TargetsUnix;" />
</Target>
<!-- Tests -->
<!-- Run all tests applicable to the host OS. -->
<Target Name="RunTests" DependsOnTargets="RunUnitTests;RunFunctionalTests;RunManualTests"/>
<!-- Run all unit tests applicable to the host OS. -->
<Target Name="RunUnitTests" DependsOnTargets="RunUnitTestsWindows;RunUnitTestsUnix" Condition="$(ReferenceType.Contains('Project'))"/>
<!-- Run all unit tests applicable to Windows. -->
<Target Name="RunUnitTestsWindows" Condition="'$(IsEnabledWindows)' == 'true' AND $(ReferenceType.Contains('Project'))">
<PropertyGroup>
<!--
The UnitTests project exclusively uses Project references, which is the default applied by
src/Directory.Build.props, so no need to specify the ReferenceType property here.
-->
<TestCommand>
$(DotnetPath)dotnet test "@(UnitTestsProj)"
-f $(TF)
-p:Configuration=$(Configuration)
$(FilterArgument)
$(BlameArgument)
$(CollectArgument)
--results-directory $(ResultsDirectory)
--logger:"trx;LogFilePrefix=Unit-Windows$(TargetGroup)-$(TestSet)"
</TestCommand>
<!-- Convert more than one whitespace character into one space -->
<TestCommand>$([System.Text.RegularExpressions.Regex]::Replace($(TestCommand), "\s+", " "))</TestCommand>
</PropertyGroup>
<Message Text=">>> Running unit tests for Windows via command: $(TestCommand)"/>
<Exec ConsoleToMsBuild="true" Command="$(TestCommand)"/>
</Target>
<!-- Run all unit tests applicable to Unix. -->
<Target Name="RunUnitTestsUnix" Condition="'$(IsEnabledWindows)' != 'true' AND $(ReferenceType.Contains('Project'))">
<PropertyGroup>
<TestCommand>
$(DotnetPath)dotnet test "@(UnitTestsProj)"
-f $(TF)
-p:Configuration=$(Configuration)
$(FilterArgument)
$(BlameArgument)
$(CollectArgument)
--results-directory $(ResultsDirectory)
--logger:"trx;LogFilePrefix=Unit-Unixnetcoreapp-$(TestSet)"
</TestCommand>
<!-- Convert more than one whitespace character into one space -->
<TestCommand>$([System.Text.RegularExpressions.Regex]::Replace($(TestCommand), "\s+", " "))</TestCommand>
</PropertyGroup>
<Message Text=">>> Running unit tests for Unix via command: $(TestCommand)"/>
<Exec ConsoleToMsBuild="true" Command="$(TestCommand)"/>
</Target>
<!-- Run all Functional tests applicable to the host OS. -->
<Target Name="RunFunctionalTests" DependsOnTargets="RunFunctionalTestsWindows;RunFunctionalTestsUnix" />
<!-- Run all Functional tests applicable to Windows. -->
<Target Name="RunFunctionalTestsWindows" Condition="'$(IsEnabledWindows)' == 'true'">
<PropertyGroup>
<TestCommand>
$(DotnetPath)dotnet test "@(FunctionalTestsProj)"
-f $(TF)
-p:Configuration=$(Configuration)
-p:ReferenceType=$(ReferenceType)
-p:AbstractionsPackageVersion=$(AbstractionsPackageVersion)
-p:MdsPackageVersion=$(MdsPackageVersion)
$(FilterArgument)
$(BlameArgument)
$(CollectArgument)
--results-directory $(ResultsDirectory)
--logger:"trx;LogFilePrefix=Functional-Windows$(TargetGroup)-$(TestSet)"
</TestCommand>
<!-- Convert more than one whitespace character into one space -->
<TestCommand>$([System.Text.RegularExpressions.Regex]::Replace($(TestCommand), "\s+", " "))</TestCommand>
</PropertyGroup>
<Message Text=">>> Running Functional test for Windows via command: $(TestCommand)" />
<Exec ConsoleToMsBuild="true" Command="$(TestCommand)" />
</Target>
<!-- Run all Functional tests applicable to Unix. -->
<Target Name="RunFunctionalTestsUnix" Condition="'$(IsEnabledWindows)' != 'true'">
<PropertyGroup>
<TestCommand>
$(DotnetPath)dotnet test "@(FunctionalTestsProj)"
-f $(TF)
-p:Configuration=$(Configuration)
-p:ReferenceType=$(ReferenceType)
-p:AbstractionsPackageVersion=$(AbstractionsPackageVersion)
-p:MdsPackageVersion=$(MdsPackageVersion)
$(FilterArgument)
$(BlameArgument)
$(CollectArgument)
--results-directory $(ResultsDirectory)
--logger:"trx;LogFilePrefix=Functional-Unixnetcoreapp-$(TestSet)"
</TestCommand>
<!-- Convert more than one whitespace character into one space -->
<TestCommand>$([System.Text.RegularExpressions.Regex]::Replace($(TestCommand), "\s+", " "))</TestCommand>
</PropertyGroup>
<Message Text=">>> Running Functional test for Unix via command: $(TestCommand)" />
<Exec ConsoleToMsBuild="true" Command="$(TestCommand)" />
</Target>
<!-- Run all Manual tests applicable to the host OS. -->
<Target Name="RunManualTests" DependsOnTargets="RunManualTestsWindows;RunManualTestsUnix" />
<!-- Run all Manual tests applicable to Windows. -->
<Target Name="RunManualTestsWindows" Condition="'$(IsEnabledWindows)' == 'true'">
<PropertyGroup>
<TestCommand>
$(DotnetPath)dotnet test "@(ManualTestsProj)"
-f $(TF)
-p:Configuration=$(Configuration)
-p:ReferenceType=$(ReferenceType)
-p:AbstractionsPackageVersion=$(AbstractionsPackageVersion)
-p:MdsPackageVersion=$(MdsPackageVersion)
$(FilterArgument)
$(BlameArgument)
$(CollectArgument)
--results-directory $(ResultsDirectory)
--logger:"trx;LogFilePrefix=Manual-Windows$(TargetGroup)-$(TestSet)"
</TestCommand>
<!-- Add test set only if it was provided - otherwise it will be permanently set to '' -->
<TestCommand Condition="'$(TestSet)' != ''">
$(TestCommand)
-p:TestSet=$(TestSet)
</TestCommand>
<!-- Convert more than one whitespace character into one space -->
<TestCommand>$([System.Text.RegularExpressions.Regex]::Replace($(TestCommand), "\s+", " "))</TestCommand>
</PropertyGroup>
<Message Text=">>> Running Manual test for Windows via command: $(TestCommand)" />
<Exec ConsoleToMsBuild="true" Command="$(TestCommand)" />
</Target>
<!-- Run all Manual tests applicable to Unix. -->
<Target Name="RunManualTestsUnix" Condition="'$(IsEnabledWindows)' != 'true'">
<PropertyGroup>
<TestCommand>
$(DotnetPath)dotnet test "@(ManualTestsProj)"
-f $(TF)
-p:Configuration=$(Configuration)
-p:ReferenceType=$(ReferenceType)
-p:AbstractionsPackageVersion=$(AbstractionsPackageVersion)
-p:MdsPackageVersion=$(MdsPackageVersion)
$(FilterArgument)
$(BlameArgument)
$(CollectArgument)
--results-directory $(ResultsDirectory)
--logger:"trx;LogFilePrefix=Manual-Unixnetcoreapp-$(TestSet)"
</TestCommand>
<!-- Add test set only if it was provided - otherwise it will be permanently set to '' -->
<TestCommand Condition="'$(TestSet)' != ''">
$(TestCommand)
-p:TestSet=$(TestSet)
</TestCommand>
<!-- Convert more than one whitespace character into one space -->
<TestCommand>$([System.Text.RegularExpressions.Regex]::Replace($(TestCommand), "\s+", " "))</TestCommand>
</PropertyGroup>
<Message Text=">>> Running Manual test for Unix via command: $(TestCommand)" />
<Exec ConsoleToMsBuild="true" Command="$(TestCommand)" />
</Target>
<!-- Clean all build outputs. -->
<Target Name="Clean">
<RemoveDir Directories='$([System.IO.Directory]::GetDirectories(".", "artifacts", SearchOption.AllDirectories))' />
<RemoveDir Directories='$([System.IO.Directory]::GetDirectories(".", "bin", SearchOption.AllDirectories))' />
<RemoveDir Directories='$([System.IO.Directory]::GetDirectories(".", ".nuget", SearchOption.AllDirectories))' />
<RemoveDir Directories='$([System.IO.Directory]::GetDirectories(".", "obj", SearchOption.AllDirectories))' />
<!-- Remove generated .nupkg and .snupkg files from packages/ and output/. -->
<ItemGroup>
<PackagesToDelete Include="$(RepoRoot)/packages/*.nupkg" />
<PackagesToDelete Include="$(RepoRoot)/packages/*.snupkg" />
<PackagesToDelete Include="$(RepoRoot)/output/*.nupkg" />
<PackagesToDelete Include="$(RepoRoot)/output/*.snupkg" />
</ItemGroup>
<Delete Files="@(PackagesToDelete)" />
</Target>
<!-- AKV Targets ========================================================= -->
<Target Name="BuildAkv">
<!-- @TODO: TestTargetOS for restore poisons the project.assets.json file... We should remove it. -->
<!-- @TODO: TestTargetOS makes this far more complicated than it needs to be. We should remove it. -->
<!-- @TODO: RemoveProperties shouldn't be necessary -->
<Message Text=">>> Restoring AKV project" />
<MSBuild Projects="@(AKVProvider)" Targets="Restore" Properties="$(CommonProperties)" />
<PropertyGroup>
<BuildAkvProperties>$(CI);TestTargetOS=$(TestOS)netfx;Platform=AnyCPU;$(ProjectProperties);$(NugetPackProperties)</BuildAkvProperties>
</PropertyGroup>
<Message Text=">>> Building AKV project for netfx [$(BuildAkvProperties)]" />
<MSBuild Projects="@(AKVProvider)" Properties="$(BuildAkvProperties);" />
<PropertyGroup>
<BuildAkvProperties>$(CI);TestTargetOS=$(TestOS)netcoreapp;$(ProjectProperties);Platform=AnyCPU;OSGroup=Unix;</BuildAkvProperties>
</PropertyGroup>
<Message Text=">>> Building AKV project for netcore/unix [$(BuildAkvProperties)]" />
<MSBuild Projects="@(AKVProvider)" Properties="$(BuildAkvProperties)" RemoveProperties="TargetsWindows;TargetsUnix;" />
<PropertyGroup>
<BuildAkvProperties>$(CI);TestTargetOS=$(TestOS)netcoreapp;$(ProjectProperties);Platform=AnyCPU;OSGroup=Windows_NT</BuildAkvProperties>
</PropertyGroup>
<Message Text=">>> Building AKV project for netcore/windows [$(BuildAkvProperties)]" />
<MSBuild Projects="@(AKVProvider)" Properties="$(BuildAkvProperties);" RemoveProperties="TargetsWindows;TargetsUnix;" />
<PropertyGroup>
<BuildAkvProperties>$(CI);TestTargetOS=$(TestOS)netcoreapp;$(ProjectProperties);Platform=AnyCPU;OSGroup=AnyOS;</BuildAkvProperties>
</PropertyGroup>
<Message Text=">>> Building AKV project for netcore/anyos [$(BuildAkvProperties)]" />
<MSBuild Projects="@(AKVProvider)" Properties="$(BuildAkvProperties)" RemoveProperties="TargetsWindows;TargetsUnix;" />
</Target>
<Target Name="BuildAKVNetFx" DependsOnTargets="BuildNetFx" Condition="'$(IsEnabledWindows)' == 'true'">
<MSBuild Projects="@(AKVProvider)" Targets="restore" Properties="$(CommonProperties);TestTargetOS=$(TestOS)netfx" />
<Message Text=">>> Building AKVNetFx [$(CI);TestTargetOS=$(TestOS)netfx;Platform=AnyCPU;$(TestProjectProperties)] ..." Condition="!$(ReferenceType.Contains('Package'))" />
<MSBuild Projects="@(AKVProvider)" Properties="$(CI);TestTargetOS=$(TestOS)netfx;Platform=AnyCPU;$(TestProjectProperties);$(NugetPackProperties);" Condition="!$(ReferenceType.Contains('Package'))" />
<!-- Only build platform specific builds for Package reference types -->
<Message Text=">>> Building AKVNetFx [$(CI);TestTargetOS=$(TestOS)netfx;Platform=$(Platform);$(TestProjectProperties)] ..." Condition="$(ReferenceType.Contains('Package'))" />
<MSBuild Projects="@(AKVProvider)" Properties="$(CI);TestTargetOS=$(TestOS)netfx;Platform=$(Platform);$(TestProjectProperties);$(NugetPackProperties);" Condition="$(ReferenceType.Contains('Package'))" />
</Target>
<Target Name="BuildAKVNetCore" DependsOnTargets="BuildNetCore">
<MSBuild Projects="@(AKVProvider)" Targets="restore" Properties="$(CommonProperties);TestTargetOS=$(TestOS)netcoreapp" />
<Message Text=">>> Building AKVNetCore [$(CI);TestTargetOS=$(TestOS)netcoreapp;$(ProjectProperties);Platform=AnyCPU;ReferenceType=$(ReferenceType);] ..." Condition="!$(ReferenceType.Contains('Package'))" />
<MSBuild Projects="@(AKVProvider)" Properties="$(CI);TestTargetOS=$(TestOS)netcoreapp;$(ProjectProperties);Platform=AnyCPU;" Condition="!$(ReferenceType.Contains('Package'))" />
<!-- Only build platform specific builds for Package reference types -->
<Message Text=">>> Building AKVNetCore [$(CI);TestTargetOS=$(TestOS)netcoreapp;$(ProjectProperties);Platform=$(Platform);ReferenceType=$(ReferenceType);] ..." Condition="$(ReferenceType.Contains('Package'))" />
<MSBuild Projects="@(AKVProvider)" Properties="$(CI);TestTargetOS=$(TestOS)netcoreapp;$(ProjectProperties);Platform=$(Platform);" Condition="$(ReferenceType.Contains('Package'))" />
</Target>
<Target Name="BuildAKVNetCoreAllOS" DependsOnTargets="BuildNetCore">
<MSBuild Projects="@(AKVProvider)" Targets="restore" Properties="$(CommonProperties);TestTargetOS=$(TestOS)netcoreapp" />
<MSBuild Projects="@(AKVProvider)" Properties="$(CI);TestTargetOS=$(TestOS)netcoreapp;$(ProjectProperties);Platform=AnyCPU;OSGroup=Unix;" RemoveProperties="TargetsWindows;TargetsUnix;" />
<MSBuild Projects="@(AKVProvider)" Properties="$(CI);TestTargetOS=$(TestOS)netcoreapp;$(ProjectProperties);Platform=AnyCPU;OSGroup=Windows_NT;" RemoveProperties="TargetsWindows;TargetsUnix;" Condition="'$(IsEnabledWindows)' == 'true'" />
<MSBuild Projects="@(AKVProvider)" Properties="$(CI);TestTargetOS=$(TestOS)netcoreapp;$(ProjectProperties);Platform=AnyCPU;OSGroup=AnyOS;" RemoveProperties="TargetsWindows;TargetsUnix;" />
</Target>
</Project>