Skip to content

[xabt] Disable legacy assembly fixups for trimmable typemap - #12659

Open
simonrozsival wants to merge 3 commits into
mainfrom
simonrozsival-investigate-r-java-ids
Open

[xabt] Disable legacy assembly fixups for trimmable typemap#12659
simonrozsival wants to merge 3 commits into
mainfrom
simonrozsival-investigate-r-java-ids

Conversation

@simonrozsival

@simonrozsival simonrozsival commented Sep 3, 2026

Copy link
Copy Markdown
Member

Summary

  • add AndroidEnableLegacyCompatibilityAssemblyFixups
  • default it to false for the trimmable typemap and true for LLVM-IR
  • gate the untrimmed FixAbstractMethodsStep, FixLegacyResourceDesignerStep, and AddKeepAlivesStep passes behind the property
  • preserve the existing non-compatibility LinkAssembliesNoShrink scanning and staging behavior
  • document the untrimmed-only opt-in semantics and log when the compatibility passes are skipped
  • cover both pipeline composition and the actual trimmable default/explicit opt-in MSBuild wiring

Trimmed trimmable builds already exclude these compatibility rewriters, so this closes the remaining untrimmed path by default while retaining an escape hatch for older binding/resource-designer binaries in untrimmed builds.

Follow-up to #10842.

Validation

  • target XML validation
  • MSBuild property evaluation: trimmable defaults to false, LLVM-IR defaults to true, and an explicit trimmable opt-in remains true
  • focused pipeline unit coverage for enabled and disabled compatibility passes
  • full-build AndroidAddKeepAlives cases for trimmable default-off and explicit opt-in added for CI
  • local full-build execution unavailable because this worktree has no prepared local Android SDK or JDK

Gate the untrimmed legacy resource, abstract method, and keep-alive assembly rewrites behind AndroidEnableLegacyCompatibilityAssemblyFixups. Preserve the existing default for LLVM-IR builds while disabling the fixups by default for the trimmable typemap.

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

🟢 Approval recommended

The changes are coherent and tested, and the behavior is guarded behind a clearly documented opt-in property with typemap-specific defaults.

Review tier: Lite
Findings: 1 Low severity

New issues introduced by this change (1)
Severity Finding
Low severity src/​Xamarin.Android.Build.Tasks/​Tasks/​LinkAssembliesNoShrink.cs — 💡 suggestion MaintainabilityEnableLegacyCompatibilityAssemblyFixups has a = true
What changed in this PR

This PR introduces an opt-in MSBuild property to control “legacy compatibility” assembly rewrite steps in untrimmed builds, defaulting it off for the trimmable typemap and on for the LLVM-IR typemap. This aligns the untrimmed behavior more closely with the trimmable trimmed pipeline while retaining an escape hatch for older assemblies.

Changes:

  • Added AndroidEnableLegacyCompatibilityAssemblyFixups and plumbed it into LinkAssembliesNoShrink.
  • Defaulted the property to false for trimmable typemap builds and true for LLVM-IR typemap builds.
  • Added a focused unit test asserting the pipeline steps are included/excluded based on the new flag, and documented the property.
File Description
src/​Xamarin.Android.Build.Tasks/​Xamarin.Android.Common.targets Passes the new MSBuild property into LinkAssembliesNoShrink and includes it in the build properties cache.
src/​Xamarin.Android.Build.Tasks/​Tests/​Xamarin.Android.Build.Tests/​Tasks/​LinkerTests.cs Adds a unit test verifying pipeline-step presence is gated by the new flag.
src/​Xamarin.Android.Build.Tasks/​Tasks/​LinkAssembliesNoShrink.cs Gates FixAbstractMethodsStep, FixLegacyResourceDesignerStep, and AddKeepAlivesStep behind EnableLegacyCompatibilityAssemblyFixups.
src/​Xamarin.Android.Build.Tasks/​Microsoft.Android.Sdk/​targets/​Microsoft.Android.Sdk.TypeMap.Trimmable.targets Sets the default AndroidEnableLegacyCompatibilityAssemblyFixups to false for trimmable typemap builds (when unset by user).
src/​Xamarin.Android.Build.Tasks/​Microsoft.Android.Sdk/​targets/​Microsoft.Android.Sdk.TypeMap.LlvmIr.targets Sets the default AndroidEnableLegacyCompatibilityAssemblyFixups to true for LLVM-IR typemap builds (when unset by user).
Documentation/​docs-mobile/​building-apps/​build-properties.md Documents the new build property and its defaults.

Comment thread src/Xamarin.Android.Build.Tasks/Tasks/LinkAssembliesNoShrink.cs
simonrozsival and others added 2 commits September 3, 2026 10:45
Document the untrimmed-only scope, log skipped compatibility fixups, preserve coverage for the common assembly pipeline, and exercise the trimmable default and explicit opt-in through a full build test.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Import the build task logging extensions required by the new diagnostic and clarify that the task property initializer is only the direct-caller fallback.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants