diff --git a/eng/testing/scenarios/BuildWasmAppsJobsList.txt b/eng/testing/scenarios/BuildWasmAppsJobsList.txt
index eb29f0052f6a05..00f34812664385 100644
--- a/eng/testing/scenarios/BuildWasmAppsJobsList.txt
+++ b/eng/testing/scenarios/BuildWasmAppsJobsList.txt
@@ -13,6 +13,7 @@ Wasm.Build.Tests.Blazor.MiscTests2
Wasm.Build.Tests.Blazor.MiscTests3
Wasm.Build.Tests.Blazor.NativeTests
Wasm.Build.Tests.Blazor.NoopNativeRebuildTest
+Wasm.Build.Tests.Blazor.WorkloadRequiredTests
Wasm.Build.Tests.Blazor.IcuTests
Wasm.Build.Tests.BuildPublishTests
Wasm.Build.Tests.ConfigSrcTests
diff --git a/eng/testing/tests.browser.targets b/eng/testing/tests.browser.targets
index f53072182007bd..8c4b3e46c9eac9 100644
--- a/eng/testing/tests.browser.targets
+++ b/eng/testing/tests.browser.targets
@@ -15,7 +15,7 @@
- For regular library tests, it will use the symbols file from the runtime pack.
- for AOT library tests, we use WasmNativeStrip=false, so we already have symbols
-->
- false
+ false
true
<_WasmMainJSFileName Condition="'$(WasmMainJSPath)' != ''">$([System.IO.Path]::GetFileName('$(WasmMainJSPath)'))
diff --git a/eng/testing/workloads-testing.targets b/eng/testing/workloads-testing.targets
index 373ee0d388a04e..2961313c84973d 100644
--- a/eng/testing/workloads-testing.targets
+++ b/eng/testing/workloads-testing.targets
@@ -77,14 +77,6 @@
-
-
-
- <_ManifestsToRemove Include="$(_SdkWithNoWorkloadPath)\sdk-manifests\8.0.100\microsoft.net.workload.mono.toolchain" />
-
-
-
diff --git a/src/mono/nuget/Microsoft.NET.Workload.Mono.Toolchain.Current.Manifest/WorkloadManifest.targets.in b/src/mono/nuget/Microsoft.NET.Workload.Mono.Toolchain.Current.Manifest/WorkloadManifest.targets.in
index 3a551a646e5cf5..246a656a460372 100644
--- a/src/mono/nuget/Microsoft.NET.Workload.Mono.Toolchain.Current.Manifest/WorkloadManifest.targets.in
+++ b/src/mono/nuget/Microsoft.NET.Workload.Mono.Toolchain.Current.Manifest/WorkloadManifest.targets.in
@@ -39,10 +39,23 @@
+
+ <_WasmPropertiesDifferFromRuntimePackThusNativeBuildNeeded Condition="
+ '$(WasmEnableLegacyJsInterop)' == 'false' or
+ '$(WasmEnableSIMD)' == 'false' or
+ '$(WasmEnableExceptionHandling)' == 'false' or
+ '$(InvariantTimezone)' == 'true' or
+ '$(InvariantGlobalization)' == 'true' or
+ '$(WasmNativeStrip)' == 'false'">true
+
- <_WasmNativeWorkloadNeeded Condition="'$(RunAOTCompilation)' == 'true' or '$(WasmEnableSIMD)' == 'true' or '$(WasmEnableLegacyJsInterop)' == 'false' or '$(WasmBuildNative)' == 'true' or
- '$(WasmGenerateAppBundle)' == 'true' or '$(_UsingBlazorOrWasmSdk)' != 'true'" >true
+ <_WasmNativeWorkloadNeeded Condition="
+ '$(_WasmPropertiesDifferFromRuntimePackThusNativeBuildNeeded)' == 'true' or
+ '$(RunAOTCompilation)' == 'true' or
+ '$(WasmBuildNative)' == 'true' or
+ '$(WasmGenerateAppBundle)' == 'true' or
+ '$(_UsingBlazorOrWasmSdk)' != 'true'" >true
false
true
@@ -185,8 +198,8 @@
Text="WebAssembly workloads, required for native relinking, are only supported for projects targeting net6.0+ . Set %24(WasmBuildNative)=false to disable it." />
-
diff --git a/src/mono/wasm/Wasm.Build.Tests/Blazor/BlazorBuildOptions.cs b/src/mono/wasm/Wasm.Build.Tests/Blazor/BlazorBuildOptions.cs
index ba953eb86fd00f..f8ccf6a5e31408 100644
--- a/src/mono/wasm/Wasm.Build.Tests/Blazor/BlazorBuildOptions.cs
+++ b/src/mono/wasm/Wasm.Build.Tests/Blazor/BlazorBuildOptions.cs
@@ -13,6 +13,7 @@ public record BlazorBuildOptions
string TargetFramework = BuildTestBase.DefaultTargetFrameworkForBlazor,
bool IsPublish = false,
bool WarnAsError = true,
+ bool ExpectSuccess = true,
bool ExpectRelinkDirWhenPublishing = false,
bool ExpectFingerprintOnDotnetJs = false,
RuntimeVariant RuntimeType = RuntimeVariant.SingleThreaded,
diff --git a/src/mono/wasm/Wasm.Build.Tests/Blazor/BlazorWasmTestBase.cs b/src/mono/wasm/Wasm.Build.Tests/Blazor/BlazorWasmTestBase.cs
index 5da83c4c56a641..79f16d31bbd275 100644
--- a/src/mono/wasm/Wasm.Build.Tests/Blazor/BlazorWasmTestBase.cs
+++ b/src/mono/wasm/Wasm.Build.Tests/Blazor/BlazorWasmTestBase.cs
@@ -58,9 +58,10 @@ public string CreateBlazorWasmTemplateProject(string id)
if (options.WarnAsError)
extraArgs = extraArgs.Append("/warnaserror").ToArray();
- (CommandResult res, string logPath) = BlazorBuildInternal(options.Id, options.Config, publish: false, setWasmDevel: false, extraArgs);
+ (CommandResult res, string logPath) = BlazorBuildInternal(options.Id, options.Config, publish: false, setWasmDevel: false, expectSuccess: options.ExpectSuccess, extraArgs);
- AssertBundle(res.Output, options with { IsPublish = false });
+ if (options.ExpectSuccess)
+ AssertBundle(res.Output, options with { IsPublish = false });
return (res, logPath);
}
@@ -70,25 +71,29 @@ public string CreateBlazorWasmTemplateProject(string id)
if (options.WarnAsError)
extraArgs = extraArgs.Append("/warnaserror").ToArray();
- (CommandResult res, string logPath) = BlazorBuildInternal(options.Id, options.Config, publish: true, setWasmDevel: false, extraArgs);
- AssertBundle(res.Output, options with { IsPublish = true });
+ (CommandResult res, string logPath) = BlazorBuildInternal(options.Id, options.Config, publish: true, setWasmDevel: false, expectSuccess: options.ExpectSuccess, extraArgs);
- if (options.ExpectedFileType == NativeFilesType.AOT)
+ if (options.ExpectSuccess)
{
- // check for this too, so we know the format is correct for the negative
- // test for jsinterop.webassembly.dll
- Assert.Contains("Microsoft.JSInterop.dll -> Microsoft.JSInterop.dll.bc", res.Output);
+ AssertBundle(res.Output, options with { IsPublish = true });
- // make sure this assembly gets skipped
- Assert.DoesNotContain("Microsoft.JSInterop.WebAssembly.dll -> Microsoft.JSInterop.WebAssembly.dll.bc", res.Output);
- }
+ if (options.ExpectedFileType == NativeFilesType.AOT)
+ {
+ // check for this too, so we know the format is correct for the negative
+ // test for jsinterop.webassembly.dll
+ Assert.Contains("Microsoft.JSInterop.dll -> Microsoft.JSInterop.dll.bc", res.Output);
- string objBuildDir = Path.Combine(_projectDir!, "obj", options.Config, options.TargetFramework!, "wasm", "for-build");
- // Check that we linked only for publish
- if (options.ExpectRelinkDirWhenPublishing)
- Assert.True(Directory.Exists(objBuildDir), $"Could not find expected {objBuildDir}, which gets created when relinking during Build. This is likely a test authoring error");
- else
- Assert.False(File.Exists(Path.Combine(objBuildDir, "emcc-link.rsp")), $"Found unexpected files in {objBuildDir}, which gets created when relinking during Build");
+ // make sure this assembly gets skipped
+ Assert.DoesNotContain("Microsoft.JSInterop.WebAssembly.dll -> Microsoft.JSInterop.WebAssembly.dll.bc", res.Output);
+ }
+
+ string objBuildDir = Path.Combine(_projectDir!, "obj", options.Config, options.TargetFramework!, "wasm", "for-build");
+ // Check that we linked only for publish
+ if (options.ExpectRelinkDirWhenPublishing)
+ Assert.True(Directory.Exists(objBuildDir), $"Could not find expected {objBuildDir}, which gets created when relinking during Build. This is likely a test authoring error");
+ else
+ Assert.False(File.Exists(Path.Combine(objBuildDir, "emcc-link.rsp")), $"Found unexpected files in {objBuildDir}, which gets created when relinking during Build");
+ }
return (res, logPath);
}
@@ -98,6 +103,7 @@ public string CreateBlazorWasmTemplateProject(string id)
string config,
bool publish = false,
bool setWasmDevel = true,
+ bool expectSuccess = true,
params string[] extraArgs)
{
try
@@ -105,7 +111,7 @@ public string CreateBlazorWasmTemplateProject(string id)
return BuildProjectWithoutAssert(
id,
config,
- new BuildProjectOptions(CreateProject: false, UseCache: false, Publish: publish),
+ new BuildProjectOptions(CreateProject: false, UseCache: false, Publish: publish, ExpectSuccess: expectSuccess),
extraArgs.Concat(new[]
{
"-p:BlazorEnableCompression=false",
diff --git a/src/mono/wasm/Wasm.Build.Tests/Blazor/WorkloadRequiredTests.cs b/src/mono/wasm/Wasm.Build.Tests/Blazor/WorkloadRequiredTests.cs
new file mode 100644
index 00000000000000..e0ee5e8f208f0d
--- /dev/null
+++ b/src/mono/wasm/Wasm.Build.Tests/Blazor/WorkloadRequiredTests.cs
@@ -0,0 +1,89 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+
+using System;
+using System.Collections.Generic;
+using System.IO;
+using Xunit;
+using Xunit.Abstractions;
+
+#nullable enable
+
+namespace Wasm.Build.Tests.Blazor;
+
+public class WorkloadRequiredTests : BlazorWasmTestBase
+{
+ /* Keep in sync with settings in wasm.proj, and WasmApp.Native.targets .
+ * The `triggerValue` here is opposite of the default used when building the runtime pack
+ * (see wasm.proj), and thus requiring a native build
+ */
+ public static (string propertyName, bool triggerValue)[] PropertiesWithTriggerValues = new[]
+ {
+ ("RunAOTCompilation", true),
+ ("WasmEnableLegacyJsInterop", false),
+ ("WasmEnableSIMD", false),
+ ("WasmEnableExceptionHandling", false),
+ ("InvariantTimezone", true),
+ ("InvariantGlobalization", true),
+ ("WasmNativeStrip", false)
+ };
+
+ public WorkloadRequiredTests(ITestOutputHelper output, SharedBuildPerTestClassFixture buildContext)
+ : base(output, buildContext)
+ {
+ }
+
+ public static TheoryData SettingDifferentFromValuesInRuntimePack(bool forPublish)
+ {
+ TheoryData data = new();
+
+ string[] configs = new[] { "Debug", "Release" };
+ foreach (var defaultPair in PropertiesWithTriggerValues)
+ {
+ foreach (string config in configs)
+ {
+ data.Add(config, $"<{defaultPair.propertyName}>{defaultPair.triggerValue}{defaultPair.propertyName}>", true);
+ data.Add(config, $"<{defaultPair.propertyName}>{!defaultPair.triggerValue}{defaultPair.propertyName}>", false);
+ }
+ }
+
+ return data;
+ }
+
+ [Theory, TestCategory("no-workload")]
+ [MemberData(nameof(SettingDifferentFromValuesInRuntimePack), parameters: false)]
+ public void WorkloadRequiredForBuild(string config, string extraProperties, bool workloadNeeded)
+ => CheckWorkloadRequired(config, extraProperties, workloadNeeded, publish: false);
+
+ [Theory, TestCategory("no-workload")]
+ [MemberData(nameof(SettingDifferentFromValuesInRuntimePack), parameters: false)]
+ public void WorkloadRequiredForPublish(string config, string extraProperties, bool workloadNeeded)
+ => CheckWorkloadRequired(config, extraProperties, workloadNeeded, publish: true);
+
+ private void CheckWorkloadRequired(string config, string extraProperties, bool workloadNeeded, bool publish)
+ {
+ string id = $"props_req_workload_{(publish ? "publish" : "build")}_{GetRandomId()}";
+ string projectFile = CreateWasmTemplateProject(id, "blazorwasm");
+ AddItemsPropertiesToProject(projectFile, extraProperties,
+ atTheEnd: @"
+
+ ");
+
+ CommandResult result;
+ if (publish)
+ (result, _) = BlazorPublish(new BlazorBuildOptions(id, config, ExpectSuccess: false));
+ else
+ (result, _) = BlazorBuild(new BlazorBuildOptions(id, config, ExpectSuccess: false));
+
+ if (workloadNeeded)
+ {
+ Assert.Contains("following workloads must be installed: wasm-tools", result.Output);
+ Assert.DoesNotContain("error : Stopping the build", result.Output);
+ }
+ else
+ {
+ Assert.DoesNotContain("following workloads must be installed: wasm-tools", result.Output);
+ Assert.Contains("error : Stopping the build", result.Output);
+ }
+ }
+}
diff --git a/src/mono/wasm/Wasm.Build.Tests/Common/BuildEnvironment.cs b/src/mono/wasm/Wasm.Build.Tests/Common/BuildEnvironment.cs
index 558bfb00909de9..21feaea66f28e7 100644
--- a/src/mono/wasm/Wasm.Build.Tests/Common/BuildEnvironment.cs
+++ b/src/mono/wasm/Wasm.Build.Tests/Common/BuildEnvironment.cs
@@ -128,9 +128,6 @@ public BuildEnvironment()
EnvVars["WasmEnableWebCil"] = "false";
}
- // helps with debugging
- EnvVars["WasmNativeStrip"] = "false";
-
DotNet = Path.Combine(sdkForWorkloadPath!, "dotnet");
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
DotNet += ".exe";
diff --git a/src/mono/wasm/Wasm.Build.Tests/WasmNativeDefaultsTests.cs b/src/mono/wasm/Wasm.Build.Tests/WasmNativeDefaultsTests.cs
index 3e30da43d9655e..5efd84085b8863 100644
--- a/src/mono/wasm/Wasm.Build.Tests/WasmNativeDefaultsTests.cs
+++ b/src/mono/wasm/Wasm.Build.Tests/WasmNativeDefaultsTests.cs
@@ -1,11 +1,10 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
-using System;
+using System.Collections.Generic;
using System.IO;
using Xunit;
using Xunit.Abstractions;
-using Xunit.Sdk;
#nullable enable
@@ -18,39 +17,157 @@ public WasmNativeDefaultsTests(ITestOutputHelper output, SharedBuildPerTestClass
{
}
+ public static TheoryData SettingDifferentFromValuesInRuntimePack(bool forPublish)
+ {
+ List<(string propertyName, bool defaultValueInRuntimePack)> defaults = new()
+ {
+ ("WasmEnableLegacyJsInterop", true),
+ ("WasmEnableSIMD", true),
+ ("WasmEnableExceptionHandling", true),
+ ("InvariantTimezone", false),
+ ("InvariantGlobalization", false),
+ // ("WasmNativeStrip", true) -- tested separately because it has special handling in targets
+ };
+
+ TheoryData data = new();
+
+ string[] configs = new[] { "Debug", "Release" };
+ foreach (var defaultPair in defaults)
+ {
+ foreach (string config in configs)
+ {
+ // Config=Release always causes relinking when publishing
+ bool publishValue = forPublish && config == "Release" ? true : false;
+ // Setting the default value from the runtime pack shouldn't trigger relinking
+ data.Add(config, $"<{defaultPair.propertyName}>{defaultPair.defaultValueInRuntimePack}{defaultPair.propertyName}>",
+ /*aot*/ false, /*build*/ false, /*publish*/ publishValue);
+ // Leaving the property unset, so checking the default
+ data.Add(config, "", /*aot*/ false, /*build*/ false, /*publish*/ publishValue);
+
+ // Setting the !default value should trigger relinking
+ data.Add(config, $"<{defaultPair.propertyName}>{!defaultPair.defaultValueInRuntimePack}{defaultPair.propertyName}>",
+ /*aot*/ false, /*build*/ true, /*publish*/ true);
+ }
+ }
+
+ return data;
+ }
+ public static TheoryData DefaultsTestData(bool forPublish)
+ {
+ TheoryData data = new()
+ {
+ /* relink by default for publish+Release */
+ { "Release", "", /*aot*/ false, /*build*/ false, /*publish*/ true },
+ /* NO relink by default for publish+Release, when not trimming */
+ { "Release", "false", /*aot*/ false, /*build*/ false, /*publish*/ false },
+
+ /* When not trimming, and no-aot, we don't relink. But WasmNativeStrip=false should still trigger it*/
+ // { "Release", "falsefalse",
+ // /*aot*/ false, /*build*/ true, /*publish*/ true }
+ };
+
+ if (!forPublish)
+ {
+ /* Debug config, when building does trigger relinking */
+ data.Add("Debug", "", /*aot*/ false, /*build*/ false, /*publish*/ true);
+ }
+
+ if (forPublish)
+ {
+ /* NO relink by default for publish+Debug */
+ data.Add("Debug", "", /*aot*/ false, /*build*/ false, /*publish*/ false);
+
+ /* AOT */
+ data.Add("Release", "", /*aot*/ true, /*build*/ false, /*publish*/ true);
+ data.Add("Debug", "", /*aot*/ true, /*build*/ false, /*publish*/ true);
+
+ // FIXME: separate test
+ // { "Release", "true",
+ // /*aot*/ true, /*build*/ true, /*publish*/ true },
+
+ /* AOT not affected by trimming */
+ data.Add("Release", "false", /*aot*/ true, /*build*/ false, /*publish*/ true);
+ data.Add("Debug", "false", /*aot*/ true, /*build*/ false, /*publish*/ true);
+ }
+
+ return data;
+ }
+
[Theory]
- /* relink by default for publish+Release */
- [InlineData("Release", "", /*aot*/ false, /*build*/ false, /*publish*/ true)]
- /* NO relink by default for publish+Release, even when not trimming */
- [InlineData("Release", "false", /*aot*/ false, /*build*/ false, /*publish*/ false)]
-
- [InlineData("Debug", "", /*aot*/ false, /*build*/ false, /*publish*/ false)]
-
- /* AOT */
- [InlineData("Release", "", /*aot*/ true, /*build*/ false, /*publish*/ true)]
- [InlineData("Debug", "", /*aot*/ true, /*build*/ false, /*publish*/ true)]
- // FIXME: separate test
- // [InlineData("Release", "true",
- // /*aot*/ true, /*build*/ true, /*publish*/ true)]
-
- /* AOT not affected by trimming */
- [InlineData("Release", "false", /*aot*/ true, /*build*/ false, /*publish*/ true)]
- [InlineData("Debug", "false", /*aot*/ true, /*build*/ false, /*publish*/ true)]
- public void Defaults(string config, string extraProperties, bool aot, bool buildValue, bool publishValue)
+ [MemberData(nameof(DefaultsTestData), parameters: false)]
+ [MemberData(nameof(SettingDifferentFromValuesInRuntimePack), parameters: false)]
+ public void DefaultsWithBuild(string config, string extraProperties, bool aot, bool expectWasmBuildNativeForBuild, bool expectWasmBuildNativeForPublish)
{
- string output = CheckWasmNativeDefaultValue("native_defaults_publish", config, extraProperties, aot, dotnetWasmFromRuntimePack: !publishValue);
+ string output = CheckWasmNativeDefaultValue("native_defaults_build", config, extraProperties, aot, dotnetWasmFromRuntimePack: !expectWasmBuildNativeForPublish, publish: false);
+
+ bool expectedWasmNativeStripValue = true;
+ if (/*isBuild && */ expectWasmBuildNativeForBuild && config == "Debug")
+ expectedWasmNativeStripValue = false;
+ // bool expectedWasmNativeStripValue = !(wasmBuildNativeForBuild && config == "Debug");
// for build
- Assert.DoesNotContain($"** WasmBuildNative: '{buildValue.ToString().ToLower()}', WasmBuildingForNestedPublish: ''", output);
+ Assert.Contains($"** WasmBuildNative: '{expectWasmBuildNativeForBuild.ToString().ToLower()}', WasmNativeStrip: '{expectedWasmNativeStripValue.ToString().ToLower()}', WasmBuildingForNestedPublish: ''", output);
+ Assert.Contains("Stopping the build", output);
+ }
+
+#pragma warning disable xUnit1026 // For unused *buildValue* parameter
+ [Theory]
+ [MemberData(nameof(DefaultsTestData), parameters: true)]
+ [MemberData(nameof(SettingDifferentFromValuesInRuntimePack), parameters: true)]
+ public void DefaultsWithPublish(string config, string extraProperties, bool aot, bool expectWasmBuildNativeForBuild, bool expectWasmBuildNativeForPublish)
+ {
+ string output = CheckWasmNativeDefaultValue("native_defaults_publish", config, extraProperties, aot, dotnetWasmFromRuntimePack: !expectWasmBuildNativeForPublish, publish: true);
+
+ // for build
+ // Assert.DoesNotContain($"** WasmBuildNative: '{buildValue.ToString().ToLower()}', WasmNativeStrip: 'true', WasmBuildingForNestedPublish: ''", output);
// for publish
- Assert.Contains($"** WasmBuildNative: '{publishValue.ToString().ToLower()}', WasmBuildingForNestedPublish: 'true'", output);
+ Assert.Contains($"** WasmBuildNative: '{expectWasmBuildNativeForPublish.ToString().ToLower()}', WasmNativeStrip: 'true', WasmBuildingForNestedPublish: 'true'", output);
+ Assert.Contains("Stopping the build", output);
+ }
+#pragma warning restore xunit1026
+
+ public static TheoryData SetWasmNativeStripExplicitlyTestData(bool publish) => new()
+ {
+ {"Debug", "true", false, true },
+ {"Release", "true", publish, true },
+ {"Debug", "false", true, false },
+ {"Release", "false", true, false }
+ };
+
+ public static TheoryData SetWasmNativeStripExplicitlyWithWasmBuildNativeTestData() => new()
+ {
+ { "Debug", "falsefalse", true, false },
+ { "Release", "falsefalse", true, false },
+ { "Debug", "truefalse", true, true },
+ { "Release", "truefalse", true, true }
+ };
+
+ [Theory]
+ [MemberData(nameof(SetWasmNativeStripExplicitlyTestData), parameters: /*publish*/ false)]
+ [MemberData(nameof(SetWasmNativeStripExplicitlyWithWasmBuildNativeTestData))]
+ public void WasmNativeStripDefaultWithBuild(string config, string extraProperties, bool expectedWasmBuildNativeValue, bool expectedWasmNativeStripValue)
+ {
+ string output = CheckWasmNativeDefaultValue("native_strip_defaults", config, extraProperties, aot: false, dotnetWasmFromRuntimePack: !expectedWasmBuildNativeValue, publish: false);
+
+ Assert.Contains($"** WasmBuildNative: '{expectedWasmBuildNativeValue.ToString().ToLower()}', WasmNativeStrip: '{expectedWasmNativeStripValue.ToString().ToLower()}', WasmBuildingForNestedPublish: ''", output);
+ Assert.Contains("Stopping the build", output);
+ }
+
+ [Theory]
+ [MemberData(nameof(SetWasmNativeStripExplicitlyTestData), parameters: /*publish*/ true)]
+ [MemberData(nameof(SetWasmNativeStripExplicitlyWithWasmBuildNativeTestData))]
+ public void WasmNativeStripDefaultWithPublish(string config, string extraProperties, bool expectedWasmBuildNativeValue, bool expectedWasmNativeStripValue)
+ {
+ string output = CheckWasmNativeDefaultValue("native_strip_defaults", config, extraProperties, aot: false, dotnetWasmFromRuntimePack: !expectedWasmBuildNativeValue, publish: true);
+
+ Assert.Contains($"** WasmBuildNative: '{expectedWasmBuildNativeValue.ToString().ToLower()}', WasmNativeStrip: '{expectedWasmNativeStripValue.ToString().ToLower()}', WasmBuildingForNestedPublish: 'true'", output);
Assert.Contains("Stopping the build", output);
}
[Theory]
/* always relink */
- [InlineData("Release", "", /*build*/ true, /*publish*/ true)]
[InlineData("Debug", "", /*build*/ true, /*publish*/ true)]
+ [InlineData("Release", "", /*build*/ true, /*publish*/ true)]
[InlineData("Release", "false", /*build*/ true, /*publish*/ true)]
public void WithNativeReference(string config, string extraProperties, bool buildValue, bool publishValue)
{
@@ -61,12 +178,13 @@ public void WithNativeReference(string config, string extraProperties, bool buil
extraProperties,
aot: false,
dotnetWasmFromRuntimePack: !publishValue,
+ publish: true,
extraItems: nativeRefItem);
- // for build
- Assert.DoesNotContain($"** WasmBuildNative: '{buildValue.ToString().ToLower()}', WasmBuildingForNestedPublish: ''", output);
+ // for build - FIXME:
+ Assert.DoesNotContain($"** WasmBuildNative: '{buildValue.ToString().ToLower()}', WasmBuildingForNestedPublish: ''", output);
// for publish
- Assert.Contains($"** WasmBuildNative: '{publishValue.ToString().ToLower()}', WasmBuildingForNestedPublish: 'true'", output);
+ Assert.Contains($"** WasmBuildNative: '{publishValue.ToString().ToLower()}', WasmNativeStrip: 'true', WasmBuildingForNestedPublish: 'true'", output);
Assert.Contains("Stopping the build", output);
}
@@ -75,16 +193,19 @@ private string CheckWasmNativeDefaultValue(string projectName,
string extraProperties,
bool aot,
bool dotnetWasmFromRuntimePack,
+ bool publish,
string extraItems = "")
{
// builds with -O0
extraProperties += "<_WasmDevel>true";
string printValueTarget = @"
-
-
-
- ";
+
+
+ " + (publish
+ ? @""
+ : @"")
+ + "";
BuildArgs buildArgs = new(ProjectName: projectName, Config: config, AOT: aot, string.Empty, null);
buildArgs = ExpandBuildArgs(buildArgs,
@@ -99,7 +220,8 @@ private string CheckWasmNativeDefaultValue(string projectName,
DotnetWasmFromRuntimePack: dotnetWasmFromRuntimePack,
ExpectSuccess: false,
UseCache: false,
- BuildOnlyAfterPublish: false));
+ BuildOnlyAfterPublish: false,
+ Publish: publish));
return output;
}
diff --git a/src/mono/wasm/Wasm.Build.Tests/WasmSIMDTests.cs b/src/mono/wasm/Wasm.Build.Tests/WasmSIMDTests.cs
index b63098064f166e..46fb36135d6f2a 100644
--- a/src/mono/wasm/Wasm.Build.Tests/WasmSIMDTests.cs
+++ b/src/mono/wasm/Wasm.Build.Tests/WasmSIMDTests.cs
@@ -98,42 +98,6 @@ public void PublishWithoutSIMD_AOT(BuildArgs buildArgs, RunHost host, string id)
}, host: host, id: id);
}
- [Theory, TestCategory("no-workload")]
- [InlineData("Debug", /*aot*/true, /*publish*/true)]
- [InlineData("Debug", /*aot*/false, /*publish*/false)]
- [InlineData("Debug", /*aot*/false, /*publish*/true)]
- [InlineData("Release", /*aot*/true, /*publish*/true)]
- [InlineData("Release", /*aot*/false, /*publish*/false)]
- [InlineData("Release", /*aot*/false, /*publish*/true)]
- public void BuildWithSIMDNeedsWorkload(string config, bool aot, bool publish)
- {
- string id = GetRandomId();
- string projectName = $"simd_no_workload_{config}_aot_{aot}";
- BuildArgs buildArgs = new
- (
- ProjectName: projectName,
- Config: config,
- AOT: aot,
- ProjectFileContents: "placeholder",
- ExtraBuildArgs: string.Empty
- );
-
- string extraProperties = """
- browser-wasm
- true
- """;
- buildArgs = ExpandBuildArgs(buildArgs, extraProperties);
-
- (_, string output) = BuildProject(buildArgs,
- id: id,
- new BuildProjectOptions(
- InitProject: () => File.WriteAllText(Path.Combine(_projectDir!, "Program.cs"), s_simdProgramText),
- Publish: publish,
- ExpectSuccess: false,
- UseCache: false));
- Assert.Contains("following workloads must be installed: wasm-tools", output);
- }
-
private static string s_simdProgramText = @"
using System;
using System.Runtime.Intrinsics;
diff --git a/src/mono/wasm/build/WasmApp.Native.targets b/src/mono/wasm/build/WasmApp.Native.targets
index 1a894ad7b9eab8..eb3be550b22586 100644
--- a/src/mono/wasm/build/WasmApp.Native.targets
+++ b/src/mono/wasm/build/WasmApp.Native.targets
@@ -21,7 +21,8 @@
<_BeforeWasmBuildAppDependsOn>
$(_BeforeWasmBuildAppDependsOn);
_SetupEmscripten;
- _SetWasmBuildNativeDefaults
+ _SetWasmBuildNativeDefaults;
+ _SetWasmNativeStripDefault
<_EmccDefaultFlags Condition="'$(WasmEnableSIMD)' == 'true'">-msimd128
@@ -108,26 +109,27 @@
+
+ <_BoolPropertiesThatTriggerRelinking Include="WasmEnableLegacyJsInterop" DefaultValueInRuntimePack="true" />
+ <_BoolPropertiesThatTriggerRelinking Include="WasmEnableSIMD" DefaultValueInRuntimePack="true" />
+ <_BoolPropertiesThatTriggerRelinking Include="WasmEnableExceptionHandling" DefaultValueInRuntimePack="true" />
+ <_BoolPropertiesThatTriggerRelinking Include="InvariantTimezone" DefaultValueInRuntimePack="false" />
+ <_BoolPropertiesThatTriggerRelinking Include="InvariantGlobalization" DefaultValueInRuntimePack="false" />
+ <_BoolPropertiesThatTriggerRelinking Include="WasmNativeStrip" DefaultValueInRuntimePack="true" />
+
+
+
+ true
+
+
true
-
- true
-
-
- true
-
-
- true
-
-
- true
- true
-
true
-
false
@@ -137,13 +139,6 @@
true
true
-
- true
-
-
- true
- true
-
false
@@ -162,6 +157,14 @@
+
+
+
+ false
+ true
+
+
+
@@ -172,8 +175,6 @@
<_MonoAotCrossCompilerPath>@(MonoAotCrossCompiler->WithMetadataValue('RuntimeIdentifier','browser-wasm'))
<_EmccDefaultFlagsRsp>$([MSBuild]::NormalizePath($(_WasmRuntimePackSrcDir), 'emcc-default.rsp'))
<_EmccDefaultLinkFlagsRsp>$([MSBuild]::NormalizePath($(_WasmRuntimePackSrcDir), 'emcc-link.rsp'))
- false
- true
true
$(WasmBuildNative)
@@ -216,7 +217,7 @@
<_EmccCommonFlags Include="$(_DefaultEmccFlags)" />
<_EmccCommonFlags Include="$(EmccFlags)" />
- <_EmccCommonFlags Include="-g" Condition="'$(WasmNativeStrip)' == 'false'" />
+ <_EmccCommonFlags Include="-g" Condition="'$(WasmNativeDebugSymbols)' == 'true'" />
<_EmccCommonFlags Include="-v" Condition="'$(EmccVerbose)' != 'false'" />
<_EmccCommonFlags Include="-s DISABLE_EXCEPTION_CATCHING=0" Condition="'$(WasmEnableExceptionHandling)' == 'false'" />
<_EmccCommonFlags Include="-fwasm-exceptions" Condition="'$(WasmEnableExceptionHandling)' == 'true'" />
@@ -243,7 +244,6 @@
<_EmccCFlags Include="-emit-llvm" />
<_EmccCFlags Include=""-I%(_EmccIncludePaths.Identity)"" />
- <_EmccCFlags Include="-g" Condition="'$(WasmNativeDebugSymbols)' == 'true'" />
<_EmccLDFlags Include="$(EmccLinkOptimizationFlag)" />
@@ -397,7 +397,7 @@
-
@@ -718,7 +718,7 @@
<_AssembliesToScan Include="@(_WasmAssembliesInternal)" />
-
+