From 9ccb5c42ccd9f43ea04c866eb31b3314ea95b3e7 Mon Sep 17 00:00:00 2001 From: Zoltan Varga Date: Thu, 5 Jan 2023 14:50:19 -0500 Subject: [PATCH 1/4] [wasm] Enable dedup by default. --- src/mono/wasm/build/WasmApp.targets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mono/wasm/build/WasmApp.targets b/src/mono/wasm/build/WasmApp.targets index 9c8d75ac10a3dc..f48baa1eac6ba0 100644 --- a/src/mono/wasm/build/WasmApp.targets +++ b/src/mono/wasm/build/WasmApp.targets @@ -87,7 +87,7 @@ --> - false + true false false From 408a7c29488839bfb8de46bbc009bb5878933c55 Mon Sep 17 00:00:00 2001 From: Ankit Jain Date: Thu, 5 Jan 2023 22:41:32 +0000 Subject: [PATCH 2/4] [wasm] Enable symbol map for AOT tests too --- eng/testing/tests.wasm.targets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/testing/tests.wasm.targets b/eng/testing/tests.wasm.targets index 2d23e4fcf91e18..8baf24a62e2b39 100644 --- a/eng/testing/tests.wasm.targets +++ b/eng/testing/tests.wasm.targets @@ -19,7 +19,7 @@ - for AOT library tests, we use WasmNativeStrip=false, so we already have symbols --> false - true + true <_ShellCommandSeparator Condition="'$(OS)' == 'Windows_NT'">&& From cc847443749f60d59669d228ec0094f911969be2 Mon Sep 17 00:00:00 2001 From: Ankit Jain Date: Wed, 18 Jan 2023 01:08:16 +0000 Subject: [PATCH 3/4] MonoAOTCompiler: Fix up the path for the output items if they had been .. copied to `aot-in` for the compilation step. Example: - when using WasmDedup=true, we get the main assemblies in `publish` directory after linking, but `aot-instances.dll` is in different directory. - this causes `MonoAOTCompiler` to copy all of them to a temporary `aot-in` dir for compiling with `mono-aot-cross`. - And when the output items are set, we get: ``` Output Item(s): _WasmAssembliesInternal= obj/Debug/net8.0/browser-wasm/wasm/for-publish/aot-in/Debug_u4nbxx3i.gc5.dll LlvmBitcodeFile=obj/Debug/net8.0/browser-wasm/wasm/for-publish/Debug_u4nbxx3i.gc5.dll.bc ``` - here the `ItemSpec` is incorrectly set to the temporary `aot-in` path - which can cause build failures in the following build steps --- src/tasks/AotCompilerTask/MonoAOTCompiler.cs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/tasks/AotCompilerTask/MonoAOTCompiler.cs b/src/tasks/AotCompilerTask/MonoAOTCompiler.cs index efcdaf30cc34f0..e6aac82177f048 100644 --- a/src/tasks/AotCompilerTask/MonoAOTCompiler.cs +++ b/src/tasks/AotCompilerTask/MonoAOTCompiler.cs @@ -560,7 +560,7 @@ private IEnumerable EnsureAllAssembliesInTheSameDir(IEnumerable ConvertAssembliesDictToOrderedList(ConcurrentDict List outItems = new(originalAssemblies.Count); foreach (ITaskItem item in originalAssemblies) { - if (dict.TryGetValue(item.GetMetadata("FullPath"), out ITaskItem? dictItem)) - outItems.Add(dictItem); + if (!dict.TryGetValue(item.GetMetadata("FullPath"), out ITaskItem? dictItem)) + continue; + + string originalFullPath = item.GetMetadata(s_originalFullPathMetadataName); + if (!string.IsNullOrEmpty(originalFullPath)) + dictItem.ItemSpec = originalFullPath; + + outItems.Add(dictItem); } return outItems; } From ae4791a62511fcf13dcf082adf57e5d5c52c2a28 Mon Sep 17 00:00:00 2001 From: Ankit Jain Date: Wed, 18 Jan 2023 01:13:28 +0000 Subject: [PATCH 4/4] WBT: remove redundant case --- src/mono/wasm/Wasm.Build.Tests/WasmTemplateTests.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/mono/wasm/Wasm.Build.Tests/WasmTemplateTests.cs b/src/mono/wasm/Wasm.Build.Tests/WasmTemplateTests.cs index 4507dddd1ff511..706ddc9b0b58ec 100644 --- a/src/mono/wasm/Wasm.Build.Tests/WasmTemplateTests.cs +++ b/src/mono/wasm/Wasm.Build.Tests/WasmTemplateTests.cs @@ -340,7 +340,6 @@ public static TheoryData TestDataForConsolePublishAndRun() { var data = new TheoryData(); data.Add("Debug", false, false); - data.Add("Debug", false, false); data.Add("Debug", false, true); data.Add("Release", false, false); // Release relinks by default