diff --git a/src/Uno.Wasm.Bootstrap/Constants.cs b/src/Uno.Wasm.Bootstrap/Constants.cs index f725436da..17b31b8e4 100644 --- a/src/Uno.Wasm.Bootstrap/Constants.cs +++ b/src/Uno.Wasm.Bootstrap/Constants.cs @@ -10,9 +10,6 @@ internal class Constants public const string DefaultSdkUrl = @"https://unowasmbootstrap.azureedge.net/runtime/mono-wasm-f30f5adfbbb.zip"; public const string DefaultAotSDKUrl = @"https://unowasmbootstrap.azureedge.net/runtime/wasm-release-Linux-f30f5adfbbb07cc4c4ba0add8ccfa35e652d3354.zip"; - // NOTE: The SDK version may be overriden by an installation of the https://www.nuget.org/packages/Uno.Wasm.MonoRuntime nuget package - public const string DefaultDotnetRuntimeSdkUrl = "https://unowasmbootstrap.azureedge.net/runtime/dotnet-runtime-wasm-b27ff42-22309-Release.zip"; - /// /// Min version of the emscripten SDK. Must be aligned with mono's SDK build in . /// @@ -20,6 +17,18 @@ internal class Constants /// The emscripten version use by mono can be found here: /// https://github.com/mono/mono/blob/master/sdks/builds/wasm.mk#L4 /// - public static Version EmscriptenVersion { get; } = new Version("2.0.9"); + public static Version MonoRuntimeEmscriptenVersion { get; } = new Version("2.0.6"); + + // NOTE: The SDK version may be overriden by an installation of the https://www.nuget.org/packages/Uno.Wasm.MonoRuntime nuget package + public const string DefaultDotnetRuntimeSdkUrl = "https://unowasmbootstrap.azureedge.net/runtime/dotnet-runtime-wasm-b27ff42-22309-Release.zip"; + + /// + /// Min version of the emscripten SDK. Must be aligned with dotnet/runtime SDK build in . + /// + /// + /// The emscripten version use by dotnet/runtime can be found here: + /// https://github.com/dotnet/runtime/blob/f9bb1673708ca840da0e71f9a9444ea9b0d31911/src/mono/wasm/Makefile#L32 + /// + public static Version DotnetRuntimeEmscriptenVersion { get; } = new Version("2.0.9"); } } diff --git a/src/Uno.Wasm.Bootstrap/ShellTask.cs b/src/Uno.Wasm.Bootstrap/ShellTask.cs index a03fe05f0..382d35013 100644 --- a/src/Uno.Wasm.Bootstrap/ShellTask.cs +++ b/src/Uno.Wasm.Bootstrap/ShellTask.cs @@ -445,6 +445,11 @@ as the BrotliStream must be closed in order to signal that no more blocks are be private bool HasAotProfile => AotProfile?.Any() ?? false; + public Version CurrentEmscriptenVersion + => IsNetCoreWasm + ? Constants.DotnetRuntimeEmscriptenVersion + : Constants.MonoRuntimeEmscriptenVersion; + private (int exitCode, string output, string error) RunProcess(string executable, string parameters, string? workingDirectory = null) { if (IsWSLRequired && !ForceDisableWSL) @@ -937,7 +942,7 @@ private string ValidateEmscripten() if (Environment.OSVersion.Platform == PlatformID.Win32NT) { var emsdkHostFolder = Environment.GetEnvironmentVariable("WASMSHELL_WSLEMSDK") ?? "$HOME/.uno/emsdk"; - var emsdkBaseFolder = emsdkHostFolder + $"/emsdk-{Constants.EmscriptenVersion}"; + var emsdkBaseFolder = emsdkHostFolder + $"/emsdk-{CurrentEmscriptenVersion}"; if (!File.Exists(Environment.GetEnvironmentVariable("WINDIR") + "\\sysnative\\bash.exe")) { @@ -951,7 +956,7 @@ private string ValidateEmscripten() var result = RunProcess( emscriptenSetupScript, - $"\"{emsdkHostFolder.Replace("\\\\?\\", "").TrimEnd('\\')}\" {Constants.EmscriptenVersion}"); + $"\"{emsdkHostFolder.Replace("\\\\?\\", "").TrimEnd('\\')}\" {CurrentEmscriptenVersion}"); if (result.exitCode == 0) { @@ -972,14 +977,14 @@ private string ValidateEmscripten() var home = Environment.GetEnvironmentVariable("HOME"); var emsdkHostFolder = Environment.GetEnvironmentVariable("WASMSHELL_WSLEMSDK") ?? $"{home}/.uno/emsdk"; var emscriptenSetupScript = Path.Combine(BuildTaskBasePath, "scripts", "emscripten-setup.sh"); - var emsdkBaseFolder = emsdkHostFolder + $"/emsdk-{Constants.EmscriptenVersion}"; + var emsdkBaseFolder = emsdkHostFolder + $"/emsdk-{CurrentEmscriptenVersion}"; // Adjust line endings AdjustFileLineEndings(emscriptenSetupScript); var result = RunProcess( "bash", - $"-c \"chmod +x {emscriptenSetupScript}; {emscriptenSetupScript} \\\"{emsdkHostFolder}\\\" {Constants.EmscriptenVersion}\""); + $"-c \"chmod +x {emscriptenSetupScript}; {emscriptenSetupScript} \\\"{emsdkHostFolder}\\\" {CurrentEmscriptenVersion}\""); if (result.exitCode == 0) { @@ -1020,7 +1025,7 @@ private IEnumerable GetBitcodeFilesParams() .ToArray() ?? new string[0]; - _bitcodeFilesCache = BitcodeFilesSelector.Filter(Constants.EmscriptenVersion, _bitcodeFilesCache); + _bitcodeFilesCache = BitcodeFilesSelector.Filter(CurrentEmscriptenVersion, _bitcodeFilesCache); } return _bitcodeFilesCache;