[browser] Fix WasmEmitTypeScriptDefinitions making builds non-incremental#125509
[browser] Fix WasmEmitTypeScriptDefinitions making builds non-incremental#125509
Conversation
|
Tagging subscribers to 'arch-wasm': @lewing, @pavelsavara |
There was a problem hiding this comment.
Pull request overview
This PR fixes a build incrementality regression caused by WasmEmitTypeScriptDefinitions. When enabled, the first build copies dotnet.d.ts to wwwroot/, but on subsequent builds the wwwroot Content glob discovers it, causing Static Web Assets to regenerate manifests and break incrementality. The fix removes wwwroot\dotnet.d.ts from Content at evaluation time.
Changes:
- Added a static
ItemGroupthat removeswwwroot\dotnet.d.tsfrom Content whenWasmEmitTypeScriptDefinitionsis enabled, preventing the SWA pipeline from discovering it via the glob.
You can also share your feedback on Copilot code review. Take the survey.
...nuget/Microsoft.NET.Sdk.WebAssembly.Pack/build/Microsoft.NET.Sdk.WebAssembly.Browser.targets
Outdated
Show resolved
Hide resolved
When WasmEmitTypeScriptDefinitions is enabled, the _EnsureDotnetTypeScriptDefinitions target copies dotnet.d.ts to wwwroot/ during the first build. On the second build, the evaluation-time wwwroot glob picks up the file as a Content item, causing Static Web Assets to regenerate manifests with different content. The newer obj/ manifests then make _CopyOutOfDateSourceItemsToOutputDirectory treat the build as non-incremental. Fix by removing wwwroot/dotnet.d.ts from Content at evaluation time (static ItemGroup) so the SWA pipeline never discovers it through the glob, keeping manifests stable across builds. Fixes #124729 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Extends TypeScriptDefinitionsCopiedToWwwrootOnBuild to perform a second build when WasmEmitTypeScriptDefinitions is enabled, verifying that the presence of dotnet.d.ts in wwwroot does not break build incrementality. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
01e3cdf to
b64246b
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.
You can also share your feedback on Copilot code review. Take the survey.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.
You can also share your feedback on Copilot code review. Take the survey.
When WasmEmitTypeScriptDefinitions is enabled, the _EnsureDotnetTypeScriptDefinitions target copies dotnet.d.ts to wwwroot/ during the first build. On the second build, the evaluation-time wwwroot glob picks up the file as a Content item, causing Static Web Assets to regenerate manifests with different content. The newer obj/ manifests then make _CopyOutOfDateSourceItemsToOutputDirectory treat the build as non-incremental.
Fix by removing wwwroot/dotnet.d.ts from Content at evaluation time (static ItemGroup) so the SWA pipeline never discovers it through the glob, keeping manifests stable across builds.
Fixes #124729
Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com