Skip to content

Add emsdk RepositoryReference to runtime for browser builds - #8193

Merged
akoeplinger merged 7 commits into
dotnet:mainfrom
akoeplinger:akoeplinger/runtime-emsdk-repositoryreference
Aug 11, 2026
Merged

akoeplinger merged 7 commits into
dotnet:mainfrom
akoeplinger:akoeplinger/runtime-emsdk-repositoryreference

Conversation

@akoeplinger

@akoeplinger akoeplinger commented Aug 7, 2026 •

Copy link
Copy Markdown
Member

The browser (WebAssembly) runtime build needs the Emscripten toolchain provided by emsdk. This adds a browser-gated RepositoryReference from runtime to emsdk so that emsdk source changes are consumed by the runtime browser build in the same vertical.

emsdk is a host build tool, so emsdk.proj overrides the target OS/architecture/RID to the host values, while the vertical keeps flowing TargetOS=browser (so emsdk stays a ShortStack build and its assets keep Vertical visibility, i.e. they aren't published from the browser-wasm job).

We add a new marker package to flow the version from emsdk to runtime.

The browser (WebAssembly) runtime build needs the Emscripten toolchain
from emsdk. Add a browser-gated RepositoryReference from runtime to emsdk
so emsdk source changes are consumed by the runtime browser build in the
same vertical.

emsdk is a host build tool, so its build is overridden to target the host
OS/architecture/RID even though the vertical keeps TargetOS=browser.

Co-authored-by: Copilot <[email protected]>
Copilot-Session: 9ffabacd-e239-4bbc-9f9f-8ff2cc616bae
Copilot AI review requested due to automatic review settings August 7, 2026 17:47
@akoeplinger
akoeplinger requested review from a team as code owners August 7, 2026 17:47
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).
1 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds emsdk as a dependency of the runtime repo build when building the browser (WebAssembly) vertical, and adjusts the emsdk repo-project to build for the host toolchain even when the outer vertical target is browser.

Changes:

  • Add a browser-gated RepositoryReference from runtime to emsdk.
  • In emsdk.proj, append host-targeting properties to the repo build args for the browser vertical.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
repo-projects/runtime.proj Adds emsdk as a browser-only dependency so runtime browser builds consume emsdk changes in the same vertical.
repo-projects/emsdk.proj Overrides target properties during browser vertical builds so emsdk is built for the host toolchain.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread repo-projects/emsdk.proj Resolved
akoeplinger and others added 2 commits August 10, 2026 10:32
The VMR-level $(BuildRid) can be distro-specific (e.g. azurelinux.3.0-x64),
which made emsdk look for runtime.azurelinux.3.0-x64.Microsoft.NETCore.Runtime.Wasm.*.Transport
packages that only exist for portable RIDs, failing with NU1101. It also made
TargetRid != emsdk's own portable BuildRid, so emsdk treated it as a cross-build.

Co-authored-by: Copilot <[email protected]>
Copilot-Session: 9ffabacd-e239-4bbc-9f9f-8ff2cc616bae
Now that runtime references emsdk in repo-projects, the browser build should
consume the emsdk built alongside it in the same vertical. It didn't: runtime's
EmsdkPackageVersion was set to MicrosoftNETCoreAppRefPackageVersion, which is a
Version.Details.xml dependency version, so NuGet restored a previously published
emsdk from the remote feed instead of the one this build just produced.

The reason for that workaround is that every package emsdk produces has both the
Emscripten version and the RID in its ID, so there is no stable ID to list in
Version.Details.xml and let package version propagation (PVP) override.

Add a payload-free Microsoft.NET.Runtime.Emscripten.Internal package to serve as
that stable ID. All emsdk packages share $(PackageVersion) via
Microsoft.NET.Runtime.Emscripten.Common.props, so it faithfully stands in for
all of them, and PVP can now flow the locally built version into runtime.

Do the same in src/sdk, which had the same problem in workloads.csproj. Its two
Emscripten Cache.win-x64 entries in Version.Details.xml were unreferenced, so
drop them in favour of the new package.

The new package is RID-agnostic, so Arcade's EnableDefaultRidSpecificArtifacts
handling publishes it externally only from the RID-agnostic vertical and marks
it Vertical elsewhere, which keeps it consumable in-vertical without duplicate
assets.

Co-authored-by: Copilot <[email protected]>
Copilot-Session: 9ffabacd-e239-4bbc-9f9f-8ff2cc616bae
@dotnet-policy-service
dotnet-policy-service Bot requested review from a team August 10, 2026 12:23
akoeplinger and others added 3 commits August 10, 2026 15:32
Resolved conflicts in the Maestro-generated Version.Details.props files by
taking the newly flowed versions and re-applying the
Microsoft.NET.Runtime.Emscripten.Internal entries on top.

Co-authored-by: Copilot <[email protected]>
Copilot-Session: 9ffabacd-e239-4bbc-9f9f-8ff2cc616bae
SanityCheckUnixFilePermissionsFile ran for every pkgproj on non-Windows, but
the data/UnixFilePermissions.xml it validates is only produced by
GenerateUnixPermissionsFile, which just the four payload-carrying packages pull
in. Microsoft.NET.Runtime.Emscripten.Internal ships no tools, so the check
failed the emsdk build in the Browser_Shortstack_wasm vertical.

Condition the check on ArtifactsDirToPackage, which is set by exactly those four
packages, so coverage is unchanged for everything that carries executables.

Co-authored-by: Copilot <[email protected]>
Copilot-Session: 9ffabacd-e239-4bbc-9f9f-8ff2cc616bae
Arcade's DefaultVersions.props imports eng/Versions.props well before it imports
DotNetPackageVersionPropsPath, so a property derived in Versions.props captures
the Version.Details.props value and never sees the propagated one. The browser
vertical showed this directly: package version propagation set
MicrosoftNETRuntimeEmscriptenInternalPackageVersion to 11.0.0-ci, but
EmsdkPackageVersion still held 11.0.0-rc.1.26379.102 and runtime restored a
previously published emsdk from the feed.

Move the definition to eng/AcquireEmscriptenSdk.targets, which is evaluated
after the propagation props. Its only consumers are PackageReference items,
which are evaluated after all properties, so they still observe it.

Co-authored-by: Copilot <[email protected]>
Copilot-Session: 9ffabacd-e239-4bbc-9f9f-8ff2cc616bae

@mmitche mmitche left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

What kind of effect does this have on shortstack build times?

@akoeplinger

Copy link
Copy Markdown
Member Author

@mmitche it only affects the browser-wasm job and it goes from ~40mins to ~70mins, well below the long-pole jobs

@akoeplinger
akoeplinger enabled auto-merge (squash) August 11, 2026 14:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants