[native build] Use a single source of truth for NDK API levels#10754
Open
[native build] Use a single source of truth for NDK API levels#10754
Conversation
062d427 to
806caf9
Compare
806caf9 to
95526fc
Compare
There was a problem hiding this comment.
Pull request overview
This PR consolidates NDK API level definitions into a single source of truth in Configuration.props, eliminating hardcoded constants scattered across the build system. The PR introduces a new AndroidMinimumNonMonoApiLevel property (set to 24) for CoreCLR and NativeAOT runtimes, while maintaining the existing AndroidMinimumDotNetApiLevel (set to 21) for Mono-based runtimes.
Changes:
- Adds
AndroidMinimumNonMonoApiLevelproperty (API 24) to Configuration.props for CoreCLR/NativeAOT runtimes - Refactors
XABuildConfigto useAndroidTargetArch-keyed dictionaries instead of string-based arch names - Updates CMake presets to use runtime-specific configurations with distinct API levels for Mono vs non-Mono runtimes
Reviewed changes
Copilot reviewed 19 out of 19 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| Configuration.props | Adds AndroidMinimumNonMonoApiLevel property (24) with documentation |
| build-tools/scripts/XABuildConfig.cs.in | Replaces string-keyed ArchAPILevels dictionary with two AndroidTargetArch-keyed dictionaries for Mono and non-Mono runtimes |
| build-tools/xaprepare/xaprepare/ConfigAndData/BuildAndroidPlatforms.cs | Converts NdkMinimum* constants to properties sourced from Context |
| build-tools/xaprepare/xaprepare/Application/KnownProperties.cs | Adds AndroidMinimumNonMonoApiLevel constant |
| build-tools/xaprepare/xaprepare/Application/Properties.Defaults.cs.in | Initializes AndroidMinimumNonMonoApiLevel property from template |
| build-tools/xaprepare/xaprepare/Steps/Step_GenerateFiles.cs | Adds placeholder replacements for non-Mono API levels |
| build-tools/xaprepare/xaprepare/Steps/Step_Android_SDK_NDK.cs | Updates to use string-based NdkMinimumAPI property |
| build-tools/xaprepare/xaprepare/xaprepare.targets | Adds AndroidMinimumNonMonoApiLevel replacement token |
| build-tools/scripts/xa_build_configuration.cmake.in | Removes unused 32-bit CoreCLR runtime directory variables |
| src/native/CMakeLists.txt | Removes unused 32-bit CoreCLR runtime directory definitions |
| src/native/CMakePresets.json.in | Adds nonmono-common-* presets with higher API levels and runtime-specific preset variants |
| src/native/native.targets | Adds _PresetPrefix logic to select runtime-specific CMake presets; removes NativeAOT debug output |
| src/Xamarin.Android.Build.Tasks/Utilities/NdkTools/*.cs | Updates GetMinimumApiLevelFor signature to accept AndroidRuntime parameter |
| src/Xamarin.Android.Build.Tasks/Utilities/MonoAndroidHelper.cs | Adds GetMinimumApiLevel helper method to select appropriate API level based on runtime |
| src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Tasks/NdkUtilTests.cs | Updates test to parameterize by runtime and verify correct API levels |
| src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Xamarin.Android.Build.Tests.csproj | Includes generated XABuildConfig.cs for test access |
build-tools/xaprepare/xaprepare/Application/Properties.Defaults.cs.in
Outdated
Show resolved
Hide resolved
Contributor
|
@grendello I've opened a new pull request, #10764, to work on those changes. Once the pull request is ready, I'll request review from you. |
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.
NOTE: #9926 must be merged first