|
1 | 1 | <Project>
|
2 |
| - <UsingTask TaskName="AndroidAppBuilderTask" |
3 |
| - AssemblyFile="$(AndroidAppBuilderTasksAssemblyPath)" /> |
4 |
| - |
5 | 2 | <PropertyGroup>
|
| 3 | + <AndroidGenerateAppBundle Condition="'$(AndroidGenerateAppBundle)' == '' and '$(GenerateAppBundle)' != ''">$(GenerateAppBundle)</AndroidGenerateAppBundle> |
6 | 4 | <AndroidGenerateAppBundle Condition="'$(AndroidGenerateAppBundle)' == ''">true</AndroidGenerateAppBundle>
|
7 | 5 | <!-- Unable to properly integrate nativelib into app build, so not supported for now. -->
|
8 | 6 | <AndroidGenerateAppBundle Condition="'$(_IsLibraryMode)' == 'true'">false</AndroidGenerateAppBundle>
|
| 7 | + |
| 8 | + <EnableDefaultAssembliesToBundle Condition="'$(EnableDefaultAssembliesToBundle)' == ''">false</EnableDefaultAssembliesToBundle> |
9 | 9 | </PropertyGroup>
|
10 | 10 |
|
11 |
| - <Target Name="AndroidBuildApp" AfterTargets="$(AndroidBuildAppAfterThisTarget)" /> |
| 11 | + <UsingTask Condition="'$(AndroidGenerateAppBundle)' == 'true'" |
| 12 | + TaskName="AndroidAppBuilderTask" |
| 13 | + AssemblyFile="$(AndroidAppBuilderTasksAssemblyPath)" /> |
| 14 | + |
| 15 | + <Target Name="AndroidBuild" AfterTargets="$(AndroidBuildAfterThisTarget)" /> |
12 | 16 |
|
13 |
| - <Target Name="_AndroidCoreBuild" BeforeTargets="AndroidBuildApp" DependsOnTargets="$(AndroidBuildAppDependsOn)" /> |
| 17 | + <Target Name="_AndroidCoreBuild" BeforeTargets="AndroidBuild" DependsOnTargets="$(AndroidBuildDependsOn)" /> |
14 | 18 |
|
15 | 19 | <Target Name="_InitializeCommonProperties">
|
16 | 20 | <Error Condition="'$(IntermediateOutputPath)' == ''" Text="%24(IntermediateOutputPath) property needs to be set" />
|
17 | 21 |
|
18 | 22 | <PropertyGroup>
|
19 | 23 | <_MobileIntermediateOutputPath>$([MSBuild]::NormalizeDirectory($(IntermediateOutputPath), 'mobile'))</_MobileIntermediateOutputPath>
|
| 24 | + <TargetArchitecture Condition="'$(TargetArchitecture)' == ''">$(PlatformTarget)</TargetArchitecture> |
20 | 25 | </PropertyGroup>
|
21 | 26 |
|
22 | 27 | <PropertyGroup>
|
23 |
| - <BundleDir>$(AndroidAppBundleDir)</BundleDir> |
24 |
| - <_MonoHeaderPath>$(MicrosoftNetCoreAppRuntimePackNativeDir)include\mono-2.0</_MonoHeaderPath> |
25 |
| - <_AotModuleTablePath>$(AndroidAppBundleDir)\modules.c</_AotModuleTablePath> |
| 28 | + <MicrosoftNetCoreAppRuntimePackDir Condition="'$(MicrosoftNetCoreAppRuntimePackDir)' == ''">%(ResolvedRuntimePack.PackageDirectory)</MicrosoftNetCoreAppRuntimePackDir> |
| 29 | + <MicrosoftNetCoreAppRuntimePackRidDir Condition="'$(MicrosoftNetCoreAppRuntimePackRidDir)' == ''">$([MSBuild]::NormalizeDirectory($(MicrosoftNetCoreAppRuntimePackDir), 'runtimes', '$(TargetOS)-$(TargetArchitecture)'))</MicrosoftNetCoreAppRuntimePackRidDir> |
| 30 | + <MicrosoftNetCoreAppRuntimePackRidDir>$([MSBuild]::NormalizeDirectory($(MicrosoftNetCoreAppRuntimePackRidDir)))</MicrosoftNetCoreAppRuntimePackRidDir> |
| 31 | + <MicrosoftNetCoreAppRuntimePackRidNativeDir>$([MSBuild]::NormalizeDirectory($(MicrosoftNetCoreAppRuntimePackRidDir), 'native'))</MicrosoftNetCoreAppRuntimePackRidNativeDir> |
| 32 | + </PropertyGroup> |
| 33 | + |
| 34 | + <PropertyGroup> |
| 35 | + <AndroidBuildDir Condition="'$(AndroidBuildDir)' == ''">$([MSBuild]::NormalizeDirectory($(PublishDir)))</AndroidBuildDir> |
| 36 | + <AndroidBundleDir Condition="'$(AndroidBundleDir)' == ''">$([MSBuild]::NormalizeDirectory('$(OutDir)', 'Bundle'))</AndroidBundleDir> |
| 37 | + |
| 38 | + <BundleDir>$(AndroidBundleDir)</BundleDir> |
| 39 | + <_MonoHeaderPath>$([MSBuild]::NormalizeDirectory($(MicrosoftNetCoreAppRuntimePackRidNativeDir), 'include', 'mono-2.0'))</_MonoHeaderPath> |
| 40 | + <_AotModuleTablePath>$(AndroidBundleDir)\modules.c</_AotModuleTablePath> |
26 | 41 | </PropertyGroup>
|
27 | 42 |
|
28 | 43 | <PropertyGroup>
|
|
40 | 55 | Include="$(RuntimeComponents)" />
|
41 | 56 |
|
42 | 57 | <_RuntimeLibraries
|
43 |
| - Include="$(AndroidAppDir)\*-stub-static.a" /> |
| 58 | + Include="$(AndroidBuildDir)\*-stub-static.a" /> |
44 | 59 | <_RuntimeLibraries
|
45 |
| - Include="$(AndroidAppDir)\*.a" |
46 |
| - Exclude="$(AndroidAppDir)\*-static.a" /> |
| 60 | + Include="$(AndroidBuildDir)\*.a" |
| 61 | + Exclude="$(AndroidBuildDir)\*-static.a" /> |
47 | 62 |
|
48 |
| - <_RuntimeLibraries Remove="$(AndroidAppDir)\libmono-component-%(_UsedComponents.Identity)-stub-static.a" /> |
49 |
| - <_RuntimeLibraries Include="$(AndroidAppDir)\libmono-component-%(_UsedComponents.Identity)-static.a" /> |
| 63 | + <_RuntimeLibraries Remove="$(AndroidBuildDir)\libmono-component-%(_UsedComponents.Identity)-stub-static.a" /> |
| 64 | + <_RuntimeLibraries Include="$(AndroidBuildDir)\libmono-component-%(_UsedComponents.Identity)-static.a" /> |
50 | 65 | </ItemGroup>
|
51 | 66 | </Target>
|
52 | 67 |
|
53 |
| - <Target Name="_BeforeAndroidBuildApp"> |
| 68 | + <Target Name="_BeforeAndroidBuild"> |
54 | 69 | <PropertyGroup>
|
55 |
| - <_AndroidRuntimeConfigFilePath Condition="'$(_AndroidRuntimeConfigFilePath)' == ''">$([MSBuild]::NormalizePath($(AndroidAppDir), '$(AssemblyName).runtimeconfig.json'))</_AndroidRuntimeConfigFilePath> |
56 |
| - <_ParsedRuntimeConfigFilePath Condition="'$(_ParsedRuntimeConfigFilePath)' == ''">$([MSBuild]::NormalizePath($(AndroidAppDir), 'runtimeconfig.bin'))</_ParsedRuntimeConfigFilePath> |
| 70 | + <_AndroidRuntimeConfigFilePath Condition="'$(_AndroidRuntimeConfigFilePath)' == ''">$([MSBuild]::NormalizePath($(AndroidBuildDir), '$(AssemblyName).runtimeconfig.json'))</_AndroidRuntimeConfigFilePath> |
| 71 | + <_ParsedRuntimeConfigFilePath Condition="'$(_ParsedRuntimeConfigFilePath)' == ''">$([MSBuild]::NormalizePath($(AndroidBuildDir), 'runtimeconfig.bin'))</_ParsedRuntimeConfigFilePath> |
57 | 72 | </PropertyGroup>
|
58 | 73 |
|
59 |
| - <RemoveDir Directories="$(AndroidAppBundleDir)" /> |
| 74 | + <RemoveDir Directories="$(AndroidBundleDir)" /> |
60 | 75 | </Target>
|
61 | 76 |
|
62 | 77 | <Target Name="_AndroidResolveReferences">
|
| 78 | + <ItemGroup Condition="'$(EnableDefaultAssembliesToBundle)' == 'true'"> |
| 79 | + <AndroidAssembliesToBundle Remove="@(AndroidAssembliesToBundle)" /> |
| 80 | + <AndroidAssembliesToBundle Include="$(PublishDir)\**\*.dll" /> |
| 81 | + </ItemGroup> |
| 82 | + |
63 | 83 | <ItemGroup>
|
64 |
| - <AppAssembliesInternal Remove="@(AppAssembliesInternal)" /> |
65 |
| - <AppAssembliesInternal Include="@(AndroidAssembliesToBundle)"> |
| 84 | + <_AssembliesToBundleInternal Remove="@(_AssembliesToBundleInternal)" /> |
| 85 | + <_AssembliesToBundleInternal Include="@(AndroidAssembliesToBundle)"> |
66 | 86 | <_InternalForceInterpret>%(AndroidAssembliesToBundle._InternalForceInterpret)</_InternalForceInterpret>
|
67 | 87 | <_IsNative>%(AndroidAssembliesToBundle._IsNative)</_IsNative>
|
68 |
| - </AppAssembliesInternal> |
| 88 | + </_AssembliesToBundleInternal> |
69 | 89 | </ItemGroup>
|
70 | 90 | </Target>
|
71 | 91 |
|
72 |
| - <Target Name="_AndroidBeforeAotCompileApp"> |
| 92 | + <Target Name="_AndroidBeforeAotCompile"> |
73 | 93 | <PropertyGroup>
|
74 | 94 | <_AOTMode Condition="'$(UseMonoJustInterp)' != 'true'">Normal</_AOTMode>
|
75 | 95 | <_AOTMode Condition="'$(UseMonoJustInterp)' == 'true'">JustInterp</_AOTMode>
|
|
107 | 127 | </PropertyGroup>
|
108 | 128 |
|
109 | 129 | <ItemGroup>
|
110 |
| - <_AotInputAssemblies Include="@(AppAssembliesInternal)" |
111 |
| - Condition="'%(AppAssembliesInternal._InternalForceInterpret)' != 'true'"> |
| 130 | + <_AotInputAssemblies Include="@(_AssembliesToBundleInternal)" |
| 131 | + Condition="'%(_AssembliesToBundleInternal._InternalForceInterpret)' != 'true'"> |
112 | 132 | <AotArguments>$(AotArguments)</AotArguments>
|
113 | 133 | <ProcessArguments>$(ProcessArguments)</ProcessArguments>
|
114 | 134 | </_AotInputAssemblies>
|
115 | 135 |
|
116 |
| - <_AOT_InternalForceInterpretAssemblies Include="@(AppAssembliesInternal->WithMetadataValue('_InternalForceInterpret', 'true'))" /> |
117 |
| - <AppAssembliesInternal Remove="@(AppAssembliesInternal)" /> |
| 136 | + <_AOT_InternalForceInterpretAssemblies Include="@(_AssembliesToBundleInternal->WithMetadataValue('_InternalForceInterpret', 'true'))" /> |
| 137 | + <_AssembliesToBundleInternal Remove="@(_AssembliesToBundleInternal)" /> |
118 | 138 | </ItemGroup>
|
119 | 139 |
|
120 | 140 | <MakeDir Directories="$(_MobileIntermediateOutputPath)" />
|
121 | 141 | </Target>
|
122 | 142 |
|
123 | 143 | <Target Name="_AndroidPrepareProfiledAot"
|
124 | 144 | Condition="'$(NetTraceFilePath)' != '' and '$(ForceFullAOT)' != 'true'"
|
125 |
| - DependsOnTargets="_AndroidBeforeAotCompileApp"> |
| 145 | + DependsOnTargets="_AndroidBeforeAotCompile"> |
126 | 146 | <PropertyGroup>
|
127 | 147 | <_ToolPath>$([System.IO.Path]::GetDirectoryName('$(DotnetPgoToolPath)'))</_ToolPath>
|
128 | 148 | </PropertyGroup>
|
|
136 | 156 | </NetTraceToMibcConverter>
|
137 | 157 | </Target>
|
138 | 158 |
|
139 |
| - <Target Name="_AndroidAotCompileApp" |
| 159 | + <Target Name="_AndroidAotCompile" |
140 | 160 | Condition="'$(RunAOTCompilation)' == 'true'"
|
141 |
| - DependsOnTargets="_AndroidBeforeAotCompileApp"> |
| 161 | + DependsOnTargets="_AndroidBeforeAotCompile"> |
142 | 162 |
|
143 | 163 | <PropertyGroup Condition="'$(_IsLibraryMode)' == 'true'">
|
144 | 164 | <_EnableUnmanagedCallersOnlyMethodsExport>true</_EnableUnmanagedCallersOnlyMethodsExport>
|
|
175 | 195 | OutputType="AsmOnly"
|
176 | 196 | UseAotDataFile="$(_UseAotDataFile)"
|
177 | 197 | UseLLVM="$(MonoEnableLLVM)">
|
178 |
| - <Output TaskParameter="CompiledAssemblies" ItemName="AppAssembliesInternal" /> |
| 198 | + <Output TaskParameter="CompiledAssemblies" ItemName="_AssembliesToBundleInternal" /> |
179 | 199 | </MonoAOTCompiler>
|
180 | 200 |
|
181 | 201 | <ItemGroup>
|
182 |
| - <AppAssembliesInternal Include="@(_AOT_InternalForceInterpretAssemblies)" /> |
| 202 | + <_AssembliesToBundleInternal Include="@(_AOT_InternalForceInterpretAssemblies)" /> |
183 | 203 | </ItemGroup>
|
184 | 204 | </Target>
|
185 | 205 |
|
|
194 | 214 | </ItemGroup>
|
195 | 215 |
|
196 | 216 | <AndroidAppBuilderTask
|
197 |
| - AppDir="$(AndroidAppDir)" |
198 |
| - Assemblies="@(AppAssembliesInternal)" |
| 217 | + AppDir="$(AndroidBuildDir)" |
| 218 | + Assemblies="@(_AssembliesToBundleInternal)" |
199 | 219 | DiagnosticPorts="$(DiagnosticPorts)"
|
200 | 220 | EnvironmentVariables="@(AndroidEnv)"
|
201 | 221 | ExtraLinkerArguments="@(ExtraAppLinkerArgs)"
|
|
206 | 226 | MainLibraryFileName="$(MainLibraryFileName)"
|
207 | 227 | MonoRuntimeHeaders="$(_MonoHeaderPath)"
|
208 | 228 | NativeDependencies="@(_NativeDependencies)"
|
209 |
| - OutputDir="$(AndroidAppBundleDir)" |
| 229 | + OutputDir="$(AndroidBundleDir)" |
210 | 230 | ProjectName="$(AssemblyName)"
|
211 | 231 | RuntimeComponents="$(RuntimeComponents)"
|
212 | 232 | RuntimeIdentifier="$(RuntimeIdentifier)"
|
|
220 | 240 | <Message Importance="High" Text="Apk: $(ApkBundlePath)"/>
|
221 | 241 | </Target>
|
222 | 242 |
|
223 |
| - <Target Name="_AfterAndroidBuildApp"> |
| 243 | + <Target Name="_AfterAndroidBuild"> |
224 | 244 |
|
225 | 245 | </Target>
|
226 | 246 |
|
|
0 commit comments