Skip to content

Commit

Permalink
[wasm] Fix builds for blazor app + InvariantGlobalization=true (#90432)
Browse files Browse the repository at this point in the history
The following commit caused workload to be required for a blazor app
when `InvariantGlobalization==true`, but this is not required.

```
commit 26ae097
Author: Ankit Jain <radical@gmail.com>
Date:   Thu Aug 10 23:39:10 2023 -0400

    [wasm] Fix up conditions to trigger relink, and require `wasm-tools` workload (#89754)
```

And this broke some sdk tests.
  • Loading branch information
radical authored Aug 11, 2023
1 parent b22aa17 commit 685b593
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
'$(WasmEnableSIMD)' == 'false' or
'$(WasmEnableExceptionHandling)' == 'false' or
'$(InvariantTimezone)' == 'true' or
'$(InvariantGlobalization)' == 'true' or
('$(_UsingBlazorOrWasmSdk)' != 'true' and '$(InvariantGlobalization)' == 'true') or
'$(WasmNativeStrip)' == 'false'">true</_WasmPropertiesDifferFromRuntimePackThusNativeBuildNeeded>

<!-- $(WasmBuildNative)==true is needed to enable workloads, when using native references, without AOT -->
Expand Down
10 changes: 9 additions & 1 deletion src/mono/wasm/Wasm.Build.Tests/Blazor/WorkloadRequiredTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public static (string propertyName, bool triggerValue)[] PropertiesWithTriggerVa
("WasmEnableSIMD", false),
("WasmEnableExceptionHandling", false),
("InvariantTimezone", true),
("InvariantGlobalization", true),
//("InvariantGlobalization", true), - not applicable for blazor
("WasmNativeStrip", false)
};

Expand Down Expand Up @@ -60,6 +60,14 @@ public void WorkloadRequiredForBuild(string config, string extraProperties, bool
public void WorkloadRequiredForPublish(string config, string extraProperties, bool workloadNeeded)
=> CheckWorkloadRequired(config, extraProperties, workloadNeeded, publish: true);

[Theory, TestCategory("no-workload")]
[InlineData("Debug", "<InvariantGlobalization>true</InvariantGlobalization>", /*workloadNeeded*/ false, /*publish*/ false)]
[InlineData("Debug", "<InvariantGlobalization>false</InvariantGlobalization>", /*workloadNeeded*/ false, /*publish*/ false)]
[InlineData("Release", "<InvariantGlobalization>true</InvariantGlobalization>", /*workloadNeeded*/ false, /*publish*/ true)]
[InlineData("Release", "<InvariantGlobalization>false</InvariantGlobalization>", /*workloadNeeded*/ false, /*publish*/ true)]
public void WorkloadNotRequiredForInvariantGlobalization(string config, string extraProperties, bool workloadNeeded, bool publish)
=> CheckWorkloadRequired(config, extraProperties, workloadNeeded, publish: publish);

private void CheckWorkloadRequired(string config, string extraProperties, bool workloadNeeded, bool publish)
{
string id = $"props_req_workload_{(publish ? "publish" : "build")}_{GetRandomId()}";
Expand Down

0 comments on commit 685b593

Please sign in to comment.