[TrimmableTypeMap] Wire AcwMapWriter to populate acw-map.txt#11015
Conversation
Pass AcwMapOutputFile to GenerateTrimmableTypeMap so AcwMapWriter produces real managed→Java mappings for _ConvertCustomView and layout fixup. The <Touch> in _GenerateJavaStubs now only creates an empty placeholder when _GenerateTrimmableTypeMap was skipped. The generated acw-map.txt is tracked in @(FileWrites) from both targets. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
a27e14f
into
dev/simonrozsival/trimmable-typemap-build-pipeline
There was a problem hiding this comment.
Pull request overview
This PR aims to make the trimmable typemap build path generate a usable acw-map.txt (managed → Java/ACW mappings) so downstream targets like _ConvertCustomView can correctly rewrite custom view names in layout XML.
Changes:
- Pass a new
AcwMapOutputFileparameter intoGenerateTrimmableTypeMap. - Track
acw-map.txtas an output viaFileWritesand adjust the placeholder<Touch>to only run when the file doesn’t exist.
| ApplicationJavaClass="$(AndroidApplicationJavaClass)" | ||
| AcwMapOutputFile="$(IntermediateOutputPath)acw-map.txt"> |
There was a problem hiding this comment.
GenerateTrimmableTypeMap is being invoked with a new AcwMapOutputFile parameter, but the task implementation currently has no matching public settable property. MSBuild will fail with MSB4064/MSB4063 (“parameter is not supported”) unless GenerateTrimmableTypeMap is updated to accept this parameter (or the parameter name is corrected to match the task).
| ApplicationJavaClass="$(AndroidApplicationJavaClass)" | |
| AcwMapOutputFile="$(IntermediateOutputPath)acw-map.txt"> | |
| ApplicationJavaClass="$(AndroidApplicationJavaClass)"> |
| <ItemGroup> | ||
| <FileWrites Include="@(_GeneratedTypeMapAssemblies)" /> | ||
| <FileWrites Include="@(_GeneratedJavaFiles)" /> | ||
| <FileWrites Include="$(_TypeMapBaseOutputDir)AndroidManifest.xml" /> | ||
| <FileWrites Include="$(IntermediateOutputPath)acw-map.txt" /> |
There was a problem hiding this comment.
acw-map.txt is now a real output of _GenerateTrimmableTypeMap, but the target’s Outputs only include the typemap DLL. This can let MSBuild skip _GenerateTrimmableTypeMap as up-to-date even when acw-map.txt is missing/outdated (e.g., file deleted or partially cleaned), and the later <Touch> fallback would then create an empty placeholder, breaking _ConvertCustomView. Include $(IntermediateOutputPath)acw-map.txt (and any other required outputs) in the target’s Outputs so incrementality is correct.
Pass AcwMapOutputFile to GenerateTrimmableTypeMap so AcwMapWriter produces real managed→Java mappings for _ConvertCustomView and layout fixup. The <Touch> in _GenerateJavaStubs now only creates an empty placeholder when _GenerateTrimmableTypeMap was skipped. The generated acw-map.txt is tracked in @(FileWrites) from both targets. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Part of #10807
Depends on #10980
Summary
Wires the existing
AcwMapWriterclass intoGenerateTrimmableTypeMapso thatacw-map.txtis populated with real managed→Java name mappings instead of being an empty placeholder.This enables
_ConvertCustomViewto correctly rewrite custom view names in layout XMLs for the trimmable typemap path.Changes
GenerateTrimmableTypeMap.cs: AddedAcwMapOutputFileproperty andWriteAcwMap()method that callsAcwMapWriter.Write()Microsoft.Android.Sdk.TypeMap.Trimmable.targets: PassesAcwMapOutputFileto the task, adds toFileWrites, demotes<Touch>to a fallback