Skip to content

[TrimmableTypeMap] Add ComputeTypeMapDependencies pre-task for partial builds #11492

@simonrozsival

Description

@simonrozsival

Part of #10958.

The proposed per-assembly MSBuild partial-build design needs a lightweight dependency pre-task that computes which assemblies can affect each typemap unit. This issue tracks implementing that pre-task independently, without changing typemap generation yet.

Goal

Add a ComputeTypeMapDependencies-style MSBuild task that reads assembly metadata and produces per-assembly dependency metadata suitable for later Inputs/Outputs wiring.

Proposed behavior

  • Read each input assembly's AssemblyRef metadata using System.Reflection.Metadata/PEReader.
  • Build the transitive assembly dependency graph for the resolved assembly set.
  • Prune dependencies that cannot affect trimmable typemap generation, especially assemblies with no path to Java-peer-bearing assemblies such as Mono.Android or Java.Interop.
  • Output items for each candidate typemap input assembly with metadata containing its relevant dependency closure.

Current related code

  • src/Microsoft.Android.Sdk.TrimmableTypeMap/Scanner/AssemblyIndex.cs already reads metadata and type references, but it builds a richer scan index than this pre-task should need.
  • src/Xamarin.Android.Build.Tasks/Microsoft.Android.Sdk/targets/Microsoft.Android.Sdk.TypeMap.Trimmable.targets currently passes all assemblies directly to GenerateTrimmableTypeMap.

Acceptance criteria

  • New task computes deterministic per-assembly dependency metadata from a set of resolved assemblies.
  • Task is covered by unit tests using small fixture assemblies or existing test infrastructure.
  • No behavior change to typemap generation yet; this is an enabling step for later partial-build wiring.

Metadata

Metadata

Assignees

No one assigned

    Labels

    copilot`copilot-cli` or other AIs were used to author thistrimmable-type-map

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions