diff --git a/src/mono/wasm/build/WasmApp.InTree.props b/src/mono/wasm/build/WasmApp.InTree.props
index f9540f1fac7a2b..87bcc072cf1ddc 100644
--- a/src/mono/wasm/build/WasmApp.InTree.props
+++ b/src/mono/wasm/build/WasmApp.InTree.props
@@ -6,8 +6,8 @@
AnyCPU
false
$(NetCoreAppToolCurrent)
- $(ArtifactsBinDir)microsoft.netcore.app.runtime.browser-wasm\$(Configuration)\runtimes\browser-wasm\
- $(MonoProjectRoot)wasm\emsdk
+ $([MSBuild]::NormalizeDirectory($(ArtifactsBinDir), 'microsoft.netcore.app.runtime.browser-wasm', $(Configuration), 'runtimes', 'browser-wasm'))
+ $([MSBuild]::NormalizeDirectory($(MonoProjectRoot), 'wasm', 'emsdk'))
false
true
diff --git a/src/mono/wasm/build/WasmApp.InTree.targets b/src/mono/wasm/build/WasmApp.InTree.targets
index d7009c76275d2c..cde8075f0874c5 100644
--- a/src/mono/wasm/build/WasmApp.InTree.targets
+++ b/src/mono/wasm/build/WasmApp.InTree.targets
@@ -8,7 +8,7 @@
- $(ArtifactsBinDir)microsoft.netcore.app.runtime.browser-wasm\$(Configuration)
+ $([MSBuild]::NormalizeDirectory($(ArtifactsBinDir), 'microsoft.netcore.app.runtime.browser-wasm', $(Configuration)))
@@ -16,7 +16,7 @@
-
+
$(TargetOS).AnyCPU.$(Configuration)
- $(ArtifactsDir)helix/
- $(HelixArchiveRoot)runonly/
- $(HelixArchiveRunOnlyRoot)$(OSPlatformConfig)/$(WasmHelixTestAppRelativeDir)/
+ $([MSBuild]::NormalizeDirectory($(ArtifactsDir), 'helix'))
+ $([MSBuild]::NormalizeDirectory($(HelixArchiveRoot), 'runonly'))
+ $([MSBuild]::NormalizeDirectory($(HelixArchiveRunOnlyRoot), $(OSPlatformConfig), $(WasmHelixTestAppRelativeDir)))
$(OutputPath)$(AssemblyName).zip
diff --git a/src/mono/wasm/build/WasmApp.LocalBuild.props b/src/mono/wasm/build/WasmApp.LocalBuild.props
index a56d7137dac890..f0b08f1f62bea6 100644
--- a/src/mono/wasm/build/WasmApp.LocalBuild.props
+++ b/src/mono/wasm/build/WasmApp.LocalBuild.props
@@ -29,7 +29,7 @@
$(RuntimeSrcDir)\artifacts\bin\
$(RuntimeSrcDir)\src\mono\wasm\emsdk\
- $(ArtifactsBinDir)microsoft.netcore.app.runtime.browser-wasm\$(RuntimeConfig)\
+ $([MSBuild]::NormalizeDirectory($(ArtifactsBinDir), 'microsoft.netcore.app.runtime.browser-wasm', $(RuntimeConfig)))
$([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'WasmAppBuilder', 'Debug', '$(_NetCoreAppToolCurrent)', 'publish'))
$([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'WasmBuildTasks', 'Debug', '$(_NetCoreAppToolCurrent)', 'publish'))
@@ -39,19 +39,20 @@
$(WasmBuildSupportDir)\
- $(BuildBaseDir)microsoft.netcore.app.runtime.browser-wasm\
- $(BuildBaseDir)\MonoAOTCompiler\
- $(BuildBaseDir)\WasmAppBuilder\
- $(BuildBaseDir)\WasmBuildTasks\
+ $([MSBuild]::NormalizeDirectory($(BuildBaseDir), 'microsoft.netcore.app.runtime.browser-wasm'))
+ $([MSBuild]::NormalizeDirectory($(BuildBaseDir), 'MonoAOTCompiler'))
+ $([MSBuild]::NormalizeDirectory($(BuildBaseDir), 'WasmAppBuilder'))
+ $([MSBuild]::NormalizeDirectory($(BuildBaseDir), 'WasmBuildTasks'))
- $(MicrosoftNetCoreAppRuntimePackLocationToUse)runtimes\browser-wasm\
- $(MicrosoftNetCoreAppRuntimePackRidDir)native\cross\$(RuntimeIdentifier)\mono-aot-cross
+ $([MSBuild]::NormalizeDirectory($(MicrosoftNetCoreAppRuntimePackLocationToUse), 'runtimes', 'browser-wasm'))
+ $([MSBuild]::NormalizePath($(MicrosoftNetCoreAppRuntimePackRidDir), 'native', 'cross', $(RuntimeIdentifier), 'mono-aot-cross'))
$(MonoAotCrossCompilerPath).exe
$([MSBuild]::NormalizePath('$(WasmAppBuilderDir)', 'WasmAppBuilder.dll'))
$([MSBuild]::NormalizePath('$(WasmBuildTasksDir)', 'WasmBuildTasks.dll'))
$([MSBuild]::NormalizePath('$(MonoAOTCompilerDir)', 'MonoAOTCompiler.dll'))
+
diff --git a/src/mono/wasm/build/WasmApp.LocalBuild.targets b/src/mono/wasm/build/WasmApp.LocalBuild.targets
index cc2c752a730f1f..9fdf8de6739bc2 100644
--- a/src/mono/wasm/build/WasmApp.LocalBuild.targets
+++ b/src/mono/wasm/build/WasmApp.LocalBuild.targets
@@ -58,6 +58,16 @@
+
+ $([MSBuild]::NormalizeDirectory($(MicrosoftNetCoreAppRuntimePackLocationToUse), 'runtimes', 'browser-wasm'))
+ $([MSBuild]::NormalizePath($(MicrosoftNetCoreAppRuntimePackRidDir), 'native', 'cross', $(RuntimeIdentifier), 'mono-aot-cross'))
+ $(MonoAotCrossCompilerPath).exe
+
+ $([MSBuild]::NormalizePath('$(WasmAppBuilderDir)', 'WasmAppBuilder.dll'))
+ $([MSBuild]::NormalizePath('$(WasmBuildTasksDir)', 'WasmBuildTasks.dll'))
+ $([MSBuild]::NormalizePath('$(MonoAOTCompilerDir)', 'MonoAOTCompiler.dll'))
+
+
diff --git a/src/mono/wasm/build/WasmApp.targets b/src/mono/wasm/build/WasmApp.targets
index 21f15e8fc427c4..34732b71be2dc4 100644
--- a/src/mono/wasm/build/WasmApp.targets
+++ b/src/mono/wasm/build/WasmApp.targets
@@ -9,6 +9,9 @@
Required public items/properties:
- $(WasmMainJSPath)
- @(WasmAssembliesToBundle) - list of assemblies to package as the wasm app
+ - %(_InternalForceInterpret) metadata - if true, then skips this assembly from the AOT step.
+ Error for this to be set with AOTMode=LLVMOnly
+
- $(EMSDK_PATH) - points to the emscripten sdk location.
Public properties (optional):
@@ -19,9 +22,11 @@
- $(WasmLinkIcalls) - Whenever to link out unused icalls. Defaults to $(WasmBuildNative).
- $(RunAOTCompilation) - Defaults to false.
- $(WasmDebugLevel)
+ - $(WasmNativeDebugSymbols) - Build with native debug symbols, useful only with `$(RunAOTCompilation)`, or `$(WasmBuildNative)`
+ Defaults to true.
- $(WasmProfilers) - Profilers to use
- - $(AOTMode) - Defaults to `LLVMOnly`
+ - $(AOTMode) - Defaults to `AotInterp`
- $(AOTProfilePath) - profile data file to be used for profile-guided optimization
- $(InvariantGlobalization) - Whenever to disable ICU. Defaults to false.
@@ -35,7 +40,7 @@
packaging, or app bundle generation, eg. Blazor.
- $(WasmStripAOTAssemblies) - Whether to run `mono-cil-strip` on the assemblies.
- Defaults to true
+ Always set to false!
- $(WasmBuildAppAfterThisTarget) - This target is used as `AfterTargets` for `WasmBuildApp. this
is what triggers the wasm app building. Defaults to `Publish`.
@@ -69,7 +74,7 @@
-
+
@@ -80,22 +85,27 @@
- <_AotInputAssemblies Include="@(_WasmAssemblies->Distinct())">
+ <_AotInputAssemblies Include="@(_WasmAssembliesInternal)" Condition="'%(_WasmAssembliesInternal._InternalForceInterpret)' != 'true'">
@(MonoAOTCompilerDefaultAotArguments, ';')
@(MonoAOTCompilerDefaultProcessArguments, ';')
+ <_AOT_InternalForceInterpretAssemblies Include="@(_WasmAssembliesInternal->WithMetadataValue('_InternalForceInterpret', 'true'))" />
- <_WasmAssemblies Remove="@(_WasmAssemblies)" />
+ <_WasmAssembliesInternal Remove="@(_WasmAssembliesInternal)" />
- <_WasmAOTSearchPaths Include="$(MicrosoftNetCoreAppRuntimePackRidDir)\native" />
+ <_WasmAOTSearchPaths Include="$(MicrosoftNetCoreAppRuntimePackRidNativeDir)" />
<_WasmAOTSearchPaths Include="$(MicrosoftNetCoreAppRuntimePackRidDir)\lib\net6.0" />
- AotInterp
- LLVMOnly
+
+ AotInterp
+
+
+
-
+
+
+
+
+ <_WasmAssembliesInternal Include="@(_AOT_InternalForceInterpretAssemblies)" />
+
- <_WasmStrippedAssembliesPath>$([System.IO.Path]::GetFullPath('$(_WasmIntermediateOutputPath)\stripped-assemblies\'))
+ <_WasmStrippedAssembliesPath>$([MSBuild]::NormalizeDirectory($(_WasmIntermediateOutputPath), 'stripped-assemblies'))
- <_WasmStrippedAssemblies Include="@(_WasmAssemblies->'$(_WasmStrippedAssembliesPath)\%(FileName)%(Extension)')" OriginalPath="%(_WasmAssemblies.Identity)" />
+ <_WasmStrippedAssemblies
+ Condition="'%(_WasmAssembliesInternal._InternalForceInterpret)' != 'true'"
+ Include="@(_WasmAssembliesInternal->'$(_WasmStrippedAssembliesPath)%(FileName)%(Extension)')"
+ OriginalPath="%(_WasmAssembliesInternal.Identity)" />
+ <_WasmInterpOnlyAssembly Include="@(_WasmAssembliesInternal->WithMetadataValue('_InternalForceInterpret', 'true'))" />
-
+
- <_WasmAssemblies Remove="@(_WasmAssemblies)" />
- <_WasmAssemblies Include="@(_WasmStrippedAssemblies)" />
+ <_WasmAssembliesInternal Remove="@(_WasmAssembliesInternal)" />
+ <_WasmAssembliesInternal Include="@(_WasmStrippedAssemblies);@(_WasmInterpOnlyAssembly)" />
- <_WasmAssemblies Remove="@(_WasmAssemblies)" />
- <_WasmAssemblies Include="@(_TmpWasmAssemblies)" />
+ <_WasmAssembliesInternal Remove="@(_WasmAssembliesInternal)" />
+ <_WasmAssembliesInternal Include="@(_TmpWasmAssemblies)" />
+
true
false
true
+ true
$(OutputPath)AppBundle\
$(TargetFileName)
- $(MicrosoftNetCoreAppRuntimePackRidDir)native\cross\$(PackageRID)\mono-aot-cross$(_ExeExt)
+
+ $([MSBuild]::NormalizeDirectory($(MicrosoftNetCoreAppRuntimePackRidDir), 'native'))
+ $([MSBuild]::NormalizePath($(MicrosoftNetCoreAppRuntimePackRidNativeDir), 'cross', $(PackageRID), 'mono-aot-cross$(_ExeExt)'))
+ $([MSBuild]::EnsureTrailingSlash($(MicrosoftNetCoreAppRuntimePackRidDir)))
- <_WasmIntermediateOutputPath>$([System.IO.Path]::GetFullPath('$(IntermediateOutputPath)\wasm\'))
+ <_WasmIntermediateOutputPath>$([MSBuild]::NormalizeDirectory($(IntermediateOutputPath), 'wasm'))
- $(MicrosoftNetCoreAppRuntimePackRidDir)\
+ $([MSBuild]::NormalizeDirectory($(MicrosoftNetCoreAppRuntimePackRidDir)))
- <_WasmAssemblies Include="@(WasmAssembliesToBundle)" />
+ <_WasmAssembliesInternal Include="@(WasmAssembliesToBundle->Distinct())" />
@@ -189,17 +213,17 @@
-
-
+
+
-
-
+
+
+
+
- $(MicrosoftNetCoreAppRuntimePackRidDir)native\src\emcc-flags.txt
+ $([MSBuild]::NormalizePath($(MicrosoftNetCoreAppRuntimePackRidNativeDir), 'src', 'emcc-flags.txt'))
true
$(WasmBuildNative)
@@ -241,17 +267,19 @@
-
+
+ RuntimeIcallTableFile="$(_WasmIntermediateOutputPath)runtime-icall-table.h"
+ Assemblies="@(_WasmAssembliesInternal)"
+ OutputPath="$(_WasmIntermediateOutputPath)icall-table.h" />
$(EmccFlags) -DLINK_ICALLS=1
+ <_WasmIncludeDir>$([MSBuild]::NormalizeDirectory($(MicrosoftNetCoreAppRuntimePackRidNativeDir), 'include'))
+ <_WasmSrcDir>$([MSBuild]::NormalizeDirectory($(MicrosoftNetCoreAppRuntimePackRidNativeDir), 'src'))
@@ -262,45 +290,56 @@
<_WasmRuntimePackNativeLibs Include="libSystem.Native.a"/>
<_WasmRuntimePackNativeLibs Include="libSystem.IO.Compression.Native.a"/>
<_WasmRuntimePackNativeLibs Include="libmono-profiler-aot.a"/>
-
<_WasmRuntimePackNativeLibs Include="libicuuc.a" />
<_WasmRuntimePackNativeLibs Include="libicui18n.a" />
<_WasmObjects Include="@(_WasmRuntimePackNativeLibs->'$(MicrosoftNetCoreAppRuntimePackRidDir)\native\%(FileName)%(Extension)')" />
- <_WasmObjects Include="$(_WasmIntermediateOutputPath)driver.o"/>
- <_WasmObjects Include="$(_WasmIntermediateOutputPath)pinvoke.o"/>
- <_WasmObjects Include="$(_WasmIntermediateOutputPath)corebindings.o"/>
- <_BitcodeFile Include="%(_WasmAssemblies.LlvmBitcodeFile)" />
+ <_WasmObjectsToBuild Include="$(_WasmIntermediateOutputPath)driver.o"/>
+ <_WasmObjectsToBuild Include="$(_WasmIntermediateOutputPath)pinvoke.o"/>
+ <_WasmObjectsToBuild Include="$(_WasmIntermediateOutputPath)corebindings.o"/>
+ <_WasmObjectsToBuild SourcePath="$(_WasmSrcDir)%(FileName).c" />
+
+ <_WasmObjects Include="@(_WasmRuntimePackNativeLibs->'$(MicrosoftNetCoreAppRuntimePackRidNativeDir)%(FileName)%(Extension)')" />
+ <_WasmObjects Include="@(_WasmObjectsToBuild)" />
+
+ <_DotnetJSSrcFile Include="$(_WasmSrcDir)library_mono.js" />
+ <_DotnetJSSrcFile Include="$(_WasmSrcDir)binding_support.js" />
+ <_DotnetJSSrcFile Include="$(_WasmSrcDir)dotnet_support.js" />
+ <_DotnetJSSrcFile Include="$(_WasmSrcDir)pal_random.js" />
+
+ <_AOTAssemblies Include="@(_WasmAssembliesInternal)" Condition="'%(_WasmAssembliesInternal._InternalForceInterpret)' != 'true'" />
+ <_BitcodeFile Include="%(_WasmAssembliesInternal.LlvmBitcodeFile)" />
-
+
- <_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) -DCORE_BINDINGS -DGEN_PINVOKE=1 "-I$(_WasmIncludeDir)mono-2.0" "-I$(_WasmIncludeDir)wasm"
+ $(EmccCFlags) -g
+
+
+ $(EmccCFlags) "-I$(_WasmIntermediateOutputPath)."
+ $(EmccCFlags) "-I$(_WasmIntermediateOutputPath)"
+
$(EmccFlags) -s TOTAL_MEMORY=536870912
<_WasmOptCommand>$([MSBuild]::NormalizePath('$(EMSDK_PATH)', 'upstream', 'bin', 'wasm-opt$(_ExeExt)'))
-
-
-
-
-
+
+
+
+
-
-
+
+
-
-
-
@@ -342,7 +381,7 @@ EMSCRIPTEN_KEEPALIVE void mono_wasm_load_profiler_aot (const char *desc) { mono_
-
+
@@ -364,7 +403,13 @@ EMSCRIPTEN_KEEPALIVE void mono_wasm_load_profiler_aot (const char *desc) { mono_
-
+
+
+
+
diff --git a/src/tasks/AotCompilerTask/MonoAOTCompiler.cs b/src/tasks/AotCompilerTask/MonoAOTCompiler.cs
index f540896e101fc8..d7a7ab69674893 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");
@@ -350,7 +350,7 @@ private bool PrecompileLibrary(ITaskItem assemblyItem, string? monoPaths)
// values, which wont work.
processArgs.Add($"\"--aot={string.Join(",", aotArgs)}\"");
- processArgs.Add(assemblyFilename);
+ processArgs.Add($"\"{assemblyFilename}\"");
var envVariables = new Dictionary
{
@@ -361,7 +361,8 @@ private bool PrecompileLibrary(ITaskItem assemblyItem, string? monoPaths)
try
{
// run the AOT compiler
- Utils.RunProcess(CompilerBinaryPath, string.Join(" ", processArgs), envVariables, assemblyDir, silent: false, outputMessageImportance: MessageImportance.Low);
+ Utils.RunProcess(CompilerBinaryPath, string.Join(" ", processArgs), envVariables, assemblyDir, silent: false,
+ outputMessageImportance: MessageImportance.Low, debugMessageImportance: MessageImportance.Low);
}
catch (Exception ex)
{
diff --git a/src/tasks/Common/Utils.cs b/src/tasks/Common/Utils.cs
index 6ed889a483b7bf..0adc13170b7e09 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 debugMessageImportance=MessageImportance.High)
{
- LogInfo($"Running: {path} {args}");
+ LogInfo($"Running: {path} {args}", debugMessageImportance);
var outputBuilder = new StringBuilder();
var errorBuilder = new StringBuilder();
var processStartInfo = new ProcessStartInfo
@@ -46,7 +47,7 @@ public static string RunProcess(
if (workingDir != null)
processStartInfo.WorkingDirectory = workingDir;
- LogInfo($"Using working directory: {workingDir ?? Environment.CurrentDirectory}", MessageImportance.Low);
+ LogInfo($"Using working directory: {workingDir ?? Environment.CurrentDirectory}", debugMessageImportance);
if (envVars != null)
{