-
Notifications
You must be signed in to change notification settings - Fork 4.8k
/
Microsoft.NET.CrossGen.targets
528 lines (444 loc) · 28.3 KB
/
Microsoft.NET.CrossGen.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
<!--
***********************************************************************************************
Microsoft.NET.CrossGen.targets
WARNING: DO NOT MODIFY this file unless you are knowledgeable about MSBuild and have
created a backup copy. Incorrect changes to this file will make it
impossible to load or build your projects from the command-line or the IDE.
Copyright (c) .NET Foundation. All rights reserved.
***********************************************************************************************
-->
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!--
For ReadyToRun compilation, default to Crossgen for .NET Core 3.x and .NET 5. If PublishReadyToRunUseCrossgen2
is set to true in the project or on the command line, use Crossgen2 and default to composite mode. For .NET 6
and higher, always use Crossgen2 and default to non-composite mode.
-->
<PropertyGroup Condition="'$(TargetFrameworkIdentifier)' == '.NETCoreApp' and '$(_TargetFrameworkVersionWithoutV)' >= '3.0'">
<PublishReadyToRunUseCrossgen2 Condition="'$(_TargetFrameworkVersionWithoutV)' >= '6.0'">true</PublishReadyToRunUseCrossgen2>
<PublishReadyToRunComposite Condition="'$(PublishReadyToRunComposite)' == '' and '$(_TargetFrameworkVersionWithoutV)' >= '6.0'">false</PublishReadyToRunComposite>
<PublishReadyToRunComposite Condition="'$(PublishReadyToRunComposite)' == ''">true</PublishReadyToRunComposite>
<PublishReadyToRunComposite Condition="'$(PublishReadyToRunUseCrossgen2)' != 'true' or '$(SelfContained)' != 'true'">false</PublishReadyToRunComposite>
<PublishReadyToRunUseRuntimePackOptimizationData Condition="'$(PublishReadyToRunUseRuntimePackOptimizationData)' == ''">true</PublishReadyToRunUseRuntimePackOptimizationData>
<PublishReadyToRunPerfmapFormatVersion Condition="'$(PublishReadyToRunPerfmapFormatVersion)' == ''">1</PublishReadyToRunPerfmapFormatVersion>
</PropertyGroup>
<!--
============================================================
PrepOptimizer
Sets up the common infrastructure for the optimization phase
Outputs:
JitPath
Crossgen
============================================================
-->
<Target Name="PrepOptimizer"
DependsOnTargets="_RestoreCrossgen;"
Condition="$(SkipOptimization) != 'true' ">
<!-- Get the coreclr path -->
<ItemGroup>
<_CoreclrResolvedPath Include="@(CrossgenResolvedAssembliesToPublish)"
Condition="'%(CrossgenResolvedAssembliesToPublish.Filename)'=='coreclr'" />
<_CoreclrResolvedPath Include="@(CrossgenResolvedAssembliesToPublish)"
Condition="'%(CrossgenResolvedAssembliesToPublish.Filename)'=='libcoreclr'" />
<_JitResolvedPath Include="@(CrossgenResolvedAssembliesToPublish)"
Condition="'%(CrossgenResolvedAssembliesToPublish.Filename)'=='clrjit'" />
<_JitResolvedPath Include="@(CrossgenResolvedAssembliesToPublish)"
Condition="'%(CrossgenResolvedAssembliesToPublish.Filename)'=='libclrjit'" />
</ItemGroup>
<NETSdkError Condition="'@(_CoreclrResolvedPath->Count())' > 1"
ResourceName="MultipleFilesResolved"
FormatArguments="coreclr" />
<NETSdkError Condition="'@(_CoreclrResolvedPath)'== ''"
ResourceName="UnableToFindResolvedPath"
FormatArguments="coreclr" />
<NETSdkError Condition="'@(_JitResolvedPath->Count())' > 1"
ResourceName="MultipleFilesResolved"
FormatArguments="jit" />
<NETSdkError Condition="'@(_JitResolvedPath)'== ''"
ResourceName="UnableToFindResolvedPath"
FormatArguments="jit" />
<!-- Get the crossgen and jit path-->
<PropertyGroup>
<_CoreclrPath>@(_CoreclrResolvedPath)</_CoreclrPath>
<JitPath>@(_JitResolvedPath)</JitPath>
<_CoreclrDir>$([System.IO.Path]::GetDirectoryName($(_CoreclrPath)))</_CoreclrDir>
<_CoreclrPkgDir>$([System.IO.Path]::Combine($(_CoreclrDir),"..\..\..\"))</_CoreclrPkgDir>
<CrossgenDir>$([System.IO.Path]::Combine($(_CoreclrPkgDir),"tools"))</CrossgenDir>
<!-- TODO override with rid specific tools path for x-arch -->
<Crossgen>$([System.IO.Path]::Combine($(CrossgenDir),"crossgen"))</Crossgen>
<Crossgen Condition="$([MSBuild]::IsOSPlatform(`Windows`))">$([System.IO.Path]::Combine($(CrossgenDir),"crossgen.exe"))</Crossgen>
</PropertyGroup>
<NETSdkError Condition="!Exists($(Crossgen))"
ResourceName="UnableToFindResolvedPath"
FormatArguments="$(Crossgen)" />
<!-- Copy crossgen into the netcoreapp folder to ensure it can load Microsoft.DiaSymReader.Native when creating PDBs -->
<Copy SourceFiles="$(Crossgen)"
DestinationFolder="$(_NetCoreRefDir)"
OverwriteReadOnlyFiles="$(OverwriteReadOnlyFiles)"
Retries="$(CopyRetryCount)"
RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)"
UseHardlinksIfPossible="$(CreateHardLinksForPublishFilesIfPossible)"
UseSymboliclinksIfPossible="$(CreateSymbolicLinksForPublishFilesIfPossible)">
<Output TaskParameter="DestinationFiles" ItemName="FileWrites"/>
</Copy>
<PropertyGroup>
<Crossgen>$([System.IO.Path]::GetFullPath($([System.IO.Path]::Combine($(_NetCoreRefDir), $([System.IO.Path]::GetFileName($(Crossgen)))))))</Crossgen>
</PropertyGroup>
</Target>
<!--
============================================================
_RunOptimizer
Start the optimization phase
============================================================
-->
<Target Name="_RunOptimizer"
DependsOnTargets="_InitializeBasicProps;
_ComputeResolvedFilesToStoreTypes;
_SetupStageForCrossgen"
Condition="$(SkipOptimization) != 'true' ">
<ItemGroup>
<AssembliestoCrossgen Include="$(MSBuildProjectFullPath)">
<Properties>
CrossgenExe=$(Crossgen);
CrossgenJit=$(JitPath);
CrossgenInputAssembly=%(_ManagedResolvedFilesToOptimize.Fullpath);
CrossgenOutputAssembly=$(_RuntimeOptimizedDir)$(DirectorySeparatorChar)%(_ManagedResolvedFilesToOptimize.FileName)%(_ManagedResolvedFilesToOptimize.Extension);
CrossgenSubOutputPath=%(_ManagedResolvedFilesToOptimize.DestinationSubPath);
_RuntimeOptimizedDir=$(_RuntimeOptimizedDir);
PublishDir=$(StoreStagingDir);
CrossgenPlatformAssembliesPath=$(_RuntimeRefDir)$(PathSeparator)$(_NetCoreRefDir);
CreateProfilingSymbols=$(CreateProfilingSymbols);
StoreSymbolsStagingDir=$(StoreSymbolsStagingDir);
_RuntimeSymbolsDir=$(_RuntimeSymbolsDir)
</Properties>
</AssembliestoCrossgen>
</ItemGroup>
<!-- CrossGen the assemblies -->
<MSBuild Projects="@(AssembliestoCrossgen)"
Targets="RunCrossGen"
BuildInParallel="$(BuildInParallel)"
Condition="'@(_ManagedResolvedFilesToOptimize)' != ''"/>
</Target>
<!--
============================================================
RunCrossGen
Target Encapsulating the crossgen command
============================================================
-->
<Target Name="RunCrossGen"
DependsOnTargets="_InitializeBasicProps;">
<PropertyGroup>
<CrossgenProfilingSymbolsOutputDirectory>$([System.IO.Path]::GetDirectoryName($(_RuntimeSymbolsDir)\$(CrossgenSubOutputPath)))</CrossgenProfilingSymbolsOutputDirectory>
<CrossgenSymbolsStagingDirectory>$([System.IO.Path]::GetDirectoryName($(StoreSymbolsStagingDir)\$(CrossgenSubOutputPath)))</CrossgenSymbolsStagingDirectory>
<CrossgenCommandline>$(CrossgenExe) -nologo -readytorun -in "$(CrossgenInputAssembly)" -out "$(CrossgenOutputAssembly)" -jitpath "$(CrossgenJit)" -platform_assemblies_paths "$(CrossgenPlatformAssembliesPath)"</CrossgenCommandline>
<CreateProfilingSymbolsOptionName Condition="$([MSBuild]::IsOSPlatform(`Windows`))">CreatePDB</CreateProfilingSymbolsOptionName>
<CreateProfilingSymbolsOptionName Condition="'$(CreateProfilingSymbolsOptionName)' == ''">CreatePerfMap</CreateProfilingSymbolsOptionName>
</PropertyGroup>
<Message Text="CrossgenCommandline: $(CrossgenCommandline)"/>
<!--Optimization skip if the assembly is already present in the final output directory-->
<Exec
Command="$(CrossgenCommandline)"
Condition="!Exists($([System.IO.Path]::Combine($(PublishDir),$(CrossgenSubOutputPath))))"
IgnoreStandardErrorWarningFormat="true" />
<Copy SourceFiles = "$(CrossgenOutputAssembly)"
DestinationFiles="$(PublishDir)\$(CrossgenSubOutputPath)"
OverwriteReadOnlyFiles="$(OverwriteReadOnlyFiles)"
Retries="$(CopyRetryCount)"
RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)"
Condition="!Exists($([System.IO.Path]::Combine($(PublishDir),$(CrossgenSubOutputPath))))">
<Output TaskParameter="DestinationFiles" ItemName="FileWrites"/>
</Copy>
<!-- Create profiling symbols if requested -->
<MakeDir Directories="$(CrossgenProfilingSymbolsOutputDirectory)"
Condition="'$(CreateProfilingSymbols)' == 'true' and Exists($(CrossgenOutputAssembly))" />
<Exec Command="$(CrossgenExe) -nologo -readytorun -platform_assemblies_paths $(CrossgenPlatformAssembliesPath) -$(CreateProfilingSymbolsOptionName) $(CrossgenProfilingSymbolsOutputDirectory) $(CrossgenOutputAssembly)"
Condition="'$(CreateProfilingSymbols)' == 'true' and Exists($(CrossgenOutputAssembly))"
IgnoreStandardErrorWarningFormat="true" />
<ItemGroup>
<_ProfilingSymbols Include="$(CrossgenProfilingSymbolsOutputDirectory)\*"
Condition="'$(CreateProfilingSymbols)' == 'true'" />
</ItemGroup>
<Copy SourceFiles="@(_ProfilingSymbols)"
DestinationFolder="$(CrossgenSymbolsStagingDirectory)"
Condition="'$(CreateProfilingSymbols)' == 'true'"
OverwriteReadOnlyFiles="$(OverwriteReadOnlyFiles)"
Retries="$(CopyRetryCount)"
RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)">
<Output TaskParameter="DestinationFiles" ItemName="FileWrites"/>
</Copy>
</Target>
<Target Name="_InitializeBasicProps">
<PropertyGroup>
<PathSeparator>$([System.IO.Path]::PathSeparator)</PathSeparator>
<DirectorySeparatorChar>$([System.IO.Path]::DirectorySeparatorChar)</DirectorySeparatorChar>
</PropertyGroup>
</Target>
<!--
============================================================
_GetCrossgenProps
Generates props used by Crossgen
============================================================
-->
<Target Name="_GetCrossgenProps"
Condition="$(SkipOptimization) != 'true' ">
<PropertyGroup>
<_CrossProjFileDir>$([System.IO.Path]::Combine($(ComposeWorkingDir),"Optimize"))</_CrossProjFileDir>
<_NetCoreRefDir>$([System.IO.Path]::Combine($(_CrossProjFileDir), "netcoreapp"))</_NetCoreRefDir> <!-- flat netcore app assemblies-->
</PropertyGroup>
<MakeDir Directories="$(_CrossProjFileDir)"/>
<PropertyGroup>
<_CrossProjAssetsFile>$([System.IO.Path]::Combine($(_CrossProjFileDir), project.assets.json))</_CrossProjAssetsFile>
</PropertyGroup>
</Target>
<!--
============================================================
_SetupStageForCrossgen
============================================================
-->
<Target Name="_SetupStageForCrossgen"
DependsOnTargets="_GetCrossgenProps;">
<PropertyGroup>
<_RuntimeRefDir>$([System.IO.Path]::Combine($(StoreWorkerWorkingDir), "runtimeref"))</_RuntimeRefDir> <!-- flat app managed assemblies -->
<_RuntimeOptimizedDir>$([System.IO.Path]::Combine($(StoreWorkerWorkingDir), "runtimopt"))</_RuntimeOptimizedDir> <!-- optimized app managed assemblies in nuget cache layout -->
<_RuntimeSymbolsDir>$([System.IO.Path]::Combine($(StoreWorkerWorkingDir), "runtimesymbols"))</_RuntimeSymbolsDir>
</PropertyGroup>
<ItemGroup>
<_ManagedResolvedFilesToOptimize Include="@(_ManagedResolvedFileToPublishCandidates)" />
</ItemGroup>
<MakeDir Directories="$(_RuntimeOptimizedDir)"/>
<MakeDir Directories="$(_RuntimeSymbolsDir)"
Condition="'$(CreateProfilingSymbols)' == 'true'" />
<!-- Copy managed files to a flat temp directory for passing it as ref -->
<Copy SourceFiles = "@(_ManagedResolvedFilesToOptimize)"
DestinationFolder="$(_RuntimeRefDir)"
OverwriteReadOnlyFiles="$(OverwriteReadOnlyFiles)"
Retries="$(CopyRetryCount)"
RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)"
UseHardlinksIfPossible="$(CreateHardLinksForPublishFilesIfPossible)"
UseSymboliclinksIfPossible="$(CreateSymbolicLinksForPublishFilesIfPossible)">
<Output TaskParameter="DestinationFiles" ItemName="FileWrites"/>
</Copy>
</Target>
<!--
============================================================
_RestoreCrossgen
Restores netcoreapp and publishes it to a temp directory
============================================================
-->
<Target Name="_RestoreCrossgen"
DependsOnTargets="PrepforRestoreForComposeStore;
_SetupStageForCrossgen;
ProcessFrameworkReferences;
ApplyImplicitVersions;
_ComputePackageReferencePublish"
Condition="$(SkipOptimization) != 'true' ">
<ItemGroup>
<!-- Filter package references to the one for the platform library, in order to find the right version -->
<PackageReferenceForCrossGen Include="@(PackageReference)" Condition="'%(Identity)' == '$(MicrosoftNETPlatformLibrary)'" />
</ItemGroup>
<MSBuild Projects="$(MSBuildProjectFullPath)"
Targets="Restore"
Properties="RuntimeIdentifiers=$(RuntimeIdentifier);
RestoreGraphProjectInput=$(MSBuildProjectFullPath);
RestoreOutputPath=$(_CrossProjFileDir);
StorePackageName=$(MicrosoftNETPlatformLibrary);
StorePackageVersion=%(PackageReferenceForCrossGen.Version);"/>
<!-- For future: Use ResolvePackageAssets instead of ResolveCopyLocalAssets, delete ResolveCopyLocalAssets task -->
<ResolveCopyLocalAssets Condition="'$(_TargetFrameworkVersionWithoutV)' < '3.0'"
AssetsFilePath="$(_CrossProjAssetsFile)"
TargetFramework="$(_TFM)"
RuntimeIdentifier="$(RuntimeIdentifier)"
PlatformLibraryName="$(MicrosoftNETPlatformLibrary)"
RuntimeFrameworks="@(RuntimeFramework)"
ExcludedPackageReferences="@(_ExcludeFromPublishPackageReference)"
IsSelfContained="$(SelfContained)"
PreserveStoreLayout="false">
<Output TaskParameter="ResolvedAssets" ItemName="CrossgenResolvedAssembliesToPublish" />
</ResolveCopyLocalAssets>
<GetPackageDirectory Condition="'$(_TargetFrameworkVersionWithoutV)' >= '3.0'"
Items="@(RuntimePack)"
AssetsFileWithAdditionalPackageFolders="$(_CrossProjAssetsFile)">
<Output TaskParameter="Output" ItemName="_CrossgenRuntimePack" />
</GetPackageDirectory>
<ResolveRuntimePackAssets Condition="'$(_TargetFrameworkVersionWithoutV)' >= '3.0'"
FrameworkReferences="@(FrameworkReference)"
ResolvedRuntimePacks="@(_CrossgenRuntimePack)">
<Output TaskParameter="RuntimePackAssets" ItemName="CrossgenResolvedAssembliesToPublish" />
</ResolveRuntimePackAssets>
<!-- Copy managed files to a flat temp directory for passing it as ref for crossgen -->
<Copy SourceFiles = "@(CrossgenResolvedAssembliesToPublish)"
DestinationFolder="$(_NetCoreRefDir)"
OverwriteReadOnlyFiles="$(OverwriteReadOnlyFiles)"
Retries="$(CopyRetryCount)"
RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)"
UseHardlinksIfPossible="$(CreateHardLinksForPublishFilesIfPossible)"
UseSymboliclinksIfPossible="$(CreateSymbolicLinksForPublishFilesIfPossible)">
<Output TaskParameter="DestinationFiles" ItemName="FileWrites"/>
</Copy>
</Target>
<PropertyGroup>
<MicrosoftNETCrossgenBuildTasksAssembly Condition="'$(MSBuildRuntimeType)' == 'Core'">$(MSBuildThisFileDirectory)..\tasks\net6.0\Microsoft.NET.Sdk.Crossgen.dll</MicrosoftNETCrossgenBuildTasksAssembly>
<MicrosoftNETCrossgenBuildTasksAssembly Condition="'$(MSBuildRuntimeType)' != 'Core'">$(MSBuildThisFileDirectory)..\tasks\net472\Microsoft.NET.Sdk.Crossgen.dll</MicrosoftNETCrossgenBuildTasksAssembly>
</PropertyGroup>
<!--
============================================================
CreateReadyToRunImages
Create ReadyToRun images for managed assemblies in _ResolvedFileToPublishAlways and _ResolvedFileToPublishPreserveNewest.
============================================================
-->
<Target Name="CreateReadyToRunImages"
Condition="'$(_TargetFrameworkVersionWithoutV)' >= '3.0' And '$(PublishReadyToRun)' == 'true' And '$(TargetFrameworkIdentifier)' == '.NETCoreApp'"
DependsOnTargets="_PrepareForReadyToRunCompilation;
_CreateR2RImages;
_CreateR2RSymbols">
<ItemGroup>
<_R2RCrossgenTelemetry Include="PublishReadyToRunUseCrossgen2" Value="$(PublishReadyToRunUseCrossgen2)" />
<_R2RCrossgenTelemetry Include="Crossgen2PackVersion" Value="%(ResolvedCrossgen2Pack.NuGetPackageVersion)" />
<_R2RCrossgenTelemetry Include="CompileListCount" Value="@(_ReadyToRunCompileList->Count())" />
<_R2RCrossgenTelemetry Include="FailedCount" Value="@(_ReadyToRunCompilationFailures->Count())" />
</ItemGroup>
<AllowEmptyTelemetry EventName="ReadyToRun" EventData="@(_R2RCrossgenTelemetry)" />
<NETSdkError Condition="'@(_ReadyToRunCompilationFailures)' != ''" ResourceName="ReadyToRunCompilationFailed" />
<NETSdkInformation Condition="'$(_ReadyToRunCompilerHasWarnings)' != ''" ResourceName="ReadyToRunCompilationHasWarnings_Info" />
<ItemGroup>
<!--
Note: we only remove the entries for the IL images and replace them with the entries for the R2R images.
We do not do the same for PDBs, because the native PDBs created by the R2R compiler complement the IL PDBs
and do not replace them. IL PDBs are still required for debugging. Native PDBs emitted by the R2R compiler are
only used for profiling purposes.
-->
<ResolvedFileToPublish Remove="@(_ReadyToRunCompositeBuildInput)" />
<ResolvedFileToPublish Remove="@(_ReadyToRunCompileList)" />
<ResolvedFileToPublish Include="@(_ReadyToRunFilesToPublish)" />
</ItemGroup>
</Target>
<!--
============================================================
_PrepareForReadyToRunCompilation
Prepare build for ReadyToRun compilations. Builds list of assemblies to compile, and computes paths to ReadyToRun compiler bits
============================================================
-->
<UsingTask Condition="'$(Crossgen2TasksOverriden)' != 'true'" TaskName="PrepareForReadyToRunCompilation" AssemblyFile="$(MicrosoftNETBuildTasksAssembly)"/>
<Target Name="_PrepareForReadyToRunCompilation" DependsOnTargets="ResolveReadyToRunCompilers;_ComputeManagedRuntimePackAssemblies;_ComputeAssembliesToPostprocessOnPublish">
<PropertyGroup>
<_ReadyToRunOutputPath>$(IntermediateOutputPath)R2R</_ReadyToRunOutputPath>
</PropertyGroup>
<MakeDir Directories="$(_ReadyToRunOutputPath)" />
<ItemGroup>
<_ReadyToRunImplementationAssemblies Include="@(ResolvedFileToPublish->WithMetadataValue('PostprocessAssembly', 'true'))" />
</ItemGroup>
<!-- Even if app is not self-contained, crossgen requires closure of implementation assemblies. Resolve conflicts
of the runtime pack assets as though we were copying them locally, and add them to the R2R implementation
assembly list. -->
<ItemGroup Condition="'$(SelfContained)' != 'true'">
<_ReadyToRunImplementationAssemblies Include="@(_ManagedRuntimePackAssembly)" ReferenceOnly="true" />
</ItemGroup>
<ResolvePackageFileConflicts Condition="'$(SelfContained)' != 'true'"
ReferenceCopyLocalPaths="@(_ReadyToRunImplementationAssemblies)">
<Output TaskParameter="ReferenceCopyLocalPathsWithoutConflicts" ItemName="_ReadyToRunImplementationAssembliesWithoutConflicts" />
</ResolvePackageFileConflicts>
<ItemGroup Condition="'$(SelfContained)' != 'true'">
<_ReadyToRunImplementationAssemblies Remove="@(_ReadyToRunImplementationAssemblies)" />
<_ReadyToRunImplementationAssemblies Include="@(_ReadyToRunImplementationAssembliesWithoutConflicts)" />
</ItemGroup>
<ItemGroup>
<_ReadyToRunPgoFiles Include="@(PublishReadyToRunPgoFiles)" />
<_ReadyToRunPgoFiles Include="@(RuntimePackAsset)"
Condition="'%(RuntimePackAsset.AssetType)' == 'pgodata' and '%(RuntimePackAsset.Extension)' == '.mibc' and '$(PublishReadyToRunUseRuntimePackOptimizationData)' == 'true'" />
</ItemGroup>
<PrepareForReadyToRunCompilation CrossgenTool="@(CrossgenTool)"
Crossgen2Tool="@(Crossgen2Tool)"
OutputPath="$(_ReadyToRunOutputPath)"
MainAssembly="@(IntermediateAssembly)"
Assemblies="@(_ReadyToRunImplementationAssemblies)"
ExcludeList="@(PublishReadyToRunExclude)"
EmitSymbols="$(PublishReadyToRunEmitSymbols)"
IncludeSymbolsInSingleFile="$(IncludeSymbolsInSingleFile)"
ReadyToRunUseCrossgen2="$(PublishReadyToRunUseCrossgen2)"
Crossgen2Composite="$(PublishReadyToRunComposite)"
PublishReadyToRunCompositeExclusions="@(PublishReadyToRunCompositeExclusions)">
<Output TaskParameter="ReadyToRunCompileList" ItemName="_ReadyToRunCompileList" />
<Output TaskParameter="ReadyToRunSymbolsCompileList" ItemName="_ReadyToRunSymbolsCompileList" />
<Output TaskParameter="ReadyToRunFilesToPublish" ItemName="_ReadyToRunFilesToPublish" />
<Output TaskParameter="ReadyToRunAssembliesToReference" ItemName="_ReadyToRunAssembliesToReference" />
<Output TaskParameter="ReadyToRunCompositeBuildReferences" ItemName="_ReadyToRunCompositeBuildReferences" />
<Output TaskParameter="ReadyToRunCompositeBuildInput" ItemName="_ReadyToRunCompositeBuildInput" />
</PrepareForReadyToRunCompilation>
</Target>
<UsingTask Condition="'$(Crossgen2TasksOverriden)' != 'true'" TaskName="ResolveReadyToRunCompilers" AssemblyFile="$(MicrosoftNETBuildTasksAssembly)" />
<Target Name="ResolveReadyToRunCompilers">
<ResolveReadyToRunCompilers RuntimePacks="@(ResolvedRuntimePack)"
Crossgen2Packs="@(ResolvedCrossgen2Pack)"
TargetingPacks="@(ResolvedTargetingPack)"
RuntimeGraphPath="$(BundledRuntimeIdentifierGraphFile)"
NETCoreSdkRuntimeIdentifier="$(NETCoreSdkRuntimeIdentifier)"
EmitSymbols="$(PublishReadyToRunEmitSymbols)"
ReadyToRunUseCrossgen2="$(PublishReadyToRunUseCrossgen2)"
PerfmapFormatVersion="$(PublishReadyToRunPerfmapFormatVersion)">
<Output TaskParameter="CrossgenTool" ItemName="CrossgenTool" />
<Output TaskParameter="Crossgen2Tool" ItemName="Crossgen2Tool" />
</ResolveReadyToRunCompilers>
</Target>
<!--
============================================================
_CreateR2RImages
Compiles assemblies in the _ReadyToRunCompileList list into ReadyToRun images
============================================================
-->
<UsingTask Condition="'$(Crossgen2TasksOverriden)' != 'true'" TaskName="RunReadyToRunCompiler" AssemblyFile="$(MicrosoftNETBuildTasksAssembly)" />
<Target Name="_CreateR2RImages"
Inputs="@(_ReadyToRunCompileList);@(_ReadyToRunCompositeBuildInput);@(_ReadyToRunPgoFiles)"
Outputs="%(_ReadyToRunCompileList.OutputR2RImage);%(_ReadyToRunCompileList.OutputPDBImage)">
<RunReadyToRunCompiler CrossgenTool="@(CrossgenTool)"
Crossgen2Tool="@(Crossgen2Tool)"
UseCrossgen2="$(PublishReadyToRunUseCrossgen2)"
Crossgen2PgoFiles="@(_ReadyToRunPgoFiles)"
Crossgen2ExtraCommandLineArgs="$(PublishReadyToRunCrossgen2ExtraArgs)"
ImplementationAssemblyReferences="@(_ReadyToRunAssembliesToReference)"
ShowCompilerWarnings="$(PublishReadyToRunShowWarnings)"
CompilationEntry="@(_ReadyToRunCompileList)"
ContinueOnError="ErrorAndContinue"
ReadyToRunCompositeBuildReferences="@(_ReadyToRunCompositeBuildReferences)"
ReadyToRunCompositeBuildInput="@(_ReadyToRunCompositeBuildInput)">
<Output TaskParameter="ExitCode" PropertyName="_ReadyToRunCompilerExitCode" />
<Output TaskParameter="WarningsDetected" PropertyName="_ReadyToRunWarningsDetected" />
</RunReadyToRunCompiler>
<PropertyGroup>
<!-- Use distinct property here as any of the invocations can set it -->
<_ReadyToRunCompilerHasWarnings Condition="'$(_ReadyToRunWarningsDetected)' == 'true'">true</_ReadyToRunCompilerHasWarnings>
</PropertyGroup>
<ItemGroup>
<_ReadyToRunCompilationFailures Condition="'$(_ReadyToRunCompilerExitCode)' != '' And $(_ReadyToRunCompilerExitCode) != 0"
Include="@(_ReadyToRunCompileList)" />
</ItemGroup>
</Target>
<!--
============================================================
_CreateR2RSymbols
Emit native symbols for ReadyToRun images in the _ReadyToRunSymbolsCompileList list
============================================================
-->
<Target Name="_CreateR2RSymbols"
Inputs="@(_ReadyToRunSymbolsCompileList)"
Outputs="%(_ReadyToRunSymbolsCompileList.OutputPDBImage)"
Condition="'$(PublishReadyToRunUseCrossgen2)' != 'true' or '@(Crossgen2Tool -> '%(IsVersion5)')' == 'true'">
<RunReadyToRunCompiler CrossgenTool="@(CrossgenTool)"
Crossgen2Tool="@(Crossgen2Tool)"
UseCrossgen2="$(PublishReadyToRunUseCrossgen2)"
Crossgen2ExtraCommandLineArgs="$(PublishReadyToRunCrossgen2ExtraArgs)"
ImplementationAssemblyReferences="@(_ReadyToRunAssembliesToReference)"
ShowCompilerWarnings="$(PublishReadyToRunShowWarnings)"
CompilationEntry="@(_ReadyToRunSymbolsCompileList)"
ContinueOnError="ErrorAndContinue">
<Output TaskParameter="ExitCode" PropertyName="_ReadyToRunCompilerExitCode" />
<Output TaskParameter="WarningsDetected" PropertyName="_ReadyToRunWarningsDetected" />
</RunReadyToRunCompiler>
<PropertyGroup>
<!-- Use distinct property here as any of the invocations can set it -->
<_ReadyToRunCompilerHasWarnings Condition="'$(_ReadyToRunWarningsDetected)' == 'true'">true</_ReadyToRunCompilerHasWarnings>
</PropertyGroup>
<ItemGroup>
<_ReadyToRunCompilationFailures Condition="'$(_ReadyToRunCompilerExitCode)' != '' And $(_ReadyToRunCompilerExitCode) != 0"
Include="@(_ReadyToRunSymbolsCompileList)" />
</ItemGroup>
</Target>
</Project>