Force-build WasmSdk before layout glob to fix dropped WebAssembly SDK#55097
Open
mthalman wants to merge 1 commit into
Open
Force-build WasmSdk before layout glob to fix dropped WebAssembly SDK#55097mthalman wants to merge 1 commit into
mthalman wants to merge 1 commit into
Conversation
PublishNetSdks in GenerateLayout.targets collects the per-SDK layout content via wildcard globs that are evaluated when the target runs. The Microsoft.NET.Sdk.WebAssembly folder is populated by CopyAdditionalFilesToLayout (AfterTargets="Build") on src/WasmSdk/Tasks/Microsoft.NET.Sdk.WebAssembly.Tasks.csproj. If that project has not finished building when the glob runs, the glob resolves to an empty folder and the entire Microsoft.NET.Sdk.WebAssembly SDK is silently dropped from the layout. This is the same class of ordering race that dotnet#15651 worked around for src/WebSdk by force-building those projects up front, but that workaround never covered the sibling src/WasmSdk directory (added later). Extend the force-build to include src/WasmSdk/**/*.csproj so the WebAssembly layout source folder is guaranteed to be populated before the glob runs. Diagnosed from the reproducibility pipeline (build-twice-and-diff): one build contained the 9 WebAssembly SDK files and the other did not; the binlogs showed PublishNetSdks copied 0 WebAssembly files in the failing build while CopyAdditionalFilesToLayout still ran completely, confirming an ordering race rather than an incremental/timestamp skip.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes a layout-generation ordering race where PublishNetSdks can evaluate wildcard globs before the WebAssembly SDK’s layout content has been produced, causing Microsoft.NET.Sdk.WebAssembly to be silently omitted from the final SDK layout.
Changes:
- Extend the existing “force-build SDK projects before globbing layout content” step to also build projects under
src/WasmSdk/**. - Consolidate the WebSdk/WasmSdk force-build project list into a single item (
_SdkProjectFile) used by theMSBuildtask.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PublishNetSdks in GenerateLayout.targets collects the per-SDK layout content via wildcard globs that are evaluated when the target runs. The Microsoft.NET.Sdk.WebAssembly folder is populated by CopyAdditionalFilesToLayout (AfterTargets="Build") on src/WasmSdk/Tasks/Microsoft.NET.Sdk.WebAssembly.Tasks.csproj. If that project has not finished building when the glob runs, the glob resolves to an empty folder and the entire Microsoft.NET.Sdk.WebAssembly SDK is silently dropped from the layout.
This is the same class of ordering race that #15651 worked around for src/WebSdk by force-building those projects up front, but that workaround never covered the sibling src/WasmSdk directory (added later). Extend the force-build to include src/WasmSdk/**/*.csproj so the WebAssembly layout source folder is guaranteed to be populated before the glob runs.
Diagnosed from the reproducibility pipeline (build-twice-and-diff): one build contained the 9 WebAssembly SDK files and the other did not; the binlogs showed PublishNetSdks copied 0 WebAssembly files in the failing build while CopyAdditionalFilesToLayout still ran completely, confirming an ordering race rather than an incremental/timestamp skip.