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