|
13 | 13 | the patch in some build orderings. This suppression is harmless since we do fix them. --> |
14 | 14 | <AndroidPageSize16KBCompatibilityCheck>false</AndroidPageSize16KBCompatibilityCheck> |
15 | 15 | </PropertyGroup> |
| 16 | + |
16 | 17 | <!-- Patch NuGet-provided .so files that ship with 4 KB ELF alignment to 16 KB. |
17 | 18 | See build/PatchElfPageSize.targets for details. |
18 | 19 | TODO: Remove once ppy.Veldrid.SPIRV ships 16 KB-aligned native libraries. --> |
19 | 20 | <Import Project="$(MSBuildThisFileDirectory)build\PatchElfPageSize.targets" /> |
| 21 | + |
20 | 22 | <!-- Release-only optimisations: AOT for low-latency gameplay, trimming for smaller APK. |
21 | 23 | Suppress trim analysis warnings because the project uses reflection extensively |
22 | 24 | (Newtonsoft.Json, Realm, AutoMapper, RuntimeBinder). --> |
23 | 25 | <PropertyGroup Condition="'$(Configuration)' == 'Release'"> |
24 | 26 | <RunAOTCompilation>true</RunAOTCompilation> |
25 | 27 | <AndroidEnableProfiledAot>true</AndroidEnableProfiledAot> |
26 | 28 | <SuppressTrimAnalysisWarnings>true</SuppressTrimAnalysisWarnings> |
| 29 | + <!-- Disable ELF patching in Release to prevent signature corruption --> |
| 30 | + <PatchElfPageSizeEnabled>false</PatchElfPageSizeEnabled> |
| 31 | + <PublishTrimmed>true</PublishTrimmed> |
| 32 | + <TrimMode>partial</TrimMode> |
27 | 33 | </PropertyGroup> |
| 34 | + |
| 35 | + <ItemGroup Condition="'$(Configuration)' == 'Release'"> |
| 36 | + <!-- Force Microsoft.CSharp into the trimmer input graph (.NET 10+). --> |
| 37 | + <!-- A bare TrimmerRootAssembly is ignored if the assembly is not in the --> |
| 38 | + <!-- linker's input set; adding this reference ensures it is included. --> |
| 39 | + <PackageReference Include="Microsoft.CSharp" Version="4.7.0" NoWarn="NU1510" /> |
| 40 | + <TrimmerRootAssembly Include="Microsoft.CSharp" RootMode="all" /> |
| 41 | + </ItemGroup> |
| 42 | + |
28 | 43 | <ItemGroup> |
29 | 44 | <!-- IMPORTANT: ppy.osu.Framework.Android v2026.318.0 only ships net8.0-android34.0 assets. |
30 | 45 | NuGet silently falls back to those assets when the app targets net10.0-android (API 36). |
|
33 | 48 | TODO: Remove this comment once ppy.osu.Framework.Android ships net10.0-android assets. --> |
34 | 49 | <PackageReference Include="ppy.osu.Framework.Android" Version="2026.318.0" /> |
35 | 50 | </ItemGroup> |
| 51 | + |
36 | 52 | <PropertyGroup> |
37 | 53 | <!-- Fody does not handle Android build well, and warns when unchanged. |
38 | 54 | Since Realm objects are not declared directly in Android projects, simply disable Fody. --> |
39 | 55 | <DisableFody>true</DisableFody> |
40 | 56 | </PropertyGroup> |
| 57 | + |
| 58 | + <!-- Fix for .NET 10 Android AOT misclassifying non-managed assets in runtime pack. |
| 59 | + This is critical for Android 16 (API 36) which has stricter manifest/parsing rules. --> |
| 60 | + <Target Name="FixRuntimePackAssetTypes" AfterTargets="ResolveRuntimePackAssets;ComputeFilesToPublish;ComputeResolvedFilesToPublishList"> |
| 61 | + <ItemGroup> |
| 62 | + <RuntimePackAsset Update="@(RuntimePackAsset)" Condition="'%(Extension)' != '.dll'"> |
| 63 | + <AssetType>native</AssetType> |
| 64 | + </RuntimePackAsset> |
| 65 | + <ResolvedFileToPublish Update="@(ResolvedFileToPublish)" Condition="'%(Extension)' != '.dll'"> |
| 66 | + <AssetType>native</AssetType> |
| 67 | + </ResolvedFileToPublish> |
| 68 | + </ItemGroup> |
| 69 | + </Target> |
41 | 70 | </Project> |
0 commit comments