-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Move asset compression to the StaticWebAssets SDK #31559
Conversation
Thanks for your PR, @MackinnonBuck. |
src/BlazorWasmSdk/Targets/Microsoft.NET.Sdk.BlazorWebAssembly.6_0.targets
Outdated
Show resolved
Hide resolved
src/BlazorWasmSdk/Targets/Microsoft.NET.Sdk.BlazorWebAssembly.6_0.targets
Outdated
Show resolved
Hide resolved
src/BlazorWasmSdk/Targets/Microsoft.NET.Sdk.BlazorWebAssembly.6_0.targets
Outdated
Show resolved
Hide resolved
Source build failures seem unrelated. They're happening in |
src/StaticWebAssetsSdk/Targets/Microsoft.NET.Sdk.StaticWebAssets.Compression.targets
Outdated
Show resolved
Hide resolved
src/StaticWebAssetsSdk/Targets/Microsoft.NET.Sdk.StaticWebAssets.Compression.targets
Outdated
Show resolved
Hide resolved
src/StaticWebAssetsSdk/Targets/Microsoft.NET.Sdk.StaticWebAssets.Compression.targets
Outdated
Show resolved
Hide resolved
@@ -190,7 +190,7 @@ Integration with static web assets: | |||
<MakeDir Directories="$(_ScopedCssIntermediatePath)" /> | |||
<RewriteCss | |||
FilesToTransform="@(_ScopedCss)" | |||
ToolAssembly="$(_StaticWebAssetsSdkToolAssembly)" | |||
ToolAssembly="$(_StaticWebAssetsSdkRazorToolAssembly)" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is Razor needed for a reason here?
src/StaticWebAssetsSdk/Targets/Sdk.StaticWebAssets.CurrentVersion.targets
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few minor details, but otherwise looks great!
- For blazor AOT, the blazor targets explicitly skip `Microsoft.JSInterop.WebAssembly.dll` in `_GatherBlazorFilesToPublish` target. - it is done by marking the assembly item in `@(WasmAssembliesToBundle)` with `%(AOT_InternalForceToInterpret)="true"`. - this target needs to run after `_GatherWasmFilesToPublish` which builds the list of assemblies to AOT in `@(WasmAssembliesToBundle)` - the order of these two targets was corrected in #31640 - but the changes in #31559 added the target twice, resulting in the order: `_GatherBlazorFilesToPublish;_GatherWasmFilesToPublish;_GatherBlazorFilesToPublish` 1. in which the first `_GatherBlazorFilesToPublish` tries to remove the assembly from an empty list 2. then `_GatherWasmFilesToPublish` populates the list 3. and the last instance of `_GatherBlazorFilesToPublish` target doesn't run because it has already run before in (2). - thus the assembly never gets removed from the list. Fixes: dotnet/runtime#85010
- For blazor AOT, the blazor targets explicitly skip `Microsoft.JSInterop.WebAssembly.dll` in `_GatherBlazorFilesToPublish` target. - it is done by marking the assembly item in `@(WasmAssembliesToBundle)` with `%(AOT_InternalForceToInterpret)="true"`. - this target needs to run after `_GatherWasmFilesToPublish` which builds the list of assemblies to AOT in `@(WasmAssembliesToBundle)` - the order of these two targets was corrected in #31640 - but the changes in #31559 added the target twice, resulting in the order: `_GatherBlazorFilesToPublish;_GatherWasmFilesToPublish;_GatherBlazorFilesToPublish` 1. in which the first `_GatherBlazorFilesToPublish` tries to remove the assembly from an empty list 2. then `_GatherWasmFilesToPublish` populates the list 3. and the last instance of `_GatherBlazorFilesToPublish` target doesn't run because it has already run before in (2). - thus the assembly never gets removed from the list. Fixes: dotnet/runtime#85010
Move asset compression to the StaticWebAssets SDK
This PR moves the asset compression feature from the BlazorWebAssembly SDK to the StaticWebAssets SDK.
List of major changes
StaticWebAsset
definitions before the actual compression happens.AssetsToCompress
item groupStaticWebAsset
items have been addedResolveCompressedAssets
taskBrotliCompress
andGZipCompress
tasks toM.NET.Sdk.StaticWebAssets.Tasks
and updated them accordinglyComputeBlazorFilesToCompress
task and its corresponding tests.Fixes dotnet/aspnetcore#46998