Skip to content

[r8-obfuscation] Enable R8 JNI name obfuscation for CoreCLR - #12632

Draft
simonrozsival wants to merge 13 commits into
simonrozsival-trimmable-typemap-jni-rewritingfrom
simonrozsival-coreclr-r8-jni-integration
Draft

[r8-obfuscation] Enable R8 JNI name obfuscation for CoreCLR#12632
simonrozsival wants to merge 13 commits into
simonrozsival-trimmable-typemap-jni-rewritingfrom
simonrozsival-coreclr-r8-jni-integration

Conversation

@simonrozsival

@simonrozsival simonrozsival commented Sep 1, 2026

Copy link
Copy Markdown
Member

Related to #12535

Depends on #12631

Layer 5 of 6 in the replacement stack for #12575. This layer adds the shared two-pass R8 seed/final mapping machinery and enables opt-in JNI name obfuscation for trimmed CoreCLR builds. NativeAOT support follows in layer 6.

Testing:

  • Parsed all modified MSBuild targets and resources as XML.
  • Built Xamarin.Android.Build.Tasks.csproj and the complete Xamarin.Android.Build.Tests.csproj.
  • Passed all 35 focused GenerateProguardConfiguration/R8 task tests, including canonical LF manifest output for the Windows failure in build 1577218.
  • Attempted all three CoreCLR integration tests; the local environment blocked project restore with NETSDK1147 because the unrelated wasm-tools workload is not installed.

@simonrozsival
simonrozsival force-pushed the simonrozsival-coreclr-r8-jni-integration branch from bdfec0a to 7c15701 Compare September 1, 2026 19:34
@simonrozsival
simonrozsival force-pushed the simonrozsival-coreclr-r8-jni-integration branch from f51fbae to f88d2f4 Compare September 1, 2026 22:33
@simonrozsival

Copy link
Copy Markdown
Member Author

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines will not run the associated pipelines, because the pull request was updated after the run command was issued. Review the pull request again and issue a new run command.

@simonrozsival

Copy link
Copy Markdown
Member Author

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines will not run the associated pipelines, because the pull request was updated after the run command was issued. Review the pull request again and issue a new run command.

@simonrozsival

Copy link
Copy Markdown
Member Author

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines will not run the associated pipelines, because the pull request was updated after the run command was issued. Review the pull request again and issue a new run command.

@simonrozsival

Copy link
Copy Markdown
Member Author

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines will not run the associated pipelines, because the pull request was updated after the run command was issued. Review the pull request again and issue a new run command.

@simonrozsival

Copy link
Copy Markdown
Member Author

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines will not run the associated pipelines, because the pull request was updated after the run command was issued. Review the pull request again and issue a new run command.

@simonrozsival
simonrozsival force-pushed the simonrozsival-coreclr-r8-jni-integration branch from 1cee050 to 65740e9 Compare September 2, 2026 09:05
@simonrozsival
simonrozsival force-pushed the simonrozsival-coreclr-r8-jni-integration branch from 2f3c599 to 5e41251 Compare September 2, 2026 11:23
@simonrozsival
simonrozsival force-pushed the simonrozsival-coreclr-r8-jni-integration branch from 5e41251 to cbc7457 Compare September 2, 2026 11:59
@simonrozsival
simonrozsival force-pushed the simonrozsival-coreclr-r8-jni-integration branch from cbc7457 to 61d0a23 Compare September 2, 2026 12:23
@simonrozsival

Copy link
Copy Markdown
Member Author

/azp run

@azure-pipelines

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

@simonrozsival
simonrozsival force-pushed the simonrozsival-coreclr-r8-jni-integration branch from 61d0a23 to ed2522d Compare September 2, 2026 15:23
@simonrozsival

Copy link
Copy Markdown
Member Author

/azp run

@azure-pipelines

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

@simonrozsival
simonrozsival force-pushed the simonrozsival-coreclr-r8-jni-integration branch from 60b031c to 15c4b79 Compare September 2, 2026 21:34
simonrozsival and others added 13 commits September 3, 2026 07:00
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Allow seed R8 to rename ACWs, track final R8 generated inputs, and keep validation mappings private when public mapping output is disabled.

Use canonical LF expectations for generated reachability manifests.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Build the seed R8 configuration from user and library consumer rules instead of final generated configuration, whose baseline native-method rule pins ACW names.

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>
Generate identity keep rules directly from the merged text manifest so seed R8 does not require resources to be linked early. Keep final AAPT resource rules on their normal late path and cover manifest normalization, provenance, and resource independence.\n\nCo-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Assert that an activity alias identity is not treated as a Java class while its target activity remains protected.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Prepare the manifest merger directory before seed manifest rule generation, and keep generated ACW pinning rules out of final JNI-obfuscating R8 passes while retaining final AAPT and mapped reachability rules.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copy the shared trimmable manifest into each inner build before seed manifest merging, and validate final R8 output through its configured public mapping path.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Allow blank records when validating generated reachability manifests, and resolve the final AAPT rules through their explicit configuration provenance instead of filesystem name uniqueness.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Convert manifest-style JNI paths to the native directory separator at the filesystem copy boundary.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@simonrozsival
simonrozsival force-pushed the simonrozsival-coreclr-r8-jni-integration branch from 15c4b79 to 6a05a22 Compare September 3, 2026 05:00
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.

1 participant