diff options
author | Sven Boemer <sbomer@gmail.com> | 2022-03-04 01:22:30 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-04 01:22:30 +0300 |
commit | 6246f84506a7f0a2cf990c2fddd7225691f4bc89 (patch) | |
tree | 9798579b768b1c816d75318d40a5ad96df893e7f /eng | |
parent | 9174037cc6b58de847c9c88b7dcceef2b4fda440 (diff) |
Run trim analyzer (#65870)
* Use SDK logic for IsTrimmable
* Address some analyzer warnings
* Disable analyzer when baseline suppressions exist
* Don't mark unannotated test project as trimmable
* Add nativeaot annotations
* Add suppression in windows-only code
* Import illink.targets only when trimming mobile tests
* Don't run analyzer on unannotated windows OOBs
* PR feedback
Use pragma instead of UnconditionalSuppressMessage
Diffstat (limited to 'eng')
-rw-r--r-- | eng/illink.targets | 3 | ||||
-rw-r--r-- | eng/testing/tests.mobile.targets | 2 | ||||
-rw-r--r-- | eng/versioning.targets | 5 |
3 files changed, 4 insertions, 6 deletions
diff --git a/eng/illink.targets b/eng/illink.targets index 320d21715ef..ce06abbf10e 100644 --- a/eng/illink.targets +++ b/eng/illink.targets @@ -1,5 +1,6 @@ <Project> <PropertyGroup> + <IsTrimmable Condition="'$(IsTrimmable)' == ''">true</IsTrimmable> <PrepareResourcesDependsOn> _EmbedILLinkXmls; $(PrepareResourcesDependsOn) @@ -35,6 +36,8 @@ <ILLinkSuppressionsXmlFile>$(ILLinkSuppressionsXmlFilePrefix).xml</ILLinkSuppressionsXmlFile> <ILLinkSuppressionsConfigurationSpecificXmlFile>$(ILLinkSuppressionsXmlFilePrefix).$(Configuration).xml</ILLinkSuppressionsConfigurationSpecificXmlFile> <ILLinkSuppressionsLibraryBuildXmlFile>$(ILLinkSuppressionsXmlFilePrefix).LibraryBuild.xml</ILLinkSuppressionsLibraryBuildXmlFile> + <!-- Only run the trim analyzer on libraries which have been annotated. --> + <EnableTrimAnalyzer Condition="'$(EnableTrimAnalyzer)' == '' And (Exists('$(ILLinkSuppressionsXmlFile)') Or Exists('$(ILLinkSuppressionsConfigurationSpecificXmlFile)'))">false</EnableTrimAnalyzer> <!-- if building a PDB, tell illink to rewrite the symbols file --> <ILLinkRewritePDBs Condition="'$(ILLinkRewritePDBs)' == '' and '$(DebugSymbols)' != 'false'">true</ILLinkRewritePDBs> diff --git a/eng/testing/tests.mobile.targets b/eng/testing/tests.mobile.targets index 837dc971653..2c355fea155 100644 --- a/eng/testing/tests.mobile.targets +++ b/eng/testing/tests.mobile.targets @@ -233,5 +233,5 @@ DependsOnTargets="InstallWorkloadUsingArtifacts" Condition="'$(InstallWorkloadForTesting)' == 'true'" /> - <Import Project="$(RepositoryEngineeringDir)illink.targets" Condition="'$(SkipImportRepoLinkerTargets)' != 'true'" /> + <Import Project="$(RepositoryEngineeringDir)illink.targets" Condition="'$(EnableAggressiveTrimming)' == 'true' or '$(EnableSoftTrimming)' == 'true'" /> </Project> diff --git a/eng/versioning.targets b/eng/versioning.targets index f31612f41a4..10226b7a490 100644 --- a/eng/versioning.targets +++ b/eng/versioning.targets @@ -23,11 +23,6 @@ <_Parameter1>PreferInbox</_Parameter1> <_Parameter2>True</_Parameter2> </AssemblyAttribute> - <AssemblyAttribute Include="System.Reflection.AssemblyMetadata" - Condition="'$(SetIsTrimmable)' != 'false'"> - <_Parameter1>IsTrimmable</_Parameter1> - <_Parameter2>True</_Parameter2> - </AssemblyAttribute> </ItemGroup> <ItemGroup> |