Skip to content

Commit

Permalink
[wasm] Move hardcoded _BoolPropertiesThatTriggerRelinking to `wasm-…
Browse files Browse the repository at this point in the history
…props.json` included in the runtime pack (#103422)

* Fix.

* Fix

* Feedback.

* Fix wasi wbt.

* Fix CI - wbt testing native build should set it to true.
  • Loading branch information
ilonatommy authored Jun 18, 2024
1 parent 808328e commit 93eacbd
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 19 deletions.
14 changes: 13 additions & 1 deletion src/mono/browser/browser.proj
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@
<PropertyGroup>
<ICULibDir Condition="'$(WasmEnableThreads)' != 'true'">$([MSBuild]::NormalizeDirectory('$(PkgMicrosoft_NETCore_Runtime_ICU_Transport)', 'runtimes', 'browser-wasm', 'native', 'lib'))</ICULibDir>
<ICULibDir Condition="'$(WasmEnableThreads)' == 'true'">$([MSBuild]::NormalizeDirectory('$(PkgMicrosoft_NETCore_Runtime_ICU_Transport)', 'runtimes', 'browser-wasm-threads', 'native', 'lib'))</ICULibDir>
<InvariantTimezone Condition="'$(InvariantTimezone)' == ''">false</InvariantTimezone>
<InvariantGlobalization Condition="'$(InvariantGlobalization)' == ''">false</InvariantGlobalization>
<WasmNativeStrip Condition="'$(WasmNativeStrip)' == ''">true</WasmNativeStrip>
<WasmSingleFileBundle Condition="'$(WasmSingleFileBundle)' == ''">false</WasmSingleFileBundle>
<WasmEnableSIMD Condition="'$(WasmEnableSIMD)' == ''">true</WasmEnableSIMD>
<WasmEnableExceptionHandling Condition="'$(WasmEnableExceptionHandling)' == ''">true</WasmEnableExceptionHandling>
<WasmEnableJsInteropByValue Condition="'$(WasmEnableJsInteropByValue)' == '' and '$(WasmEnableThreads)' == 'true'">true</WasmEnableJsInteropByValue>
Expand Down Expand Up @@ -325,7 +329,15 @@
],
"WasmOptConfigurationFlags": [@(WasmOptConfigurationFlags -> '%22%(Identity)%22', ',')],
"EmccDefaultExportedFunctions": [@(EmccExportedFunction -> '%22%(Identity)%22', ',')],
"EmccDefaultExportedRuntimeMethods": [@(EmccExportedRuntimeMethod -> '%22%(Identity)%22', ',')]
"EmccDefaultExportedRuntimeMethods": [@(EmccExportedRuntimeMethod -> '%22%(Identity)%22', ',')],
"BoolPropertiesThatTriggerRelinking": [
{ "identity": "InvariantTimezone", "defaultValueInRuntimePack": "$(InvariantTimezone)" },
{ "identity": "InvariantGlobalization", "defaultValueInRuntimePack": "$(InvariantGlobalization)" },
{ "identity": "WasmNativeStrip", "defaultValueInRuntimePack": "$(WasmNativeStrip)" },
{ "identity": "WasmSingleFileBundle", "defaultValueInRuntimePack": "$(WasmSingleFileBundle)" },
{ "identity": "WasmEnableSIMD", "defaultValueInRuntimePack": "$(WasmEnableSIMD)" },
{ "identity": "WasmEnableExceptionHandling", "defaultValueInRuntimePack": "$(WasmEnableExceptionHandling)" }
]
}
}
]]>
Expand Down
3 changes: 0 additions & 3 deletions src/mono/browser/build/BrowserWasmApp.targets
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,6 @@
<ItemGroup>
<!-- Allow running/debugging from VS -->
<ProjectCapability Include="DotNetCoreWeb"/>

<_BoolPropertiesThatTriggerRelinking Include="WasmEnableSIMD" DefaultValueInRuntimePack="true" />
<_BoolPropertiesThatTriggerRelinking Include="WasmEnableExceptionHandling" DefaultValueInRuntimePack="true" />
</ItemGroup>

<Target Name="_GetWasmGenerateAppBundleDependencies">
Expand Down
4 changes: 2 additions & 2 deletions src/mono/wasi/Wasi.Build.Tests/SdkMissingTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ public static TheoryData<string, string, bool> TestDataForNativeBuildFails(strin
};

[Theory]
[MemberData(nameof(TestDataForNativeBuildFails), "<WasmSingleFileBundle>true</WasmSingleFileBundle>")]
[MemberData(nameof(TestDataForNativeBuildFails), "<InvariantGlobalization>true</InvariantGlobalization>")]
[MemberData(nameof(TestDataForNativeBuildFails), "<WasmSingleFileBundle>true</WasmSingleFileBundle><WasmBuildNative>true</WasmBuildNative>")]
[MemberData(nameof(TestDataForNativeBuildFails), "<InvariantGlobalization>true</InvariantGlobalization><WasmBuildNative>true</WasmBuildNative>")]
public void NativeBuildOrPublishFails(string config, string extraProperties, bool publish)
{
string output = BuildWithInvalidSdkPath(config, extraProperties, publish, expectSuccess: false);
Expand Down
5 changes: 0 additions & 5 deletions src/mono/wasi/build/WasiApp.targets
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,6 @@
<!--<WasiRunner Condition="'$(WasiRunner)' == ''">wasmtime</WasiRunner>-->
</PropertyGroup>

<ItemGroup>
<_BoolPropertiesThatTriggerRelinking Include="WasmEnableSIMD" DefaultValueInRuntimePack="false" />
<!--<_BoolPropertiesThatTriggerRelinking Include="WasmEnableExceptionHandling" DefaultValueInRuntimePack="true" />-->
</ItemGroup>

<Target Name="_GetWasiGenerateAppBundleDependencies">
<ItemGroup Condition="'$(InvariantGlobalization)' == 'true' or '$(WasmSingleFileBundle)' == 'true'">
<ReferenceCopyLocalPaths Remove="$(MicrosoftNetCoreAppRuntimePackRidNativeDir)icudt.dat" />
Expand Down
12 changes: 12 additions & 0 deletions src/mono/wasi/wasi.proj
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
<PropertyGroup>
<ICULibDir Condition="'$(WasmEnableThreads)' != 'true'">$([MSBuild]::NormalizeDirectory('$(PkgMicrosoft_NETCore_Runtime_ICU_Transport)', 'runtimes', 'wasi-wasm', 'native', 'lib'))</ICULibDir>
<ICULibDir Condition="'$(WasmEnableThreads)' == 'true'">$([MSBuild]::NormalizeDirectory('$(PkgMicrosoft_NETCore_Runtime_ICU_Transport)', 'runtimes', 'wasi-wasm-threads', 'native', 'lib'))</ICULibDir>
<InvariantTimezone Condition="'$(InvariantTimezone)' == ''">false</InvariantTimezone>
<InvariantGlobalization Condition="'$(InvariantGlobalization)' == ''">false</InvariantGlobalization>
<WasmNativeStrip Condition="'$(WasmNativeStrip)' == ''">true</WasmNativeStrip>
<WasmSingleFileBundle Condition="'$(WasmSingleFileBundle)' == ''">false</WasmSingleFileBundle>
<WasmEnableSIMD Condition="'$(WasmEnableSIMD)' == ''">false</WasmEnableSIMD>
<FilterSystemTimeZones Condition="'$(FilterSystemTimeZones)' == ''">false</FilterSystemTimeZones>
<WasiObjDir>$(ArtifactsObjDir)wasi</WasiObjDir>
Expand Down Expand Up @@ -152,9 +156,17 @@
{
"items": {
"WasmOptConfigurationFlags": [@(WasmOptConfigurationFlags -> '%22%(Identity)%22', ',')],
"BoolPropertiesThatTriggerRelinking": [
{ "identity": "InvariantTimezone", "defaultValueInRuntimePack": "$(InvariantTimezone)" },
{ "identity": "InvariantGlobalization", "defaultValueInRuntimePack": "$(InvariantGlobalization)" },
{ "identity": "WasmNativeStrip", "defaultValueInRuntimePack": "$(WasmNativeStrip)" },
{ "identity": "WasmSingleFileBundle", "defaultValueInRuntimePack": "$(WasmSingleFileBundle)" },
{ "identity": "WasmEnableSIMD", "defaultValueInRuntimePack": "$(WasmEnableSIMD)" }
]
}
}
]]>
<!-- { "identity": "WasmEnableExceptionHandling", "value": "$(WasmEnableExceptionHandling)", "defaultValueInRuntimePack": "true" }, -->
</_WasiPropsJson>
</PropertyGroup>

Expand Down
11 changes: 3 additions & 8 deletions src/mono/wasm/build/WasmApp.Common.targets
Original file line number Diff line number Diff line change
Expand Up @@ -113,21 +113,14 @@
<UsingTask TaskName="MonoTargetsTasks.MarshalingPInvokeScanner" AssemblyFile="$(MonoTargetsTasksAssemblyPath)" />
<UsingTask TaskName="EmitBundleObjectFiles" AssemblyFile="$(MonoTargetsTasksAssemblyPath)" />

<ItemGroup>
<_BoolPropertiesThatTriggerRelinking Include="InvariantTimezone" DefaultValueInRuntimePack="false" />
<_BoolPropertiesThatTriggerRelinking Include="InvariantGlobalization" DefaultValueInRuntimePack="false" />
<_BoolPropertiesThatTriggerRelinking Include="WasmNativeStrip" DefaultValueInRuntimePack="true" />
<_BoolPropertiesThatTriggerRelinking Include="WasmSingleFileBundle" DefaultValueInRuntimePack="false" />
</ItemGroup>

<PropertyGroup>
<PrepareInputsForWasmBuildDependsOn>
$(PrepareInputsForWasmBuildDependsOn);
_SetupToolchain;
_ReadWasmProps;
_SetWasmBuildNativeDefaults;
_GetDefaultWasmAssembliesToBundle;
_WasmGetRuntimeConfigPath;
_ReadWasmProps;
</PrepareInputsForWasmBuildDependsOn>

<WasmGenerateAppBundleDependsOn>
Expand Down Expand Up @@ -400,6 +393,7 @@
<WasmOptConfigurationFlags ParameterType="Microsoft.Build.Framework.ITaskItem[]" Required="false" Output="true" />
<EmccDefaultExportedFunctions ParameterType="Microsoft.Build.Framework.ITaskItem[]" Required="false" Output="true" />
<EmccDefaultExportedRuntimeMethods ParameterType="Microsoft.Build.Framework.ITaskItem[]" Required="false" Output="true" />
<BoolPropertiesThatTriggerRelinking ParameterType="Microsoft.Build.Framework.ITaskItem[]" Required="false" Output="true" />
</ParameterGroup>
</UsingTask>

Expand All @@ -411,6 +405,7 @@

<!-- shared by browser/wasi -->
<Output TaskParameter="WasmOptConfigurationFlags" ItemName="_DefaulWasmOptConfigurationFlags" />
<Output TaskParameter="BoolPropertiesThatTriggerRelinking" ItemName="_BoolPropertiesThatTriggerRelinking" />
</ReadWasmProps>

<CreateProperty Value="%(_EmccPropItems.Value)" Condition="%(_EmccPropItems.Identity) != ''">
Expand Down

0 comments on commit 93eacbd

Please sign in to comment.