|
97 | 97 |
|
98 | 98 | <ItemGroup>
|
99 | 99 | <_BlazorDependencyInput Include="@(ReferenceCopyLocalPaths->WithMetadataValue('Extension','.dll')->'%(FullPath)')" />
|
| 100 | + |
| 101 | + <_WebAssemblyBCLFolder Include=" |
| 102 | + $(DotNetWebAssemblyBCLPath); |
| 103 | + $(DotNetWebAssemblyBCLFacadesPath); |
| 104 | + $(DotNetWebAssemblyFrameworkPath)" /> |
| 105 | + |
| 106 | + <_WebAssemblyBCLAssembly Include="%(_WebAssemblyBCLFolder.Identity)*.dll" /> |
100 | 107 | </ItemGroup>
|
101 | 108 |
|
102 | 109 | <MakeDir Directories="$(BlazorIntermediateOutputPath)" />
|
|
119 | 126 | <Target
|
120 | 127 | Name="_ResolveBlazorOutputsWhenLinked"
|
121 | 128 | Condition="'$(BlazorLinkOnBuild)' == 'true'"
|
122 |
| - DependsOnTargets="_GenerateLinkerDescriptor;_LinkBlazorApplication"> |
| 129 | + DependsOnTargets="_GenerateBlazorLinkerDescriptor;_LinkBlazorApplication"> |
123 | 130 |
|
124 | 131 | <!-- _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. -->
|
125 | 132 | <ReadLinesFromFile File="$(_BlazorLinkerOutputCache)">
|
|
133 | 140 | </ItemGroup>
|
134 | 141 | </Target>
|
135 | 142 |
|
136 |
| - <Target Name="_GenerateLinkerDescriptor" |
| 143 | + <UsingTask TaskName="BlazorCreateRootDescriptorFile" AssemblyFile="$(BlazorTasksPath)" /> |
| 144 | + <Target Name="_GenerateBlazorLinkerDescriptor" |
137 | 145 | Inputs="@(IntermediateAssembly)"
|
138 | 146 | Outputs="$(GeneratedBlazorLinkerDescriptor)"
|
139 | 147 | Condition="'@(BlazorLinkerDescriptor)' == ''">
|
140 | 148 |
|
141 | 149 | <!-- Generate linker descriptors if the project doesn't explicitly provide one. -->
|
142 | 150 |
|
143 |
| - <ItemGroup> |
144 |
| - <_PrepareLinkerDescriptorAssemblyLine Include="@(IntermediateAssembly->'%(FileName)')" /> |
145 |
| - <_GeneratedLinkerDescriptorLine Include="<linker>" /> |
146 |
| - <_GeneratedLinkerDescriptorLine Include="@(_PrepareLinkerDescriptorAssemblyLine->'<assembly fullname="%(Identity)" />')" /> |
147 |
| - <_GeneratedLinkerDescriptorLine Include="</linker>" /> |
148 |
| - </ItemGroup> |
149 |
| - |
150 |
| - <WriteLinesToFile |
151 |
| - Lines="@(_GeneratedLinkerDescriptorLine)" |
152 |
| - File="$(GeneratedBlazorLinkerDescriptor)" |
153 |
| - Overwrite="true" |
154 |
| - WriteOnlyWhenDifferent="True" /> |
| 151 | + <BlazorCreateRootDescriptorFile |
| 152 | + AssemblyNames="@(IntermediateAssembly->'%(Filename)')" |
| 153 | + RootDescriptorFilePath="$(GeneratedBlazorLinkerDescriptor)" /> |
155 | 154 |
|
156 | 155 | <ItemGroup>
|
157 | 156 | <FileWrites Include="$(GeneratedBlazorLinkerDescriptor)" />
|
158 |
| - </ItemGroup> |
159 |
| - |
160 |
| - <ItemGroup> |
161 |
| - <BlazorLinkerDescriptor Include="$(_BlazorBuiltInBclLinkerDescriptor)" /> |
162 | 157 | <BlazorLinkerDescriptor Include="$(GeneratedBlazorLinkerDescriptor)" />
|
| 158 | + <BlazorLinkerDescriptor Include="$(_BlazorBuiltInBclLinkerDescriptor)" /> |
163 | 159 | </ItemGroup>
|
164 | 160 | </Target>
|
165 | 161 |
|
| 162 | + <UsingTask TaskName="BlazorILLink" AssemblyFile="$(BlazorTasksPath)" /> |
| 163 | + |
166 | 164 | <Target
|
167 | 165 | Name="_LinkBlazorApplication"
|
168 | 166 | Inputs="$(ProjectAssetsFile);
|
|
173 | 171 | Outputs="$(_BlazorLinkerOutputCache)">
|
174 | 172 |
|
175 | 173 | <ItemGroup>
|
176 |
| - <_BlazorDependencyAssembly Include="@(_BlazorDependencyInput)"> |
177 |
| - <RelativeDirNoTrailingSlash>$([System.String]::Copy('%(RelativeDir)').TrimEnd('\').TrimEnd('/'))</RelativeDirNoTrailingSlash> |
178 |
| - <IsLinkable Condition="$([System.String]::Copy('%(FileName)').StartsWith('System.'))">true</IsLinkable> |
179 |
| - </_BlazorDependencyAssembly> |
180 |
| - </ItemGroup> |
181 |
| - <ItemGroup> |
182 |
| - <_WebAssemblyBCLFolder Include="$(DotNetWebAssemblyBCLPath);$(DotNetWebAssemblyBCLFacadesPath);$(DotNetWebAssemblyFrameworkPath)" /> |
183 |
| - <_BlazorAssembliesToCopy Include="@(IntermediateAssembly->'-a "%(FullPath)"')" /> |
184 |
| - <_BlazorFolderLookupPaths Include="@(_WebAssemblyBCLFolder->'-d "%(Identity)"')" /> |
185 |
| - |
186 |
| - <!-- For linkable assemblies, add their directories as lookup paths --> |
187 |
| - <_BlazorFolderLookupPaths Condition="'%(_BlazorDependencyAssembly.IsLinkable)' == 'true'" Include="@(_BlazorDependencyAssembly->'-d "%(RelativeDirNoTrailingSlash)"')" /> |
| 174 | + <_BlazorDependencyAssembly Include="@(_BlazorDependencyInput)" IsLinkable="$([System.String]::Copy('%(FileName)').StartsWith('System.'))" /> |
188 | 175 |
|
189 |
| - <!-- For non-linkable assemblies, reference the .dll directly --> |
190 |
| - <_BlazorAssembliesToCopy Condition="'%(_BlazorDependencyAssembly.IsLinkable)' != 'true'" Include="@(_BlazorDependencyAssembly->'-a "%(FullPath)"')" /> |
| 176 | + <_BlazorAssemblyToLink Include="@(_WebAssemblyBCLAssembly)" /> |
| 177 | + <_BlazorAssemblyToLink Include="@(_BlazorDependencyAssembly)" Condition="'%(_BlazorDependencyAssembly.IsLinkable)' == 'true'" /> |
191 | 178 |
|
192 |
| - <_BlazorAssemblyDescriptorFiles |
193 |
| - Include="@(BlazorLinkerDescriptor->'-x "%(FullPath)"')" Condition="'@(BlazorLinkerDescriptor)' != ''" /> |
| 179 | + <_BlazorLinkerRoot Include="@(IntermediateAssembly)" /> |
| 180 | + <_BlazorLinkerRoot Include="@(_BlazorDependencyAssembly)" Condition="'%(_BlazorDependencyAssembly.IsLinkable)' != 'true'" /> |
194 | 181 | </ItemGroup>
|
195 | 182 |
|
196 | 183 | <PropertyGroup>
|
197 | 184 | <_BlazorLinkerAdditionalOptions>-l $(MonoLinkerI18NAssemblies) $(AdditionalMonoLinkerOptions)</_BlazorLinkerAdditionalOptions>
|
198 | 185 | </PropertyGroup>
|
199 | 186 |
|
200 |
| - <!-- Clear the contents of /obj/<<configuration>>/<<targetframework>>/blazor/linker --> |
201 | 187 | <ItemGroup>
|
202 | 188 | <_OldLinkedFile Include="$(BlazorIntermediateLinkerOutputPath)*.dll" />
|
203 | 189 | </ItemGroup>
|
204 | 190 |
|
205 | 191 | <Delete Files="@(_OldLinkedFile)" />
|
206 | 192 |
|
207 |
| - <!-- Run the linker and put the results in /obj/<<configuration>>/<<targetframework>>/blazor/blazor/linker --> |
208 |
| - <Exec Command="dotnet "$(MonoLinkerPath)" $(_BlazorLinkerAdditionalOptions) @(_BlazorFolderLookupPaths, ' ') -o "$(BlazorIntermediateLinkerOutputPath)" @(_BlazorAssemblyDescriptorFiles, ' ') @(_BlazorAssembliesToCopy, ' ')" /> |
| 193 | + <!-- |
| 194 | + When running from Desktop MSBuild, DOTNET_HOST_PATH is not set. |
| 195 | + In this case, explicitly specify the path to the dotnet host. |
| 196 | + --> |
| 197 | + <PropertyGroup Condition=" '$(DOTNET_HOST_PATH)' == '' "> |
| 198 | + <_DotNetHostDirectory>$(NetCoreRoot)</_DotNetHostDirectory> |
| 199 | + <_DotNetHostFileName>dotnet</_DotNetHostFileName> |
| 200 | + <_DotNetHostFileName Condition=" '$(OS)' == 'Windows_NT' ">dotnet.exe</_DotNetHostFileName> |
| 201 | + </PropertyGroup> |
| 202 | + |
| 203 | + <BlazorILLink |
| 204 | + ILLinkPath="$(MonoLinkerPath)" |
| 205 | + AssemblyPaths="@(_BlazorAssemblyToLink)" |
| 206 | + RootAssemblyNames="@(_BlazorLinkerRoot)" |
| 207 | + RootDescriptorFiles="@(BlazorLinkerDescriptor)" |
| 208 | + OutputDirectory="$(BlazorIntermediateLinkerOutputPath)" |
| 209 | + ExtraArgs="$(_BlazorLinkerAdditionalOptions)" |
| 210 | + ToolExe="$(_DotNetHostFileName)" |
| 211 | + ToolPath="$(_DotNetHostDirectory)" /> |
209 | 212 |
|
210 | 213 | <ItemGroup>
|
211 | 214 | <_LinkerResult Include="$(BlazorIntermediateLinkerOutputPath)*.dll" />
|
|
214 | 217 | <WriteLinesToFile File="$(_BlazorLinkerOutputCache)" Lines="@(_LinkerResult)" Overwrite="true" />
|
215 | 218 | </Target>
|
216 | 219 |
|
| 220 | + |
217 | 221 | <UsingTask TaskName="ResolveBlazorRuntimeDependencies" AssemblyFile="$(BlazorTasksPath)" />
|
218 | 222 | <Target
|
219 | 223 | Name="_ResolveBlazorOutputsWhenNotLinked"
|
|
242 | 246 | At this point we have decided not to run the linker and instead to just copy the assemblies
|
243 | 247 | from the BCL referenced by the app the nuget package into the _framework/_bin folder.
|
244 | 248 | The only thing we need to do here is collect the list of items that will go into _framework/_bin.
|
245 |
| - --> |
246 |
| - |
247 |
| - <ItemGroup> |
248 |
| - <_WebAssemblyBCLFolder Include="$(DotNetWebAssemblyBCLPath);$(DotNetWebAssemblyBCLFacadesPath);$(DotNetWebAssemblyFrameworkPath)" /> |
249 |
| - <_WebAssemblyBCLAssembly Include="%(_WebAssemblyBCLFolder.Identity)*.dll" /> |
250 |
| - </ItemGroup> |
251 |
| - |
| 249 | + --> |
252 | 250 | <ResolveBlazorRuntimeDependencies
|
253 | 251 | EntryPoint="@(IntermediateAssembly)"
|
254 | 252 | ApplicationDependencies="@(_BlazorDependencyInput)"
|
|
0 commit comments