-
Notifications
You must be signed in to change notification settings - Fork 447
/
Directory.Build.targets
785 lines (656 loc) · 41.9 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
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
<Project>
<Import Project="$([MSBuild]::GetPathOfFileAbove(Directory.Build.targets, $(MSBuildThisFileDirectory)..))" />
<PropertyGroup Condition="'$(UseInnerClone)' == 'true'">
<BuildArgs>$(BuildArgs) /p:UseInnerClone=true</BuildArgs>
<BuildArgs>$(BuildArgs) /p:CopySrcInsteadOfClone=true</BuildArgs>
<BuildArgs>$(BuildArgs) /p:CopyWipIntoInnerSourceBuildRepo=true</BuildArgs>
</PropertyGroup>
<PropertyGroup>
<!-- Force use of dotnet msbuild (ignoring global.json contents) unless BuildWithDesktopMSBuild is explicitly set in the repo project. -->
<BuildArgs Condition="'$(BuildOS)' == 'windows' and '$(BuildWithDesktopMSBuild)' != 'true'">$(BuildArgs) $(FlagParameterPrefix)msbuildEngine dotnet</BuildArgs>
</PropertyGroup>
<PropertyGroup>
<BuildCommand Condition="'$(BuildCommand)' == '' and '$(IsUtilityProject)' != 'true'">$(BuildScript) $(BuildActions) $(BuildArgs)</BuildCommand>
<!-- MinimalConsoleLogOutput determines if the repository build should be logged to a separate file or directly to the console. -->
<RepoConsoleLogFile>$(ArtifactsLogDir)$(RepositoryName).log</RepoConsoleLogFile>
<MinimalConsoleLogOutput Condition="'$(MinimalConsoleLogOutput)' == '' and '$(ContinuousIntegrationBuild)' == 'true'">true</MinimalConsoleLogOutput>
<PackageReportDataFile>$(PackageReportDir)prebuilt-usage.xml</PackageReportDataFile>
<ProjectAssetsJsonArchiveFile>$(PackageReportDir)all-project-assets-json-files.zip</ProjectAssetsJsonArchiveFile>
<ProdConManifestFile>$(PackageReportDir)prodcon-build.xml</ProdConManifestFile>
<RepoManifestFile>$([MSBuild]::NormalizePath('$(ProjectDirectory)', 'artifacts', 'RepoManifest.xml'))</RepoManifestFile>
<IntermediateSymbolsRepoDir>$(IntermediateSymbolsRootDir)$(RepositoryName)</IntermediateSymbolsRepoDir>
</PropertyGroup>
<UsingTask AssemblyFile="$(XPlatSourceBuildTasksAssembly)" TaskName="AddSourceToNuGetConfig" />
<UsingTask AssemblyFile="$(XPlatSourceBuildTasksAssembly)" TaskName="RemoveInternetSourcesFromNuGetConfig" />
<UsingTask AssemblyFile="$(XPlatSourceBuildTasksAssembly)" TaskName="UpdateJson" />
<UsingTask AssemblyFile="$(XPlatSourceBuildTasksAssembly)" TaskName="UpdateNuGetConfigPackageSourcesMappings" />
<UsingTask AssemblyFile="$(XPlatSourceBuildTasksAssembly)" TaskName="ValidateUsageAgainstBaseline" />
<UsingTask AssemblyFile="$(XPlatSourceBuildTasksAssembly)" TaskName="WritePackageVersionsProps" />
<UsingTask AssemblyFile="$(XPlatSourceBuildTasksAssembly)" TaskName="WritePackageUsageData" />
<UsingTask AssemblyFile="$(XPlatSourceBuildTasksAssembly)" TaskName="WriteUsageReports" />
<!-- Wraps the transitive repo references with additional metadata -->
<Target Name="GetRepositoryReferenceInfo"
DependsOnTargets="GetTransitiveRepositoryReferences">
<!-- SBRP is explicitly excluded since it is output to its own special directory, $(ReferencePackagesDir). -->
<ItemGroup Condition="'@(TransitiveRepositoryReference)' != ''">
<RepositoryReferenceInfo Include="@(TransitiveRepositoryReference)"
Exclude="source-build-reference-packages">
<ShippingSourceName>source-built-%(Identity)</ShippingSourceName>
<NonShippingSourceName>source-built-transport-%(Identity)</NonShippingSourceName>
<ShippingPackagesPath>$(ArtifactsShippingPackagesDir)/%(Identity)/</ShippingPackagesPath>
<NonShippingPackagesPath>$(ArtifactsNonShippingPackagesDir)/%(Identity)/</NonShippingPackagesPath>
</RepositoryReferenceInfo>
</ItemGroup>
<ItemGroup Condition="'@(RepositoryReferenceInfo)' != ''">
<DependentRepoSourceName Include="@(RepositoryReferenceInfo->'%(ShippingSourceName)')" />
<DependentRepoSourceName Include="@(RepositoryReferenceInfo->'%(NonShippingSourceName)')" />
<DependentRepoPackageFile Include="%(RepositoryReferenceInfo.ShippingPackagesPath)**" />
<DependentRepoPackageFile Include="%(RepositoryReferenceInfo.NonShippingPackagesPath)**" />
</ItemGroup>
</Target>
<Target Name="CopyNuGetConfig"
Condition="'$(NuGetConfigFile)' != ''"
Inputs="$(MSBuildProjectFullPath);$(OriginalNuGetConfigFile)"
Outputs="$(NuGetConfigFile)">
<MakeDir Directories="$([System.IO.Path]::GetDirectoryName('$(NuGetConfigFile)'))" />
<Copy
SourceFiles="$(OriginalNuGetConfigFile)"
DestinationFiles="$(NuGetConfigFile)">
<Output TaskParameter="CopiedFiles" ItemName="FileWrites" />
</Copy>
</Target>
<Target Name="UpdateNuGetConfig"
DependsOnTargets="CopyNuGetConfig;GetRepositoryReferenceInfo"
Condition="'$(NuGetConfigFile)' != ''"
Inputs="$(MSBuildProjectFullPath)"
Outputs="$(BaseIntermediateOutputPath)UpdateNuGetConfig.complete">
<PropertyGroup>
<!-- Dev innerloop opt-in feed: /p:ExtraRestoreSourcePath=... -->
<ExtraSourcesNuGetSourceName>ExtraSources</ExtraSourcesNuGetSourceName>
</PropertyGroup>
<PropertyGroup Condition="'$(DotNetBuildSourceOnly)' == 'true'">
<PrebuiltNuGetSourceName>prebuilt</PrebuiltNuGetSourceName>
<PreviouslySourceBuiltNuGetSourceName>previously-source-built</PreviouslySourceBuiltNuGetSourceName>
<ReferencePackagesNuGetSourceName>reference-packages</ReferencePackagesNuGetSourceName>
</PropertyGroup>
<ItemGroup>
<_CommonBuildSources Include="@(DependentRepoSourceName)" />
<_CommonBuildSources Include="$(ExtraSourcesNuGetSourceName)" Condition="'$(ExtraRestoreSourcePath)' != ''" />
</ItemGroup>
<ItemGroup>
<_BuildSources Condition="'$(DotNetBuildSourceOnly)' == 'true'"
Include="$(PrebuiltNuGetSourceName);$(PreviouslySourceBuiltNuGetSourceName);$(ReferencePackagesNuGetSourceName)" />
<_BuildSources Include="@(_CommonBuildSources)" />
</ItemGroup>
<PropertyGroup Condition="'$(DotNetBuildSourceOnly)' != 'true'">
<!-- When not building source-only, repositories lagging behind on the .NET SDK (e.g. tooling repos)
that need to utilize a VS-aligned version for development purposes may not have the latest product
daily build feed in their NuGet.config. This means that when a newer globally-specified .NET SDK
attempts to restore shared framework packages, they will not be found. Work around this by
ensuring that repos have the supporting SDK feed. Note that this is not required when the SDK
in use is a released SDK.
Currently we are using a preview .NET 9 SDK and not all repos are using the Net 9 SDK
If either of these are not true, set below to false.
-->
<AddNetSdkSupportingFeed>true</AddNetSdkSupportingFeed>
<NetSdkSupportingFeedName>net-sdk-supporting-feed</NetSdkSupportingFeedName>
<NetSdkSupportingFeed>https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet9/nuget/v3/index.json</NetSdkSupportingFeed>
</PropertyGroup>
<RemoveInternetSourcesFromNuGetConfig
NuGetConfigFile="$(NuGetConfigFile)"
BuildWithOnlineFeeds="$(DotNetBuildWithOnlineFeeds)"
KeepFeedPrefixes="@(KeepFeedPrefixes)"
Condition="'$(DotNetBuildSourceOnly)' == 'true'" />
<AddSourceToNuGetConfig NuGetConfigFile="$(NuGetConfigFile)"
SourceName="$(PrebuiltNuGetSourceName)"
SourcePath="$(PrebuiltPackagesPath)"
Condition="'$(DotNetBuildSourceOnly)' == 'true'" />
<AddSourceToNuGetConfig NuGetConfigFile="$(NuGetConfigFile)"
SourceName="$(PreviouslySourceBuiltNuGetSourceName)"
SourcePath="$(PrebuiltSourceBuiltPackagesPath)"
Condition="'$(DotNetBuildSourceOnly)' == 'true'" />
<AddSourceToNuGetConfig NuGetConfigFile="$(NuGetConfigFile)"
SourceName="$(ReferencePackagesNuGetSourceName)"
SourcePath="$(ReferencePackagesDir)"
Condition="'$(DotNetBuildSourceOnly)' == 'true'" />
<AddSourceToNuGetConfig NuGetConfigFile="$(NuGetConfigFile)"
SourceName="%(RepositoryReferenceInfo.ShippingSourceName)"
SourcePath="%(RepositoryReferenceInfo.ShippingPackagesPath)"
Condition="Exists('%(RepositoryReferenceInfo.ShippingPackagesPath)')" />
<AddSourceToNuGetConfig NuGetConfigFile="$(NuGetConfigFile)"
SourceName="%(RepositoryReferenceInfo.NonShippingSourceName)"
SourcePath="%(RepositoryReferenceInfo.NonShippingPackagesPath)"
Condition="Exists('%(RepositoryReferenceInfo.NonShippingPackagesPath)')" />
<AddSourceToNuGetConfig NuGetConfigFile="$(NuGetConfigFile)"
SourceName="$(ExtraSourcesNuGetSourceName)"
SourcePath="$(ExtraRestoreSourcePath)"
Condition="'$(ExtraRestoreSourcePath)' != ''" />
<!-- See root Directory.Build.props for value. -->
<AddSourceToNuGetConfig NuGetConfigFile="$(NuGetConfigFile)"
SourceName="$(NetSdkSupportingFeedName)"
SourcePath="$(NetSdkSupportingFeed)"
Condition="'$(AddNetSdkSupportingFeed)' == 'true'" />
<UpdateNuGetConfigPackageSourcesMappings
NuGetConfigFile="$(NuGetConfigFile)"
BuildWithOnlineFeeds="$(DotNetBuildWithOnlineFeeds)"
SourceBuildSources="@(_BuildSources)" />
<MakeDir Directories="$(BaseIntermediateOutputPath)" />
<Touch Files="$(BaseIntermediateOutputPath)UpdateNuGetConfig.complete" AlwaysCreate="true">
<Output TaskParameter="TouchedFiles" ItemName="FileWrites" />
</Touch>
<ItemGroup>
<!-- This is defined in this target to ensure the NuGet.config file is updated before it gets embedded. If this item
was define globally, it would immediately get embedded with the original, unmodified version of the file. -->
<EmbedInBinlog Include="$(NuGetConfigFile)" />
</ItemGroup>
</Target>
<!-- Update the SDK version in the repo's global.json file.
This guarantees that all repositories build with the VMR's SDK version. -->
<Target Name="UpdateGlobalJsonVersions"
Condition="'$(GlobalJsonFile)' != ''"
Inputs="$(MSBuildProjectFullPath);$(MSBuildThisFileFullPath)"
Outputs="$(BaseIntermediateOutputPath)UpdateGlobalJsonVersions.complete">
<ItemGroup>
<_PossibleCliVersionJsonPath Include="sdk:version" />
<_PossibleCliVersionJsonPath Include="tools:dotnet" />
</ItemGroup>
<UpdateJson JsonFilePath="$(GlobalJsonFile)"
PathToAttribute="%(_PossibleCliVersionJsonPath.Identity)"
NewAttributeValue="$(NETCoreSdkVersion)"
SkipUpdateIfMissingKey="true" />
<!-- VB PoC, remove the global runtimes until https://github.com/dotnet/arcade/issues/14283 is resolved. -->
<UpdateJson JsonFilePath="$(GlobalJsonFile)"
PathToAttribute="tools:runtimes"
SkipUpdateIfMissingKey="true" />
<MakeDir Directories="$(BaseIntermediateOutputPath)" />
<Touch Files="$(BaseIntermediateOutputPath)UpdateGlobalJsonVersions.complete" AlwaysCreate="true">
<Output TaskParameter="TouchedFiles" ItemName="FileWrites" />
</Touch>
</Target>
<!-- TODO: Remove when all repos use a consistent set of eng/common files: https://github.com/dotnet/source-build/issues/3710. -->
<Target Name="UpdateEngCommonFiles"
Condition="'$(UpdateEngCommonFiles)' == 'true' or '$(DotNetBuildSourceOnly)' != 'true'">
<ItemGroup>
<OrchestratorEngCommonFile Include="$(RepositoryEngineeringDir)common\**\*" />
</ItemGroup>
<Copy SourceFiles="@(OrchestratorEngCommonFile)"
DestinationFolder="$(ProjectDirectory)eng\common\%(RecursiveDir)"
SkipUnchangedFiles="true" />
</Target>
<!-- Before a repository builds, set up the version property files that override the repo's defaults.
There are 3 files generated -->
<Target Name="CreateBuildInputProps"
DependsOnTargets="GetRepositoryReferenceInfo"
Inputs="$(MSBuildProjectFullPath)"
Outputs="$(BaseIntermediateOutputPath)CreateBuildInputProps.complete">
<ItemGroup>
<!-- Collect all the NuGet packages from dependent repos except for the symbols -->
<_CurrentSourceBuiltPackages Include="@(DependentRepoPackageFile)"
Condition="!$([System.String]::Copy('%(Identity)').EndsWith('.symbols.nupkg'))" />
<_PreviouslyBuiltSourceBuiltPackages Include="$(PrebuiltSourceBuiltPackagesPath)*.nupkg" />
</ItemGroup>
<Error Condition="'$(PackageVersionPropsFlowType)' != 'AllPackages' and '$(PackageVersionPropsFlowType)' != 'DependenciesOnly'"
Text="Invalid PackageVersionPropsFlowType '$(PackageVersionPropsFlowType)'. Must be 'AllPackages' or 'DependenciesOnly'." />
<PropertyGroup>
<_VersionDetailsXml Condition="'$(PackageVersionPropsFlowType)' == 'DependenciesOnly'">$(ProjectDirectory)/eng/Version.Details.xml</_VersionDetailsXml>
</PropertyGroup>
<!-- Write the build input properties, then save off a copy that will be used for generating usage reports later -->
<WritePackageVersionsProps NuGetPackages="@(_CurrentSourceBuiltPackages)"
ExtraProperties="@(ExtraPackageVersionPropsPackageInfo)"
VersionPropsFlowType="$(PackageVersionPropsFlowType)"
VersionDetails="$(_VersionDetailsXml)"
OutputPath="$(CurrentSourceBuiltPackageVersionPropsPath)" />
<!-- Create previously source-built inputs info -->
<WritePackageVersionsProps NuGetPackages="@(_PreviouslyBuiltSourceBuiltPackages)"
VersionPropsFlowType="$(PackageVersionPropsFlowType)"
VersionDetails="$(_VersionDetailsXml)"
OutputPath="$(PreviouslySourceBuiltPackageVersionPropsPath)" />
<!-- Write a full package version props (unfiltered) that will be used to track which repo creates a package.
Because not all repos implement the repo API (e.g. some are external), it's difficult to consistently gather
a list of packages from the output of each repo. This may be an area for improvement later.
Instead, we rely on the package version props file that is built up
before each build. If the full list of packages grows by package A, B and C between repo Y and Z, then Y produced
A B and C.
A key element of this algorith is that we must write the full package version props and not the filtered version. -->
<WritePackageVersionsProps NuGetPackages="@(_CurrentSourceBuiltPackages)"
VersionPropsFlowType="AllPackages"
OutputPath="$(SnapshotPackageVersionPropsPath)" />
<!-- Write a single file that contains imports for both the current and previously built packages -->
<PropertyGroup>
<PackageVersionsPropsContents>
<![CDATA[
<Project>
<Import Project="$(PreviouslySourceBuiltPackageVersionPropsPath)" />
<Import Project="$(CurrentSourceBuiltPackageVersionPropsPath)" />
</Project>
]]>
</PackageVersionsPropsContents>
</PropertyGroup>
<WriteLinesToFile File="$(PackageVersionPropsPath)"
Lines="$(PackageVersionsPropsContents)"
Overwrite="true" />
<Message Importance="High" Text="$(RepositoryName) using package version properties saved at $(CurrentSourceBuiltPackageVersionPropsPath) and $(PreviouslySourceBuiltPackageVersionPropsPath)" />
<MakeDir Directories="$(BaseIntermediateOutputPath)" />
<Touch Files="$(BaseIntermediateOutputPath)CreateBuildInputProps.complete" AlwaysCreate="true">
<Output TaskParameter="TouchedFiles" ItemName="FileWrites" />
</Touch>
</Target>
<!-- SkipRepoReferences is a developer innerloop switch to skip building dependencies. -->
<Target Name="BuildRepoReferences"
DependsOnTargets="GetTransitiveRepositoryReferences"
Condition="'@(RepositoryReference)' != '' and '$(SkipRepoReferences)' != 'true'">
<Message Importance="High" Text="Building dependencies [@(TransitiveRepositoryReference)] needed by '$(RepositoryName)'." />
<ItemGroup>
<_DependentProject Include="@(TransitiveRepositoryReference -> '%(Identity).proj')" />
</ItemGroup>
<MSBuild Projects="@(_DependentProject)"
Targets="Build"
BuildInParallel="$(BuildInParallel)"
StopOnFirstFailure="true" />
</Target>
<Target Name="SetSourceBuiltSdkOverrides"
Condition="'@(SourceBuiltSdkOverride)' != ''">
<ItemGroup>
<!-- Set the environment variables for MSBuild to look for our additional SDK Resolvers and or our resolver to find our source-built SDKs. -->
<EnvironmentVariables Include="MSBUILDADDITIONALSDKRESOLVERSFOLDER=$(VSMSBuildSdkResolversDir)" />
<EnvironmentVariables Include="SOURCE_BUILT_SDK_ID_%(SourceBuiltSdkOverride.Group)=%(SourceBuiltSdkOverride.Identity)" />
<EnvironmentVariables Include="SOURCE_BUILT_SDK_VERSION_%(SourceBuiltSdkOverride.Group)=%(SourceBuiltSdkOverride.Version)" />
<EnvironmentVariables Condition="'%(SourceBuiltSdkOverride.Location)' != ''" Include="SOURCE_BUILT_SDK_DIR_%(SourceBuiltSdkOverride.Group)=%(SourceBuiltSdkOverride.Location)/" />
<EnvironmentVariables Condition="'%(SourceBuiltSdkOverride.Location)' == ''" Include="SOURCE_BUILT_SDK_DIR_%(SourceBuiltSdkOverride.Group)=$(SourceBuiltSdksDir)%(SourceBuiltSdkOverride.Identity)/" />
</ItemGroup>
</Target>
<Target Name="RepoBuild"
Inputs="$(MSBuildProjectFullPath)"
Outputs="$(BaseIntermediateOutputPath)Build.complete"
Condition="'$(BuildCommand)' != ''"
DependsOnTargets="BuildRepoReferences;
UpdateNuGetConfig;
UpdateGlobalJsonVersions;
UpdateEngCommonFiles;
CreateBuildInputProps;
SetSourceBuiltSdkOverrides">
<Message Importance="High" Text="[$([System.DateTime]::Now.ToString('HH:mm:ss.ff'))] Building $(RepositoryName)" />
<Message Importance="High" Text="Running command:" />
<Message Importance="High" Text=" $(BuildCommand)" />
<Message Importance="High" Text=" Log: $(RepoConsoleLogFile)" Condition="'$(MinimalConsoleLogOutput)' == 'true'" />
<Message Importance="High" Text=" With Environment Variables:"/>
<Message Importance="High" Text=" %(EnvironmentVariables.Identity)" />
<Message Text="DirSize Before Building $(RepositoryName)" Importance="High"
Condition=" '$(CleanWhileBuilding)' == 'true' and '$(BuildOS)' != 'windows'" />
<Exec Command="df -h $(RepoRoot)"
Condition=" '$(CleanWhileBuilding)' == 'true' and '$(BuildOS)' != 'windows'" />
<PropertyGroup>
<FullCommand>$(BuildCommand)</FullCommand>
<FullCommand Condition="'$(LogVerbosityOptOut)' != 'true'">$(FullCommand) /v:$(LogVerbosity)</FullCommand>
<FullCommand Condition="'$(MinimalConsoleLogOutput)' == 'true'">$(FullCommand) > $(RepoConsoleLogFile) 2>&1</FullCommand>
</PropertyGroup>
<MakeDir Directories="$([System.IO.Path]::GetDirectoryName('$(RepoConsoleLogFile)'));
$(ArtifactsAssetsDir)" />
<!-- Create directories for extra debugging. -->
<MakeDir Directories="$(MSBuildDebugPathTargetDir);
$(RoslynDebugPathTargetDir);
$(AspNetRazorBuildServerLogDir)"
Condition="'$(EnableExtraDebugging)' == 'true'" />
<Exec Command="$(FullCommand)"
WorkingDirectory="$(ProjectDirectory)"
EnvironmentVariables="@(EnvironmentVariables)"
IgnoreStandardErrorWarningFormat="true">
<Output TaskParameter="ExitCode" PropertyName="RepoBuildExitCode" />
</Exec>
<Message Importance="High" Text="[$([System.DateTime]::Now.ToString('HH:mm:ss.ff'))] Building $(RepositoryName)...done" />
<MakeDir Directories="$(BaseIntermediateOutputPath)" />
<Touch Files="$(BaseIntermediateOutputPath)Build.complete" AlwaysCreate="true">
<Output TaskParameter="TouchedFiles" ItemName="FileWrites" />
</Touch>
<!-- Propagate errors to the output when using the minimal console log feature. -->
<OnError ExecuteTargets="LogRepoBuildError" Condition="'$(MinimalConsoleLogOutput)' == 'true'" />
</Target>
<Target Name="LogRepoBuildError">
<Message Importance="High" Text="$([System.IO.File]::ReadAllText('$(RepoConsoleLogFile)'))" Condition="Exists('$(RepoConsoleLogFile)') and '$(MinimalConsoleLogOutput)' == 'true'" />
<Message Importance="High" Text="'$(RepositoryName)' failed during build." />
<Message Importance="High" Text="See '$(RepoConsoleLogFile)' for more information." Condition="Exists('$(RepoConsoleLogFile)') and '$(MinimalConsoleLogOutput)' == 'true'" />
</Target>
<Target Name="CopyRepoArtifacts"
DependsOnTargets="RepoBuild"
Condition="'$(IsUtilityProject)' != 'true'"
Inputs="$(RepoManifestFile)"
Outputs="$(BaseIntermediateOutputPath)CopyRepoArtifacts.complete">
<Error Text="Repo manifest file doesn't exist." Condition="!Exists('$(RepoManifestFile)')" />
<XmlPeek XmlInputPath="$(RepoManifestFile)"
Query="Build/Artifact/@Path">
<Output TaskParameter="Result" ItemName="RepoManifestArtifact" />
</XmlPeek>
<!-- Error if a repository doesn't produce any shipping or non-shipping artifacts. -->
<ItemGroup Condition="'@(RepoManifestArtifact)' == ''">
<_ArtifactsNotCreatedReason Include="^ There may have been a silent failure in the repo build." />
<_ArtifactsNotCreatedReason Include="^ To confirm, check the build log file for undetected errors that may have prevented package creation: $(RepoConsoleLogFile)" Condition="'$(MinimalConsoleLogOutput)' == 'true'" />
<_ArtifactsNotCreatedReason Include="^ The packages may have been written to an unexpected directory. For example, some repos used bin/ and changed to artifacts/ to match Arcade. Check RepoManifestFile in $(MSBuildProjectFullPath) (currently '$(RepoManifestFile)')" />
</ItemGroup>
<Error Text="$(RepositoryName) produced no new source-built package identities. Known possible causes:%0A@(_ArtifactsNotCreatedReason, '%0A')"
Condition="'@(RepoManifestArtifact)' == ''" />
<!-- The repo symbol archive shouldn't be copied. -->
<ItemGroup>
<RepoSymbolsArchive Include="@(RepoManifestArtifact)"
Condition="$([System.String]::Copy('%(Identity)').EndsWith('Symbols.$(RepositoryName)$(ArchiveExtension)'))" />
<RepoManifestArtifact Remove="@(RepoSymbolsArchive)" />
</ItemGroup>
<!-- Log the new repo artifacts -->
<Message Importance="High" Text="New artifact(s) after building $(RepositoryName):" />
<Message Importance="High" Text=" -> %(RepoManifestArtifact.Filename)%(RepoManifestArtifact.Extension)" />
<ItemGroup>
<RepoManifestPackage Include="@(RepoManifestArtifact->WithMetadataValue('Extension', '.nupkg'))" />
<RepoManifestAsset Include="@(RepoManifestArtifact)" Exclude="@(RepoManifestPackage)" />
</ItemGroup>
<!-- Prepare the repo manifest packages and group them by shipping and non-shipping. -->
<ItemGroup>
<RepoManifestNonShippingPackage Include="@(RepoManifestPackage)"
Condition="$([System.String]::Copy('%(Identity)').Contains('$([System.IO.Path]::DirectorySeparatorChar)NonShipping$([System.IO.Path]::DirectorySeparatorChar)'))">
<DestinationFolder Condition="'$(ReferenceOnlyRepoArtifacts)' != 'true'">$(RepoArtifactsNonShippingPackagesDir)</DestinationFolder>
<DestinationFolder Condition="'$(ReferenceOnlyRepoArtifacts)' == 'true'">$(ReferencePackagesDir)</DestinationFolder>
</RepoManifestNonShippingPackage>
<RepoManifestShippingPackage Include="@(RepoManifestPackage)"
Exclude="@(RepoManifestNonShippingPackage)">
<DestinationFolder Condition="'$(ReferenceOnlyRepoArtifacts)' != 'true'">$(RepoArtifactsShippingPackagesDir)</DestinationFolder>
<DestinationFolder Condition="'$(ReferenceOnlyRepoArtifacts)' == 'true'">$(ReferencePackagesDir)</DestinationFolder>
</RepoManifestShippingPackage>
<RepoManifestAsset>
<DestinationFolder Condition="'$(ReferenceOnlyRepoArtifacts)' != 'true'">$(ArtifactsAssetsDir)</DestinationFolder>
<DestinationFolder Condition="'$(ReferenceOnlyRepoArtifacts)' == 'true'">$(ReferenceAssetsDir)</DestinationFolder>
</RepoManifestAsset>
</ItemGroup>
<!-- Copy shipping packages -->
<Copy SourceFiles="@(RepoManifestShippingPackage)"
DestinationFolder="%(RepoManifestShippingPackage.DestinationFolder)"
Condition="'@(RepoManifestShippingPackage)' != ''" />
<!-- Copy non-shipping packages -->
<Copy SourceFiles="@(RepoManifestNonShippingPackage)"
DestinationFolder="%(RepoManifestNonShippingPackage.DestinationFolder)"
Condition="'@(RepoManifestNonShippingPackage)' != ''" />
<!-- Copy assets -->
<Copy SourceFiles="@(RepoManifestAsset)"
DestinationFolder="%(RepoManifestAsset.DestinationFolder)"
Condition="'@(RepoManifestAsset)' != ''" />
<MakeDir Directories="$(BaseIntermediateOutputPath)" />
<Touch Files="$(BaseIntermediateOutputPath)CopyRepoArtifacts.complete" AlwaysCreate="true">
<Output TaskParameter="TouchedFiles" ItemName="FileWrites" />
</Touch>
</Target>
<!-- Copy restored packages from inner build to ensure they're included in the
main build prebuilt check -->
<Target Name="CopyInnerBuildRestoredPackages"
Condition="'$(IsUtilityProject)' != 'true'">
<ItemGroup>
<_InnerPackageCacheFiles Include="$(ProjectDirectory)artifacts/sb/package-cache/**/*" />
</ItemGroup>
<Copy SourceFiles="@(_InnerPackageCacheFiles)"
DestinationFiles="$(NuGetPackageRoot)%(RecursiveDir)%(Filename)%(Extension)"
SkipUnchangedFiles="true"
Condition="'@(_InnerPackageCacheFiles)' != ''" />
</Target>
<Target Name="CleanupRepo"
Condition="'$(IsUtilityProject)' != 'true' and
'$(CleanWhileBuilding)' == 'true' and
Exists('$(ProjectDirectory)artifacts')">
<!--
Some repositories (WinForms) use source generators that open files manually and keep file handles open on the compiler server (CsWin32).
These source generators are written incorrectly (a source generator should never do IO itself),
but the required features to read in binary files as input to a source generator don't exist.
To work around these source generators, shut down the compiler server so we can delete the obj directories.
-->
<Exec Command="$(DotnetTool) build-server shutdown --vbcscompiler" />
<PropertyGroup>
<BuildLogsDir>$([MSBuild]::NormalizeDirectory('$(ProjectDirectory)', 'artifacts', 'buildLogs'))</BuildLogsDir>
<BuildObjDir>$([MSBuild]::NormalizeDirectory('$(ProjectDirectory)', 'artifacts', 'buildObj'))</BuildObjDir>
</PropertyGroup>
<ItemGroup>
<LogFilesToCopy Include="$(ProjectDirectory)artifacts/**/*.log" />
<LogFilesToCopy Include="$(ProjectDirectory)artifacts/**/*.binlog" />
<ObjFilesToCopy Include="$(ProjectDirectory)artifacts/**/project.assets.json" />
</ItemGroup>
<!-- Make a copy of the build logs & project.assets.json files -->
<Copy SourceFiles="@(LogFilesToCopy)"
DestinationFolder="$(BuildLogsDir)%(RecursiveDir)"
SkipUnchangedFiles="true"
Condition="'@(LogFilesToCopy)' != ''" />
<Copy SourceFiles="@(ObjFilesToCopy)"
DestinationFolder="$(BuildObjDir)%(RecursiveDir)"
SkipUnchangedFiles="true"
Condition="'@(ObjFilesToCopy)' != ''" />
<ItemGroup>
<DirsToDelete Include="$([System.IO.Directory]::GetDirectories('$(ProjectDirectory)artifacts'))" />
<DirsToDeleteWithTrailingSeparator Include="$([MSBuild]::EnsureTrailingSlash('%(DirsToDelete.Identity)'))" />
<DirsToDeleteWithTrailingSeparator Remove="$(BuildLogsDir)" />
<DirsToDeleteWithTrailingSeparator Remove="$(BuildObjDir)" />
</ItemGroup>
<Message Text="DirSize After Building $(RepositoryName)" Importance="High" Condition="'$(BuildOS)' != 'windows' and '@(DirsToDeleteWithTrailingSeparator)' != ''" />
<Exec Command="df -h $(RepoRoot)" Condition="'$(BuildOS)' != 'windows' and '@(DirsToDeleteWithTrailingSeparator)' != ''" />
<!-- Cleanup everything else -->
<RemoveDir Directories="@(DirsToDeleteWithTrailingSeparator)" />
<Message Text="DirSize After CleanupRepo $(RepositoryName)" Importance="High" Condition="'$(BuildOS)' != 'windows'and '@(DirsToDeleteWithTrailingSeparator)' != ''" />
<Exec Command="df -h $(RepoRoot)" Condition="'$(BuildOS)' != 'windows'and '@(DirsToDeleteWithTrailingSeparator)' != ''" />
</Target>
<Target Name="ExtractToolPackage"
DependsOnTargets="CopyRepoArtifacts"
Condition="'@(BuiltSdkPackageOverride)' != ''"
Inputs="$(MSBuildProjectFullPath)"
Outputs="$(BaseIntermediateOutputPath)ExtractToolPackage.complete">
<PropertyGroup>
<_ToolPackagesRoot Condition="'$(ReferenceOnlyRepoArtifacts)' != 'true'">$(RepoArtifactsNonShippingPackagesDir)</_ToolPackagesRoot>
<_ToolPackagesRoot Condition="'$(ReferenceOnlyRepoArtifacts)' == 'true'">$(ReferencePackagesDir)</_ToolPackagesRoot>
</PropertyGroup>
<ItemGroup>
<_ToolPackage
Condition="'%(BuiltSdkPackageOverride.Version)' == ''"
Include="$(_ToolPackagesRoot)%(BuiltSdkPackageOverride.Identity)*.nupkg"
Exclude="$(_ToolPackagesRoot)%(BuiltSdkPackageOverride.Identity)*.symbols.nupkg"
Id="%(BuiltSdkPackageOverride.Identity)" />
<_ToolPackage
Condition="'%(BuiltSdkPackageOverride.Version)' != ''"
Include="$(_ToolPackagesRoot)%(BuiltSdkPackageOverride.Identity).%(BuiltSdkPackageOverride.Version).nupkg"
Exclude="$(_ToolPackagesRoot)%(BuiltSdkPackageOverride.Identity).%(BuiltSdkPackageOverride.Version).symbols.nupkg"
Id="%(BuiltSdkPackageOverride.Identity)" />
</ItemGroup>
<Unzip SourceFiles="%(_ToolPackage.Identity)"
DestinationFolder="$(SourceBuiltSdksDir)%(_ToolPackage.Id)\"
SkipUnchangedFiles="true" />
<ItemGroup>
<ExtractedToolFiles Include="$(SourceBuiltSdksDir)%(_ToolPackage.Id)/**/*netcore*/*.dll" />
</ItemGroup>
<Copy SourceFiles="@(ExtractedToolFiles)" DestinationFolder="$(SourceBuiltSdksDir)/" />
<!-- When unpacking, this executable file has the wrong permissions on
non-windows systems: https://github.com/NuGet/Home/issues/13121. -->
<Exec Command="chmod 755 git-clone-to-dir.sh"
Condition=" '%(_ToolPackage.Id)' == 'Microsoft.DotNet.Arcade.Sdk' and !$([MSBuild]::IsOSPlatform(Windows))"
WorkingDirectory="$(SourceBuiltSdksDir)%(_ToolPackage.Id)/tools/SourceBuild/" />
<MakeDir Directories="$(BaseIntermediateOutputPath)" />
<Touch Files="$(BaseIntermediateOutputPath)ExtractToolPackage.complete" AlwaysCreate="true">
<Output TaskParameter="TouchedFiles" ItemName="FileWrites" />
</Touch>
</Target>
<Target Name="ExtractSymbolsArchiveFile"
DependsOnTargets="CopyRepoArtifacts"
Condition="'$(DotNetBuildSourceOnly)' == 'true' and
'$(IsUtilityProject)' != 'true' and
'@(RepoSymbolsArchive)' != ''"
Inputs="@(RepoSymbolsArchive)"
Outputs="$(IntermediateSymbolsRepoDir)">
<Error Text="There must only be a single repository symbols archive file. Found: @(RepoSymbolsArchive)"
Condition="@(RepoSymbolsArchive->Count()) > 1" />
<!-- Extract repo symbols tarball -->
<MakeDir Directories="$(IntermediateSymbolsRepoDir)" />
<Exec Command="tar -xzf %(RepoSymbolsArchive.Identity) -C $(IntermediateSymbolsRepoDir)" />
</Target>
<Target Name="Build"
DependsOnTargets="
BuildRepoReferences;
RepoBuild;
CopyRepoArtifacts;
CopyInnerBuildRestoredPackages;
ExtractToolPackage;
ExtractSymbolsArchiveFile;
CleanupRepo" />
<Target Name="WritePrebuiltUsageData"
DependsOnTargets="GetAllProjectDirectories"
Inputs="$(MSBuildProjectFullPath)"
Outputs="$(BaseIntermediateOutputPath)WritePrebuiltUsageData.complete">
<!-- Save the PVP snapshot of each build step to be evaluated while building the report. -->
<ItemGroup>
<PackageVersionPropsSnapshotFiles Include="$(PackageVersionsDir)PackageVersions.*.Snapshot.props" />
</ItemGroup>
<Copy SourceFiles="@(PackageVersionPropsSnapshotFiles)" DestinationFolder="$(PackageReportDir)snapshots/" />
<ItemGroup>
<AllRestoredPackageFiles Include="$(NuGetPackageRoot)**/*.nupkg" />
<!-- Only contains packages when building. -->
<TarballPrebuiltPackageFiles Include="$(PrebuiltPackagesPath)*.nupkg" />
<SourceBuiltPackageFiles Include="$(ArtifactsPackagesDir)**/*.nupkg" />
<SourceBuiltPackageFiles Include="$(PrebuiltSourceBuiltPackagesPath)*.nupkg" />
<ReferencePackageFiles Include="$(ReferencePackagesDir)**/*.nupkg" />
<!-- Check all RIDs from all restored Microsoft.NETCore.Platforms packages. -->
<PlatformsRuntimeJsonFiles Include="$(NuGetPackageRoot)microsoft.netcore.platforms/*/PortableRuntimeIdentifierGraph.json" />
<!-- Add some other potential top-level project directories for a more specific report. -->
<ProjectDirectories Include="$(SourceBuiltSdksDir);$(TasksDir);$(ArtifactsObjDir)" />
<!-- Finally, scan entire source-build, in case project.assets.json ends up in an unexpected place. -->
<ProjectDirectories Include="$(RepoRoot)" />
</ItemGroup>
<ItemGroup>
<!-- This file is a resource tracked by Git, not generated by restore. Ignore false positive. -->
<IgnoredProjectAssetsJsonFiles Include="$(SrcDir)*nuget-client*/**/test/NuGet.Core.Tests/NuGet.Build.Tasks.Pack.Test/compiler/resources/project.assets.json"/>
</ItemGroup>
<WritePackageUsageData
RestoredPackageFiles="@(AllRestoredPackageFiles)"
TarballPrebuiltPackageFiles="@(TarballPrebuiltPackageFiles)"
SourceBuiltPackageFiles="@(SourceBuiltPackageFiles)"
ReferencePackageFiles="@(ReferencePackageFiles)"
PlatformsRuntimeJsonFiles="@(PlatformsRuntimeJsonFiles)"
TargetRid="$(TargetRid)"
ProjectDirectories="@(ProjectDirectories)"
RootDir="$(RepoRoot)"
IgnoredProjectAssetsJsonFiles="@(IgnoredProjectAssetsJsonFiles)"
DataFile="$(PackageReportDataFile)"
ProjectAssetsJsonArchiveFile="$(ProjectAssetsJsonArchiveFile)" />
<!-- Copy packages detected as prebuilts to the artifacts prebuilt folder -->
<ItemGroup>
<AllowedPackageFiles Include="@(TarballPrebuiltPackageFile)" />
<AllowedPackageFiles Include="@(SourceBuiltPackageFiles)" />
<AllowedPackageFiles Include="@(ReferencePackageFiles)" />
<AllowedPackageFiles>
<LCFilename>$([System.String]::Copy(%(Filename)).ToLowerInvariant())</LCFilename>
</AllowedPackageFiles>
<PrebuiltPackageFiles Include="@(AllRestoredPackageFiles)" >
<LCFilename>$([System.String]::Copy(%(Filename)).ToLowerInvariant())</LCFilename>
</PrebuiltPackageFiles>
<PrebuiltPackageFiles Remove="@(AllowedPackageFiles)" MatchOnMetadata="LCFilename" />
</ItemGroup>
<Copy
SourceFiles="@(PrebuiltPackageFiles)"
DestinationFolder="$(ResultingPrebuiltPackagesDir)" />
<MakeDir Directories="$(BaseIntermediateOutputPath)" />
<Touch Files="$(BaseIntermediateOutputPath)WritePrebuiltUsageData.complete" AlwaysCreate="true">
<Output TaskParameter="TouchedFiles" ItemName="FileWrites" />
</Touch>
</Target>
<Target Name="GetAllProjectDirectories">
<ItemGroup>
<AllRepoProjects Include="$(RepoProjectsDir)*.proj" />
</ItemGroup>
<Message Importance="High" Text="Finding project directories..." />
<MSBuild Projects="@(AllRepoProjects)"
Targets="GetProjectDirectory">
<Output TaskParameter="TargetOutputs" ItemName="ProjectDirectories" />
</MSBuild>
</Target>
<Target Name="ReportPrebuiltUsage"
Inputs="$(MSBuildProjectFullPath)"
Outputs="$(BaseIntermediateOutputPath)ReportPrebuiltUsage.complete">
<PropertyGroup>
<FailOnPrebuiltBaselineError Condition="'$(FailOnPrebuiltBaselineError)' == ''">false</FailOnPrebuiltBaselineError>
</PropertyGroup>
<ItemGroup>
<PackageVersionPropsSavedSnapshotFiles Include="$(PackageReportDir)snapshots/PackageVersions.*.Snapshot.props" />
</ItemGroup>
<WriteUsageReports DataFile="$(PackageReportDataFile)"
PackageVersionPropsSnapshots="@(PackageVersionPropsSavedSnapshotFiles)"
ProdConBuildManifestFile="$(ProdConManifestFile)"
PoisonedReportFile="$(PoisonedReportFile)"
OutputDirectory="$(PackageReportDir)" />
<PropertyGroup Condition="'$(ContinueOnPrebuiltBaselineError)' == ''">
<ContinueOnPrebuiltBaselineError>false</ContinueOnPrebuiltBaselineError>
<ContinueOnPrebuiltBaselineError Condition="'$(FailOnPrebuiltBaselineError)' != 'true'">true</ContinueOnPrebuiltBaselineError>
</PropertyGroup>
<ValidateUsageAgainstBaseline
DataFile="$(PackageReportDataFile)"
BaselineDataFile="$(BaselineDataFile)"
OutputBaselineFile="$(PackageReportDir)generated-new-baseline.xml"
OutputReportFile="$(PackageReportDir)baseline-comparison.xml"
AllowTestProjectUsage="$(AllowTestProjectUsage)"
ContinueOnError="$(ContinueOnPrebuiltBaselineError)" />
<MakeDir Directories="$(BaseIntermediateOutputPath)" />
<Touch Files="$(BaseIntermediateOutputPath)ReportPrebuiltUsage.complete" AlwaysCreate="true">
<Output TaskParameter="TouchedFiles" ItemName="FileWrites" />
</Touch>
</Target>
<Target Name="GetProjectDirectory" Outputs="$(ProjectDirectory)" />
<Target Name="GetRepositoryReferences" Outputs="@(RepositoryReference)" />
<!-- Returns the repository references of this project and all the projects this project references, recursively -->
<Target Name="GetTransitiveRepositoryReferences" Outputs="@(TransitiveRepositoryReference)">
<ItemGroup>
<_TransitiveRepositoryReference Include="@(RepositoryReference)" />
</ItemGroup>
<MSBuild Projects="@(RepositoryReference->'%(Identity).proj')"
Targets="GetTransitiveRepositoryReferences"
BuildInParallel="true">
<Output TaskParameter="TargetOutputs" ItemName="_DependencyTransitiveRepositoryReference" />
</MSBuild>
<!-- When items are transferred between projects, they get metadata indicating their source (e.g. MSBuildSourceProjectFile).
This is problematic because it causes introduces distinctness on the items. For example, an arcade RepositoryReference
that comes from both msbuild and source-build-externals will be treated as two separate items. But we only want one arcade
reference. To prevent this from happening, we need to remove the extra metadata so the two references can be seen as duplicates. -->
<ItemGroup>
<_TransitiveRepositoryReference Include="@(_DependencyTransitiveRepositoryReference)"
RemoveMetadata="MSBuildSourceProjectFile;MSBuildSourceTargetName;OriginalItemSpec" />
<TransitiveRepositoryReference Include="@(_TransitiveRepositoryReference)" KeepDuplicates="false" />
</ItemGroup>
<!-- Exclude repositories that currently don't build when not building source-only. -->
<ItemGroup Condition="'$(DotNetBuildSourceOnly)' != 'true'">
<TransitiveRepositoryReference Remove="roslyn" />
<TransitiveRepositoryReference Remove="msbuild" />
<TransitiveRepositoryReference Remove="aspnetcore" />
<TransitiveRepositoryReference Remove="nuget-client" />
<TransitiveRepositoryReference Remove="fsharp" />
<TransitiveRepositoryReference Remove="vstest" />
</ItemGroup>
</Target>
<!-- Outputs a dependency graph of the repos, in YAML form, to the console. -->
<Target Name="ShowDependencyGraph">
<MSBuild Projects="$(MSBuildProjectFullPath)"
Targets="GetDependencyGraphString"
Properties="DependencyGraphIndent=">
<Output TaskParameter="TargetOutputs" PropertyName="DependencyGraphString" />
</MSBuild>
<!-- Replace the '_' placeholder with spaces -->
<Message Importance="High" Text="$(DependencyGraphString.Replace('_', ' ').Trim())" />
</Target>
<!-- Recursively walks the repo dependency graph gathering each repo's dependencies which are returned as a YAML string representation -->
<Target Name="GetDependencyGraphString"
DependsOnTargets="GetTransitiveRepositoryReferences"
Outputs="$(DependencyGraphString)">
<PropertyGroup>
<!-- Each step deeper in the graph builds up the indentation used for the YAML representation.
Use '_' as a placeholder for the space ' ' character since trailing spaces aren't handled well as property values. -->
<_NextIndent>$(DependencyGraphIndent)__</_NextIndent>
</PropertyGroup>
<!-- For each of the current project's direct repo dependencies, recursively call the target to get each of there dependency graphs -->
<MSBuild Projects="@(RepositoryReference->'%(Identity).proj')"
Targets="GetDependencyGraphString"
Properties="DependencyGraphIndent=$(_NextIndent)">
<Output TaskParameter="TargetOutputs" ItemName="_DependencyGraphString" />
</MSBuild>
<!-- Append all the separate dependency graph snippets together -->
<PropertyGroup>
<!-- Ensure the item `;` separators are removed from the the target output -->
<_DependencyGraphString>@(_DependencyGraphString, '')</_DependencyGraphString>
<_LineBreak>%0a</_LineBreak>
<DependencyGraphString>$(DependencyGraphIndent)-_$(RepositoryName)$(_LineBreak)$(_DependencyGraphString)</DependencyGraphString>
</PropertyGroup>
</Target>
</Project>