-
Notifications
You must be signed in to change notification settings - Fork 568
Open
Labels
Area: CoreCLRIssues that only occur when using CoreCLR.Issues that only occur when using CoreCLR.Area: NativeAOTIssues that only occur when using NativeAOT.Issues that only occur when using NativeAOT.needs-triageIssues that need to be assigned.Issues that need to be assigned.trimmable-type-map
Milestone
Description
Part of #10789
Depends on: Generator sub-issue (PR2)
Overview
Wire the scanner and generators into the MSBuild pipeline: implement the GenerateTypeMapAssembly task and fill in the trimmable .targets stubs.
MSBuild Task (GenerateTypeMapAssembly)
Thin orchestrator extending AndroidTask:
Inputs:
[Required] ResolvedAssemblies(ITaskItem[]) — all resolved assemblies to scan[Required] OutputDirectory(string) — output dir for generated assemblies[Required] JavaSourceOutputDirectory(string) — output dir for JCW.javafilesCustomViewMapFile(string) — custom view types from layout XMLErrorOnCustomJavaObject(bool)
Outputs:
[Output] GeneratedAssemblies(ITaskItem[]) — per-assembly typemaps + root assembly[Output] GeneratedJavaFiles(ITaskItem[]) — generated.javafiles[Output] TypeMapEntryAssemblyName(string)[Output] UpdatedResolvedAssemblies(ITaskItem[])
RunTask() flow:
- Scan assemblies →
List<JavaPeerInfo>(per-assembly, with incremental caching) - Load custom view map → mark matching types unconditional
- Generate per-assembly typemap assemblies (only for changed inputs)
- Generate root assembly (alias detection, cross-ref unconditional forcing)
- Generate JCW
.javafiles for ACW types - Set output properties
Targets Wiring
Microsoft.Android.Sdk.TypeMap.Trimmable.targets
UsingTaskdeclaration forGenerateTypeMapAssembly(fromMicrosoft.Android.Build.TypeMap.dll)- Define
_TypeMapAssemblyName=_Microsoft.Android.TypeMaps RuntimeHostConfigurationOptionforSystem.Runtime.InteropServices.TypeMappingEntryAssembly
Microsoft.Android.Sdk.TypeMap.Trimmable.CoreCLR.targets
_GeneratePerAssemblyTypeMapstarget with per-assemblyInputs/Outputsfor incrementality_GenerateRootTypeMaptarget for root assembly generation- Adds generated assemblies to resolved assemblies list for ILLink with
TrimmerRootAssemblymetadata - Adds
--typemap-entry-assembly:$(_TypeMapAssemblyName)to ILLink args - Override
_PrepareNativeAssemblySourcesas empty (no native typemap)
Microsoft.Android.Sdk.TypeMap.Trimmable.NativeAOT.targets
- Same generation targets
- Adds assemblies to
IlcReference,UnmanagedEntryPointsAssembly, andTrimmerRootAssembly
Incremental Build Support
Per-assembly typemap generation with MSBuild Inputs/Outputs:
<Target Name="_GeneratePerAssemblyTypeMaps"
Inputs="@(_ResolvedUserMonoAndroidAssemblies)"
Outputs="@(_ResolvedUserMonoAndroidAssemblies->'$(IntermediateOutputPath)typemaps/%(Filename).TypeMap.dll')">Typical incremental build: only app assembly changed → rescan app, regenerate app's typemap + root assembly. Cost: <0.5s.
Tests
- Task integration tests with
MockBuildEngine - Full build with
_AndroidTypeMapImplementation=trimmablesucceeds - Artifact validation: no
.otypemap objects, no legacymono.android.jarcopy - Incremental build: second build with no changes skips generation
- Incremental build: app assembly change only regenerates app typemap
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Area: CoreCLRIssues that only occur when using CoreCLR.Issues that only occur when using CoreCLR.Area: NativeAOTIssues that only occur when using NativeAOT.Issues that only occur when using NativeAOT.needs-triageIssues that need to be assigned.Issues that need to be assigned.trimmable-type-map