From 93eacbd8f7dd806bb8b0848c74fe8d72646c7fee Mon Sep 17 00:00:00 2001 From: Ilona Tomkowicz <32700855+ilonatommy@users.noreply.github.com> Date: Tue, 18 Jun 2024 16:04:14 +0000 Subject: [PATCH] [wasm] Move hardcoded `_BoolPropertiesThatTriggerRelinking` to `wasm-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. --- src/mono/browser/browser.proj | 14 +++++++++++++- src/mono/browser/build/BrowserWasmApp.targets | 3 --- src/mono/wasi/Wasi.Build.Tests/SdkMissingTests.cs | 4 ++-- src/mono/wasi/build/WasiApp.targets | 5 ----- src/mono/wasi/wasi.proj | 12 ++++++++++++ src/mono/wasm/build/WasmApp.Common.targets | 11 +++-------- 6 files changed, 30 insertions(+), 19 deletions(-) diff --git a/src/mono/browser/browser.proj b/src/mono/browser/browser.proj index 12bdcca654264..81768d43e6a53 100644 --- a/src/mono/browser/browser.proj +++ b/src/mono/browser/browser.proj @@ -23,6 +23,10 @@ $([MSBuild]::NormalizeDirectory('$(PkgMicrosoft_NETCore_Runtime_ICU_Transport)', 'runtimes', 'browser-wasm', 'native', 'lib')) $([MSBuild]::NormalizeDirectory('$(PkgMicrosoft_NETCore_Runtime_ICU_Transport)', 'runtimes', 'browser-wasm-threads', 'native', 'lib')) + false + false + true + false true true true @@ -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)" } + ] } } ]]> diff --git a/src/mono/browser/build/BrowserWasmApp.targets b/src/mono/browser/build/BrowserWasmApp.targets index fc8708fed161d..ae7ea4f7f781d 100644 --- a/src/mono/browser/build/BrowserWasmApp.targets +++ b/src/mono/browser/build/BrowserWasmApp.targets @@ -61,9 +61,6 @@ - - <_BoolPropertiesThatTriggerRelinking Include="WasmEnableSIMD" DefaultValueInRuntimePack="true" /> - <_BoolPropertiesThatTriggerRelinking Include="WasmEnableExceptionHandling" DefaultValueInRuntimePack="true" /> diff --git a/src/mono/wasi/Wasi.Build.Tests/SdkMissingTests.cs b/src/mono/wasi/Wasi.Build.Tests/SdkMissingTests.cs index 580754663c12c..99e8b2a144805 100644 --- a/src/mono/wasi/Wasi.Build.Tests/SdkMissingTests.cs +++ b/src/mono/wasi/Wasi.Build.Tests/SdkMissingTests.cs @@ -31,8 +31,8 @@ public static TheoryData TestDataForNativeBuildFails(strin }; [Theory] - [MemberData(nameof(TestDataForNativeBuildFails), "true")] - [MemberData(nameof(TestDataForNativeBuildFails), "true")] + [MemberData(nameof(TestDataForNativeBuildFails), "truetrue")] + [MemberData(nameof(TestDataForNativeBuildFails), "truetrue")] public void NativeBuildOrPublishFails(string config, string extraProperties, bool publish) { string output = BuildWithInvalidSdkPath(config, extraProperties, publish, expectSuccess: false); diff --git a/src/mono/wasi/build/WasiApp.targets b/src/mono/wasi/build/WasiApp.targets index c2e3ae6f11962..40664b86a7d42 100644 --- a/src/mono/wasi/build/WasiApp.targets +++ b/src/mono/wasi/build/WasiApp.targets @@ -46,11 +46,6 @@ - - <_BoolPropertiesThatTriggerRelinking Include="WasmEnableSIMD" DefaultValueInRuntimePack="false" /> - - - diff --git a/src/mono/wasi/wasi.proj b/src/mono/wasi/wasi.proj index 120607ce7e9fc..9c386481a26e1 100644 --- a/src/mono/wasi/wasi.proj +++ b/src/mono/wasi/wasi.proj @@ -8,6 +8,10 @@ $([MSBuild]::NormalizeDirectory('$(PkgMicrosoft_NETCore_Runtime_ICU_Transport)', 'runtimes', 'wasi-wasm', 'native', 'lib')) $([MSBuild]::NormalizeDirectory('$(PkgMicrosoft_NETCore_Runtime_ICU_Transport)', 'runtimes', 'wasi-wasm-threads', 'native', 'lib')) + false + false + true + false false false $(ArtifactsObjDir)wasi @@ -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)" } + ] } } ]]> + diff --git a/src/mono/wasm/build/WasmApp.Common.targets b/src/mono/wasm/build/WasmApp.Common.targets index 7f9e8230815ab..6aafca7d110a2 100644 --- a/src/mono/wasm/build/WasmApp.Common.targets +++ b/src/mono/wasm/build/WasmApp.Common.targets @@ -113,21 +113,14 @@ - - <_BoolPropertiesThatTriggerRelinking Include="InvariantTimezone" DefaultValueInRuntimePack="false" /> - <_BoolPropertiesThatTriggerRelinking Include="InvariantGlobalization" DefaultValueInRuntimePack="false" /> - <_BoolPropertiesThatTriggerRelinking Include="WasmNativeStrip" DefaultValueInRuntimePack="true" /> - <_BoolPropertiesThatTriggerRelinking Include="WasmSingleFileBundle" DefaultValueInRuntimePack="false" /> - - $(PrepareInputsForWasmBuildDependsOn); _SetupToolchain; + _ReadWasmProps; _SetWasmBuildNativeDefaults; _GetDefaultWasmAssembliesToBundle; _WasmGetRuntimeConfigPath; - _ReadWasmProps; @@ -400,6 +393,7 @@ + @@ -411,6 +405,7 @@ +