Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 28 additions & 5 deletions src/tasks/Crossgen2Tasks/Microsoft.NET.CrossGen.targets
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,9 @@ Copyright (c) .NET Foundation. All rights reserved.
<PublishReadyToRunCrossgen2ExtraArgs Condition="'$(PublishReadyToRunStripDebugInfo)' == 'true' and $(RuntimeIdentifier.StartsWith('browser-'))">$(PublishReadyToRunCrossgen2ExtraArgs);--strip-debug-info</PublishReadyToRunCrossgen2ExtraArgs>
<PublishReadyToRunCrossgen2ExtraArgs Condition="'$(PublishReadyToRunStripDebugInfo)' != 'false' and $(RuntimeIdentifier.StartsWith('wasi-'))">$(PublishReadyToRunCrossgen2ExtraArgs);--strip-debug-info</PublishReadyToRunCrossgen2ExtraArgs>

<!-- Overrides the target's default instruction sets, as IlcInstructionSet does for NativeAOT. -->
<PublishReadyToRunCrossgen2ExtraArgs Condition="'$(PublishReadyToRunInstructionSet)' != ''">$(PublishReadyToRunCrossgen2ExtraArgs);--instruction-set:$(PublishReadyToRunInstructionSet)</PublishReadyToRunCrossgen2ExtraArgs>
<!-- Overrides the target's default instruction sets, as IlcInstructionSet does for NativeAOT. This is kept out of
PublishReadyToRunCrossgen2ExtraArgs so that it still applies when that property is set on the command line. -->
<_ReadyToRunInstructionSetArgs Condition="'$(PublishReadyToRunInstructionSet)' != ''">--instruction-set:$(PublishReadyToRunInstructionSet)</_ReadyToRunInstructionSetArgs>
</PropertyGroup>

<!--
Expand Down Expand Up @@ -501,17 +502,39 @@ Copyright (c) .NET Foundation. All rights reserved.
Compiles assemblies in the _ReadyToRunCompileList list into ReadyToRun images
============================================================
-->

<!-- The compiler arguments are not files, so record a hash of them as an input of _CreateR2RImages.
This runs before _CreateR2RImages so that it sees arguments added by targets declared earlier.
Targets declared later that add arguments should also run before this target, or add their own
inputs to _ReadyToRunCompilerInputs. -->
<Target Name="_CreateReadyToRunCompilerArgumentsCacheFile"
BeforeTargets="_CreateR2RImages">
<PropertyGroup>
Comment thread
lewing marked this conversation as resolved.
Resolved
<_ReadyToRunCompilerArgumentsCacheFile>$(IntermediateOutputPath)$(MSBuildProjectName).ReadyToRunCompilerArguments.cache</_ReadyToRunCompilerArgumentsCacheFile>
</PropertyGroup>

<Hash ItemsToHash="$(PublishReadyToRunCrossgen2ExtraArgs);$(_PublishReadyToRunCrossgen2ExtraArgs);InstructionSet=$(_ReadyToRunInstructionSetArgs);Composite=$(PublishReadyToRunComposite);ContainerFormat=$(PublishReadyToRunContainerFormat);UseCrossgen2=$(PublishReadyToRunUseCrossgen2);PerfmapFormatVersion=$(PublishReadyToRunPerfmapFormatVersion)">
<Output TaskParameter="HashResult" PropertyName="_ReadyToRunCompilerArgumentsHash" />
</Hash>

<WriteLinesToFile Lines="$(_ReadyToRunCompilerArgumentsHash)" File="$(_ReadyToRunCompilerArgumentsCacheFile)" Overwrite="True" WriteOnlyWhenDifferent="True" />

<ItemGroup>
<FileWrites Include="$(_ReadyToRunCompilerArgumentsCacheFile)" />
</ItemGroup>
</Target>

<UsingTask Condition="'$(Crossgen2TasksOverriden)' != 'true'" TaskName="RunReadyToRunCompiler" AssemblyFile="$(MicrosoftNETBuildTasksAssembly)" />
<Target Name="_CreateR2RImages"
Inputs="$(MSBuildAllProjects);@(CrossgenTool);@(Crossgen2Tool);@(_ReadyToRunCompilerInputs);@(_ReadyToRunCompileList);@(_ReadyToRunCompositeBuildInput);@(_ReadyToRunPgoFiles)"
Inputs="$(MSBuildAllProjects);@(CrossgenTool);@(Crossgen2Tool);@(_ReadyToRunCompilerInputs);@(_ReadyToRunCompileList);@(_ReadyToRunCompositeBuildInput);@(_ReadyToRunPgoFiles);$(_ReadyToRunCompilerArgumentsCacheFile)"
Outputs="%(_ReadyToRunCompileList.OutputR2RImage);%(_ReadyToRunCompileList.OutputPDBImage)">

<RunReadyToRunCompiler CrossgenTool="@(CrossgenTool)"
Crossgen2Tool="@(Crossgen2Tool)"
UseCrossgen2="$(PublishReadyToRunUseCrossgen2)"
Crossgen2PgoFiles="@(_ReadyToRunPgoFiles)"
Crossgen2ContainerFormat="$(PublishReadyToRunContainerFormat)"
Crossgen2ExtraCommandLineArgs="$(PublishReadyToRunCrossgen2ExtraArgs);$(_PublishReadyToRunCrossgen2ExtraArgs)"
Crossgen2ExtraCommandLineArgs="$(PublishReadyToRunCrossgen2ExtraArgs);$(_PublishReadyToRunCrossgen2ExtraArgs);$(_ReadyToRunInstructionSetArgs)"
ImplementationAssemblyReferences="@(_ReadyToRunAssembliesToReference)"
ShowCompilerWarnings="$(PublishReadyToRunShowWarnings)"
CompilationEntry="@(_ReadyToRunCompileList)"
Expand Down Expand Up @@ -548,7 +571,7 @@ Copyright (c) .NET Foundation. All rights reserved.
<RunReadyToRunCompiler CrossgenTool="@(CrossgenTool)"
Crossgen2Tool="@(Crossgen2Tool)"
UseCrossgen2="$(PublishReadyToRunUseCrossgen2)"
Crossgen2ExtraCommandLineArgs="$(PublishReadyToRunCrossgen2ExtraArgs);$(_PublishReadyToRunCrossgen2ExtraArgs)"
Crossgen2ExtraCommandLineArgs="$(PublishReadyToRunCrossgen2ExtraArgs);$(_PublishReadyToRunCrossgen2ExtraArgs);$(_ReadyToRunInstructionSetArgs)"
ImplementationAssemblyReferences="@(_ReadyToRunAssembliesToReference)"
ShowCompilerWarnings="$(PublishReadyToRunShowWarnings)"
CompilationEntry="@(_ReadyToRunSymbolsCompileList)"
Expand Down
Loading