Recognize TrimMode=partial in ILCompiler targets (#71117)
authorMichal Strehovský <MichalStrehovsky@users.noreply.github.com>
Fri, 15 Jul 2022 08:09:42 +0000 (17:09 +0900)
committerGitHub <noreply@github.com>
Fri, 15 Jul 2022 08:09:42 +0000 (01:09 -0700)
This should root all non-trimmable assemblies, same as TrimmerDefaultAction=copy.

We still support consuming ILCompiler through NuGet when targeting .NET 6, so recognize the old thing too. We might want to cut the .NET 6 support close to RC and at that time TrimmerDefaultAction handling can go away.

Related: https://github.com/dotnet/linker/pull/2856.

src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.targets

index 1c99b64..52ac04a 100644 (file)
@@ -246,7 +246,7 @@ The .NET Foundation licenses this file to you under the MIT license.
       <IlcArg Include="@(_IlcConditionallyRootedAssemblies->'--conditionalroot:%(Identity)')" />
       <IlcArg Include="@(_IlcTrimmedAssemblies->'--trim:%(Identity)')" />
       <IlcArg Include="@(_IlcNoSingleWarnAssemblies->'--nosinglewarnassembly:%(Filename)')" />
-      <IlcArg Condition="'$(TrimmerDefaultAction)' == 'copyused' or '$(TrimmerDefaultAction)' == 'copy'" Include="--defaultrooting" />
+      <IlcArg Condition="'$(TrimmerDefaultAction)' == 'copyused' or '$(TrimmerDefaultAction)' == 'copy' or '$(TrimMode)' == 'partial'" Include="--defaultrooting" />
       <IlcArg Include="--resilient" />
 
       <IlcArg Condition="$(IlcDisableReflection) == 'true'" Include="--feature:System.Reflection.IsReflectionExecutionAvailable=false" />