From b75cb643f5593c04e36d863dadc914e0f27a262c Mon Sep 17 00:00:00 2001 From: Ankit Jain Date: Thu, 18 Feb 2021 21:52:06 -0500 Subject: [PATCH 1/5] [wasm] reduce visibility of `[AOT] /foo/bar.dll` messages --- src/mono/wasm/build/WasmApp.targets | 1 + src/tasks/AotCompilerTask/MonoAOTCompiler.cs | 4 ++-- src/tasks/Common/Utils.cs | 5 +++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/mono/wasm/build/WasmApp.targets b/src/mono/wasm/build/WasmApp.targets index d041b0a5aac9c9..5f08b2ec77b50e 100644 --- a/src/mono/wasm/build/WasmApp.targets +++ b/src/mono/wasm/build/WasmApp.targets @@ -280,6 +280,7 @@ <_WasmOptCommand>$([MSBuild]::NormalizePath('$(EMSDK_PATH)', 'upstream', 'bin', 'wasm-opt$(_ExeExt)')) + diff --git a/src/tasks/AotCompilerTask/MonoAOTCompiler.cs b/src/tasks/AotCompilerTask/MonoAOTCompiler.cs index 7e5baee6f81dd7..fd756737685ec6 100644 --- a/src/tasks/AotCompilerTask/MonoAOTCompiler.cs +++ b/src/tasks/AotCompilerTask/MonoAOTCompiler.cs @@ -255,7 +255,7 @@ private bool PrecompileLibrary(ITaskItem assemblyItem, string? monoPaths) processArgs.AddRange(p.Split(";", StringSplitOptions.RemoveEmptyEntries)); } - Utils.LogInfo($"[AOT] {assembly}"); + Log.LogMessage(MessageImportance.Low, $"[AOT] {assembly}"); processArgs.Add("--debug"); @@ -361,7 +361,7 @@ private bool PrecompileLibrary(ITaskItem assemblyItem, string? monoPaths) try { // run the AOT compiler - Utils.RunProcess(CompilerBinaryPath, string.Join(" ", processArgs), envVariables, directory, silent: false, outputMessageImportance: MessageImportance.Low); + Utils.RunProcess(CompilerBinaryPath, string.Join(" ", processArgs), envVariables, directory, silent: false, outputMessageImportance: MessageImportance.Low, logMessageImportance: MessageImportance.Low); } catch (Exception ex) { diff --git a/src/tasks/Common/Utils.cs b/src/tasks/Common/Utils.cs index 97b8e5cf0e5cf3..ecd01ef4500b67 100644 --- a/src/tasks/Common/Utils.cs +++ b/src/tasks/Common/Utils.cs @@ -28,9 +28,10 @@ public static string RunProcess( string? workingDir = null, bool ignoreErrors = false, bool silent = true, - MessageImportance outputMessageImportance=MessageImportance.High) + MessageImportance outputMessageImportance=MessageImportance.High, + MessageImportance logMessageImportance=MessageImportance.High) { - LogInfo($"Running: {path} {args}"); + LogInfo($"Running: {path} {args}", logMessageImportance); var outputBuilder = new StringBuilder(); var errorBuilder = new StringBuilder(); var processStartInfo = new ProcessStartInfo From 0b77ee6bfb809b8266c2a6b7dfb9c5aeb4d46b4d Mon Sep 17 00:00:00 2001 From: Ankit Jain Date: Thu, 18 Feb 2021 22:04:50 -0500 Subject: [PATCH 2/5] [wasm] build: Rename @(WasmAssembliesToBundle) -> @(WasmAssembly) - The reason for this change is that generating the app bundle is optional now. Eg. in case of blazor, which handles the layout itself. - In that case, the assemblies will be used for other things during `WasmBuildApp` target (eg. AOT). - Change the name to reflect that --- eng/testing/tests.mobile.targets | 2 +- src/mono/sample/mbr/browser/WasmDelta.csproj | 2 +- src/mono/sample/wasm/Directory.Build.targets | 2 +- src/mono/wasm/build/README.md | 8 ++-- src/mono/wasm/build/WasmApp.targets | 42 +++++++++---------- .../tests/debugger-test/debugger-test.csproj | 2 +- .../wasm-test-runner/WasmTestRunner.proj | 4 +- .../wasm/Directory.Build.targets | 2 +- 8 files changed, 32 insertions(+), 32 deletions(-) diff --git a/eng/testing/tests.mobile.targets b/eng/testing/tests.mobile.targets index b4e7fb22dfa962..4e36825e52adac 100644 --- a/eng/testing/tests.mobile.targets +++ b/eng/testing/tests.mobile.targets @@ -211,7 +211,7 @@ $([System.IO.Directory]::GetParent('%(Identity)').Name) - + diff --git a/src/mono/sample/mbr/browser/WasmDelta.csproj b/src/mono/sample/mbr/browser/WasmDelta.csproj index 322a01ba8595a7..c5b33a4dbecfca 100644 --- a/src/mono/sample/mbr/browser/WasmDelta.csproj +++ b/src/mono/sample/mbr/browser/WasmDelta.csproj @@ -31,7 +31,7 @@ - + \%(_DeltaFileForPublish.Filename)%(_DeltaFileForPublish.Extension) diff --git a/src/mono/sample/wasm/Directory.Build.targets b/src/mono/sample/wasm/Directory.Build.targets index 6a83bb38c13471..6f0f0baa36405e 100644 --- a/src/mono/sample/wasm/Directory.Build.targets +++ b/src/mono/sample/wasm/Directory.Build.targets @@ -1,7 +1,7 @@ - + diff --git a/src/mono/wasm/build/README.md b/src/mono/wasm/build/README.md index 281d1dccb445f8..33a838e173517e 100644 --- a/src/mono/wasm/build/README.md +++ b/src/mono/wasm/build/README.md @@ -12,16 +12,16 @@ various properties before the target `WasmBuildApp` gets executed. to do that. - By default, the `WasmLoadAssembliesAndReferences` task is not run, and -the specified `@(WasmAssembliesToBundle)` are directly passed to +the specified `@(WasmAssembly)` are directly passed to `WasmAppBuilder`. - If the project needs assembly dependencies to be resolved, then set `$(WasmResolveAssembliesBeforeBuild) == true`. - Should you need to run the AOT toolset, ensure `$(RunAOTCompilation) == true` and set `$(WasmAOTDir)` to the directory that you want to AOT. Make sure that both - `@(WasmAssembliesToBundle)` and `$(WasmAOTDir)` are absolute paths. + `@(WasmAssembly)` and `$(WasmAOTDir)` are absolute paths. - Assemblies to be bundled with the app are set via -`@(WasmAssembliesToBundle)` (which optionally will have dependencies +`@(WasmAssembly)` (which optionally will have dependencies resolved) The various task inputs correspond to properties as: @@ -29,7 +29,7 @@ The various task inputs correspond to properties as: ``` AssemblySearchPaths : @(WasmAssemblySearchPaths) - Assemblies : @(WasmAssembliesToBundle) + Assemblies : @(WasmAssembly) AppDir : $(WasmAppDir) MainAssembly : $(WasmMainAssemblyPath) diff --git a/src/mono/wasm/build/WasmApp.targets b/src/mono/wasm/build/WasmApp.targets index 5f08b2ec77b50e..b3d43a92d3324a 100644 --- a/src/mono/wasm/build/WasmApp.targets +++ b/src/mono/wasm/build/WasmApp.targets @@ -8,7 +8,7 @@ @@ -128,22 +128,22 @@ - <_WasmAssemblies Remove="@(_WasmAssemblies)" /> - <_WasmAssemblies Include="@(_WasmStrippedAssemblies)" /> + <_WasmAssemblyInternal Remove="@(_WasmAssemblyInternal)" /> + <_WasmAssemblyInternal Include="@(_WasmStrippedAssemblies)" /> - + - <_WasmAssemblies Remove="@(_WasmAssemblies)" /> - <_WasmAssemblies Include="@(_TmpWasmAssemblies)" /> + <_WasmAssemblyInternal Remove="@(_WasmAssemblyInternal)" /> + <_WasmAssemblyInternal Include="@(_TmpWasmAssembly)" /> @@ -168,7 +168,7 @@ $(MicrosoftNetCoreAppRuntimePackRidDir)\ - <_WasmAssemblies Include="@(WasmAssembliesToBundle)" /> + <_WasmAssemblyInternal Include="@(WasmAssembly)" /> @@ -196,7 +196,7 @@ $(EmccFlags) -DLINK_ICALLS=1 @@ -266,11 +266,11 @@ <_WasmObjects Include="$(_WasmIntermediateOutputPath)pinvoke.o"/> <_WasmObjects Include="$(_WasmIntermediateOutputPath)corebindings.o"/> - <_BitcodeFile Include="%(_WasmAssemblies.LlvmBitcodeFile)" /> + <_BitcodeFile Include="%(_WasmAssemblyInternal.LlvmBitcodeFile)" /> - + <_WasmIncludeDir>$(MicrosoftNetCoreAppRuntimePackRidDir)native/include @@ -284,7 +284,7 @@ - + @@ -357,7 +357,7 @@ EMSCRIPTEN_KEEPALIVE void mono_wasm_load_profiler_aot (const char *desc) { mono_ - + diff --git a/src/mono/wasm/debugger/tests/debugger-test/debugger-test.csproj b/src/mono/wasm/debugger/tests/debugger-test/debugger-test.csproj index 988b3b2e5d9a0d..0dfb171f383ba9 100644 --- a/src/mono/wasm/debugger/tests/debugger-test/debugger-test.csproj +++ b/src/mono/wasm/debugger/tests/debugger-test/debugger-test.csproj @@ -27,7 +27,7 @@ - + diff --git a/src/tests/Common/wasm-test-runner/WasmTestRunner.proj b/src/tests/Common/wasm-test-runner/WasmTestRunner.proj index c28b704c4f3bed..eac97cd0f2c346 100644 --- a/src/tests/Common/wasm-test-runner/WasmTestRunner.proj +++ b/src/tests/Common/wasm-test-runner/WasmTestRunner.proj @@ -25,8 +25,8 @@ - - + + diff --git a/src/tests/FunctionalTests/wasm/Directory.Build.targets b/src/tests/FunctionalTests/wasm/Directory.Build.targets index b0d320fabe3776..ba6525b01a3b22 100644 --- a/src/tests/FunctionalTests/wasm/Directory.Build.targets +++ b/src/tests/FunctionalTests/wasm/Directory.Build.targets @@ -8,7 +8,7 @@ - + From fc78f9178817fc0e98a8d0715fb649f958823092 Mon Sep 17 00:00:00 2001 From: Ankit Jain Date: Fri, 19 Feb 2021 13:35:31 -0500 Subject: [PATCH 3/5] [wasm] don't copy dotnet.* to appbundle unnecessarily This was added earlier to support blazor workload which only uses AOT. But that has since been fixed to correctly use `WasmBuildApp`+`@(WasmNativeAsset)`, so this can be removed. --- src/mono/wasm/build/WasmApp.targets | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/mono/wasm/build/WasmApp.targets b/src/mono/wasm/build/WasmApp.targets index b3d43a92d3324a..7e423ab2c12fc2 100644 --- a/src/mono/wasm/build/WasmApp.targets +++ b/src/mono/wasm/build/WasmApp.targets @@ -291,9 +291,6 @@ - - - From d3b34771b848aece421ebc2f70a4cabc715686e8 Mon Sep 17 00:00:00 2001 From: Ankit Jain Date: Tue, 23 Feb 2021 20:05:17 -0500 Subject: [PATCH 4/5] [wasm] quote file paths in shell invocations This fixes emcc invocations with paths that have spaces (common on windows!). --- src/mono/wasm/build/WasmApp.targets | 36 ++++++++++++++++++----------- 1 file changed, 23 insertions(+), 13 deletions(-) diff --git a/src/mono/wasm/build/WasmApp.targets b/src/mono/wasm/build/WasmApp.targets index 7e423ab2c12fc2..80c96cd1e97da4 100644 --- a/src/mono/wasm/build/WasmApp.targets +++ b/src/mono/wasm/build/WasmApp.targets @@ -125,7 +125,7 @@ - + <_WasmAssemblyInternal Remove="@(_WasmAssemblyInternal)" /> @@ -241,13 +241,15 @@ OutputPath="$(_WasmIntermediateOutputPath)pinvoke-table.h" /> - + $(EmccFlags) -DLINK_ICALLS=1 + <_WasmIncludeDir>$(MicrosoftNetCoreAppRuntimePackRidDir)native/include + <_WasmSrcDir>$(MicrosoftNetCoreAppRuntimePackRidDir)native/src @@ -260,11 +262,18 @@ <_WasmRuntimePackNativeLibs Include="libmono-profiler-aot.a"/> <_WasmRuntimePackNativeLibs Include="libicuuc.a" Condition="'$(InvariantGlobalization)' != 'true'" /> <_WasmRuntimePackNativeLibs Include="libicui18n.a" Condition="'$(InvariantGlobalization)' != 'true'" /> + + <_WasmObjectsToBuild Include="$(_WasmIntermediateOutputPath)driver.o"/> + <_WasmObjectsToBuild Include="$(_WasmIntermediateOutputPath)pinvoke.o"/> + <_WasmObjectsToBuild Include="$(_WasmIntermediateOutputPath)corebindings.o"/> + <_WasmObjects Include="@(_WasmRuntimePackNativeLibs->'$(MicrosoftNetCoreAppRuntimePackRidDir)\native\%(FileName)%(Extension)')" /> + <_WasmObjects Include="@(_WasmObjectsToBuild)" /> - <_WasmObjects Include="$(_WasmIntermediateOutputPath)driver.o"/> - <_WasmObjects Include="$(_WasmIntermediateOutputPath)pinvoke.o"/> - <_WasmObjects Include="$(_WasmIntermediateOutputPath)corebindings.o"/> + <_DotnetJSSrcFile Include="$(_WasmSrcDir)/library_mono.js" /> + <_DotnetJSSrcFile Include="$(_WasmSrcDir)/binding_support.js" /> + <_DotnetJSSrcFile Include="$(_WasmSrcDir)/dotnet_support.js" /> + <_DotnetJSSrcFile Include="$(_WasmSrcDir)/pal_random.js" /> <_BitcodeFile Include="%(_WasmAssemblyInternal.LlvmBitcodeFile)" /> @@ -273,19 +282,20 @@ Text="Bug: Number of assemblies doesn't match the number of generated bitcode files. BitcodeFiles: @(_BitcodeFile->Count()) vs Assemblies: @(_WasmAssemblyInternal->Count())" /> - <_WasmIncludeDir>$(MicrosoftNetCoreAppRuntimePackRidDir)native/include - <_WasmSrcDir>$(MicrosoftNetCoreAppRuntimePackRidDir)native/src - $(EmccFlags) -DCORE_BINDINGS -DGEN_PINVOKE=1 -I$(_WasmIntermediateOutputPath) -I$(_WasmIncludeDir)/mono-2.0 -I$(_WasmIncludeDir)/wasm + $(EmccFlags) -g -DCORE_BINDINGS -DGEN_PINVOKE=1 "-I$(_WasmIncludeDir)/mono-2.0" "-I$(_WasmIncludeDir)/wasm" + + + $(EmccCFlags) "-I$(_WasmIntermediateOutputPath)"" + $(EmccCFlags) "-I$(_WasmIntermediateOutputPath)" + $(EmccFlags) -s TOTAL_MEMORY=536870912 <_WasmOptCommand>$([MSBuild]::NormalizePath('$(EMSDK_PATH)', 'upstream', 'bin', 'wasm-opt$(_ExeExt)')) - - - - - + + + From ea6692c204bbdaa42ac189cadd201a780d93691e Mon Sep 17 00:00:00 2001 From: Ankit Jain Date: Wed, 24 Feb 2021 17:27:48 -0500 Subject: [PATCH 5/5] Update src/mono/wasm/build/WasmApp.targets Co-authored-by: Pranav K --- 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 80c96cd1e97da4..266357d29b6326 100644 --- a/src/mono/wasm/build/WasmApp.targets +++ b/src/mono/wasm/build/WasmApp.targets @@ -292,7 +292,7 @@ <_WasmOptCommand>$([MSBuild]::NormalizePath('$(EMSDK_PATH)', 'upstream', 'bin', 'wasm-opt$(_ExeExt)')) - +