From 6e63861cf330e6c26e2f1c211f5ca21d017179c1 Mon Sep 17 00:00:00 2001 From: Ankit Jain Date: Tue, 6 Apr 2021 21:41:26 -0400 Subject: [PATCH] [wasm][tests][aot] Propogate wasm properties from the original project .. to the proxy project on helix. This also fixes https://github.com/dotnet/runtime/issues/50727 , by correctly passing `$(InvariantGlobalization)` property to the proxy project. So, re-enable `Invariant.Tests`. --- eng/testing/tests.mobile.targets | 39 +++++++++++-- src/libraries/tests.proj | 3 - ...build.proj => AOTTestProjectForHelix.proj} | 7 ++- src/tasks/WasmBuildTasks/GenerateAOTProps.cs | 55 +++++++++++++++++++ 4 files changed, 93 insertions(+), 11 deletions(-) rename src/mono/wasm/data/aot-tests/{aot-build.proj => AOTTestProjectForHelix.proj} (93%) create mode 100644 src/tasks/WasmBuildTasks/GenerateAOTProps.cs diff --git a/eng/testing/tests.mobile.targets b/eng/testing/tests.mobile.targets index 9a8e360f3d30b..21bddd4db8397 100644 --- a/eng/testing/tests.mobile.targets +++ b/eng/testing/tests.mobile.targets @@ -20,15 +20,21 @@ - dotnet msbuild publish/aot-build.proj /bl:$XHARNESS_OUT/AOTBuild.binlog - $(RunScriptCommand) /p:RuntimeSrcDir=$(RepoRoot) /p:RuntimeConfig=$(Configuration) - $(RunScriptCommand) /p:WasmBuildSupportDir=$HELIX_CORRELATION_PAYLOAD/build - $(RunScriptCommand) /p:RunAOTCompilation=$(RunAOTCompilation) + dotnet msbuild publish/AOTTestProjectForHelix.proj /bl:$XHARNESS_OUT/AOTBuild.binlog - $(RunScriptCommand) && cd wasm_build/AppBundle && + + $(RunScriptCommand) /p:RuntimeSrcDir=$(RepoRoot) /p:RuntimeConfig=$(Configuration) + + + $(RunScriptCommand) /p:WasmBuildSupportDir=$HELIX_CORRELATION_PAYLOAD/build + + $(RunScriptCommand) /p:RunAOTCompilation=$(RunAOTCompilation) + $(RunScriptCommand) && cd wasm_build/AppBundle + $(RunScriptCommand) && + $(RunScriptCommand) $HARNESS_RUNNER wasm $XHARNESS_COMMAND --app=. --engine=$(JSEngine) $(JSEngineArgs) --js-file=runtime.js --output-directory=$XHARNESS_OUT -- $(RunTestsJSArguments) --run WasmTestRunner.dll $(AssemblyName).dll $(RunScriptCommand) $HARNESS_RUNNER wasm $XHARNESS_COMMAND --app=. --engine=$(JSEngine) $(JSEngineArgs) --js-file=runtime.js --output-directory=$XHARNESS_OUT --expected-exit-code=$(ExpectedExitCode) -- $(RunTestsJSArguments) --run $(AssemblyName).dll --testing @@ -280,6 +286,7 @@ + @@ -289,6 +296,28 @@ + + + <_WasmPropertyNames Include="InvariantGlobalization" /> + <_WasmPropertyNames Include="AOTMode" /> + <_WasmPropertyNames Include="WasmDebugLevel" /> + <_WasmPropertyNames Include="WasmBuildNative" /> + <_WasmPropertyNames Include="_WasmDevel" /> + <_WasmPropertyNames Include="WasmLinkIcalls" /> + <_WasmPropertyNames Include="WasmDedup" /> + + <_WasmPropertiesToPass + Include="$(%(_WasmPropertyNames.Identity))" + Name="%(_WasmPropertyNames.Identity)" + ConditionToUse="%(_WasmPropertyNames.ConditionToUse)" /> + + + + + diff --git a/src/libraries/tests.proj b/src/libraries/tests.proj index c29d32a0e0b68..57ae2024e314d 100644 --- a/src/libraries/tests.proj +++ b/src/libraries/tests.proj @@ -274,9 +274,6 @@ - - - diff --git a/src/mono/wasm/data/aot-tests/aot-build.proj b/src/mono/wasm/data/aot-tests/AOTTestProjectForHelix.proj similarity index 93% rename from src/mono/wasm/data/aot-tests/aot-build.proj rename to src/mono/wasm/data/aot-tests/AOTTestProjectForHelix.proj index 37d63927f3c3e..4acc227dc95a7 100644 --- a/src/mono/wasm/data/aot-tests/aot-build.proj +++ b/src/mono/wasm/data/aot-tests/AOTTestProjectForHelix.proj @@ -6,19 +6,20 @@ $(MSBuildThisFileDirectory)..\wasm_build\ $(TestRootDir)..\publish\ $(TestRootDir)\obj + false - false true false - PrepareForWasmBuildApp;$(WasmBuildAppDependsOn) + + - >$(TestRootDir)AppBundle\ + $(TestRootDir)AppBundle\ $(OriginalPublishDir)WasmTestRunner.dll $(OriginalPublishDir)runtime-test.js true diff --git a/src/tasks/WasmBuildTasks/GenerateAOTProps.cs b/src/tasks/WasmBuildTasks/GenerateAOTProps.cs new file mode 100644 index 0000000000000..8e6c9c3142a9b --- /dev/null +++ b/src/tasks/WasmBuildTasks/GenerateAOTProps.cs @@ -0,0 +1,55 @@ +// 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.Diagnostics.CodeAnalysis; +using System.IO; +using System.Text; +using Microsoft.Build.Framework; +using Microsoft.Build.Utilities; + +namespace Microsoft.WebAssembly.Build.Tasks +{ + public class GenerateAOTProps : Task + { + [NotNull] + [Required] + public ITaskItem[]? Properties { get; set; } + + [NotNull] + [Required] + public string? OutputFile { get; set; } + + public override bool Execute() + { + var outDir = Path.GetDirectoryName(OutputFile); + if (!string.IsNullOrEmpty(outDir) && !Directory.Exists(outDir)) + Directory.CreateDirectory(outDir); + + StringBuilder sb = new(); + + sb.AppendLine(""); + sb.AppendLine(" "); + + foreach (var prop in Properties) + { + string value = prop.ItemSpec; + string? name = prop.GetMetadata("Name"); + string? condition = prop.GetMetadata("ConditionToUse"); + + if (!string.IsNullOrEmpty(condition)) + sb.AppendLine($" <{name} Condition=\"{condition}\">{value}"); + else + sb.AppendLine($" <{name}>{value}"); + } + + sb.AppendLine(" "); + sb.AppendLine(""); + + File.WriteAllText(OutputFile, sb.ToString()); + return !Log.HasLoggedErrors; + } + + } +}