diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml
index a4fc33aa807cf1..774a46f1170717 100644
--- a/eng/Version.Details.xml
+++ b/eng/Version.Details.xml
@@ -414,5 +414,37 @@
https://github.com/dotnet/installer
fa261b952d702c6bd604728fcbdb58ac071a22b1
+
+ https://github.com/dotnet/node
+ 308c7d0f1fa19bd1e7b768ad13646f5206133cdb
+
+
+ https://github.com/dotnet/node
+ 308c7d0f1fa19bd1e7b768ad13646f5206133cdb
+
+
+ https://github.com/dotnet/node
+ 308c7d0f1fa19bd1e7b768ad13646f5206133cdb
+
+
+ https://github.com/dotnet/node
+ 308c7d0f1fa19bd1e7b768ad13646f5206133cdb
+
+
+ https://github.com/dotnet/node
+ 308c7d0f1fa19bd1e7b768ad13646f5206133cdb
+
+
+ https://github.com/dotnet/node
+ 308c7d0f1fa19bd1e7b768ad13646f5206133cdb
+
+
+ https://github.com/dotnet/node
+ 308c7d0f1fa19bd1e7b768ad13646f5206133cdb
+
+
+ https://github.com/dotnet/node
+ 308c7d0f1fa19bd1e7b768ad13646f5206133cdb
+
diff --git a/eng/Versions.props b/eng/Versions.props
index 19bbef019e1736..cee603b6e38b9d 100644
--- a/eng/Versions.props
+++ b/eng/Versions.props
@@ -256,5 +256,9 @@
9.0.100-preview.5.24253.16
$(MicrosoftDotnetSdkInternalVersion)
+ 9.0.0-alpha.1.24175.1
+ $(MicrosoftNETRuntimeEmscriptenVersion)
+ $(runtimewinx64MicrosoftNETCoreRuntimeWasmNodeTransportPackageVersion)
+ 3.1.34
diff --git a/eng/native/gen-buildsys.cmd b/eng/native/gen-buildsys.cmd
index 79db6bffae062d..b81ef55cbe49bb 100644
--- a/eng/native/gen-buildsys.cmd
+++ b/eng/native/gen-buildsys.cmd
@@ -56,7 +56,7 @@ if /i "%__Arch%" == "wasm" (
set "EMSDK_PATH=!EMSDK_PATH:\=/!"
if not "!EMSDK_PATH:~-1!" == "/" set "EMSDK_PATH=!EMSDK_PATH!/"
- set __ExtraCmakeParams=%__ExtraCmakeParams% "-DCMAKE_TOOLCHAIN_FILE=!EMSDK_PATH!/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake"
+ set __ExtraCmakeParams=%__ExtraCmakeParams% "-DCMAKE_TOOLCHAIN_FILE=!EMSDK_PATH!/emscripten/cmake/Modules/Platform/Emscripten.cmake"
set __UseEmcmake=1
)
if /i "%__Os%" == "wasi" (
@@ -107,7 +107,7 @@ if not "%__ConfigureOnly%" == "1" (
)
if /i "%__UseEmcmake%" == "1" (
- call "!EMSDK_PATH!/emsdk_env.bat" > nul 2>&1 && emcmake "%CMakePath%" %__ExtraCmakeParams% --no-warn-unused-cli -G "%__CmakeGenerator%" -B %__IntermediatesDir% -S %__SourceDir%
+ call "!EMSDK_PATH!/emsdk_env.cmd" > nul 2>&1 && emcmake "%CMakePath%" %__ExtraCmakeParams% --no-warn-unused-cli -G "%__CmakeGenerator%" -B %__IntermediatesDir% -S %__SourceDir%
) else (
"%CMakePath%" %__ExtraCmakeParams% --no-warn-unused-cli -G "%__CmakeGenerator%" -B %__IntermediatesDir% -S %__SourceDir%
)
diff --git a/eng/pipelines/common/templates/pipeline-with-resources.yml b/eng/pipelines/common/templates/pipeline-with-resources.yml
index 4989a9301924f9..bedb0ff5121a4a 100644
--- a/eng/pipelines/common/templates/pipeline-with-resources.yml
+++ b/eng/pipelines/common/templates/pipeline-with-resources.yml
@@ -100,7 +100,7 @@ extends:
image: mcr.microsoft.com/dotnet-buildtools/prereqs:centos-stream8
browser_wasm:
- image: mcr.microsoft.com/dotnet-buildtools/prereqs:cbl-mariner-2.0-webassembly-20230913040940-1edc1c6
+ image: mcr.microsoft.com/dotnet-buildtools/prereqs:cbl-mariner-2.0-webassembly
env:
ROOTFS_DIR: /crossrootfs/x64
diff --git a/src/libraries/sendtohelix-browser.targets b/src/libraries/sendtohelix-browser.targets
index 393b4dd38f1ff2..80cbacd109a9b4 100644
--- a/src/libraries/sendtohelix-browser.targets
+++ b/src/libraries/sendtohelix-browser.targets
@@ -52,8 +52,7 @@
false
false
-
- $(RepoRoot)src\mono\browser\emsdk\
+ $([MSBuild]::NormalizeDirectory($(RepoRoot), 'src', 'mono', 'browser', 'emsdk'))
$(HelixDependenciesStagingPath)\emsdk
chrome
diff --git a/src/mono/browser/Makefile b/src/mono/browser/Makefile
index 6b756c64e33e6d..1401a1b36a431f 100644
--- a/src/mono/browser/Makefile
+++ b/src/mono/browser/Makefile
@@ -167,4 +167,4 @@ build-app-host:
$(DOTNET) build $(TOP)/src/mono/wasm/host $(_MSBUILD_WASM_BUILD_ARGS) $(MSBUILD_ARGS)
patch-deterministic:
- cd emsdk/upstream/emscripten/ && patch -p1 < ../../../runtime/deterministic.diff
+ cd emsdk/emscripten/ && patch -p1 < ../../../runtime/deterministic.diff
diff --git a/src/mono/browser/browser.proj b/src/mono/browser/browser.proj
index 63eb3f9883f44c..94039bfc937437 100644
--- a/src/mono/browser/browser.proj
+++ b/src/mono/browser/browser.proj
@@ -33,7 +33,7 @@
<_EmccDefaultsRspPath>$(NativeBinDir)src\emcc-default.rsp
<_EmccCompileRspPath>$(NativeBinDir)src\emcc-compile.rsp
<_EmccLinkRspPath>$(NativeBinDir)src\emcc-link.rsp
- $(EMSDK_PATH)\upstream\bin\llvm-ar
+ $(EMSDK_PATH)\bin\llvm-ar
$(EmSdkLLVMAr).exe
@@ -397,12 +397,12 @@
$(CMakeBuildRuntimeConfigureCmd) -DENABLE_JS_INTEROP_BY_VALUE=1
$(CMakeBuildRuntimeConfigureCmd) $(CMakeConfigurationEmsdkPath)
- call "$(RepositoryEngineeringDir)native\init-vs-env.cmd" && call "$([MSBuild]::NormalizePath('$(EMSDK_PATH)', 'emsdk_env.bat'))" && $(CMakeBuildRuntimeConfigureCmd)
+ call "$(RepositoryEngineeringDir)native\init-vs-env.cmd" && call "$([MSBuild]::NormalizePath('$(EMSDK_PATH)', 'emsdk_env.cmd'))" && $(CMakeBuildRuntimeConfigureCmd)
bash -c 'source $(EMSDK_PATH)/emsdk_env.sh 2>&1 && $(CMakeBuildRuntimeConfigureCmd)'
-v
cmake --build . --config $(Configuration) $(CmakeOptions)
- call "$(RepositoryEngineeringDir)native\init-vs-env.cmd" && call "$([MSBuild]::NormalizePath('$(EMSDK_PATH)', 'emsdk_env.bat'))" && $(CMakeBuildRuntimeCmd)
+ call "$(RepositoryEngineeringDir)native\init-vs-env.cmd" && call "$([MSBuild]::NormalizePath('$(EMSDK_PATH)', 'emsdk_env.cmd'))" && $(CMakeBuildRuntimeCmd)
bash -c 'source $(EMSDK_PATH)/emsdk_env.sh 2>&1 && $(CMakeBuildRuntimeCmd)'
diff --git a/src/mono/browser/build/EmSdkRepo.Defaults.props b/src/mono/browser/build/EmSdkRepo.Defaults.props
index 23bfe4551a5c81..4e56389ea631e6 100644
--- a/src/mono/browser/build/EmSdkRepo.Defaults.props
+++ b/src/mono/browser/build/EmSdkRepo.Defaults.props
@@ -4,25 +4,18 @@
$([MSBuild]::EnsureTrailingSlash($(EMSDK_PATH)))
- $([MSBuild]::NormalizeDirectory($(EmscriptenSdkToolsPath), 'upstream', 'bin'))
- $([MSBuild]::NormalizeDirectory($(EmscriptenSdkToolsPath), 'upstream', 'emscripten'))
-
- <_NodeToolsBasePath>$(EmscriptenSdkToolsPath)node
+ $([MSBuild]::NormalizeDirectory($(EmscriptenSdkToolsPath), 'bin'))
+ $([MSBuild]::NormalizeDirectory($(EmscriptenSdkToolsPath), 'emscripten'))
- <_NodeToolsVersionedPath Condition="Exists($(_NodeToolsBasePath))">$([System.IO.Directory]::GetDirectories($(_NodeToolsBasePath)))
- $(_NodeToolsVersionedPath)
- $([MSBuild]::NormalizeDirectory($(EmscriptenNodeToolsPath)))
+ $([MSBuild]::NormalizeDirectory($(EmscriptenSdkToolsPath), 'node', 'bin'))
<_UsingEMSDK_PATH>true
- <_PythonToolsBasePath>$(EmscriptenSdkToolsPath)python
- <_PythonToolsVersionedPath Condition="Exists($(_PythonToolsBasePath))">$([System.IO.Directory]::GetDirectories($(_PythonToolsBasePath)))
- $(_PythonToolsVersionedPath)
- $([MSBuild]::NormalizeDirectory($(EmscriptenPythonToolsPath)))
+ $([MSBuild]::NormalizeDirectory($(EmscriptenSdkToolsPath)python))
<_EMSDKMissingPaths Condition="'$(_EMSDKMissingPaths)' == '' and ('$(EmscriptenPythonToolsPath)' == '' or !Exists('$(EmscriptenPythonToolsPath)'))">%24(EmscriptenPythonToolsPath)=$(EmscriptenPythonToolsPath)
@@ -31,9 +24,9 @@
-
+
-
+
diff --git a/src/mono/browser/runtime/CMakeLists.txt b/src/mono/browser/runtime/CMakeLists.txt
index 60570d6deafd60..8b7939330f8c3a 100644
--- a/src/mono/browser/runtime/CMakeLists.txt
+++ b/src/mono/browser/runtime/CMakeLists.txt
@@ -44,7 +44,7 @@ set(ignoreMeEmsdkPath "${EMSDK_PATH}")
if(CMAKE_BUILD_TYPE STREQUAL "Release")
add_custom_command(TARGET dotnet.native
- POST_BUILD COMMAND ${EMSDK_PATH}/upstream/bin/wasm-opt --enable-exception-handling ${CONFIGURATION_WASM_OPT_FLAGS} --strip-dwarf ${NATIVE_BIN_DIR}/dotnet.native.wasm -o ${NATIVE_BIN_DIR}/dotnet.native.wasm
+ POST_BUILD COMMAND ${EMSDK_PATH}/bin/wasm-opt --enable-exception-handling ${CONFIGURATION_WASM_OPT_FLAGS} --strip-dwarf ${NATIVE_BIN_DIR}/dotnet.native.wasm -o ${NATIVE_BIN_DIR}/dotnet.native.wasm
COMMENT "Stripping debug symbols from dotnet.native.wasm using wasm-opt")
endif()
diff --git a/src/mono/browser/sanitize.py b/src/mono/browser/sanitize.py
index c3a63434aa3920..55737f8e4be568 100644
--- a/src/mono/browser/sanitize.py
+++ b/src/mono/browser/sanitize.py
@@ -32,7 +32,7 @@ def rewrite_package_json(path):
emsdk_path = sys.argv[1]
-emscripten_path = os.path.join(emsdk_path, "upstream", "emscripten")
+emscripten_path = os.path.join(emsdk_path, "emscripten")
node_root = os.path.join(emsdk_path, "node")
node_paths = glob(node_root)
upgrade = True
diff --git a/src/mono/mono.proj b/src/mono/mono.proj
index 5ef8234bcf84a2..8f02901b6d7715 100644
--- a/src/mono/mono.proj
+++ b/src/mono/mono.proj
@@ -77,6 +77,8 @@
true
+ true
+ false
@@ -87,6 +89,20 @@
GeneratePathProperty="true" />
+
+
+
+
+
+
+ Condition="'$(ShouldProvisionEmscripten)' == 'true'">
@@ -157,25 +173,133 @@
$([MSBuild]::NormalizeDirectory('$(MSBuildThisFileDirectory)', 'browser'))
emsdk
%(_VersionLines.Identity)
-
- $(EMSDK_PATH)/emsdk$(EmsdkExt) install $(EmscriptenVersion)
- $(EMSDK_PATH)/emsdk$(EmsdkExt) activate $(EmscriptenVersion)
- powershell -NonInteractive -command "& $(InstallCmd); Exit $LastExitCode "
- powershell -NonInteractive -command "& $(ActivateCmd); Exit $LastExitCode "
- setlocal EnableDelayedExpansion && call "$([MSBuild]::NormalizePath('$(EMSDK_PATH)', 'emsdk_env.bat'))" && !EMSDK_PYTHON!
+ <_EmsdkPaths Condition="'$(HostOS)' != 'windows'">
+CURRENT_SCRIPT=
+DIR="."
+
+# use shell specific method to get the path
+# to the current file being source'd.
+#
+# To add a shell, add another conditional below,
+# then add tests to scripts/test_source_env.sh
+
+if [ -n "%24{BASH_SOURCE-}" ]%3B then
+ CURRENT_SCRIPT="%24BASH_SOURCE"
+elif [ -n "%24{ZSH_VERSION-}" ]%3B then
+ CURRENT_SCRIPT="%24{(%):-%x}"
+elif [ -n "%24{KSH_VERSION-}" ]%3B then
+ CURRENT_SCRIPT=%24{.sh.file}
+fi
+
+if [ -n "%24{CURRENT_SCRIPT-}" ]%3B then
+ DIR=%24(dirname "%24CURRENT_SCRIPT")
+ if [ -h "%24CURRENT_SCRIPT" ]%3B then
+ # Now work out actual DIR since this is part of a symlink.
+ # Since we can't be sure that readlink or realpath
+ # are available, use tools more likely to be installed.
+ # (This will still fail if sed is not available.)
+ SYMDIR=%24(dirname "%24(ls -l "%24CURRENT_SCRIPT" | sed -n "s/.*-> //p")")
+ if [ -z "%24SYMDIR" ]%3B then
+ SYMDIR="."
+ fi
+ FULLDIR="%24DIR/%24SYMDIR"
+ DIR=%24(cd "%24FULLDIR" > /dev/null 2>&1%3B /bin/pwd)
+ unset SYMDIR
+ unset FULLDIR
+ fi
+fi
+unset CURRENT_SCRIPT
+
+if [ ! -f "%24DIR/emscripten/emcmake.py" ]%3B then
+ echo "Error: unable to determine 'emsdk' directory. Perhaps you are using a shell or" 1>&2
+ echo " environment that this script does not support." 1>&2
+ echo 1>&2
+ echo "A possible solution is to source this script while in the 'emsdk' directory." 1>&2
+ echo 1>&2
+ unset DIR
+ return
+fi
+
+export EMSDK_PATH=%24{DIR}/
+unset DIR
+
+export DOTNET_EMSCRIPTEN_LLVM_ROOT=%24{EMSDK_PATH}bin/
+export DOTNET_EMSCRIPTEN_NODE_JS=%24{EMSDK_PATH}node/bin/node
+export DOTNET_EMSCRIPTEN_BINARYEN_ROOT=%24{EMSDK_PATH}
+
+
+ <_EmsdkPaths Condition="'$(HostOS)' == 'windows'">
+@echo off
+
+set CURRENT_SCRIPT=%~dp0
+set EMSDK_PATH=%CURRENT_SCRIPT:~0,-1%\
+
+set EMSDK_PYTHON=%EMSDK_PATH%python\python.exe
+set DOTNET_EMSCRIPTEN_LLVM_ROOT=%EMSDK_PATH%bin\
+set DOTNET_EMSCRIPTEN_NODE_JS=%EMSDK_PATH%node\bin\node
+set DOTNET_EMSCRIPTEN_NODE_PATH=%EMSDK_PATH%node\bin\
+set DOTNET_EMSCRIPTEN_BINARYEN_ROOT=%EMSDK_PATH%
+
+
+ <_EmscriptenPaths>
+import os
+
+emsdk_path = os.path.dirname(os.path.dirname(os.path.realpath(os.getenv('EM_CONFIG')).replace('\\', '/')))
+
+LLVM_ROOT = emsdk_path + '/bin'
+NODE_JS = emsdk_path + '/node/bin/node'
+BINARYEN_ROOT = emsdk_path
+
+FROZEN_CACHE = bool(os.getenv('FROZEN_CACHE', 'True'))
+
+COMPILER_ENGINE = NODE_JS
+JS_ENGINES = [NODE_JS]
+
+ setlocal EnableDelayedExpansion && call "$([MSBuild]::NormalizePath('$(EMSDK_PATH)', 'emsdk_env$(ScriptExt)'))" && !EMSDK_PYTHON!
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ false
+
@@ -599,14 +723,16 @@
$([MSBuild]::EnsureTrailingSlash('$(EMSDK_PATH)').Replace('\', '/'))
$([MSBuild]::EnsureTrailingSlash('$(WASI_SDK_PATH)').Replace('\', '/'))
+ <_EmsdkEnvScriptPath>$([MSBuild]::NormalizePath('$(EMSDK_PATH)', 'emsdk_env$(ScriptExt)'))
+
<_MonoCMakeConfigureCommand>cmake @(_MonoCMakeArgs, ' ') $(MonoCMakeExtraArgs) "$(MonoProjectRoot.TrimEnd('\/'))"
<_MonoCMakeConfigureCommand Condition="'$(TargetsBrowser)' != 'true' and '$(TargetsWasi)' != 'true' and '$(_MonoSkipInitCompiler)' != 'true' and '$(HostOS)' != 'windows'">sh -c 'build_arch="$(_CompilerTargetArch)" compiler="$(MonoCCompiler)" . "$(RepositoryEngineeringCommonDir)native/init-compiler.sh" && @(_MonoBuildEnv, ' ') $(_MonoCMakeConfigureCommand)'
<_MonoCMakeConfigureCommand Condition="'$(TargetsBrowser)' != 'true' and '$(TargetsWasi)' != 'true' and '$(_MonoSkipInitCompiler)' == 'true' and '$(HostOS)' != 'windows'">$(_MonoCCOption) $(_MonoCXXOption) @(_MonoBuildEnv, ' ') $(_MonoCMakeConfigureCommand)
<_MonoCMakeConfigureCommand Condition="'$(TargetsWasi)' == 'true'">$(_MonoCMakeConfigureCommand) -DWASI_SDK_PREFIX=$(WASI_SDK_PATH) -DCMAKE_SYSROOT=$(WASI_SDK_PATH)share/wasi-sysroot -DCMAKE_TOOLCHAIN_FILE=$(WASI_SDK_PATH)share/cmake/wasi-sdk.cmake -DCMAKE_CXX_FLAGS="--sysroot=$(WASI_SDK_PATH)share/wasi-sysroot"
<_MonoCMakeConfigureCommand Condition="'$(TargetsBrowser)' != 'true' and '$(TargetsWasi)' != 'true' and '$(HostOS)' == 'windows'">call "$(RepositoryEngineeringDir)native\init-vs-env.cmd" $(_CompilerTargetArch) && cd /D "$(MonoObjDir)" && @(_MonoBuildEnv, ' ') $(_MonoCMakeConfigureCommand)
- <_MonoCMakeConfigureCommand Condition="'$(TargetsBrowser)' == 'true' and '$(HostOS)' != 'windows'">bash -c 'source $(EMSDK_PATH)/emsdk_env.sh 2>&1 && emcmake $(_MonoCMakeConfigureCommand)'
- <_MonoCMakeConfigureCommand Condition="'$(TargetsBrowser)' == 'true' and '$(HostOS)' == 'windows'">call "$(RepositoryEngineeringDir)native\init-vs-env.cmd" && call "$([MSBuild]::NormalizePath('$(EMSDK_PATH)', 'emsdk_env.bat'))" && emcmake $(_MonoCMakeConfigureCommand)
+ <_MonoCMakeConfigureCommand Condition="'$(TargetsBrowser)' == 'true' and '$(HostOS)' != 'windows'">bash -c 'source $(_EmsdkEnvScriptPath) 2>&1 && emcmake $(_MonoCMakeConfigureCommand)'
+ <_MonoCMakeConfigureCommand Condition="'$(TargetsBrowser)' == 'true' and '$(HostOS)' == 'windows'">call "$(RepositoryEngineeringDir)native\init-vs-env.cmd" && call "$(_EmsdkEnvScriptPath)" && emcmake $(_MonoCMakeConfigureCommand)
<_MonoCMakeConfigureCommand Condition="'$(TargetsWasi)' == 'true' and '$(HostOS)' == 'windows'">call "$(RepositoryEngineeringDir)native\init-vs-env.cmd" && cmake $(_MonoCMakeConfigureCommand)
<_MonoCMakeBuildCommand>cmake --build . --target install --config $(Configuration)
@@ -796,7 +922,7 @@
-
+
diff --git a/src/tasks/WasmAppBuilder/RunWithEmSdkEnv.cs b/src/tasks/WasmAppBuilder/RunWithEmSdkEnv.cs
index b4c524bb225124..e17e01f870facb 100644
--- a/src/tasks/WasmAppBuilder/RunWithEmSdkEnv.cs
+++ b/src/tasks/WasmAppBuilder/RunWithEmSdkEnv.cs
@@ -25,7 +25,7 @@ public override bool Execute()
{
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
- string envScriptPath = Path.Combine(EmSdkPath, "emsdk_env.bat");
+ string envScriptPath = Path.Combine(EmSdkPath, "emsdk_env.cmd");
if (!CheckEnvScript(envScriptPath))
return false;