-
Notifications
You must be signed in to change notification settings - Fork 4.5k
/
Directory.Build.targets
627 lines (536 loc) · 34.2 KB
/
Directory.Build.targets
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
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!--
Common files don't take part in the root src\tests\Directory.Build.targets
This file prevents them from including it as it gets included in its place
If they ever need to take part, we can conditionally include them as documented
here https://docs.microsoft.com/en-us/visualstudio/msbuild/customize-your-build#directorybuildprops-and-directorybuildtargets
-->
<Import Project="$(MSBuildThisFileDirectory)/Common/disableversioncheck.targets"
Condition="'$(DisableVersionCheckImported)' != 'true'" />
<PropertyGroup Condition="'$(TargetsAppleMobile)' == 'true' and '$(RuntimeFlavor)' == 'mono'">
<OSPlatformConfig>$(TargetOS).AnyCPU.$(Configuration)</OSPlatformConfig>
<TestArchiveRoot>$(ArtifactsDir)helix/</TestArchiveRoot>
<TestArchiveTestsRoot>$(TestArchiveRoot)tests/</TestArchiveTestsRoot>
<TestArchiveTestsDir>$(TestArchiveTestsRoot)$(OSPlatformConfig)/</TestArchiveTestsDir>
<TestArchiveRuntimeRoot>$(TestArchiveRoot)runtime/</TestArchiveRuntimeRoot>
<PublishTestAsSelfContainedDependsOn>BuildMonoiOSApp</PublishTestAsSelfContainedDependsOn>
<PublishTestAsSelfContainedAfterTargets>BuildMonoiOSApp</PublishTestAsSelfContainedAfterTargets>
<BundleTestAppleAppDependsOn>GenerateRunScript</BundleTestAppleAppDependsOn>
<IsRuntimeTests>true</IsRuntimeTests>
</PropertyGroup>
<Import Project="$(RepositoryEngineeringDir)testing\tests.targets"
Condition="'$(TargetsAppleMobile)' == 'true' and '$(RuntimeFlavor)' == 'mono'" />
<Target Name="_SetRunScriptOutputDirectory" Condition="'$(TargetsAppleMobile)' == 'true' and '$(RuntimeFlavor)' == 'mono' and '$(IsRuntimeTests)' == 'true'" BeforeTargets="GenerateRunScript">
<PropertyGroup>
<RunScriptOutputDirectory>$(ArtifactsDir)/tests/coreclr/obj/$(TargetOS).$(Platform).$(Configuration)/Managed/build/iOSApps/$(TestProjectName)/AppBundle</RunScriptOutputDirectory>
</PropertyGroup>
</Target>
<!-- Default priority building values. -->
<PropertyGroup>
<DisableProjectBuild Condition="'$(IsMergedTestRunnerAssembly)' == 'true' and $(BuildAsStandalone)">true</DisableProjectBuild>
<OutputType Condition="('$(IsMergedTestRunnerAssembly)' == 'true' and !$(BuildAsStandalone)) or '$(RequiresProcessIsolation)' == 'true'">Exe</OutputType>
<CLRTestKind Condition="'$(CLRTestKind)' == '' and '$(OutputType)' == 'Exe'">BuildAndRun</CLRTestKind>
<CLRTestKind Condition="'$(CLRTestKind)' == ''">BuildOnly</CLRTestKind>
<CLRTestPriority Condition="'$(CLRTestPriority)' == ''">0</CLRTestPriority>
<!-- Merged test runner assemblies might not have any non-generated sources, and that's okay -->
<NoWarn Condition="'$(IsMergedTestRunnerAssembly)' == 'true'">$(NoWarn);CS2008</NoWarn>
</PropertyGroup>
<!-- All CLRTests need to be of a certain "kind". These kinds are enumerated below.
By default all tests are BuildAndRun. This means that the build system will Build them
and construct a run-batch-script for them. -->
<Choose>
<When Condition=" '$(CLRTestKind)'=='SharedLibrary'">
<PropertyGroup>
<_CLRTestCompilesSource>true</_CLRTestCompilesSource>
<_CLRTestNeedsToRun>false</_CLRTestNeedsToRun>
<GenerateRunScript>false</GenerateRunScript>
<_CLRTestBuildsExecutable>false</_CLRTestBuildsExecutable>
</PropertyGroup>
</When>
<When Condition=" '$(CLRTestKind)'=='BuildAndRun' ">
<PropertyGroup>
<GenerateRunScript>true</GenerateRunScript>
<_CLRTestNeedsToRun>true</_CLRTestNeedsToRun>
<_CLRTestCompilesSource>true</_CLRTestCompilesSource>
<_CLRTestBuildsExecutable>true</_CLRTestBuildsExecutable>
</PropertyGroup>
</When>
<When Condition=" '$(CLRTestKind)'=='BuildOnly'">
<PropertyGroup>
<_CLRTestNeedsToRun>false</_CLRTestNeedsToRun>
<GenerateRunScript>false</GenerateRunScript>
<_CLRTestCompilesSource>true</_CLRTestCompilesSource>
<_CLRTestBuildsExecutable>true</_CLRTestBuildsExecutable>
</PropertyGroup>
</When>
<When Condition=" '$(CLRTestKind)'=='RunOnly' ">
<PropertyGroup>
<GenerateRunScript>true</GenerateRunScript>
<SkipSigning>true</SkipSigning>
<_CLRTestBuildsExecutable>false</_CLRTestBuildsExecutable>
<_CLRTestNeedsToRun>true</_CLRTestNeedsToRun>
<_CLRTestCompilesSource>false</_CLRTestCompilesSource>
</PropertyGroup>
</When>
</Choose>
<PropertyGroup>
<_CLRTestNeedsProjectToRun>false</_CLRTestNeedsProjectToRun>
<_CLRTestNeedsProjectToRun Condition=" '$(_CLRTestNeedsToRun)' and '!$(_CLRTestBuildsExecutable)' ">true</_CLRTestNeedsProjectToRun>
</PropertyGroup>
<PropertyGroup>
<!-- Since bug in Roslyn for Linux empty DebugType property leads to build failure. See issue Roslyn@20343 -->
<DebugType Condition=" '$(DebugType)' == '' and '$(RunningOnUnix)' == 'true' ">None</DebugType>
<TestLibraryProjectPath>$(RepoRoot)\src\tests\Common\CoreCLRTestLibrary\CoreCLRTestLibrary.csproj</TestLibraryProjectPath>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="$(TestLibraryProjectPath)" Condition="'$(IsMergedTestRunnerAssembly)' == 'true'" />
</ItemGroup>
<!--
If it needs ProjectToRun, turn the project into a ProjectReference so it gets built
-->
<ItemGroup Condition=" $(_CLRTestNeedsProjectToRun) ">
<ProjectReference Include="$(CLRTestProjectToRun)">
<Private>false</Private>
</ProjectReference>
</ItemGroup>
<PropertyGroup Condition="'$(RequiresCodeFlowEnforcement)' == 'true'">
<CLRTestTargetUnsupported Condition="'$(UseCodeFlowEnforcement)' != 'true'">true</CLRTestTargetUnsupported>
</PropertyGroup>
<!-- Determine if this project should be built or not -->
<PropertyGroup>
<BuildAllProjects Condition="'$(BuildAllProjects)' == ''">false</BuildAllProjects>
<_WillCLRTestProjectBuild Condition="'$(_WillCLRTestProjectBuild)' == ''">false</_WillCLRTestProjectBuild>
<_WillCLRTestProjectBuild Condition="'$(BuildAllProjects)' != 'true'">true</_WillCLRTestProjectBuild>
<_WillCLRTestProjectBuild Condition="'$(BuildAllProjects)' == 'true' And '$(CLRTestPriority)' <= '$(CLRTestPriorityToBuild)'">true</_WillCLRTestProjectBuild>
<_WillCLRTestProjectBuild Condition="'$(CLRTestBuildAllTargets)' != 'allTargets' And '$(CLRTestTargetUnsupported)' == 'true'">false</_WillCLRTestProjectBuild>
<_WillCLRTestProjectBuild Condition="'$(DisableProjectBuild)' == 'true'">false</_WillCLRTestProjectBuild>
<_WillCLRTestProjectBuild Condition="'$(NativeAotIncompatible)' == 'true' and '$(TestBuildMode)' == 'nativeaot'">false</_WillCLRTestProjectBuild>
<_WillCLRTestProjectBuild Condition="'$(RuntimeFlavor)' == 'mono' And '$(AlwaysUseCrossgen2)' == 'true'">false</_WillCLRTestProjectBuild>
<_WillCLRTestProjectBuild Condition="'$(EnableNativeSanitizers)' != '' And '$(AlwaysUseCrossgen2)' == 'true'">false</_WillCLRTestProjectBuild>
</PropertyGroup>
<PropertyGroup>
<_CopyNativeProjectBinaries Condition="'$(__CopyNativeTestBinaries)' != '1'">$(__CopyNativeProjectsAfterCombinedTestBuild)</_CopyNativeProjectBinaries>
<_CopyNativeProjectBinaries Condition="'$(_WillCLRTestProjectBuild)' != 'true'">false</_CopyNativeProjectBinaries>
<_CopyNativeProjectBinaries Condition="'$(_CopyNativeProjectBinaries)' == ''">true</_CopyNativeProjectBinaries>
</PropertyGroup>
<!-- We enable auto-unification of assembly references after importing the common targets. Binding redirects are not needed
for coreclr since it auto-unifies, so the warnings we get without this setting are just noise -->
<PropertyGroup>
<AutoUnifyAssemblyReferences>true</AutoUnifyAssemblyReferences>
</PropertyGroup>
<!-- Project language -->
<!-- TODO: This might just be the Language property -->
<PropertyGroup Condition="'$(ProjectLanguage)' == ''">
<ProjectLanguage Condition="'$(MSBuildProjectExtension)' == '.ilproj' OR '$(Language)' == 'IL'">IL</ProjectLanguage>
<ProjectLanguage Condition="'$(MSBuildProjectExtension)' == '.csproj' OR '$(Language)' == 'C#' OR '$(ProjectLanguage)'==''">CSharp</ProjectLanguage>
<SkipImportILTargets Condition="'$(CLRTestPriority)' > '$(CLRTestPriorityToBuild)'">true</SkipImportILTargets>
<SkipImportILTargets Condition="'$(CLRTestBuildAllTargets)' != '' And '$(CLRTestNeedTarget)' != '$(CLRTestBuildAllTargets)'">true</SkipImportILTargets>
</PropertyGroup>
<!-- If a test in a merged test directory (e.g., under JIT\Directed where Directed_1.csproj and siblings -->
<!-- represent the groups) has OutputType==Exe set, then it will end up being skipped because the merged -->
<!-- groups are supposed to cover all of the tests. The merged groups themselves should be Exes, as -->
<!-- should any test marked RequiresProcessIsolation or BuildAsStandalone. -->
<Target Name="CheckForTestOutsideOfGroup" BeforeTargets="Build">
<Error Condition="'$(InMergedTestDirectory)' == 'true'
and '$(OutputType)' == 'Exe'
and '$(RequiresProcessIsolation)' != 'true'
and '$(BuildAsStandalone)' != 'true'
and '$(IsMergedTestRunnerAssembly)' != 'true'"
Text="Tests in merged test directories should not set OutputType to Exe unless they are RequiresProcessIsolation, BuildAsStandalone, or IsMergedTestRunnerAssembly." />
</Target>
<Target Name="CopyNativeProjectBinaries" Condition="'$(_CopyNativeProjectBinaries)' == 'true'">
<ItemGroup Condition="'$(UseVisualStudioNativeBinariesLayout)' == 'true'">
<NativeProjectBinaries Include="$(NativeProjectOutputFolder)\*.*" />
</ItemGroup>
<ItemGroup Condition="'$(UseVisualStudioNativeBinariesLayout)' != 'true'">
<!-- ############################################################### -->
<!-- The following is required because the single configuration -->
<!-- generators, unlike multi-configuration generators, -->
<!-- do not place the binaries built into a separate -->
<!-- Debug/Checked/Release directory. Therefore we must filter -->
<!-- the folder to only include dynamic libraries, static libraries -->
<!-- and executables. -->
<!-- -->
<!-- Please take care when modifying the following lines of code. -->
<!-- ############################################################### -->
<!-- Include everything and then filter. -->
<NativeProjectBinariesMatched Include="$(NativeProjectOutputFolder)\**\*.*" />
<!-- Filter executables on unix -->
<NativeProjectBinariesExeFilter Condition="'%(Extension)' == ''" Include="@(NativeProjectBinariesMatched)" />
<!-- Filter executables on Windows -->
<NativeProjectBinariesExeFilter Condition="'%(Extension)' == '.exe'" Include="@(NativeProjectBinariesMatched)" />
<!-- Filter manifest/data files on Windows -->
<NativeProjectBinariesManifestFilter Condition="'%(Extension)' == '.manifest'" Include="@(NativeProjectBinariesMatched)" />
<NativeProjectBinariesManifestFilter Condition="'%(Extension)' == '.tlb'" Include="@(NativeProjectBinariesMatched)" />
<!-- Filter out the *Make* files -->
<NativeProjectBinariesExeFilterRemovedMakeFile Condition="'%(FileName)' != 'Makefile'" Include="@(NativeProjectBinariesExeFilter)" />
<!-- Filter .dylib files for OSX -->
<NativeProjectBinariesDyLibFilter Condition="'%(Extension)' == '.dylib'" Include="@(NativeProjectBinariesMatched)" />
<!-- Filter .so files for Linux -->
<NativeProjectBinariesDyLibFilter Condition="'%(Extension)' == '.so'" Include="@(NativeProjectBinariesMatched)" />
<!-- Filter static lib files for Unix -->
<NativeProjectBinariesStaticLibFilter Condition="'%(Extension)' == '.a'" Include="@(NativeProjectBinariesMatched)" />
<!-- Filter dynamic lib files for Windows -->
<NativeProjectBinariesDyLibFilter Condition="'%(Extension)' == '.dll'" Include="@(NativeProjectBinariesMatched)" />
<!-- Filter symbol files for Windows -->
<NativeProjectsBinariesSymbolsFilter Condition="'%(Extension)' == '.pdb'" Include="@(NativeProjectBinariesMatched)" />
<!-- Filter static lib files for Windows -->
<NativeProjectBinariesStaticLibFilter Condition="'%(Extension)' == '.lib'" Include="@(NativeProjectBinariesMatched)" />
<!-- Filter .dex and .jar files for Android -->
<NativeProjectBinariesJavaLibFilter Condition="'%(Extension)' == '.dex'" Include="@(NativeProjectBinariesMatched)" />
<NativeProjectBinariesJavaLibFilter Condition="'%(Extension)' == '.jar'" Include="@(NativeProjectBinariesMatched)" />
<!-- Merge the filtered lists -->
<NativeProjectBinaries Include="@(NativeProjectBinariesExeFilterRemovedMakeFile)" />
<NativeProjectBinaries Include="@(NativeProjectBinariesDyLibFilter)" />
<NativeProjectBinaries Include="@(NativeProjectBinariesStaticLibFilter)" />
<NativeProjectBinaries Include="@(NativeProjectsBinariesSymbolsFilter)" />
<NativeProjectBinaries Include="@(NativeProjectBinariesManifestFilter)" />
<NativeProjectBinaries Include="@(NativeProjectBinariesJavaLibFilter)" />
</ItemGroup>
<!-- There are currently no native project binaries on wasm or Android -->
<Error Text="The native project files are missing in $(NativeProjectOutputFolder) please run build from the root of the repo at least once"
Condition="'@(NativeProjectBinaries)' == '' And '$(TargetOS)' != 'browser' And '$(TargetsMobile)' != 'true'"/>
<Copy
SourceFiles="@(NativeProjectBinaries)"
DestinationFiles="@(NativeProjectBinaries -> '$(OutDir)%(Filename)%(Extension)')"
SkipUnchangedFiles="$(SkipCopyUnchangedFiles)"
OverwriteReadOnlyFiles="$(OverwriteReadOnlyFiles)"
Retries="$(CopyRetryCount)"
RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)"
UseHardlinksIfPossible="$(CreateHardLinksForCopyFilesToOutputDirectoryIfPossible)">
<Output TaskParameter="DestinationFiles" ItemName="FileWrites" />
</Copy>
</Target>
<Target Name="ResolveCMakeNativeProjectReference"
Condition="'@(CMakeProjectReference)' != ''"
BeforeTargets="ConsolidateNativeProjectReference;BeforeResolveReferences;BeforeClean" >
<ItemGroup>
<NativeProjectReference Include="%(CMakeProjectReference.Identity)" Condition="$([System.String]::Copy(%(CMakeProjectReference.FileName)).ToUpper()) == 'CMAKELISTS'" />
<NativeProjectReferenceNormalized Include="@(NativeProjectReference -> '%(FullPath)')" />
</ItemGroup>
</Target>
<Target Name="ConsolidateNativeProjectReference"
Condition="'$(_CopyNativeProjectBinaries)' == 'true'"
BeforeTargets="Build" >
<ItemGroup Condition="'@(NativeProjectReferenceNormalized)' != ''">
<NativeProjectOutputFoldersToCopy Include="$([System.String]::Copy('%(NativeProjectReferenceNormalized.RelativeDir)').Replace($(TestSourceDir),$(__NativeTestIntermediatesDir)\))" Condition="'$(UseVisualStudioNativeBinariesLayout)' != 'true'" />
<NativeProjectOutputFoldersToCopy Include="$([System.String]::Copy('%(NativeProjectReferenceNormalized.RelativeDir)').Replace($(TestSourceDir),$(__NativeTestIntermediatesDir)\))$(Configuration)\" Condition="'$(UseVisualStudioNativeBinariesLayout)' == 'true'" />
</ItemGroup>
<Message Text= "Full native project references are :%(NativeProjectReferenceNormalized.Identity)" />
<Message Text= "Native binaries will be copied from :%(NativeProjectOutputFoldersToCopy.Identity)" />
<MSBuild Projects="$(MSBuildProjectFile)" Targets="CopyNativeProjectBinaries" Properties="NativeProjectOutputFolder=%(NativeProjectOutputFoldersToCopy.Identity)" Condition="'@(NativeProjectReference)' != ''" />
<MSBuild Projects="@(ProjectReference)"
Targets="CopyAllNativeProjectReferenceBinaries"
Condition="'$(IsMergedTestRunnerAssembly)' == 'true'"
BuildInParallel="true" />
</Target>
<Target Name="CopyAllNativeProjectReferenceBinaries"
DependsOnTargets="ResolveCMakeNativeProjectReference;ConsolidateNativeProjectReference"
BeforeTargets="Build">
<ItemGroup Condition="'$(IsMergedTestRunnerAssembly)' == 'true'">
<OutOfProcessTestMarkers Include="$(OutDir)/../**/*.OutOfProcessTest" />
<OutOfProcessTestFolders Include="$([MSBuild]::NormalizePath('$([System.IO.Path]::GetDirectoryName('%(OutOfProcessTestMarkers.FullPath)'))'))" Condition="'@(OutOfProcessTestMarkers)' != ''" />
<MergedWrapperReferenceFolders Include="@(ProjectReference->'$([MSBuild]::NormalizePath('$([System.IO.Path]::GetFullPath('%(ProjectReference.Identity)/..', '$(OutDir)/..'))/%(ProjectReference.FileName)'))')" />
<!-- Don't copy out-of-process test components to the merged wrapper output folder -->
<MergedWrapperReferenceFolders Remove="@(OutOfProcessTestFolders)" />
<!-- For merged project wrappers, include native libraries in all project references -->
<MergedWrapperReferenceFiles Include="%(MergedWrapperReferenceFolders.Identity)/*$(LibSuffix)" Condition="'@(MergedWrapperReferenceFolders)' != ''" />
</ItemGroup>
<Copy SourceFiles="@(MergedWrapperReferenceFiles)"
DestinationFiles="@(MergedWrapperReferenceFiles->'$(OutDir)/%(FileName)%(Extension)')"
SkipUnchangedFiles="true"
Condition="'@(MergedWrapperReferenceFiles)' != ''"
/>
</Target>
<!-- Build shell or command scripts whenever we copy native binaries -->
<Import Project="$(MSBuildThisFileDirectory)Common\CLRTest.Execute.targets" />
<Target Name="CreateExecuteScript"
BeforeTargets="Build;CopyAllNativeProjectReferenceBinaries"
Condition="'$(CLRTestBuildAllTargets)' != 'allTargets' And '$(GenerateRunScript)' != 'false' And ('$(_WillCLRTestProjectBuild)' == 'true')"
DependsOnTargets="GenerateExecutionScriptsInternal" />
<Target Name="UpdateReferenceItems"
BeforeTargets="BeforeResolveReferences"
>
<MSBuild Projects="$(MSBuildProjectFullPath)"
Targets="GetLiveRefAssemblies">
<Output TaskParameter="TargetOutputs" ItemName="Reference" />
</MSBuild>
<ItemGroup>
<Reference Include="$(TargetingPackPath)/*.dll" >
<Private>false</Private>
</Reference>
</ItemGroup>
</Target>
<Target Name="GetLiveRefAssemblies" Returns="@(LibrariesRefAssembliesDlls)"
DependsOnTargets="ResolveLibrariesRefAssembliesFromLocalBuild">
<ItemGroup>
<LibrariesRefAssembliesDlls Include="@(LibrariesRefAssemblies)" Condition="'%(Extension)' == '.dll'" Private="false" />
</ItemGroup>
</Target>
<Target Name="ConvertCountOfStressMarkersToListPhase1" BeforeTargets="ConvertCountOfStressMarkersToListPhase1">
<PropertyGroup>
<SequenceOfSemicolons>$([System.String]::new(';',10))</SequenceOfSemicolons>
</PropertyGroup>
</Target>
<Target Name="GenerateMarkerFiles" BeforeTargets="AssignTargetPaths">
<PropertyGroup Condition="'$(NumberOfStripesToUseInStress)' == '' and '$(IsMergedTestRunnerAssembly)' == 'true'">
<NumberOfStripesToUseInStress>1</NumberOfStripesToUseInStress> <!-- Set a custom number of stripes in stress to allow very large merged groups to function in the presence of GCStress -->
</PropertyGroup>
<!-- Generate a set of stress marker files to be used in stress scenarios in CI runs -->
<ItemGroup Condition="'$(NumberOfStripesToUseInStress)' != '' and '$(IsMergedTestRunnerAssembly)' == 'true'">
<SequenceOfIntegers Include="0"/>
<SequenceOfIntegers Include="1"/>
<SequenceOfIntegers Include="2"/>
<SequenceOfIntegers Include="3"/>
<SequenceOfIntegers Include="4"/>
<SequenceOfIntegers Include="5"/>
<SequenceOfIntegers Include="6"/>
<SequenceOfIntegers Include="7"/>
<SequenceOfIntegers Include="8"/>
<SequenceOfIntegers Include="9"/>
<SequenceOfIntegers Include="10"/>
<SequenceOfIntegers Include="11"/>
<SequenceOfIntegers Include="12"/>
<SequenceOfIntegers Include="13"/>
<SequenceOfIntegers Include="14"/>
<SequenceOfIntegers Include="15"/>
<SequenceOfIntegers Include="16"/>
<SequenceOfIntegers Include="17"/>
<SequenceOfIntegers Include="18"/>
<SequenceOfIntegers Include="19"/>
<SequenceOfIntegers Include="20"/>
<SequenceOfIntegers Include="21"/>
<SequenceOfIntegers Include="22"/>
<SequenceOfIntegers Include="23"/>
<SequenceOfIntegers Include="24"/>
<SequenceOfIntegers Include="25"/>
<SequenceOfIntegers Include="26"/>
<SequenceOfIntegers Include="27"/>
<SequenceOfIntegers Include="28"/>
<SequenceOfIntegers Include="29"/>
<SequenceOfIntegers Include="20"/>
<SequenceOfIntegers Include="31"/>
<SequenceOfIntegers Include="32"/>
<SequenceOfIntegers Include="33"/>
<SequenceOfIntegers Include="34"/>
<SequenceOfIntegers Include="35"/>
<SequenceOfIntegers Include="36"/>
<SequenceOfIntegers Include="37"/>
<SequenceOfIntegers Include="38"/>
<SequenceOfIntegers Include="39"/>
<SequenceOfIntegers Include="40"/>
<SequenceOfIntegers Include="41"/>
<SequenceOfIntegers Include="42"/>
<SequenceOfIntegers Include="43"/>
<SequenceOfIntegers Include="44"/>
<SequenceOfIntegers Include="45"/>
<SequenceOfIntegers Include="46"/>
<SequenceOfIntegers Include="47"/>
<SequenceOfIntegers Include="48"/>
<SequenceOfIntegers Include="49"/>
<SequenceOfIntegers Include="50"/>
<SequenceOfIntegers Include="51"/>
<SequenceOfIntegers Include="52"/>
<SequenceOfIntegers Include="53"/>
<SequenceOfIntegers Include="54"/>
<SequenceOfIntegers Include="55"/>
<SequenceOfIntegers Include="56"/>
<SequenceOfIntegers Include="57"/>
<SequenceOfIntegers Include="58"/>
<SequenceOfIntegers Include="59"/>
<SequenceOfIntegers Include="60"/>
<SequenceOfIntegers Include="61"/>
<SequenceOfIntegers Include="62"/>
<SequenceOfIntegers Include="63"/>
<SequenceOfIntegers Include="64"/>
<SequenceOfIntegers Include="65"/>
<SequenceOfIntegers Include="66"/>
<SequenceOfIntegers Include="67"/>
<SequenceOfIntegers Include="68"/>
<SequenceOfIntegers Include="69"/>
<SequenceOfIntegers Include="70"/>
<SequenceOfIntegers Include="71"/>
<SequenceOfIntegers Include="72"/>
<SequenceOfIntegers Include="73"/>
<SequenceOfIntegers Include="74"/>
<SequenceOfIntegers Include="75"/>
<SequenceOfIntegers Include="76"/>
<SequenceOfIntegers Include="77"/>
<SequenceOfIntegers Include="78"/>
<SequenceOfIntegers Include="79"/>
<SequenceOfIntegers Include="80"/>
<SequenceOfIntegers Include="81"/>
<SequenceOfIntegers Include="82"/>
<SequenceOfIntegers Include="83"/>
<SequenceOfIntegers Include="84"/>
<SequenceOfIntegers Include="85"/>
<SequenceOfIntegers Include="86"/>
<SequenceOfIntegers Include="87"/>
<SequenceOfIntegers Include="88"/>
<SequenceOfIntegers Include="89"/>
<SequenceOfIntegers Include="90"/>
<SequenceOfIntegers Include="91"/>
<SequenceOfIntegers Include="92"/>
<SequenceOfIntegers Include="93"/>
<SequenceOfIntegers Include="94"/>
<SequenceOfIntegers Include="95"/>
<SequenceOfIntegers Include="96"/>
<SequenceOfIntegers Include="97"/>
<SequenceOfIntegers Include="98"/>
<SequenceOfIntegers Include="99"/>
<MarkerFileIntegerSequence Include="@(SequenceOfIntegers)" Condition="%(Identity)<$(NumberOfStripesToUseInStress)" />
<MarkerFile Include="@(MarkerFileIntegerSequence->'$(IntermediateOutputPath)\$(MSBuildProjectName).MergedTestAssembly.%(Identity).$(NumberOfStripesToUseInStress).MergedTestAssemblyForStress')">
<Type>MergedStressTestAssembly</Type>
</MarkerFile>
</ItemGroup>
<Error Condition="'$(NumberOfStripesToUseInStress)' != '' and $(NumberOfStripesToUseInStress)>99" Text="Attempt to split into too many stripes. Either reduce stripe count, or add more entries to SequenceOfIntegers" />
<ItemGroup>
<Content Include="$(AssemblyName).reflect.xml" Condition="Exists('$(AssemblyName).reflect.xml')" CopyToOutputDirectory="PreserveNewest" />
<MarkerFile Include="$(IntermediateOutputPath)\$(MSBuildProjectName).MergedTestAssembly" Condition="'$(IsMergedTestRunnerAssembly)' == 'true'">
<Type>MergedTestAssembly</Type>
</MarkerFile>
<MarkerFile Include="$(IntermediateOutputPath)\$(AssemblyName).NoMonoAot" Condition="'$(MonoAotIncompatible)' == 'true'">
<Type>NoMonoAot</Type>
</MarkerFile>
<Content Include="@(MarkerFile)" CopyToOutputDirectory="PreserveNewest" />
</ItemGroup>
<Copy SourceFiles="$(AssemblyName).reflect.xml"
DestinationFolder="$(OutputPath)"
Condition="Exists('$(AssemblyName).reflect.xml')"/>
<WriteLinesToFile
Condition="'@(MarkerFile)' != ''"
File="%(Identity)"
Lines="%(Type)"
Overwrite="true"
WriteOnlyWhenDifferent="true" />
<!-- We don't want the out-of-process test marker file to be included in referencing projects, so we don't include it as content. -->
<WriteLinesToFile
Condition="'$(RequiresProcessIsolation)' == 'true' and '$(BuildAsStandalone)' != 'true'"
File="$(OutputPath)\$(AssemblyName).OutOfProcessTest"
Lines="OutOfProcessTest"
Overwrite="true"
WriteOnlyWhenDifferent="true" />
</Target>
<PropertyGroup>
<ProjectAssetsFile>$(BaseOutputPath)\packages\Common\test_dependencies\test_dependencies\project.assets.json</ProjectAssetsFile>
</PropertyGroup>
<Import Project="$(BaseOutputPath)\packages\Common\test_dependencies\test_dependencies\test_dependencies.*.targets" />
<PropertyGroup>
<DisableImplicitFrameworkReferences>true</DisableImplicitFrameworkReferences>
</PropertyGroup>
<PropertyGroup>
<IncludeOOBLibraries>true</IncludeOOBLibraries>
</PropertyGroup>
<ItemGroup>
<KnownFrameworkReference Remove="Microsoft.AspNetCore.App" />
<KnownFrameworkReference Remove="Microsoft.WindowsDesktop.App" />
</ItemGroup>
<Target Name="GetProjectsWithDisabledBuild" Returns="@(ProjectWithDisabledBuild)">
<ItemGroup Condition="'$(_WillCLRTestProjectBuild)' != 'true'">
<ProjectWithDisabledBuild Include="$(MSBuildProjectFullPath)" />
</ItemGroup>
</Target>
<Target Name="GetRequiresProcessIsolation" Returns="@(ProjectRequiringProcessIsolation)">
<ItemGroup Condition="'$(RequiresProcessIsolation)' == 'true'">
<ProjectRequiringProcessIsolation Include="$(MSBuildProjectFullPath)" />
</ItemGroup>
</Target>
<Target Name="DiscoverProcessIsolatedTestProjectReferences" BeforeTargets="AssignProjectConfiguration" Condition="'$(IsMergedTestRunnerAssembly)' == 'true'">
<MSBuild Projects="@(ProjectReference)" Targets="GetRequiresProcessIsolation" SkipNonexistentTargets="true">
<Output TaskParameter="TargetOutputs" ItemName="ReferencedProjectRequiringProcessIsolation" />
</MSBuild>
<ItemGroup>
<ProjectReference Remove="@(ReferencedProjectRequiringProcessIsolation->'%(OriginalItemSpec)')" />
<ProjectReference Include="@(ReferencedProjectRequiringProcessIsolation->'%(OriginalItemSpec)')" OutputItemType="OutOfProcessTests" BuildReference="true" ReferenceOutputAssembly="false" />
</ItemGroup>
</Target>
<PropertyGroup Condition="'$(Language)' == 'C#' and ('$(BuildAsStandalone)' == 'true' or '$(RequiresProcessIsolation)' == 'true' or '$(InMergedTestDirectory)' == 'true' or '$(IsMergedTestRunnerAssembly)' == 'true')">
<ReferenceXUnitWrapperGenerator Condition="'$(ReferenceXUnitWrapperGenerator)' == ''">true</ReferenceXUnitWrapperGenerator>
</PropertyGroup>
<ItemGroup Condition="'$(ReferenceXUnitWrapperGenerator)' == 'true'">
<ProjectReference Include="$(RepoRoot)/src/tests/Common/XUnitWrapperGenerator/XUnitWrapperGenerator.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false" />
</ItemGroup>
<ItemGroup Condition="'$(IsMergedTestRunnerAssembly)' == 'true'">
<ProjectReference Include="$(RepoRoot)/src/tests/Common/XUnitWrapperLibrary/XUnitWrapperLibrary.csproj" />
</ItemGroup>
<Import Project="$(RepoRoot)/src/tests/Common/XUnitWrapperGenerator/XUnitWrapperGenerator.props" />
<Import Project="$(RepoRoot)eng/liveBuilds.targets" />
<Import Project="$(MSBuildProjectFullPath).targets" Condition="Exists('$(MSBuildProjectFullPath).targets')"/>
<Import Project="$(RepoRoot)/src/tests/Common/mergedrunner.targets" Condition="'$(IsMergedTestRunnerAssembly)' == 'true'" />
<Target Name="GetBinPlaceTargetFramework" />
<Import Project="$(RepoRoot)src\coreclr\clr.featuredefines.props" />
<!-- if we have determined that there is nothing to build, overwrite the build targets so that nothing happens -->
<Import Project="$(MSBuildThisFileDirectory)Common\nobuild.targets" Condition="'$(_WillCLRTestProjectBuild)' == 'false'" />
<!-- RunOnly projects have a special build for dependent projects -->
<Import Project="$(MSBuildThisFileDirectory)Common\runonly.targets" Condition="'$(CLRTestKind)' == 'RunOnly'" />
<PropertyGroup Condition="'$(TestBuildMode)' == 'nativeaot'">
<!-- NativeAOT compiled output is placed into a 'native' subdirectory: we need to tweak
rpath so that the test can load its native library dependencies if there's any -->
<IlcRPath Condition="'$(TargetOS)' == 'osx' or '$(TargetsAppleMobile)' == 'true'">@executable_path/..</IlcRPath>
<IlcRPath Condition="'$(IlcRPath)' == ''">$ORIGIN/..</IlcRPath>
<!-- Works around "Error: Native compilation can run on x64 and arm64 hosts only" -->
<DisableUnsupportedError>true</DisableUnsupportedError>
<!-- IL projects often have mismatches assembly names vs file names and that breaks Win32 resource generation option -->
<IlcGenerateWin32Resources Condition="'$(Language)' == 'IL'">false</IlcGenerateWin32Resources>
<!-- The default TrimMode in the SDK is full. But trimming most of the tests would just make them fail,
so the default for the test tree is partial. -->
<TrimMode Condition="'$(EnableAggressiveTrimming)' != 'true'">partial</TrimMode>
<IlcToolsPath>$(CoreCLRILCompilerDir)</IlcToolsPath>
<IlcToolsPath Condition="'$(TargetArchitecture)' != '$(BuildArchitecture)' or '$(TargetOS)' != '$(HostOS)' or '$(EnableNativeSanitizers)' != ''">$(CoreCLRCrossILCompilerDir)</IlcToolsPath>
<IlcBuildTasksPath>$(CoreCLRILCompilerDir)netstandard/ILCompiler.Build.Tasks.dll</IlcBuildTasksPath>
<IlcSdkPath>$(CoreCLRAotSdkDir)</IlcSdkPath>
<IlcFrameworkPath>$(MicrosoftNetCoreAppRuntimePackRidLibTfmDir)</IlcFrameworkPath>
<IlcFrameworkNativePath>$(MicrosoftNetCoreAppRuntimePackNativeDir)</IlcFrameworkNativePath>
<RuntimeIdentifier>$(OutputRID)</RuntimeIdentifier>
<SysRoot Condition="'$(CrossBuild)' == 'true' and '$(HostOS)' != 'windows'">$(ROOTFS_DIR)</SysRoot>
<BuildNativeAotFrameworkObjects Condition="'$(IlcMultiModule)' == 'true'">true</BuildNativeAotFrameworkObjects>
<DisableFrameworkLibGeneration Condition="'$(BuildNativeAotFrameworkObjects)' == 'true'">true</DisableFrameworkLibGeneration>
<FrameworkLibPath Condition="'$(BuildNativeAotFrameworkObjects)' == 'true'">$(IlcSdkPath)</FrameworkLibPath>
</PropertyGroup>
<ItemGroup Condition="'$(TestBuildMode)' == 'nativeaot'">
<CustomLinkerArg Condition="'$(CrossBuild)' == 'true' and '$(_hostArchitecture)' == '$(_targetArchitecture)' and '$(_hostOS)' != 'windows'" Include="--gcc-toolchain=$(ROOTFS_DIR)/usr" />
<IlcReference Include="$(TargetingPackPath)/*.dll" />
<!-- xunit calls MakeGenericType to check if something is IEquatable -->
<IlcArg Condition="'$(EagerlyValidateTypeConstruction)' != 'false'" Include="--feature:System.Reflection.IsTypeConstructionEagerlyValidated=false" />
<!-- Bump the generic cycle tolerance. There's at least one test with a cycle that is reachable at runtime to depth 6 -->
<IlcArg Include="--maxgenericcycle:7" />
<!-- We set TrimMode to partial so that we don't trim parts of the tests,
but don't make this apply to xunit cruft -->
<IlcArg Include="--trim:Microsoft.DotNet.XUnitExtensions" />
<IlcArg Include="--trim:xunit.abstractions" />
<IlcArg Include="--trim:xunit.assert" />
<IlcArg Include="--trim:xunit.console" />
<IlcArg Include="--trim:xunit.core" />
<IlcArg Include="--trim:xunit.execution.dotnet" />
<IlcArg Include="--trim:xunit.abstractions" />
</ItemGroup>
<Import Project="$(RepositoryEngineeringDir)nativeSanitizers.targets" Condition="'$(TestBuildMode)' == 'nativeaot'" />
<Import Project="$(CoreCLRBuildIntegrationDir)Microsoft.DotNet.ILCompiler.SingleEntry.targets" Condition="'$(TestBuildMode)' == 'nativeaot'" />
<ItemGroup Condition="'$(TestBuildMode)' == 'nativeaot'">
<Content Include="@(SanitizerRuntimeToCopy->'$(CoreCLRArtifactsPath)/%(Identity)')" CopyToOutputDirectory="PreserveNewest" />
</ItemGroup>
<Target Name="BuildNativeAot"
DependsOnTargets="Build;LinkNativeIfBuildAndRun" />
<Target Name="LinkNativeIfBuildAndRun"
Condition="'$(_WillCLRTestProjectBuild)' == 'true' and '$(CLRTestKind)' == 'BuildAndRun'"
DependsOnTargets="ComputeResolvedFilesToPublishList;LinkNative" />
<Target Name="LocateNativeCompiler"
Condition="'$(TestBuildMode)' == 'nativeaot' and '$(HostOS)' != 'windows'"
BeforeTargets="SetupOSSpecificProps">
<PropertyGroup>
<CppCompilerAndLinker Condition="'$(CppCompilerAndLinker)' == ''">clang</CppCompilerAndLinker>
</PropertyGroup>
<Exec Command="sh -c 'build_arch="$(TargetArchitecture)" compiler="$(CppCompilerAndLinker)" . "$(RepositoryEngineeringDir)/common/native/init-compiler.sh" && echo "$CC;$LDFLAGS"' 2>/dev/null"
EchoOff="true"
ConsoleToMsBuild="true"
StandardOutputImportance="Low">
<Output TaskParameter="ConsoleOutput" PropertyName="_CC_LDFLAGS" />
</Exec>
<PropertyGroup>
<CppLinker>$(_CC_LDFLAGS.SubString(0, $(_CC_LDFLAGS.IndexOf(';'))))</CppLinker>
<_LDFLAGS>$(_CC_LDFLAGS.SubString($([MSBuild]::Add($(_CC_LDFLAGS.IndexOf(';')), 1))))</_LDFLAGS>
<LinkerFlavor Condition="$(_LDFLAGS.Contains('lld'))">lld</LinkerFlavor>
</PropertyGroup>
</Target>
</Project>