[NativeAOT] Make workload linker the default for NativeAOT builds#11340
Open
sbomer wants to merge 4 commits into
Open
[NativeAOT] Make workload linker the default for NativeAOT builds#11340sbomer wants to merge 4 commits into
sbomer wants to merge 4 commits into
Conversation
Change _AndroidUseWorkloadNativeLinker default from false to true so NativeAOT builds use the workload-provided linker and sysroot by default, removing the NDK requirement. Update SetRuntime(NativeAOT) to set _SkipNdkResolution=true so all existing NativeAOT tests exercise the NDK-free workload linker path. Update NativeAotBuildTests with three tests covering the full matrix: - BuildNativeAot_WithoutNdk: workload linker (default), no NDK -> succeeds - BuildNativeAot_WithNdkLinker: opt-out to NDK linker, with NDK -> succeeds - BuildNativeAot_WithoutNdk_WorkloadLinkerDisabled_Fails: opt-out, no NDK -> fails Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Assisted-by: Claude:claude-opus-4.6-1m
Contributor
There was a problem hiding this comment.
Pull request overview
This PR switches NativeAOT builds to use the workload-provided linker/sysroot by default (removing the NDK requirement for the default path) and adjusts the test suite to validate both the default workload-linker behavior and the opt-out NDK-linker behavior.
Changes:
- Default
_AndroidUseWorkloadNativeLinkertotruefor NativeAOT builds. - Update the NativeAOT test runtime helper to skip NDK resolution by default for NativeAOT test projects.
- Revise/expand
NativeAotBuildTeststo cover success/failure across the workload-linker vs NDK-linker matrix.
Show a summary per file
| File | Description |
|---|---|
| src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Utilities/ProjectExtensions.cs | Changes NativeAOT test runtime setup to force the NDK-free path. |
| src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/NativeAotBuildTests.cs | Updates/extends NativeAOT build tests for the new default and opt-out behavior. |
| src/Xamarin.Android.Build.Tasks/Microsoft.Android.Sdk/targets/Microsoft.Android.Sdk.NativeAOT.targets | Switches the default NativeAOT linker selection toward workload-provided tooling. |
Copilot's findings
- Files reviewed: 3/3 changed files
- Comments generated: 2
Comment on lines
26
to
28
| project.SetPublishAot (true); | ||
| project.SetProperty ("_SkipNdkResolution", "true"); | ||
| EnablePreviewFeaturesIfNeeded (project, runtime); |
The default was set inside _AndroidLinkNativeAotSharedLibrary, but SetIlcToolchainPath in _AndroidBeforeIlcCompile runs earlier and checks the property. With the default set too late, ILC would use the NDK bin dir instead of AndroidBinUtilsDirectory when the property was not explicitly set. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Assisted-by: Claude:claude-opus-4.6-1m
Update _NdkRequired in GetAndroidDependencies to only require NDK for PublishAot when _AndroidUseWorkloadNativeLinker is not enabled. Update NativeAotRequiresNdk test to explicitly opt out of the workload linker so it continues to verify NDK is required on the old path. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Assisted-by: Claude:claude-opus-4.6-1m
Skip EnableLLVM and AndroidEnableProfiledAot for NativeAOT (Mono concepts not applicable). AotAssemblies+NativeAOT continues to run and correctly asserts NDK is not required. Fix NativeAotRequiresNdk to override _SkipNdkResolution=false so NDK resolution runs and the ndk-bundle dependency can be detected when testing the opt-out path. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Assisted-by: Claude:claude-opus-4.6-1m
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Change _AndroidUseWorkloadNativeLinker default from false to true so NativeAOT builds use the workload-provided linker and sysroot by default, removing the NDK requirement.
Update SetRuntime(NativeAOT) to set _SkipNdkResolution=true so all existing NativeAOT tests exercise the NDK-free workload linker path.
Update NativeAotBuildTests with three tests covering the full matrix: