forked from ppy/osu
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathosu.Android.props
More file actions
103 lines (97 loc) · 6.34 KB
/
Copy pathosu.Android.props
File metadata and controls
103 lines (97 loc) · 6.34 KB
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
<Project>
<PropertyGroup>
<SupportedOSPlatformVersion>33.0</SupportedOSPlatformVersion>
<!-- arm64-v8a only. Modern Android devices are 99%+ arm64; 32-bit arm32 (armeabi-v7a)
adds ~200 MB of duplicate native libraries for negligible device coverage.
x86 was already removed — modern x86_64 emulators run arm64 via translation. -->
<RuntimeIdentifiers>android-arm64</RuntimeIdentifiers>
<AndroidPackageFormat>apk</AndroidPackageFormat>
<!-- CJK and Mideast encodings are needed for song metadata display.
Rare covers supplementary Unicode blocks. West is the default Latin set. -->
<MandroidI18n>CJK;Mideast;Rare;West;Other;</MandroidI18n>
<AndroidHttpClientHandlerType>Xamarin.Android.Net.AndroidMessageHandler</AndroidHttpClientHandlerType>
<!-- NullabilityInfoContextSupport is disabled by default for Android -->
<NullabilityInfoContextSupport>true</NullabilityInfoContextSupport>
<EmbedAssembliesIntoApk>true</EmbedAssembliesIntoApk>
<!-- Enable optimized marshal methods for faster managed↔native interop.
.NET 10 generates efficient bridging code at build time instead of the
slower runtime-generated trampolines. -->
<AndroidEnableMarshalMethods>true</AndroidEnableMarshalMethods>
<!-- Suppress XA0141 page-size warnings. ELF patching is disabled for all configurations
(see PatchElfPageSizeEnabled below) to prevent APK signature corruption.
The XA0141 warning is therefore expected and harmless.
AndroidPageSize16KBCompatibilityCheck=false should suppress the check, but Android SDK
36.1.53 still emits XA0141 in some build orderings, so we also add it to NoWarn. -->
<AndroidPageSize16KBCompatibilityCheck>false</AndroidPageSize16KBCompatibilityCheck>
<NoWarn>$(NoWarn);XA0141</NoWarn>
<!-- Disable ELF alignment patching for ALL configurations.
The custom PatchElfPageSize task can run concurrently with the Android packaging step
because MSBuild's BeforeTargets="Build" fires for every ABI sub-build, which often
overlaps with the main APK assembly pass. Patching .so files in the NuGet cache while
they are being read and packed into the APK can corrupt the ZIP/signing structures,
producing an APK with a null certificate array (INSTALL_PARSE_FAILED_NO_CERTIFICATES).
TODO: Re-enable once ppy.Veldrid.SPIRV ships 16 KB-aligned native libraries so no
patching is needed at all, or once the build targets are re-sequenced so
patching always completes before packaging starts. -->
<PatchElfPageSizeEnabled>false</PatchElfPageSizeEnabled>
</PropertyGroup>
<!-- Patch NuGet-provided .so files that ship with 4 KB ELF alignment to 16 KB.
See build/PatchElfPageSize.targets for details.
TODO: Remove once ppy.Veldrid.SPIRV ships 16 KB-aligned native libraries. -->
<Import Project="$(MSBuildThisFileDirectory)build\PatchElfPageSize.targets" />
<!-- Release-only optimisations: AOT for low-latency gameplay, trimming for smaller APK.
Suppress trim analysis warnings because the project uses reflection extensively
(Newtonsoft.Json, Realm, AutoMapper, RuntimeBinder). -->
<PropertyGroup Condition="'$(Configuration)' == 'Release'">
<RunAOTCompilation>true</RunAOTCompilation>
<AndroidEnableProfiledAot>true</AndroidEnableProfiledAot>
<!-- Use LLVM backend for AOT — produces higher-quality native code than the default
Mono AOT compiler. Critical for a rhythm game where frame-level timing matters. -->
<EnableLLVM>true</EnableLLVM>
<SuppressTrimAnalysisWarnings>true</SuppressTrimAnalysisWarnings>
<PublishTrimmed>true</PublishTrimmed>
<TrimMode>partial</TrimMode>
<!-- Strip IL bodies from AOT-compiled assemblies. The runtime uses the native .so code
instead, and IL is only kept for non-AOT methods. This can save 20-30 MB. -->
<AndroidStripILAfterAOT>true</AndroidStripILAfterAOT>
<!-- Compress managed assemblies inside the APK (LZ4). Android extracts them on first run
but the download/APK size is significantly smaller. -->
<AndroidEnableAssemblyCompression>true</AndroidEnableAssemblyCompression>
<!-- Don't ship PDB files in the APK — they add ~15-20 MB.
Stack traces still work via embedded metadata. -->
<DebugType>none</DebugType>
<DebugSymbols>false</DebugSymbols>
</PropertyGroup>
<ItemGroup Condition="'$(Configuration)' == 'Release'">
<!-- Force Microsoft.CSharp into the trimmer input graph (.NET 10+). -->
<!-- A bare TrimmerRootAssembly is ignored if the assembly is not in the -->
<!-- linker's input set; adding this reference ensures it is included. -->
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" NoWarn="NU1510" />
<TrimmerRootAssembly Include="Microsoft.CSharp" RootMode="all" />
</ItemGroup>
<ItemGroup>
<!-- Use winnerspiros/osu-framework fork (net10.0-android, optimized) via submodule instead of ppy NuGet package -->
<ProjectReference Include="$(MSBuildThisFileDirectory)submodules\osu-framework\osu.Framework.Android\osu.Framework.Android.csproj" />
</ItemGroup>
<PropertyGroup>
<!-- Fody does not handle Android build well, and warns when unchanged.
Since Realm objects are not declared directly in Android projects, simply disable Fody. -->
<DisableFody>true</DisableFody>
</PropertyGroup>
<!-- Fix for .NET 10 Android AOT misclassifying native .so assets in runtime pack.
Only .so files need the AssetType override — the previous broader filter
(all non-DLL, non-PDB) incorrectly reclassified signing metadata and config
files, which corrupted the APK signature (INSTALL_PARSE_FAILED_NO_CERTIFICATES).
Scoped to Release only to avoid interfering with Debug builds. -->
<Target Name="FixRuntimePackAssetTypes" AfterTargets="ResolveRuntimePackAssets;ComputeFilesToPublish;ComputeResolvedFilesToPublishList"
Condition="'$(Configuration)' == 'Release'">
<ItemGroup>
<RuntimePackAsset Update="@(RuntimePackAsset)" Condition="'%(Extension)' == '.so'">
<AssetType>native</AssetType>
</RuntimePackAsset>
<ResolvedFileToPublish Update="@(ResolvedFileToPublish)" Condition="'%(Extension)' == '.so'">
<AssetType>native</AssetType>
</ResolvedFileToPublish>
</ItemGroup>
</Target>
</Project>