diff options
author | Eric Erhardt <eric.erhardt@microsoft.com> | 2020-05-01 04:25:41 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-01 04:25:41 +0300 |
commit | c6140977982a188fc8c5d98d9cab686f1585d2aa (patch) | |
tree | 46cdcedb0588994309e5c7c5d045ee02ea8ffadb /eng/illink.targets | |
parent | 6b2f3b5ef717ed21b5fbeaae034e135bdf044f90 (diff) |
Strip the ILLinkTrim.xml file from System.Private.Xml (#35547)
* Strip the ILLinkTrim.xml file from System.Private.Xml
The two methods being preserved in System.Private.Xml (CreateSqlReader and GenerateSerializer) are large, and are not necessary when linking a mobile app. These methods only need to be preserved when linking the shared framework. When a normal app is linked, the linker is able to figure out if the two methods are necessary.
Contributes to #35199
Fix #30912
* Respond to PR feedback
- Add PreserveDependencyAttribute to SqlXml to be explicit.
- Rename ILLinkTrim.xml to ILLinkTrim_LibraryBuild.xml when it shouldn't be embedded in the resulting assembly.
Diffstat (limited to 'eng/illink.targets')
-rw-r--r-- | eng/illink.targets | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/eng/illink.targets b/eng/illink.targets index ea4989776ad..6ac5e9ac2a1 100644 --- a/eng/illink.targets +++ b/eng/illink.targets @@ -29,6 +29,8 @@ <ILLinkTrimOutputPath>$(IntermediateOutputPath)</ILLinkTrimOutputPath> <ILLinkTrimXml Condition="'$(ILLinkTrimXml)' == '' and Exists('$(MSBuildProjectDirectory)/ILLinkTrim.xml')">$(MSBuildProjectDirectory)/ILLinkTrim.xml</ILLinkTrimXml> + <!-- ILLinkTrim_LibraryBuild.xml files are only used during building the library, not an app. They shouldn't be embedded into the assembly. --> + <ILLinkTrimXmlLibraryBuild Condition="'$(ILLinkTrimXmlLibraryBuild)' == '' and Exists('$(MSBuildProjectDirectory)/ILLinkTrim_LibraryBuild.xml')">$(MSBuildProjectDirectory)/ILLinkTrim_LibraryBuild.xml</ILLinkTrimXmlLibraryBuild> <!-- if building a PDB, tell illink to rewrite the symbols file --> <ILLinkRewritePDBs Condition="'$(ILLinkRewritePDBs)' == '' and '$(DebugSymbols)' != 'false'">true</ILLinkRewritePDBs> @@ -40,6 +42,10 @@ </EmbeddedResource> </ItemGroup> + <ItemGroup Condition="'$(ILLinkTrimXmlLibraryBuild)' != ''"> + <None Include="$(ILLinkTrimXmlLibraryBuild)" /> + </ItemGroup> + <!-- Custom binplacing for pre/post-trimming and reports that is useful for analysis Must be enabled by setting BinPlaceILLinkTrimAssembly=true --> @@ -87,7 +93,9 @@ <!-- keep types and members required by Debugger-related attributes --> <ILLinkArgs>$(ILLinkArgs) -v true</ILLinkArgs> <!-- don't remove the embedded root xml resource since ILLink may run again on the assembly --> - <ILLinkArgs>$(ILLinkArgs) --strip-descriptors false</ILLinkArgs> + <ILLinkArgs Condition="'$(ILLinkTrimXml)' != ''">$(ILLinkArgs) --strip-descriptors false</ILLinkArgs> + <!-- pass the non-embedded root xml file on the command line --> + <ILLinkArgs Condition="'$(ILLinkTrimXmlLibraryBuild)' != ''">$(ILLinkArgs) -x "$(ILLinkTrimXmlLibraryBuild)"</ILLinkArgs> <!-- ignore unresolved references --> <ILLinkArgs>$(ILLinkArgs) --skip-unresolved true</ILLinkArgs> <!-- keep interface implementations --> |