Skip to content

Commit

Permalink
fix: Split mono/mono and dotnet/runtime versions.
Browse files Browse the repository at this point in the history
Rollback until emscripten-core/emscripten#12551 is fixed by aligning LLVM versions.
  • Loading branch information
jeromelaban committed Dec 3, 2020
1 parent 08fdea9 commit 371195a
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 9 deletions.
17 changes: 13 additions & 4 deletions src/Uno.Wasm.Bootstrap/Constants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,25 @@ 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";

/// <summary>
/// Min version of the emscripten SDK. Must be aligned with mono's SDK build in <see cref="DefaultAotSDKUrl"/>.
/// </summary>
/// <remarks>
/// The emscripten version use by mono can be found here:
/// https://github.com/mono/mono/blob/master/sdks/builds/wasm.mk#L4
/// </remarks>
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";

/// <summary>
/// Min version of the emscripten SDK. Must be aligned with dotnet/runtime SDK build in <see cref="NetCoreWasmSDKUri"/>.
/// </summary>
/// <remarks>
/// The emscripten version use by dotnet/runtime can be found here:
/// https://github.com/dotnet/runtime/blob/f9bb1673708ca840da0e71f9a9444ea9b0d31911/src/mono/wasm/Makefile#L32
/// </remarks>
public static Version DotnetRuntimeEmscriptenVersion { get; } = new Version("2.0.9");
}
}
15 changes: 10 additions & 5 deletions src/Uno.Wasm.Bootstrap/ShellTask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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"))
{
Expand All @@ -951,7 +956,7 @@ private string ValidateEmscripten()

var result = RunProcess(
emscriptenSetupScript,
$"\"{emsdkHostFolder.Replace("\\\\?\\", "").TrimEnd('\\')}\" {Constants.EmscriptenVersion}");
$"\"{emsdkHostFolder.Replace("\\\\?\\", "").TrimEnd('\\')}\" {CurrentEmscriptenVersion}");

if (result.exitCode == 0)
{
Expand All @@ -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)
{
Expand Down Expand Up @@ -1020,7 +1025,7 @@ private IEnumerable<string> GetBitcodeFilesParams()
.ToArray()
?? new string[0];

_bitcodeFilesCache = BitcodeFilesSelector.Filter(Constants.EmscriptenVersion, _bitcodeFilesCache);
_bitcodeFilesCache = BitcodeFilesSelector.Filter(CurrentEmscriptenVersion, _bitcodeFilesCache);
}

return _bitcodeFilesCache;
Expand Down

0 comments on commit 371195a

Please sign in to comment.