|
1 | 1 | <Project>
|
| 2 | + |
2 | 3 | <PropertyGroup>
|
3 | 4 | <IsTrimmable Condition="'$(IsTrimmable)' == ''">true</IsTrimmable>
|
4 | 5 | <PrepareResourcesDependsOn>_EmbedILLinkXmls;$(PrepareResourcesDependsOn)</PrepareResourcesDependsOn>
|
5 | 6 | <TargetsTriggeredByCompilation Condition="'$(DesignTimeBuild)' != 'true'">$(TargetsTriggeredByCompilation);ILLinkTrimAssembly</TargetsTriggeredByCompilation>
|
6 |
| - </PropertyGroup> |
7 |
| - |
8 |
| - <!-- Flow the IsTrimmable property down to consuming projects, in order for oob.proj |
9 |
| - to exclude non trimmable assemblies. --> |
10 |
| - <ItemDefinitionGroup> |
11 |
| - <TargetPathWithTargetPlatformMoniker> |
12 |
| - <IsTrimmable>$(IsTrimmable)</IsTrimmable> |
13 |
| - </TargetPathWithTargetPlatformMoniker> |
14 |
| - </ItemDefinitionGroup> |
15 | 7 |
|
16 |
| - <!-- Inputs and outputs of ILLinkTrimAssembly --> |
17 |
| - <PropertyGroup> |
18 | 8 | <ILLinkDirectory Condition="'$(ILLinkDirectory)' == ''">$(MSBuildProjectDirectory)\ILLink\</ILLinkDirectory>
|
19 | 9 | <ILLinkTrimAssemblyPath>$(IntermediateOutputPath)$(TargetName)$(TargetExt)</ILLinkTrimAssemblyPath>
|
20 | 10 | <ILLinkTrimAssemblySymbols>$(IntermediateOutputPath)$(TargetName).pdb</ILLinkTrimAssemblySymbols>
|
|
40 | 30 |
|
41 | 31 | <!-- if building a PDB, tell illink to rewrite the symbols file -->
|
42 | 32 | <ILLinkRewritePDBs Condition="'$(ILLinkRewritePDBs)' == '' and '$(DebugSymbols)' != 'false'">true</ILLinkRewritePDBs>
|
43 |
| - </PropertyGroup> |
44 | 33 |
|
45 |
| - <ItemGroup> |
46 |
| - <None Include="$(ILLinkDescriptorsLibraryBuildXml)" Condition="'$(ILLinkDescriptorsLibraryBuildXml)' != ''" /> |
47 |
| - <None Include="@(ILLinkSubstitutionsXmls)" /> |
48 |
| - </ItemGroup> |
49 |
| - |
50 |
| - <PropertyGroup> |
51 |
| - <NetCoreAppCurrentBuildSettings Condition="'$(NetCoreAppCurrentBuildSettings)' == ''">$(NetCoreAppCurrent)-$(TargetOS)-$(Configuration)-$(TargetArchitecture)</NetCoreAppCurrentBuildSettings> |
52 |
| - <ILLinkTrimAssemblyArtifactsRootDir>$([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'ILLinkTrimAssembly', '$(NetCoreAppCurrentBuildSettings)'))</ILLinkTrimAssemblyArtifactsRootDir> |
53 |
| - <ILLinkTrimAssemblyRuntimePackSuppressionsXmlsDir>$(ILLinkTrimAssemblyArtifactsRootDir)suppressions-xmls\</ILLinkTrimAssemblyRuntimePackSuppressionsXmlsDir> |
54 |
| - <ILLinkTrimAssemblyOOBSuppressionsXmlsDir>$(ILLinkTrimAssemblyArtifactsRootDir)oob-suppressions-xmls\</ILLinkTrimAssemblyOOBSuppressionsXmlsDir> |
55 |
| - <ILLinkTrimAssemblySuppressionsXmlsDir Condition="'$(IsNETCoreAppSrc)' == 'true'">$(ILLinkTrimAssemblyRuntimePackSuppressionsXmlsDir)</ILLinkTrimAssemblySuppressionsXmlsDir> |
56 |
| - <ILLinkTrimAssemblySuppressionsXmlsDir Condition="'$(IsNETCoreAppSrc)' != 'true'">$(ILLinkTrimAssemblyOOBSuppressionsXmlsDir)</ILLinkTrimAssemblySuppressionsXmlsDir> |
| 34 | + <ILLinkResourcesSubstitutionIntermediatePath>$(IntermediateOutputPath)ILLink.Resources.Substitutions.xml</ILLinkResourcesSubstitutionIntermediatePath> |
| 35 | + <GenerateResourcesSubstitutions Condition="'$(GenerateResourcesSubstitutions)' == '' and '$(StringResourcesPath)' != ''">true</GenerateResourcesSubstitutions> |
57 | 36 | </PropertyGroup>
|
58 | 37 |
|
59 |
| - <!-- Custom binplacing for pre/post-trimming and reports that is useful for analysis |
60 |
| - Must be enabled by setting BinPlaceILLinkTrimAssembly=true |
61 |
| - --> |
62 |
| - <ItemGroup Condition="'$(BinPlaceILLinkTrimAssembly)' == 'true'"> |
63 |
| - <BinPlaceTargetFrameworks Include="$(NetCoreAppCurrentBuildSettings)"> |
64 |
| - <RuntimePath>$(ILLinkTrimAssemblyArtifactsRootDir)trimmed</RuntimePath> |
65 |
| - <ItemName>TrimmedItem</ItemName> |
66 |
| - </BinPlaceTargetFrameworks> |
67 |
| - <BinPlaceTargetFrameworks Include="$(NetCoreAppCurrentBuildSettings)"> |
68 |
| - <RuntimePath>$(ILLinkTrimAssemblyArtifactsRootDir)reports</RuntimePath> |
69 |
| - <ItemName>TrimmingReport</ItemName> |
70 |
| - </BinPlaceTargetFrameworks> |
71 |
| - <BinPlaceTargetFrameworks Include="$(NetCoreAppCurrentBuildSettings)"> |
72 |
| - <RuntimePath>$(ILLinkTrimAssemblyArtifactsRootDir)pretrimmed</RuntimePath> |
73 |
| - <ItemName>PreTrimmedItem</ItemName> |
74 |
| - </BinPlaceTargetFrameworks> |
75 |
| - </ItemGroup> |
76 |
| - |
77 | 38 | <ItemGroup>
|
78 |
| - <ILLinkSuppressionsXmls Condition="Exists('$(ILLinkSuppressionsXmlFile)')" |
79 |
| - Include="$(ILLinkSuppressionsXmlFile)" /> |
80 |
| - <ILLinkSuppressionsXmls Condition="Exists('$(ILLinkSuppressionsConfigurationSpecificXmlFile)')" |
81 |
| - Include="$(ILLinkSuppressionsConfigurationSpecificXmlFile)" /> |
82 |
| - <ILLinkSuppressionsXmls Condition="Exists('$(ILLinkSuppressionsLibraryBuildXmlFile)')" |
83 |
| - Include="$(ILLinkSuppressionsLibraryBuildXmlFile)" /> |
84 |
| - <ILLinkSuppressionsXmls Update="@(ILLinkSuppressionsXmls)" TargetPath="%(FileName).$(AssemblyName).xml" /> |
| 39 | + <ILLinkSuppressionsXmls Include="$(ILLinkSuppressionsXmlFile)" |
| 40 | + Condition="Exists('$(ILLinkSuppressionsXmlFile)')" /> |
| 41 | + <ILLinkSuppressionsXmls Include="$(ILLinkSuppressionsConfigurationSpecificXmlFile)" |
| 42 | + Condition="Exists('$(ILLinkSuppressionsConfigurationSpecificXmlFile)')" /> |
| 43 | + <ILLinkSuppressionsXmls Include="$(ILLinkSuppressionsLibraryBuildXmlFile)" |
| 44 | + Condition="Exists('$(ILLinkSuppressionsLibraryBuildXmlFile)')" /> |
| 45 | + <ILLinkSuppressionsXmls Update="@(ILLinkSuppressionsXmls)" |
| 46 | + TargetPath="%(FileName).$(AssemblyName).xml" /> |
85 | 47 | </ItemGroup>
|
86 | 48 |
|
87 | 49 | <ItemGroup>
|
88 |
| - <BinPlaceTargetFrameworks Include="$(NetCoreAppCurrent)"> |
89 |
| - <RuntimePath>$(ILLinkTrimAssemblySuppressionsXmlsDir)</RuntimePath> |
90 |
| - <ItemName>ILLinkSuppressionsXmls</ItemName> |
91 |
| - </BinPlaceTargetFrameworks> |
92 |
| - <BinPlaceTargetFrameworks Include="$(NetCoreAppCurrent)-$(TargetOS.ToLowerInvariant())"> |
93 |
| - <RuntimePath>$(ILLinkTrimAssemblySuppressionsXmlsDir)</RuntimePath> |
94 |
| - <ItemName>ILLinkSuppressionsXmls</ItemName> |
95 |
| - </BinPlaceTargetFrameworks> |
| 50 | + <ILLinkSubstitutionsXmls Include="$(ILLinkResourcesSubstitutionIntermediatePath)" |
| 51 | + Condition="'$(GenerateResourcesSubstitutions)' == 'true'" /> |
| 52 | + <None Include="@(ILLinkSubstitutionsXmls)" /> |
| 53 | + <None Include="$(ILLinkDescriptorsLibraryBuildXml)" |
| 54 | + Condition="'$(ILLinkDescriptorsLibraryBuildXml)' != ''" /> |
96 | 55 | </ItemGroup>
|
97 | 56 |
|
98 |
| - <Target Name="_EmbedILLinkXmls" |
99 |
| - DependsOnTargets="_CombineILLinkDescriptorsXmls;_CombineILLinkSubstitutionsXmls;_CombineILLinkLinkAttributesXmls"> |
| 57 | + <!-- Flow the IsTrimmable property down to consuming projects, in order for oob.proj |
| 58 | + to exclude non trimmable assemblies. --> |
| 59 | + <ItemDefinitionGroup> |
| 60 | + <TargetPathWithTargetPlatformMoniker> |
| 61 | + <IsTrimmable>$(IsTrimmable)</IsTrimmable> |
| 62 | + </TargetPathWithTargetPlatformMoniker> |
| 63 | + </ItemDefinitionGroup> |
100 | 64 |
|
101 |
| - <ItemGroup Condition="'$(ILLinkDescriptorsXml)' != ''"> |
102 |
| - <EmbeddedResource Include="$(ILLinkDescriptorsXml)"> |
103 |
| - <LogicalName>ILLink.Descriptors.xml</LogicalName> |
104 |
| - </EmbeddedResource> |
| 65 | + <!-- Flow the ILLinkSuppressionsXmls item list down to consuming projects, in order for sfx.proj and oob.proj to |
| 66 | + receive the suppression files. --> |
| 67 | + <Target Name="AnnotateTargetPathWithILLinkSuppressionsXmlsProp" |
| 68 | + AfterTargets="GetTargetPathWithTargetPlatformMoniker"> |
| 69 | + <ItemGroup> |
| 70 | + <TargetPathWithTargetPlatformMoniker ILLinkSuppressionsXmls="@(ILLinkSuppressionsXmls->Metadata('FullPath'))" /> |
105 | 71 | </ItemGroup>
|
| 72 | + </Target> |
106 | 73 |
|
107 |
| - <ItemGroup Condition="'$(ILLinkSubstitutionsXml)' != ''"> |
108 |
| - <EmbeddedResource Include="$(ILLinkSubstitutionsXml)"> |
109 |
| - <LogicalName>ILLink.Substitutions.xml</LogicalName> |
110 |
| - </EmbeddedResource> |
111 |
| - </ItemGroup> |
| 74 | + <Target Name="_EmbedILLinkXmls" |
| 75 | + DependsOnTargets="_CombineILLinkDescriptorsXmls; |
| 76 | + _CombineILLinkSubstitutionsXmls; |
| 77 | + _CombineILLinkLinkAttributesXmls"> |
| 78 | + <ItemGroup> |
| 79 | + <EmbeddedResource Include="$(ILLinkDescriptorsXml)" |
| 80 | + LogicalName="ILLink.Descriptors.xml" |
| 81 | + Condition="'$(ILLinkDescriptorsXml)' != ''" /> |
112 | 82 |
|
113 |
| - <ItemGroup Condition="'$(ILLinkLinkAttributesXml)' != ''"> |
114 |
| - <EmbeddedResource Include="$(ILLinkLinkAttributesXml)"> |
115 |
| - <LogicalName>ILLink.LinkAttributes.xml</LogicalName> |
116 |
| - </EmbeddedResource> |
117 |
| - </ItemGroup> |
| 83 | + <EmbeddedResource Include="$(ILLinkSubstitutionsXml)" |
| 84 | + LogicalName="ILLink.Substitutions.xml" |
| 85 | + Condition="'$(ILLinkSubstitutionsXml)' != ''" /> |
118 | 86 |
|
| 87 | + <EmbeddedResource Include="$(ILLinkLinkAttributesXml)" |
| 88 | + LogicalName="ILLink.LinkAttributes.xml" |
| 89 | + Condition="'$(ILLinkLinkAttributesXml)' != ''" /> |
| 90 | + </ItemGroup> |
119 | 91 | </Target>
|
120 | 92 |
|
121 | 93 | <UsingTask TaskName="CombineLinkerXmlFiles" AssemblyFile="$(ILLinkTasksAssembly)" Condition="'$(ILLinkTasksAssembly)' != ''" />
|
|
135 | 107 | </ItemGroup>
|
136 | 108 | </Target>
|
137 | 109 |
|
138 |
| - <PropertyGroup> |
139 |
| - <ILLinkResourcesSubstitutionIntermediatePath>$(IntermediateOutputPath)ILLink.Resources.Substitutions.xml</ILLinkResourcesSubstitutionIntermediatePath> |
140 |
| - <GenerateResourcesSubstitutions Condition="'$(GenerateResourcesSubstitutions)' == '' and '$(StringResourcesPath)' != ''">true</GenerateResourcesSubstitutions> |
141 |
| - </PropertyGroup> |
142 |
| - |
143 |
| - <ItemGroup Condition="'$(GenerateResourcesSubstitutions)' == 'true'"> |
144 |
| - <ILLinkSubstitutionsXmls Include="$(ILLinkResourcesSubstitutionIntermediatePath)" /> |
145 |
| - </ItemGroup> |
146 |
| - |
147 | 110 | <!-- If a library uses string resources, the following target generates a substitution xml that will be embedded on the
|
148 | 111 | library so that if a consumer wants to run the linker they can specify a feature switch to strip out all resources
|
149 | 112 | from the assembly. -->
|
|
218 | 181 | </PropertyGroup>
|
219 | 182 | </Target>
|
220 | 183 |
|
221 |
| - <!-- ILLinkTrimAssembly |
222 |
| - Examines the "input assembly" for IL that is unreachable from public API and trims that, |
223 |
| - rewriting the assembly to an "output assembly" |
224 |
| - --> |
| 184 | + <!-- Examines the "input assembly" for IL that is unreachable from public API and trims that, |
| 185 | + rewriting the assembly to an "output assembly" --> |
225 | 186 | <UsingTask TaskName="ILLink" AssemblyFile="$(ILLinkTasksAssembly)" Condition="'$(ILLinkTasksAssembly)' != ''" />
|
226 | 187 | <Target Name="ILLinkTrimAssembly"
|
227 | 188 | Condition="'$(ILLinkTrimAssembly)' == 'true'"
|
|
260 | 221 | <ILLinkArgs Condition="'$(ILLinkDisableIPConstProp)' == 'true'">$(ILLinkArgs) --disable-opt ipconstprop</ILLinkArgs>
|
261 | 222 | </PropertyGroup>
|
262 | 223 |
|
263 |
| - <MakeDir Directories="$(ILLinkTrimInputPath)" /> |
264 |
| - |
265 | 224 | <!-- Move the assembly into a subdirectory for ILLink -->
|
266 | 225 | <Move SourceFiles="$(ILLinkTrimAssemblyPath)"
|
267 |
| - DestinationFolder="$(ILLinkTrimInputPath)" |
268 |
| - /> |
| 226 | + DestinationFolder="$(ILLinkTrimInputPath)"> |
| 227 | + <Output TaskParameter="MovedFiles" ItemName="FileWrites" /> |
| 228 | + </Move> |
269 | 229 |
|
270 | 230 | <!-- Move the PDB into a subdirectory for ILLink if we are rewriting PDBs -->
|
271 | 231 | <Move SourceFiles="$(ILLinkTrimAssemblySymbols)"
|
272 | 232 | DestinationFolder="$(ILLinkTrimInputPath)"
|
273 |
| - Condition="'$(ILLinkRewritePDBs)' == 'true' and Exists('$(ILLinkTrimAssemblySymbols)')" |
274 |
| - /> |
| 233 | + Condition="'$(ILLinkRewritePDBs)' == 'true' and Exists('$(ILLinkTrimAssemblySymbols)')"> |
| 234 | + <Output TaskParameter="MovedFiles" ItemName="FileWrites" /> |
| 235 | + </Move> |
275 | 236 |
|
276 | 237 | <ItemGroup>
|
277 | 238 | <_DependencyDirectoriesTemp Include="@(ReferencePathWithRefAssemblies->'%(RootDir)%(Directory)')" />
|
|
333 | 294 | <Message Text="Assembly trimming report: $(AsmDiffList)" />
|
334 | 295 | </Target>
|
335 | 296 |
|
336 |
| - <!-- Similar to _CheckForCompileOutputs and runs in the same places, |
337 |
| - always set these even if compile didn't run. --> |
338 |
| - <Target Name="_CheckForILLinkTrimAssemblyOutputs" |
339 |
| - BeforeTargets="CopyFilesToOutputDirectory;_CleanGetCurrentAndPriorFileWrites" |
340 |
| - Condition="'$(ILLinkTrimAssembly)' == 'true'"> |
341 |
| - <ItemGroup> |
342 |
| - <PreTrimmedItem Condition="Exists('$(ILLinkTrimInputAssembly)')" Include="$(ILLinkTrimInputAssembly)" /> |
343 |
| - <PreTrimmedItem Condition="'$(ILLinkRewritePDBs)' == 'true' and Exists('$(ILLinkTrimInputSymbols)')" Include="$(ILLinkTrimInputSymbols)" /> |
344 |
| - <FileWrites Include="@(PreTrimmedItem)" /> |
345 |
| - |
346 |
| - <TrimmedItem Condition="Exists('$(ILLinkTrimAssemblyPath)')" Include="$(ILLinkTrimAssemblyPath)" /> |
347 |
| - <TrimmedItem Condition="'$(ILLinkRewritePDBs)' == 'true' and Exists('$(ILLinkTrimAssemblySymbols)')" Include="$(ILLinkTrimAssemblySymbols)" /> |
348 |
| - |
349 |
| - <TrimmingReport Condition="Exists('$(AsmDiffReport)')" Include="$(AsmDiffReport)" /> |
350 |
| - <TrimmingReport Condition="Exists('$(AsmDiffList)')" Include="$(AsmDiffList)" /> |
351 |
| - </ItemGroup> |
352 |
| - </Target> |
353 | 297 | </Project>
|
0 commit comments