Enable android-arm NativeAOT runtime packs#12029
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
28e7cf5 to
5816a3c
Compare
|
/review |
|
✅ Android PR Reviewer completed successfully! |
There was a problem hiding this comment.
Pull request overview
Enables NativeAOT runtime-pack resolution and pack production for the android-arm (armeabi-v7a) RID, aligning NativeAOT/ILCompiler pack versions with the repo’s dotnet/runtime dependency and ensuring required native crypto assets are present in the produced packs.
Changes:
- Adds
Microsoft.Android.Runtime.NativeAOT.37.android-armto the Android workload manifest and wires up build/NDK metadata to support NativeAOT onandroid-arm. - Downloads the upstream
Microsoft.NETCore.App.Runtime.NativeAOT.android-*packs during workload provisioning and usesMicrosoftNETCoreAppRefPackageVersionto keep pack versions aligned. - Copies
libSystem.Security.Cryptography.Native.Android.afrom upstream NativeAOT runtime packs intoMicrosoft.Android.Runtime.NativeAOTpack outputs and adjusts NativeAOT linking to prefer the runtime-pack-provided archive when available.
Show a summary per file
| File | Description |
|---|---|
| src/Xamarin.Android.Build.Tasks/Xamarin.Android.Build.Tasks.targets | Plumbs MicrosoftNETCoreAppRefPackageVersion into bundled versions generation inputs/replacements. |
| src/Xamarin.Android.Build.Tasks/Microsoft.NET.Sdk.Android/WorkloadManifest.in.json | Adds the android-arm NativeAOT runtime pack to the workload pack list and pack definitions. |
| src/Xamarin.Android.Build.Tasks/Microsoft.Android.Sdk/targets/Microsoft.Android.Sdk.NativeAOT.targets | Enables android-arm NativeAOT runtime-pack restore/selection and adds android-arm toolchain/linker handling. |
| src/Xamarin.Android.Build.Tasks/Microsoft.Android.Sdk/in/Microsoft.Android.Sdk.BundledVersions.in.targets | Exposes MicrosoftNETCoreAppRefPackageVersion in the generated SDK bundled-versions targets. |
| src/workloads/workloads.csproj | Downloads upstream NativeAOT Android runtime packs as part of workload provisioning. |
| src/native/native.targets | Copies upstream NativeAOT crypto archive into the local NativeAOT runtime pack output for supported RIDs. |
| src/native/native-nativeaot.csproj | Expands NativeAOT native build RID list to include armeabi-v7a (android-arm). |
| src/native/CMakePresets.json.in | Adds nativeaot CMake presets for armeabi-v7a debug/release builds. |
| src/Mono.Android/metadata | Adds an API 37 metadata removal for android.app.appfunctions.AppFunctionState. |
| build-tools/scripts/Ndk.projitems | Marks android-arm as supporting NativeAOT in NDK ABI metadata. |
| build-tools/create-packs/Microsoft.Android.Runtime.proj | Includes upstream NativeAOT crypto archive as a NativeAOT runtime-pack asset when present. |
Copilot's findings
- Files reviewed: 11/11 changed files
- Comments generated: 1
There was a problem hiding this comment.
🤖 Android PR Review — ⚠️ Needs Changes
Enables android-arm (armeabi-v7a) NativeAOT runtime packs: workload manifest entry, runtime-pack download, NDK toolchain wiring, CMake presets, and crypto-archive plumbing. The structure closely mirrors the existing arm64/x64 NativeAOT paths, and the version plumbing is consistent (DotNetRuntimePacksVersion defaults to MicrosoftNETCoreAppRefPackageVersion, so the new BundledVersions/lookup wiring lines up).
Findings
⚠️ 1 warning —AndroidNdkApiLevel_Armis referenced but never defined, so_NDKApiLevelis empty forandroid-arm(see inline onMicrosoft.Android.Sdk.NativeAOT.targets). Works in the validated default workload-linker path, but breaks the_AndroidUseWorkloadNativeLinker != 'true'NDK path and is a latent inconsistency with arm64/x64. One-line fix.- 💡 2 suggestions — an unrelated
AppFunctionStateAPI-37 metadata<remove-node>bundled into this PR; and a potential silent crypto-lib drop if the download vs. lookup version properties ever diverge.
CI
Not green yet — the Mac build and Java.Interop Mac tests are in progress and the main dotnet-android build is queued. The earlier Windows/Linux runs show cancelled because a newer build superseded them (not real failures). Please confirm the pipeline goes green before merging.
Positive callouts
- Correctly handles the NDK quirk where the 32-bit ARM clang prefix (
armv7a-linux-androideabi) differs from the sysroot dir (arm-linux-androideabi). - CMake presets, RID→ABI mapping, and
_PrivateBuildTargetAbiare consistent with the arm64/x64 precedent. - Real-device validation on an armeabi-v7a phone is documented in the PR description.
Automated review — please verify each suggestion against full context before acting.
Generated by Android PR Reviewer for #12029 · 265.6 AIC · ⌖ 28 AIC · ⊞ 6.8K
Comment /review to run again
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: f3ad2c76-9fba-41d4-a747-c5602aeae335
|
/review |
|
✅ Android PR Reviewer completed successfully! |
There was a problem hiding this comment.
🤖 Code Review — Enable android-arm NativeAOT runtime packs
Verdict:
This is a clean, well-scoped MSBuild/CMake plumbing change to bring up android-arm (armeabi-v7a) NativeAOT. I verified the changes against the full source files:
- ✅
_NdkClangPrefix/_NdkSysrootAbi/_NdkAbiare now set explicitly per RID;armv7a-linux-androideabi(clang prefix) vsarm-linux-androideabi(sysroot) is the correct NDK split for 32-bit arm, and the derived_NdkAbi=armmatches the compiler-rt/libunwindfile naming used later in the file. - ✅
AndroidNdkApiLevel_Armuses the existing@NDK_ARMEABI_V7_API@replacement token (already consumed elsewhere inXamarin.Android.Common.props.in), and the new@MICROSOFT_NETCORE_APP_REF_PACKAGE_VERSION@token is wired through both the cache lines andReplaceFileContentsreplacements — so incremental builds won't go stale. - ✅ The
KnownRuntimePack/KnownILCompilerPackoverride correctly appendsandroid-armtoRuntimePackRuntimeIdentifiersand aligns ILCompiler + runtime-pack versions. - ✅ Good test coverage: a
Restoretest asserting theandroid-armpack is selected (and that it does not fall back tolinux-bionic-arm), plus an NDK-linker build test.
Suggestions (all non-blocking)
- 💡 Duplicated crypto-lib NuGet-cache path across three files — extract to a shared property.
- 💡 Silent
Exists(...)skip of the crypto archive during pack creation could mask a broken restore. - 💡 Document the intentional
MicrosoftNETCoreAppRefPackageVersionvsDotNetRuntimePacksVersiondivergence inworkloads.csproj.
Notes
- CI status is currently pending on the head commit — a maintainer should confirm the pipeline goes green before merge (per review guidelines, this keeps the verdict at
⚠️ rather than ✅). - The PR description acknowledges a local
System.IO.Hashing.dllworkaround unrelated to these changes; nothing in the diff depends on it.
Nice work — the per-RID abstraction is a clean improvement over the previous string-concatenation approach.
Generated by Android PR Reviewer for #12029 · 127.1 AIC · ⌖ 17.5 AIC · ⊞ 6.8K
Comment /review to run again
Summary
Validation
make prepare && make all MSBUILD_ARGS="/m:1 /nr:false /p:UseSharedCompilation=false"./dotnet-local.sh publish samples/NativeAOT/NativeAOT.csproj -c Release -r android-arm -tl:off -nr:falseMicrosoft.NETCore.App.Runtime.NativeAOT.android-armandMicrosoft.DotNet.ILCompilerto11.0.0-preview.7.26355.102armeabi-v7a), process stayed alive with no fatal logcat linesNote: local sample publish required replacing the built SDK tools
System.IO.Hashing.dllwith the package'snetstandard2.0asset to avoid a current main-branch MSBuild task assembly-load mismatch. The repo build itself passed without that local workaround.Note
This PR description was created with GitHub Copilot.