diff --git a/docs/workflow/testing/libraries/testing-wasm.md b/docs/workflow/testing/libraries/testing-wasm.md index bb80a32876f9b8..7e2f3302e09ea5 100644 --- a/docs/workflow/testing/libraries/testing-wasm.md +++ b/docs/workflow/testing/libraries/testing-wasm.md @@ -195,26 +195,30 @@ stale staged assets can otherwise cause assembly-loading failures before tests s The `LibraryTestsCoreCLR_R2R` CI jobs use the same configuration and archive the published tests for execution on Helix. The existing interpreter jobs remain separate. -To run a library suite with a single composite ReadyToRun image instead of per-assembly -images, add `PublishReadyToRunComposite=true`: +CoreCLR browser ReadyToRun tests publish a single composite image +(`.r2r.wasm`) by default. It is staged into `wwwroot/_framework` beside +the component WebCIL stubs and listed in the boot config. + +To run a library suite with per-assembly ReadyToRun images instead, add +`PublishReadyToRunComposite=false`: ```bash XHARNESS_COMMAND=test-browser ./build.sh libs.tests -test -os browser -c Release \ --projects $PWD/src/libraries/System.Memory/tests/System.Memory.Tests.csproj \ - /p:RuntimeFlavor=CoreCLR /p:TestWasmReadyToRun=true /p:PublishReadyToRunComposite=true \ + /p:RuntimeFlavor=CoreCLR /p:TestWasmReadyToRun=true /p:PublishReadyToRunComposite=false \ /p:EnableAggressiveTrimming=true /p:Scenario=WasmTestOnChrome /p:InstallChromeForTests=true ``` -The composite image (`.r2r.wasm`) is staged into `wwwroot/_framework` beside -the component WebCIL stubs and listed in the boot config. As with other mode switches, clean -the project-specific `bin` and `obj` outputs when switching between composite and per-assembly -images. +As with other mode switches, clean the project-specific `bin` and `obj` outputs when +switching between composite and per-assembly images. -For CoreCLR browser applications, set `PublishReadyToRun=true` and -`PublishReadyToRunComposite=true` to publish a single composite ReadyToRun image and -component WebCIL stubs instead of per-assembly images. Publishing requires a wasm-capable -crossgen2 and WebCIL enabled; the composite is loaded before the runtime starts. -`ReadyToRunTests.PublishRunAllPagesComposite` exercises trimmed, untrimmed, and +For CoreCLR browser applications, ReadyToRun remains opt-in: set +`PublishReadyToRun=true` to publish a single composite ReadyToRun image and component +WebCIL stubs. Set `PublishReadyToRunComposite=false` to retain per-assembly images. +Publishing requires a wasm-capable crossgen2. Composite publishing additionally requires +ReadyToRun SDK tasks that support wasm composite output naming and WebCIL enabled; +the composite is loaded before the runtime starts. +`ReadyToRunTests.PublishRunAllPagesComposite` exercises the default mode with trimmed, untrimmed, and native-relinked publishes in a browser, including asset fingerprinting when `USE_FINGERPRINTING_FOR_TESTS=true`. diff --git a/src/mono/nuget/Microsoft.NET.Sdk.WebAssembly.Pack/build/Microsoft.NET.Sdk.WebAssembly.Browser.CoreCLR.targets b/src/mono/nuget/Microsoft.NET.Sdk.WebAssembly.Pack/build/Microsoft.NET.Sdk.WebAssembly.Browser.CoreCLR.targets index d5d6a22615f67a..0f18cc5dac3515 100644 --- a/src/mono/nuget/Microsoft.NET.Sdk.WebAssembly.Pack/build/Microsoft.NET.Sdk.WebAssembly.Browser.CoreCLR.targets +++ b/src/mono/nuget/Microsoft.NET.Sdk.WebAssembly.Pack/build/Microsoft.NET.Sdk.WebAssembly.Browser.CoreCLR.targets @@ -30,8 +30,6 @@ Copyright (c) .NET Foundation. All rights reserved. wasm - - false $(PublishReadyToRunCrossgen2ExtraArgs);--opt-cross-module:* $(PublishReadyToRunCrossgen2ExtraArgs);--instruction-set:relaxed-simd @@ -83,7 +81,7 @@ Copyright (c) .NET Foundation. All rights reserved. + Text="PublishReadyToRunComposite for CoreCLR browser-wasm requires WebCIL-in-Wasm assemblies; enable WasmEnableWebcil. To opt out of composite mode, set PublishReadyToRunComposite=false." /> + Text="PublishReadyToRunComposite for CoreCLR browser-wasm requires ReadyToRun SDK tasks that name the composite image '<entry>.r2r.wasm', but they planned '$([System.IO.Path]::GetFileName('%(_WasmCompositeOwnerEntry.OutputR2RImage)'))'. Use an SDK with wasm ReadyToRun output naming (dotnet/sdk#56395), or set Crossgen2SdkOverridePropsPath and Crossgen2SdkOverrideTargetsPath to the dotnet/runtime Crossgen2Tasks. To opt out of composite mode, set PublishReadyToRunComposite=false." /> false + true + partial full diff --git a/src/mono/sample/wasm/Directory.Build.props b/src/mono/sample/wasm/Directory.Build.props index b63362260ba5e2..03138cf9ff35a0 100644 --- a/src/mono/sample/wasm/Directory.Build.props +++ b/src/mono/sample/wasm/Directory.Build.props @@ -53,6 +53,7 @@ $(Nested_RuntimeFlavor) $(Nested_PublishReadyToRun) + $(Nested_PublishReadyToRunComposite) false diff --git a/src/mono/sample/wasm/Directory.Build.targets b/src/mono/sample/wasm/Directory.Build.targets index bd4f2de1aa2de6..e7f33cf2022e0a 100644 --- a/src/mono/sample/wasm/Directory.Build.targets +++ b/src/mono/sample/wasm/Directory.Build.targets @@ -34,6 +34,7 @@ + diff --git a/src/mono/wasm/Wasm.Build.Tests/NativeLibraryTests.cs b/src/mono/wasm/Wasm.Build.Tests/NativeLibraryTests.cs index 21307e7197e75b..62a102cc0e5e1a 100644 --- a/src/mono/wasm/Wasm.Build.Tests/NativeLibraryTests.cs +++ b/src/mono/wasm/Wasm.Build.Tests/NativeLibraryTests.cs @@ -41,7 +41,7 @@ private async Task ProjectWithNativeReferenceCore(Configuration config, bool aot string extraItems = $""; string extraProperties = "true"; if (readyToRun) - extraProperties += "true"; + extraProperties += "truefalse"; string insertAtEnd = readyToRun ? """ diff --git a/src/mono/wasm/Wasm.Build.Tests/ReadyToRunTests.cs b/src/mono/wasm/Wasm.Build.Tests/ReadyToRunTests.cs index c6a3ddb6b5e508..1334dd1c09de24 100644 --- a/src/mono/wasm/Wasm.Build.Tests/ReadyToRunTests.cs +++ b/src/mono/wasm/Wasm.Build.Tests/ReadyToRunTests.cs @@ -86,8 +86,9 @@ private async Task PublishRunAllPagesCore(Configuration config, bool trimmed, bo string extraItems = composite ? """""" : string.Empty; + string compositeProperty = composite ? string.Empty : "false"; ProjectInfo info = CopyTestAsset(config, aot: false, TestAsset.BlazorBasicTestApp, label, - extraProperties: $"true{(composite ? "true" : "false")}{(trimmed ? "true" : "false")}", + extraProperties: $"true{compositeProperty}{(trimmed ? "true" : "false")}", extraItems: extraItems); if (composite) LogR2RSuffixLibraryMarker();