Skip to content

[NativeAOT] Fix incremental build test with trimmable type map - #11283

Merged
simonrozsival merged 2 commits into
mainfrom
dev/sbomer/incremental-naot-typemap
May 5, 2026
Merged

[NativeAOT] Fix incremental build test with trimmable type map#11283
simonrozsival merged 2 commits into
mainfrom
dev/sbomer/incremental-naot-typemap

Conversation

@sbomer

@sbomer sbomer commented May 4, 2026

Copy link
Copy Markdown
Member

Avoid running _AfterILLinkAdditionalSteps which as I understand should not be needed when using the trimmable type map. Fixes an incremental build issue with NativeAOT where this target was updating the timestamp of a shared designer assembly that is input into CoreCompile, causing CoreCompile to rerun on every incremental build.

Related issues

sbomer and others added 2 commits May 4, 2026 13:17
The trimmable typemap has its own complete pipeline for Java object
discovery and typemap generation (GenerateTrimmableTypeMap + JavaPeerScanner),
making the AssemblyModifierPipeline steps (FindJavaObjectsStep,
SaveChangedAssemblyStep, FindTypeMapObjectsStep) unnecessary.

_AfterILLinkAdditionalSteps was running unconditionally for trimmable
builds because its Input (link.flag) is never created when ILLink is
skipped (NativeAOT+trimmable), causing MSBuild to treat the target as
always out-of-date. This resulted in cascading rebuilds where the
in-place assembly processing made CoreCompile reference inputs newer
than its outputs.

Add a condition to skip _AfterILLinkAdditionalSteps when using the
trimmable typemap, matching the established pattern used throughout
NativeAOT.targets.

Also re-enable the NativeAOT incremental build test that was blocked
by this issue.

Fixes #11265

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Assisted-by: Claude:claude-opus-4.6-1m
Parameterize the test to run for both CoreCLR and NativeAOT runtimes
with the trimmable typemap. The test checks for XACIC7004 error strings
which are not runtime-specific.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Assisted-by: Claude:claude-opus-4.6-1m
Copilot AI review requested due to automatic review settings May 4, 2026 20:46

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.

Pull request overview

This PR updates the Android build pipeline so trimmable typemap builds stop running the legacy post-ILLink assembly-modification target, which is intended to avoid the incremental-build churn seen with NativeAOT. It also updates the corresponding trimmable typemap regression tests in the build test suite.

Changes:

  • Gate _AfterILLinkAdditionalSteps so it does not run when _AndroidTypeMapImplementation is trimmable.
  • Re-enable the trimmable typemap incremental-build test for NativeAOT.
  • Expand the copy/mismatch regression test to run for both CoreCLR and NativeAOT.
Show a summary per file
File Description
src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets Skips the post-ILLink assembly modifier target for trimmable typemap builds.
src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/TrimmableTypeMapBuildTests.cs Updates trimmable typemap regression tests to include NativeAOT scenarios.

Copilot's findings

  • Files reviewed: 2/2 changed files
  • Comments generated: 1

Comment on lines 40 to 42
var proj = new XamarinAndroidApplicationProject {
IsRelease = isRelease,
};

@simonrozsival simonrozsival left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The test failing in CI is unrelated

@simonrozsival
simonrozsival merged commit 5368eda into main May 5, 2026
6 of 7 checks passed
@simonrozsival
simonrozsival deleted the dev/sbomer/incremental-naot-typemap branch May 5, 2026 13:39
@github-actions github-actions Bot locked and limited conversation to collaborators Jun 5, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants