Skip to content

[Xamarin.Android.Build.Tasks] Separate CoreCLR bootstrap - #13093

Open
simonrozsival wants to merge 2 commits into
mainfrom
simonrozsival-separate-coreclr-bootstrap-generation
Open

simonrozsival wants to merge 2 commits into
mainfrom
simonrozsival-separate-coreclr-bootstrap-generation

Conversation

@simonrozsival

@simonrozsival simonrozsival commented Oct 12, 2026 •

Copy link
Copy Markdown
Member

Why

Stacked follow-up to #13081, based on 07a0b2142eea5c50a1501db13b2db9af2f6e111c. No issue is closed by this cleanup.

CoreCLR configuration is already binary, but its inputs, JNI preload policy, missing-output recovery and completion stamp still belonged to _GeneratePackageManagerJava. Separate that responsibility into _AndroidGenerateCoreClrBootstrap, with its own input fingerprint, stamp and FileWrites registration before the SDK's incremental-clean snapshot. Reuse application-source prerequisites and their extension ordering; retarget both binary-blob producers and typemap assembly-count preparation. Java resource generation now tracks only the entry assembly filename and its generator, not environment/runtimeconfig/native-library changes.

Remove the unused runtime field, NativeAOT environment-clearing branch and nullable/no-output branch from the CoreCLR producer. Preserve the shipped GenerateNativeApplicationConfigSources task name and public properties. Explicitly approved behavior change: direct NativeAOT calls now fail with a clear task error instead of succeeding without output; the existing runtime parser's unknown-name handling is unchanged. Production NativeAOT never invokes this task.

No transport redesign, runtime/native-loader changes, new compatibility layer or deletion of required Java glue. NativeAOT linked data objects, independent providers/library hints and precise obsolete-Java upgrade cleanup remain intact.

Copilot AI balanced review requested due to automatic review settings October 12, 2026 21:22
@simonrozsival
simonrozsival added this pull request to stack #13083 October 12, 2026 21:25

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.

🟡 Changes recommended

The newly introduced task error must use the repository’s localized resource mechanism.

1 open finding
What changed in this PR

Separates CoreCLR bootstrap generation from Java resource generation with independent incremental tracking.

Changes:

  • Adds a dedicated CoreCLR bootstrap target, inputs fingerprint, stamp, and cleanup tracking.
  • Retargets remapping and trimmable-type-map dependencies.
  • Expands task, incremental-build, packaging, and runtime tests.
File Description
tests/​MSBuildDeviceIntegration/​Tests/​R8RuntimeRemappingBuildTests.cs Expands CoreCLR packaging coverage.
src/​Xamarin.Android.Build.Tasks/​Xamarin.Android.Common.targets Defines independent bootstrap generation.
src/​Xamarin.Android.Build.Tasks/​Tests/​Xamarin.Android.Build.Tests/​Tasks/​GenerateNativeApplicationConfigSourcesTests.cs Expands bootstrap task tests.
src/​Xamarin.Android.Build.Tasks/​Tests/​Xamarin.Android.Build.Tests/​IncrementalBuildTest.cs Tests bootstrap incrementality and recovery.
src/​Xamarin.Android.Build.Tasks/​Tasks/​GenerateNativeApplicationConfigSources.cs Restricts generation to CoreCLR.
src/​Xamarin.Android.Build.Tasks/​Microsoft.Android.Sdk/​targets/​Microsoft.Android.Sdk.TypeMap.Trimmable.targets Retargets typemap preparation.
src/​Xamarin.Android.Build.Tasks/​Microsoft.Android.Sdk/​targets/​Microsoft.Android.Sdk.R8JniRemapping.targets Updates binary-blob dependencies.
src/​Xamarin.Android.Build.Tasks/​Microsoft.Android.Sdk/​targets/​Microsoft.Android.Sdk.BuildOrder.targets Orders generation before cleanup and packaging.
src/​Microsoft.Android.Sdk.TrimmableTypeMap/​README.md Documents the revised pipeline.
src/​Microsoft.Android.Build.Tasks/​Tests/​Microsoft.Android.Build.Tasks.Tests/​NativeAotBootstrapTargetsTests.cs Verifies target separation.

🧠 Review effort: Balanced

Comment thread src/Xamarin.Android.Build.Tasks/Tasks/GenerateNativeApplicationConfigSources.cs Outdated
Base automatically changed from simonrozsival-nativeaot-static-data-objects to main October 13, 2026 22:04
simonrozsival and others added 2 commits October 14, 2026 00:34
Give binary CoreCLR configuration its own inputs, completion stamp and
FileWrites ownership instead of coupling it to Java resource generation.
Reuse application-source prerequisites, preserve extension ordering, and
wire both blob producers and typemap assembly preparation to the new
binary target.  Java resources now depend only on the entry assembly name.

Keep the shipped task name and properties.  Separately, reject direct
NativeAOT invocations with a clear error, as explicitly approved, instead
of silently succeeding without output.  Remove the dead environment
clearing and conditional-output branches; retain runtime parsing behavior.

Cover payload bytes, missing-output and failed-write recovery, Clean,
input isolation, JNI preload policy and NDK-free APK/AAB packaging.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Use an English resource for the unsupported-runtime exception rather
than a hard-coded message.  Include the original AndroidRuntime value
so direct-task failures identify the rejected input, while preserving
the existing AndroidTask error code and runtime parsing behavior.

Regenerate the resource accessor and extend the rejection fixture to
check both NativeAOT casing variants, the coded diagnostic, and the
absence of a bootstrap output.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@simonrozsival
simonrozsival force-pushed the simonrozsival-separate-coreclr-bootstrap-generation branch from b753380 to b14b6eb Compare October 13, 2026 22:48
@simonrozsival

Copy link
Copy Markdown
Member Author

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).

@simonrozsival

Copy link
Copy Markdown
Member Author

@dalexsoto review

This branch has not been deployed

No deployments
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