diff --git a/src/Uno.Wasm.Bootstrap/ShellTask.cs b/src/Uno.Wasm.Bootstrap/ShellTask.cs index d9aebb0..79b9bb3 100644 --- a/src/Uno.Wasm.Bootstrap/ShellTask.cs +++ b/src/Uno.Wasm.Bootstrap/ShellTask.cs @@ -686,9 +686,16 @@ namespace Uno.Wasm.Bootstrap Log.LogMessage(MessageImportance.Low, $"Bitcode files features lookup filter: {string.Join(",", features)}"); - var list = BitcodeFilesSelector.Filter(new(EmscriptenVersion), features.ToArray(), bitcodeFiles); + if (Version.TryParse(EmscriptenVersion, out var emsdkVersion)) + { + var list = BitcodeFilesSelector.Filter(emsdkVersion, features.ToArray(), bitcodeFiles); - NativeFileReference = list.Select(i => new TaskItem(i)).ToArray(); + NativeFileReference = list.Select(i => new TaskItem(i)).ToArray(); + } + else + { + Log.LogMessage(MessageImportance.Low, $"EmscriptenVersion is not set, skipping native assets"); + } } private IEnumerable GetEmccExportedRuntimeMethods() diff --git a/src/Uno.Wasm.Bootstrap/build/Uno.Wasm.Bootstrap.targets b/src/Uno.Wasm.Bootstrap/build/Uno.Wasm.Bootstrap.targets index 480dd0f..ecc8513 100644 --- a/src/Uno.Wasm.Bootstrap/build/Uno.Wasm.Bootstrap.targets +++ b/src/Uno.Wasm.Bootstrap/build/Uno.Wasm.Bootstrap.targets @@ -32,11 +32,24 @@ BeforeTargets="ResolveRuntimePackAssets" Condition=" '$(WasmShellGenerateAOTProfile)' == 'true' "> - + + + + + + + + @@ -110,6 +123,7 @@ $(TMP)\emsdk-cache diff --git a/src/Uno.Wasm.Bootstrap/tools/support/Uno.Wasm.AotProfiler.deps.json b/src/Uno.Wasm.Bootstrap/tools/support/Uno.Wasm.AotProfiler.deps.json new file mode 100644 index 0000000..1343e46 --- /dev/null +++ b/src/Uno.Wasm.Bootstrap/tools/support/Uno.Wasm.AotProfiler.deps.json @@ -0,0 +1,118 @@ +{ + "runtimeTarget": { + "name": ".NETCoreApp,Version=v7.0", + "signature": "" + }, + "compilationOptions": {}, + "targets": { + ".NETCoreApp,Version=v7.0": { + "Uno.Wasm.AotProfiler/1.0.0": { + "dependencies": { + "DotNet.ReproducibleBuilds": "1.1.1", + "System.Memory": "4.5.2" + }, + "runtime": { + "Uno.Wasm.AotProfiler.dll": {} + } + }, + "DotNet.ReproducibleBuilds/1.1.1": { + "dependencies": { + "Microsoft.SourceLink.AzureRepos.Git": "1.1.1", + "Microsoft.SourceLink.Bitbucket.Git": "1.1.1", + "Microsoft.SourceLink.GitHub": "1.1.1", + "Microsoft.SourceLink.GitLab": "1.1.1" + } + }, + "Microsoft.Build.Tasks.Git/1.1.1": {}, + "Microsoft.SourceLink.AzureRepos.Git/1.1.1": { + "dependencies": { + "Microsoft.Build.Tasks.Git": "1.1.1", + "Microsoft.SourceLink.Common": "1.1.1" + } + }, + "Microsoft.SourceLink.Bitbucket.Git/1.1.1": { + "dependencies": { + "Microsoft.Build.Tasks.Git": "1.1.1", + "Microsoft.SourceLink.Common": "1.1.1" + } + }, + "Microsoft.SourceLink.Common/1.1.1": {}, + "Microsoft.SourceLink.GitHub/1.1.1": { + "dependencies": { + "Microsoft.Build.Tasks.Git": "1.1.1", + "Microsoft.SourceLink.Common": "1.1.1" + } + }, + "Microsoft.SourceLink.GitLab/1.1.1": { + "dependencies": { + "Microsoft.Build.Tasks.Git": "1.1.1", + "Microsoft.SourceLink.Common": "1.1.1" + } + }, + "System.Memory/4.5.2": {} + } + }, + "libraries": { + "Uno.Wasm.AotProfiler/1.0.0": { + "type": "project", + "serviceable": false, + "sha512": "" + }, + "DotNet.ReproducibleBuilds/1.1.1": { + "type": "package", + "serviceable": true, + "sha512": "sha512-+H2t/t34h6mhEoUvHi8yGXyuZ2GjSovcGYehJrS2MDm2XgmPfZL2Sdxg+uL2lKgZ4M6tTwKHIlxOob2bgh0NRQ==", + "path": "dotnet.reproduciblebuilds/1.1.1", + "hashPath": "dotnet.reproduciblebuilds.1.1.1.nupkg.sha512" + }, + "Microsoft.Build.Tasks.Git/1.1.1": { + "type": "package", + "serviceable": true, + "sha512": "sha512-AT3HlgTjsqHnWpBHSNeR0KxbLZD7bztlZVj7I8vgeYG9SYqbeFGh0TM/KVtC6fg53nrWHl3VfZFvb5BiQFcY6Q==", + "path": "microsoft.build.tasks.git/1.1.1", + "hashPath": "microsoft.build.tasks.git.1.1.1.nupkg.sha512" + }, + "Microsoft.SourceLink.AzureRepos.Git/1.1.1": { + "type": "package", + "serviceable": true, + "sha512": "sha512-qB5urvw9LO2bG3eVAkuL+2ughxz2rR7aYgm2iyrB8Rlk9cp2ndvGRCvehk3rNIhRuNtQaeKwctOl1KvWiklv5w==", + "path": "microsoft.sourcelink.azurerepos.git/1.1.1", + "hashPath": "microsoft.sourcelink.azurerepos.git.1.1.1.nupkg.sha512" + }, + "Microsoft.SourceLink.Bitbucket.Git/1.1.1": { + "type": "package", + "serviceable": true, + "sha512": "sha512-cDzxXwlyWpLWaH0em4Idj0H3AmVo3L/6xRXKssYemx+7W52iNskj/SQ4FOmfCb8YQt39otTDNMveCZzYtMoucQ==", + "path": "microsoft.sourcelink.bitbucket.git/1.1.1", + "hashPath": "microsoft.sourcelink.bitbucket.git.1.1.1.nupkg.sha512" + }, + "Microsoft.SourceLink.Common/1.1.1": { + "type": "package", + "serviceable": true, + "sha512": "sha512-WMcGpWKrmJmzrNeuaEb23bEMnbtR/vLmvZtkAP5qWu7vQsY59GqfRJd65sFpBszbd2k/bQ8cs8eWawQKAabkVg==", + "path": "microsoft.sourcelink.common/1.1.1", + "hashPath": "microsoft.sourcelink.common.1.1.1.nupkg.sha512" + }, + "Microsoft.SourceLink.GitHub/1.1.1": { + "type": "package", + "serviceable": true, + "sha512": "sha512-IaJGnOv/M7UQjRJks7B6p7pbPnOwisYGOIzqCz5ilGFTApZ3ktOR+6zJ12ZRPInulBmdAf1SrGdDG2MU8g6XTw==", + "path": "microsoft.sourcelink.github/1.1.1", + "hashPath": "microsoft.sourcelink.github.1.1.1.nupkg.sha512" + }, + "Microsoft.SourceLink.GitLab/1.1.1": { + "type": "package", + "serviceable": true, + "sha512": "sha512-tvsg47DDLqqedlPeYVE2lmiTpND8F0hkrealQ5hYltSmvruy/Gr5nHAKSsjyw5L3NeM/HLMI5ORv7on/M4qyZw==", + "path": "microsoft.sourcelink.gitlab/1.1.1", + "hashPath": "microsoft.sourcelink.gitlab.1.1.1.nupkg.sha512" + }, + "System.Memory/4.5.2": { + "type": "package", + "serviceable": true, + "sha512": "sha512-fvq1GNmUFwbKv+aLVYYdgu/+gc8Nu9oFujOxIjPrsf+meis9JBzTPDL6aP/eeGOz9yPj6rRLUbOjKMpsMEWpNg==", + "path": "system.memory/4.5.2", + "hashPath": "system.memory.4.5.2.nupkg.sha512" + } + } +} \ No newline at end of file diff --git a/src/Uno.Wasm.Bootstrap/tools/support/Uno.Wasm.AotProfiler.dll b/src/Uno.Wasm.Bootstrap/tools/support/Uno.Wasm.AotProfiler.dll new file mode 100644 index 0000000..8514629 Binary files /dev/null and b/src/Uno.Wasm.Bootstrap/tools/support/Uno.Wasm.AotProfiler.dll differ diff --git a/src/Uno.Wasm.Bootstrap/tools/support/Uno.Wasm.MetadataUpdater.deps.json b/src/Uno.Wasm.Bootstrap/tools/support/Uno.Wasm.MetadataUpdater.deps.json new file mode 100644 index 0000000..92b7a2d --- /dev/null +++ b/src/Uno.Wasm.Bootstrap/tools/support/Uno.Wasm.MetadataUpdater.deps.json @@ -0,0 +1,109 @@ +{ + "runtimeTarget": { + "name": ".NETCoreApp,Version=v8.0", + "signature": "" + }, + "compilationOptions": {}, + "targets": { + ".NETCoreApp,Version=v8.0": { + "Uno.Wasm.MetadataUpdater/1.0.0": { + "dependencies": { + "DotNet.ReproducibleBuilds": "1.1.1" + }, + "runtime": { + "Uno.Wasm.MetadataUpdater.dll": {} + } + }, + "DotNet.ReproducibleBuilds/1.1.1": { + "dependencies": { + "Microsoft.SourceLink.AzureRepos.Git": "1.1.1", + "Microsoft.SourceLink.Bitbucket.Git": "1.1.1", + "Microsoft.SourceLink.GitHub": "1.1.1", + "Microsoft.SourceLink.GitLab": "1.1.1" + } + }, + "Microsoft.Build.Tasks.Git/1.1.1": {}, + "Microsoft.SourceLink.AzureRepos.Git/1.1.1": { + "dependencies": { + "Microsoft.Build.Tasks.Git": "1.1.1", + "Microsoft.SourceLink.Common": "1.1.1" + } + }, + "Microsoft.SourceLink.Bitbucket.Git/1.1.1": { + "dependencies": { + "Microsoft.Build.Tasks.Git": "1.1.1", + "Microsoft.SourceLink.Common": "1.1.1" + } + }, + "Microsoft.SourceLink.Common/1.1.1": {}, + "Microsoft.SourceLink.GitHub/1.1.1": { + "dependencies": { + "Microsoft.Build.Tasks.Git": "1.1.1", + "Microsoft.SourceLink.Common": "1.1.1" + } + }, + "Microsoft.SourceLink.GitLab/1.1.1": { + "dependencies": { + "Microsoft.Build.Tasks.Git": "1.1.1", + "Microsoft.SourceLink.Common": "1.1.1" + } + } + } + }, + "libraries": { + "Uno.Wasm.MetadataUpdater/1.0.0": { + "type": "project", + "serviceable": false, + "sha512": "" + }, + "DotNet.ReproducibleBuilds/1.1.1": { + "type": "package", + "serviceable": true, + "sha512": "sha512-+H2t/t34h6mhEoUvHi8yGXyuZ2GjSovcGYehJrS2MDm2XgmPfZL2Sdxg+uL2lKgZ4M6tTwKHIlxOob2bgh0NRQ==", + "path": "dotnet.reproduciblebuilds/1.1.1", + "hashPath": "dotnet.reproduciblebuilds.1.1.1.nupkg.sha512" + }, + "Microsoft.Build.Tasks.Git/1.1.1": { + "type": "package", + "serviceable": true, + "sha512": "sha512-AT3HlgTjsqHnWpBHSNeR0KxbLZD7bztlZVj7I8vgeYG9SYqbeFGh0TM/KVtC6fg53nrWHl3VfZFvb5BiQFcY6Q==", + "path": "microsoft.build.tasks.git/1.1.1", + "hashPath": "microsoft.build.tasks.git.1.1.1.nupkg.sha512" + }, + "Microsoft.SourceLink.AzureRepos.Git/1.1.1": { + "type": "package", + "serviceable": true, + "sha512": "sha512-qB5urvw9LO2bG3eVAkuL+2ughxz2rR7aYgm2iyrB8Rlk9cp2ndvGRCvehk3rNIhRuNtQaeKwctOl1KvWiklv5w==", + "path": "microsoft.sourcelink.azurerepos.git/1.1.1", + "hashPath": "microsoft.sourcelink.azurerepos.git.1.1.1.nupkg.sha512" + }, + "Microsoft.SourceLink.Bitbucket.Git/1.1.1": { + "type": "package", + "serviceable": true, + "sha512": "sha512-cDzxXwlyWpLWaH0em4Idj0H3AmVo3L/6xRXKssYemx+7W52iNskj/SQ4FOmfCb8YQt39otTDNMveCZzYtMoucQ==", + "path": "microsoft.sourcelink.bitbucket.git/1.1.1", + "hashPath": "microsoft.sourcelink.bitbucket.git.1.1.1.nupkg.sha512" + }, + "Microsoft.SourceLink.Common/1.1.1": { + "type": "package", + "serviceable": true, + "sha512": "sha512-WMcGpWKrmJmzrNeuaEb23bEMnbtR/vLmvZtkAP5qWu7vQsY59GqfRJd65sFpBszbd2k/bQ8cs8eWawQKAabkVg==", + "path": "microsoft.sourcelink.common/1.1.1", + "hashPath": "microsoft.sourcelink.common.1.1.1.nupkg.sha512" + }, + "Microsoft.SourceLink.GitHub/1.1.1": { + "type": "package", + "serviceable": true, + "sha512": "sha512-IaJGnOv/M7UQjRJks7B6p7pbPnOwisYGOIzqCz5ilGFTApZ3ktOR+6zJ12ZRPInulBmdAf1SrGdDG2MU8g6XTw==", + "path": "microsoft.sourcelink.github/1.1.1", + "hashPath": "microsoft.sourcelink.github.1.1.1.nupkg.sha512" + }, + "Microsoft.SourceLink.GitLab/1.1.1": { + "type": "package", + "serviceable": true, + "sha512": "sha512-tvsg47DDLqqedlPeYVE2lmiTpND8F0hkrealQ5hYltSmvruy/Gr5nHAKSsjyw5L3NeM/HLMI5ORv7on/M4qyZw==", + "path": "microsoft.sourcelink.gitlab/1.1.1", + "hashPath": "microsoft.sourcelink.gitlab.1.1.1.nupkg.sha512" + } + } +} \ No newline at end of file diff --git a/src/Uno.Wasm.Bootstrap/tools/support/Uno.Wasm.MetadataUpdater.dll b/src/Uno.Wasm.Bootstrap/tools/support/Uno.Wasm.MetadataUpdater.dll new file mode 100644 index 0000000..0490302 Binary files /dev/null and b/src/Uno.Wasm.Bootstrap/tools/support/Uno.Wasm.MetadataUpdater.dll differ diff --git a/src/Uno.Wasm.Bootstrap/ts/Uno/WebAssembly/Bootstrapper.ts b/src/Uno.Wasm.Bootstrap/ts/Uno/WebAssembly/Bootstrapper.ts index 3ec5e12..4e8a68f 100644 --- a/src/Uno.Wasm.Bootstrap/ts/Uno/WebAssembly/Bootstrapper.ts +++ b/src/Uno.Wasm.Bootstrap/ts/Uno/WebAssembly/Bootstrapper.ts @@ -270,8 +270,7 @@ namespace Uno.WebAssembly.Bootstrap { try { this.attachDebuggerHotkey(); - console.error("UNO TODO HOT RELOAD IS DISABLED"); - //await this.setupHotReload(); + await this.setupHotReload(); if (this._hotReloadSupport) { await this._hotReloadSupport.initializeHotReload(); diff --git a/src/Uno.Wasm.MetadataUpdater/Runtime.cs b/src/Uno.Wasm.MetadataUpdater/Runtime.cs index 4ef0a22..245943f 100644 --- a/src/Uno.Wasm.MetadataUpdater/Runtime.cs +++ b/src/Uno.Wasm.MetadataUpdater/Runtime.cs @@ -1,50 +1,23 @@ using System; using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Runtime.InteropServices.ComTypes; +using System.Runtime.InteropServices.JavaScript; namespace WebAssembly { internal sealed class Runtime { - /// - /// Mono specific internal call. - /// - [MethodImpl(MethodImplOptions.InternalCall)] - private static extern string InvokeJS(string str, out int exceptional_result); - - // Disable inlining to avoid the interpreter to evaluate an internal call that may not be available - [MethodImpl(MethodImplOptions.NoInlining)] - private static string MonoInvokeJS(string str, out int exceptionResult) => InvokeJS(str, out exceptionResult); - - // Disable inlining to avoid the interpreter to evaluate an internal call that may not be available - [MethodImpl(MethodImplOptions.NoInlining)] - private static string NetCoreInvokeJS(string str, out int exceptionResult) - => Interop.Runtime.InvokeJS(str, out exceptionResult); - /// /// Invokes Javascript code in the hosting environment /// internal static string InvokeJS(string str) - { - var r = IsNetCore - ? NetCoreInvokeJS(str, out var exceptionResult) - : MonoInvokeJS(str, out exceptionResult); - - if (exceptionResult != 0) - { - Console.Error.WriteLine($"Error #{exceptionResult} \"{r}\" executing javascript: \"{str}\""); - } - return r; - } - - internal static bool IsNetCore { get; } = Type.GetType("System.Runtime.Loader.AssemblyLoadContext") != null; + => Interop.InvokeJS(str); } -} -internal sealed class Interop -{ - internal sealed class Runtime + internal static partial class Interop { - [MethodImplAttribute(MethodImplOptions.InternalCall)] - public static extern string InvokeJS(string str, out int exceptional_result); + [JSImport("globalThis.Uno.WebAssembly.Bootstrap.Bootstrapper.invokeJS")] + public static partial string InvokeJS(string value); } }