[Xamarin.Android.Build.Tasks] Remove R8 assembly rewriter - #12846
Merged
Merged
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
The test project has an unresolved compile issue after the project reference removal; localization artifacts also need synchronization.
Get a fresh assessment by requesting another Copilot review.
Review effort: Lite
Findings: 1
Open (2)
What changed in this PR
Removes the experimental R8 managed-assembly rewriter while retaining ordinary R8 processing and R8Mapping.
Changes:
- Deletes rewriter implementation, tasks, fixtures, and tests.
- Removes XA4325/XA4326 resources and documentation.
- Retains and updates
R8Mappingtests.
| File | Change |
|---|---|
tests/Microsoft.Android.Sdk.TrimmableTypeMap.IntegrationTests/JniAssemblyRewriterTests.cs |
Removes rewriter integration tests. |
tests/Microsoft.Android.Sdk.TrimmableTypeMap.IntegrationTests/GeneratedTypeMapRewriterTests.cs |
Removes typemap rewriter tests. |
src/Xamarin.Android.Build.Tasks/Utilities/JniRemapping/NativeResourceSectionCopier.cs |
Removes resource rewrite helper. |
src/Xamarin.Android.Build.Tasks/Utilities/JniRemapping/MetadataRawColumns.cs |
Removes metadata helper. |
src/Xamarin.Android.Build.Tasks/Utilities/JniRemapping/MetadataEncoding.cs |
Removes encoding helper. |
src/Xamarin.Android.Build.Tasks/Utilities/JniRemapping/LdstrRewriter.cs |
Removes string rewriter. |
src/Xamarin.Android.Build.Tasks/Utilities/JniRemapping/JniRewritePlanner.cs |
Removes rewrite planning logic. |
src/Xamarin.Android.Build.Tasks/Utilities/JniRemapping/JniRewritePlan.cs |
Removes rewrite plan and IL scanner. |
src/Xamarin.Android.Build.Tasks/Utilities/JniRemapping/JniRewriteException.cs |
Removes rewrite exception. |
src/Xamarin.Android.Build.Tasks/Utilities/JniRemapping/JniDescriptorText.cs |
Removes descriptor helper. |
src/Xamarin.Android.Build.Tasks/Utilities/JniRemapping/JniAssemblyRewriter.cs |
Removes rewriter entry point. |
src/Xamarin.Android.Build.Tasks/Utilities/JniRemapping/IlOpcodeTable.cs |
Removes opcode metadata. |
src/Xamarin.Android.Build.Tasks/Utilities/JniRemapping/FieldRvaTable.cs |
Removes FieldRVA support. |
src/Xamarin.Android.Build.Tasks/Utilities/JniRemapping/CustomAttributeStringRewriter.cs |
Removes attribute rewriting helper. |
src/Xamarin.Android.Build.Tasks/Utilities/JniRemapping/AssemblyRebuilder.cs |
Removes PE reconstruction implementation. |
src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Utilities/JniRemapping/R8MappingTests.cs |
Retains parser coverage and removes deleted helper usage. |
src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Utilities/JniRemapping/NativeResourceSectionCopierTests.cs |
Removes helper tests. |
src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Utilities/JniRemapping/LdstrRewriterTests.cs |
Removes string-rewriter tests. |
src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Utilities/JniRemapping/JniFixtureBuilder.cs |
Removes rewrite fixtures. |
src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Utilities/JniRemapping/JniDescriptorTextTests.cs |
Removes descriptor-helper tests. |
src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Utilities/JniRemapping/AssemblyRebuilderTests.cs |
Removes rebuilder tests. |
src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Tasks/RewriteJniNamesForR8Tests.cs |
Removes task tests. |
src/Xamarin.Android.Build.Tasks/Tasks/RewriteJniNamesForR8.cs |
Removes the experimental rewrite task. |
src/Xamarin.Android.Build.Tasks/Properties/Resources.resx |
Removes XA4325/XA4326 resources. |
src/Xamarin.Android.Build.Tasks/Properties/Resources.Designer.cs |
Removes generated resource accessors. |
src/Microsoft.Android.Build.Tasks/Tests/Microsoft.Android.Build.Tasks.Tests/Microsoft.Android.Build.Tasks.Tests.csproj |
Removes the rewriter-only project reference. |
src/Microsoft.Android.Build.Tasks/Tests/Microsoft.Android.Build.Tasks.Tests/JniAssemblyRewriterTypeMapTests.cs |
Removes rewriter type-map tests. |
Documentation/docs-mobile/TOC.yml |
Removes diagnostic navigation entries. |
Documentation/docs-mobile/messages/xa4326.md |
Removes XA4326 documentation. |
Documentation/docs-mobile/messages/xa4325.md |
Removes XA4325 documentation. |
Documentation/docs-mobile/messages/index.md |
Removes diagnostic index entries. |
Files not reviewed (1)
- src/Xamarin.Android.Build.Tasks/Properties/Resources.Designer.cs: Generated file
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
simonrozsival
added this pull request to stack #12850
September 21, 2026 14:15
This was referenced Sep 21, 2026
rolfbjarne
approved these changes
Sep 21, 2026
jonathanpeppers
approved these changes
Sep 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Summary
Remove the experimental build-time managed-assembly rewriting approach for R8 so any future assembly-rewriting design can start from a clean foundation.
This cleanup is related to #12535 and the original prototype in #12575.
What this PR undoes
This removes the managed rewriting implementation developed across the R8 obfuscation stack:
Concretely, this PR removes the rewrite task, rewrite-only metadata/IL utilities, dedicated tests and fixtures, and the XA4325/XA4326 resources and documentation. The intent is to abandon this implementation rather than preserve an unused rewriting stack that a future design would need to work around.
What remains in place
R8Mappingparser introduced in [r8-obfuscation] Add R8 JNI mapping primitives #12628 remains, along with its tests and theMSBuildDeviceIntegrationconsumer. It is independently useful for reading R8 mapping files.private-membersobfuscation/optimization policy from [r8] Add configurable private-member obfuscation and optimization #12668 remain unchanged. This PR does not disable R8 or remove private-member obfuscation.We may revisit managed assembly rewriting in .NET 12 based on customer feedback and performance data, but with a fresh design rather than this implementation.
Validation
Xamarin.Android.Build.TasksMicrosoft.Android.Build.Tasks.TestsMicrosoft.Android.Sdk.TrimmableTypeMap.IntegrationTestsMSBuildDeviceIntegrationR8MappingTests