-
Notifications
You must be signed in to change notification settings - Fork 1.2k
[wasm] Embed HotReload in WebAssembly SDK #52710
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
base: main
Are you sure you want to change the base?
Changes from all commits
7ec7aa6
415a97b
1d61ff1
c777ede
366479c
43ca45c
9b27e95
0b699ca
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -21,10 +21,46 @@ Copyright (c) .NET Foundation. All rights reserved. | |
| <_WasmEnableHotReload Condition="'$(_WasmEnableHotReload)' == '' and '$(Configuration)' != 'Debug'">false</_WasmEnableHotReload> | ||
| <_WasmEnableHotReload Condition="'$(_WasmEnableHotReload)' == '' and '$(TargetFrameworkIdentifier)' == '.NETCoreApp' and $([MSBuild]::VersionGreaterThanOrEquals('$(TargetFrameworkVersion)', '10.0'))">true</_WasmEnableHotReload> | ||
| </PropertyGroup> | ||
| <Target Name="_ImplicitlyReferenceHotReload" BeforeTargets="ProcessFrameworkReferences"> | ||
| <ItemGroup Condition="'$(_WasmEnableHotReload)' == 'true'"> | ||
| <PackageReference Include="Microsoft.DotNet.HotReload.WebAssembly.Browser" Version="$(NETCoreSdkVersion)" IsImplicitlyDefined="true" /> | ||
| <Target Name="_ImplicitlyReferenceHotReload" BeforeTargets="ResolveProjectStaticWebAssets" AfterTargets="ResolveStaticWebAssetsConfiguration" Condition="'$(_WasmEnableHotReload)' == 'true'"> | ||
| <PropertyGroup> | ||
| <_WasmHotReloadRoot>$([MSBuild]::NormalizeDirectory($(MSBuildThisFileDirectory), '..', 'hotreload'))</_WasmHotReloadRoot> | ||
| <_WasmHotReloadDllPath Condition="$([MSBuild]::VersionGreaterThanOrEquals('$(TargetFrameworkVersion)', '10.0'))">net10.0</_WasmHotReloadDllPath> | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @tmat Do you prefer to multi-target the dll or pin it to .NET 10?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's pin to .NET 10 until we need runtime features that need higher version. It's simpler and reduces SDK size.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also, let's target |
||
| <_WasmHotReloadDllPath Condition="$([MSBuild]::VersionGreaterThanOrEquals('$(TargetFrameworkVersion)', '11.0'))">net11.0</_WasmHotReloadDllPath> | ||
| </PropertyGroup> | ||
| <ItemGroup Condition="'$(_WasmHotReloadDllPath)' != ''"> | ||
| <ReferenceCopyLocalPaths Include="$(_WasmHotReloadRoot)\$(_WasmHotReloadDllPath)\Microsoft.DotNet.HotReload.WebAssembly.Browser.dll"> | ||
| <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | ||
| <CopyToPublishDirectory>Never</CopyToPublishDirectory> | ||
| </ReferenceCopyLocalPaths> | ||
| <_WasmHotReloadModule Include="$(_WasmHotReloadRoot)\wwwroot\Microsoft.DotNet.HotReload.WebAssembly.Browser.lib.module.js"> | ||
| <TargetPath>_framework\Microsoft.DotNet.HotReload.WebAssembly.Browser.lib.module.js</TargetPath> | ||
| <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | ||
| <CopyToPublishDirectory>Never</CopyToPublishDirectory> | ||
| </_WasmHotReloadModule> | ||
| <_WasmHotReloadModule OriginalItemSpec="%(Identity)" /> | ||
| </ItemGroup> | ||
|
|
||
| <DefineStaticWebAssets | ||
| CandidateAssets="@(_WasmHotReloadModule)" | ||
| FingerprintCandidates="$(StaticWebAssetsFingerprintContent)" | ||
| FingerprintPatterns="@(StaticWebAssetFingerprintPattern)" | ||
| SourceId="$(PackageId)" | ||
| SourceType="Computed" | ||
| ContentRoot="$(_WasmHotReloadRoot)\wwwroot\" | ||
| BasePath="$(StaticWebAssetBasePath)" | ||
| AssetKind="Build" | ||
| AssetTraitName="JSModule" | ||
| AssetTraitValue="JSLibraryModule" | ||
| PropertyOverrides="AssetTraitName;AssetTraitValue"> | ||
| <Output TaskParameter="Assets" ItemName="StaticWebAsset" /> | ||
| <Output TaskParameter="Assets" ItemName="_WasmHotReloadModuleStaticWebAsset" /> | ||
| </DefineStaticWebAssets> | ||
| <DefineStaticWebAssetEndpoints | ||
| CandidateAssets="@(_WasmHotReloadModuleStaticWebAsset)" | ||
| ContentTypeMappings="@(StaticWebAssetContentTypeMapping)" | ||
| > | ||
| <Output TaskParameter="Endpoints" ItemName="StaticWebAssetEndpoint" /> | ||
| </DefineStaticWebAssetEndpoints> | ||
| </Target> | ||
|
|
||
| <Import Sdk="Microsoft.NET.Sdk.Publish" Project="Sdk.targets" Condition="'$(_WasmSdkImportsMicrosoftNETSdkPublish)' == 'true'" /> | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -47,6 +47,14 @@ | |
| <Pack>true</Pack> | ||
| <PackagePath>Sdk</PackagePath> | ||
| </AdditionalContent> | ||
| <AdditionalContent Include="$(ArtifactsBinDir)\Microsoft.DotNet.HotReload.WebAssembly.Browser\$(Configuration)\**\*.*"> | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shouldn't this come from a project reference? Otherwise, the build graph is not going to have the dependency edge and build may fail depending on the order in which the projects are built. |
||
| <Pack>true</Pack> | ||
| <PackagePath>hotreload</PackagePath> | ||
| </AdditionalContent> | ||
| <AdditionalContent Include="$(SdkSrcRoot)\BuiltInTools\HotReloadAgent.WebAssembly.Browser\wwwroot\**\*.*"> | ||
| <Pack>true</Pack> | ||
| <PackagePath>hotreload\wwwroot</PackagePath> | ||
| </AdditionalContent> | ||
| </ItemGroup> | ||
|
|
||
| <Target Name="PrepareAdditionalFilesToLayout" BeforeTargets="AssignTargetPaths"> | ||
|
|
||
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.
lines 14-17 shouldn't needed anymore.