@@ -23,6 +23,7 @@ They run in a context of an inner build with a single $(RuntimeIdentifier).
2323 -->
2424 <ImportGroup Condition =" '$(MonoAOTCompilerTasksAssemblyPath)' == '' and '$(AotAssemblies)' == 'true' " >
2525 <Import Project =" Sdk.props" Sdk =" Microsoft.NET.Runtime.MonoAOTCompiler.Task" />
26+ <Import Project =" Sdk.props" Sdk =" Microsoft.NET.Runtime.MonoTargets.Task" />
2627 <Import Project =" Sdk.props" Sdk =" Microsoft.NETCore.App.Runtime.AOT.Cross.android-x86" />
2728 <Import Project =" Sdk.props" Sdk =" Microsoft.NETCore.App.Runtime.AOT.Cross.android-x64" />
2829 <Import Project =" Sdk.props" Sdk =" Microsoft.NETCore.App.Runtime.AOT.Cross.android-arm" />
@@ -39,7 +40,7 @@ They run in a context of an inner build with a single $(RuntimeIdentifier).
3940
4041 <Target Name =" _AndroidAot"
4142 Condition =" '$(AotAssemblies)' == 'true' and '$(RuntimeIdentifier)' != '' "
42- DependsOnTargets =" _CreatePropertiesCache;_AndroidAotInputs;_AndroidAotCompilation" >
43+ DependsOnTargets =" _CreatePropertiesCache;_AndroidAotInputs;_AndroidBeforeAotCompilation; _AndroidAotCompilation" >
4344 <ReadLinesFromFile File =" $(_AndroidStampDirectory)_AndroidAot.stamp" >
4445 <Output TaskParameter =" Lines" ItemName =" _AotCompiledAssemblies" />
4546 </ReadLinesFromFile >
@@ -71,9 +72,7 @@ They run in a context of an inner build with a single $(RuntimeIdentifier).
7172 </ItemGroup >
7273 </Target >
7374
74- <Target Name =" _AndroidAotCompilation"
75- Inputs =" @(_AndroidAotInputs)"
76- Outputs =" $(_AndroidStampDirectory)_AndroidAot.stamp" >
75+ <Target Name =" _AndroidGetAotAssemblies" >
7776 <ItemGroup >
7877 <AndroidAotProfile Include =" $(MSBuildThisFileDirectory)dotnet.aotprofile" Condition =" '$(AndroidEnableProfiledAot)' == 'true' and '$(AndroidUseDefaultAotProfile)' != 'false' " />
7978 </ItemGroup >
@@ -102,11 +101,37 @@ They run in a context of an inner build with a single $(RuntimeIdentifier).
102101 <ItemGroup Condition =" '$(AndroidExtraAotOptions)' != '' " >
103102 <_MonoAOTAssemblies Update =" @(_MonoAOTAssemblies)" ProcessArguments =" $(AndroidExtraAotOptions)" />
104103 </ItemGroup >
104+ </Target >
105+
106+ <Target Name =" _AndroidPrepareProfiledAot"
107+ Condition =" '$(AndroidEnableProfiledAot)' == 'true' and '$(NetTraceFilePath)' != '' and '$(DotnetPgoToolPath)' != '' and '$(AotAssemblies)' == 'true' and '$(AndroidAotMode)' != 'Full'" >
108+ <PropertyGroup >
109+ <_ToolPath >$([System.IO.Path]::GetDirectoryName('$(DotnetPgoToolPath)'))</_ToolPath >
110+ </PropertyGroup >
111+
112+ <NetTraceToMibcConverter
113+ ToolPath =" $(_ToolPath)"
114+ Assemblies =" @(_MonoAOTAssemblies)"
115+ NetTraceFilePath =" $(NetTraceFilePath)"
116+ OutputDir =" $(IntermediateOutputPath)" >
117+ <Output TaskParameter =" MibcFilePath" ItemName =" ProfiledAOTProfilePaths" />
118+ </NetTraceToMibcConverter >
119+ </Target >
120+
121+ <Target Name =" _AndroidBeforeAotCompilation" DependsOnTargets =" _AndroidGetAotAssemblies;_AndroidPrepareProfiledAot" />
122+
123+ <Target Name =" _AndroidAotCompilation"
124+ Inputs =" @(_AndroidAotInputs)"
125+ Outputs =" $(_AndroidStampDirectory)_AndroidAot.stamp"
126+ DependsOnTargets =" _AndroidBeforeAotCompilation" >
105127 <PropertyGroup >
106128 <_MonoAOTCompilerPath >@(MonoAotCrossCompiler->WithMetadataValue('RuntimeIdentifier', '$(RuntimeIdentifier)'))</_MonoAOTCompilerPath >
107129 <_LLVMPath Condition =" '$(EnableLLVM)' == 'true' " >$([System.IO.Path]::GetDirectoryName ('$(_MonoAOTCompilerPath)'))</_LLVMPath >
108130 </PropertyGroup >
109131 <MakeDir Directories =" $(IntermediateOutputPath)aot\" />
132+ <ItemGroup >
133+ <ProfiledAOTProfilePaths Include =" $(MibcFilePath)" />
134+ </ItemGroup >
110135 <MonoAOTCompiler
111136 Triple =" $(_Triple)"
112137 ToolPrefix =" $(_ToolPrefix)"
@@ -126,6 +151,7 @@ They run in a context of an inner build with a single $(RuntimeIdentifier).
126151 LdFlags =" $(_LdFlags)"
127152 CollectTrimmingEligibleMethods =" $(AndroidStripILAfterAOT)"
128153 TrimmingEligibleMethodsOutputDirectory =" $(IntermediateOutputPath)tokens"
154+ MibcProfilePath =" @(ProfiledAOTProfilePaths)"
129155 WorkingDirectory =" $(MSBuildProjectDirectory)"
130156 AotArguments =" $(AndroidAotAdditionalArguments)" >
131157 <Output TaskParameter =" CompiledAssemblies" ItemName =" _MonoAOTCompiledAssemblies" />
0 commit comments