Skip to content

[xabt] Move trimmable typemap tasks to net11 - #12678

Open
simonrozsival wants to merge 8 commits into
mainfrom
simonrozsival-trimmable-typemap-migration
Open

[xabt] Move trimmable typemap tasks to net11#12678
simonrozsival wants to merge 8 commits into
mainfrom
simonrozsival-trimmable-typemap-migration

Conversation

@simonrozsival

@simonrozsival simonrozsival commented Sep 4, 2026

Copy link
Copy Markdown
Member

Summary

  • move GenerateTrimmableTypeMap and GenerateMissingTypeMapStubs into the net11.0 Microsoft.Android.Build.Tasks assembly
  • retarget the trimmable typemap generator and its tests to .NET 11
  • isolate modern tasks and their .NET dependencies under tools/net/, avoiding conflicts with netstandard2.0 dependencies in the shared tools directory
  • register the tasks for Core and full-framework MSBuild and package their localized resources
  • add a dedicated .NET 11 task test project and run it in CI
  • make formerly transitive System.Reflection.Metadata usage explicit

Performance improvements remain intentionally out of scope; existing stack-based hashing continues to use System.IO.Hashing.Crc64 directly.

Validation

  • make prepare && make all
  • 833 trimmable typemap generator tests
  • 17 modern build-task tests, including localized resource loading
  • CoreCLR and NativeAOT Build_WithTrimmableTypeMap_Succeeds cases
  • trimmable typemap SDK artifact packaging test
  • relocated NativeAOT ProGuard task tests

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI lite review requested due to automatic review settings September 4, 2026 09:02
simonrozsival and others added 2 commits September 4, 2026 11:07
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🔵 Needs a closer look

It changes shipped MSBuild task loading/target wiring and retargets generator infrastructure, which warrants careful human validation of build/packaging behavior across MSBuild runtimes.

Review tier: Lite
Findings: None

What changed in this PR

This PR restructures the trimmable typemap pipeline by moving the MSBuild task entrypoints into the Microsoft.Android.Build.Tasks net11 assembly, retargeting the generator/tests to .NET 11, and updating the SDK targets to load the new tasks appropriately under both Full Framework and Core MSBuild.

Changes:

  • Rewired Microsoft.Android.Sdk.TypeMap.Trimmable*.targets to load Microsoft.Android.Tasks.GenerateTrimmableTypeMap / GenerateMissingTypeMapStubs from Microsoft.Android.Build.Tasks.dll.
  • Retargeted Microsoft.Android.Sdk.TrimmableTypeMap (and its unit tests) to $(DotNetTargetFramework) and adjusted code for .NET 11 runtime behavior.
  • Added a dedicated Microsoft.Android.Build.Tasks.Tests project and migrated relevant task tests, while keeping unrelated NativeAOT ProGuard tests in the existing suite.
File Description
Xamarin.Android.slnx Adds the new Microsoft.Android.Build.Tasks.Tests project to the main solution test folder.
Xamarin.Android.Build.Tasks.slnx Adds the new Microsoft.Android.Build.Tasks.Tests project to the build-tasks solution.
tests/​Microsoft.Android.Sdk.TrimmableTypeMap.Tests/​Microsoft.Android.Sdk.TrimmableTypeMap.Tests.csproj Retargets unit tests to $(DotNetTargetFramework) for the net11 transition.
src/​Xamarin.Android.Build.Tasks/​Xamarin.Android.Build.Tasks.csproj Adds explicit System.Reflection.Metadata package reference and removes the trimmable typemap project reference.
src/​Xamarin.Android.Build.Tasks/​Tests/​Xamarin.Android.Build.Tests/​Tasks/​GenerateNativeAotProguardConfigurationTests.cs Introduces a dedicated test file for NativeAOT ProGuard configuration behavior after test relocation.
src/​Xamarin.Android.Build.Tasks/​Microsoft.Android.Sdk/​targets/​Microsoft.Android.Sdk.TypeMap.Trimmable.targets Updates <UsingTask> to load GenerateTrimmableTypeMap from Microsoft.Android.Build.Tasks.
src/​Xamarin.Android.Build.Tasks/​Microsoft.Android.Sdk/​targets/​Microsoft.Android.Sdk.TypeMap.Trimmable.CoreCLR.targets Updates <UsingTask> to load GenerateMissingTypeMapStubs from Microsoft.Android.Build.Tasks.
src/​Xamarin.Android.Build.Tasks/​Microsoft.Android.Sdk/​targets/​Microsoft.Android.Sdk.targets Adds _MicrosoftAndroidBuildTasksAssembly path for the new task assembly.
src/​Microsoft.Android.Sdk.TrimmableTypeMap/​Scanner/​ScannerHashingHelper.cs Adjusts CRC64 hashing implementation to use compatible APIs in the presence of MSBuild’s asset loading behavior.
src/​Microsoft.Android.Sdk.TrimmableTypeMap/​Scanner/​JavaPeerScanner.cs Tightens forwarded-type resolution with an explicit null-aware lookup.
src/​Microsoft.Android.Sdk.TrimmableTypeMap/​Scanner/​JavaAnnotationParser.cs Tightens dictionary lookup/null handling around resolved indices.
src/​Microsoft.Android.Sdk.TrimmableTypeMap/​README.md Updates documentation paths and notes net11 generator/task location.
src/​Microsoft.Android.Sdk.TrimmableTypeMap/​Microsoft.Android.Sdk.TrimmableTypeMap.csproj Retargets generator library to $(DotNetTargetFramework) and removes now-unneeded references for net11.
src/​Microsoft.Android.Build.Tasks/​Tests/​Microsoft.Android.Build.Tasks.Tests/​Microsoft.Android.Build.Tasks.Tests.csproj Adds a new net11 test project for Microsoft.Android.Build.Tasks.
src/​Microsoft.Android.Build.Tasks/​Tests/​Microsoft.Android.Build.Tasks.Tests/​GenerateTrimmableTypeMapTests.cs Updates tests to use the moved task type and adjusts Mono.Android discovery logic.
src/​Microsoft.Android.Build.Tasks/​Tests/​Microsoft.Android.Build.Tasks.Tests/​GenerateMissingTypeMapStubsTests.cs Updates tests to reference Microsoft.Android.Tasks task types.
src/​Microsoft.Android.Build.Tasks/​Tests/​Microsoft.Android.Build.Tasks.Tests/​BaseTest.cs Adds a lightweight base test helper for the new task test project.
src/​Microsoft.Android.Build.Tasks/​Tasks/​GenerateTrimmableTypeMap.cs Moves task entrypoint into Microsoft.Android.Tasks and adjusts helper implementations.
src/​Microsoft.Android.Build.Tasks/​Tasks/​GenerateMissingTypeMapStubs.cs Moves task entrypoint namespace to Microsoft.Android.Tasks.
src/​Microsoft.Android.Build.Tasks/​Microsoft.Android.Build.Tasks.csproj Adds direct references needed for moved tasks and links shared utilities/resources.
.github/​skills/​tests/​SKILL.md Updates the tests skill guidance to include the new standalone task tests.
.github/​skills/​tests/​references/​test-catalog.md Adds the new Microsoft.Android.Build.Tasks.Tests project to the test catalog.
Suppressed comments (1)

src/Microsoft.Android.Build.Tasks/Tasks/GenerateTrimmableTypeMap.cs:389

  • ⚠️ warning Error handlingLoadCustomViewTypeNames() assumes every line contains a ; separator and will throw IndexOutOfRangeException on blank/malformed lines (e.g., an empty trailing line or manual edits), failing the task. Consider parsing defensively and only collecting the keys since the values aren’t used.

simonrozsival and others added 5 commits September 4, 2026 11:30
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
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