diff --git a/Directory.Build.props b/Directory.Build.props
index 2a5cd307f5262b..ab7ccdb43bccf6 100644
--- a/Directory.Build.props
+++ b/Directory.Build.props
@@ -183,6 +183,7 @@
$(WASMTIME_PATH)
$([MSBuild]::NormalizeDirectory($(ArtifactsObjDir), 'wasmtime'))
true
+ $([MSBuild]::NormalizeDirectory($(MonoProjectRoot), 'wasm', 'build'))
@@ -331,7 +332,7 @@
true
-
+
false
diff --git a/eng/testing/scenarios/BuildWasiAppsJobsList.txt b/eng/testing/scenarios/BuildWasiAppsJobsList.txt
index 8f031650e8d5db..b68f7fe3d30ed0 100644
--- a/eng/testing/scenarios/BuildWasiAppsJobsList.txt
+++ b/eng/testing/scenarios/BuildWasiAppsJobsList.txt
@@ -1,2 +1,5 @@
Wasi.Build.Tests.InvariantTests
-Wasi.Build.Tests.WasiTemplateTests
\ No newline at end of file
+Wasi.Build.Tests.ILStripTests
+Wasi.Build.Tests.SdkMissingTests
+Wasi.Build.Tests.RuntimeConfigTests
+Wasi.Build.Tests.WasiTemplateTests
diff --git a/eng/testing/tests.wasm.targets b/eng/testing/tests.wasm.targets
index c2e10e9e977883..dd0a572c953133 100644
--- a/eng/testing/tests.wasm.targets
+++ b/eng/testing/tests.wasm.targets
@@ -109,6 +109,8 @@
+
+
diff --git a/src/libraries/sendtohelix-wasi.targets b/src/libraries/sendtohelix-wasi.targets
index c5c4f2c064e8e6..db341ab28cd91d 100644
--- a/src/libraries/sendtohelix-wasi.targets
+++ b/src/libraries/sendtohelix-wasi.targets
@@ -47,7 +47,8 @@
false
$(RepoRoot)src\mono\wasi\wasi-sdk\
- $([MSBuild]::NormalizeDirectory('$(RepoRoot)', 'src', 'mono', 'wasi', 'build'))
+ $([MSBuild]::NormalizeDirectory('$(RepoRoot)', 'src', 'mono', 'wasi', 'build'))
+ $([MSBuild]::NormalizeDirectory('$(RepoRoot)', 'src', 'mono', 'wasm', 'build'))
$([MSBuild]::NormalizeDirectory('$(RepoRoot)', 'src', 'mono', 'wasm', 'shared'))
$(HelixDependenciesStagingPath)\wasi-sdk
$(HelixDependenciesStagingPath)\wasmtime
@@ -123,6 +124,7 @@
+
diff --git a/src/mono/nuget/Microsoft.NET.Runtime.WebAssembly.Sdk/Microsoft.NET.Runtime.WebAssembly.Sdk.pkgproj b/src/mono/nuget/Microsoft.NET.Runtime.WebAssembly.Sdk/Microsoft.NET.Runtime.WebAssembly.Sdk.pkgproj
index 55c5c211b895e7..39be924260c184 100644
--- a/src/mono/nuget/Microsoft.NET.Runtime.WebAssembly.Sdk/Microsoft.NET.Runtime.WebAssembly.Sdk.pkgproj
+++ b/src/mono/nuget/Microsoft.NET.Runtime.WebAssembly.Sdk/Microsoft.NET.Runtime.WebAssembly.Sdk.pkgproj
@@ -14,9 +14,13 @@
+
-
+
+
+
+
diff --git a/src/mono/nuget/Microsoft.NET.Runtime.WebAssembly.Wasi.Sdk/Microsoft.NET.Runtime.WebAssembly.Wasi.Sdk.pkgproj b/src/mono/nuget/Microsoft.NET.Runtime.WebAssembly.Wasi.Sdk/Microsoft.NET.Runtime.WebAssembly.Wasi.Sdk.pkgproj
index 4ee4946f36d6b6..df4dab00016a98 100644
--- a/src/mono/nuget/Microsoft.NET.Runtime.WebAssembly.Wasi.Sdk/Microsoft.NET.Runtime.WebAssembly.Wasi.Sdk.pkgproj
+++ b/src/mono/nuget/Microsoft.NET.Runtime.WebAssembly.Wasi.Sdk/Microsoft.NET.Runtime.WebAssembly.Wasi.Sdk.pkgproj
@@ -14,7 +14,10 @@
-
+
+
+
+
diff --git a/src/mono/wasi/Wasi.Build.Tests/BuildTestBase.cs b/src/mono/wasi/Wasi.Build.Tests/BuildTestBase.cs
index 95d2e10b67739a..993e5995448b45 100644
--- a/src/mono/wasi/Wasi.Build.Tests/BuildTestBase.cs
+++ b/src/mono/wasi/Wasi.Build.Tests/BuildTestBase.cs
@@ -93,7 +93,7 @@ public BuildTestBase(ITestOutputHelper output, SharedBuildPerTestClassFixture bu
{
_testIdx = Interlocked.Increment(ref s_testCounter);
_buildContext = buildContext;
- _testOutput = output;
+ _testOutput = new TestOutputWrapper(output);
_logPath = s_buildEnv.LogRootPath; // FIXME:
}
@@ -603,8 +603,6 @@ void LogData(string label, string? message)
}
outputBuilder.AppendLine($"{label} {message}");
}
- if (EnvironmentVariables.ShowBuildOutput)
- Console.WriteLine($"{label} {message}");
}
}
@@ -703,6 +701,7 @@ public static int Main()
.MultiplyWithSingleArgs(true, false) /*propertyValue*/
.MultiplyWithSingleArgs(true, false) /*aot*/
.UnwrapItemsAsArrays();
+
protected CommandResult RunWithoutBuild(string config, string id)
{
string runArgs = $"run --no-build -c {config}";
@@ -721,7 +720,7 @@ protected CommandResult RunWithoutBuild(string config, string id)
return res;
}
}
-
+
public record BuildArgs(string ProjectName,
string Config,
bool AOT,
diff --git a/src/mono/wasi/Wasi.Build.Tests/ILStripTests.cs b/src/mono/wasi/Wasi.Build.Tests/ILStripTests.cs
new file mode 100644
index 00000000000000..6ad8b4c0096c2b
--- /dev/null
+++ b/src/mono/wasi/Wasi.Build.Tests/ILStripTests.cs
@@ -0,0 +1,128 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+
+using System.IO;
+using Xunit;
+using Xunit.Abstractions;
+using Wasm.Build.Tests;
+
+#nullable enable
+
+namespace Wasi.Build.Tests;
+
+public class ILStripTests : BuildTestBase
+{
+ public ILStripTests(ITestOutputHelper output, SharedBuildPerTestClassFixture buildContext)
+ : base(output, buildContext)
+ {
+ }
+
+ [Theory]
+ [InlineData("", /*expectILStripping*/ true, /*singleFileBundle*/false)] // Default case
+ [InlineData("", /*expectILStripping*/ true, /*singleFileBundle*/true)] // Default case
+ [InlineData("false", /*expectILStripping*/ false, /*singleFileBundle*/false)] // the opposite of the default case
+ [InlineData("false", /*expectILStripping*/ false, /*singleFileBundle*/true)] // the opposite of the default case
+ public void WasmStripILAfterAOT_TestDefaultAndOverride(string stripILAfterAOT, bool expectILStripping, bool singleFileBundle)
+ {
+ string config = "Release";
+ string id = $"{config}_{GetRandomId()}";
+ string projectFile = CreateWasmTemplateProject(id, "wasiconsole");
+ string projectName = Path.GetFileNameWithoutExtension(projectFile);
+
+ string extraProperties = "true";
+ if (singleFileBundle)
+ extraProperties += "true";
+ if (!string.IsNullOrEmpty(stripILAfterAOT))
+ extraProperties += $"{stripILAfterAOT}";
+ AddItemsPropertiesToProject(projectFile, extraProperties);
+
+ var buildArgs = new BuildArgs(projectName, config, AOT: true, ProjectFileContents: id, ExtraBuildArgs: null);
+ buildArgs = ExpandBuildArgs(buildArgs);
+
+ BuildProject(buildArgs,
+ id: id,
+ new BuildProjectOptions(
+ DotnetWasmFromRuntimePack: false,
+ CreateProject: false,
+ Publish: true,
+ TargetFramework: BuildTestBase.DefaultTargetFramework,
+ UseCache: false));
+
+ string runArgs = $"run --no-silent --no-build -c {config}";
+ new RunCommand(s_buildEnv, _testOutput, label: id)
+ .WithWorkingDirectory(_projectDir!)
+ .ExecuteWithCapturedOutput(runArgs)
+ .EnsureSuccessful();
+
+ string frameworkDir = singleFileBundle ? "" : Path.Combine(_projectDir!, "bin", config, DefaultTargetFramework, "wasi-wasm", "AppBundle", "managed");
+ string objBuildDir = Path.Combine(_projectDir!, "obj", config, DefaultTargetFramework, "wasi-wasm", "wasm", "for-publish");
+ TestWasmStripILAfterAOTOutput(objBuildDir, frameworkDir, expectILStripping, singleFileBundle, _testOutput);
+ }
+
+ private static void TestWasmStripILAfterAOTOutput(string objBuildDir, string appBundleFrameworkDir, bool expectILStripping, bool singleFileBundle, ITestOutputHelper testOutput)
+ {
+ string origAssemblyDir = Path.Combine(objBuildDir, "aot-in");
+ string strippedAssemblyDir = Path.Combine(objBuildDir, "stripped");
+ Assert.True(Directory.Exists(origAssemblyDir), $"Could not find the original AOT input assemblies dir: {origAssemblyDir}");
+ if (expectILStripping)
+ Assert.True(Directory.Exists(strippedAssemblyDir), $"Could not find the stripped assemblies dir: {strippedAssemblyDir}");
+ else
+ Assert.False(Directory.Exists(strippedAssemblyDir), $"Expected {strippedAssemblyDir} to not exist");
+
+ string assemblyToExamine = "System.Private.CoreLib.dll";
+ string originalAssembly = Path.Combine(objBuildDir, origAssemblyDir, assemblyToExamine);
+ string strippedAssembly = Path.Combine(objBuildDir, strippedAssemblyDir, assemblyToExamine);
+ string includedAssembly = Path.Combine(appBundleFrameworkDir, assemblyToExamine);
+
+ Assert.True(File.Exists(originalAssembly), $"Expected {nameof(originalAssembly)} {originalAssembly} to exist");
+ if (!singleFileBundle)
+ Assert.True(File.Exists(includedAssembly), $"Expected {nameof(includedAssembly)} {includedAssembly} to exist");
+ if (expectILStripping)
+ Assert.True(File.Exists(strippedAssembly), $"Expected {nameof(strippedAssembly)} {strippedAssembly} to exist");
+ else
+ Assert.False(File.Exists(strippedAssembly), $"Expected {strippedAssembly} to not exist");
+
+ string compressedOriginalAssembly = Utils.GZipCompress(originalAssembly);
+ string? compressedIncludedAssembly = null;
+ FileInfo compressedOriginalAssembly_fi = new FileInfo(compressedOriginalAssembly);
+ FileInfo? compressedincludedAssembly_fi = null;
+
+ testOutput.WriteLine ($"compressedOriginalAssembly_fi: {compressedOriginalAssembly_fi.Length}, {compressedOriginalAssembly}");
+ if (!singleFileBundle)
+ {
+ compressedIncludedAssembly = Utils.GZipCompress(includedAssembly)!;
+ compressedincludedAssembly_fi = new FileInfo(compressedIncludedAssembly);
+ testOutput.WriteLine ($"compressedincludedAssembly_fi: {compressedincludedAssembly_fi.Length}, {compressedIncludedAssembly}");
+ }
+
+ if (expectILStripping)
+ {
+ string compressedStrippedAssembly = Utils.GZipCompress(strippedAssembly);
+ FileInfo compressedStrippedAssembly_fi = new FileInfo(compressedStrippedAssembly);
+ testOutput.WriteLine ($"compressedStrippedAssembly_fi: {compressedStrippedAssembly_fi.Length}, {compressedStrippedAssembly}");
+
+ // original > stripped assembly
+ Assert.True(compressedOriginalAssembly_fi.Length > compressedStrippedAssembly_fi.Length,
+ $"Expected original assembly ({compressedOriginalAssembly}) size ({compressedOriginalAssembly_fi.Length}) " +
+ $"to be bigger than the stripped assembly ({compressedStrippedAssembly}) size ({compressedStrippedAssembly_fi.Length})");
+
+ if (!singleFileBundle)
+ {
+ // included == stripped assembly
+ Assert.True(compressedincludedAssembly_fi!.Length == compressedStrippedAssembly_fi.Length,
+ $"Expected included assembly ({compressedIncludedAssembly}) size ({compressedincludedAssembly_fi.Length}) " +
+ $"to be the same as the stripped assembly ({compressedStrippedAssembly}) size ({compressedStrippedAssembly_fi.Length})");
+ }
+ }
+ else
+ {
+ if (!singleFileBundle)
+ {
+ // original == included assembly
+ Assert.True(compressedincludedAssembly_fi!.Length == compressedOriginalAssembly_fi.Length,
+ $"Expected included assembly ({compressedIncludedAssembly}) size ({compressedincludedAssembly_fi.Length}) " +
+ $"to be the same as the original assembly ({compressedOriginalAssembly}) size ({compressedOriginalAssembly_fi.Length})");
+ }
+ }
+ }
+}
diff --git a/src/mono/wasi/Wasi.Build.Tests/InvariantTests.cs b/src/mono/wasi/Wasi.Build.Tests/InvariantTests.cs
index 6ad05de3de6669..a7a2785e65bfdd 100644
--- a/src/mono/wasi/Wasi.Build.Tests/InvariantTests.cs
+++ b/src/mono/wasi/Wasi.Build.Tests/InvariantTests.cs
@@ -3,10 +3,8 @@
using System;
using System.IO;
-using System.Runtime.InteropServices;
using Xunit;
using Xunit.Abstractions;
-using Xunit.Sdk;
using Wasm.Build.Tests;
#nullable enable
diff --git a/src/mono/wasi/Wasi.Build.Tests/RuntimeConfigTests.cs b/src/mono/wasi/Wasi.Build.Tests/RuntimeConfigTests.cs
new file mode 100644
index 00000000000000..dd703f8fc6a1ce
--- /dev/null
+++ b/src/mono/wasi/Wasi.Build.Tests/RuntimeConfigTests.cs
@@ -0,0 +1,52 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+
+using System.IO;
+using Xunit;
+using Xunit.Abstractions;
+using Wasm.Build.Tests;
+
+#nullable enable
+
+namespace Wasi.Build.Tests;
+
+public class RuntimeConfigTests : BuildTestBase
+{
+ public RuntimeConfigTests(ITestOutputHelper output, SharedBuildPerTestClassFixture buildContext)
+ : base(output, buildContext)
+ {
+ }
+
+ [Theory]
+ [ActiveIssue("https://github.com/dotnet/runtime/issues/95345")]
+ [InlineData(false)]
+ [InlineData(true)]
+ public void MissingRuntimeConfigTemplateJson(bool singleFileBundle)
+ {
+ string config = "Release";
+ string id = $"{config}_{GetRandomId()}";
+ string projectFile = CreateWasmTemplateProject(id, "wasiconsole");
+ string projectName = Path.GetFileNameWithoutExtension(projectFile);
+
+ File.Delete(Path.Combine(_projectDir!, "runtimeconfig.template.json"));
+
+ var buildArgs = new BuildArgs(projectName, config, AOT: true, ProjectFileContents: id, ExtraBuildArgs: null);
+ buildArgs = ExpandBuildArgs(buildArgs);
+ AddItemsPropertiesToProject(projectFile, singleFileBundle ? "true" : "");
+
+ BuildProject(buildArgs,
+ id: id,
+ new BuildProjectOptions(
+ DotnetWasmFromRuntimePack: false,
+ CreateProject: false,
+ Publish: true,
+ TargetFramework: BuildTestBase.DefaultTargetFramework,
+ UseCache: false));
+
+ string runArgs = $"run --no-silent --no-build -c {config}";
+ new RunCommand(s_buildEnv, _testOutput, label: id)
+ .WithWorkingDirectory(_projectDir!)
+ .ExecuteWithCapturedOutput(runArgs)
+ .EnsureSuccessful();
+ }
+}
diff --git a/src/mono/wasi/Wasi.Build.Tests/SdkMissingTests.cs b/src/mono/wasi/Wasi.Build.Tests/SdkMissingTests.cs
new file mode 100644
index 00000000000000..580754663c12cb
--- /dev/null
+++ b/src/mono/wasi/Wasi.Build.Tests/SdkMissingTests.cs
@@ -0,0 +1,82 @@
+// 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.IO;
+using System.Runtime.InteropServices;
+using Xunit;
+using Xunit.Abstractions;
+using Xunit.Sdk;
+using Wasm.Build.Tests;
+using System.Collections.Generic;
+
+#nullable enable
+
+namespace Wasi.Build.Tests;
+
+public class SdkMissingTests : BuildTestBase
+{
+ public SdkMissingTests(ITestOutputHelper output, SharedBuildPerTestClassFixture buildContext)
+ : base(output, buildContext)
+ {
+ }
+
+ public static TheoryData TestDataForNativeBuildFails(string extraProperties)
+ => new TheoryData
+ {
+ { "Debug", extraProperties, false },
+ { "Debug", extraProperties, true },
+ { "Release", extraProperties, false },
+ { "Release", extraProperties, true }
+ };
+
+ [Theory]
+ [MemberData(nameof(TestDataForNativeBuildFails), "true")]
+ [MemberData(nameof(TestDataForNativeBuildFails), "true")]
+ public void NativeBuildOrPublishFails(string config, string extraProperties, bool publish)
+ {
+ string output = BuildWithInvalidSdkPath(config, extraProperties, publish, expectSuccess: false);
+ Assert.Contains("SDK is required for building native files.", output);
+ }
+
+ [Theory]
+ [InlineData("Debug", "true", false)]
+ [InlineData("Release", "true", true)]
+ public void AOTFailsOnlyOnPublish(string config, string extraProperties, bool publish)
+ {
+ string output = BuildWithInvalidSdkPath(config, extraProperties, publish, expectSuccess: !publish);
+ if (publish)
+ Assert.Contains("SDK is required for AOT'ing assemblies", output);
+ else
+ Assert.DoesNotContain("SDK is required", output);
+ }
+
+ [Theory]
+ [InlineData("Debug")]
+ [InlineData("Release")]
+ public void SimpleBuildDoesNotFail(string config)
+ => BuildWithInvalidSdkPath(config, "", publish: false, expectSuccess: true);
+
+ private string BuildWithInvalidSdkPath(string config, string extraProperties, bool publish, bool expectSuccess)
+ {
+ string id = $"{config}_{GetRandomId()}";
+ string projectFile = CreateWasmTemplateProject(id, "wasiconsole");
+ string projectName = Path.GetFileNameWithoutExtension(projectFile);
+
+ var buildArgs = new BuildArgs(projectName, config, /*aot*/ true, id, null);
+ buildArgs = ExpandBuildArgs(buildArgs);
+ AddItemsPropertiesToProject(projectFile, extraProperties);
+
+ (_, string output) = BuildProject(buildArgs,
+ id: id,
+ new BuildProjectOptions(
+ DotnetWasmFromRuntimePack: true,
+ CreateProject: false,
+ Publish: publish,
+ TargetFramework: BuildTestBase.DefaultTargetFramework,
+ ExtraBuildEnvironmentVariables: new Dictionary { { "WASI_SDK_PATH", "x" } },
+ ExpectSuccess: expectSuccess));
+
+ return output;
+ }
+}
diff --git a/src/mono/wasi/Wasi.Build.Tests/WasiTemplateTests.cs b/src/mono/wasi/Wasi.Build.Tests/WasiTemplateTests.cs
index 3216c8d16952b5..82b8844c5cb6e0 100644
--- a/src/mono/wasi/Wasi.Build.Tests/WasiTemplateTests.cs
+++ b/src/mono/wasi/Wasi.Build.Tests/WasiTemplateTests.cs
@@ -3,7 +3,6 @@
using System;
using System.IO;
-using System.Runtime.InteropServices;
using Xunit;
using Xunit.Abstractions;
using Xunit.Sdk;
diff --git a/src/mono/wasi/build/WasiApp.InTree.props b/src/mono/wasi/build/WasiApp.InTree.props
index 585dddf9454bed..754b3ca9a3aad4 100644
--- a/src/mono/wasi/build/WasiApp.InTree.props
+++ b/src/mono/wasi/build/WasiApp.InTree.props
@@ -1,6 +1,5 @@
-
AnyCPU
diff --git a/src/mono/wasi/build/WasiApp.InTree.targets b/src/mono/wasi/build/WasiApp.InTree.targets
index ece3fb2d1a3b53..39236ac77c4f17 100644
--- a/src/mono/wasi/build/WasiApp.InTree.targets
+++ b/src/mono/wasi/build/WasiApp.InTree.targets
@@ -1,6 +1,7 @@
+
diff --git a/src/mono/wasi/build/WasiApp.Native.targets b/src/mono/wasi/build/WasiApp.Native.targets
deleted file mode 100644
index 213765c2d2f777..00000000000000
--- a/src/mono/wasi/build/WasiApp.Native.targets
+++ /dev/null
@@ -1,612 +0,0 @@
-
-
-
-
-
-
-
-
-
-
- <_WasiBuildNativeCoreDependsOn>
- _WasmAotCompileApp;
- _WasmStripAOTAssemblies;
- _PrepareForWasiBuildNative;
- _GetNativeFilesForLinking;
- _GenerateManagedToNative;
- _WasmCompileNativeFiles;
- _GenerateObjectFilesForSingleFileBundle;
- _WasiLinkDotNet;
-
-
- <_BeforeWasmBuildAppDependsOn>
- $(_BeforeWasmBuildAppDependsOn);
- _SetupWasiSdk;
- _SetWasmBuildNativeDefaults;
-
-
- <_ExeExt Condition="$([MSBuild]::IsOSPlatform('WINDOWS'))">.exe
-
-
-
-
-
-
-
-
- <_MonoComponent Include="hot_reload;debugger" />
-
-
- <_MonoComponent Include="marshal-ilgen" />
-
-
-
-
-
-
- <_ToolchainMissingPaths Condition="'$(_ToolchainMissingPaths)' == '' and ('$(WasiClang)' == '' or !Exists('$(WasiClang)'))">%24(WasiClang)=$(WasiClang)
-
-
-
- <_ToolchainMissingErrorMessage Condition="'$(WASI_SDK_PATH)' == '' and '$(WasiSdkRoot)' == ''">Could not find wasi-sdk. Install wasi-sdk and set %24(WASI_SDK_PATH) . It can be obtained from https://github.com/WebAssembly/wasi-sdk/releases
- <_ToolchainMissingErrorMessage Condition="'$(_ToolchainMissingErrorMessage)' == '' and '$(_ToolchainMissingPaths)' != ''">Using WASI_SDK_PATH=$(WASI_SDK_PATH), cannot find $(_ToolchainMissingPaths) .
- <_IsToolchainMissing Condition="'$(_ToolchainMissingErrorMessage)' != ''">true
-
-
-
- $([MSBuild]::NormalizeDirectory($(WasiSdkBinPath)))
-
-
-
-
-
-
-
-
-
-
-
-
- true
-
- true
- true
- true
-
- true
-
- false
-
-
-
-
-
- true
- true
- true
- true
- true
-
-
- false
-
-
- true
-
- false
-
-
-
-
-
-
- false
-
-
-
-
-
-
-
-
-
- <_MonoAotCrossCompilerPath>@(MonoAotCrossCompiler->WithMetadataValue('RuntimeIdentifier','wasi-wasm'))
- <_WasiClangDefaultFlagsRsp>$([MSBuild]::NormalizePath($(_WasmRuntimePackSrcDir), 'wasi-default.rsp'))
- <_WasiClangDefaultLinkFlagsRsp>$([MSBuild]::NormalizePath($(_WasmRuntimePackSrcDir), 'wasi-link.rsp'))
- false
- true
- true
- $(WasmBuildNative)
-
- <_WasmICallTablePath>$(_WasmIntermediateOutputPath)icall-table.h
- <_WasmRuntimeICallTablePath>$(_WasmIntermediateOutputPath)runtime-icall-table.h
- <_WasmPInvokeTablePath>$(_WasmIntermediateOutputPath)pinvoke-table.h
- <_WasmInterpToNativeTablePath>$(_WasmIntermediateOutputPath)wasm_m2n_invoke.g.h
- <_WasmPInvokeHPath>$(_WasmRuntimePackIncludeDir)wasm\pinvoke.h
- <_DriverGenCPath>$(_WasmIntermediateOutputPath)driver-gen.c
- false
- $(DisableParallelAot)
-
- <_DriverGenCNeeded Condition="'$(_DriverGenCNeeded)' == '' and '$(_WasmShouldAOT)' == 'true'">true
-
- <_WasmDevel Condition="'$(_WasmDevel)' == '' and '$(WasmBuildNative)' == 'true' and '$(Configuration)' == 'Debug'">true
-
-
- <_WasiClangOptimizationFlagDefault Condition="'$(_WasmDevel)' == 'true'">-O0
- <_WasiClangOptimizationFlagDefault Condition="'$(_WasiClangOptimizationFlagDefault)' == '' and '$(Configuration)' == 'Debug' and '$(WasmBuildingForNestedPublish)' != 'true'">-O1
- <_WasiClangOptimizationFlagDefault Condition="'$(_WasiClangOptimizationFlagDefault)' == ''">-Oz
-
- $(_WasiClangOptimizationFlagDefault)
- -O2
- $(WasiClangCompileOptimizationFlag)
-
- <_WasiClangCompileRsp>$(_WasmIntermediateOutputPath)wasi-compile.rsp
- <_WasiClangCompileOutputMessageImportance Condition="'$(WasiClangVerbose)' == 'true'">Normal
- <_WasiClangCompileOutputMessageImportance Condition="'$(WasiClangVerbose)' != 'true'">Low
-
- <_WasiClangCompileBitcodeRsp>$(_WasmIntermediateOutputPath)wasi-compile-bc.rsp
- <_WasiClangLinkRsp>$(_WasmIntermediateOutputPath)clang-link.rsp
-
-
- 52428800
-
-
-
-
-
-
- <_WasmCommonIncludePaths Include="$(_WasmIntermediateOutputPath.TrimEnd('\/'))" />
- <_WasmCommonIncludePaths Include="$(_WasmRuntimePackIncludeDir)mono-2.0" />
- <_WasmCommonIncludePaths Include="$(_WasmRuntimePackIncludeDir)wasm" />
-
-
-
-
- <_WasmCommonIncludePathsFixedUp Include="$([System.String]::new(%(_WasmCommonIncludePaths.Identity)).Replace('\', '/'))" />
- <_WasmCommonIncludePaths Remove="@(_WasmCommonIncludePaths)" />
- <_WasmCommonIncludePaths Include="@(_WasmCommonIncludePathsFixedUp)" />
-
-
-
- <_WasmLinkDependencies Remove="@(_WasmLinkDependencies)" />
-
- <_WasiClangCommonFlags Include="$(_DefaultWasiClangFlags)" />
- <_WasiClangCommonFlags Include="$(WasiClangFlags)" />
- <_WasiClangCommonFlags Include="--sysroot="$(WasiSdkRoot.Replace('\', '/'))/share/wasi-sysroot"" />
- <_WasiClangCommonFlags Include="-g" Condition="'$(WasmNativeStrip)' == 'false'" />
- <_WasiClangCommonFlags Include="-v" Condition="'$(WasiClangVerbose)' != 'false'" />
-
-
- <_WasiClangCommonFlags Include="-msimd128" Condition="'$(WasmEnableSIMD)' == 'true'" />
-
- <_WasmCommonCFlags Include="-DGEN_PINVOKE=1" />
- <_WasmCommonCFlags Condition="'$(_WasmShouldAOT)' == 'true'" Include="-DENABLE_AOT=1" />
- <_WasmCommonCFlags Condition="'$(_DriverGenCNeeded)' == 'true'" Include="-DDRIVER_GEN=1" />
- <_WasmCommonCFlags Condition="'$(WasmSingleFileBundle)' == 'true'" Include="-DWASM_SINGLE_FILE=1" />
- <_WasmCommonCFlags Condition="'$(InvariantGlobalization)' == 'true'" Include="-DINVARIANT_GLOBALIZATION=1" />
- <_WasmCommonCFlags Condition="'$(InvariantTimezone)' == 'true'" Include="-DINVARIANT_TIMEZONE=1" />
- <_WasmCommonCFlags Condition="'$(WasmLinkIcalls)' == 'true'" Include="-DLINK_ICALLS=1" />
- <_WasiClangCFlags Include="@(_WasmCommonCFlags)" />
-
- <_WasiClangCFlags Include=""-I%(_WasmCommonIncludePaths.Identity)"" />
- <_WasiClangCFlags Include="-I"$(MicrosoftNetCoreAppRuntimePackRidNativeDir.Replace('\', '/'))include"" />
-
- <_WasiClangCFlags Condition="'@(WasiAfterRuntimeLoadedDeclarations)' != ''"
- Include="-D WASI_AFTER_RUNTIME_LOADED_DECLARATIONS="@(WasiAfterRuntimeLoadedDeclarations, ' ')"" />
- <_WasiClangCFlags Condition="'@(WasiAfterRuntimeLoadedCalls)' != ''"
- Include="-D WASI_AFTER_RUNTIME_LOADED_CALLS="@(WasiAfterRuntimeLoadedCalls, ' ')"" />
-
- <_WasiClangLDFlags Include="$(WasiClangLinkOptimizationFlag)" />
- <_WasiClangLDFlags Include="@(_WasiClangCommonFlags)" />
-
-
-
- <_DriverCDependencies Include="$(_WasmPInvokeHPath);$(_WasmICallTablePath)" />
- <_DriverCDependencies Include="$(_DriverGenCPath)" Condition="'$(_DriverGenCNeeded)' == 'true'" />
-
- <_WasmRuntimePackSrcFile Include="$(_WasmRuntimePackSrcDir)pinvoke.c"
- Dependencies="$(_WasmPInvokeHPath);$(_WasmPInvokeTablePath)" />
- <_WasmRuntimePackSrcFile Include="$(_WasmRuntimePackSrcDir)driver.c"
- Dependencies="@(_DriverCDependencies)" />
- <_WasmRuntimePackSrcFile Include="$(_WasmRuntimePackSrcDir)main.c" />
- <_WasmRuntimePackSrcFile Include="$(_WasmRuntimePackSrcDir)stubs.c" />
- <_WasmRuntimePackSrcFile Include="$(_WasmRuntimePackSrcDir)synthetic-pthread.c" />
-
- <_WasmRuntimePackSrcFile ObjectFile="$(_WasmIntermediateOutputPath)%(FileName).o" />
-
-
-
-
-
-
-
- <_WasmPInvokeModules Include="%(_WasmNativeFileForLinking.FileName)" Condition="'%(_WasmNativeFileForLinking.ScanForPInvokes)' != 'false'" />
-
- <_WasmPInvokeModules Include="libSystem.Native" />
- <_WasmPInvokeModules Include="libSystem.Globalization.Native" />
-
-
-
-
-
- <_HasMscorlib Condition="'%(_WasmAssembliesInternal.FileName)%(_WasmAssembliesInternal.Extension)' == 'mscorlib.dll'">true
- <_MscorlibPath Condition="'$(_HasMscorlib)' != 'true'">$([System.IO.Path]::Combine($(MicrosoftNetCoreAppRuntimePackRidLibTfmDir), 'mscorlib.dll'))
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- <_WasiClangCFlags Include="$(WasiClangExtraCFlags)" />
-
-
-
-
-
-
-
-
- <_WasmSourceFileToCompile Remove="@(_WasmSourceFileToCompile)" />
- <_WasmSourceFileToCompile Include="@(_WasmRuntimePackSrcFile)" Dependencies="%(_WasmRuntimePackSrcFile.Dependencies);$(_WasiClangDefaultFlagsRsp);$(_WasiClangCompileRsp)" />
-
-
-
-
-
-
- <_WasmNativeFileForLinking Include="%(_WasmSourceFileToCompile.ObjectFile)" />
-
-
-
-
-
-
- <_BitCodeFile Dependencies="%(_BitCodeFile.Dependencies);$(_WasiClangDefaultFlagsRsp);$(_WasiClangCompileBitcodeRsp)" />
-
-
-
-
-
-
-
-
-
- <_BitcodeLDFlags Include="@(_WasiClangLDFlags)" />
- <_BitcodeLDFlags Include="$(WasiClangExtraBitcodeLDFlags)" />
-
-
-
-
-
-
-
-
-
-
-
-
- <_WasmEHLib Condition="'$(WasmEnableExceptionHandling)' == 'true'">libmono-wasm-eh-wasm.a
-
-
- <_WasmEHLibToExclude Condition="'$(WasmEnableExceptionHandling)' != 'true'">libmono-wasm-eh-wasm.a
- <_WasmSIMDLib Condition="'$(WasmEnableSIMD)' == 'true'">libmono-wasm-simd.a
- <_WasmSIMDLib Condition="'$(WasmEnableSIMD)' != 'true'">libmono-wasm-nosimd.a
- <_WasmSIMDLibToExclude Condition="'$(WasmEnableSIMD)' != 'true'">libmono-wasm-simd.a
- <_WasmSIMDLibToExclude Condition="'$(WasmEnableSIMD)' == 'true'">libmono-wasm-nosimd.a
-
-
-
-
- <_WasmNativeFileForLinking Include="%(_BitcodeFile.ObjectFile)" />
-
- <_MonoRuntimeComponentDontLink Include="libmono-component-diagnostics_tracing-static.a" />
- <_MonoRuntimeComponentDontLink Include="wasm-bundled-timezones.a" Condition="'$(InvariantTimezone)' == 'true'"/>
-
- <_WasmNativeFileForLinking
- Include="$(MicrosoftNetCoreAppRuntimePackRidNativeDir)*.a"
- Exclude="@(_MonoRuntimeComponentDontLink->'$(MicrosoftNetCoreAppRuntimePackRidNativeDir)%(Identity)')" />
- <_WasmNativeFileForLinking Condition="'$(_WasmEHLib)' != ''" Include="$(MicrosoftNetCoreAppRuntimePackRidNativeDir)$(_WasmEHLib)" />
- <_WasmNativeFileForLinking Condition="'$(_WasmSIMDLib)' != ''" Include="$(MicrosoftNetCoreAppRuntimePackRidNativeDir)$(_WasmSIMDLib)" />
- <_WasmNativeFileForLinking Remove="$(MicrosoftNetCoreAppRuntimePackRidNativeDir)$(_WasmEHLibToExclude)" />
- <_WasmNativeFileForLinking Remove="$(MicrosoftNetCoreAppRuntimePackRidNativeDir)$(_WasmSIMDLibToExclude)" />
-
- <_WasmNativeFileForLinking Include="$(WasiSysRoot)\lib\wasm32-wasi\libc++.a" />
- <_WasmNativeFileForLinking Include="$(WasiSysRoot)\lib\wasm32-wasi\libc++abi.a" />
-
-
-
-
-
- <_EmitBundleItemName
- Include="@(_WasmAssembliesInternal)"
- BundleRegistrationFunctionName="mono_register_assemblies_bundle"
- BundleFile="wasi_bundled_assemblies.o" />
-
- <_EmitBundleItemName
- Include="$(MicrosoftNetCoreAppRuntimePackRidNativeDir)icudt.dat"
- BundleRegistrationFunctionName="mono_register_icu_bundle"
- BundleFile="wasi_bundled_icu.o" />
-
- <_EmitBundleItemName
- Include="$(_ParsedRuntimeConfigFilePath)"
- BundleRegistrationFunctionName="mono_register_runtimeconfig_bin"
- BundleFile="wasi_bundled_runtimeconfig_bin.o" />
-
-
-
-
-
-
-
-
-
- <_EmitBundleOutputFile Remove="@(_EmitBundleOutputFile)" />
- <_EmitBundleOutputFile Include="%(_EmitBundleOutputItem.DestinationFile)" />
- <_EmitBundleOutputFile Include="@(_EmitBundleRegistrationFile)" />
-
- <_WasiObjectFilesForBundle Include="@(_EmitBundleOutputFile)" />
-
-
-
-
-
-
-
- <_WasiGetEntrypointCFile>$(_WasmIntermediateOutputPath)entrypoint_$(WasmMainAssemblyFileName).c
-
-
-
-
-
-
-
-
- <_WasiClangXLinkerFlags Include="--initial-memory=$(WasmInitialHeapSize)" />
-
- <_WasmNativeFileForLinking Include="@(NativeFileReference)" />
-
- <_WasiFilePathForFixup Include="$(_WasiGetEntrypointCFile)" />
- <_WasiFilePathForFixup Include="@(_WasiObjectFilesForBundle)" />
- <_WasiFilePathForFixup Include="@(_WasmNativeFileForLinking)" />
-
- <_WasmLinkDependencies Include="@(_WasiFilePathForFixup)" />
-
- <_WasiSdkClangArgs Condition="'$(OS)' == 'Windows_NT'" Include=""$([System.String]::new(%(_WasiFilePathForFixup.Identity)).Replace('\', '/'))"" />
- <_WasiSdkClangArgs Condition="'$(OS)' != 'Windows_NT'" Include="@(_WasiFilePathForFixup -> '"%(Identity)"')" />
-
- <_WasiSdkClangArgs Include="-Wl,--export=malloc,--export=free,--export=__heap_base,--export=__data_end" />
-
- <_WasiSdkClangArgs Include="-Wl,-z,stack-size=8388608,-lwasi-emulated-process-clocks,-lwasi-emulated-signal,-lwasi-emulated-mman"/>
- <_WasiSdkClangArgs Include="-Wl,-s" Condition="'$(WasmNativeStrip)' == 'true'"/>
-
- <_WasiSdkClangArgs Include=""@$(_WasiClangDefaultLinkFlagsRsp.Replace('\', '/'))"" />
- <_WasiSdkClangArgs Include="@(_WasiClangXLinkerFlags -> '-Xlinker %(Identity)', ' ')" />
- <_WasiSdkClangArgs Include="@(_WasiClangLDFlags)" />
-
- <_WasiSdkClangArgs Include="-o "$(_WasmOutputFileName.Replace('\', '/'))"" />
-
-
-
-
- <_WasmLinkDependencies Include="$(_WasiClangLinkRsp)" />
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- <_MonoAotCrossCompilerPath>@(MonoAotCrossCompiler->WithMetadataValue('RuntimeIdentifier', 'wasi-wasm'))
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- <_AotInputAssemblies Include="@(_WasmAssembliesInternal)">
- @(MonoAOTCompilerDefaultAotArguments, ';')
- @(MonoAOTCompilerDefaultProcessArguments, ';')
-
-
- <_WasmAssembliesInternal Remove="@(_WasmAssembliesInternal)" />
-
- <_WasmAOTSearchPaths Include="$(MicrosoftNetCoreAppRuntimePackRidNativeDir)" />
- <_WasmAOTSearchPaths Include="$(MicrosoftNetCoreAppRuntimePackRidLibTfmDir)" />
-
-
-
-
- <_AotInputAssemblies Condition="'%(Filename)' != '' and '@(_AotInputAssemblies->Metadata(`Filename`))' != '' and '@(_AOT_InternalForceInterpretAssemblies->Metadata(`Filename`))' != ''">
- true
-
-
-
-
-
- LLVMOnlyInterp
- <_AOTCompilerCacheFile>$(_WasmIntermediateOutputPath)aot_compiler_cache.json
-
-
-
-
-
-
- <_WasmDedupAssembly>$(_WasmIntermediateOutputPath)\aot-instances.dll
-
-
-
-
- <_AotInputAssemblies Include="$(_WasmDedupAssembly)">
- @(MonoAOTCompilerDefaultAotArguments, ';')
- @(MonoAOTCompilerDefaultProcessArguments, ';')
-
-
-
-
-
-
-
-
-
-
- <_BitcodeFile Include="%(_WasmAssembliesInternal.LlvmBitcodeFile)" />
- <_BitcodeFile ObjectFile="$(_WasmIntermediateOutputPath)%(FileName).o" />
-
-
- <_WasmAssembliesInternal Include="@(_AotInputAssemblies->WithMetadataValue('AOT_InternalForceToInterpret', 'true'))" />
-
-
-
-
-
-
- <_WasmStrippedAssembliesPath>$([MSBuild]::NormalizeDirectory($(_WasmIntermediateOutputPath), 'stripped-assemblies'))
-
-
-
- <_AOTedAssemblies Include="@(_WasmAssembliesInternal)" />
- <_WasmStrippedAssemblies
- Include="@(_AOTedAssemblies)"
- OriginalPath="%(_WasmAssembliesInternal.Identity)" />
-
-
-
-
-
-
-
-
- <_WasmAssembliesInternal Remove="@(_WasmAssembliesInternal)" />
- <_WasmAssembliesInternal Include="@(_WasmStrippedAssemblies)" />
-
-
-
-
-
-
diff --git a/src/mono/wasi/build/WasiApp.props b/src/mono/wasi/build/WasiApp.props
index 8f7b6eed1e4e15..d3e85d068e0da6 100644
--- a/src/mono/wasi/build/WasiApp.props
+++ b/src/mono/wasi/build/WasiApp.props
@@ -5,22 +5,9 @@
wasm
wasi
wasi-wasm
- true
partial
-
- <_WasmBuildCoreDependsOn>
- _InitializeCommonProperties;
- _PrepareForAfterBuild;
- _BeforeWasmBuildApp;
- _WasiGenerateAppBundle;
-
-
- $(_WasmBuildCoreDependsOn)
-
-
-
- _PrepareForNestedPublish;
- $(_WasmBuildCoreDependsOn)
-
+ true
+
+
diff --git a/src/mono/wasi/build/WasiApp.targets b/src/mono/wasi/build/WasiApp.targets
index 8678d5bd40758c..dba44b49c5b770 100644
--- a/src/mono/wasi/build/WasiApp.targets
+++ b/src/mono/wasi/build/WasiApp.targets
@@ -1,393 +1,375 @@
+
+
-
-
-
- true
+
+ _CheckToolchainIsExpectedVersion;
+ _PrepareForWasiBuildNative;
+ $(PrepareForWasmBuildNativeDependsOn)
+
+
+
+ $(WasmLinkDotNetDependsOn);
+ _WasiLinkDotNet;
+
+
+
+ $(WasmGenerateAppBundleDependsOn);
+ _GetWasiGenerateAppBundleDependencies;
+ _WasiGenerateAppBundle;
+ _GenerateRunWasmtimeScript;
+ _WasmGenerateNodeScripts;
+
+
false
false
-
-
- false
-
- <_BeforeWasmBuildAppDependsOn />
-
- true
- true
- true
-
- Build
-
- Publish
- <_WasmNestedPublishAppPreTarget Condition="'$(DisableAutoWasmPublishApp)' != 'true'">Publish
-
- true
- true
- true
- false
-
-
- false
true
- partial
false
+ partial
-
- -1
-
- false
- true
- true
- true
-
- true
- wasmtime
+
+
+
-
-
-
+ <_BoolPropertiesThatTriggerRelinking Include="WasmEnableSIMD" DefaultValueInRuntimePack="false" />
+
+ <_BoolPropertiesThatTriggerRelinking Include="WasmNativeStrip" DefaultValueInRuntimePack="true" />
-
-
- <_AppBundleDirForRunCommand Condition="'$(WasmAppDir)' != ''">$(WasmAppDir)
-
-
-
-
- <_AppBundleDirForRunCommand Condition="'$(_AppBundleDirForRunCommand)' == '' and '$(UseArtifactsOutput)' == '' and '$(AppendRuntimeIdentifierToOutputPath)' != 'false'">$([System.IO.Path]::Combine($(OutputPath), 'wasi-wasm', 'AppBundle'))
-
-
- <_AppBundleDirForRunCommand Condition="'$(_AppBundleDirForRunCommand)' == ''">$([System.IO.Path]::Combine($(OutputPath), 'AppBundle'))
-
-
- <_AppBundleDirForRunCommand Condition="'$(_AppBundleDirForRunCommand)' != '' and !$([System.IO.Path]::IsPathRooted($(_AppBundleDirForRunCommand)))">$([System.IO.Path]::Combine($(MSBuildProjectDirectory), $(_AppBundleDirForRunCommand)))
-
-
-
- $(DOTNET_HOST_PATH)
- dotnet
-
- <_RuntimeConfigJsonPath>$([MSBuild]::NormalizePath($(_AppBundleDirForRunCommand), '$(AssemblyName).runtimeconfig.json'))
- exec "$([MSBuild]::NormalizePath($(WasmAppHostDir), 'WasmAppHost.dll'))" --runtime-config "$(_RuntimeConfigJsonPath)" $(WasmHostArguments)
- exec "$([MSBuild]::NormalizePath($(WasmAppHostDir), 'WasmAppHost.dll'))" $(WasmHostArguments)
- $(_AppBundleDirForRunCommand)
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
-
-
+
+
-
-
-
-
-
+
-
+
+
- <_WasmRuntimeConfigFilePath Condition="$([System.String]::new(%(PublishItemsOutputGroupOutputs.Identity)).EndsWith('$(AssemblyName).runtimeconfig.json'))">@(PublishItemsOutputGroupOutputs)
+ <_ToolchainMissingPaths Condition="'$(_ToolchainMissingPaths)' == '' and ('$(WasiClang)' == '' or !Exists('$(WasiClang)'))">%24(WasiClang)=$(WasiClang)
-
-
-
-
+
+ <_ToolchainMissingErrorMessage Condition="'$(WASI_SDK_PATH)' == '' and '$(WasiSdkRoot)' == ''">Could not find wasi-sdk. Install wasi-sdk and set %24(WASI_SDK_PATH) . It can be obtained from https://github.com/WebAssembly/wasi-sdk/releases
+ <_ToolchainMissingErrorMessage Condition="'$(_ToolchainMissingErrorMessage)' == '' and '$(_ToolchainMissingPaths)' != ''">Using WASI_SDK_PATH=$(WASI_SDK_PATH), cannot find $(_ToolchainMissingPaths) .
+ <_IsToolchainMissing Condition="'$(_ToolchainMissingErrorMessage)' != ''">true
+
-
- <_WasmRuntimeConfigFilePath Condition="$([System.String]::new(%(PublishItemsOutputGroupOutputs.Identity)).EndsWith('$(AssemblyName).runtimeconfig.json'))">@(PublishItemsOutputGroupOutputs)
+
+ $([MSBuild]::NormalizeDirectory($(WasiSdkBinPath)))
+ <_WasmLLVMPathForAOT>$(WasiSdkBinPath)
-
-
+
+
-
-
+
+ <_MonoAotCrossCompilerPath>@(MonoAotCrossCompiler->WithMetadataValue('RuntimeIdentifier','wasi-wasm'))
+ <_WasmDefaultFlagsRsp>$([MSBuild]::NormalizePath($(_WasmRuntimePackSrcDir), 'wasi-default.rsp'))
+ <_WasmDefaultLinkFlagsRsp>$([MSBuild]::NormalizePath($(_WasmRuntimePackSrcDir), 'wasi-link.rsp'))
+ false
+ true
+ true
+ $(WasmBuildNative)
+
+ <_WasmICallTablePath>$(_WasmIntermediateOutputPath)icall-table.h
+ <_WasmRuntimeICallTablePath>$(_WasmIntermediateOutputPath)runtime-icall-table.h
+ <_WasmPInvokeTablePath>$(_WasmIntermediateOutputPath)pinvoke-table.h
+ <_WasmInterpToNativeTablePath>$(_WasmIntermediateOutputPath)wasm_m2n_invoke.g.h
+ <_WasmPInvokeHPath>$(_WasmRuntimePackIncludeDir)wasm\pinvoke.h
+ <_DriverGenCPath>$(_WasmIntermediateOutputPath)driver-gen.c
+ false
+ $(DisableParallelAot)
-
-
-
+ <_DriverGenCNeeded Condition="'$(_DriverGenCNeeded)' == '' and '$(_WasmShouldAOT)' == 'true'">true
-
- %(ResolvedRuntimePack.PackageDirectory)
- $([MSBuild]::NormalizeDirectory($(MicrosoftNetCoreAppRuntimePackDir), 'runtimes', $(RuntimeIdentifier)))
- $([MSBuild]::NormalizeDirectory($(MicrosoftNetCoreAppRuntimePackRidDir)))
- $([MSBuild]::NormalizeDirectory($(MicrosoftNetCoreAppRuntimePackRidDir), 'native'))
+ <_WasmDevel Condition="'$(_WasmDevel)' == '' and '$(WasmBuildNative)' == 'true' and '$(Configuration)' == 'Debug'">true
- <_WasmRuntimePackIncludeDir>$([MSBuild]::NormalizeDirectory($(MicrosoftNetCoreAppRuntimePackRidNativeDir), 'include'))
- <_WasmRuntimePackSrcDir>$([MSBuild]::NormalizeDirectory($(MicrosoftNetCoreAppRuntimePackRidNativeDir), 'src'))
+
+ <_WasiClangOptimizationFlagDefault Condition="'$(_WasmDevel)' == 'true'">-O0
+ <_WasiClangOptimizationFlagDefault Condition="'$(_WasiClangOptimizationFlagDefault)' == '' and '$(Configuration)' == 'Debug' and '$(WasmBuildingForNestedPublish)' != 'true'">-O1
+ <_WasiClangOptimizationFlagDefault Condition="'$(_WasiClangOptimizationFlagDefault)' == ''">-Oz
- <_WasmIntermediateOutputPath Condition="'$(WasmBuildingForNestedPublish)' == ''">$([MSBuild]::NormalizeDirectory($(IntermediateOutputPath), 'wasm', 'for-build'))
- <_WasmIntermediateOutputPath Condition="'$(WasmBuildingForNestedPublish)' != ''">$([MSBuild]::NormalizeDirectory($(IntermediateOutputPath), 'wasm', 'for-publish'))
+ $(_WasiClangOptimizationFlagDefault)
+ $(WasiClangCompileOptimizationFlag)
+ -O2
+ $(WasiClangCompileOptimizationFlag)
+ $(WasiClangLinkOptimizationFlag)
- <_DriverGenCPath>$(_WasmIntermediateOutputPath)driver-gen.c
- <_WasmShouldAOT Condition="'$(WasmBuildingForNestedPublish)' == 'true' and '$(RunAOTCompilation)' == 'true'">true
- <_WasmShouldAOT Condition="'$(RunAOTCompilationAfterBuild)' == 'true' and '$(RunAOTCompilation)' == 'true'">true
- <_WasmShouldAOT Condition="'$(_WasmShouldAOT)' == ''">false
+ <_WasmCompileRsp>$(_WasmIntermediateOutputPath)wasi-compile.rsp
+ <_WasmCompileOutputMessageImportance Condition="'$(WasiClangVerbose)' == 'true'">Normal
+ <_WasmCompileOutputMessageImportance Condition="'$(WasiClangVerbose)' != 'true'">Low
+
+ <_WasmCompileBitcodeRsp>$(_WasmIntermediateOutputPath)wasi-compile-bc.rsp
+ <_WasmLinkRsp>$(_WasmIntermediateOutputPath)clang-link.rsp
+
+
+ 52428800
+ $(WasiClang)
-
-
- <_SystemRuntimePathItem Include="$(MicrosoftNetCoreAppRuntimePackRidDir)\lib\net*\System.Runtime.dll" />
+
+
+
+
+ <_WasmCommonIncludePaths Include="$(_WasmIntermediateOutputPath.TrimEnd('\/'))" />
+ <_WasmCommonIncludePaths Include="$(_WasmRuntimePackIncludeDir)mono-2.0" />
+ <_WasmCommonIncludePaths Include="$(_WasmRuntimePackIncludeDir)wasm" />
-
-
+
+
+ <_WasmCommonIncludePathsFixedUp Include="$([System.String]::new(%(_WasmCommonIncludePaths.Identity)).Replace('\', '/'))" />
+ <_WasmCommonIncludePaths Remove="@(_WasmCommonIncludePaths)" />
+ <_WasmCommonIncludePaths Include="@(_WasmCommonIncludePathsFixedUp)" />
+
-
- $([System.IO.Path]::GetDirectoryName(%(_SystemRuntimePathItem.Identity)))
-
+
+ <_WasmLinkDependencies Remove="@(_WasmLinkDependencies)" />
+
+ <_WasiClangCommonFlags Include="$(_DefaultWasiClangFlags)" />
+ <_WasiClangCommonFlags Include="$(WasiClangFlags)" />
+ <_WasiClangCommonFlags Include="--sysroot="$(WasiSdkRoot.Replace('\', '/'))/share/wasi-sysroot"" />
+ <_WasiClangCommonFlags Include="-g" Condition="'$(WasmNativeStrip)' == 'false'" />
+ <_WasiClangCommonFlags Include="-v" Condition="'$(WasiClangVerbose)' != 'false'" />
+
+
+
+
+ <_WasmCommonCFlags Include="-DGEN_PINVOKE=1" />
+ <_WasmCommonCFlags Condition="'$(_WasmShouldAOT)' == 'true'" Include="-DENABLE_AOT=1" />
+ <_WasmCommonCFlags Condition="'$(_DriverGenCNeeded)' == 'true'" Include="-DDRIVER_GEN=1" />
+ <_WasmCommonCFlags Condition="'$(WasmSingleFileBundle)' == 'true'" Include="-DWASM_SINGLE_FILE=1" />
+ <_WasmCommonCFlags Condition="'$(InvariantGlobalization)' == 'true'" Include="-DINVARIANT_GLOBALIZATION=1" />
+ <_WasmCommonCFlags Condition="'$(InvariantTimezone)' == 'true'" Include="-DINVARIANT_TIMEZONE=1" />
+ <_WasmCommonCFlags Condition="'$(WasmLinkIcalls)' == 'true'" Include="-DLINK_ICALLS=1" />
+ <_WasiClangCFlags Include="@(_WasmCommonCFlags)" />
+
+ <_WasiClangCFlags Include=""-I%(_WasmCommonIncludePaths.Identity)"" />
+ <_WasiClangCFlags Include="-I"$(MicrosoftNetCoreAppRuntimePackRidNativeDir.Replace('\', '/'))include"" />
+
+ <_WasiClangCFlags Condition="'@(WasiAfterRuntimeLoadedDeclarations)' != ''"
+ Include="-D WASI_AFTER_RUNTIME_LOADED_DECLARATIONS="@(WasiAfterRuntimeLoadedDeclarations, ' ')"" />
+ <_WasiClangCFlags Condition="'@(WasiAfterRuntimeLoadedCalls)' != ''"
+ Include="-D WASI_AFTER_RUNTIME_LOADED_CALLS="@(WasiAfterRuntimeLoadedCalls, ' ')"" />
+
+ <_WasiClangLDFlags Include="$(WasiClangLinkOptimizationFlag)" />
+ <_WasiClangLDFlags Include="@(_WasiClangCommonFlags)" />
+
+
+
+ <_DriverCDependencies Include="$(_WasmPInvokeHPath);$(_WasmICallTablePath)" />
+ <_DriverCDependencies Include="$(_DriverGenCPath)" Condition="'$(_DriverGenCNeeded)' == 'true'" />
+
+ <_WasmRuntimePackSrcFile Include="$(_WasmRuntimePackSrcDir)pinvoke.c"
+ Dependencies="$(_WasmPInvokeHPath);$(_WasmPInvokeTablePath)" />
+ <_WasmRuntimePackSrcFile Include="$(_WasmRuntimePackSrcDir)driver.c"
+ Dependencies="@(_DriverCDependencies)" />
+ <_WasmRuntimePackSrcFile Include="$(_WasmRuntimePackSrcDir)main.c" />
+ <_WasmRuntimePackSrcFile Include="$(_WasmRuntimePackSrcDir)stubs.c" />
+ <_WasmRuntimePackSrcFile Include="$(_WasmRuntimePackSrcDir)synthetic-pthread.c" />
+
+ <_WasmRuntimePackSrcFile ObjectFile="$(_WasmIntermediateOutputPath)%(FileName).o" />
+
-
-
-
+
+ <_WasmBundleItem
+ Include="@(_WasmAssembliesInternal)"
+ BundleRegistrationFunctionName="mono_register_assemblies_bundle"
+ BundleFile="wasi_bundled_assemblies.o" />
+
+
+ <_WasmBundleItem
+ Include="$(MicrosoftNetCoreAppRuntimePackRidNativeDir)icudt.dat"
+ BundleRegistrationFunctionName="mono_register_icu_bundle"
+ BundleFile="wasi_bundled_icu.o" />
+
+
+ <_WasmBundleItem
+ Include="$(_ParsedRuntimeConfigFilePath)"
+ BundleRegistrationFunctionName="mono_register_runtimeconfig_bin"
+ BundleFile="wasi_bundled_runtimeconfig_bin.o" />
+
+
+
-
-
-
+
+
+ <_WasmCFlags Include="@(_WasiClangCFlags)" />
+ <_WasmCFlags Include="$(WasiClangExtraCFlags)" />
+
+
+
+
+
+
+ <_BitcodeLDFlags Include="@(_WasiClangLDFlags)" />
+ <_BitcodeLDFlags Include="$(WasiClangExtraBitcodeLDFlags)" />
-
-
-
+
+
- $([MSBuild]::NormalizeDirectory($(OutputPath), 'AppBundle'))
+ <_WasiGetEntrypointCFile>$(_WasmIntermediateOutputPath)entrypoint_$(WasmMainAssemblyFileName).c
+
+
+
+
+
+
- $(TargetFileName)
-
- $([System.IO.Path]::GetFileName($(WasmMainAssemblyFileName)))
+
+
+ <_WasmEHLib Condition="'$(WasmEnableExceptionHandling)' == 'true'">libmono-wasm-eh-wasm.a
+
+
+ <_WasmEHLibToExclude Condition="'$(WasmEnableExceptionHandling)' != 'true'">libmono-wasm-eh-wasm.a
+ <_WasmSIMDLib Condition="'$(WasmEnableSIMD)' == 'true'">libmono-wasm-simd.a
+ <_WasmSIMDLib Condition="'$(WasmEnableSIMD)' != 'true'">libmono-wasm-nosimd.a
+ <_WasmSIMDLibToExclude Condition="'$(WasmEnableSIMD)' != 'true'">libmono-wasm-simd.a
+ <_WasmSIMDLibToExclude Condition="'$(WasmEnableSIMD)' == 'true'">libmono-wasm-nosimd.a
+
- <_WasmOutputFileName Condition="'$(WasmSingleFileBundle)' == 'true'">$([System.IO.Path]::GetFileNameWithoutExtension('$(WasmMainAssemblyFileName)')).wasm
- <_WasmOutputFileName Condition="'$(WasmSingleFileBundle)' != 'true'">dotnet.wasm
- <_WasmOutputFileName>$([System.IO.Path]::Combine($(_WasmIntermediateOutputPath), $(_WasmOutputFileName)))
+
+
+ <_WasmNativeFileForLinking Include="%(_BitcodeFile.ObjectFile)" />
+
+ <_MonoRuntimeComponentDontLink Include="libmono-component-diagnostics_tracing-static.a" />
+ <_MonoRuntimeComponentDontLink Include="wasm-bundled-timezones.a" Condition="'$(InvariantTimezone)' == 'true'"/>
+
+ <_WasmNativeFileForLinking
+ Include="$(MicrosoftNetCoreAppRuntimePackRidNativeDir)*.a"
+ Exclude="@(_MonoRuntimeComponentDontLink->'$(MicrosoftNetCoreAppRuntimePackRidNativeDir)%(Identity)')" />
+ <_WasmNativeFileForLinking Condition="'$(_WasmEHLib)' != ''" Include="$(MicrosoftNetCoreAppRuntimePackRidNativeDir)$(_WasmEHLib)" />
+ <_WasmNativeFileForLinking Condition="'$(_WasmSIMDLib)' != ''" Include="$(MicrosoftNetCoreAppRuntimePackRidNativeDir)$(_WasmSIMDLib)" />
+ <_WasmNativeFileForLinking Remove="$(MicrosoftNetCoreAppRuntimePackRidNativeDir)$(_WasmEHLibToExclude)" />
+ <_WasmNativeFileForLinking Remove="$(MicrosoftNetCoreAppRuntimePackRidNativeDir)$(_WasmSIMDLibToExclude)" />
+
+ <_WasmNativeFileForLinking Include="$(WasiSysRoot)\lib\wasm32-wasi\libc++.a" />
+ <_WasmNativeFileForLinking Include="$(WasiSysRoot)\lib\wasm32-wasi\libc++abi.a" />
+
+ <_WasmNativeFileForLinking Include="@(NativeFileReference)" />
+
- $([MSBuild]::NormalizeDirectory($(WasmAppDir)))
+
+ <_WasiClangXLinkerFlags Include="--initial-memory=$(WasmInitialHeapSize)" />
- <_MainAssemblyPath Condition="'%(WasmAssembliesToBundle.FileName)' == $(AssemblyName) and '%(WasmAssembliesToBundle.Extension)' == '.dll' and $(WasmGenerateAppBundle) == 'true'">%(WasmAssembliesToBundle.Identity)
- <_WasmRuntimeConfigFilePath Condition="'$(_WasmRuntimeConfigFilePath)' == '' and $(_MainAssemblyPath) != ''">$([System.IO.Path]::ChangeExtension($(_MainAssemblyPath), '.runtimeconfig.json'))
- <_ParsedRuntimeConfigFilePath Condition="'$(_WasmRuntimeConfigFilePath)' != ''">$([System.IO.Path]::GetDirectoryName($(_WasmRuntimeConfigFilePath)))\runtimeconfig.bin
-
+ <_WasiFilePathForFixup Include="$(_WasiGetEntrypointCFile)" />
+ <_WasiFilePathForFixup Include="@(_WasmObjectFilesForBundle)" />
+ <_WasiFilePathForFixup Include="@(_WasmNativeFileForLinking)" />
-
+ <_WasmLinkDependencies Include="@(_WasiFilePathForFixup)" />
-
+ <_WasiSdkClangArgs Condition="'$(OS)' == 'Windows_NT'" Include=""$([System.String]::new(%(_WasiFilePathForFixup.Identity)).Replace('\', '/'))"" />
+ <_WasiSdkClangArgs Condition="'$(OS)' != 'Windows_NT'" Include="@(_WasiFilePathForFixup -> '"%(Identity)"')" />
-
- <_WasmAssembliesInternal Remove="@(_WasmAssembliesInternal)" />
- <_WasmAssembliesInternal Include="@(WasmAssembliesToBundle->Distinct())" WasmRole="assembly" />
+ <_WasiSdkClangArgs Include="-Wl,--export=malloc,--export=free,--export=__heap_base,--export=__data_end" />
+
+ <_WasiSdkClangArgs Include="-Wl,-z,stack-size=8388608,-lwasi-emulated-process-clocks,-lwasi-emulated-signal,-lwasi-emulated-mman"/>
+ <_WasiSdkClangArgs Include="-Wl,-s" Condition="'$(WasmNativeStrip)' == 'true'"/>
+
+ <_WasiSdkClangArgs Include=""@$(_WasmDefaultLinkFlagsRsp.Replace('\', '/'))"" />
+ <_WasiSdkClangArgs Include="@(_WasiClangXLinkerFlags -> '-Xlinker %(Identity)', ' ')" />
+ <_WasiSdkClangArgs Include="@(_WasiClangLDFlags)" />
- <_WasmSatelliteAssemblies Remove="@(_WasmSatelliteAssemblies)" />
- <_WasmSatelliteAssemblies Include="@(_WasmAssembliesInternal)" />
- <_WasmSatelliteAssemblies Remove="@(_WasmSatelliteAssemblies)" Condition="!$([System.String]::Copy('%(Identity)').EndsWith('.resources.dll'))" />
-
- <_WasmSatelliteAssemblies CultureName="$([System.IO.Directory]::GetParent('%(Identity)').Name)" WasmRole="SatelliteAssembly" />
+ <_WasiSdkClangArgs Include="-o "$(_WasiOutputFileName.Replace('\', '/'))"" />
- <_WasmAssembliesInternal Remove="@(_WasmSatelliteAssemblies)" />
+ <_WasmLinkStepArgs Include="@(_WasiSdkClangArgs)" />
-
-
- <_RuntimeConfigReservedProperties Include="RUNTIME_IDENTIFIER"/>
- <_RuntimeConfigReservedProperties Include="APP_CONTEXT_BASE_DIRECTORY"/>
-
+
+
+
+
-
-
+
+
+
+
-
+
-
+
+
- <_HasDotnetWasm Condition="'%(WasmNativeAsset.FileName)%(WasmNativeAsset.Extension)' == 'dotnet.wasm'">true
+ <_WasiOutputFileName Condition="'$(WasmSingleFileBundle)' == 'true'">$([System.IO.Path]::GetFileNameWithoutExtension('$(WasmMainAssemblyFileName)')).wasm
+ <_WasiOutputFileName Condition="'$(WasmSingleFileBundle)' != 'true'">dotnet.wasm
+ <_WasiOutputFileName Condition="'$(_WasiOutputFileName)' != ''">$([System.IO.Path]::Combine($(_WasiIntermediateOutputPath), $(_WasiOutputFileName)))
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
-
-
-
+
+
@@ -451,23 +433,5 @@ wasi.start(instance);
-
-
-
-
-
-
- <_WasmAssembliesInternal Remove="@(_WasmAssembliesInternal)" />
- <_WasmAssembliesInternal Include="@(_TmpWasmAssemblies)" />
-
-
-
-
-
-
-
-
+
diff --git a/src/mono/wasm/Wasm.Build.Tests/WasmNativeDefaultsTests.cs b/src/mono/wasm/Wasm.Build.Tests/WasmNativeDefaultsTests.cs
index 4bbea5dff8a926..7974e22506da33 100644
--- a/src/mono/wasm/Wasm.Build.Tests/WasmNativeDefaultsTests.cs
+++ b/src/mono/wasm/Wasm.Build.Tests/WasmNativeDefaultsTests.cs
@@ -196,7 +196,7 @@ public void WithNativeReference(string config, string extraProperties, bool publ
extraProperties += "<_WasmDevel>true";
string printValueTarget = @"
-
+
" + (publish
? @""
diff --git a/src/mono/wasm/build/EmSdkRepo.Defaults.props b/src/mono/wasm/build/EmSdkRepo.Defaults.props
index a25b41ea5b5851..23bfe4551a5c81 100644
--- a/src/mono/wasm/build/EmSdkRepo.Defaults.props
+++ b/src/mono/wasm/build/EmSdkRepo.Defaults.props
@@ -5,6 +5,7 @@
$([MSBuild]::EnsureTrailingSlash($(EMSDK_PATH)))
$([MSBuild]::NormalizeDirectory($(EmscriptenSdkToolsPath), 'upstream', 'bin'))
+ $([MSBuild]::NormalizeDirectory($(EmscriptenSdkToolsPath), 'upstream', 'emscripten'))
<_NodeToolsBasePath>$(EmscriptenSdkToolsPath)node
diff --git a/src/mono/wasm/build/WasmApp.Common.props b/src/mono/wasm/build/WasmApp.Common.props
new file mode 100644
index 00000000000000..f74fa9acda0be1
--- /dev/null
+++ b/src/mono/wasm/build/WasmApp.Common.props
@@ -0,0 +1,25 @@
+
+
+ wasm
+ true
+
+
+
+ _WasmBuildAppCore;
+
+
+ <_WasmBuildAppCoreDependsOn>
+ _InitializeCommonProperties;
+ PrepareInputsForWasmBuild;
+ _WasmResolveReferences;
+ _WasmBuildNativeCore;
+ WasmGenerateAppBundle;
+ _EmitWasmAssembliesFinal;
+
+
+
+ _PrepareForNestedPublish;
+ _WasmBuildAppCore;
+
+
+
diff --git a/src/mono/wasm/build/WasmApp.Common.targets b/src/mono/wasm/build/WasmApp.Common.targets
new file mode 100644
index 00000000000000..e8e309469ab233
--- /dev/null
+++ b/src/mono/wasm/build/WasmApp.Common.targets
@@ -0,0 +1,853 @@
+
+
+
+
+
+
+
+
+
+
+
+
+ $(PrepareInputsForWasmBuildDependsOn);
+ _SetupToolchain;
+ _SetWasmBuildNativeDefaults;
+ _SetWasmNativeStripDefault;
+ _GetDefaultWasmAssembliesToBundle;
+ _WasmGetRuntimeConfigPath;
+
+
+
+ $(WasmGenerateAppBundleDependsOn);
+ _WasmGenerateRuntimeConfig;
+
+
+
+ <_WasmBuildNativeCoreDependsOn>
+ $(_WasmBuildNativeCoreDependsOn);
+ _PrepareForWasmBuildNative;
+ PrepareForWasmBuildNative;
+ _ScanAssembliesDecideLightweightMarshaler;
+ _WasmAotCompileApp;
+ _WasmStripAOTAssemblies;
+ _GenerateManagedToNative;
+ WasmLinkDotNet;
+
+
+
+ $(WasmLinkDotNetDependsOn);
+ _CheckToolchainIsExpectedVersion;
+ _WasmSelectRuntimeComponentsForLinking;
+ _WasmCompileAssemblyBitCodeFilesForAOT;
+ _WasmCalculateInitialHeapSizeFromBitcodeFiles;
+ _WasmGenerateRuntimeConfig;
+ _WasmWriteRspForCompilingNativeSourceFiles;
+ _WasmCompileNativeSourceFiles;
+ _GenerateObjectFilesForSingleFileBundle;
+ _WasmWriteRspForLinking;
+
+
+ true
+ true
+ true
+ true
+ Build
+
+ Publish
+ <_WasmNestedPublishAppPreTarget Condition="'$(DisableAutoWasmPublishApp)' != 'true'">Publish
+
+ true
+
+ true
+ true
+ false
+
+
+ false
+
+
+ -1
+
+ false
+ false
+ true
+ _framework
+
+
+
+
+
+
+
+
+
+ false
+
+
+
+
+ <_AppBundleDirForRunCommand Condition="'$(WasmAppDir)' != ''">$(WasmAppDir)
+
+
+
+
+ <_AppBundleDirForRunCommand Condition="'$(_AppBundleDirForRunCommand)' == '' and '$(UseArtifactsOutput)' == '' and '$(AppendRuntimeIdentifierToOutputPath)' != 'false'">$([System.IO.Path]::Combine($(OutputPath), $(RuntimeIdentifier), 'AppBundle'))
+
+
+ <_AppBundleDirForRunCommand Condition="'$(_AppBundleDirForRunCommand)' == ''">$([System.IO.Path]::Combine($(OutputPath), 'AppBundle'))
+
+
+ <_AppBundleDirForRunCommand Condition="'$(_AppBundleDirForRunCommand)' != '' and !$([System.IO.Path]::IsPathRooted($(_AppBundleDirForRunCommand)))">$([System.IO.Path]::Combine($(MSBuildProjectDirectory), $(_AppBundleDirForRunCommand)))
+
+
+
+ $(DOTNET_HOST_PATH)
+ dotnet
+
+ <_RuntimeConfigJsonPath>$([MSBuild]::NormalizePath($(_AppBundleDirForRunCommand), '$(AssemblyName).runtimeconfig.json'))
+ exec "$([MSBuild]::NormalizePath($(WasmAppHostDir), 'WasmAppHost.dll'))" --runtime-config "$(_RuntimeConfigJsonPath)" $(WasmHostArguments)
+ $(_AppBundleDirForRunCommand)
+
+
+
+ <_ExeExt Condition="$([MSBuild]::IsOSPlatform('WINDOWS'))">.exe
+
+ <_WasmStrictVersionMatch Condition="'$(WasmUseEMSDK_PATH)' == 'true'">true
+
+
+
+
+
+
+
+ <_MonoComponent Include="hot_reload;debugger" />
+
+
+
+
+
+
+
+
+
+
+
+
+
+ %(ResolvedRuntimePack.PackageDirectory)
+ $([MSBuild]::NormalizeDirectory($(MicrosoftNetCoreAppRuntimePackDir), 'runtimes', $(RuntimeIdentifier)))
+ $([MSBuild]::NormalizeDirectory($(MicrosoftNetCoreAppRuntimePackRidDir)))
+ $([MSBuild]::NormalizeDirectory($(MicrosoftNetCoreAppRuntimePackRidDir), 'native'))
+
+ <_WasmRuntimePackIncludeDir>$([MSBuild]::NormalizeDirectory($(MicrosoftNetCoreAppRuntimePackRidNativeDir), 'include'))
+ <_WasmRuntimePackSrcDir>$([MSBuild]::NormalizeDirectory($(MicrosoftNetCoreAppRuntimePackRidNativeDir), 'src'))
+
+ <_WasmIntermediateOutputPath Condition="'$(WasmBuildingForNestedPublish)' == ''">$([MSBuild]::NormalizeDirectory($(IntermediateOutputPath), 'wasm', 'for-build'))
+ <_WasmIntermediateOutputPath Condition="'$(WasmBuildingForNestedPublish)' != ''">$([MSBuild]::NormalizeDirectory($(IntermediateOutputPath), 'wasm', 'for-publish'))
+
+ <_DriverGenCPath>$(_WasmIntermediateOutputPath)driver-gen.c
+ <_WasmShouldAOT Condition="'$(WasmBuildingForNestedPublish)' == 'true' and '$(RunAOTCompilation)' == 'true'">true
+ <_WasmShouldAOT Condition="'$(RunAOTCompilationAfterBuild)' == 'true' and '$(RunAOTCompilation)' == 'true'">true
+ <_WasmShouldAOT Condition="'$(_WasmShouldAOT)' == ''">false
+
+
+
+
+ <_SystemRuntimePathItem Include="$(MicrosoftNetCoreAppRuntimePackRidDir)\lib\net*\System.Runtime.dll" />
+
+
+
+
+
+
+ $([System.IO.Path]::GetDirectoryName(%(_SystemRuntimePathItem.Identity)))
+
+
+
+ $([MSBuild]::NormalizeDirectory($(OutputPath), 'AppBundle'))
+ $(TargetFileName)
+
+ $([System.IO.Path]::GetFileName($(WasmMainAssemblyFileName)))
+
+ $([MSBuild]::NormalizeDirectory($(WasmAppDir)))
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <_MainAssemblyPath Condition="'%(WasmAssembliesToBundle.FileName)' == $(AssemblyName) and '%(WasmAssembliesToBundle.Extension)' == '.dll' and $(WasmGenerateAppBundle) == 'true'">%(WasmAssembliesToBundle.Identity)
+ <_WasmRuntimeConfigFilePath Condition="'$(_WasmRuntimeConfigFilePath)' == '' and $(_MainAssemblyPath) != ''">$([System.IO.Path]::ChangeExtension($(_MainAssemblyPath), '.runtimeconfig.json'))
+ <_ParsedRuntimeConfigFilePath Condition="'$(_WasmRuntimeConfigFilePath)' != ''">$([System.IO.Path]::GetDirectoryName($(_WasmRuntimeConfigFilePath)))\runtimeconfig.bin
+
+
+
+
+
+
+
+
+
+ <_WasmAssembliesInternal Remove="@(_WasmAssembliesInternal)" />
+ <_WasmAssembliesInternal Include="@(_TmpWasmAssemblies)" />
+
+
+
+
+
+
+
+
+
+
+
+
+ <_WasmAssembliesInternal Remove="@(_WasmAssembliesInternal)" />
+ <_WasmAssembliesInternal Include="@(WasmAssembliesToBundle->Distinct())" />
+
+ <_WasmSatelliteAssemblies Remove="@(_WasmSatelliteAssemblies)" />
+ <_WasmSatelliteAssemblies Include="@(_WasmAssembliesInternal)" />
+ <_WasmSatelliteAssemblies Remove="@(_WasmSatelliteAssemblies)" Condition="!$([System.String]::Copy('%(Identity)').EndsWith('.resources.dll'))" />
+
+ <_WasmSatelliteAssemblies CultureName="$([System.IO.Directory]::GetParent('%(Identity)').Name)" />
+
+ <_WasmAssembliesInternal Remove="@(_WasmSatelliteAssemblies)" />
+
+
+
+
+
+
+
+ <_RuntimeConfigReservedProperties Include="RUNTIME_IDENTIFIER"/>
+ <_RuntimeConfigReservedProperties Include="APP_CONTEXT_BASE_DIRECTORY"/>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <_WasmRuntimeConfigFilePath Condition="$([System.String]::new(%(PublishItemsOutputGroupOutputs.Identity)).EndsWith('$(AssemblyName).runtimeconfig.json'))">@(PublishItemsOutputGroupOutputs)
+
+
+
+ <_WasmRuntimeConfigFilePath Condition="$([System.String]::new(%(PublishItemsOutputGroupOutputs.Identity)).EndsWith('$(AssemblyName).runtimeconfig.json'))">@(PublishItemsOutputGroupOutputs)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <_BoolPropertiesThatTriggerRelinking Include="InvariantTimezone" DefaultValueInRuntimePack="false" />
+ <_BoolPropertiesThatTriggerRelinking Include="InvariantGlobalization" DefaultValueInRuntimePack="false" />
+
+
+
+ true
+
+
+
+
+
+ true
+
+ true
+ true
+ false
+
+
+
+
+
+ true
+ true
+ true
+
+
+ false
+
+
+ true
+
+ false
+
+
+
+
+
+
+ false
+ true
+
+
+
+
+
+
+
+
+ <_AOTObjectFile Include="%(_BitcodeFile.ObjectFile)" />
+
+
+
+
+
+
+
+ <_AOTDataSegmentSize Condition="$([System.String]::Copy('%(LlvmAotSizeOutput.Identity)').StartsWith('DATA '))"
+ Include="$([System.String]::Copy('%(LlvmAotSizeOutput.Identity)').Replace("DATA ", "").Replace(" 0", "").Trim())" />
+
+
+
+
+
+
+ $(_WasmCalculatedInitialHeapSize)
+ 16777216
+
+
+
+
+
+ <_AssembliesToScan Include="@(_WasmAssembliesInternal)" />
+
+
+
+
+
+
+
+ <_MonoComponent Include="marshal-ilgen" />
+
+
+
+
+
+
+ <_MonoAotCrossCompilerPath>@(MonoAotCrossCompiler->WithMetadataValue('RuntimeIdentifier',$(RuntimeIdentifier)))
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <_AotInputAssemblies Include="@(_WasmAssembliesInternal)">
+ @(MonoAOTCompilerDefaultAotArguments, ';')
+ @(MonoAOTCompilerDefaultProcessArguments, ';')
+
+
+ <_WasmAssembliesInternal Remove="@(_WasmAssembliesInternal)" />
+
+ <_WasmAOTSearchPaths Include="$(MicrosoftNetCoreAppRuntimePackRidNativeDir)" />
+ <_WasmAOTSearchPaths Include="$(MicrosoftNetCoreAppRuntimePackRidLibTfmDir)" />
+
+
+
+
+ <_AotInputAssemblies Condition="'%(Filename)' != '' and '@(_AotInputAssemblies->Metadata(`Filename`))' != '' and '@(_AOT_InternalForceInterpretAssemblies->Metadata(`Filename`))' != ''">
+ true
+
+
+
+
+
+ LLVMOnlyInterp
+ <_AOTCompilerCacheFile>$(_WasmIntermediateOutputPath)aot_compiler_cache.json
+
+
+
+
+ <_WasmDedupAssembly>$(_WasmIntermediateOutputPath)\aot-instances.dll
+
+
+
+
+ <_AotInputAssemblies Include="$(_WasmDedupAssembly)">
+ @(MonoAOTCompilerDefaultAotArguments, ';')
+ @(MonoAOTCompilerDefaultProcessArguments, ';')
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <_WasmAssembliesInternal Remove="@(_WasmAssembliesInternal)"/>
+ <_WasmAssembliesInternal Include="@(_UpdatedAssembliesAfterILStrip)"/>
+
+
+
+ <_BitcodeFile Include="%(_WasmAssembliesInternal.LlvmBitcodeFile)" />
+ <_BitcodeFile ObjectFile="$(_WasmIntermediateOutputPath)%(FileName).o" />
+
+
+ <_WasmAssembliesInternal Include="@(_AotInputAssemblies->WithMetadataValue('AOT_InternalForceToInterpret', 'true'))" />
+
+
+
+
+
+
+
+ <_WasmStrippedAssembliesPath>$([MSBuild]::NormalizeDirectory($(_WasmIntermediateOutputPath), 'stripped-assemblies'))
+
+
+
+ <_AOTedAssemblies Include="@(_WasmAssembliesInternal)" />
+ <_WasmStrippedAssemblies
+ Include="@(_AOTedAssemblies)"
+ OriginalPath="%(_WasmAssembliesInternal.Identity)" />
+
+
+
+
+
+
+
+
+ <_WasmAssembliesInternal Remove="@(_WasmAssembliesInternal)" />
+ <_WasmAssembliesInternal Include="@(_WasmStrippedAssemblies)" />
+
+
+
+
+
+ <_WasmPInvokeModules Include="%(_WasmNativeFileForLinking.FileName)" Condition="'%(_WasmNativeFileForLinking.ScanForPInvokes)' != 'false'" />
+
+ <_WasmPInvokeModules Include="libSystem.Native" />
+ <_WasmPInvokeModules Include="libSystem.IO.Compression.Native" />
+ <_WasmPInvokeModules Include="libSystem.Globalization.Native" />
+
+
+
+ <_HasMscorlib Condition="'%(_WasmAssembliesInternal.FileName)%(_WasmAssembliesInternal.Extension)' == 'mscorlib.dll'">true
+ <_MscorlibPath Condition="'$(_HasMscorlib)' != 'true'">$([System.IO.Path]::Combine($(MicrosoftNetCoreAppRuntimePackRidLibTfmDir), 'mscorlib.dll'))
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <_BitCodeFile Dependencies="%(_BitCodeFile.Dependencies);$(_WasmDefaultsFlagsRsp);$(_WasmCompileBitcodeRsp)" />
+
+ <_WasmCompileArguments Remove="@(_WasmCompileArguments)" />
+ <_WasmCompileArguments Include=""@$(_WasmDefaultFlagsRsp)"" Condition="'$(_WasmDefaultFlagsRsp)' != ''" />
+ <_WasmCompileArguments Include="$(_WasmDefaultFlags)" Condition="'$(_WasmDefaultFlags)' != ''" />
+ <_WasmCompileArguments Include=""@$(_WasmCompileBitcodeRsp)"" Condition="'$(_WasmCompileBitcodeRsp)' != ''" />
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <_WasmSourceFileToCompile Remove="@(_WasmSourceFileToCompile)" />
+ <_WasmSourceFileToCompile Include="@(_WasmRuntimePackSrcFile)" Dependencies="%(_WasmRuntimePackSrcFile.Dependencies);$(_WasmDefaultFlagsRsp);$(_WasmCompileRsp)" />
+
+ <_WasmCompileArguments Remove="@(_WasmCompileArguments)" />
+ <_WasmCompileArguments Include=""@$(_WasmDefaultFlagsRsp)"" Condition="'$(_WasmDefaultFlagsRsp)' != ''" />
+ <_WasmCompileArguments Include="$(_EmccDefaultFlags)" Condition="'$(_EmccDefaultFlags)' != ''" />
+ <_WasmCompileArguments Include=""@$(_WasmCompileRsp)"" Condition="'$(_WasmCompileRsp)' != ''" />
+
+
+
+
+
+
+
+ <_WasmNativeFileForLinking Include="%(_WasmSourceFileToCompile.ObjectFile)" />
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <_EmitBundleOutputFile Remove="@(_EmitBundleOutputFile)" />
+ <_EmitBundleOutputFile Include="%(_EmitBundleOutputItem.DestinationFile)" />
+ <_EmitBundleOutputFile Include="@(_EmitBundleRegistrationFile)" />
+
+ <_WasmObjectFilesForBundle Include="@(_EmitBundleOutputFile)" />
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/mono/wasm/build/WasmApp.InTree.props b/src/mono/wasm/build/WasmApp.InTree.props
index 993b6f8aafedd3..6899a111b4af76 100644
--- a/src/mono/wasm/build/WasmApp.InTree.props
+++ b/src/mono/wasm/build/WasmApp.InTree.props
@@ -1,5 +1,9 @@
+
+ $(MSBuildThisFileDirectory)
+ $([MSBuild]::NormalizeDirectory($(MonoProjectRoot), 'wasm', 'build'))
+
diff --git a/src/mono/wasm/build/WasmApp.Native.targets b/src/mono/wasm/build/WasmApp.Native.targets
deleted file mode 100644
index 573fa9a044a907..00000000000000
--- a/src/mono/wasm/build/WasmApp.Native.targets
+++ /dev/null
@@ -1,786 +0,0 @@
-
-
-
-
-
-
-
-
- <_WasmBuildNativeCoreDependsOn>
- _ScanAssembliesDecideLightweightMarshaler;
- _WasmAotCompileApp;
- _WasmStripAOTAssemblies;
- _PrepareForWasmBuildNative;
- _GenerateManagedToNative;
- _WasmCompileNativeFiles;
- _WasmLinkDotNet;
- _CompleteWasmBuildNative
-
-
- <_BeforeWasmBuildAppDependsOn>
- $(_BeforeWasmBuildAppDependsOn);
- _SetupEmscripten;
- _SetWasmBuildNativeDefaults;
- _ReadEmccProps
-
-
- <_EmccDefaultFlags Condition="'$(WasmEnableExceptionHandling)' == 'false'">-fexceptions
- <_EmccDefaultFlags Condition="'$(WasmEnableExceptionHandling)' != 'false'">-fwasm-exceptions
- <_EmccDefaultFlags Condition="'$(WasmEnableSIMD)' == 'true'">-msimd128
- <_ExeExt Condition="$([MSBuild]::IsOSPlatform('WINDOWS'))">.exe
- true
-
- <_WasmStrictVersionMatch Condition="'$(WasmUseEMSDK_PATH)' == 'true'">true
-
-
-
-
-
-
-
- <_MonoComponent Include="hot_reload;debugger" />
-
-
-
-
-
-
- <_EMSDKMissingPaths Condition="'$(_EMSDKMissingPaths)' == '' and ('$(EmscriptenSdkToolsPath)' == '' or !Exists('$(EmscriptenSdkToolsPath)'))">%24(EmscriptenSdkToolsPath)=$(EmscriptenSdkToolsPath)
- <_EMSDKMissingPaths Condition="'$(_EMSDKMissingPaths)' == '' and ('$(EmscriptenNodeToolsPath)' == '' or !Exists('$(EmscriptenNodeToolsPath)'))">%24(EmscriptenNodeToolsPath)=$(EmscriptenNodeToolsPath)
- <_EMSDKMissingPaths Condition="'$(_EMSDKMissingPaths)' == '' and ('$(EmscriptenUpstreamBinPath)' == '' or !Exists('$(EmscriptenUpstreamBinPath)'))">%24(EmscriptenUpstreamBinPath)=$(EmscriptenUpstreamBinPath)
-
-
-
- <_EMSDKMissingErrorMessage Condition="'$(EMSDK_PATH)' == '' and '$(EmscriptenSdkToolsPath)' == ''">Could not find emscripten sdk. Either set %24(EMSDK_PATH), or use workloads to get the sdk.
-
- <_EMSDKMissingErrorMessage Condition="'$(_EMSDKMissingErrorMessage)' == '' and '$(_UsingEMSDK_PATH)' != 'true' and '$(_EMSDKMissingPaths)' != ''">Emscripten from the workload is missing some paths: $(_EMSDKMissingPaths).
- <_EMSDKMissingErrorMessage Condition="'$(_EMSDKMissingErrorMessage)' == '' and '$(_UsingEMSDK_PATH)' == 'true' and !Exists($(EMSDK_PATH))">Could not find Emscripten sdk at %24(EMSDK_PATH)=$(EMSDK_PATH) .
- <_EMSDKMissingErrorMessage Condition="'$(_EMSDKMissingErrorMessage)' == '' and '$(_UsingEMSDK_PATH)' == 'true' and '$(_EMSDKMissingPaths)' != ''">Specified Emscripten sdk at %24(EMSDK_PATH)=$(EMSDK_PATH) is missing some paths: $(_EMSDKMissingPaths).
-
- <_IsEMSDKMissing Condition="'$(_EMSDKMissingErrorMessage)' != ''">true
-
-
-
- $([MSBuild]::NormalizeDirectory($(EmscriptenSdkToolsPath)))
- $([MSBuild]::NormalizeDirectory($(EmscriptenNodeToolsPath)))
- $([MSBuild]::NormalizeDirectory($(EmscriptenUpstreamBinPath)))
-
-
-
-
-
-
-
-
-
-
- <_EmscriptenPrependPATHTrimmed Include="$([MSBuild]::ValueOrDefault('%(EmscriptenPrependPATH.Identity)\', '').TrimEnd('\/'))" />
-
-
-
-
-
-
- <_PathSeparator Condition="'$(OS)' == 'Windows_NT'">%3B
- <_PathSeparator Condition="'$(OS)' != 'Windows_NT'">:
-
- <_EmscriptenPrependPATHProperty>@(EmscriptenPrependPATH -> '%(Identity)', '$(_PathSeparator)')
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- <_BoolPropertiesThatTriggerRelinking Include="WasmEnableLegacyJsInterop" DefaultValueInRuntimePack="true" />
- <_BoolPropertiesThatTriggerRelinking Include="WasmEnableSIMD" DefaultValueInRuntimePack="true" />
- <_BoolPropertiesThatTriggerRelinking Include="WasmEnableExceptionHandling" DefaultValueInRuntimePack="true" />
- <_BoolPropertiesThatTriggerRelinking Include="InvariantTimezone" DefaultValueInRuntimePack="false" />
- <_BoolPropertiesThatTriggerRelinking Include="InvariantGlobalization" DefaultValueInRuntimePack="false" />
- <_BoolPropertiesThatTriggerRelinking Include="WasmNativeStrip" DefaultValueInRuntimePack="true" />
-
-
-
-
- true
-
-
-
-
-
- true
-
- true
-
-
-
-
-
- true
- true
-
-
- false
-
-
- true
-
-
-
- false
-
-
-
-
- true
- false
-
-
-
- true
- true
-
-
-
-
-
-
- false
-
-
-
-
-
-
-
-
-
- <_MonoAotCrossCompilerPath>@(MonoAotCrossCompiler->WithMetadataValue('RuntimeIdentifier','browser-wasm'))
- <_EmccDefaultFlagsRsp>$([MSBuild]::NormalizePath($(_WasmRuntimePackSrcDir), 'emcc-default.rsp'))
- <_EmccDefaultLinkFlagsRsp>$([MSBuild]::NormalizePath($(_WasmRuntimePackSrcDir), 'emcc-link.rsp'))
- $(WasmBuildNative)
-
- <_WasmICallTablePath>$(_WasmIntermediateOutputPath)icall-table.h
- <_WasmRuntimeICallTablePath>$(_WasmIntermediateOutputPath)runtime-icall-table.h
- <_WasmPInvokeTablePath>$(_WasmIntermediateOutputPath)pinvoke-table.h
- <_WasmInterpToNativeTablePath>$(_WasmIntermediateOutputPath)wasm_m2n_invoke.g.h
- <_WasmM2NCachePath>$(_WasmIntermediateOutputPath)m2n_cache.txt
- <_WasmPInvokeHPath>$(_WasmRuntimePackIncludeDir)wasm\pinvoke.h
- <_DriverGenCPath>$(_WasmIntermediateOutputPath)driver-gen.c
- false
- $(DisableParallelAot)
-
- <_DriverGenCNeeded Condition="'$(_DriverGenCNeeded)' == '' and '$(_WasmShouldAOT)' == 'true'">true
-
- <_WasmDevel Condition="'$(_WasmDevel)' == '' and '$(WasmBuildNative)' == 'true' and '$(Configuration)' == 'Debug' and '$(WasmBuildingForNestedPublish)' != 'true'">true
-
- <_EmccOptimizationFlagDefault Condition="'$(_WasmDevel)' == 'true'">-O0
- <_EmccOptimizationFlagDefault Condition="'$(_EmccOptimizationFlagDefault)' == '' and '$(Configuration)' == 'Debug' and '$(WasmBuildingForNestedPublish)' != 'true'">-O1
- <_EmccOptimizationFlagDefault Condition="'$(_EmccOptimizationFlagDefault)' == ''">-Oz
-
- $(_EmccOptimizationFlagDefault)
- -O2
- $(EmccCompileOptimizationFlag)
-
- <_EmccCompileRsp>$(_WasmIntermediateOutputPath)emcc-compile.rsp
- <_EmccCompileOutputMessageImportance Condition="'$(EmccVerbose)' == 'true'">Normal
- <_EmccCompileOutputMessageImportance Condition="'$(EmccVerbose)' != 'true'">Low
-
- <_EmccCompileBitcodeRsp>$(_WasmIntermediateOutputPath)emcc-compile-bc.rsp
- <_EmccLinkRsp>$(_WasmIntermediateOutputPath)emcc-link.rsp
-
- $(EmccTotalMemory)
- 5MB
- false
- true
-
-
-
- <_WasmLinkDependencies Remove="@(_WasmLinkDependencies)" />
-
- <_EmccCommonFlags Include="$(_DefaultEmccFlags)" />
- <_EmccCommonFlags Include="$(EmccFlags)" />
- <_EmccCommonFlags Include="-g" Condition="'$(WasmNativeStrip)' == 'false'" />
- <_EmccCommonFlags Include="-v" Condition="'$(EmccVerbose)' != 'false'" />
- <_EmccCommonFlags Include="-s DISABLE_EXCEPTION_CATCHING=0" Condition="'$(WasmEnableExceptionHandling)' == 'false'" />
- <_EmccCommonFlags Include="-fwasm-exceptions" Condition="'$(WasmEnableExceptionHandling)' == 'true'" />
- <_EmccCommonFlags Include="-s MAXIMUM_MEMORY=$(EmccMaximumHeapSize)" Condition="'$(EmccMaximumHeapSize)' != ''" />
-
- <_EmccIncludePaths Include="$(_WasmIntermediateOutputPath.TrimEnd('\/'))" />
- <_EmccIncludePaths Include="$(_WasmRuntimePackIncludeDir)mono-2.0" />
- <_EmccIncludePaths Include="$(_WasmRuntimePackIncludeDir)wasm" />
-
-
- <_EmccCFlags Include="$(EmccCompileOptimizationFlag)" />
- <_EmccCFlags Include="@(_EmccCommonFlags)" />
-
- <_EmccCFlags Include="-DDISABLE_PERFTRACING_LISTEN_PORTS=1" />
- <_EmccCFlags Include="-DENABLE_AOT=1" Condition="'$(_WasmShouldAOT)' == 'true'" />
- <_EmccCFlags Include="-DDRIVER_GEN=1" Condition="'$(_WasmShouldAOT)' == 'true'" />
- <_EmccCFlags Include="-DINVARIANT_GLOBALIZATION=1" Condition="'$(InvariantGlobalization)' == 'true'" />
- <_EmccCFlags Include="-DINVARIANT_TIMEZONE=1" Condition="'$(InvariantTimezone)' == 'true'" />
- <_EmccCFlags Include="-DLINK_ICALLS=1" Condition="'$(WasmLinkIcalls)' == 'true'" />
- <_EmccCFlags Include="-DENABLE_AOT_PROFILER=1" Condition="$(WasmProfilers.Contains('aot'))" />
- <_EmccCFlags Include="-DENABLE_BROWSER_PROFILER=1" Condition="$(WasmProfilers.Contains('browser'))" />
- <_EmccCFlags Include="-DDISABLE_LEGACY_JS_INTEROP=1" Condition="'$(WasmEnableLegacyJsInterop)' == 'false'" />
- <_EmccCFlags Include="-DENABLE_JS_INTEROP_BY_VALUE=1" Condition="'$(WasmEnableJsInteropByValue)' == 'true'" />
-
- <_EmccCFlags Include="-DGEN_PINVOKE=1" />
- <_EmccCFlags Include="-emit-llvm" />
-
- <_EmccCFlags Include=""-I%(_EmccIncludePaths.Identity)"" />
- <_EmccCFlags Include="-g" Condition="'$(WasmNativeDebugSymbols)' == 'true'" />
-
-
- <_EmccLDFlags Include="$(EmccLinkOptimizationFlag)" />
- <_EmccLDFlags Include="@(_EmccCommonFlags)" />
- <_EmccLDFlags Include="-s EXPORT_ES6=1 -lexports.js" />
- <_EmccLDFlags Condition="'$(WasmEnableExceptionHandling)' != 'false'" Include="-s EXPORT_EXCEPTION_HANDLING_HELPERS=1" />
-
- <_DriverCDependencies Include="$(_WasmPInvokeHPath);$(_WasmICallTablePath)" />
- <_DriverCDependencies Include="$(_DriverGenCPath)" Condition="'$(_DriverGenCNeeded)' == 'true'" />
-
- <_WasmRuntimePackSrcFile Include="$(_WasmRuntimePackSrcDir)pinvoke.c"
- Dependencies="$(_WasmPInvokeHPath);$(_WasmPInvokeTablePath)" />
- <_WasmRuntimePackSrcFile Include="$(_WasmRuntimePackSrcDir)driver.c"
- Dependencies="@(_DriverCDependencies)" />
- <_WasmRuntimePackSrcFile Include="$(_WasmRuntimePackSrcDir)corebindings.c" />
-
- <_WasmRuntimePackSrcFile ObjectFile="$(_WasmIntermediateOutputPath)%(FileName).o" />
-
-
-
-
-
-
-
-
-
- <_WasmExtraJSFile Include="$(_WasmRuntimePackSrcDir)\*.%(JSFileType.Identity)" Kind="%(JSFileType.Kind)" />
- <_WasmExtraJSFile Include="$(_WasmRuntimePackSrcDir)\es6\*.%(JSFileType.Identity)" Kind="%(JSFileType.Kind)" />
-
- <_WasmNativeFileForLinking Include="@(NativeFileReference)" />
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- <_EmccLDSFlags Include="-Wl,--allow-undefined" />
- <_EmccLDSFlags Include="-s ERROR_ON_UNDEFINED_SYMBOLS=0" />
-
-
- <_EmccLDSFlags Include="-s LLD_REPORT_UNDEFINED" />
- <_EmccLDSFlags Include="-s ERROR_ON_UNDEFINED_SYMBOLS=1" />
-
-
-
-
-
-
-
- <_WasmPInvokeModules Include="%(_WasmNativeFileForLinking.FileName)" Condition="'%(_WasmNativeFileForLinking.ScanForPInvokes)' != 'false'" />
-
- <_WasmPInvokeModules Include="libSystem.Native" />
- <_WasmPInvokeModules Include="libSystem.IO.Compression.Native" />
- <_WasmPInvokeModules Include="libSystem.Globalization.Native" />
-
-
-
- <_HasMscorlib Condition="'%(_WasmAssembliesInternal.FileName)%(_WasmAssembliesInternal.Extension)' == 'mscorlib.dll'">true
- <_MscorlibPath Condition="'$(_HasMscorlib)' != 'true'">$([System.IO.Path]::Combine($(MicrosoftNetCoreAppRuntimePackRidLibTfmDir), 'mscorlib.dll'))
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- <_EmccCFlags Include="$(EmccExtraCFlags)" />
-
-
-
-
-
-
-
-
- <_WasmSourceFileToCompile Remove="@(_WasmSourceFileToCompile)" />
- <_WasmSourceFileToCompile Include="@(_WasmRuntimePackSrcFile)" Dependencies="%(_WasmRuntimePackSrcFile.Dependencies);$(_EmccDefaultFlagsRsp);$(_EmccCompileRsp)" />
-
-
-
-
-
-
-
-
-
- <_BitCodeFile Dependencies="%(_BitCodeFile.Dependencies);$(_EmccDefaultFlagsRsp);$(_EmccCompileBitcodeRsp)" />
-
-
-
-
-
-
-
-
-
- <_BitcodeLDFlags Include="@(_EmccLDFlags)" />
- <_BitcodeLDFlags Include="$(EmccExtraBitcodeLDFlags)" />
-
-
-
-
-
-
-
-
-
- <_AOTObjectFile Include="%(_BitcodeFile.ObjectFile)" />
-
-
-
-
-
-
-
- <_AOTDataSegmentSize Condition="$([System.String]::Copy('%(LlvmAotSizeOutput.Identity)').StartsWith('DATA '))"
- Include="$([System.String]::Copy('%(LlvmAotSizeOutput.Identity)').Replace("DATA ", "").Replace(" 0", "").Trim())" />
-
-
-
-
-
-
- $(_WasmCalculatedInitialHeapSize)
- 16777216
-
-
-
-
-
- <_WasmEHLib Condition="'$(WasmEnableExceptionHandling)' == 'true'">libmono-wasm-eh-wasm.a
- <_WasmEHLib Condition="'$(WasmEnableExceptionHandling)' != 'true'">libmono-wasm-eh-js.a
- <_WasmEHLibToExclude Condition="'$(WasmEnableExceptionHandling)' == 'true'">libmono-wasm-eh-js.a
- <_WasmEHLibToExclude Condition="'$(WasmEnableExceptionHandling)' != 'true'">libmono-wasm-eh-wasm.a
- <_WasmSIMDLib Condition="'$(WasmEnableSIMD)' == 'true'">libmono-wasm-simd.a
- <_WasmSIMDLib Condition="'$(WasmEnableSIMD)' != 'true'">libmono-wasm-nosimd.a
- <_WasmSIMDLibToExclude Condition="'$(WasmEnableSIMD)' != 'true'">libmono-wasm-simd.a
- <_WasmSIMDLibToExclude Condition="'$(WasmEnableSIMD)' == 'true'">libmono-wasm-nosimd.a
- <_EmccExportedLibraryFunction>"[@(EmccExportedLibraryFunction -> '%27%(Identity)%27', ',')]"
- <_EmccExportedRuntimeMethods>"[@(EmccExportedRuntimeMethod -> '%27%(Identity)%27', ',')]"
- <_EmccExportedFunctions>@(EmccExportedFunction -> '%(Identity)',',')
-
-
-
-
- <_EmccLDSFlags Include="-s INITIAL_MEMORY=$(EmccInitialHeapSize)" />
- <_EmccLDSFlags Include="-s STACK_SIZE=$(EmccStackSize)" />
- <_EmccLDSFlags Include="-s WASM_BIGINT=1" />
- <_EmccLDSFlags Condition="'$(EmccEnvironment)' != ''" Include="-s ENVIRONMENT="$(EmccEnvironment)"" />
- <_EmccLDSFlags Condition="'$(EmccEnableAssertions)' == 'true'" Include="-s ASSERTIONS=1" />
-
- <_WasmNativeFileForLinking Include="%(_BitcodeFile.ObjectFile)" />
- <_WasmNativeFileForLinking Include="%(_WasmSourceFileToCompile.ObjectFile)" />
-
- <_WasmNativeFileForLinking
- Include="$(MicrosoftNetCoreAppRuntimePackRidNativeDir)*.a"
- Exclude="@(_MonoRuntimeComponentDontLink->'$(MicrosoftNetCoreAppRuntimePackRidNativeDir)%(Identity)')" />
- <_WasmNativeFileForLinking Include="$(MicrosoftNetCoreAppRuntimePackRidNativeDir)$(_WasmEHLib)" />
- <_WasmNativeFileForLinking Condition="'$(_WasmSIMDLib)' != ''" Include="$(MicrosoftNetCoreAppRuntimePackRidNativeDir)$(_WasmSIMDLib)" />
- <_WasmNativeFileForLinking Remove="$(MicrosoftNetCoreAppRuntimePackRidNativeDir)$(_WasmEHLibToExclude)" />
- <_WasmNativeFileForLinking Remove="$(MicrosoftNetCoreAppRuntimePackRidNativeDir)$(_WasmSIMDLibToExclude)" />
-
- <_WasmExtraJSFile Include="@(Content)" Condition="'%(Content.Extension)' == '.js'" />
-
- <_EmccLinkStepArgs Include="@(_EmccLDFlags)" />
- <_EmccLinkStepArgs Include="@(_EmccLDSFlags)" />
- <_EmccLinkStepArgs Include="--emit-symbol-map" Condition="'$(WasmEmitSymbolMap)' == 'true'" />
-
- <_EmccLinkStepArgs Include="--%(_WasmExtraJSFile.Kind) "%(_WasmExtraJSFile.Identity)"" Condition="'%(_WasmExtraJSFile.Kind)' != ''" />
- <_WasmLinkDependencies Include="@(_WasmExtraJSFile)" />
-
- <_EmccLinkStepArgs Include=""%(_WasmNativeFileForLinking.Identity)"" />
- <_WasmLinkDependencies Include="@(_WasmNativeFileForLinking)" />
-
- <_EmccLinkStepArgs Include="-o "$(_WasmIntermediateOutputPath)dotnet.native.js"" />
- <_WasmLinkDependencies Include="$(_EmccLinkRsp)" />
-
- <_EmccLinkStepArgs Include="-s DEFAULT_LIBRARY_FUNCS_TO_INCLUDE=$(_EmccExportedLibraryFunction)" Condition="'$(_EmccExportedLibraryFunction)' != ''" />
- <_EmccLinkStepArgs Include="-s EXPORTED_RUNTIME_METHODS=$(_EmccExportedRuntimeMethods)" />
- <_EmccLinkStepArgs Include="-s EXPORTED_FUNCTIONS=$(_EmccExportedFunctions)" />
-
- <_EmccLinkStepArgs Include="$(EmccExtraLDFlags)" />
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- <_WasmAssembliesInternal Remove="$(_WasmDedupAssembly)"/>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- <_EmccVersionCommand>emcc --version
-
-
-
-
-
-
-
-
-
-
-
-
- <_ReversedVersionLines Include="@(_VersionLines->Reverse())" />
-
-
- %(_ReversedVersionLines.Identity)
- <_VersionMismatchMessage>Emscripten version mismatch. The runtime pack in $(MicrosoftNetCoreAppRuntimePackDir) expects '$(RuntimeEmccVersionRaw)', but emcc being used has version '$(ActualEmccVersionRaw)'. This might cause build failures.
-
-
-
-
-
-
-
-
-
-
-
- <_MonoAotCrossCompilerPath>@(MonoAotCrossCompiler->WithMetadataValue('RuntimeIdentifier','browser-wasm'))
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- <_AotInputAssemblies Include="@(_WasmAssembliesInternal)">
- @(MonoAOTCompilerDefaultAotArguments, ';')
- @(MonoAOTCompilerDefaultProcessArguments, ';')
-
-
- <_WasmAssembliesInternal Remove="@(_WasmAssembliesInternal)" />
-
- <_WasmAOTSearchPaths Include="$(MicrosoftNetCoreAppRuntimePackRidNativeDir)" />
- <_WasmAOTSearchPaths Include="$(MicrosoftNetCoreAppRuntimePackRidLibTfmDir)" />
-
-
-
-
- <_AotInputAssemblies Condition="'%(Filename)' != '' and '@(_AotInputAssemblies->Metadata(`Filename`))' != '' and '@(_AOT_InternalForceInterpretAssemblies->Metadata(`Filename`))' != ''">
- true
-
-
-
-
-
- LLVMOnlyInterp
- <_AOTCompilerCacheFile>$(_WasmIntermediateOutputPath)aot_compiler_cache.json
-
-
-
-
-
-
- <_WasmDedupAssembly>$(_WasmIntermediateOutputPath)\aot-instances.dll
-
-
-
-
- <_AotInputAssemblies Include="$(_WasmDedupAssembly)">
- @(MonoAOTCompilerDefaultAotArguments, ';')
- @(MonoAOTCompilerDefaultProcessArguments, ';')
-
-
-
-
-
-
-
-
-
-
-
-
-
- <_WasmAssembliesInternal Remove="@(_WasmAssembliesInternal)"/>
- <_WasmAssembliesInternal Include="@(_UpdatedAssembliesAfterILStrip)"/>
-
-
-
- <_BitcodeFile Include="%(_WasmAssembliesInternal.LlvmBitcodeFile)" />
- <_BitcodeFile ObjectFile="$(_WasmIntermediateOutputPath)%(FileName).o" />
-
-
- <_WasmAssembliesInternal Include="@(_AotInputAssemblies->WithMetadataValue('AOT_InternalForceToInterpret', 'true'))" />
-
-
-
-
-
- <_AssembliesToScan Include="@(_WasmAssembliesInternal)" />
-
-
-
-
-
-
-
- <_MonoComponent Include="marshal-ilgen" />
-
-
-
-
-
-
- <_WasmStrippedAssembliesPath>$([MSBuild]::NormalizeDirectory($(_WasmIntermediateOutputPath), 'stripped-assemblies'))
-
-
-
- <_AOTedAssemblies Include="@(_WasmAssembliesInternal)" />
- <_WasmStrippedAssemblies
- Include="@(_AOTedAssemblies)"
- OriginalPath="%(_WasmAssembliesInternal.Identity)" />
-
-
-
-
-
-
-
-
- <_WasmAssembliesInternal Remove="@(_WasmAssembliesInternal)" />
- <_WasmAssembliesInternal Include="@(_WasmStrippedAssemblies)" />
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/mono/wasm/build/WasmApp.props b/src/mono/wasm/build/WasmApp.props
index 54eb73ed45d45a..6de307e2d5f7d0 100644
--- a/src/mono/wasm/build/WasmApp.props
+++ b/src/mono/wasm/build/WasmApp.props
@@ -1,27 +1,10 @@
- wasm
browser
browser-wasm
- true
-
- <_WasmBuildCoreDependsOn>
- _InitializeCommonProperties;
- _BeforeWasmBuildApp;
- _WasmResolveReferences;
- _WasmBuildNativeCore;
- _WasmGenerateAppBundle;
- _AfterWasmBuildApp
-
-
-
- _PrepareForAfterBuild;
- $(_WasmBuildCoreDependsOn)
-
-
-
- _PrepareForNestedPublish;
- $(_WasmBuildCoreDependsOn)
-
+ _WasmGenerateAppBundle
+ true
+
+
diff --git a/src/mono/wasm/build/WasmApp.targets b/src/mono/wasm/build/WasmApp.targets
index bde671b2f05f8c..3e7d059c20849d 100644
--- a/src/mono/wasm/build/WasmApp.targets
+++ b/src/mono/wasm/build/WasmApp.targets
@@ -1,377 +1,75 @@
+
+
-
-
-
-
- true
+
+ $(PrepareInputsForWasmBuildDependsOn);
+ _ReadEmccProps
+
+
+
+ _CheckToolchainIsExpectedVersion;
+ _PrepareForBrowserWasmBuildNative;
+ $(PrepareForWasmBuildNativeDependsOn)
+
+
+
+ $(WasmLinkDotNetDependsOn);
+ _BrowserWasmLinkDotNet;
+
+
+
+ $(WasmGenerateAppBundleDependsOn);
+ _GetWasmGenerateAppBundleDependencies;
+ _WasmGenerateAppBundle;
+ _WasmGenerateRunV8Script;
+
+
true
$(WasmEnableExceptionHandling)
true
true
false
-
-
-
- false
-
- <_BeforeWasmBuildAppDependsOn />
-
- true
- Build
-
- Publish
- <_WasmNestedPublishAppPreTarget Condition="'$(DisableAutoWasmPublishApp)' != 'true'">Publish
-
- true
-
- true
- true
- false
- false
- full
- <_ExtraTrimmerArgs Condition="'$(WasmEnableSIMD)' == 'true' and '$(RunAOTCompilation)' == 'true'">$(_ExtraTrimmerArgs) --substitutions "$(MSBuildThisFileDirectory)ILLink.Substitutions.WasmIntrinsics.xml"
- <_ExtraTrimmerArgs Condition="'$(WasmEnableSIMD)' != 'true'">$(_ExtraTrimmerArgs) --substitutions "$(MSBuildThisFileDirectory)ILLink.Substitutions.NoWasmIntrinsics.xml"
- <_ExtraTrimmerArgs Condition="'$(WasmEnableLegacyJsInterop)' == 'false'">$(_ExtraTrimmerArgs) --substitutions "$(MSBuildThisFileDirectory)ILLink.Substitutions.LegacyJsInterop.xml"
+ true
false
-
- -1
-
true
.wasm
.dll
true
-
_framework
-
-
-
-
-
-
-
-
-
-
-
- false
-
-
-
-
- <_AppBundleDirForRunCommand Condition="'$(WasmAppDir)' != ''">$(WasmAppDir)
-
-
-
-
- <_AppBundleDirForRunCommand Condition="'$(_AppBundleDirForRunCommand)' == '' and '$(UseArtifactsOutput)' == '' and '$(AppendRuntimeIdentifierToOutputPath)' != 'false'">$([System.IO.Path]::Combine($(OutputPath), 'browser-wasm', 'AppBundle'))
+ full
-
- <_AppBundleDirForRunCommand Condition="'$(_AppBundleDirForRunCommand)' == ''">$([System.IO.Path]::Combine($(OutputPath), 'AppBundle'))
+ <_WasmGenerateAppBundleDependsOn>_GetWasmGenerateAppBundleDependencies;$(_WasmGenerateAppBundleDependsOn)
-
- <_AppBundleDirForRunCommand Condition="'$(_AppBundleDirForRunCommand)' != '' and !$([System.IO.Path]::IsPathRooted($(_AppBundleDirForRunCommand)))">$([System.IO.Path]::Combine($(MSBuildProjectDirectory), $(_AppBundleDirForRunCommand)))
-
+ <_ExtraTrimmerArgs Condition="'$(WasmEnableSIMD)' == 'true' and '$(RunAOTCompilation)' == 'true'">$(_ExtraTrimmerArgs) --substitutions "$(MSBuildThisFileDirectory)ILLink.Substitutions.WasmIntrinsics.xml"
+ <_ExtraTrimmerArgs Condition="'$(WasmEnableSIMD)' != 'true'">$(_ExtraTrimmerArgs) --substitutions "$(MSBuildThisFileDirectory)ILLink.Substitutions.NoWasmIntrinsics.xml"
+ <_ExtraTrimmerArgs Condition="'$(WasmEnableLegacyJsInterop)' == 'false'">$(_ExtraTrimmerArgs) --substitutions "$(MSBuildThisFileDirectory)ILLink.Substitutions.LegacyJsInterop.xml"
-
- $(DOTNET_HOST_PATH)
- dotnet
+ true
+ emcc
- <_RuntimeConfigJsonPath>$([MSBuild]::NormalizePath($(_AppBundleDirForRunCommand), '$(AssemblyName).runtimeconfig.json'))
- exec "$([MSBuild]::NormalizePath($(WasmAppHostDir), 'WasmAppHost.dll'))" --runtime-config "$(_RuntimeConfigJsonPath)" $(WasmHostArguments)
- $(_AppBundleDirForRunCommand)
+ <_WasmDefaultFlags Condition="'$(WasmEnableExceptionHandling)' == 'false'">-fexceptions
+ <_WasmDefaultFlags Condition="'$(WasmEnableExceptionHandling)' != 'false'">-fwasm-exceptions
+ <_WasmDefaultFlags Condition="'$(WasmEnableSIMD)' == 'true'">-msimd128
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- <_WasmRuntimeConfigFilePath Condition="$([System.String]::new(%(PublishItemsOutputGroupOutputs.Identity)).EndsWith('$(AssemblyName).runtimeconfig.json'))">@(PublishItemsOutputGroupOutputs)
-
-
-
-
-
-
-
-
- <_WasmRuntimeConfigFilePath Condition="$([System.String]::new(%(PublishItemsOutputGroupOutputs.Identity)).EndsWith('$(AssemblyName).runtimeconfig.json'))">@(PublishItemsOutputGroupOutputs)
-
-
-
-
-
-
-
-
-
-
-
-
-
- %(ResolvedRuntimePack.PackageDirectory)
- $([MSBuild]::NormalizeDirectory($(MicrosoftNetCoreAppRuntimePackDir), 'runtimes', 'browser-wasm'))
- $([MSBuild]::NormalizeDirectory($(MicrosoftNetCoreAppRuntimePackRidDir)))
- $([MSBuild]::NormalizeDirectory($(MicrosoftNetCoreAppRuntimePackRidDir), 'native'))
-
- <_WasmRuntimePackIncludeDir>$([MSBuild]::NormalizeDirectory($(MicrosoftNetCoreAppRuntimePackRidNativeDir), 'include'))
- <_WasmRuntimePackSrcDir>$([MSBuild]::NormalizeDirectory($(MicrosoftNetCoreAppRuntimePackRidNativeDir), 'src'))
-
- <_WasmIntermediateOutputPath Condition="'$(WasmBuildingForNestedPublish)' == ''">$([MSBuild]::NormalizeDirectory($(IntermediateOutputPath), 'wasm', 'for-build'))
- <_WasmIntermediateOutputPath Condition="'$(WasmBuildingForNestedPublish)' != ''">$([MSBuild]::NormalizeDirectory($(IntermediateOutputPath), 'wasm', 'for-publish'))
-
- <_DriverGenCPath>$(_WasmIntermediateOutputPath)driver-gen.c
- <_WasmShouldAOT Condition="'$(WasmBuildingForNestedPublish)' == 'true' and '$(RunAOTCompilation)' == 'true'">true
- <_WasmShouldAOT Condition="'$(RunAOTCompilationAfterBuild)' == 'true' and '$(RunAOTCompilation)' == 'true'">true
- <_WasmShouldAOT Condition="'$(_WasmShouldAOT)' == ''">false
-
-
-
-
- <_SystemRuntimePathItem Include="$(MicrosoftNetCoreAppRuntimePackRidDir)\lib\net*\System.Runtime.dll" />
-
-
-
-
-
-
- $([System.IO.Path]::GetDirectoryName(%(_SystemRuntimePathItem.Identity)))
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- $([MSBuild]::NormalizeDirectory($(OutputPath), 'AppBundle'))
-
- $(TargetFileName)
-
- $([System.IO.Path]::GetFileName($(WasmMainAssemblyFileName)))
-
- $([MSBuild]::NormalizeDirectory($(WasmAppDir)))
-
- <_MainAssemblyPath Condition="'%(WasmAssembliesToBundle.FileName)' == $(AssemblyName) and '%(WasmAssembliesToBundle.Extension)' == '.dll' and $(WasmGenerateAppBundle) == 'true'">%(WasmAssembliesToBundle.Identity)
- <_WasmRuntimeConfigFilePath Condition="'$(_WasmRuntimeConfigFilePath)' == '' and $(_MainAssemblyPath) != ''">$([System.IO.Path]::ChangeExtension($(_MainAssemblyPath), '.runtimeconfig.json'))
- <_ParsedRuntimeConfigFilePath Condition="'$(_WasmRuntimeConfigFilePath)' != ''">$([System.IO.Path]::GetDirectoryName($(_WasmRuntimeConfigFilePath)))\runtimeconfig.bin
-
-
-
-
-
-
-
- <_WasmAssembliesInternal Remove="@(_WasmAssembliesInternal)" />
- <_WasmAssembliesInternal Include="@(WasmAssembliesToBundle->Distinct())" />
-
- <_WasmSatelliteAssemblies Remove="@(_WasmSatelliteAssemblies)" />
- <_WasmSatelliteAssemblies Include="@(_WasmAssembliesInternal)" />
- <_WasmSatelliteAssemblies Remove="@(_WasmSatelliteAssemblies)" Condition="!$([System.String]::Copy('%(Identity)').EndsWith('.resources.dll'))" />
-
- <_WasmSatelliteAssemblies CultureName="$([System.IO.Directory]::GetParent('%(Identity)').Name)" />
-
- <_WasmAssembliesInternal Remove="@(_WasmSatelliteAssemblies)" />
-
-
-
-
-
- <_RuntimeConfigReservedProperties Include="RUNTIME_IDENTIFIER"/>
- <_RuntimeConfigReservedProperties Include="APP_CONTEXT_BASE_DIRECTORY"/>
-
-
-
-
+
+
+
-
-
-
-
+ <_BoolPropertiesThatTriggerRelinking Include="WasmEnableLegacyJsInterop" DefaultValueInRuntimePack="true" />
+ <_BoolPropertiesThatTriggerRelinking Include="WasmEnableSIMD" DefaultValueInRuntimePack="true" />
+ <_BoolPropertiesThatTriggerRelinking Include="WasmEnableExceptionHandling" DefaultValueInRuntimePack="true" />
+ <_BoolPropertiesThatTriggerRelinking Include="WasmNativeStrip" DefaultValueInRuntimePack="true" />
+
@@ -422,8 +120,7 @@
+ Condition="'$(WasmGenerateAppBundle)' == 'true'">
<_WasmAppIncludeThreadsWorker Condition="'$(WasmEnableThreads)' == 'true' or '$(MonoWasmBuildVariant)' == 'multithread'">true
@@ -466,7 +163,6 @@
-
@@ -474,7 +170,428 @@
-
+
+
+
+ <_EMSDKMissingPaths Condition="'$(_EMSDKMissingPaths)' == '' and ('$(EmscriptenSdkToolsPath)' == '' or !Exists('$(EmscriptenSdkToolsPath)'))">%24(EmscriptenSdkToolsPath)=$(EmscriptenSdkToolsPath)
+ <_EMSDKMissingPaths Condition="'$(_EMSDKMissingPaths)' == '' and ('$(EmscriptenNodeToolsPath)' == '' or !Exists('$(EmscriptenNodeToolsPath)'))">%24(EmscriptenNodeToolsPath)=$(EmscriptenNodeToolsPath)
+ <_EMSDKMissingPaths Condition="'$(_EMSDKMissingPaths)' == '' and ('$(EmscriptenUpstreamBinPath)' == '' or !Exists('$(EmscriptenUpstreamBinPath)'))">%24(EmscriptenUpstreamBinPath)=$(EmscriptenUpstreamBinPath)
+
+
+
+ <_ToolchainMissingErrorMessage Condition="'$(EMSDK_PATH)' == '' and '$(EmscriptenSdkToolsPath)' == ''">Could not find emscripten sdk. Either set %24(EMSDK_PATH), or use workloads to get the sdk.
+
+ <_ToolchainMissingErrorMessage Condition="'$(_ToolchainMissingErrorMessage)' == '' and '$(_UsingEMSDK_PATH)' != 'true' and '$(_EMSDKMissingPaths)' != ''">Emscripten from the workload is missing some paths: $(_EMSDKMissingPaths).
+ <_ToolchainMissingErrorMessage Condition="'$(_ToolchainMissingErrorMessage)' == '' and '$(_UsingEMSDK_PATH)' == 'true' and !Exists($(EMSDK_PATH))">Could not find Emscripten sdk at %24(EMSDK_PATH)=$(EMSDK_PATH) .
+ <_ToolchainMissingErrorMessage Condition="'$(_ToolchainMissingErrorMessage)' == '' and '$(_UsingEMSDK_PATH)' == 'true' and '$(_EMSDKMissingPaths)' != ''">Specified Emscripten sdk at %24(EMSDK_PATH)=$(EMSDK_PATH) is missing some paths: $(_EMSDKMissingPaths).
+
+ <_IsToolchainMissing Condition="'$(_ToolchainMissingErrorMessage)' != ''">true
+
+
+
+ $([MSBuild]::NormalizeDirectory($(EmscriptenSdkToolsPath)))
+ $([MSBuild]::NormalizeDirectory($(EmscriptenNodeToolsPath)))
+ $([MSBuild]::NormalizeDirectory($(EmscriptenUpstreamBinPath)))
+
+
+
+
+
+
+
+
+
+
+ <_EmscriptenPrependPATHTrimmed Include="$([MSBuild]::ValueOrDefault('%(EmscriptenPrependPATH.Identity)\', '').TrimEnd('\/'))" />
+
+
+
+
+
+
+ <_PathSeparator Condition="'$(OS)' == 'Windows_NT'">%3B
+ <_PathSeparator Condition="'$(OS)' != 'Windows_NT'">:
+
+ <_EmscriptenPrependPATHProperty>@(EmscriptenPrependPATH -> '%(Identity)', '$(_PathSeparator)')
+
+
+
+
+
+
+
+
+
+
+
+ <_WasmLLVMPathForAOT>$(EmscriptenUpstreamBinPath)
+
+
+
+
+
+
+
+ <_MonoAotCrossCompilerPath>@(MonoAotCrossCompiler->WithMetadataValue('RuntimeIdentifier', $(RuntimeIdentifier)))
+ <_WasmDefaultFlagsRsp>$([MSBuild]::NormalizePath($(_WasmRuntimePackSrcDir), 'emcc-default.rsp'))
+ <_WasmDefaultLinkFlagsRsp>$([MSBuild]::NormalizePath($(_WasmRuntimePackSrcDir), 'emcc-link.rsp'))
+
+ $(WasmBuildNative)
+
+ <_WasmICallTablePath>$(_WasmIntermediateOutputPath)icall-table.h
+ <_WasmRuntimeICallTablePath>$(_WasmIntermediateOutputPath)runtime-icall-table.h
+ <_WasmPInvokeTablePath>$(_WasmIntermediateOutputPath)pinvoke-table.h
+ <_WasmInterpToNativeTablePath>$(_WasmIntermediateOutputPath)wasm_m2n_invoke.g.h
+ <_WasmM2NCachePath>$(_WasmIntermediateOutputPath)m2n_cache.txt
+ <_WasmPInvokeHPath>$(_WasmRuntimePackIncludeDir)wasm\pinvoke.h
+ <_DriverGenCPath>$(_WasmIntermediateOutputPath)driver-gen.c
+ false
+ $(DisableParallelAot)
+
+ <_DriverGenCNeeded Condition="'$(_DriverGenCNeeded)' == '' and '$(_WasmShouldAOT)' == 'true'">true
+
+ <_WasmDevel Condition="'$(_WasmDevel)' == '' and '$(WasmBuildNative)' == 'true' and '$(Configuration)' == 'Debug' and '$(WasmBuildingForNestedPublish)' != 'true'">true
+
+ <_EmccOptimizationFlagDefault Condition="'$(_WasmDevel)' == 'true'">-O0
+ <_EmccOptimizationFlagDefault Condition="'$(_EmccOptimizationFlagDefault)' == '' and '$(Configuration)' == 'Debug' and '$(WasmBuildingForNestedPublish)' != 'true'">-O1
+ <_EmccOptimizationFlagDefault Condition="'$(_EmccOptimizationFlagDefault)' == ''">-Oz
+
+ $(_EmccOptimizationFlagDefault)
+
+ $(EmccCompileOptimizationFlag)
+ -O2
+ $(WasmCompileOptimizationFlag)
+ $(EmccLinkOptimizationFlag)
+
+ <_WasmCompileRsp>$(_WasmIntermediateOutputPath)emcc-compile.rsp
+ <_WasmCompileOutputMessageImportance Condition="'$(EmccVerbose)' == 'true'">Normal
+ <_WasmCompileOutputMessageImportance Condition="'$(EmccVerbose)' != 'true'">Low
+
+ <_WasmCompileBitcodeRsp>$(_WasmIntermediateOutputPath)emcc-compile-bc.rsp
+ <_WasmLinkRsp>$(_WasmIntermediateOutputPath)emcc-link.rsp
+
+ $(EmccTotalMemory)
+ $(EmccInitialHeapSize)
+ 5MB
+ false
+ true
+
+ $(EmscriptenUpstreamEmscriptenPath)emcc
+
+
+
+ <_WasmLinkDependencies Remove="@(_WasmLinkDependencies)" />
+
+ <_EmccCommonFlags Include="$(_DefaultEmccFlags)" />
+ <_EmccCommonFlags Include="$(EmccFlags)" />
+ <_EmccCommonFlags Include="-g" Condition="'$(WasmNativeDebugSymbols)' == 'true'" />
+ <_EmccCommonFlags Include="-v" Condition="'$(EmccVerbose)' != 'false'" />
+ <_EmccCommonFlags Include="-s DISABLE_EXCEPTION_CATCHING=0" Condition="'$(WasmEnableExceptionHandling)' == 'false'" />
+ <_EmccCommonFlags Include="-fwasm-exceptions" Condition="'$(WasmEnableExceptionHandling)' == 'true'" />
+ <_EmccCommonFlags Include="-s MAXIMUM_MEMORY=$(EmccMaximumHeapSize)" Condition="'$(EmccMaximumHeapSize)' != ''" />
+
+ <_EmccIncludePaths Include="$(_WasmIntermediateOutputPath.TrimEnd('\/'))" />
+ <_EmccIncludePaths Include="$(_WasmRuntimePackIncludeDir)mono-2.0" />
+ <_EmccIncludePaths Include="$(_WasmRuntimePackIncludeDir)wasm" />
+
+
+ <_EmccCFlags Include="$(WasmCompileOptimizationFlag)" />
+ <_EmccCFlags Include="@(_EmccCommonFlags)" />
+
+ <_EmccCFlags Include="-DDISABLE_PERFTRACING_LISTEN_PORTS=1" />
+ <_EmccCFlags Include="-DENABLE_AOT=1" Condition="'$(_WasmShouldAOT)' == 'true'" />
+ <_EmccCFlags Include="-DDRIVER_GEN=1" Condition="'$(_WasmShouldAOT)' == 'true'" />
+ <_EmccCFlags Include="-DINVARIANT_GLOBALIZATION=1" Condition="'$(InvariantGlobalization)' == 'true'" />
+ <_EmccCFlags Include="-DINVARIANT_TIMEZONE=1" Condition="'$(InvariantTimezone)' == 'true'" />
+ <_EmccCFlags Include="-DLINK_ICALLS=1" Condition="'$(WasmLinkIcalls)' == 'true'" />
+ <_EmccCFlags Include="-DENABLE_AOT_PROFILER=1" Condition="$(WasmProfilers.Contains('aot'))" />
+ <_EmccCFlags Include="-DENABLE_BROWSER_PROFILER=1" Condition="$(WasmProfilers.Contains('browser'))" />
+ <_EmccCFlags Include="-DDISABLE_LEGACY_JS_INTEROP=1" Condition="'$(WasmEnableLegacyJsInterop)' == 'false'" />
+ <_EmccCFlags Include="-DENABLE_JS_INTEROP_BY_VALUE=1" Condition="'$(WasmEnableJsInteropByValue)' == 'true'" />
+
+ <_EmccCFlags Include="-DGEN_PINVOKE=1" />
+ <_EmccCFlags Include="-emit-llvm" />
+
+ <_EmccCFlags Include=""-I%(_EmccIncludePaths.Identity)"" />
+
+
+ <_EmccLDFlags Include="$(WasmLinkOptimizationFlag)" />
+ <_EmccLDFlags Include="@(_EmccCommonFlags)" />
+ <_EmccLDFlags Include="-s EXPORT_ES6=1" />
+ <_EmccLDFlags Condition="'$(WasmEnableExceptionHandling)' != 'false'" Include="-s EXPORT_EXCEPTION_HANDLING_HELPERS=1" />
+
+ <_DriverCDependencies Include="$(_WasmPInvokeHPath);$(_WasmICallTablePath)" />
+ <_DriverCDependencies Include="$(_DriverGenCPath)" Condition="'$(_DriverGenCNeeded)' == 'true'" />
+
+ <_WasmRuntimePackSrcFile Include="$(_WasmRuntimePackSrcDir)pinvoke.c"
+ Dependencies="$(_WasmPInvokeHPath);$(_WasmPInvokeTablePath)" />
+ <_WasmRuntimePackSrcFile Include="$(_WasmRuntimePackSrcDir)driver.c"
+ Dependencies="@(_DriverCDependencies)" />
+ <_WasmRuntimePackSrcFile Include="$(_WasmRuntimePackSrcDir)corebindings.c" />
+
+ <_WasmRuntimePackSrcFile ObjectFile="$(_WasmIntermediateOutputPath)%(FileName).o" />
+
+
+
+
+
+
+
+
+
+ <_WasmExtraJSFile Include="$(_WasmRuntimePackSrcDir)\*.%(JSFileType.Identity)" Kind="%(JSFileType.Kind)" />
+ <_WasmExtraJSFile Include="$(_WasmRuntimePackSrcDir)\es6\*.%(JSFileType.Identity)" Kind="%(JSFileType.Kind)" />
+
+ <_WasmNativeFileForLinking Include="@(NativeFileReference)" />
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <_EmccLDSFlags Include="-Wl,--allow-undefined" />
+ <_EmccLDSFlags Include="-s ERROR_ON_UNDEFINED_SYMBOLS=0" />
+
+
+ <_EmccLDSFlags Include="-s LLD_REPORT_UNDEFINED" />
+ <_EmccLDSFlags Include="-s ERROR_ON_UNDEFINED_SYMBOLS=1" />
+
+
+
+ <_WasmBundleItem
+ Include="@(_WasmAssembliesInternal)"
+ BundleRegistrationFunctionName="mono_register_assemblies_bundle"
+ BundleFile="wasm_bundled_assemblies.o" />
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <_EmccCFlags Include="$(EmccExtraCFlags)" />
+ <_WasmCFlags Include="@(_EmccCFlags)" />
+
+
+
+
+
+ <_BitcodeLDFlags Include="@(_EmccLDFlags)" />
+ <_BitcodeLDFlags Include="$(EmccExtraBitcodeLDFlags)" />
+
+
+
+
+
+ <_WasmEHLib Condition="'$(WasmEnableExceptionHandling)' == 'true'">libmono-wasm-eh-wasm.a
+ <_WasmEHLib Condition="'$(WasmEnableExceptionHandling)' != 'true'">libmono-wasm-eh-js.a
+ <_WasmEHLibToExclude Condition="'$(WasmEnableExceptionHandling)' == 'true'">libmono-wasm-eh-js.a
+ <_WasmEHLibToExclude Condition="'$(WasmEnableExceptionHandling)' != 'true'">libmono-wasm-eh-wasm.a
+ <_WasmSIMDLib Condition="'$(WasmEnableSIMD)' == 'true'">libmono-wasm-simd.a
+ <_WasmSIMDLib Condition="'$(WasmEnableSIMD)' != 'true'">libmono-wasm-nosimd.a
+ <_WasmSIMDLibToExclude Condition="'$(WasmEnableSIMD)' != 'true'">libmono-wasm-simd.a
+ <_WasmSIMDLibToExclude Condition="'$(WasmEnableSIMD)' == 'true'">libmono-wasm-nosimd.a
+ <_EmccExportedLibraryFunction>"[@(EmccExportedLibraryFunction -> '%27%(Identity)%27', ',')]"
+ <_EmccExportedRuntimeMethods>"[@(EmccExportedRuntimeMethod -> '%27%(Identity)%27', ',')]"
+ <_EmccExportedFunctions>@(EmccExportedFunction -> '%(Identity)',',')
+
+
+
+
+ <_EmccLDSFlags Include="-s INITIAL_MEMORY=$(WasmInitialHeapSize)" />
+ <_EmccLDSFlags Include="-s STACK_SIZE=$(EmccStackSize)" />
+ <_EmccLDSFlags Include="-s WASM_BIGINT=1" />
+ <_EmccLDSFlags Condition="'$(EmccEnvironment)' != ''" Include="-s ENVIRONMENT="$(EmccEnvironment)"" />
+ <_EmccLDSFlags Condition="'$(EmccEnableAssertions)' == 'true'" Include="-s ASSERTIONS=1" />
+
+ <_WasmNativeFileForLinking Include="%(_BitcodeFile.ObjectFile)" />
+ <_WasmNativeFileForLinking Include="%(_WasmSourceFileToCompile.ObjectFile)" />
+ <_WasmNativeFileForLinking Include="@(_WasmObjectFilesForBundle)" />
+
+ <_WasmNativeFileForLinking
+ Include="$(MicrosoftNetCoreAppRuntimePackRidNativeDir)*.a"
+ Exclude="@(_MonoRuntimeComponentDontLink->'$(MicrosoftNetCoreAppRuntimePackRidNativeDir)%(Identity)')" />
+ <_WasmNativeFileForLinking Include="$(MicrosoftNetCoreAppRuntimePackRidNativeDir)$(_WasmEHLib)" />
+ <_WasmNativeFileForLinking Condition="'$(_WasmSIMDLib)' != ''" Include="$(MicrosoftNetCoreAppRuntimePackRidNativeDir)$(_WasmSIMDLib)" />
+ <_WasmNativeFileForLinking Remove="$(MicrosoftNetCoreAppRuntimePackRidNativeDir)$(_WasmEHLibToExclude)" />
+ <_WasmNativeFileForLinking Remove="$(MicrosoftNetCoreAppRuntimePackRidNativeDir)$(_WasmSIMDLibToExclude)" />
+
+ <_WasmExtraJSFile Include="@(Content)" Condition="'%(Content.Extension)' == '.js'" />
+
+ <_EmccLinkStepArgs Include="@(_EmccLDFlags)" />
+ <_EmccLinkStepArgs Include="@(_EmccLDSFlags)" />
+ <_EmccLinkStepArgs Include="--emit-symbol-map" Condition="'$(WasmEmitSymbolMap)' == 'true'" />
+
+ <_EmccLinkStepArgs Include="--%(_WasmExtraJSFile.Kind) "%(_WasmExtraJSFile.Identity)"" Condition="'%(_WasmExtraJSFile.Kind)' != ''" />
+ <_WasmLinkDependencies Include="@(_WasmExtraJSFile)" />
+
+ <_EmccLinkStepArgs Include=""%(_WasmNativeFileForLinking.Identity)"" />
+ <_WasmLinkDependencies Include="@(_WasmNativeFileForLinking)" />
+
+ <_EmccLinkStepArgs Include="-o "$(_WasmIntermediateOutputPath)dotnet.native.js"" />
+ <_WasmLinkDependencies Include="$(_WasmLinkRsp)" />
+
+ <_EmccLinkStepArgs Include="-s DEFAULT_LIBRARY_FUNCS_TO_INCLUDE=$(_EmccExportedLibraryFunction)" Condition="'$(_EmccExportedLibraryFunction)' != ''" />
+ <_EmccLinkStepArgs Include="-s EXPORTED_RUNTIME_METHODS=$(_EmccExportedRuntimeMethods)" />
+ <_EmccLinkStepArgs Include="-s EXPORTED_FUNCTIONS=$(_EmccExportedFunctions)" />
+
+ <_EmccLinkStepArgs Include="$(EmccExtraLDFlags)" />
+
+ <_WasmLinkStepArgs Include="@(_EmccLinkStepArgs)" />
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <_EmccVersionCommand>emcc --version
+
+
+
+
+
+
+
+
+
+
+
+
+ <_ReversedVersionLines Include="@(_VersionLines->Reverse())" />
+
+
+ %(_ReversedVersionLines.Identity)
+ <_VersionMismatchMessage>Emscripten version mismatch. The runtime pack in $(MicrosoftNetCoreAppRuntimePackDir) expects '$(RuntimeEmccVersionRaw)', but emcc being used has version '$(ActualEmccVersionRaw)'. This might cause build failures.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <_WasmAssembliesInternal Remove="$(_WasmDedupAssembly)"/>
+
+
+
+
@@ -497,25 +614,4 @@
-
-
-
-
-
-
-
- <_WasmAssembliesInternal Remove="@(_WasmAssembliesInternal)" />
- <_WasmAssembliesInternal Include="@(_TmpWasmAssemblies)" />
-
-
-
-
-
-
-
-
-
diff --git a/src/mono/wasm/shared/build/WasmApp.LocalBuild.props b/src/mono/wasm/shared/build/WasmApp.LocalBuild.props
index 2937803be940a8..bc5b28321718a4 100644
--- a/src/mono/wasm/shared/build/WasmApp.LocalBuild.props
+++ b/src/mono/wasm/shared/build/WasmApp.LocalBuild.props
@@ -25,6 +25,7 @@
<_TargetFrameworkForNETCoreTasks>net8.0
false
true
+ $(_WasmTargetsDir)