Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,31 @@
</ItemGroup>
</Target>

<!--
Force the typemap to be generated in the OUTER build (the build that is not an inner
per-RID build, i.e. '$(_OuterIntermediateOutputPath)' == '') before _ResolveAssemblies
spawns the inner per-RID ILC build. The inner build consumes the typemap assembly list
(via _AddTrimmableTypeMapAssembliesToIlc -> _ReadGeneratedTrimmableTypeMapAssemblies)
but cannot generate it: _GenerateTrimmableTypeMap is gated to the outer build (it requires
'$(_OuterIntermediateOutputPath)' == ''). _GenerateTrimmableTypeMap's own AfterTargets="CoreCompile"
trigger does not fire when compilation is up-to-date - e.g. the IDE's separate "Compile" then
"SignAndroidPackage" invocations (BuildingInsideVisualStudio=true) - leaving the file ungenerated
and the inner build failing with "Trimmable typemap assembly list ... was not found".
This mirrors the CoreCLR _AddTrimmableTypeMapToLinker target, which forces generation before the
(outer) ILLink. _ResolveAssemblies runs after compilation (it consumes @(IntermediateAssembly)), so
the generator still observes the compiled app assembly.

The condition matches on '$(_OuterIntermediateOutputPath)' == '' (the same discriminator
_GenerateTrimmableTypeMap uses) rather than 'RuntimeIdentifier == ''' so that single-RID outer
builds (e.g. -p:RuntimeIdentifier=android-arm64) are covered too; the inner build sets
_OuterIntermediateOutputPath via _ResolveAssemblies AdditionalProperties, so this target is
correctly skipped there.
-->
<Target Name="_EnsureTrimmableTypeMapGeneratedForNativeAotInnerBuild"
Condition=" '$(_OuterIntermediateOutputPath)' == '' "
BeforeTargets="_ResolveAssemblies"
DependsOnTargets="_GenerateTrimmableTypeMap" />

<Target Name="_CollectTrimmableNativeAotDgmlFiles"
Condition=" '$(PublishTrimmed)' == 'true' and '$(_ProguardProjectConfiguration)' != '' ">
<ItemGroup>
Expand Down
Loading