Files
dotnet-runtime/eng/codeOptimization.targets
T
Jeremy KoritzinskyandViktor Hofer 5c8055668b Clean up the crossgen2_publish project and local/live packs references (#92826)
* Inline some of the options for the new crossgen2_publish project.

* Resolve TODOs in targetingpacks.targets

* Crossgen1 is long gone. Don't try to discover it in our override targets.

* Move ReadyToRun.targets infra into the shared repo infrastructure and have projects automatically opt-in to it instead of the LKG crossgen2 when they are targeting the live build.

* Remove extraneous property set (the same value is calculated automatically already)

* Remove outdated comment.

* Fix NativeAOT and installer legs

* Condition turning off pack downloads based on opt-in to local pack usage.

* Use the LKG host instead of the 7.0 host as the fallback for NativeExports.

* Apply suggestions from code review

Co-authored-by: Viktor Hofer <viktor.hofer@microsoft.com>

* Remove AdditionalProperties as they aren't needed (global properties on the command line are already transitive)

* PR feedback

* Hook into the targets pipeline to avoid overridding targets for R2Ring projects that reference the live framework packs. Move the "target override" logic back to where we build the runtime pack as that's the only place where we need crossgen2 and can't reference the runtime pack (as we're building it).

* Don't set CoreCLRArtifactsPath manually.

* PR feedback

---------

Co-authored-by: Viktor Hofer <viktor.hofer@microsoft.com>
2023-10-03 10:20:31 +02:00

44 lines
2.6 KiB
XML

<Project>
<PropertyGroup Condition="'$(IsEligibleForNgenOptimization)' == ''">
<IsEligibleForNgenOptimization>true</IsEligibleForNgenOptimization>
<IsEligibleForNgenOptimization Condition="'$(IsReferenceAssemblyProject)' == 'true'">false</IsEligibleForNgenOptimization>
<IsEligibleForNgenOptimization Condition="'$(GeneratePlatformNotSupportedAssembly)' == 'true' or '$(GeneratePlatformNotSupportedAssemblyMessage)' != ''">false</IsEligibleForNgenOptimization>
<!-- There's an issue causing IBCMerge failures because of mismatched MVIDs
across many of our assemblies on Mac, so disable
IBCMerge optimizations on Mac for now to unblock the official build.
See issue https://github.com/dotnet/runtime/issues/33303
-->
<IsEligibleForNgenOptimization Condition="'$(TargetOS)' == 'osx' or '$(TargetsMobile)' == 'true'">false</IsEligibleForNgenOptimization>
</PropertyGroup>
<Target Name="SetApplyNgenOptimization"
Condition="'$(IsEligibleForNgenOptimization)' == 'true'"
BeforeTargets="CoreCompile">
<PropertyGroup>
<IbcOptimizationDataDir Condition="'$(TargetOS)' == 'unix' or '$(TargetOS)' == 'linux'">$(IbcOptimizationDataDir)linux\</IbcOptimizationDataDir>
<IbcOptimizationDataDir Condition="'$(TargetOS)' == 'windows'">$(IbcOptimizationDataDir)windows\</IbcOptimizationDataDir>
</PropertyGroup>
<ItemGroup>
<_optimizationDataAssembly Include="$(IbcOptimizationDataDir)**\$(TargetFileName)" />
</ItemGroup>
<PropertyGroup>
<ApplyNgenOptimization Condition="'@(_optimizationDataAssembly)' != ''">full</ApplyNgenOptimization>
</PropertyGroup>
</Target>
<Target Name="AddReadyToRunPgoOptions" DependsOnTargets="ResolveRuntimeFilesFromLocalBuild" BeforeTargets="ResolveReadyToRunCompilers" Condition="'$(PublishReadyToRun)' == 'true'">
<PropertyGroup>
<!-- Only use mibc files if UsingToolIbcOptimization is false. Allows enabling/disabling using ibc instead of mibc data -->
<IncludeMibcFilesInReadyToRun Condition="'$(UsingToolIbcOptimization)' != 'true' and '$(EnableNgenOptimization)' == 'true' and '$(DotNetBuildFromSource)' != 'true'">true</IncludeMibcFilesInReadyToRun>
</PropertyGroup>
<ItemGroup>
<PublishReadyToRunPgoFiles Condition="'$(IncludeMibcFilesInReadyToRun)' == 'true'" Include="$(CoreCLRArtifactsPath)StandardOptimizationData.mibc"/>
</ItemGroup>
<PropertyGroup Condition="'$(IncludeMibcFilesInReadyToRun)' == 'true'">
<PublishReadyToRunCrossgen2ExtraArgs>$(PublishReadyToRunCrossgen2ExtraArgs);--embed-pgo-data</PublishReadyToRunCrossgen2ExtraArgs>
</PropertyGroup>
</Target>
</Project>