-
Notifications
You must be signed in to change notification settings - Fork 569
[TrimmableTypeMap] Manifest generator fixes #11143
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
simonrozsival
merged 6 commits into
main
from
dev/simonrozsival/trimmable-manifest-fixes
Apr 18, 2026
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
8978bb9
[TrimmableTypeMap] Default instrumentation targetPackage to app packa…
simonrozsival a29c17f
[TrimmableTypeMap] Fix stale manifest causing ClassNotFoundException …
simonrozsival 5f4cf43
[TrimmableTypeMap] Use outer IntermediateOutputPath for typemap/manif…
simonrozsival 2baf64e
[TrimmableTypeMap] Rewrite compat JNI names in manifest template to C…
simonrozsival 01fc77a
[TrimmableTypeMap] Address review feedback on manifest fixes
simonrozsival 6c3f565
[TrimmableTypeMap] Address PR 11143 review comments
simonrozsival File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
20 changes: 20 additions & 0 deletions
20
src/Microsoft.Android.Sdk.TrimmableTypeMap/Generator/ManifestNameResolver.cs
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| using System; | ||
|
|
||
| namespace Microsoft.Android.Sdk.TrimmableTypeMap; | ||
|
|
||
| static class ManifestNameResolver | ||
| { | ||
| /// <summary> | ||
| /// Resolves an <c>android:name</c> value to a fully-qualified class name. | ||
| /// Names starting with '.' are relative to the package. Names with no '.' at all | ||
| /// are also treated as relative (Android tooling convention). | ||
| /// </summary> | ||
| public static string Resolve (string name, string packageName) | ||
| { | ||
| return name switch { | ||
| _ when name.StartsWith (".", StringComparison.Ordinal) => packageName + name, | ||
| _ when name.IndexOf ('.') < 0 && !packageName.IsNullOrEmpty () => packageName + "." + name, | ||
| _ => name, | ||
| }; | ||
| } | ||
| } |
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
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
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤖 💡 Correctness —
DescendantsAndSelf()iterates all manifest elements, so this rewritesandroid:nameon<meta-data>,<action>,<category>,<permission>,<uses-permission>,<uses-feature>, etc. — not just component elements whereandroid:namedenotes a Java class.While a collision is unlikely in practice (the
compatToCrcdictionary only contains actual peer class names), scoping to component element types would be more defensive:This matches the scope that
RootManifestReferencedTypesuses inTrimmableTypeMapGenerator.