|
74 | 74 | </ItemGroup>
|
75 | 75 | </Target>
|
76 | 76 |
|
77 |
| - <Target Name="_ResolveBlazorInputs"> |
| 77 | + <Target Name="_ResolveBlazorInputs" DependsOnTargets="ResolveReferences;ResolveRuntimePackAssets"> |
78 | 78 | <PropertyGroup>
|
79 | 79 | <!-- /obj/<<configuration>>/<<targetframework>>/blazor -->
|
80 | 80 | <BlazorIntermediateOutputPath>$(IntermediateOutputPath)blazor\</BlazorIntermediateOutputPath>
|
|
94 | 94 | </PropertyGroup>
|
95 | 95 |
|
96 | 96 | <ItemGroup>
|
97 |
| - <_BlazorDependencyInput Include="@(ReferenceCopyLocalPaths->WithMetadataValue('Extension','.dll')->'%(FullPath)')" /> |
98 |
| - |
99 | 97 | <_WebAssemblyBCLFolder Include="
|
100 | 98 | $(DotNetWebAssemblyBCLPath);
|
101 | 99 | $(DotNetWebAssemblyBCLFacadesPath);
|
|
104 | 102 | <_WebAssemblyBCLAssembly Include="%(_WebAssemblyBCLFolder.Identity)*.dll" />
|
105 | 103 | </ItemGroup>
|
106 | 104 |
|
| 105 | + <!-- |
| 106 | + Calculate the assemblies that act as inputs to calculate assembly closure. Based on _ComputeAssembliesToPostprocessOnPublish which is used as input to SDK's linker |
| 107 | + https://github.com/dotnet/sdk/blob/d597e7b09d7657ba4e326d6734e14fcbf8473564/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Publish.targets#L864-L873 |
| 108 | + --> |
| 109 | + <ItemGroup> |
| 110 | + <!-- Assemblies from packages --> |
| 111 | + <_BlazorManagedRuntimeAssemby Include="@(RuntimeCopyLocalItems)" /> |
| 112 | + |
| 113 | + <!-- Assemblies from other references --> |
| 114 | + <_BlazorUserRuntimeAssembly Include="@(ReferencePath->WithMetadataValue('CopyLocal', 'true'))" /> |
| 115 | + <_BlazorUserRuntimeAssembly Include="@(ReferenceDependencyPaths->WithMetadataValue('CopyLocal', 'true'))" /> |
| 116 | + |
| 117 | + <_BlazorManagedRuntimeAssemby Include="@(_BlazorUserRuntimeAssembly)" /> |
| 118 | + <_BlazorManagedRuntimeAssemby Include="@(IntermediateAssembly)" /> |
| 119 | + </ItemGroup> |
| 120 | + |
107 | 121 | <MakeDir Directories="$(BlazorIntermediateOutputPath)" />
|
108 | 122 | </Target>
|
109 | 123 |
|
110 | 124 | <Target Name="_ResolveBlazorOutputs" DependsOnTargets="_ResolveBlazorOutputsWhenLinked;_ResolveBlazorOutputsWhenNotLinked">
|
111 | 125 | <Error
|
112 | 126 | Message="Unrecongnized value for BlazorLinkOnBuild: '$(BlazorLinkOnBuild)'. Valid values are 'true' or 'false'."
|
113 | 127 | Condition="'$(BlazorLinkOnBuild)' != 'true' AND '$(BlazorLinkOnBuild)' != 'false'" />
|
| 128 | + |
| 129 | + <ItemGroup> |
| 130 | + <!-- |
| 131 | + ReferenceCopyLocalPaths includes all files that are part of the build out with CopyLocalLockFileAssemblies on. |
| 132 | + Remove assemblies that are inputs to calculating the assembly closure. Instead use the resolved outputs, since it is the minimal set. |
| 133 | + --> |
| 134 | + <_BlazorCopyLocalPaths Include="@(ReferenceCopyLocalPaths)" /> |
| 135 | + <_BlazorCopyLocalPaths Remove="@(_BlazorManagedRuntimeAssemby)" /> |
| 136 | + |
| 137 | + <BlazorOutputWithTargetPath Include="@(_BlazorCopyLocalPaths)"> |
| 138 | + <BlazorRuntimeFile>true</BlazorRuntimeFile> |
| 139 | + <TargetOutputPath>$(BlazorRuntimeBinOutputPath)%(_BlazorCopyLocalPaths.DestinationSubDirectory)%(FileName)%(Extension)</TargetOutputPath> |
| 140 | + <RelativeOutputPath>%(_BlazorCopyLocalPaths.DestinationSubDirectory)%(FileName)%(Extension)</RelativeOutputPath> |
| 141 | + </BlazorOutputWithTargetPath> |
| 142 | + |
| 143 | + <BlazorOutputWithTargetPath Include="@(_BlazorResolvedAssembly)"> |
| 144 | + <BlazorRuntimeFile>true</BlazorRuntimeFile> |
| 145 | + <TargetOutputPath>$(BlazorRuntimeBinOutputPath)%(FileName)%(Extension)</TargetOutputPath> |
| 146 | + <RelativeOutputPath>%(FileName)%(Extension)</RelativeOutputPath> |
| 147 | + </BlazorOutputWithTargetPath> |
| 148 | + </ItemGroup> |
114 | 149 | </Target>
|
115 | 150 |
|
116 | 151 | <!--
|
|
128 | 163 |
|
129 | 164 | <!-- _BlazorLinkerOutputCache records files linked during the last incremental build of the target. Read the contents and assign linked files to be copied to the output. -->
|
130 | 165 | <ReadLinesFromFile File="$(_BlazorLinkerOutputCache)">
|
131 |
| - <Output TaskParameter="Lines" ItemName="_BlazorLinkedFile"/> |
| 166 | + <Output TaskParameter="Lines" ItemName="_BlazorResolvedAssembly"/> |
132 | 167 | </ReadLinesFromFile>
|
133 |
| - |
134 |
| - <ItemGroup> |
135 |
| - <BlazorOutputWithTargetPath Include="%(_BlazorLinkedFile.Identity)"> |
136 |
| - <TargetOutputPath>$(BlazorRuntimeBinOutputPath)%(FileName)%(Extension)</TargetOutputPath> |
137 |
| - </BlazorOutputWithTargetPath> |
138 |
| - </ItemGroup> |
139 | 168 | </Target>
|
140 | 169 |
|
141 | 170 | <UsingTask TaskName="BlazorCreateRootDescriptorFile" AssemblyFile="$(BlazorTasksPath)" />
|
|
163 | 192 | <Target
|
164 | 193 | Name="_LinkBlazorApplication"
|
165 | 194 | Inputs="$(ProjectAssetsFile);
|
166 |
| - @(IntermediateAssembly); |
167 |
| - @(_BlazorDependencyInput); |
| 195 | + @(_BlazorManagedRuntimeAssemby); |
168 | 196 | @(BlazorLinkerDescriptor);
|
169 | 197 | $(MSBuildAllProjects)"
|
170 | 198 | Outputs="$(_BlazorLinkerOutputCache)">
|
|
174 | 202 | <_BlazorDependencyAssembly IsLinkable="true" Condition="$([System.String]::Copy('%(Filename)').StartsWith('System.'))" />
|
175 | 203 | <_BlazorDependencyAssembly IsLinkable="true" TypeGranularity="true" Condition="$([System.String]::Copy('%(Filename)').StartsWith('Microsoft.AspNetCore.'))" />
|
176 | 204 | <_BlazorDependencyAssembly IsLinkable="true" TypeGranularity="true" Condition="$([System.String]::Copy('%(Filename)').StartsWith('Microsoft.Extensions.'))" />
|
| 205 | + <!-- Any assembly from a package reference that starts with System. file name is allowed to be linked --> |
| 206 | + <_BlazorRuntimeCopyLocalItems Include="@(RuntimeCopyLocalItems)" IsLinkable="$([System.String]::Copy('%(FileName)').StartsWith('System.'))" /> |
177 | 207 |
|
178 | 208 | <_BlazorAssemblyToLink Include="@(_WebAssemblyBCLAssembly)" />
|
179 |
| - <_BlazorAssemblyToLink Include="@(_BlazorDependencyAssembly)" Condition="'%(_BlazorDependencyAssembly.IsLinkable)' == 'true'" /> |
| 209 | + <_BlazorAssemblyToLink Include="@(_BlazorRuntimeCopyLocalItems)" Condition="'%(_BlazorRuntimeCopyLocalItems.IsLinkable)' == 'true'" /> |
180 | 210 |
|
181 | 211 | <_BlazorLinkerRoot Include="@(IntermediateAssembly)" />
|
182 |
| - <_BlazorLinkerRoot Include="@(_BlazorDependencyAssembly)" Condition="'%(_BlazorDependencyAssembly.IsLinkable)' != 'true'" /> |
| 212 | + <_BlazorLinkerRoot Include="@(_BlazorUserRuntimeAssembly)" /> |
| 213 | + <_BlazorLinkerRoot Include="@(_BlazorRuntimeCopyLocalItems)" Condition="'%(_BlazorRuntimeCopyLocalItems.IsLinkable)' != 'true'" /> |
183 | 214 | </ItemGroup>
|
184 | 215 |
|
185 | 216 | <PropertyGroup>
|
|
230 | 261 | <WriteLinesToFile File="$(_BlazorLinkerOutputCache)" Lines="@(_LinkerResult)" Overwrite="true" />
|
231 | 262 | </Target>
|
232 | 263 |
|
233 |
| - |
234 | 264 | <UsingTask TaskName="ResolveBlazorRuntimeDependencies" AssemblyFile="$(BlazorTasksPath)" />
|
235 | 265 | <Target
|
236 | 266 | Name="_ResolveBlazorOutputsWhenNotLinked"
|
237 | 267 | DependsOnTargets="_ResolveBlazorRuntimeDependencies"
|
238 | 268 | Condition="'$(BlazorLinkOnBuild)' != 'true'">
|
239 | 269 |
|
240 |
| - <ReadLinesFromFile File="$(_BlazorApplicationAssembliesCacheFile)" Condition="'@(_BlazorResolvedRuntimeDependencies->Count())' == '0'"> |
241 |
| - <Output TaskParameter="Lines" ItemName="_BlazorResolvedRuntimeDependencies"/> |
| 270 | + <ReadLinesFromFile File="$(_BlazorApplicationAssembliesCacheFile)" Condition="'@(_BlazorResolvedAssembly->Count())' == '0'"> |
| 271 | + <Output TaskParameter="Lines" ItemName="_BlazorResolvedAssembly"/> |
242 | 272 | </ReadLinesFromFile>
|
243 |
| - |
244 |
| - <ItemGroup> |
245 |
| - <BlazorOutputWithTargetPath Include="@(_BlazorResolvedRuntimeDependencies)"> |
246 |
| - <TargetOutputPath>$(BlazorRuntimeBinOutputPath)%(FileName)%(Extension)</TargetOutputPath> |
247 |
| - </BlazorOutputWithTargetPath> |
248 |
| - </ItemGroup> |
249 | 273 | </Target>
|
250 | 274 |
|
251 | 275 | <Target
|
252 | 276 | Name="_ResolveBlazorRuntimeDependencies"
|
253 | 277 | Inputs="$(ProjectAssetsFile);
|
254 | 278 | @(IntermediateAssembly);
|
255 |
| - @(_BlazorDependencyInput)" |
| 279 | + @(_BlazorManagedRuntimeAssemby)" |
256 | 280 | Outputs="$(_BlazorApplicationAssembliesCacheFile)">
|
257 | 281 |
|
258 | 282 | <!--
|
|
262 | 286 | -->
|
263 | 287 | <ResolveBlazorRuntimeDependencies
|
264 | 288 | EntryPoint="@(IntermediateAssembly)"
|
265 |
| - ApplicationDependencies="@(_BlazorDependencyInput)" |
| 289 | + ApplicationDependencies="@(_BlazorManagedRuntimeAssemby)" |
266 | 290 | WebAssemblyBCLAssemblies="@(_WebAssemblyBCLAssembly)">
|
267 | 291 |
|
268 |
| - <Output TaskParameter="Dependencies" ItemName="_BlazorResolvedRuntimeDependencies" /> |
| 292 | + <Output TaskParameter="Dependencies" ItemName="_BlazorResolvedAssembly" /> |
269 | 293 | </ResolveBlazorRuntimeDependencies>
|
270 | 294 |
|
271 | 295 | <WriteLinesToFile File="$(_BlazorApplicationAssembliesCacheFile)" Lines="@(_BlazorResolvedRuntimeDependencies)" Overwrite="true" />
|
|
282 | 306 | Inputs="@(BlazorOutputWithTargetPath)"
|
283 | 307 | Outputs="$(BlazorBootJsonIntermediateOutputPath)">
|
284 | 308 | <ItemGroup>
|
285 |
| - <_AppReferences Include="@(BlazorOutputWithTargetPath->WithMetadataValue('Extension','.dll'))" /> |
286 |
| - <_AppReferences Include="@(BlazorOutputWithTargetPath->WithMetadataValue('Extension','.pdb'))" Condition="'$(BlazorEnableDebugging)' == 'true'" /> |
| 309 | + <_BlazorRuntimeFile Include="@(BlazorOutputWithTargetPath->WithMetadataValue('BlazorRuntimeFile', 'true'))" /> |
287 | 310 | </ItemGroup>
|
288 | 311 |
|
289 | 312 | <GenerateBlazorBootJson
|
290 | 313 | AssemblyPath="@(IntermediateAssembly)"
|
291 |
| - References="@(_AppReferences)" |
| 314 | + References="@(_BlazorRuntimeFile)" |
292 | 315 | LinkerEnabled="$(BlazorLinkOnBuild)"
|
293 | 316 | OutputPath="$(BlazorBootJsonIntermediateOutputPath)" />
|
294 | 317 |
|
|
0 commit comments