Skip to content

[native build] Use a single source of truth for NDK API levels#10754

Open
grendello wants to merge 4 commits intomainfrom
dev/grendel/ndk-api-minimums
Open

[native build] Use a single source of truth for NDK API levels#10754
grendello wants to merge 4 commits intomainfrom
dev/grendel/ndk-api-minimums

Conversation

@grendello
Copy link
Contributor

NOTE: #9926 must be merged first

@grendello grendello force-pushed the dev/grendel/ndk-api-minimums branch from 062d427 to 806caf9 Compare February 3, 2026 15:19
@grendello grendello force-pushed the dev/grendel/ndk-api-minimums branch from 806caf9 to 95526fc Compare February 4, 2026 09:30
@grendello grendello marked this pull request as ready for review February 4, 2026 14:22
Copilot AI review requested due to automatic review settings February 4, 2026 14:22
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 AndroidMinimumNonMonoApiLevel property (API 24) to Configuration.props for CoreCLR/NativeAOT runtimes
  • Refactors XABuildConfig to use AndroidTargetArch-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

Copy link
Contributor

Copilot AI commented Feb 4, 2026

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants