Skip to content

[Static Web Assets] Introduce static web asset endpoints and define compression endpoints #39636

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

Merged
merged 5 commits into from
Apr 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/Assets/WasmOverride/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
<Project />
<Project>
<PropertyGroup>
<CheckEolTargetFramework>false</CheckEolTargetFramework>
</PropertyGroup>
</Project>
1 change: 1 addition & 0 deletions src/Assets/WasmOverride/Nuget.config
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<add key="signatureValidationMode" value="accept" />
<packageSourceMapping>
<clear />
</packageSourceMapping>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,17 @@ Copyright (c) .NET Foundation. All rights reserved.
<Output TaskParameter="Assets" ItemName="_BlazorJSStaticWebAsset" />
</DefineStaticWebAssets>

<DefineStaticWebAssetEndpoints
CandidateAssets="@(_BlazorJSStaticWebAsset)"
ExistingEndpoints="@(StaticWebAssetEndpoint)"
ContentTypeMappings="@(StaticWebAssetContentTypeMapping)"
>
<Output TaskParameter="Endpoints" ItemName="_BlazorStaticWebAssetEndpoint" />
</DefineStaticWebAssetEndpoints>

<ItemGroup>
<StaticWebAsset Include="@(_BlazorJSStaticWebAsset)" />
<StaticWebAssetEndpoint Include="@(_BlazorStaticWebAssetEndpoint)" />
</ItemGroup>
</Target>

Expand Down
4 changes: 2 additions & 2 deletions src/RazorSdk/update-test-baselines.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ $TestProjects = "Microsoft.NET.Sdk.Razor.Tests", "Microsoft.NET.Sdk.BlazorWebAss
ForEach-Object { Join-Path -Path "$RepoRoot/test/" -ChildPath $_ };

if($Validate){
$TestProjects | ForEach-Object { dotnet test --no-build -l "console;verbosity=normal" $_ --filter AspNetCore=BaselineTest }
$TestProjects | ForEach-Object { dotnet test --no-build -c Release -l "console;verbosity=normal" $_ --filter AspNetCore=BaselineTest }
}else {
$TestProjects | ForEach-Object { dotnet test --no-build -l "console;verbosity=normal" $_ -e ASPNETCORE_TEST_BASELINES=true --filter AspNetCore=BaselineTest }
$TestProjects | ForEach-Object { dotnet test --no-build -c Release -l "console;verbosity=normal" $_ -e ASPNETCORE_TEST_BASELINES=true --filter AspNetCore=BaselineTest }
}
4 changes: 2 additions & 2 deletions src/RazorSdk/update-test-baselines.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,12 @@ if [ $Validate -eq 1 ]; then
echo "Running in validate mode"
for TestProject in "${TestProjects[@]}"; do
echo "Running dotnet test on $TestProject"
dotnet test --no-build -l "console;verbosity=normal" "$TestProject" --filter AspNetCore=BaselineTest
dotnet test --no-build -c Release -l "console;verbosity=normal" "$TestProject" --filter AspNetCore=BaselineTest
done
else
echo "Running in non-validate mode"
for TestProject in "${TestProjects[@]}"; do
echo "Running dotnet test on $TestProject"
dotnet test --no-build -l "console;verbosity=normal" "$TestProject" -e ASPNETCORE_TEST_BASELINES=true --filter AspNetCore=BaselineTest
dotnet test --no-build -c Release -l "console;verbosity=normal" "$TestProject" -e ASPNETCORE_TEST_BASELINES=true --filter AspNetCore=BaselineTest
done
fi
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ Copyright (c) .NET Foundation. All rights reserved.
Condition="'$(StaticWebAssetsSdkBuildTasksAssembly)' != ''" />

<UsingTask
TaskName="Microsoft.AspNetCore.StaticWebAssets.Tasks.GenerateStaticWebAsssetsPropsFile"
TaskName="Microsoft.AspNetCore.StaticWebAssets.Tasks.GenerateStaticWebAssetsPropsFile"
AssemblyFile="$(StaticWebAssetsSdkBuildTasksAssembly)"
Condition="'$(StaticWebAssetsSdkBuildTasksAssembly)' != ''" />

Expand Down Expand Up @@ -513,7 +513,7 @@ Copyright (c) .NET Foundation. All rights reserved.
<!-- Generates a props file that goes in build\Microsoft.AspNetCore.StaticWebAssets.props
and that describes the static web assets for the package.
-->
<GenerateStaticWebAsssetsPropsFile
<GenerateStaticWebAssetsPropsFile
Condition="'$(_CurrentProjectHasStaticWebAssets)' == 'true'"
StaticWebAssets="@(_CurrentProjectStaticWebAsset)"
AllowEmptySourceType="true"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ Copyright (c) .NET Foundation. All rights reserved.
<UsingTask TaskName="Microsoft.AspNetCore.StaticWebAssets.Tasks.BrotliCompress" AssemblyFile="$(StaticWebAssetsSdkBuildTasksAssembly)" />
<UsingTask TaskName="Microsoft.AspNetCore.StaticWebAssets.Tasks.GZipCompress" AssemblyFile="$(StaticWebAssetsSdkBuildTasksAssembly)" />
<UsingTask TaskName="Microsoft.AspNetCore.StaticWebAssets.Tasks.ResolveCompressedAssets" AssemblyFile="$(StaticWebAssetsSdkBuildTasksAssembly)" />
<UsingTask TaskName="Microsoft.AspNetCore.StaticWebAssets.Tasks.ApplyCompressionNegotiation" AssemblyFile="$(StaticWebAssetsSdkBuildTasksAssembly)" />

<PropertyGroup>

Expand Down Expand Up @@ -220,8 +221,35 @@ Copyright (c) .NET Foundation. All rights reserved.
<DefineStaticWebAssets
CandidateAssets="@(_CompressedStaticWebAssets)"
>
<Output TaskParameter="Assets" ItemName="StaticWebAsset" />
<Output TaskParameter="Assets" ItemName="_CompressionBuildStaticWebAsset" />
</DefineStaticWebAssets>

<DefineStaticWebAssetEndpoints
CandidateAssets="@(_CompressionBuildStaticWebAsset)"
ExistingEndpoints="@(StaticWebAssetEndpoint)"
ContentTypeMappings="@(StaticWebAssetContentTypeMapping)"
>
<Output TaskParameter="Endpoints" ItemName="_CompressionBuildStaticWebAssetEndpoint" />
</DefineStaticWebAssetEndpoints>

<ItemGroup>
<StaticWebAsset Include="@(_CompressionBuildStaticWebAsset)" />
<StaticWebAssetEndpoint Include="@(_CompressionBuildStaticWebAssetEndpoint)" />
<_CompressionCurrentProjectBuildAssets Include="@(StaticWebAsset)" />
</ItemGroup>

<ApplyCompressionNegotiation
CandidateEndpoints="@(StaticWebAssetEndpoint)"
CandidateAssets="@(_CompressionCurrentProjectBuildAssets)"
>
<Output TaskParameter="UpdatedEndpoints" ItemName="_UpdatedCompressionBuildEndpoints" />
</ApplyCompressionNegotiation>

<ItemGroup>
<StaticWebAssetEndpoint Remove="@(_UpdatedCompressionBuildEndpoints)" />
<StaticWebAssetEndpoint Include="@(_UpdatedCompressionBuildEndpoints)" />
</ItemGroup>

</Target>

<Target Name="GenerateBuildCompressedStaticWebAssets" DependsOnTargets="$(GenerateBuildCompressedStaticWebAssetsDependsOn);$(CompressFilesDependsOn)">
Expand Down Expand Up @@ -275,8 +303,35 @@ Copyright (c) .NET Foundation. All rights reserved.
<DefineStaticWebAssets
CandidateAssets="@(_CompressedStaticWebAssetsForPublish)"
>
<Output TaskParameter="Assets" ItemName="StaticWebAsset" />
<Output TaskParameter="Assets" ItemName="_CompressionPublishStaticWebAsset" />
</DefineStaticWebAssets>

<DefineStaticWebAssetEndpoints
CandidateAssets="@(_CompressionPublishStaticWebAsset)"
ExistingEndpoints="@(StaticWebAssetEndpoint)"
ContentTypeMappings="@(StaticWebAssetContentTypeMapping)"
>
<Output TaskParameter="Endpoints" ItemName="_CompressionPublishStaticWebAssetEndpoint" />
</DefineStaticWebAssetEndpoints>

<ItemGroup>
<StaticWebAsset Include="@(_CompressionPublishStaticWebAsset)" />
<StaticWebAssetEndpoint Include="@(_CompressionPublishStaticWebAssetEndpoint)" />
<_CompressionCurrentProjectPublishAssets Include="@(StaticWebAsset)" Condition="'%(AssetKind)' != 'Build'" />
</ItemGroup>

<ApplyCompressionNegotiation
CandidateEndpoints="@(StaticWebAssetEndpoint)"
CandidateAssets="@(_CompressionCurrentProjectPublishAssets)"
>
<Output TaskParameter="UpdatedEndpoints" ItemName="_UpdatedCompressionPublishEndpoints" />
</ApplyCompressionNegotiation>

<ItemGroup>
<StaticWebAssetEndpoint Remove="@(_UpdatedCompressionPublishEndpoints)" />
<StaticWebAssetEndpoint Include="@(_UpdatedCompressionPublishEndpoints)" />
</ItemGroup>

</Target>

<Target Name="GeneratePublishCompressedStaticWebAssets" DependsOnTargets="$(CompressFilesForPublishDependsOn);$(GeneratePublishCompressedStaticWebAssetsDependsOn)">
Expand Down
Loading