[TrimmableTypeMap] Generate AndroidManifest.xml from component attributes (#10807)#10983
Open
simonrozsival wants to merge 1 commit intodev/simonrozsival/trimmable-typemap-build-pipelinefrom
Conversation
c5c6fe3 to
e2214d6
Compare
e2214d6 to
9475135
Compare
fa6d25a to
427185b
Compare
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
427185b to
5c3d262
Compare
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
Generate
AndroidManifest.xmlfrom[Activity],[Service],[BroadcastReceiver],[ContentProvider]attributes in the trimmable typemap path — replacing the manual manifest copy hack. Closes #10807.Approach
No Cecil. The SRM-based
JavaPeerScanneris extended to capture full component attribute metadata, and a newTrimmableManifestGeneratorconverts it to manifest XML. Everything runs in a single scan pass insideGenerateTrimmableTypeMap.What is included
Scanner extensions (
AssemblyIndex.cs,JavaPeerScanner.cs,JavaPeerInfo.cs)[Activity],[Service], etc. +[IntentFilter]+[MetaData][Permission],[UsesPermission],[UsesFeature],[UsesLibrary],[UsesConfiguration],[Application],[MetaData],[Property], etc.HasPublicDefaultConstructorcheck via SRM method inspectionParseNameAndPropertiesgeneric helper eliminates 3 duplicate parse methodsComponentInfo,IntentFilterInfo,MetaDataInfo,AssemblyManifestInfo,PermissionInfo,UsesPermissionInfo,UsesFeatureInfo,UsesLibraryInfo,UsesConfigurationInfo,PropertyInfoManifest generator (
TrimmableManifestGenerator.cs)PropertyMapping[]arrays + oneApplyMappingsloop (instead of 56 individual method calls)android:XML attributesLaunchMode,ScreenOrientation,ConfigChanges,SoftInput,DocumentLaunchMode,UiOptions,ForegroundServiceType,Protection,ActivityPersistableModeMainLauncher-><intent-filter>with MAIN/LAUNCHER +android:exported="true"MonoRuntimeProviderinjection (with multi-process support)<permission>,<uses-permission>,<uses-feature>,<uses-library>,<uses-configuration>,<property>with name-based deduplicationManifestPlaceholders(${key}-> value replacement)CheckedBuild->android:debuggable="true"+android:extractNativeLibs="true"ApplicationJavaClass-><application android:name="...">VersionCodedefaults to"1"matching legacy behaviorValidation
[Application]types or mixed assembly-level + type-levelUnit tests (
TrimmableManifestGeneratorTests.cs)[TestCase]parameterization), all pass in ~130msTargets (
Microsoft.Android.Sdk.TypeMap.Trimmable.targets)GenerateTrimmableTypeMaptask_ResolvedAssembliesfor assembly store inclusionValidated with HelloWorld sample
Generated manifest matches legacy path output (activities, intent-filters, runtime provider, template merging all correct). The Android Manifest Merger downstream step handles library manifest merging as before.
Depends on