Skip to content

[TrimmableTypeMap] Wire AcwMapWriter to populate acw-map.txt#11015

Merged
simonrozsival merged 1 commit intodev/simonrozsival/trimmable-typemap-build-pipelinefrom
dev/simonrozsival/trimmable-typemap-acw-map-writer
Mar 25, 2026
Merged

[TrimmableTypeMap] Wire AcwMapWriter to populate acw-map.txt#11015
simonrozsival merged 1 commit intodev/simonrozsival/trimmable-typemap-build-pipelinefrom
dev/simonrozsival/trimmable-typemap-acw-map-writer

Conversation

@simonrozsival
Copy link
Member

Part of #10807
Depends on #10980

Summary

Wires the existing AcwMapWriter class into GenerateTrimmableTypeMap so that acw-map.txt is populated with real managed→Java name mappings instead of being an empty placeholder.

This enables _ConvertCustomView to correctly rewrite custom view names in layout XMLs for the trimmable typemap path.

Changes

  • GenerateTrimmableTypeMap.cs: Added AcwMapOutputFile property and WriteAcwMap() method that calls AcwMapWriter.Write()
  • Microsoft.Android.Sdk.TypeMap.Trimmable.targets: Passes AcwMapOutputFile to the task, adds to FileWrites, demotes <Touch> to a fallback
  • Tests: Verifies acw-map content for Mono.Android types and empty assembly list

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>
@simonrozsival simonrozsival marked this pull request as ready for review March 25, 2026 13:54
Copilot AI review requested due to automatic review settings March 25, 2026 13:54
@simonrozsival simonrozsival merged commit a27e14f into dev/simonrozsival/trimmable-typemap-build-pipeline Mar 25, 2026
2 of 3 checks passed
@simonrozsival simonrozsival deleted the dev/simonrozsival/trimmable-typemap-acw-map-writer branch March 25, 2026 13:54
@simonrozsival simonrozsival added the copilot `copilot-cli` or other AIs were used to author this label Mar 25, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 AcwMapOutputFile parameter into GenerateTrimmableTypeMap.
  • Track acw-map.txt as an output via FileWrites and adjust the placeholder <Touch> to only run when the file doesn’t exist.

Comment on lines +76 to +77
ApplicationJavaClass="$(AndroidApplicationJavaClass)"
AcwMapOutputFile="$(IntermediateOutputPath)acw-map.txt">
Copy link

Copilot AI Mar 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Suggested change
ApplicationJavaClass="$(AndroidApplicationJavaClass)"
AcwMapOutputFile="$(IntermediateOutputPath)acw-map.txt">
ApplicationJavaClass="$(AndroidApplicationJavaClass)">

Copilot uses AI. Check for mistakes.
Comment on lines 83 to +87
<ItemGroup>
<FileWrites Include="@(_GeneratedTypeMapAssemblies)" />
<FileWrites Include="@(_GeneratedJavaFiles)" />
<FileWrites Include="$(_TypeMapBaseOutputDir)AndroidManifest.xml" />
<FileWrites Include="$(IntermediateOutputPath)acw-map.txt" />
Copy link

Copilot AI Mar 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
simonrozsival added a commit that referenced this pull request Mar 25, 2026
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

copilot `copilot-cli` or other AIs were used to author this

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants