From 3f8e4787c6721f7d44b00b0b02e88672d85fa901 Mon Sep 17 00:00:00 2001 From: Jonathan Peppers Date: Wed, 24 Jun 2026 13:53:22 -0500 Subject: [PATCH 1/5] [xaprepare] Check in Ndk.projitems, remove generator Mirrors PR #11608 which checked in Mono.Android.Apis.projitems. Convert `build-tools/scripts/Ndk.projitems.in` into a checked-in `build-tools/scripts/Ndk.projitems` with the `@NDK_*@` placeholders resolved from the current constants in BuildAndroidPlatforms.cs, and remove the `Get_Ndk_projitems` generator from xaprepare. - Point `Ndk.targets` at the new static, in-tree location. - Delete `Get_Ndk_projitems` and its dispatch entry in Step_GenerateFiles.cs. - The NDK constants in BuildAndroidPlatforms.cs are left intact; they are still consumed by Get_XABuildConfig_cs and the cmake presets generator. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../{Ndk.projitems.in => Ndk.projitems} | 128 +++++++++--------- build-tools/scripts/Ndk.targets | 2 +- .../xaprepare/ConfigAndData/Configurables.cs | 2 +- .../xaprepare/Steps/Step_GenerateFiles.cs | 25 ---- 4 files changed, 69 insertions(+), 88 deletions(-) rename build-tools/scripts/{Ndk.projitems.in => Ndk.projitems} (79%) diff --git a/build-tools/scripts/Ndk.projitems.in b/build-tools/scripts/Ndk.projitems similarity index 79% rename from build-tools/scripts/Ndk.projitems.in rename to build-tools/scripts/Ndk.projitems index e767b8c460f..e2ef4c20aa5 100644 --- a/build-tools/scripts/Ndk.projitems.in +++ b/build-tools/scripts/Ndk.projitems @@ -1,61 +1,67 @@ - - - - @NDK_RELEASE@ - @NDK_PKG_REVISION@ - @NDK_ARMEABI_V7_API@ - @NDK_ARMEABI_V7_API_NET@ - @NDK_ARM64_V8A_API@ - @NDK_ARM64_V8A_API_NET@ - @NDK_X86_API@ - @NDK_X86_API_NET@ - @NDK_X86_64_API@ - @NDK_X86_64_API_NET@ - - - - - $(AndroidNdkApiLevel_ArmV7a) - $(AndroidNdkApiLevel_Arm) - android-arm - True - False - False - - - - $(AndroidNdkApiLevel_ArmV8a) - $(AndroidNdkApiLevel_Arm64) - android-arm64 - True - True - True - - - - $(AndroidNdkApiLevel_X86_Legacy) - $(AndroidNdkApiLevel_X86) - android-x86 - True - False - False - - - - $(AndroidNdkApiLevel_X86_64) - $(AndroidNdkApiLevel_X64) - android-x64 - True - True - True - - - + + + + + 28c + 28.2.13676358 + 24 + 24 + 24 + 24 + 24 + 24 + 24 + 24 + + + + + $(AndroidNdkApiLevel_ArmV7a) + $(AndroidNdkApiLevel_Arm) + android-arm + True + False + False + + + + $(AndroidNdkApiLevel_ArmV8a) + $(AndroidNdkApiLevel_Arm64) + android-arm64 + True + True + True + + + + $(AndroidNdkApiLevel_X86_Legacy) + $(AndroidNdkApiLevel_X86) + android-x86 + True + False + False + + + + $(AndroidNdkApiLevel_X86_64) + $(AndroidNdkApiLevel_X64) + android-x64 + True + True + True + + + diff --git a/build-tools/scripts/Ndk.targets b/build-tools/scripts/Ndk.targets index 9972e4b3a8d..4a4b41e60d2 100644 --- a/build-tools/scripts/Ndk.targets +++ b/build-tools/scripts/Ndk.targets @@ -1,7 +1,7 @@ - $(MSBuildThisFileDirectory)..\..\bin\Build$(Configuration)\Ndk.projitems + $(MSBuildThisFileDirectory)Ndk.projitems SupportNativeAOT in - /// build-tools/scripts/Ndk.projitems.in. + /// build-tools/scripts/Ndk.projitems. /// public static readonly HashSet NativeAotSupportedAbis = new (StringComparer.Ordinal) { "arm64-v8a", diff --git a/build-tools/xaprepare/xaprepare/Steps/Step_GenerateFiles.cs b/build-tools/xaprepare/xaprepare/Steps/Step_GenerateFiles.cs index 789268275d1..6e0219c875d 100644 --- a/build-tools/xaprepare/xaprepare/Steps/Step_GenerateFiles.cs +++ b/build-tools/xaprepare/xaprepare/Steps/Step_GenerateFiles.cs @@ -66,7 +66,6 @@ protected override async Task Execute (Context context) Get_Configuration_Generated_Props (context), Get_Cmake_XA_Build_Configuration (context), Get_Cmake_Presets (context), - Get_Ndk_projitems (context), Get_XABuildConfig_cs (context), }; } @@ -230,30 +229,6 @@ static string GetMinor (string value) } } - GeneratedFile Get_Ndk_projitems (Context context) - { - const string OutputFileName = "Ndk.projitems"; - - var replacements = new Dictionary (StringComparer.Ordinal) { - { "@NDK_RELEASE@", BuildAndroidPlatforms.AndroidNdkVersion }, - { "@NDK_PKG_REVISION@", BuildAndroidPlatforms.AndroidNdkPkgRevision }, - { "@NDK_ARMEABI_V7_API@", BuildAndroidPlatforms.NdkMinimumAPILegacy32.ToString () }, - { "@NDK_ARMEABI_V7_API_NET@", BuildAndroidPlatforms.NdkMinimumAPI.ToString () }, - { "@NDK_ARM64_V8A_API@", BuildAndroidPlatforms.NdkMinimumAPI.ToString () }, - { "@NDK_ARM64_V8A_API_NET@", BuildAndroidPlatforms.NdkMinimumAPI.ToString () }, - { "@NDK_X86_API@", BuildAndroidPlatforms.NdkMinimumAPILegacy32.ToString () }, - { "@NDK_X86_API_NET@", BuildAndroidPlatforms.NdkMinimumAPI.ToString () }, - { "@NDK_X86_64_API@", BuildAndroidPlatforms.NdkMinimumAPI.ToString () }, - { "@NDK_X86_64_API_NET@", BuildAndroidPlatforms.NdkMinimumAPI.ToString () }, - }; - - return new GeneratedPlaceholdersFile ( - replacements, - Path.Combine (Configurables.Paths.BuildToolsScriptsDir, $"{OutputFileName}.in"), - Path.Combine (Configurables.Paths.BuildBinDir, OutputFileName) - ); - } - public GeneratedFile Get_SourceLink_Json (Context context) { if (gitSubmodules == null || xaCommit == null) { From 2a28bc29ba366b9c34fd47a9b0d3f98039c88f47 Mon Sep 17 00:00:00 2001 From: Jonathan Peppers Date: Wed, 24 Jun 2026 13:55:26 -0500 Subject: [PATCH 2/5] Reference existing Configuration.props properties in Ndk.projitems Instead of hardcoding the NDK version (28c), pkg revision (28.2.13676358) and minimum API level (24) -- which duplicated values already defined in Configuration.props -- source them from $(_XAAndroidNdkRelease), $(_XAAndroidNdkPkgRevision) and $(AndroidMinimumDotNetApiLevel). Those are all set before Configuration.props imports Ndk.targets, so the projitems file no longer needs to be kept in sync on an NDK/API bump. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- build-tools/scripts/Ndk.projitems | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/build-tools/scripts/Ndk.projitems b/build-tools/scripts/Ndk.projitems index e2ef4c20aa5..eacfd99143c 100644 --- a/build-tools/scripts/Ndk.projitems +++ b/build-tools/scripts/Ndk.projitems @@ -1,22 +1,23 @@ - 28c - 28.2.13676358 - 24 - 24 - 24 - 24 - 24 - 24 - 24 - 24 + $(_XAAndroidNdkRelease) + $(_XAAndroidNdkPkgRevision) + $(AndroidMinimumDotNetApiLevel) + $(AndroidMinimumDotNetApiLevel) + $(AndroidMinimumDotNetApiLevel) + $(AndroidMinimumDotNetApiLevel) + $(AndroidMinimumDotNetApiLevel) + $(AndroidMinimumDotNetApiLevel) + $(AndroidMinimumDotNetApiLevel) + $(AndroidMinimumDotNetApiLevel) From c3c8b74ae5ee4894da06b771e3f91694db85ac99 Mon Sep 17 00:00:00 2001 From: Jonathan Peppers Date: Wed, 24 Jun 2026 14:16:37 -0500 Subject: [PATCH 3/5] Collapse dead legacy/NET API-level split in Ndk.projitems The legacy 32-bit minimum API level used to be lower than the .NET minimum API level, but they are identical now (both $(AndroidMinimumDotNetApiLevel)). Remove the two redundant per-ABI properties that nothing else references -- AndroidNdkApiLevel_Arm (armeabi-v7a .NET) and AndroidNdkApiLevel_X86_Legacy (x86 legacy) -- and point each item's ApiLevel/ApiLevelNET metadata at the single remaining per-ABI property. The arm64-v8a and x86_64 properties are left in place since shipped targets (Build.Tasks.targets, Common.props.in, NativeAOT.targets) still consume them by name. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- build-tools/scripts/Ndk.projitems | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/build-tools/scripts/Ndk.projitems b/build-tools/scripts/Ndk.projitems index eacfd99143c..4e61781e7ce 100644 --- a/build-tools/scripts/Ndk.projitems +++ b/build-tools/scripts/Ndk.projitems @@ -5,16 +5,18 @@ ($(_XAAndroidNdkRelease), $(_XAAndroidNdkPkgRevision) and $(AndroidMinimumDotNetApiLevel)), which is imported before this file, so there is nothing to keep in sync here. + + The legacy 32-bit minimum API level used to differ from the .NET minimum + API level, but they are the same now, so each ABI uses a single property + for both the ApiLevel and ApiLevelNET metadata. --> $(_XAAndroidNdkRelease) $(_XAAndroidNdkPkgRevision) $(AndroidMinimumDotNetApiLevel) - $(AndroidMinimumDotNetApiLevel) $(AndroidMinimumDotNetApiLevel) $(AndroidMinimumDotNetApiLevel) - $(AndroidMinimumDotNetApiLevel) $(AndroidMinimumDotNetApiLevel) $(AndroidMinimumDotNetApiLevel) $(AndroidMinimumDotNetApiLevel) @@ -25,7 +27,7 @@ Include="armeabi-v7a" Condition=" $(AndroidSupportedTargetJitAbisForConditionalChecks.Contains (':armeabi-v7a:')) "> $(AndroidNdkApiLevel_ArmV7a) - $(AndroidNdkApiLevel_Arm) + $(AndroidNdkApiLevel_ArmV7a) android-arm True False @@ -46,7 +48,7 @@ - $(AndroidNdkApiLevel_X86_Legacy) + $(AndroidNdkApiLevel_X86) $(AndroidNdkApiLevel_X86) android-x86 True From dd3ade211968b4c4d1c86e6fb357c0c95a694d47 Mon Sep 17 00:00:00 2001 From: Jonathan Peppers Date: Wed, 24 Jun 2026 14:17:30 -0500 Subject: [PATCH 4/5] Trim Ndk.projitems header comment Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- build-tools/scripts/Ndk.projitems | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/build-tools/scripts/Ndk.projitems b/build-tools/scripts/Ndk.projitems index 4e61781e7ce..8d86453722c 100644 --- a/build-tools/scripts/Ndk.projitems +++ b/build-tools/scripts/Ndk.projitems @@ -1,14 +1,8 @@ From 1c5aa2a16bc5f4460314978933dc134c90b4a389 Mon Sep 17 00:00:00 2001 From: Jonathan Peppers Date: Wed, 24 Jun 2026 14:20:04 -0500 Subject: [PATCH 5/5] Remove ApiLevelNET metadata, use ApiLevel everywhere ApiLevelNET was the minimum API level for .NET (.NET 6+) Android, as opposed to the legacy Xamarin.Android (Mono) ApiLevel. Those values used to differ but are identical now, and the repo is .NET-only. The only consumer of the ApiLevelNET metadata was libunwind-xamarin.targets; point it at ApiLevel instead and drop the now-redundant ApiLevelNET metadata from all four AndroidSupportedTargetJitAbi items in Ndk.projitems. The resolved value (24) is unchanged. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- build-tools/scripts/Ndk.projitems | 4 ---- src/native/common/libunwind/libunwind-xamarin.targets | 2 +- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/build-tools/scripts/Ndk.projitems b/build-tools/scripts/Ndk.projitems index 8d86453722c..c473fa5dd01 100644 --- a/build-tools/scripts/Ndk.projitems +++ b/build-tools/scripts/Ndk.projitems @@ -21,7 +21,6 @@ Include="armeabi-v7a" Condition=" $(AndroidSupportedTargetJitAbisForConditionalChecks.Contains (':armeabi-v7a:')) "> $(AndroidNdkApiLevel_ArmV7a) - $(AndroidNdkApiLevel_ArmV7a) android-arm True False @@ -32,7 +31,6 @@ Include="arm64-v8a" Condition=" $(AndroidSupportedTargetJitAbisForConditionalChecks.Contains (':arm64-v8a:')) "> $(AndroidNdkApiLevel_ArmV8a) - $(AndroidNdkApiLevel_Arm64) android-arm64 True True @@ -43,7 +41,6 @@ Include="x86" Condition=" $(AndroidSupportedTargetJitAbisForConditionalChecks.Contains (':x86:')) "> $(AndroidNdkApiLevel_X86) - $(AndroidNdkApiLevel_X86) android-x86 True False @@ -54,7 +51,6 @@ Include="x86_64" Condition=" $(AndroidSupportedTargetJitAbisForConditionalChecks.Contains (':x86_64:')) "> $(AndroidNdkApiLevel_X86_64) - $(AndroidNdkApiLevel_X64) android-x64 True True diff --git a/src/native/common/libunwind/libunwind-xamarin.targets b/src/native/common/libunwind/libunwind-xamarin.targets index 983f32cc460..4890470137d 100644 --- a/src/native/common/libunwind/libunwind-xamarin.targets +++ b/src/native/common/libunwind/libunwind-xamarin.targets @@ -17,7 +17,7 @@ <_ConfigureLibUnwindCommands Include="@(AndroidSupportedTargetJitAbi)"> $(CmakePath) - $(_CmakeAndroidFlags) -DANDROID_NATIVE_API_LEVEL=%(AndroidSupportedTargetJitAbi.ApiLevelNET) -DANDROID_PLATFORM=android-%(AndroidSupportedTargetJitAbi.ApiLevelNET) -DANDROID_ABI=%(AndroidSupportedTargetJitAbi.Identity) -DANDROID_RID=%(AndroidSupportedTargetJitAbi.AndroidRID) -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY="$(OutputPath)%(AndroidSupportedTargetJitAbi.AndroidRID)" -DCMAKE_LIBRARY_OUTPUT_DIRECTORY="$(OutputPath)%(AndroidSupportedTargetJitAbi.AndroidRID)" -DCMAKE_BUILD_TYPE=$(Configuration) -DLIBUNWIND_SOURCE_DIR="$(LibUnwindSourceFullPath)" -DLIBUNWIND_LIBRARY_NAME="$(_LibUnwindBaseLibName)" -DLIBUNWIND_OUTPUT_DIR="@(AndroidSupportedTargetJitAbi->'$(OutputPath)/%(AndroidRID)')" -DLIBUNWIND_HEADERS_OUTPUT_DIR="$(_LibUnwindHeadersOutputDir)" $(MSBuildThisFileDirectory) + $(_CmakeAndroidFlags) -DANDROID_NATIVE_API_LEVEL=%(AndroidSupportedTargetJitAbi.ApiLevel) -DANDROID_PLATFORM=android-%(AndroidSupportedTargetJitAbi.ApiLevel) -DANDROID_ABI=%(AndroidSupportedTargetJitAbi.Identity) -DANDROID_RID=%(AndroidSupportedTargetJitAbi.AndroidRID) -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY="$(OutputPath)%(AndroidSupportedTargetJitAbi.AndroidRID)" -DCMAKE_LIBRARY_OUTPUT_DIRECTORY="$(OutputPath)%(AndroidSupportedTargetJitAbi.AndroidRID)" -DCMAKE_BUILD_TYPE=$(Configuration) -DLIBUNWIND_SOURCE_DIR="$(LibUnwindSourceFullPath)" -DLIBUNWIND_LIBRARY_NAME="$(_LibUnwindBaseLibName)" -DLIBUNWIND_OUTPUT_DIR="@(AndroidSupportedTargetJitAbi->'$(OutputPath)/%(AndroidRID)')" -DLIBUNWIND_HEADERS_OUTPUT_DIR="$(_LibUnwindHeadersOutputDir)" $(MSBuildThisFileDirectory) $(IntermediateOutputPath)%(AndroidSupportedTargetJitAbi.Identity)-$(Configuration)