Skip to content
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

[browser] Integrate static web asset endpoints into wasm sdk #101315

Merged
merged 2 commits into from
May 7, 2024
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,9 @@ Copyright (c) .NET Foundation. All rights reserved.

<!-- Wasm -->
<AddWasmStaticWebAssetsDependsOn>
$(AddWasmStaticWebAssetsDependsOn);
ResolveWasmOutputs;
_GenerateBuildWasmBootJson;
$(AddWasmStaticWebAssetsDependsOn);
</AddWasmStaticWebAssetsDependsOn>
<GenerateBuildWasmBootJsonDependsOn>
$(GenerateBuildWasmBootJsonDependsOn);
Expand Down Expand Up @@ -278,10 +279,19 @@ Copyright (c) .NET Foundation. All rights reserved.
<Output TaskParameter="Assets" ItemName="_WasmJsConfigStaticWebAsset" />
</DefineStaticWebAssets>

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

<ItemGroup>
<!-- Update the boot config static web asset since we've given it a trait -->
<StaticWebAsset Remove="@(_WasmJsConfigStaticWebAsset)" />
<StaticWebAsset Include="@(_WasmJsConfigStaticWebAsset)" />
<StaticWebAssetEndpoint Include="@(_WasmJsConfigStaticWebAssetEndpoint)" />

<ReferenceCopyLocalPaths Remove="@(_WasmBuildFilesToRemove)" />
</ItemGroup>
Expand All @@ -292,6 +302,8 @@ Copyright (c) .NET Foundation. All rights reserved.
<ItemGroup>
<StaticWebAsset Include="@(WasmStaticWebAsset)" />
<StaticWebAsset Include="@(_BuildWasmBootJsonStaticWebAsset)" />
<StaticWebAssetEndpoint Include="@(WasmStaticWebAssetEndpoint)" />
<StaticWebAssetEndpoint Include="@(_BuildWasmBootJsonStaticWebAssetEndpoint)" />
</ItemGroup>
</Target>

Expand Down Expand Up @@ -375,6 +387,22 @@ Copyright (c) .NET Foundation. All rights reserved.
<Output TaskParameter="Assets" ItemName="_BuildWasmBootJsonStaticWebAsset" />
</DefineStaticWebAssets>

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

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

</Target>

<!-- Publish starts here -->
Expand Down Expand Up @@ -449,8 +477,8 @@ Copyright (c) .NET Foundation. All rights reserved.
<!-- _NewWebCilPublishStaticWebAssetsCandidates contain the `Fingerprint` and the `Integrity` from the old assets.
Remove them and call DefineStaticWebAssets so that they can get re-computed appropriately.
-->
<ItemGroup>
<_NewWebCilPublishStaticWebAssetsCandidatesNoMetadata
<ItemGroup>
<_NewWebCilPublishStaticWebAssetsCandidatesNoMetadata
Include="@(_NewWebCilPublishStaticWebAssetsCandidates)"
RemoveMetadata="Integrity;Fingerprint" />
</ItemGroup>
Expand All @@ -459,9 +487,18 @@ Copyright (c) .NET Foundation. All rights reserved.
<Output TaskParameter="Assets" ItemName="_NewWebCilPublishStaticWebAssets" />
</DefineStaticWebAssets>

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

<ItemGroup>
<ResolvedFileToPublish Remove="@(_PublishResolvedFilesToRemove)" />
<StaticWebAsset Include="@(_NewWebCilPublishStaticWebAssets)" />
<StaticWebAssetEndpoint Include="@(_NewWebCilPublishStaticWebAssetsEndpoint)" />

<!-- TODO: Probably doesn't do anything as of now, original https://github.com/dotnet/aspnetcore/pull/34798 -->
<PublishBlazorBootStaticWebAsset
Expand Down Expand Up @@ -499,6 +536,14 @@ Copyright (c) .NET Foundation. All rights reserved.
<Output TaskParameter="Assets" ItemName="_BlazorExtensionsCandidatesForPublish" />
<Output TaskParameter="Assets" ItemName="AssetToCompress" />
</DefineStaticWebAssets>

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

<Target Name="_AddWasmWebConfigFile" AfterTargets="ILLink">
Expand All @@ -511,7 +556,7 @@ Copyright (c) .NET Foundation. All rights reserved.
</ItemGroup>
</Target>

<Target Name="_AddPublishWasmBootJsonToStaticWebAssets">
<Target Name="_AddPublishWasmBootJsonToStaticWebAssets" DependsOnTargets="GeneratePublishWasmBootJson">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The GeneratePublishWasmBootJson can be removed from ResolveCompressedFilesForPublishDependsOn now

<ItemGroup>
<_PublishWasmBootJson
Include="$(IntermediateOutputPath)blazor.publish.boot.json"
Expand All @@ -532,7 +577,17 @@ Copyright (c) .NET Foundation. All rights reserved.
BasePath="$(StaticWebAssetBasePath)"
>
<Output TaskParameter="Assets" ItemName="StaticWebAsset" />
<Output TaskParameter="Assets" ItemName="_PublishWasmBootJsonStaticWebAsset" />
</DefineStaticWebAssets>

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

</Target>

<Target Name="GeneratePublishWasmBootJson" DependsOnTargets="$(GeneratePublishWasmBootJsonDependsOn)">
Expand Down