From e064ec65e2798dda105d0afb309fe5eb9574f230 Mon Sep 17 00:00:00 2001 From: Ilona Tomkowicz <32700855+ilonatommy@users.noreply.github.com> Date: Wed, 14 Aug 2024 16:40:21 +0000 Subject: [PATCH 01/36] Remove embedded scripts, fix build on Linux. --- src/mono/browser/browser.proj | 4 +- src/mono/mono.proj | 142 +++++--------------- src/native/libs/build-native.sh | 1 + src/tasks/WasmAppBuilder/RunWithEmSdkEnv.cs | 5 +- 4 files changed, 40 insertions(+), 112 deletions(-) diff --git a/src/mono/browser/browser.proj b/src/mono/browser/browser.proj index 316f644ccc1c27..dc06000c66daab 100644 --- a/src/mono/browser/browser.proj +++ b/src/mono/browser/browser.proj @@ -416,12 +416,12 @@ $(CMakeBuildRuntimeConfigureCmd) $(CMakeConfigurationEmsdkPath) 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)' + bash -c 'source $(EMSDK_PATH)/pre_emsdk_env.sh && 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.cmd'))" && $(CMakeBuildRuntimeCmd) - bash -c 'source $(EMSDK_PATH)/emsdk_env.sh 2>&1 && $(CMakeBuildRuntimeCmd)' + bash -c 'source $(EMSDK_PATH)/pre_emsdk_env.sh && source $(EMSDK_PATH)/emsdk_env.sh 2>&1 && $(CMakeBuildRuntimeCmd)' <_CmakeEnvironmentVariable Include="ENABLE_JS_INTEROP_BY_VALUE=1" Condition="'$(WasmEnableJsInteropByValue)' != 'false'"/> diff --git a/src/mono/mono.proj b/src/mono/mono.proj index 9b15837178cdb0..18f475e824ee18 100644 --- a/src/mono/mono.proj +++ b/src/mono/mono.proj @@ -173,93 +173,11 @@ $([MSBuild]::NormalizeDirectory('$(MSBuildThisFileDirectory)', 'browser')) emsdk %(_VersionLines.Identity) - <_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! - + @@ -272,34 +190,13 @@ JS_ENGINES = [NODE_JS] - - - - - - - - - - - - - false - + @@ -743,14 +640,33 @@ JS_ENGINES = [NODE_JS] <_MonoCFLAGSOption>-DCMAKE_C_FLAGS="@(_MonoCPPFLAGS, ' ') @(_MonoCFLAGS, ' ')" <_MonoCXXFLAGSOption>-DCMAKE_CXX_FLAGS="@(_MonoCPPFLAGS, ' ') @(_MonoCXXFLAGS, ' ')" + $([MSBuild]::EnsureTrailingSlash('$(EMSDK_PATH)').Replace('\', '/')) + $(EMSDK_PATH)bin + $(NuGetPackageRoot)runtime.$(_portableHostOS)-$(BuildArchitecture).microsoft.netcore.runtime.wasm.node.transport/%(PackageReference.Version)/tools/$(_portableHostOS)-$(BuildArchitecture)/bin + $(DOTNET_EMSCRIPTEN_NODE_PATH)/node + $(NuGetPackageRoot)Microsoft.NET.Runtime.Emscripten.$(EmsdkVersion).Python.win-$(BuildArchitecture)/%(PackageReference.Version)/tools/ + <_PreEmsdkEnvScriptPath>$(EMSDK_PATH)pre_emsdk_env$(ScriptExt) <_MonoCMakeArgs Include="$(_MonoCFLAGSOption)"/> <_MonoCMakeArgs Include="$(_MonoCXXFLAGSOption)"/> + + + <_PreEmsdkEnvScriptLines Include="#!/bin/bash" /> + + <_PreEmsdkEnvScriptLines Include="export EMSDK_PATH=$(EMSDK_PATH)" /> + <_PreEmsdkEnvScriptLines Include="export DOTNET_EMSCRIPTEN_LLVM_ROOT=$(DOTNET_EMSCRIPTEN_LLVM_ROOT)" /> + + <_PreEmsdkEnvScriptLines Include="export DOTNET_EMSCRIPTEN_NODE_JS=$(DOTNET_EMSCRIPTEN_NODE_JS)" /> + + <_PreEmsdkEnvScriptLines Include="export DOTNET_EMSCRIPTEN_BINARYEN_ROOT=$(EMSDK_PATH)" /> + + + + - $([MSBuild]::EnsureTrailingSlash('$(EMSDK_PATH)').Replace('\', '/')) <_EmsdkEnvScriptPath>$([MSBuild]::NormalizePath('$(EMSDK_PATH)', 'emsdk_env$(ScriptExt)')) <_MonoCMakeConfigureCommand>cmake @(_MonoCMakeArgs, ' ') $(MonoCMakeExtraArgs) "$(MonoProjectRoot.TrimEnd('\/'))" @@ -759,11 +675,11 @@ JS_ENGINES = [NODE_JS] <_MonoCMakeConfigureCommand Condition="'$(TargetsWasi)' == 'true'">$(_MonoCMakeConfigureCommand) -DWASI_SDK_PREFIX=$(WASI_SDK_PATH) -DCMAKE_SYSROOT=$(WASI_SDK_PATH)share/wasi-sysroot -DCMAKE_TOOLCHAIN_FILE=$(RepoRoot)src/native/external/wasi-sdk-p2.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 $(_EmsdkEnvScriptPath) 2>&1 && emcmake $(_MonoCMakeConfigureCommand)' + <_MonoCMakeConfigureCommand Condition="'$(TargetsBrowser)' == 'true' and '$(HostOS)' != 'windows'">bash -c 'source $(_PreEmsdkEnvScriptPath) && 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) + <_MonoCMakeBuildCommand>. $(_PreEmsdkEnvScriptPath) && cmake --build . --target install --config $(Configuration) <_MonoCMakeBuildCommand Condition="'$(MonoVerboseBuild)' == 'true'">$(_MonoCMakeBuildCommand) --verbose <_MonoCMakeBuildCommand Condition="'$(_MonoUseNinja)' != 'true'">$(_MonoCMakeBuildCommand) --parallel $([System.Environment]::ProcessorCount) <_MonoCMakeBuildCommand Condition="'$(TargetsBrowser)' != 'true' and '$(TargetsWasi)' != 'true' and '$(HostOS)' != 'windows'">@(_MonoBuildEnv, ' ') $(_MonoCMakeBuildCommand) @@ -787,6 +703,14 @@ JS_ENGINES = [NODE_JS] File="$(MonoObjDir)cmake_cmd_line.txt" Lines="$(_MonoCMakeConfigureCommand)" Overwrite="true" /> + + + + @@ -1008,7 +932,7 @@ JS_ENGINES = [NODE_JS] <_MonoAotCMakeConfigureCommand Condition="'$(_MonoSkipInitCompiler)' != 'true' and '$(HostOS)' != 'windows'">sh -c 'build_arch="$(_CompilerTargetArch)" ROOTFS_DIR="$(MonoCrossDir)" compiler="$(MonoCCompiler)" . "$(RepositoryEngineeringCommonDir)native/init-compiler.sh" && @(_MonoAotBuildEnv, ' ') $(_MonoAotCMakeConfigureCommand)' <_MonoAotCMakeConfigureCommand Condition="'$(_MonoSkipInitCompiler)' == 'true' and '$(HostOS)' != 'windows'">$(_MonoAOTCCOption) $(_MonoAOTCXXOption) @(_MonoAotBuildEnv, ' ') $(_MonoAotCMakeConfigureCommand) <_MonoAotCMakeConfigureCommand Condition="'$(HostOS)' == 'windows'">call "$(RepositoryEngineeringDir)native\init-vs-env.cmd" $(_CompilerTargetArch) && cd /D "$(MonoObjCrossDir)" && @(_MonoAotBuildEnv, ' ') $(_MonoAotCMakeConfigureCommand) - <_MonoAotCMakeBuildCommand>cmake --build . --target install --config $(Configuration) + <_MonoAotCMakeBuildCommand>. $(_PreEmsdkEnvScriptPath) && cmake --build . --target install --config $(Configuration) <_MonoAotCMakeBuildCommand Condition="'$(MonoVerboseBuild)' == 'true'">$(_MonoAotCMakeBuildCommand) --verbose <_MonoAotCMakeBuildCommand Condition="'$(_MonoUseNinja)' != 'true'">$(_MonoAotCMakeBuildCommand) --parallel $([System.Environment]::ProcessorCount) <_MonoAotCMakeBuildCommand Condition="'$(HostOS)' != 'windows'">@(_MonoAotBuildEnv, ' ') $(_MonoAotCMakeBuildCommand) diff --git a/src/native/libs/build-native.sh b/src/native/libs/build-native.sh index fa259dd5bae8fe..15cc93c50b401d 100755 --- a/src/native/libs/build-native.sh +++ b/src/native/libs/build-native.sh @@ -62,6 +62,7 @@ if [[ "$__TargetOS" == browser ]]; then exit 1 fi fi + source "$EMSDK_PATH"/pre_emsdk_env.sh source "$EMSDK_PATH"/emsdk_env.sh export CLR_CC=$(which emcc) elif [[ "$__TargetOS" == wasi ]]; then diff --git a/src/tasks/WasmAppBuilder/RunWithEmSdkEnv.cs b/src/tasks/WasmAppBuilder/RunWithEmSdkEnv.cs index e17e01f870facb..b66b51ae3584b7 100644 --- a/src/tasks/WasmAppBuilder/RunWithEmSdkEnv.cs +++ b/src/tasks/WasmAppBuilder/RunWithEmSdkEnv.cs @@ -33,11 +33,14 @@ public override bool Execute() } else { + string preEnvScriptPath = Path.Combine(EmSdkPath, "pre_emsdk_env.sh"); + if (!CheckEnvScript(preEnvScriptPath)) + return false; string envScriptPath = Path.Combine(EmSdkPath, "emsdk_env.sh"); if (!CheckEnvScript(envScriptPath)) return false; - Command = $"bash -c 'source {envScriptPath} > /dev/null 2>&1 && {Command}'"; + Command = $"bash -c 'source {preEnvScriptPath} > /dev/null 2>&1 && source {envScriptPath} > /dev/null 2>&1 && {Command}'"; } var workingDir = string.IsNullOrEmpty(WorkingDirectory) ? Directory.GetCurrentDirectory() : WorkingDirectory; From 60bfafced87165891d88fbb8171c0e49efba5491 Mon Sep 17 00:00:00 2001 From: Ilona Tomkowicz Date: Fri, 16 Aug 2024 11:55:57 +0200 Subject: [PATCH 02/36] Windows - almost fixed, missing native build access to EMSDK_PATH. --- eng/native/gen-buildsys.cmd | 2 +- src/mono/browser/browser.proj | 4 +- src/mono/mono.proj | 42 ++++++++++++++------- src/native/libs/build-native.proj | 6 ++- src/tasks/WasmAppBuilder/RunWithEmSdkEnv.cs | 5 ++- 5 files changed, 40 insertions(+), 19 deletions(-) diff --git a/eng/native/gen-buildsys.cmd b/eng/native/gen-buildsys.cmd index 83682d69cfc393..eea8bc39be8331 100644 --- a/eng/native/gen-buildsys.cmd +++ b/eng/native/gen-buildsys.cmd @@ -109,7 +109,7 @@ if not "%__ConfigureOnly%" == "1" ( ) if /i "%__UseEmcmake%" == "1" ( - call "!EMSDK_PATH!/emsdk_env.cmd" > nul 2>&1 && emcmake "%CMakePath%" %__ExtraCmakeParams% --no-warn-unused-cli -G "%__CmakeGenerator%" -B %__IntermediatesDir% -S %__SourceDir% + call "!EMSDK_PATH!/pre_emsdk_env.cmd" > nul 2>&1 && 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/src/mono/browser/browser.proj b/src/mono/browser/browser.proj index 1ae08bd2326ac8..e5ae0a0c5fde40 100644 --- a/src/mono/browser/browser.proj +++ b/src/mono/browser/browser.proj @@ -415,12 +415,12 @@ $(CMakeBuildRuntimeConfigureCmd) -DENABLE_JS_INTEROP_BY_VALUE=1 $(CMakeBuildRuntimeConfigureCmd) $(CMakeConfigurationEmsdkPath) - call "$(RepositoryEngineeringDir)native\init-vs-env.cmd" && call "$([MSBuild]::NormalizePath('$(EMSDK_PATH)', 'emsdk_env.cmd'))" && $(CMakeBuildRuntimeConfigureCmd) + call "$(RepositoryEngineeringDir)native\init-vs-env.cmd" && call "$([MSBuild]::NormalizePath('$(EMSDK_PATH)', 'pre_emsdk_env.cmd'))" && call "$([MSBuild]::NormalizePath('$(EMSDK_PATH)', 'emsdk_env.cmd'))" && $(CMakeBuildRuntimeConfigureCmd) bash -c 'source $(EMSDK_PATH)/pre_emsdk_env.sh && 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.cmd'))" && $(CMakeBuildRuntimeCmd) + call "$(RepositoryEngineeringDir)native\init-vs-env.cmd" && call "$([MSBuild]::NormalizePath('$(EMSDK_PATH)', 'emsdk_env.cmd'))" && call "$([MSBuild]::NormalizePath('$(EMSDK_PATH)', 'emsdk_env.cmd'))" && $(CMakeBuildRuntimeCmd) bash -c 'source $(EMSDK_PATH)/pre_emsdk_env.sh && source $(EMSDK_PATH)/emsdk_env.sh 2>&1 && $(CMakeBuildRuntimeCmd)' diff --git a/src/mono/mono.proj b/src/mono/mono.proj index ac8b9fa9841030..049af67707e2c2 100644 --- a/src/mono/mono.proj +++ b/src/mono/mono.proj @@ -173,7 +173,7 @@ $([MSBuild]::NormalizeDirectory('$(MSBuildThisFileDirectory)', 'browser')) emsdk %(_VersionLines.Identity) - setlocal EnableDelayedExpansion && call "$([MSBuild]::NormalizePath('$(EMSDK_PATH)', 'emsdk_env$(ScriptExt)'))" && !EMSDK_PYTHON! + setlocal EnableDelayedExpansion && call "$([MSBuild]::NormalizePath('$(EMSDK_PATH)', 'pre_emsdk_env$(ScriptExt)'))" && call "$([MSBuild]::NormalizePath('$(EMSDK_PATH)', 'emsdk_env$(ScriptExt)'))" && !EMSDK_PYTHON! @@ -248,8 +248,8 @@ See https://github.com/llvm/llvm-project/pull/98373 See https://github.com/dotnet/runtime/issues/104773 --> - @@ -624,32 +624,46 @@ <_MonoCFLAGSOption>-DCMAKE_C_FLAGS="@(_MonoCPPFLAGS, ' ') @(_MonoCFLAGS, ' ')" <_MonoCXXFLAGSOption>-DCMAKE_CXX_FLAGS="@(_MonoCPPFLAGS, ' ') @(_MonoCXXFLAGS, ' ')" $([MSBuild]::EnsureTrailingSlash('$(EMSDK_PATH)').Replace('\', '/')) + $([MSBuild]::EnsureTrailingSlash('$(NuGetPackageRoot)').Replace('\', '/')) $(EMSDK_PATH)bin - $(NuGetPackageRoot)runtime.$(_portableHostOS)-$(BuildArchitecture).microsoft.netcore.runtime.wasm.node.transport/%(PackageReference.Version)/tools/$(_portableHostOS)-$(BuildArchitecture)/bin + $(NuGetPackageRoot)runtime.$(_portableHostOS)-$(BuildArchitecture).microsoft.netcore.runtime.wasm.node.transport/$(NodePackageVersion)/tools/$(_portableHostOS)-$(BuildArchitecture)/bin $(DOTNET_EMSCRIPTEN_NODE_PATH)/node $(EM_FROZEN_CACHE) true - $(NuGetPackageRoot)Microsoft.NET.Runtime.Emscripten.$(EmsdkVersion).Python.win-$(BuildArchitecture)/%(PackageReference.Version)/tools/ + $(NuGetPackageRoot)Microsoft.NET.Runtime.Emscripten.$(EmsdkVersion).Python.win-$(BuildArchitecture)/$(EmsdkPackageVersion)/tools/python.exe <_PreEmsdkEnvScriptPath>$(EMSDK_PATH)pre_emsdk_env$(ScriptExt) + <_ScriptExecutor Condition="'$(HostOS)' != 'windows'">. + <_ScriptExecutor Condition="'$(HostOS)' == 'windows'">call <_MonoCMakeArgs Include="$(_MonoCFLAGSOption)"/> <_MonoCMakeArgs Include="$(_MonoCXXFLAGSOption)"/> - - + <_PreEmsdkEnvScriptLines Include="#!/bin/bash" /> - <_PreEmsdkEnvScriptLines Include="export EMSDK_PATH=$(EMSDK_PATH)" /> <_PreEmsdkEnvScriptLines Include="export DOTNET_EMSCRIPTEN_LLVM_ROOT=$(DOTNET_EMSCRIPTEN_LLVM_ROOT)" /> - <_PreEmsdkEnvScriptLines Include="export DOTNET_EMSCRIPTEN_NODE_JS=$(DOTNET_EMSCRIPTEN_NODE_JS)" /> - <_PreEmsdkEnvScriptLines Include="export DOTNET_EMSCRIPTEN_BINARYEN_ROOT=$(EMSDK_PATH)" /> <_PreEmsdkEnvScriptLines Include="export FROZEN_CACHE=$(DOTNET_EMSCRIPTEN_CACHE)" /> - + + + <_PreEmsdkEnvScriptLines Include="@echo off" /> + <_PreEmsdkEnvScriptLines Include="set EMSDK_PATH=$(EMSDK_PATH)" /> + <_PreEmsdkEnvScriptLines Include="set EMSDK_PYTHON=$(EMSDK_PYTHON)" /> + <_PreEmsdkEnvScriptLines Include="set DOTNET_EMSCRIPTEN_LLVM_ROOT=$(DOTNET_EMSCRIPTEN_LLVM_ROOT)" /> + <_PreEmsdkEnvScriptLines Include="set DOTNET_EMSCRIPTEN_NODE_JS=$(DOTNET_EMSCRIPTEN_NODE_JS)" /> + <_PreEmsdkEnvScriptLines Include="set EM_NODE_JS=$(DOTNET_EMSCRIPTEN_NODE_JS)" /> + + <_PreEmsdkEnvScriptLines Include="set EM_LLVM_ROOT=$([MSBuild]::EnsureTrailingSlash('$(DOTNET_EMSCRIPTEN_LLVM_ROOT)').Replace('/', '\'))" /> + <_PreEmsdkEnvScriptLines Include="set DOTNET_EMSCRIPTEN_NODE_PATH=$(DOTNET_EMSCRIPTEN_NODE_PATH)" /> + <_PreEmsdkEnvScriptLines Include="set DOTNET_EMSCRIPTEN_BINARYEN_ROOT=$(EMSDK_PATH)" /> + <_PreEmsdkEnvScriptLines Include="set EM_BINARYEN_ROOT=$(EMSDK_PATH)" /> + <_PreEmsdkEnvScriptLines Include="set FROZEN_CACHE=$(DOTNET_EMSCRIPTEN_CACHE)" /> + + @@ -662,10 +676,10 @@ <_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 $(_PreEmsdkEnvScriptPath) && 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="'$(TargetsBrowser)' == 'true' and '$(HostOS)' == 'windows'">call "$(_PreEmsdkEnvScriptPath)" && 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>. $(_PreEmsdkEnvScriptPath) && cmake --build . --target install --config $(Configuration) + <_MonoCMakeBuildCommand>$(_ScriptExecutor) "$(_PreEmsdkEnvScriptPath)" && cmake --build . --target install --config $(Configuration) <_MonoCMakeBuildCommand Condition="'$(MonoVerboseBuild)' == 'true'">$(_MonoCMakeBuildCommand) --verbose <_MonoCMakeBuildCommand Condition="'$(_MonoUseNinja)' != 'true'">$(_MonoCMakeBuildCommand) --parallel $([System.Environment]::ProcessorCount) <_MonoCMakeBuildCommand Condition="'$(TargetsBrowser)' != 'true' and '$(TargetsWasi)' != 'true' and '$(HostOS)' != 'windows'">@(_MonoBuildEnv, ' ') $(_MonoCMakeBuildCommand) @@ -918,7 +932,7 @@ <_MonoAotCMakeConfigureCommand Condition="'$(_MonoSkipInitCompiler)' != 'true' and '$(HostOS)' != 'windows'">sh -c 'build_arch="$(_CompilerTargetArch)" ROOTFS_DIR="$(MonoCrossDir)" compiler="$(MonoCCompiler)" . "$(RepositoryEngineeringCommonDir)native/init-compiler.sh" && @(_MonoAotBuildEnv, ' ') $(_MonoAotCMakeConfigureCommand)' <_MonoAotCMakeConfigureCommand Condition="'$(_MonoSkipInitCompiler)' == 'true' and '$(HostOS)' != 'windows'">$(_MonoAOTCCOption) $(_MonoAOTCXXOption) @(_MonoAotBuildEnv, ' ') $(_MonoAotCMakeConfigureCommand) <_MonoAotCMakeConfigureCommand Condition="'$(HostOS)' == 'windows'">call "$(RepositoryEngineeringDir)native\init-vs-env.cmd" $(_CompilerTargetArch) && cd /D "$(MonoObjCrossDir)" && @(_MonoAotBuildEnv, ' ') $(_MonoAotCMakeConfigureCommand) - <_MonoAotCMakeBuildCommand>. $(_PreEmsdkEnvScriptPath) && cmake --build . --target install --config $(Configuration) + <_MonoAotCMakeBuildCommand>$(_ScriptExecutor) "$(_PreEmsdkEnvScriptPath)" && cmake --build . --target install --config $(Configuration) <_MonoAotCMakeBuildCommand Condition="'$(MonoVerboseBuild)' == 'true'">$(_MonoAotCMakeBuildCommand) --verbose <_MonoAotCMakeBuildCommand Condition="'$(_MonoUseNinja)' != 'true'">$(_MonoAotCMakeBuildCommand) --parallel $([System.Environment]::ProcessorCount) <_MonoAotCMakeBuildCommand Condition="'$(HostOS)' != 'windows'">@(_MonoAotBuildEnv, ' ') $(_MonoAotCMakeBuildCommand) diff --git a/src/native/libs/build-native.proj b/src/native/libs/build-native.proj index 36bfccbfe07ad8..947cc99121fa76 100644 --- a/src/native/libs/build-native.proj +++ b/src/native/libs/build-native.proj @@ -79,10 +79,14 @@ Condition="$([MSBuild]::IsOsPlatform(Windows))"> <_BuildNativeArgs Condition="'$(Ninja)' == 'false'">$(_BuildNativeArgs) msbuild + + $(EMSDK_PATH)\bin + <_BuildNativeEnvironmentVariables>$(_BuildNativeEnvironmentVariables);DOTNET_EMSCRIPTEN_LLVM_ROOT=$(DOTNET_EMSCRIPTEN_LLVM_ROOT);EM_LLVM_ROOT=$(DOTNET_EMSCRIPTEN_LLVM_ROOT) - + + nul 2>&1 && {Command}\""; + Command = $"@cmd /c \"call \"{preEnvScriptPath}\" > nul 2>&1 && call \"{envScriptPath}\" > nul 2>&1 && {Command}\""; } else { From 07ce65d8d429913d1d0c4516da6adaff22e16793 Mon Sep 17 00:00:00 2001 From: Ilona Tomkowicz <32700855+ilonatommy@users.noreply.github.com> Date: Fri, 16 Aug 2024 16:12:09 +0000 Subject: [PATCH 03/36] Fix `$(EMSDK_PATH)` is missing is missing some paths. --- src/mono/browser/build/BrowserWasmApp.targets | 2 +- src/mono/browser/build/EmSdkRepo.Defaults.props | 2 +- src/mono/mono.proj | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/mono/browser/build/BrowserWasmApp.targets b/src/mono/browser/build/BrowserWasmApp.targets index 3b5683433fe862..8f144996a2d025 100644 --- a/src/mono/browser/build/BrowserWasmApp.targets +++ b/src/mono/browser/build/BrowserWasmApp.targets @@ -201,7 +201,7 @@ - + diff --git a/src/mono/browser/build/EmSdkRepo.Defaults.props b/src/mono/browser/build/EmSdkRepo.Defaults.props index aa94ded228bfc7..eecd9a1d3c52c2 100644 --- a/src/mono/browser/build/EmSdkRepo.Defaults.props +++ b/src/mono/browser/build/EmSdkRepo.Defaults.props @@ -8,7 +8,7 @@ $([MSBuild]::NormalizeDirectory($(EmscriptenSdkToolsPath), 'emscripten')) - $([MSBuild]::NormalizeDirectory($(EmscriptenSdkToolsPath), 'node', 'bin')) + $(NuGetPackageRoot)runtime.$(_portableHostOS)-$(BuildArchitecture).microsoft.netcore.runtime.wasm.node.transport/$(NodePackageVersion)/tools/$(_portableHostOS)-$(BuildArchitecture)/bin <_UsingEMSDK_PATH>true diff --git a/src/mono/mono.proj b/src/mono/mono.proj index 049af67707e2c2..76bc586a2fbf68 100644 --- a/src/mono/mono.proj +++ b/src/mono/mono.proj @@ -626,6 +626,7 @@ $([MSBuild]::EnsureTrailingSlash('$(EMSDK_PATH)').Replace('\', '/')) $([MSBuild]::EnsureTrailingSlash('$(NuGetPackageRoot)').Replace('\', '/')) $(EMSDK_PATH)bin + $(NuGetPackageRoot)runtime.$(_portableHostOS)-$(BuildArchitecture).microsoft.netcore.runtime.wasm.node.transport/$(NodePackageVersion)/tools/$(_portableHostOS)-$(BuildArchitecture)/bin $(DOTNET_EMSCRIPTEN_NODE_PATH)/node $(EM_FROZEN_CACHE) From 5636d09a0f47f7a0a40ac76bf0cc3e68c10c2ead Mon Sep 17 00:00:00 2001 From: Ilona Tomkowicz <32700855+ilonatommy@users.noreply.github.com> Date: Fri, 16 Aug 2024 17:14:21 +0000 Subject: [PATCH 04/36] Fix wasi. --- src/mono/mono.proj | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/mono/mono.proj b/src/mono/mono.proj index 76bc586a2fbf68..2cfe988fe7846f 100644 --- a/src/mono/mono.proj +++ b/src/mono/mono.proj @@ -665,6 +665,7 @@ <_PreEmsdkEnvScriptLines Include="set FROZEN_CACHE=$(DOTNET_EMSCRIPTEN_CACHE)" /> + @@ -680,7 +681,8 @@ <_MonoCMakeConfigureCommand Condition="'$(TargetsBrowser)' == 'true' and '$(HostOS)' == 'windows'">call "$(_PreEmsdkEnvScriptPath)" && 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>$(_ScriptExecutor) "$(_PreEmsdkEnvScriptPath)" && cmake --build . --target install --config $(Configuration) + <_MonoCMakeBuildCommand>cmake --build . --target install --config $(Configuration) + <_MonoCMakeBuildCommand Condition="'$(TargetsBrowser)' == 'true'">$(_ScriptExecutor) "$(_PreEmsdkEnvScriptPath)" && $(_MonoCMakeBuildCommand) <_MonoCMakeBuildCommand Condition="'$(MonoVerboseBuild)' == 'true'">$(_MonoCMakeBuildCommand) --verbose <_MonoCMakeBuildCommand Condition="'$(_MonoUseNinja)' != 'true'">$(_MonoCMakeBuildCommand) --parallel $([System.Environment]::ProcessorCount) <_MonoCMakeBuildCommand Condition="'$(TargetsBrowser)' != 'true' and '$(TargetsWasi)' != 'true' and '$(HostOS)' != 'windows'">@(_MonoBuildEnv, ' ') $(_MonoCMakeBuildCommand) @@ -933,7 +935,8 @@ <_MonoAotCMakeConfigureCommand Condition="'$(_MonoSkipInitCompiler)' != 'true' and '$(HostOS)' != 'windows'">sh -c 'build_arch="$(_CompilerTargetArch)" ROOTFS_DIR="$(MonoCrossDir)" compiler="$(MonoCCompiler)" . "$(RepositoryEngineeringCommonDir)native/init-compiler.sh" && @(_MonoAotBuildEnv, ' ') $(_MonoAotCMakeConfigureCommand)' <_MonoAotCMakeConfigureCommand Condition="'$(_MonoSkipInitCompiler)' == 'true' and '$(HostOS)' != 'windows'">$(_MonoAOTCCOption) $(_MonoAOTCXXOption) @(_MonoAotBuildEnv, ' ') $(_MonoAotCMakeConfigureCommand) <_MonoAotCMakeConfigureCommand Condition="'$(HostOS)' == 'windows'">call "$(RepositoryEngineeringDir)native\init-vs-env.cmd" $(_CompilerTargetArch) && cd /D "$(MonoObjCrossDir)" && @(_MonoAotBuildEnv, ' ') $(_MonoAotCMakeConfigureCommand) - <_MonoAotCMakeBuildCommand>$(_ScriptExecutor) "$(_PreEmsdkEnvScriptPath)" && cmake --build . --target install --config $(Configuration) + <_MonoAotCMakeBuildCommand>cmake --build . --target install --config $(Configuration) + <_MonoAotCMakeBuildCommand Condition="'$(TargetsBrowser)' == 'true'">$(_ScriptExecutor) "$(_PreEmsdkEnvScriptPath)" && $(_MonoAotCMakeBuildCommand) <_MonoAotCMakeBuildCommand Condition="'$(MonoVerboseBuild)' == 'true'">$(_MonoAotCMakeBuildCommand) --verbose <_MonoAotCMakeBuildCommand Condition="'$(_MonoUseNinja)' != 'true'">$(_MonoAotCMakeBuildCommand) --parallel $([System.Environment]::ProcessorCount) <_MonoAotCMakeBuildCommand Condition="'$(HostOS)' != 'windows'">@(_MonoAotBuildEnv, ' ') $(_MonoAotCMakeBuildCommand) From 4a3e122ae3022e9fe212a80a292f7f994ebc3812 Mon Sep 17 00:00:00 2001 From: Ilona Tomkowicz <32700855+ilonatommy@users.noreply.github.com> Date: Fri, 16 Aug 2024 18:14:00 +0000 Subject: [PATCH 05/36] Cleanup - move the pre-env script logic to emscripten provisioning. --- src/mono/mono.proj | 70 +++++++++++++++++++++------------------------- 1 file changed, 32 insertions(+), 38 deletions(-) diff --git a/src/mono/mono.proj b/src/mono/mono.proj index 2cfe988fe7846f..eedef9701316e3 100644 --- a/src/mono/mono.proj +++ b/src/mono/mono.proj @@ -173,11 +173,42 @@ $([MSBuild]::NormalizeDirectory('$(MSBuildThisFileDirectory)', 'browser')) emsdk %(_VersionLines.Identity) - setlocal EnableDelayedExpansion && call "$([MSBuild]::NormalizePath('$(EMSDK_PATH)', 'pre_emsdk_env$(ScriptExt)'))" && call "$([MSBuild]::NormalizePath('$(EMSDK_PATH)', 'emsdk_env$(ScriptExt)'))" && !EMSDK_PYTHON! + setlocal EnableDelayedExpansion && call "$([MSBuild]::NormalizePath('$(EMSDK_PATH)', 'pre_emsdk_env$(ScriptExt)'))" && call "$([MSBuild]::NormalizePath('$(EMSDK_PATH)', 'emsdk_env$(ScriptExt)'))" && !EMSDK_PYTHON! + $([MSBuild]::EnsureTrailingSlash('$(EMSDK_PATH)').Replace('\', '/')) + $([MSBuild]::EnsureTrailingSlash('$(NuGetPackageRoot)').Replace('\', '/')) + $(EMSDK_PATH)bin + + $([MSBuild]::EnsureTrailingSlash('$(DOTNET_EMSCRIPTEN_LLVM_ROOT)').Replace('/', '\')) + + $(NuGetPackageRoot)runtime.$(_portableHostOS)-$(BuildArchitecture).microsoft.netcore.runtime.wasm.node.transport/$(NodePackageVersion)/tools/$(_portableHostOS)-$(BuildArchitecture)/bin + $(DOTNET_EMSCRIPTEN_NODE_PATH)/node + $(EM_FROZEN_CACHE) + true + $(NuGetPackageRoot)Microsoft.NET.Runtime.Emscripten.$(EmsdkVersion).Python.win-$(BuildArchitecture)/$(EmsdkPackageVersion)/tools/python.exe + <_PreEmsdkEnvScriptPath>$(EMSDK_PATH)pre_emsdk_env$(ScriptExt) + <_SetOrExport Condition="'$(HostOS)' != 'windows'">export + <_SetOrExport Condition="'$(HostOS)' == 'windows'">set + + <_PreEmsdkEnvScriptLines Condition="$(HostOS) == 'windows'" Include="@echo off" /> + <_PreEmsdkEnvScriptLines Condition="$(HostOS) != 'windows'" Include="#!/bin/bash" /> + <_PreEmsdkEnvScriptLines Include="$(_SetOrExport) EMSDK_PATH=$(EMSDK_PATH)" /> + <_PreEmsdkEnvScriptLines Condition="$(HostOS) == 'windows'" Include="$(_SetOrExport) EMSDK_PYTHON=$(EMSDK_PYTHON)" /> + <_PreEmsdkEnvScriptLines Condition="$(HostOS) == 'windows'" Include="$(_SetOrExport) EM_BINARYEN_ROOT=$(EMSDK_PATH)" /> + <_PreEmsdkEnvScriptLines Condition="$(HostOS) == 'windows'" Include="$(_SetOrExport) DOTNET_EMSCRIPTEN_NODE_PATH=$(DOTNET_EMSCRIPTEN_NODE_PATH)" /> + <_PreEmsdkEnvScriptLines Condition="$(HostOS) == 'windows'" Include="$(_SetOrExport) EM_NODE_JS=$(DOTNET_EMSCRIPTEN_NODE_JS)" /> + <_PreEmsdkEnvScriptLines Condition="$(HostOS) == 'windows'" Include="$(_SetOrExport) EM_LLVM_ROOT=$(DOTNET_EMSCRIPTEN_LLVM_ROOT)" /> + <_PreEmsdkEnvScriptLines Include="$(_SetOrExport) DOTNET_EMSCRIPTEN_NODE_JS=$(DOTNET_EMSCRIPTEN_NODE_JS)" /> + <_PreEmsdkEnvScriptLines Include="$(_SetOrExport) DOTNET_EMSCRIPTEN_LLVM_ROOT=$(DOTNET_EMSCRIPTEN_LLVM_ROOT)" /> + <_PreEmsdkEnvScriptLines Include="$(_SetOrExport) DOTNET_EMSCRIPTEN_BINARYEN_ROOT=$(EMSDK_PATH)" /> + <_PreEmsdkEnvScriptLines Include="$(_SetOrExport) FROZEN_CACHE=$(DOTNET_EMSCRIPTEN_CACHE)" /> + + + + @@ -623,16 +654,6 @@ <_MonoCFLAGSOption>-DCMAKE_C_FLAGS="@(_MonoCPPFLAGS, ' ') @(_MonoCFLAGS, ' ')" <_MonoCXXFLAGSOption>-DCMAKE_CXX_FLAGS="@(_MonoCPPFLAGS, ' ') @(_MonoCXXFLAGS, ' ')" - $([MSBuild]::EnsureTrailingSlash('$(EMSDK_PATH)').Replace('\', '/')) - $([MSBuild]::EnsureTrailingSlash('$(NuGetPackageRoot)').Replace('\', '/')) - $(EMSDK_PATH)bin - - $(NuGetPackageRoot)runtime.$(_portableHostOS)-$(BuildArchitecture).microsoft.netcore.runtime.wasm.node.transport/$(NodePackageVersion)/tools/$(_portableHostOS)-$(BuildArchitecture)/bin - $(DOTNET_EMSCRIPTEN_NODE_PATH)/node - $(EM_FROZEN_CACHE) - true - $(NuGetPackageRoot)Microsoft.NET.Runtime.Emscripten.$(EmsdkVersion).Python.win-$(BuildArchitecture)/$(EmsdkPackageVersion)/tools/python.exe - <_PreEmsdkEnvScriptPath>$(EMSDK_PATH)pre_emsdk_env$(ScriptExt) <_ScriptExecutor Condition="'$(HostOS)' != 'windows'">. <_ScriptExecutor Condition="'$(HostOS)' == 'windows'">call @@ -641,33 +662,6 @@ <_MonoCMakeArgs Include="$(_MonoCXXFLAGSOption)"/> - - <_PreEmsdkEnvScriptLines Include="#!/bin/bash" /> - <_PreEmsdkEnvScriptLines Include="export EMSDK_PATH=$(EMSDK_PATH)" /> - <_PreEmsdkEnvScriptLines Include="export DOTNET_EMSCRIPTEN_LLVM_ROOT=$(DOTNET_EMSCRIPTEN_LLVM_ROOT)" /> - <_PreEmsdkEnvScriptLines Include="export DOTNET_EMSCRIPTEN_NODE_JS=$(DOTNET_EMSCRIPTEN_NODE_JS)" /> - <_PreEmsdkEnvScriptLines Include="export DOTNET_EMSCRIPTEN_BINARYEN_ROOT=$(EMSDK_PATH)" /> - <_PreEmsdkEnvScriptLines Include="export FROZEN_CACHE=$(DOTNET_EMSCRIPTEN_CACHE)" /> - - - - <_PreEmsdkEnvScriptLines Include="@echo off" /> - <_PreEmsdkEnvScriptLines Include="set EMSDK_PATH=$(EMSDK_PATH)" /> - <_PreEmsdkEnvScriptLines Include="set EMSDK_PYTHON=$(EMSDK_PYTHON)" /> - <_PreEmsdkEnvScriptLines Include="set DOTNET_EMSCRIPTEN_LLVM_ROOT=$(DOTNET_EMSCRIPTEN_LLVM_ROOT)" /> - <_PreEmsdkEnvScriptLines Include="set DOTNET_EMSCRIPTEN_NODE_JS=$(DOTNET_EMSCRIPTEN_NODE_JS)" /> - <_PreEmsdkEnvScriptLines Include="set EM_NODE_JS=$(DOTNET_EMSCRIPTEN_NODE_JS)" /> - - <_PreEmsdkEnvScriptLines Include="set EM_LLVM_ROOT=$([MSBuild]::EnsureTrailingSlash('$(DOTNET_EMSCRIPTEN_LLVM_ROOT)').Replace('/', '\'))" /> - <_PreEmsdkEnvScriptLines Include="set DOTNET_EMSCRIPTEN_NODE_PATH=$(DOTNET_EMSCRIPTEN_NODE_PATH)" /> - <_PreEmsdkEnvScriptLines Include="set DOTNET_EMSCRIPTEN_BINARYEN_ROOT=$(EMSDK_PATH)" /> - <_PreEmsdkEnvScriptLines Include="set EM_BINARYEN_ROOT=$(EMSDK_PATH)" /> - <_PreEmsdkEnvScriptLines Include="set FROZEN_CACHE=$(DOTNET_EMSCRIPTEN_CACHE)" /> - - - - - <_EmsdkEnvScriptPath>$([MSBuild]::NormalizePath('$(EMSDK_PATH)', 'emsdk_env$(ScriptExt)')) From bf2c1bb580efaac53b1268e842c126146160d7be Mon Sep 17 00:00:00 2001 From: Ilona Tomkowicz <32700855+ilonatommy@users.noreply.github.com> Date: Mon, 19 Aug 2024 08:14:48 +0000 Subject: [PATCH 06/36] Move remaining emsdk-provision bits to provision target. --- src/mono/mono.proj | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/mono/mono.proj b/src/mono/mono.proj index eedef9701316e3..cf442aed4e8219 100644 --- a/src/mono/mono.proj +++ b/src/mono/mono.proj @@ -185,6 +185,7 @@ $(EM_FROZEN_CACHE) true $(NuGetPackageRoot)Microsoft.NET.Runtime.Emscripten.$(EmsdkVersion).Python.win-$(BuildArchitecture)/$(EmsdkPackageVersion)/tools/python.exe + <_PreEmsdkEnvScriptPath>$(EMSDK_PATH)pre_emsdk_env$(ScriptExt) <_SetOrExport Condition="'$(HostOS)' != 'windows'">export <_SetOrExport Condition="'$(HostOS)' == 'windows'">set @@ -225,6 +226,12 @@ + + false @@ -700,14 +707,6 @@ File="$(MonoObjDir)cmake_cmd_line.txt" Lines="$(_MonoCMakeConfigureCommand)" Overwrite="true" /> - - - - From 97a55132cad93b52e7e77c7d88ae49b51c36af98 Mon Sep 17 00:00:00 2001 From: Ilona Tomkowicz <32700855+ilonatommy@users.noreply.github.com> Date: Mon, 19 Aug 2024 08:18:21 +0000 Subject: [PATCH 07/36] Fix: it's an Item, not a property. --- src/mono/mono.proj | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/mono/mono.proj b/src/mono/mono.proj index cf442aed4e8219..1c22636a72c55c 100644 --- a/src/mono/mono.proj +++ b/src/mono/mono.proj @@ -185,7 +185,6 @@ $(EM_FROZEN_CACHE) true $(NuGetPackageRoot)Microsoft.NET.Runtime.Emscripten.$(EmsdkVersion).Python.win-$(BuildArchitecture)/$(EmsdkPackageVersion)/tools/python.exe - <_PreEmsdkEnvScriptPath>$(EMSDK_PATH)pre_emsdk_env$(ScriptExt) <_SetOrExport Condition="'$(HostOS)' != 'windows'">export <_SetOrExport Condition="'$(HostOS)' == 'windows'">set @@ -225,7 +224,10 @@ - + + + + Date: Mon, 19 Aug 2024 08:24:44 +0000 Subject: [PATCH 08/36] More cleanup on Linux. --- src/mono/mono.proj | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/mono/mono.proj b/src/mono/mono.proj index 1c22636a72c55c..4c6bf14a86f70c 100644 --- a/src/mono/mono.proj +++ b/src/mono/mono.proj @@ -176,9 +176,7 @@ setlocal EnableDelayedExpansion && call "$([MSBuild]::NormalizePath('$(EMSDK_PATH)', 'pre_emsdk_env$(ScriptExt)'))" && call "$([MSBuild]::NormalizePath('$(EMSDK_PATH)', 'emsdk_env$(ScriptExt)'))" && !EMSDK_PYTHON! $([MSBuild]::EnsureTrailingSlash('$(EMSDK_PATH)').Replace('\', '/')) $([MSBuild]::EnsureTrailingSlash('$(NuGetPackageRoot)').Replace('\', '/')) - $(EMSDK_PATH)bin - - $([MSBuild]::EnsureTrailingSlash('$(DOTNET_EMSCRIPTEN_LLVM_ROOT)').Replace('/', '\')) + $([MSBuild]::EnsureTrailingSlash('$(EMSDK_PATH)bin').Replace('/', '\')) $(NuGetPackageRoot)runtime.$(_portableHostOS)-$(BuildArchitecture).microsoft.netcore.runtime.wasm.node.transport/$(NodePackageVersion)/tools/$(_portableHostOS)-$(BuildArchitecture)/bin $(DOTNET_EMSCRIPTEN_NODE_PATH)/node @@ -212,8 +210,6 @@ - From 5f962654bd5a97ee3ef2747c3cc64787d528d1b2 Mon Sep 17 00:00:00 2001 From: Ilona Tomkowicz <32700855+ilonatommy@users.noreply.github.com> Date: Mon, 19 Aug 2024 09:07:53 +0000 Subject: [PATCH 09/36] Fix rebuild. --- src/mono/mono.proj | 1 + 1 file changed, 1 insertion(+) diff --git a/src/mono/mono.proj b/src/mono/mono.proj index 4c6bf14a86f70c..83d20a92f88cd4 100644 --- a/src/mono/mono.proj +++ b/src/mono/mono.proj @@ -669,6 +669,7 @@ <_EmsdkEnvScriptPath>$([MSBuild]::NormalizePath('$(EMSDK_PATH)', 'emsdk_env$(ScriptExt)')) + <_PreEmsdkEnvScriptPath>$([MSBuild]::NormalizePath('$(EMSDK_PATH)', 'pre_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)' From 03353350e053dc13a5cebb391d9864929f89bddb Mon Sep 17 00:00:00 2001 From: Ilona Tomkowicz Date: Mon, 19 Aug 2024 11:14:20 +0200 Subject: [PATCH 10/36] Fix "NODE_JS is set to empty value in D:\a\_work\1\s\src\mono\browser\emsdk\emscripten\.emscripten" --- src/native/libs/build-native.proj | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/native/libs/build-native.proj b/src/native/libs/build-native.proj index 947cc99121fa76..f4871632466971 100644 --- a/src/native/libs/build-native.proj +++ b/src/native/libs/build-native.proj @@ -78,14 +78,14 @@ BeforeTargets="Build" Condition="$([MSBuild]::IsOsPlatform(Windows))"> - <_BuildNativeArgs Condition="'$(Ninja)' == 'false'">$(_BuildNativeArgs) msbuild - - $(EMSDK_PATH)\bin - <_BuildNativeEnvironmentVariables>$(_BuildNativeEnvironmentVariables);DOTNET_EMSCRIPTEN_LLVM_ROOT=$(DOTNET_EMSCRIPTEN_LLVM_ROOT);EM_LLVM_ROOT=$(DOTNET_EMSCRIPTEN_LLVM_ROOT) + <_BuildNativeArgs Condition="'$(Ninja)' == 'false'">$(_BuildNativeArgs) msbuild + $(EMSDK_PATH)\bin + $(NuGetPackageRoot)runtime.$(_portableHostOS)-$(BuildArchitecture).microsoft.netcore.runtime.wasm.node.transport/$(NodePackageVersion)/tools/$(_portableHostOS)-$(BuildArchitecture)/bin/node + <_BuildNativeEnvironmentVariables>$(_BuildNativeEnvironmentVariables);DOTNET_EMSCRIPTEN_LLVM_ROOT=$(DOTNET_EMSCRIPTEN_LLVM_ROOT);EM_LLVM_ROOT=$(DOTNET_EMSCRIPTEN_LLVM_ROOT);DOTNET_EMSCRIPTEN_NODE_JS=$(DOTNET_EMSCRIPTEN_NODE_JS) - + From 89148e84d46946a75dd7364906693343f376272b Mon Sep 17 00:00:00 2001 From: Ilona Tomkowicz Date: Mon, 19 Aug 2024 11:55:22 +0200 Subject: [PATCH 11/36] Fix "BINARYEN_ROOT is set to empty value in \src\mono\browser\emsdk\emscripten\.emscripten" --- src/native/libs/build-native.proj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/native/libs/build-native.proj b/src/native/libs/build-native.proj index f4871632466971..63bf92ce75433c 100644 --- a/src/native/libs/build-native.proj +++ b/src/native/libs/build-native.proj @@ -81,7 +81,7 @@ <_BuildNativeArgs Condition="'$(Ninja)' == 'false'">$(_BuildNativeArgs) msbuild $(EMSDK_PATH)\bin $(NuGetPackageRoot)runtime.$(_portableHostOS)-$(BuildArchitecture).microsoft.netcore.runtime.wasm.node.transport/$(NodePackageVersion)/tools/$(_portableHostOS)-$(BuildArchitecture)/bin/node - <_BuildNativeEnvironmentVariables>$(_BuildNativeEnvironmentVariables);DOTNET_EMSCRIPTEN_LLVM_ROOT=$(DOTNET_EMSCRIPTEN_LLVM_ROOT);EM_LLVM_ROOT=$(DOTNET_EMSCRIPTEN_LLVM_ROOT);DOTNET_EMSCRIPTEN_NODE_JS=$(DOTNET_EMSCRIPTEN_NODE_JS) + <_BuildNativeEnvironmentVariables>$(_BuildNativeEnvironmentVariables);DOTNET_EMSCRIPTEN_LLVM_ROOT=$(DOTNET_EMSCRIPTEN_LLVM_ROOT);EM_LLVM_ROOT=$(DOTNET_EMSCRIPTEN_LLVM_ROOT);DOTNET_EMSCRIPTEN_NODE_JS=$(DOTNET_EMSCRIPTEN_NODE_JS);DOTNET_EMSCRIPTEN_BINARYEN_ROOT=$(EMSDK_PATH) From bd9179b055268e21df162db26246fc756ce49d86 Mon Sep 17 00:00:00 2001 From: Ilona Tomkowicz Date: Mon, 19 Aug 2024 13:35:54 +0200 Subject: [PATCH 12/36] Workaround - set `EMSKD_PATH` for native build separately. --- src/native/libs/build-native.proj | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/native/libs/build-native.proj b/src/native/libs/build-native.proj index 63bf92ce75433c..54a9afbe5931fe 100644 --- a/src/native/libs/build-native.proj +++ b/src/native/libs/build-native.proj @@ -79,13 +79,15 @@ Condition="$([MSBuild]::IsOsPlatform(Windows))"> <_BuildNativeArgs Condition="'$(Ninja)' == 'false'">$(_BuildNativeArgs) msbuild + $([MSBuild]::NormalizeDirectory('$(MSBuildThisFileDirectory)', '..', '..', 'mono', 'browser', 'emsdk')) + $(ProvisionEmscriptenDir.Replace('\', '/')) $(EMSDK_PATH)\bin $(NuGetPackageRoot)runtime.$(_portableHostOS)-$(BuildArchitecture).microsoft.netcore.runtime.wasm.node.transport/$(NodePackageVersion)/tools/$(_portableHostOS)-$(BuildArchitecture)/bin/node <_BuildNativeEnvironmentVariables>$(_BuildNativeEnvironmentVariables);DOTNET_EMSCRIPTEN_LLVM_ROOT=$(DOTNET_EMSCRIPTEN_LLVM_ROOT);EM_LLVM_ROOT=$(DOTNET_EMSCRIPTEN_LLVM_ROOT);DOTNET_EMSCRIPTEN_NODE_JS=$(DOTNET_EMSCRIPTEN_NODE_JS);DOTNET_EMSCRIPTEN_BINARYEN_ROOT=$(EMSDK_PATH) - + From 7da3a6c064b89132ed70a7d7c89be3f3699d5b0d Mon Sep 17 00:00:00 2001 From: Ilona Tomkowicz Date: Mon, 19 Aug 2024 14:24:12 +0200 Subject: [PATCH 13/36] Cleanup. --- src/mono/browser/browser.proj | 2 +- src/mono/mono.proj | 36 +++++++++++++------------------ src/native/libs/build-native.proj | 5 ++--- 3 files changed, 18 insertions(+), 25 deletions(-) diff --git a/src/mono/browser/browser.proj b/src/mono/browser/browser.proj index e5ae0a0c5fde40..1a787c18c1eab2 100644 --- a/src/mono/browser/browser.proj +++ b/src/mono/browser/browser.proj @@ -420,7 +420,7 @@ -v cmake --build . --config $(Configuration) $(CmakeOptions) - call "$(RepositoryEngineeringDir)native\init-vs-env.cmd" && call "$([MSBuild]::NormalizePath('$(EMSDK_PATH)', 'emsdk_env.cmd'))" && call "$([MSBuild]::NormalizePath('$(EMSDK_PATH)', 'emsdk_env.cmd'))" && $(CMakeBuildRuntimeCmd) + call "$(RepositoryEngineeringDir)native\init-vs-env.cmd" && call "$([MSBuild]::NormalizePath('$(EMSDK_PATH)', 'pre_emsdk_env.cmd'))" && call "$([MSBuild]::NormalizePath('$(EMSDK_PATH)', 'emsdk_env.cmd'))" && call "$([MSBuild]::NormalizePath('$(EMSDK_PATH)', 'emsdk_env.cmd'))" && $(CMakeBuildRuntimeCmd) bash -c 'source $(EMSDK_PATH)/pre_emsdk_env.sh && source $(EMSDK_PATH)/emsdk_env.sh 2>&1 && $(CMakeBuildRuntimeCmd)' diff --git a/src/mono/mono.proj b/src/mono/mono.proj index 83d20a92f88cd4..885c9cba4f0a64 100644 --- a/src/mono/mono.proj +++ b/src/mono/mono.proj @@ -170,19 +170,16 @@ .ps1 $(ProvisionEmscriptenDir) - $([MSBuild]::NormalizeDirectory('$(MSBuildThisFileDirectory)', 'browser')) - emsdk %(_VersionLines.Identity) setlocal EnableDelayedExpansion && call "$([MSBuild]::NormalizePath('$(EMSDK_PATH)', 'pre_emsdk_env$(ScriptExt)'))" && call "$([MSBuild]::NormalizePath('$(EMSDK_PATH)', 'emsdk_env$(ScriptExt)'))" && !EMSDK_PYTHON! $([MSBuild]::EnsureTrailingSlash('$(EMSDK_PATH)').Replace('\', '/')) $([MSBuild]::EnsureTrailingSlash('$(NuGetPackageRoot)').Replace('\', '/')) $([MSBuild]::EnsureTrailingSlash('$(EMSDK_PATH)bin').Replace('/', '\')) - $(NuGetPackageRoot)runtime.$(_portableHostOS)-$(BuildArchitecture).microsoft.netcore.runtime.wasm.node.transport/$(NodePackageVersion)/tools/$(_portableHostOS)-$(BuildArchitecture)/bin $(DOTNET_EMSCRIPTEN_NODE_PATH)/node $(EM_FROZEN_CACHE) true - $(NuGetPackageRoot)Microsoft.NET.Runtime.Emscripten.$(EmsdkVersion).Python.win-$(BuildArchitecture)/$(EmsdkPackageVersion)/tools/python.exe + $(NuGetPackageRoot)Microsoft.NET.Runtime.Emscripten.$(EmsdkVersion).Python.win-$(BuildArchitecture)/$(EmsdkPackageVersion)/tools/python.exe <_PreEmsdkEnvScriptPath>$(EMSDK_PATH)pre_emsdk_env$(ScriptExt) <_SetOrExport Condition="'$(HostOS)' != 'windows'">export <_SetOrExport Condition="'$(HostOS)' == 'windows'">set @@ -190,15 +187,19 @@ - - <_PreEmsdkEnvScriptLines Condition="$(HostOS) == 'windows'" Include="@echo off" /> - <_PreEmsdkEnvScriptLines Condition="$(HostOS) != 'windows'" Include="#!/bin/bash" /> + + <_PreEmsdkEnvScriptLines Include="@echo off" /> + <_PreEmsdkEnvScriptLines Include="$(_SetOrExport) EMSDK_PYTHON=$(EMSDK_PYTHON)" /> + <_PreEmsdkEnvScriptLines Include="$(_SetOrExport) EM_BINARYEN_ROOT=$(EMSDK_PATH)" /> + <_PreEmsdkEnvScriptLines Include="$(_SetOrExport) DOTNET_EMSCRIPTEN_NODE_PATH=$(DOTNET_EMSCRIPTEN_NODE_PATH)" /> + <_PreEmsdkEnvScriptLines Include="$(_SetOrExport) EM_NODE_JS=$(DOTNET_EMSCRIPTEN_NODE_JS)" /> + <_PreEmsdkEnvScriptLines Include="$(_SetOrExport) EM_LLVM_ROOT=$(DOTNET_EMSCRIPTEN_LLVM_ROOT)" /> + + + <_PreEmsdkEnvScriptLines Include="#!/bin/bash" /> + + <_PreEmsdkEnvScriptLines Include="$(_SetOrExport) EMSDK_PATH=$(EMSDK_PATH)" /> - <_PreEmsdkEnvScriptLines Condition="$(HostOS) == 'windows'" Include="$(_SetOrExport) EMSDK_PYTHON=$(EMSDK_PYTHON)" /> - <_PreEmsdkEnvScriptLines Condition="$(HostOS) == 'windows'" Include="$(_SetOrExport) EM_BINARYEN_ROOT=$(EMSDK_PATH)" /> - <_PreEmsdkEnvScriptLines Condition="$(HostOS) == 'windows'" Include="$(_SetOrExport) DOTNET_EMSCRIPTEN_NODE_PATH=$(DOTNET_EMSCRIPTEN_NODE_PATH)" /> - <_PreEmsdkEnvScriptLines Condition="$(HostOS) == 'windows'" Include="$(_SetOrExport) EM_NODE_JS=$(DOTNET_EMSCRIPTEN_NODE_JS)" /> - <_PreEmsdkEnvScriptLines Condition="$(HostOS) == 'windows'" Include="$(_SetOrExport) EM_LLVM_ROOT=$(DOTNET_EMSCRIPTEN_LLVM_ROOT)" /> <_PreEmsdkEnvScriptLines Include="$(_SetOrExport) DOTNET_EMSCRIPTEN_NODE_JS=$(DOTNET_EMSCRIPTEN_NODE_JS)" /> <_PreEmsdkEnvScriptLines Include="$(_SetOrExport) DOTNET_EMSCRIPTEN_LLVM_ROOT=$(DOTNET_EMSCRIPTEN_LLVM_ROOT)" /> <_PreEmsdkEnvScriptLines Include="$(_SetOrExport) DOTNET_EMSCRIPTEN_BINARYEN_ROOT=$(EMSDK_PATH)" /> @@ -210,20 +211,13 @@ - + - - - - - - - + $(_BuildNativeArgs) msbuild $([MSBuild]::NormalizeDirectory('$(MSBuildThisFileDirectory)', '..', '..', 'mono', 'browser', 'emsdk')) $(ProvisionEmscriptenDir.Replace('\', '/')) - $(EMSDK_PATH)\bin + $(EMSDK_PATH)bin $(NuGetPackageRoot)runtime.$(_portableHostOS)-$(BuildArchitecture).microsoft.netcore.runtime.wasm.node.transport/$(NodePackageVersion)/tools/$(_portableHostOS)-$(BuildArchitecture)/bin/node <_BuildNativeEnvironmentVariables>$(_BuildNativeEnvironmentVariables);DOTNET_EMSCRIPTEN_LLVM_ROOT=$(DOTNET_EMSCRIPTEN_LLVM_ROOT);EM_LLVM_ROOT=$(DOTNET_EMSCRIPTEN_LLVM_ROOT);DOTNET_EMSCRIPTEN_NODE_JS=$(DOTNET_EMSCRIPTEN_NODE_JS);DOTNET_EMSCRIPTEN_BINARYEN_ROOT=$(EMSDK_PATH) - - + From 1a94c15d87475832c9528524f2cb2e1dc9c9481e Mon Sep 17 00:00:00 2001 From: Ilona Tomkowicz Date: Mon, 19 Aug 2024 15:35:46 +0200 Subject: [PATCH 14/36] Fix "Specified Emscripten sdk at $(EMSDK_PATH) is missing some paths: $(EmscriptenPythonToolsPath)". --- src/mono/browser/build/EmSdkRepo.Defaults.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mono/browser/build/EmSdkRepo.Defaults.props b/src/mono/browser/build/EmSdkRepo.Defaults.props index eecd9a1d3c52c2..e263c2b3967b70 100644 --- a/src/mono/browser/build/EmSdkRepo.Defaults.props +++ b/src/mono/browser/build/EmSdkRepo.Defaults.props @@ -15,7 +15,7 @@ - $([MSBuild]::NormalizeDirectory($(EmscriptenSdkToolsPath)python)) + $(NuGetPackageRoot)Microsoft.NET.Runtime.Emscripten.$(EmsdkVersion).Python.win-$(BuildArchitecture)/$(EmsdkPackageVersion)/tools <_EMSDKMissingPaths Condition="'$(_EMSDKMissingPaths)' == '' and ('$(EmscriptenPythonToolsPath)' == '' or !Exists('$(EmscriptenPythonToolsPath)'))">%24(EmscriptenPythonToolsPath)=$(EmscriptenPythonToolsPath) From d8b8a7cc465f1db7af1249e56dd314d6d043d803 Mon Sep 17 00:00:00 2001 From: Ilona Tomkowicz Date: Mon, 19 Aug 2024 17:40:04 +0200 Subject: [PATCH 15/36] Fix: path to python "is not recognized as an internal or external command" + ensure node path is formatted correctly. --- src/mono/browser/build/EmSdkRepo.Defaults.props | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mono/browser/build/EmSdkRepo.Defaults.props b/src/mono/browser/build/EmSdkRepo.Defaults.props index e263c2b3967b70..af79751189ef63 100644 --- a/src/mono/browser/build/EmSdkRepo.Defaults.props +++ b/src/mono/browser/build/EmSdkRepo.Defaults.props @@ -8,14 +8,14 @@ $([MSBuild]::NormalizeDirectory($(EmscriptenSdkToolsPath), 'emscripten')) - $(NuGetPackageRoot)runtime.$(_portableHostOS)-$(BuildArchitecture).microsoft.netcore.runtime.wasm.node.transport/$(NodePackageVersion)/tools/$(_portableHostOS)-$(BuildArchitecture)/bin + $([System.IO.Path]::Combine($(NuGetPackageRoot), 'runtime.$(_portableHostOS)-$(BuildArchitecture).microsoft.netcore.runtime.wasm.node.transport', '$(NodePackageVersion)', 'tools', '$(_portableHostOS)-$(BuildArchitecture)', 'bin')) <_UsingEMSDK_PATH>true - $(NuGetPackageRoot)Microsoft.NET.Runtime.Emscripten.$(EmsdkVersion).Python.win-$(BuildArchitecture)/$(EmsdkPackageVersion)/tools + $([System.IO.Path]::Combine($(NuGetPackageRoot), 'Microsoft.NET.Runtime.Emscripten.$(EmsdkVersion).Python.win-$(BuildArchitecture)', '$(EmsdkPackageVersion)', 'tools')) <_EMSDKMissingPaths Condition="'$(_EMSDKMissingPaths)' == '' and ('$(EmscriptenPythonToolsPath)' == '' or !Exists('$(EmscriptenPythonToolsPath)'))">%24(EmscriptenPythonToolsPath)=$(EmscriptenPythonToolsPath) From 6246fed7ddc4dff373fdcc4e2321b334228e8b06 Mon Sep 17 00:00:00 2001 From: Ilona Tomkowicz Date: Mon, 19 Aug 2024 18:39:44 +0200 Subject: [PATCH 16/36] Missing change for the fix in the previous commit. --- src/mono/browser/build/BrowserWasmApp.targets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mono/browser/build/BrowserWasmApp.targets b/src/mono/browser/build/BrowserWasmApp.targets index 8f144996a2d025..ef66b5f3d2aa4e 100644 --- a/src/mono/browser/build/BrowserWasmApp.targets +++ b/src/mono/browser/build/BrowserWasmApp.targets @@ -354,7 +354,7 @@ <_WasmNativeFileForLinking Include="@(NativeFileReference)" /> - + From 6fd5e6fb216d59f1065d1012589d14fb8ed704d8 Mon Sep 17 00:00:00 2001 From: Ilona Tomkowicz Date: Tue, 20 Aug 2024 15:22:12 +0200 Subject: [PATCH 17/36] Fix wbt: add missing env vars --- src/mono/browser/build/BrowserWasmApp.targets | 3 +++ src/native/libs/build-native.proj | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/mono/browser/build/BrowserWasmApp.targets b/src/mono/browser/build/BrowserWasmApp.targets index ef66b5f3d2aa4e..a6aef100e39cf4 100644 --- a/src/mono/browser/build/BrowserWasmApp.targets +++ b/src/mono/browser/build/BrowserWasmApp.targets @@ -200,8 +200,11 @@ + + + diff --git a/src/native/libs/build-native.proj b/src/native/libs/build-native.proj index d70459c2abbcd0..ba2ff4564afe12 100644 --- a/src/native/libs/build-native.proj +++ b/src/native/libs/build-native.proj @@ -87,7 +87,7 @@ - + Date: Wed, 21 Aug 2024 11:05:31 +0200 Subject: [PATCH 18/36] Missing "bin" part of node path. --- src/mono/browser/build/BrowserWasmApp.targets | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/mono/browser/build/BrowserWasmApp.targets b/src/mono/browser/build/BrowserWasmApp.targets index a6aef100e39cf4..e136aa527529be 100644 --- a/src/mono/browser/build/BrowserWasmApp.targets +++ b/src/mono/browser/build/BrowserWasmApp.targets @@ -202,9 +202,8 @@ - - - + + @@ -373,6 +372,8 @@ + + From caf53791c20844f30c5b999a7236db6d66d3f75b Mon Sep 17 00:00:00 2001 From: Ilona Tomkowicz Date: Wed, 21 Aug 2024 11:58:03 +0200 Subject: [PATCH 19/36] Lib tests have "bin" in the end of node path but wbt do not, satisfy both. --- src/mono/browser/build/BrowserWasmApp.targets | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/mono/browser/build/BrowserWasmApp.targets b/src/mono/browser/build/BrowserWasmApp.targets index e136aa527529be..361031cf547a79 100644 --- a/src/mono/browser/build/BrowserWasmApp.targets +++ b/src/mono/browser/build/BrowserWasmApp.targets @@ -195,6 +195,8 @@ $([MSBuild]::NormalizeDirectory($(EmscriptenSdkToolsPath))) $([MSBuild]::NormalizeDirectory($(EmscriptenNodeToolsPath))) $([MSBuild]::NormalizeDirectory($(EmscriptenUpstreamBinPath))) + <_EmscriptenNodePath Condition="!$(EmscriptenSdkToolsPath.EndsWith('bin'))">$([MSBuild]::NormalizePath($(EmscriptenNodeToolsPath), 'bin', 'node$(_ExeExt)')) + <_EmscriptenNodePath Condition="$(EmscriptenSdkToolsPath.EndsWith('bin'))" >$([MSBuild]::NormalizePath($(EmscriptenNodeToolsPath), 'node$(_ExeExt)')) @@ -203,7 +205,7 @@ - + @@ -287,6 +289,8 @@ false $(EmscriptenUpstreamEmscriptenPath)emcc + <_EmscriptenNodePath Condition="!$(EmscriptenSdkToolsPath.EndsWith('bin'))">$([MSBuild]::NormalizePath($(EmscriptenNodeToolsPath), 'bin', 'node$(_ExeExt)')) + <_EmscriptenNodePath Condition="$(EmscriptenSdkToolsPath.EndsWith('bin'))" >$([MSBuild]::NormalizePath($(EmscriptenNodeToolsPath), 'node$(_ExeExt)')) @@ -373,7 +377,7 @@ - + From 2a344031d1319987f6677422ed649a0ec07327fd Mon Sep 17 00:00:00 2001 From: Ilona Tomkowicz Date: Wed, 21 Aug 2024 12:43:44 +0200 Subject: [PATCH 20/36] Wrong condition, c&p error. --- src/mono/browser/build/BrowserWasmApp.targets | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/mono/browser/build/BrowserWasmApp.targets b/src/mono/browser/build/BrowserWasmApp.targets index 361031cf547a79..7abd3d4ffa99c8 100644 --- a/src/mono/browser/build/BrowserWasmApp.targets +++ b/src/mono/browser/build/BrowserWasmApp.targets @@ -195,8 +195,8 @@ $([MSBuild]::NormalizeDirectory($(EmscriptenSdkToolsPath))) $([MSBuild]::NormalizeDirectory($(EmscriptenNodeToolsPath))) $([MSBuild]::NormalizeDirectory($(EmscriptenUpstreamBinPath))) - <_EmscriptenNodePath Condition="!$(EmscriptenSdkToolsPath.EndsWith('bin'))">$([MSBuild]::NormalizePath($(EmscriptenNodeToolsPath), 'bin', 'node$(_ExeExt)')) - <_EmscriptenNodePath Condition="$(EmscriptenSdkToolsPath.EndsWith('bin'))" >$([MSBuild]::NormalizePath($(EmscriptenNodeToolsPath), 'node$(_ExeExt)')) + <_EmscriptenNodePath Condition="!$(EmscriptenNodeToolsPath.EndsWith('bin'))">$([MSBuild]::NormalizePath($(EmscriptenNodeToolsPath), 'bin', 'node$(_ExeExt)')) + <_EmscriptenNodePath Condition="$(EmscriptenNodeToolsPath.EndsWith('bin'))" >$([MSBuild]::NormalizePath($(EmscriptenNodeToolsPath), 'node$(_ExeExt)')) @@ -289,8 +289,8 @@ false $(EmscriptenUpstreamEmscriptenPath)emcc - <_EmscriptenNodePath Condition="!$(EmscriptenSdkToolsPath.EndsWith('bin'))">$([MSBuild]::NormalizePath($(EmscriptenNodeToolsPath), 'bin', 'node$(_ExeExt)')) - <_EmscriptenNodePath Condition="$(EmscriptenSdkToolsPath.EndsWith('bin'))" >$([MSBuild]::NormalizePath($(EmscriptenNodeToolsPath), 'node$(_ExeExt)')) + <_EmscriptenNodePath Condition="!$(EmscriptenNodeToolsPath.EndsWith('bin'))">$([MSBuild]::NormalizePath($(EmscriptenNodeToolsPath), 'bin', 'node$(_ExeExt)')) + <_EmscriptenNodePath Condition="$(EmscriptenNodeToolsPath.EndsWith('bin'))" >$([MSBuild]::NormalizePath($(EmscriptenNodeToolsPath), 'node$(_ExeExt)')) From fbd974443290dc2b18860a727bdf0280dabd5daf Mon Sep 17 00:00:00 2001 From: Ilona Tomkowicz Date: Wed, 21 Aug 2024 13:31:09 +0200 Subject: [PATCH 21/36] Fix WBT: "binaryen executable not found (%HostBinaryenDir%\bin\wasm-opt.exe). Please check your binaryen installation" --- src/mono/browser/build/BrowserWasmApp.targets | 1 + 1 file changed, 1 insertion(+) diff --git a/src/mono/browser/build/BrowserWasmApp.targets b/src/mono/browser/build/BrowserWasmApp.targets index 7abd3d4ffa99c8..5ac921d86ab996 100644 --- a/src/mono/browser/build/BrowserWasmApp.targets +++ b/src/mono/browser/build/BrowserWasmApp.targets @@ -204,6 +204,7 @@ + From 8ed999c1b738ab7371d7acc5508dca7d1d9a248a Mon Sep 17 00:00:00 2001 From: Ilona Tomkowicz Date: Wed, 21 Aug 2024 15:26:33 +0200 Subject: [PATCH 22/36] "EndsWith" did not detect the need to append "bin" correctly. --- src/mono/browser/build/BrowserWasmApp.targets | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/mono/browser/build/BrowserWasmApp.targets b/src/mono/browser/build/BrowserWasmApp.targets index 5ac921d86ab996..9aeab4fc73af67 100644 --- a/src/mono/browser/build/BrowserWasmApp.targets +++ b/src/mono/browser/build/BrowserWasmApp.targets @@ -195,8 +195,9 @@ $([MSBuild]::NormalizeDirectory($(EmscriptenSdkToolsPath))) $([MSBuild]::NormalizeDirectory($(EmscriptenNodeToolsPath))) $([MSBuild]::NormalizeDirectory($(EmscriptenUpstreamBinPath))) - <_EmscriptenNodePath Condition="!$(EmscriptenNodeToolsPath.EndsWith('bin'))">$([MSBuild]::NormalizePath($(EmscriptenNodeToolsPath), 'bin', 'node$(_ExeExt)')) - <_EmscriptenNodePath Condition="$(EmscriptenNodeToolsPath.EndsWith('bin'))" >$([MSBuild]::NormalizePath($(EmscriptenNodeToolsPath), 'node$(_ExeExt)')) + <_EmscriptenNodeToolsPathWithBin>$([System.IO.Path]::Combine($(EmscriptenNodeToolsPath), 'bin', 'node$(_ExeExt)')) + <_EmscriptenNodePath Condition="Exists('$(_EmscriptenNodeToolsPathWithBin)')" >$(_EmscriptenNodeToolsPathWithBin) + <_EmscriptenNodePath Condition="'$(_EmscriptenNodePath)' == ''" >$([System.IO.Path]::Combine($(EmscriptenNodeToolsPath), 'node$(_ExeExt)')) @@ -290,8 +291,9 @@ false $(EmscriptenUpstreamEmscriptenPath)emcc - <_EmscriptenNodePath Condition="!$(EmscriptenNodeToolsPath.EndsWith('bin'))">$([MSBuild]::NormalizePath($(EmscriptenNodeToolsPath), 'bin', 'node$(_ExeExt)')) - <_EmscriptenNodePath Condition="$(EmscriptenNodeToolsPath.EndsWith('bin'))" >$([MSBuild]::NormalizePath($(EmscriptenNodeToolsPath), 'node$(_ExeExt)')) + <_EmscriptenNodeToolsPathWithBin>$([System.IO.Path]::Combine($(EmscriptenNodeToolsPath), 'bin', 'node$(_ExeExt)')) + <_EmscriptenNodePath Condition="Exists('$(_EmscriptenNodeToolsPathWithBin)')" >$(_EmscriptenNodeToolsPathWithBin) + <_EmscriptenNodePath Condition="'$(_EmscriptenNodePath)' == ''" >$([System.IO.Path]::Combine($(EmscriptenNodeToolsPath), 'node$(_ExeExt)')) From 383e5cd8b3fa50e58c16b58ffa975a25aac61e38 Mon Sep 17 00:00:00 2001 From: Ilona Tomkowicz Date: Thu, 22 Aug 2024 13:02:16 +0200 Subject: [PATCH 23/36] Revert redundant changes to user-app targets. --- src/mono/browser/build/BrowserWasmApp.targets | 11 +++-------- src/mono/browser/build/EmSdkRepo.Defaults.props | 4 ++-- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/src/mono/browser/build/BrowserWasmApp.targets b/src/mono/browser/build/BrowserWasmApp.targets index 9aeab4fc73af67..290c7a551908b2 100644 --- a/src/mono/browser/build/BrowserWasmApp.targets +++ b/src/mono/browser/build/BrowserWasmApp.targets @@ -195,9 +195,7 @@ $([MSBuild]::NormalizeDirectory($(EmscriptenSdkToolsPath))) $([MSBuild]::NormalizeDirectory($(EmscriptenNodeToolsPath))) $([MSBuild]::NormalizeDirectory($(EmscriptenUpstreamBinPath))) - <_EmscriptenNodeToolsPathWithBin>$([System.IO.Path]::Combine($(EmscriptenNodeToolsPath), 'bin', 'node$(_ExeExt)')) - <_EmscriptenNodePath Condition="Exists('$(_EmscriptenNodeToolsPathWithBin)')" >$(_EmscriptenNodeToolsPathWithBin) - <_EmscriptenNodePath Condition="'$(_EmscriptenNodePath)' == ''" >$([System.IO.Path]::Combine($(EmscriptenNodeToolsPath), 'node$(_ExeExt)')) + <_EmscriptenNodePath>$([MSBuild]::NormalizePath($(EmscriptenNodeToolsPath), 'bin', 'node$(_ExeExt)')) @@ -206,7 +204,7 @@ - + @@ -291,9 +289,6 @@ false $(EmscriptenUpstreamEmscriptenPath)emcc - <_EmscriptenNodeToolsPathWithBin>$([System.IO.Path]::Combine($(EmscriptenNodeToolsPath), 'bin', 'node$(_ExeExt)')) - <_EmscriptenNodePath Condition="Exists('$(_EmscriptenNodeToolsPathWithBin)')" >$(_EmscriptenNodeToolsPathWithBin) - <_EmscriptenNodePath Condition="'$(_EmscriptenNodePath)' == ''" >$([System.IO.Path]::Combine($(EmscriptenNodeToolsPath), 'node$(_ExeExt)')) @@ -380,7 +375,7 @@ - + diff --git a/src/mono/browser/build/EmSdkRepo.Defaults.props b/src/mono/browser/build/EmSdkRepo.Defaults.props index af79751189ef63..aa94ded228bfc7 100644 --- a/src/mono/browser/build/EmSdkRepo.Defaults.props +++ b/src/mono/browser/build/EmSdkRepo.Defaults.props @@ -8,14 +8,14 @@ $([MSBuild]::NormalizeDirectory($(EmscriptenSdkToolsPath), 'emscripten')) - $([System.IO.Path]::Combine($(NuGetPackageRoot), 'runtime.$(_portableHostOS)-$(BuildArchitecture).microsoft.netcore.runtime.wasm.node.transport', '$(NodePackageVersion)', 'tools', '$(_portableHostOS)-$(BuildArchitecture)', 'bin')) + $([MSBuild]::NormalizeDirectory($(EmscriptenSdkToolsPath), 'node', 'bin')) <_UsingEMSDK_PATH>true - $([System.IO.Path]::Combine($(NuGetPackageRoot), 'Microsoft.NET.Runtime.Emscripten.$(EmsdkVersion).Python.win-$(BuildArchitecture)', '$(EmsdkPackageVersion)', 'tools')) + $([MSBuild]::NormalizeDirectory($(EmscriptenSdkToolsPath)python)) <_EMSDKMissingPaths Condition="'$(_EMSDKMissingPaths)' == '' and ('$(EmscriptenPythonToolsPath)' == '' or !Exists('$(EmscriptenPythonToolsPath)'))">%24(EmscriptenPythonToolsPath)=$(EmscriptenPythonToolsPath) From 2dd0adbf2d2e9813fa0401178a7b7b16a7b4c434 Mon Sep 17 00:00:00 2001 From: Ilona Tomkowicz Date: Thu, 22 Aug 2024 13:04:41 +0200 Subject: [PATCH 24/36] Missing change revert --- src/mono/browser/build/BrowserWasmApp.targets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mono/browser/build/BrowserWasmApp.targets b/src/mono/browser/build/BrowserWasmApp.targets index 290c7a551908b2..1354eb72b8a713 100644 --- a/src/mono/browser/build/BrowserWasmApp.targets +++ b/src/mono/browser/build/BrowserWasmApp.targets @@ -358,7 +358,7 @@ <_WasmNativeFileForLinking Include="@(NativeFileReference)" /> - + From 65e574e700c922d9fd1dc457cd33a2f6f8fea482 Mon Sep 17 00:00:00 2001 From: Ilona Tomkowicz <32700855+ilonatommy@users.noreply.github.com> Date: Thu, 22 Aug 2024 15:29:48 +0000 Subject: [PATCH 25/36] Feedback. --- src/mono/browser/build/BrowserWasmApp.targets | 4 +--- src/mono/browser/build/WasmApp.InTree.targets | 7 +++++++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/mono/browser/build/BrowserWasmApp.targets b/src/mono/browser/build/BrowserWasmApp.targets index 1354eb72b8a713..887d0539b43916 100644 --- a/src/mono/browser/build/BrowserWasmApp.targets +++ b/src/mono/browser/build/BrowserWasmApp.targets @@ -203,7 +203,7 @@ - + @@ -374,8 +374,6 @@ - - diff --git a/src/mono/browser/build/WasmApp.InTree.targets b/src/mono/browser/build/WasmApp.InTree.targets index e4d1475c81f2cf..bddbd0ab3385da 100644 --- a/src/mono/browser/build/WasmApp.InTree.targets +++ b/src/mono/browser/build/WasmApp.InTree.targets @@ -51,4 +51,11 @@ + + + + $([MSBuild]::NormalizeDirectory( $([System.IO.Path]::Combine($(NuGetPackageRoot), 'runtime.$(_portableHostOS)-$(BuildArchitecture).microsoft.netcore.runtime.wasm.node.transport', '$(NodePackageVersion)', 'tools', '$(_portableHostOS)-$(BuildArchitecture)')) )) + $([MSBuild]::NormalizeDirectory( $([System.IO.Path]::Combine($(NuGetPackageRoot), 'Microsoft.NET.Runtime.Emscripten.$(EmsdkVersion).Python.win-$(BuildArchitecture)', '$(EmsdkPackageVersion)', 'tools')) )) + + From 1b7befc40c4ff797bedab4e97f49f102a85e5076 Mon Sep 17 00:00:00 2001 From: Ilona Tomkowicz Date: Fri, 23 Aug 2024 13:42:54 +0200 Subject: [PATCH 26/36] Import after `SetupPackagePaths` finishes. --- src/mono/browser/build/BrowserWasmApp.targets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mono/browser/build/BrowserWasmApp.targets b/src/mono/browser/build/BrowserWasmApp.targets index 887d0539b43916..24319220daa1c6 100644 --- a/src/mono/browser/build/BrowserWasmApp.targets +++ b/src/mono/browser/build/BrowserWasmApp.targets @@ -173,8 +173,8 @@ - + <_EMSDKMissingPaths Condition="'$(_EMSDKMissingPaths)' == '' and ('$(EmscriptenSdkToolsPath)' == '' or !Exists('$(EmscriptenSdkToolsPath)'))">%24(EmscriptenSdkToolsPath)=$(EmscriptenSdkToolsPath) <_EMSDKMissingPaths Condition="'$(_EMSDKMissingPaths)' == '' and ('$(EmscriptenNodeToolsPath)' == '' or !Exists('$(EmscriptenNodeToolsPath)'))">%24(EmscriptenNodeToolsPath)=$(EmscriptenNodeToolsPath) From 583035589736bf707d7770318d84609141d2623f Mon Sep 17 00:00:00 2001 From: Ilona Tomkowicz Date: Fri, 23 Aug 2024 14:26:09 +0200 Subject: [PATCH 27/36] Fix --- src/mono/browser/build/BrowserWasmApp.targets | 4 +++- src/mono/browser/build/WasmApp.InTree.props | 2 ++ src/mono/browser/build/WasmApp.InTree.targets | 6 ------ 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/mono/browser/build/BrowserWasmApp.targets b/src/mono/browser/build/BrowserWasmApp.targets index 24319220daa1c6..eee2a4fa5bf041 100644 --- a/src/mono/browser/build/BrowserWasmApp.targets +++ b/src/mono/browser/build/BrowserWasmApp.targets @@ -173,8 +173,8 @@ + - <_EMSDKMissingPaths Condition="'$(_EMSDKMissingPaths)' == '' and ('$(EmscriptenSdkToolsPath)' == '' or !Exists('$(EmscriptenSdkToolsPath)'))">%24(EmscriptenSdkToolsPath)=$(EmscriptenSdkToolsPath) <_EMSDKMissingPaths Condition="'$(_EMSDKMissingPaths)' == '' and ('$(EmscriptenNodeToolsPath)' == '' or !Exists('$(EmscriptenNodeToolsPath)'))">%24(EmscriptenNodeToolsPath)=$(EmscriptenNodeToolsPath) @@ -289,6 +289,7 @@ false $(EmscriptenUpstreamEmscriptenPath)emcc + @@ -360,6 +361,7 @@ + diff --git a/src/mono/browser/build/WasmApp.InTree.props b/src/mono/browser/build/WasmApp.InTree.props index 951aeca06948e3..3f2d7bce565d01 100644 --- a/src/mono/browser/build/WasmApp.InTree.props +++ b/src/mono/browser/build/WasmApp.InTree.props @@ -12,6 +12,8 @@ false $(NetCoreAppCurrent) $([MSBuild]::NormalizeDirectory($(MonoProjectRoot), 'browser', 'emsdk')) + $([MSBuild]::NormalizeDirectory( $([System.IO.Path]::Combine($(NuGetPackageRoot), 'runtime.$(_portableHostOS)-$(BuildArchitecture).microsoft.netcore.runtime.wasm.node.transport', '$(NodePackageVersion)', 'tools', '$(_portableHostOS)-$(BuildArchitecture)')) )) + $([MSBuild]::NormalizeDirectory( $([System.IO.Path]::Combine($(NuGetPackageRoot), 'Microsoft.NET.Runtime.Emscripten.$(EmsdkVersion).Python.win-$(BuildArchitecture)', '$(EmsdkPackageVersion)', 'tools')) )) false true false diff --git a/src/mono/browser/build/WasmApp.InTree.targets b/src/mono/browser/build/WasmApp.InTree.targets index bddbd0ab3385da..7e75839c1c82de 100644 --- a/src/mono/browser/build/WasmApp.InTree.targets +++ b/src/mono/browser/build/WasmApp.InTree.targets @@ -52,10 +52,4 @@ - - - $([MSBuild]::NormalizeDirectory( $([System.IO.Path]::Combine($(NuGetPackageRoot), 'runtime.$(_portableHostOS)-$(BuildArchitecture).microsoft.netcore.runtime.wasm.node.transport', '$(NodePackageVersion)', 'tools', '$(_portableHostOS)-$(BuildArchitecture)')) )) - $([MSBuild]::NormalizeDirectory( $([System.IO.Path]::Combine($(NuGetPackageRoot), 'Microsoft.NET.Runtime.Emscripten.$(EmsdkVersion).Python.win-$(BuildArchitecture)', '$(EmsdkPackageVersion)', 'tools')) )) - - From fb1738b85c7843a412f550ccc60100fd05b546c1 Mon Sep 17 00:00:00 2001 From: Ilona Tomkowicz <32700855+ilonatommy@users.noreply.github.com> Date: Tue, 27 Aug 2024 08:47:51 +0000 Subject: [PATCH 28/36] Remove redundant comments. --- src/mono/browser/build/BrowserWasmApp.targets | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/mono/browser/build/BrowserWasmApp.targets b/src/mono/browser/build/BrowserWasmApp.targets index eee2a4fa5bf041..887d0539b43916 100644 --- a/src/mono/browser/build/BrowserWasmApp.targets +++ b/src/mono/browser/build/BrowserWasmApp.targets @@ -289,7 +289,6 @@ false $(EmscriptenUpstreamEmscriptenPath)emcc - @@ -361,7 +360,6 @@ - From 5f8908be8f98f29cfaf7f928d28d837d560e9f6f Mon Sep 17 00:00:00 2001 From: Ilona Tomkowicz <32700855+ilonatommy@users.noreply.github.com> Date: Tue, 27 Aug 2024 10:58:10 +0000 Subject: [PATCH 29/36] `WasmApp.InTree.props` are loaded too late. Move the props back to defaults.props. --- src/mono/browser/build/EmSdkRepo.Defaults.props | 4 ++-- src/mono/browser/build/WasmApp.InTree.props | 2 -- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/mono/browser/build/EmSdkRepo.Defaults.props b/src/mono/browser/build/EmSdkRepo.Defaults.props index aa94ded228bfc7..12da4f61cef6c1 100644 --- a/src/mono/browser/build/EmSdkRepo.Defaults.props +++ b/src/mono/browser/build/EmSdkRepo.Defaults.props @@ -8,14 +8,14 @@ $([MSBuild]::NormalizeDirectory($(EmscriptenSdkToolsPath), 'emscripten')) - $([MSBuild]::NormalizeDirectory($(EmscriptenSdkToolsPath), 'node', 'bin')) + $([System.IO.Path]::Combine($(NuGetPackageRoot), 'runtime.$(_portableHostOS)-$(BuildArchitecture).microsoft.netcore.runtime.wasm.node.transport', '$(NodePackageVersion)', 'tools', '$(_portableHostOS)-$(BuildArchitecture)')) <_UsingEMSDK_PATH>true - $([MSBuild]::NormalizeDirectory($(EmscriptenSdkToolsPath)python)) + $([System.IO.Path]::Combine($(NuGetPackageRoot), 'Microsoft.NET.Runtime.Emscripten.$(EmsdkVersion).Python.win-$(BuildArchitecture)', '$(EmsdkPackageVersion)', 'tools')) <_EMSDKMissingPaths Condition="'$(_EMSDKMissingPaths)' == '' and ('$(EmscriptenPythonToolsPath)' == '' or !Exists('$(EmscriptenPythonToolsPath)'))">%24(EmscriptenPythonToolsPath)=$(EmscriptenPythonToolsPath) diff --git a/src/mono/browser/build/WasmApp.InTree.props b/src/mono/browser/build/WasmApp.InTree.props index 3f2d7bce565d01..951aeca06948e3 100644 --- a/src/mono/browser/build/WasmApp.InTree.props +++ b/src/mono/browser/build/WasmApp.InTree.props @@ -12,8 +12,6 @@ false $(NetCoreAppCurrent) $([MSBuild]::NormalizeDirectory($(MonoProjectRoot), 'browser', 'emsdk')) - $([MSBuild]::NormalizeDirectory( $([System.IO.Path]::Combine($(NuGetPackageRoot), 'runtime.$(_portableHostOS)-$(BuildArchitecture).microsoft.netcore.runtime.wasm.node.transport', '$(NodePackageVersion)', 'tools', '$(_portableHostOS)-$(BuildArchitecture)')) )) - $([MSBuild]::NormalizeDirectory( $([System.IO.Path]::Combine($(NuGetPackageRoot), 'Microsoft.NET.Runtime.Emscripten.$(EmsdkVersion).Python.win-$(BuildArchitecture)', '$(EmsdkPackageVersion)', 'tools')) )) false true false From 8c9a3f02d4536fba2082af96279d2091426dca80 Mon Sep 17 00:00:00 2001 From: Ilona Tomkowicz Date: Tue, 27 Aug 2024 13:24:52 +0200 Subject: [PATCH 30/36] Fix missing slash in the end of the path. --- src/mono/browser/build/EmSdkRepo.Defaults.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mono/browser/build/EmSdkRepo.Defaults.props b/src/mono/browser/build/EmSdkRepo.Defaults.props index 12da4f61cef6c1..7b1fb8dd005205 100644 --- a/src/mono/browser/build/EmSdkRepo.Defaults.props +++ b/src/mono/browser/build/EmSdkRepo.Defaults.props @@ -15,7 +15,7 @@ - $([System.IO.Path]::Combine($(NuGetPackageRoot), 'Microsoft.NET.Runtime.Emscripten.$(EmsdkVersion).Python.win-$(BuildArchitecture)', '$(EmsdkPackageVersion)', 'tools')) + $([MSBuild]::NormalizeDirectory($([System.IO.Path]::Combine($(NuGetPackageRoot), 'Microsoft.NET.Runtime.Emscripten.$(EmsdkVersion).Python.win-$(BuildArchitecture)', '$(EmsdkPackageVersion)', 'tools')))) <_EMSDKMissingPaths Condition="'$(_EMSDKMissingPaths)' == '' and ('$(EmscriptenPythonToolsPath)' == '' or !Exists('$(EmscriptenPythonToolsPath)'))">%24(EmscriptenPythonToolsPath)=$(EmscriptenPythonToolsPath) From b14d7a9770c29db003826f2e1fdea92e3abacef9 Mon Sep 17 00:00:00 2001 From: Ilona Tomkowicz <32700855+ilonatommy@users.noreply.github.com> Date: Wed, 28 Aug 2024 06:56:23 +0000 Subject: [PATCH 31/36] Remove whitespace change. --- src/mono/browser/build/WasmApp.InTree.targets | 1 - 1 file changed, 1 deletion(-) diff --git a/src/mono/browser/build/WasmApp.InTree.targets b/src/mono/browser/build/WasmApp.InTree.targets index 7e75839c1c82de..e4d1475c81f2cf 100644 --- a/src/mono/browser/build/WasmApp.InTree.targets +++ b/src/mono/browser/build/WasmApp.InTree.targets @@ -51,5 +51,4 @@ - From 6daf79ef0b9b4fee18e8219eb9fd9566161479d9 Mon Sep 17 00:00:00 2001 From: Ilona Tomkowicz <32700855+ilonatommy@users.noreply.github.com> Date: Tue, 3 Sep 2024 07:16:05 +0000 Subject: [PATCH 32/36] Make sure properties to build nuget paths on helix are not empty. --- eng/testing/tests.wasm.targets | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/eng/testing/tests.wasm.targets b/eng/testing/tests.wasm.targets index eee739184828fa..eb70e11edc5d4e 100644 --- a/eng/testing/tests.wasm.targets +++ b/eng/testing/tests.wasm.targets @@ -131,7 +131,13 @@ <_WasmPropertyNames Include="WasmNativeStrip" /> <_WasmPropertyNames Include="_WasmDevel" /> <_WasmPropertyNames Include="_WasmStrictVersionMatch" /> - <_WasmPropertyNames Include="WasmEmitSymbolMap" /> + <_WasmPropertyNames Include="WasmEmitSymbolMap" /> + <_WasmPropertyNames Include="NuGetPackageRoot" /> + <_WasmPropertyNames Include="_portableHostOS" /> + <_WasmPropertyNames Include="BuildArchitecture" /> + <_WasmPropertyNames Include="NodePackageVersion" /> + <_WasmPropertyNames Include="EmsdkVersion" /> + <_WasmPropertyNames Include="EmsdkPackageVersion" /> <_WasmPropertiesToPass Include="$(%(_WasmPropertyNames.Identity))" From 08f86f3df97abd98ebe363003a090b7bf573b4e9 Mon Sep 17 00:00:00 2001 From: Ilona Tomkowicz <32700855+ilonatommy@users.noreply.github.com> Date: Tue, 3 Sep 2024 08:43:19 +0000 Subject: [PATCH 33/36] Debugging commit, see where are packages. --- src/mono/browser/build/BrowserWasmApp.targets | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/mono/browser/build/BrowserWasmApp.targets b/src/mono/browser/build/BrowserWasmApp.targets index 887d0539b43916..0dd2c0e43e5372 100644 --- a/src/mono/browser/build/BrowserWasmApp.targets +++ b/src/mono/browser/build/BrowserWasmApp.targets @@ -175,12 +175,23 @@ + + + + + $([System.IO.Path]::GetFullPath($(EmscriptenNodeToolsPath)/../..)) + $([System.IO.Path]::GetFullPath($(EmscriptenNodeToolsPath)/../../..)) <_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. @@ -189,6 +200,7 @@ <_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 + <_ToolchainMissingErrorMessage>$(_ToolchainMissingErrorMessage); [DEBUG] Directories at $(NodeTransportDir): %(NodeTransportDirContents.Identity); Directories at $(PackagesDir): %(PackagesDirContents.Identity); From 4744846606199d5b896a7ee35411c986caa53a00 Mon Sep 17 00:00:00 2001 From: Ilona Tomkowicz <32700855+ilonatommy@users.noreply.github.com> Date: Tue, 3 Sep 2024 11:32:32 +0000 Subject: [PATCH 34/36] More debugging. --- src/mono/browser/build/BrowserWasmApp.targets | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/mono/browser/build/BrowserWasmApp.targets b/src/mono/browser/build/BrowserWasmApp.targets index 0dd2c0e43e5372..f15458a9273bfd 100644 --- a/src/mono/browser/build/BrowserWasmApp.targets +++ b/src/mono/browser/build/BrowserWasmApp.targets @@ -178,10 +178,12 @@ - - $([System.IO.Path]::GetFullPath($(EmscriptenNodeToolsPath)/../..)) - $([System.IO.Path]::GetFullPath($(EmscriptenNodeToolsPath)/../../..)) + $([System.Text.RegularExpressions.Regex]::Match($(NuGetLocalsOutput), 'global-packages:\s*([^;]+)').Groups[1].Value) + + + + $([System.IO.Path]::Combine($(GlobalPackagesPath), 'runtime.$(_portableHostOS)-$(BuildArchitecture).microsoft.netcore.runtime.wasm.node.transport')) <_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) @@ -189,7 +191,7 @@ - + From 574548b002d66acbfd7c569fa900ba4d86eb7560 Mon Sep 17 00:00:00 2001 From: Ilona Tomkowicz <32700855+ilonatommy@users.noreply.github.com> Date: Thu, 5 Sep 2024 14:02:05 +0000 Subject: [PATCH 35/36] Fallback for helix. --- src/mono/browser/build/EmSdkRepo.Defaults.props | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/mono/browser/build/EmSdkRepo.Defaults.props b/src/mono/browser/build/EmSdkRepo.Defaults.props index 7b1fb8dd005205..9e28b902f891fa 100644 --- a/src/mono/browser/build/EmSdkRepo.Defaults.props +++ b/src/mono/browser/build/EmSdkRepo.Defaults.props @@ -7,7 +7,10 @@ $([MSBuild]::NormalizeDirectory($(EmscriptenSdkToolsPath), 'bin')) $([MSBuild]::NormalizeDirectory($(EmscriptenSdkToolsPath), 'emscripten')) + <_PathToNugetsAvailable Condition="'$(NuGetPackageRoot)' != '' and '$(_portableHostOS)' != '' and '$(BuildArchitecture)' != '' and '$(NodePackageVersion)' != ''">true + + $([MSBuild]::NormalizeDirectory($(EmscriptenSdkToolsPath), 'node', 'bin')) $([System.IO.Path]::Combine($(NuGetPackageRoot), 'runtime.$(_portableHostOS)-$(BuildArchitecture).microsoft.netcore.runtime.wasm.node.transport', '$(NodePackageVersion)', 'tools', '$(_portableHostOS)-$(BuildArchitecture)')) <_UsingEMSDK_PATH>true @@ -15,7 +18,9 @@ - $([MSBuild]::NormalizeDirectory($([System.IO.Path]::Combine($(NuGetPackageRoot), 'Microsoft.NET.Runtime.Emscripten.$(EmsdkVersion).Python.win-$(BuildArchitecture)', '$(EmsdkPackageVersion)', 'tools')))) + <_PathToNugetsAvailable Condition="'$(NuGetPackageRoot)' != '' and '$(EmsdkVersion)' != '' and '$(BuildArchitecture)' != '' and '$(EmsdkPackageVersion)' != ''">true + $([MSBuild]::NormalizeDirectory($(EmscriptenSdkToolsPath)python)) + $([MSBuild]::NormalizeDirectory($([System.IO.Path]::Combine($(NuGetPackageRoot), 'Microsoft.NET.Runtime.Emscripten.$(EmsdkVersion).Python.win-$(BuildArchitecture)', '$(EmsdkPackageVersion)', 'tools')))) <_EMSDKMissingPaths Condition="'$(_EMSDKMissingPaths)' == '' and ('$(EmscriptenPythonToolsPath)' == '' or !Exists('$(EmscriptenPythonToolsPath)'))">%24(EmscriptenPythonToolsPath)=$(EmscriptenPythonToolsPath) From f9acf9f1e10d1b3285059ee57754f91f9301ffe5 Mon Sep 17 00:00:00 2001 From: Ilona Tomkowicz <32700855+ilonatommy@users.noreply.github.com> Date: Thu, 5 Sep 2024 14:02:56 +0000 Subject: [PATCH 36/36] Cleanup needed when we have the fallback. --- eng/testing/tests.wasm.targets | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/eng/testing/tests.wasm.targets b/eng/testing/tests.wasm.targets index eb70e11edc5d4e..eee739184828fa 100644 --- a/eng/testing/tests.wasm.targets +++ b/eng/testing/tests.wasm.targets @@ -131,13 +131,7 @@ <_WasmPropertyNames Include="WasmNativeStrip" /> <_WasmPropertyNames Include="_WasmDevel" /> <_WasmPropertyNames Include="_WasmStrictVersionMatch" /> - <_WasmPropertyNames Include="WasmEmitSymbolMap" /> - <_WasmPropertyNames Include="NuGetPackageRoot" /> - <_WasmPropertyNames Include="_portableHostOS" /> - <_WasmPropertyNames Include="BuildArchitecture" /> - <_WasmPropertyNames Include="NodePackageVersion" /> - <_WasmPropertyNames Include="EmsdkVersion" /> - <_WasmPropertyNames Include="EmsdkPackageVersion" /> + <_WasmPropertyNames Include="WasmEmitSymbolMap" /> <_WasmPropertiesToPass Include="$(%(_WasmPropertyNames.Identity))"