@@ -23,6 +23,7 @@ They run in a context of an inner build with a single $(RuntimeIdentifier).
23
23
-->
24
24
<ImportGroup Condition =" '$(MonoAOTCompilerTasksAssemblyPath)' == '' and '$(AotAssemblies)' == 'true' " >
25
25
<Import Project =" Sdk.props" Sdk =" Microsoft.NET.Runtime.MonoAOTCompiler.Task" />
26
+ <Import Project =" Sdk.props" Sdk =" Microsoft.NET.Runtime.MonoTargets.Task" />
26
27
<Import Project =" Sdk.props" Sdk =" Microsoft.NETCore.App.Runtime.AOT.Cross.android-x86" />
27
28
<Import Project =" Sdk.props" Sdk =" Microsoft.NETCore.App.Runtime.AOT.Cross.android-x64" />
28
29
<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).
39
40
40
41
<Target Name =" _AndroidAot"
41
42
Condition =" '$(AotAssemblies)' == 'true' and '$(RuntimeIdentifier)' != '' "
42
- DependsOnTargets =" _CreatePropertiesCache;_AndroidAotInputs;_AndroidAotCompilation" >
43
+ DependsOnTargets =" _CreatePropertiesCache;_AndroidAotInputs;_AndroidBeforeAotCompilation; _AndroidAotCompilation" >
43
44
<ReadLinesFromFile File =" $(_AndroidStampDirectory)_AndroidAot.stamp" >
44
45
<Output TaskParameter =" Lines" ItemName =" _AotCompiledAssemblies" />
45
46
</ReadLinesFromFile >
@@ -71,9 +72,7 @@ They run in a context of an inner build with a single $(RuntimeIdentifier).
71
72
</ItemGroup >
72
73
</Target >
73
74
74
- <Target Name =" _AndroidAotCompilation"
75
- Inputs =" @(_AndroidAotInputs)"
76
- Outputs =" $(_AndroidStampDirectory)_AndroidAot.stamp" >
75
+ <Target Name =" _AndroidGetAotAssemblies" >
77
76
<ItemGroup >
78
77
<AndroidAotProfile Include =" $(MSBuildThisFileDirectory)dotnet.aotprofile" Condition =" '$(AndroidEnableProfiledAot)' == 'true' and '$(AndroidUseDefaultAotProfile)' != 'false' " />
79
78
</ItemGroup >
@@ -102,11 +101,37 @@ They run in a context of an inner build with a single $(RuntimeIdentifier).
102
101
<ItemGroup Condition =" '$(AndroidExtraAotOptions)' != '' " >
103
102
<_MonoAOTAssemblies Update =" @(_MonoAOTAssemblies)" ProcessArguments =" $(AndroidExtraAotOptions)" />
104
103
</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" >
105
127
<PropertyGroup >
106
128
<_MonoAOTCompilerPath >@(MonoAotCrossCompiler->WithMetadataValue('RuntimeIdentifier', '$(RuntimeIdentifier)'))</_MonoAOTCompilerPath >
107
129
<_LLVMPath Condition =" '$(EnableLLVM)' == 'true' " >$([System.IO.Path]::GetDirectoryName ('$(_MonoAOTCompilerPath)'))</_LLVMPath >
108
130
</PropertyGroup >
109
131
<MakeDir Directories =" $(IntermediateOutputPath)aot\" />
132
+ <ItemGroup >
133
+ <ProfiledAOTProfilePaths Include =" $(MibcFilePath)" />
134
+ </ItemGroup >
110
135
<MonoAOTCompiler
111
136
Triple =" $(_Triple)"
112
137
ToolPrefix =" $(_ToolPrefix)"
@@ -126,6 +151,7 @@ They run in a context of an inner build with a single $(RuntimeIdentifier).
126
151
LdFlags =" $(_LdFlags)"
127
152
CollectTrimmingEligibleMethods =" $(AndroidStripILAfterAOT)"
128
153
TrimmingEligibleMethodsOutputDirectory =" $(IntermediateOutputPath)tokens"
154
+ MibcProfilePath =" @(ProfiledAOTProfilePaths)"
129
155
WorkingDirectory =" $(MSBuildProjectDirectory)"
130
156
AotArguments =" $(AndroidAotAdditionalArguments)" >
131
157
<Output TaskParameter =" CompiledAssemblies" ItemName =" _MonoAOTCompiledAssemblies" />
0 commit comments