-
Notifications
You must be signed in to change notification settings - Fork 530
/
Microsoft.Android.Sdk.Aot.targets
137 lines (127 loc) · 6.65 KB
/
Microsoft.Android.Sdk.Aot.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
<!--
***********************************************************************************************
Microsoft.Android.Sdk.Aot.targets
MSBuild targets for .NET 6+ AOT support.
For <MonoAOTCompiler/> usage, see:
* https://github.com/dotnet/runtime/blob/15dec9a2aa5a4236d6ba70de2e9c146867b9d2e0/src/tasks/AotCompilerTask/MonoAOTCompiler.cs
* https://github.com/dotnet/runtime/blob/15dec9a2aa5a4236d6ba70de2e9c146867b9d2e0/src/mono/netcore/nuget/Microsoft.NET.Runtime.MonoAOTCompiler.Task/README.md
These targets are running within the _ComputeFilesToPublishForRuntimeIdentifiers target.
They run in a context of an inner build with a single $(RuntimeIdentifier).
***********************************************************************************************
-->
<Project>
<!--
NOTE: currently, the only way to allow $(AotAssemblies) in
.csproj files is to import these in the Android workload
when $(MonoAOTCompilerTasksAssemblyPath) is blank:
https://github.com/dotnet/runtime/blob/69711860262e44458bbe276393ea3eb9f7a2192a/src/mono/nuget/Microsoft.NET.Workload.Mono.Toolchain.Manifest/WorkloadManifest.targets.in#L20-L25
-->
<ImportGroup Condition=" '$(MonoAOTCompilerTasksAssemblyPath)' == '' and '$(AotAssemblies)' == 'true' ">
<Import Project="Sdk.props" Sdk="Microsoft.NET.Runtime.MonoAOTCompiler.Task" />
<Import Project="Sdk.props" Sdk="Microsoft.NETCore.App.Runtime.AOT.Cross.android-x86" />
<Import Project="Sdk.props" Sdk="Microsoft.NETCore.App.Runtime.AOT.Cross.android-x64" />
<Import Project="Sdk.props" Sdk="Microsoft.NETCore.App.Runtime.AOT.Cross.android-arm" />
<Import Project="Sdk.props" Sdk="Microsoft.NETCore.App.Runtime.AOT.Cross.android-arm64" />
</ImportGroup>
<UsingTask TaskName="Xamarin.Android.Tasks.GetAotAssemblies" AssemblyFile="$(_XamarinAndroidBuildTasksAssembly)" />
<Target Name="_AndroidAotInputs">
<ItemGroup>
<_AndroidAotInputs Include="@(ResolvedFileToPublish)" Condition=" '%(ResolvedFileToPublish.Extension)' == '.dll' and '%(ResolvedFileToPublish.AssetType)' != 'resources' " />
</ItemGroup>
</Target>
<Target Name="_AndroidAot"
Condition=" '$(AotAssemblies)' == 'true' and '$(RuntimeIdentifier)' != '' "
DependsOnTargets="_CreatePropertiesCache;_AndroidAotInputs;_AndroidAotCompilation">
<ReadLinesFromFile File="$(_AndroidStampDirectory)_AndroidAot.stamp">
<Output TaskParameter="Lines" ItemName="_AotCompiledAssemblies" />
</ReadLinesFromFile>
<ItemGroup>
<FileWrites Include="@(_AotCompiledAssemblies)" />
<ResolvedFileToPublish
Include="@(_AotCompiledAssemblies)"
Condition=" '$(_AndroidUseMarshalMethods)' != 'True' "
ArchiveFileName="libaot-$([System.IO.Path]::GetFileNameWithoutExtension('%(_AotCompiledAssemblies.Identity)')).so"
/>
<_AotResolvedFileToPublish
Include="@(_AotCompiledAssemblies)"
Condition=" '$(_AndroidUseMarshalMethods)' == 'True' "
ArchiveFileName="libaot-$([System.IO.Path]::GetFileNameWithoutExtension('%(_AotCompiledAssemblies.Identity)')).so"
/>
</ItemGroup>
</Target>
<Target Name="_AndroidAotAndComputeFilesToPublishForRuntimeIdentifiers"
DependsOnTargets="_AndroidAot"
Returns="@(_AotResolvedFileToPublish)">
<ItemGroup>
<_AotResolvedFileToPublish Remove="@(_SourceItemsToCopyToPublishDirectory)" />
<_AotResolvedFileToPublish
Condition=" '%(_AotResolvedFileToPublish.RuntimeIdentifier)' == '' "
Update="@(_AotResolvedFileToPublish)"
RuntimeIdentifier="$(RuntimeIdentifier)"
/>
</ItemGroup>
</Target>
<Target Name="_AndroidAotCompilation"
Inputs="@(_AndroidAotInputs)"
Outputs="$(_AndroidStampDirectory)_AndroidAot.stamp">
<ItemGroup>
<AndroidAotProfile Include="$(MSBuildThisFileDirectory)dotnet.aotprofile" Condition=" '$(AndroidEnableProfiledAot)' == 'true' and '$(AndroidUseDefaultAotProfile)' != 'false' " />
</ItemGroup>
<GetAotAssemblies
AndroidAotMode="$(AndroidAotMode)"
AndroidNdkDirectory="$(AndroidNdkDirectory)"
AndroidBinUtilsDirectory="$(AndroidBinUtilsDirectory)"
AndroidApiLevel="$(_AndroidApiLevel)"
MinimumSupportedApiLevel="$(AndroidMinimumSupportedApiLevel)"
AndroidSequencePointsMode="$(_SequencePointsMode)"
TargetName="$(TargetName)"
ResolvedAssemblies="@(_AndroidAotInputs)"
AotOutputDirectory="$(_AndroidAotBinDirectory)"
RuntimeIdentifier="$(RuntimeIdentifier)"
EnableLLVM="$(EnableLLVM)"
Profiles="@(AndroidAotProfile)"
StripLibraries="$(_AndroidAotStripLibraries)">
<Output PropertyName="_Triple" TaskParameter="Triple" />
<Output PropertyName="_ToolPrefix" TaskParameter="ToolPrefix" />
<Output PropertyName="_MsymPath" TaskParameter="MsymPath" />
<Output PropertyName="_LdName" TaskParameter="LdName" />
<Output PropertyName="_LdFlags" TaskParameter="LdFlags" />
<Output ItemName="_MonoAOTAssemblies" TaskParameter="ResolvedAssemblies" />
</GetAotAssemblies>
<ItemGroup Condition=" '$(AndroidExtraAotOptions)' != '' ">
<_MonoAOTAssemblies Update="@(_MonoAOTAssemblies)" ProcessArguments="$(AndroidExtraAotOptions)" />
</ItemGroup>
<PropertyGroup>
<_MonoAOTCompilerPath>@(MonoAotCrossCompiler->WithMetadataValue('RuntimeIdentifier', '$(RuntimeIdentifier)'))</_MonoAOTCompilerPath>
<_LLVMPath Condition=" '$(EnableLLVM)' == 'true' ">$([System.IO.Path]::GetDirectoryName ('$(_MonoAOTCompilerPath)'))</_LLVMPath>
</PropertyGroup>
<MakeDir Directories="$(IntermediateOutputPath)aot\" />
<MonoAOTCompiler
Triple="$(_Triple)"
ToolPrefix="$(_ToolPrefix)"
MsymPath="$(_MsymPath)"
Assemblies="@(_MonoAOTAssemblies)"
CompilerBinaryPath="$(_MonoAOTCompilerPath)"
DisableParallelAot="$(_DisableParallelAot)"
IntermediateOutputPath="$(IntermediateOutputPath)"
LibraryFormat="So"
Mode="$(AndroidAotMode)"
OutputDir="$(IntermediateOutputPath)aot\"
OutputType="Library"
UseAotDataFile="false"
UseLLVM="$(EnableLLVM)"
LLVMPath="$(_LLVMPath)"
LdName="$(_LdName)"
LdFlags="$(_LdFlags)"
WorkingDirectory="$(MSBuildProjectDirectory)"
AotArguments="$(AndroidAotAdditionalArguments)">
<Output TaskParameter="CompiledAssemblies" ItemName="_MonoAOTCompiledAssemblies" />
<Output TaskParameter="FileWrites" ItemName="FileWrites" />
</MonoAOTCompiler>
<WriteLinesToFile
File="$(_AndroidStampDirectory)_AndroidAot.stamp"
Lines="@(_MonoAOTCompiledAssemblies->'%(LibraryFile)')"
Overwrite="true"
/>
</Target>
</Project>