diff --git a/docs/using-nativeaot/compiling.md b/docs/using-nativeaot/compiling.md index 2c5fdf484e6..46057c16996 100644 --- a/docs/using-nativeaot/compiling.md +++ b/docs/using-nativeaot/compiling.md @@ -71,6 +71,8 @@ Another large contributor to the size is globalization support (ICU data and cod Additionally, NativeAOT-LLVM supports the following properties: - `WasmHtmlTemplate`: specifies path to the HTML template within which the WASM application will be embedded. An example of a minimal template can be found in the Emscripten repo: https://github.com/emscripten-core/emscripten/blob/main/src/shell_minimal.html +And item groups: +- `WasmComponentTypeWit`: WIT files that will be passed to the linker to define the imports and exports ('world') of the application as a component. ## WebAssembly native libraries diff --git a/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.targets b/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.targets index 6418e84d3b3..03585d580f0 100644 --- a/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.targets +++ b/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.targets @@ -548,7 +548,7 @@ The .NET Foundation licenses this file to you under the MIT license. - <_WasiComponentImports Include="$(IlcFrameworkNativePath)*.wit" /> + @@ -566,7 +566,7 @@ The .NET Foundation licenses this file to you under the MIT license. - + diff --git a/src/tests/nativeaot/SmokeTests/SharedLibrary/SharedLibrary.cs b/src/tests/nativeaot/SmokeTests/SharedLibrary/SharedLibrary.cs index 9db2c3a3cf5..f949690b1a2 100644 --- a/src/tests/nativeaot/SmokeTests/SharedLibrary/SharedLibrary.cs +++ b/src/tests/nativeaot/SmokeTests/SharedLibrary/SharedLibrary.cs @@ -147,29 +147,16 @@ public static int DoCheckSimpleGCCollect() } [UnmanagedCallersOnly(EntryPoint = "test-http")] - public static unsafe void wasmExportTestHttp(int p0) + public static unsafe void TestHttp(int port) { - TestHttp((((ushort)p0))); - } - - public static void TestHttp(ushort port) - { - var stopwatch = new Stopwatch(); - stopwatch.Start(); - - var task = TestHttpAsync(port); - while (!task.IsCompleted) - { - WasiEventLoop.DispatchWasiEventLoop(); - } - var exception = task.Exception; - if (exception is not null) - { - throw exception; - } + [UnsafeAccessor(UnsafeAccessorKind.StaticMethod, Name = "PollWasiEventLoopUntilResolvedVoid")] + static extern void PollWasiEventLoopUntilResolvedVoid(Thread t, Task task); + Stopwatch stopwatch = Stopwatch.StartNew(); + PollWasiEventLoopUntilResolvedVoid(null, TestHttpAsync((ushort)port)); stopwatch.Stop(); - // Verify that `WasiEventLoop.DispatchWasiEventLoop` returned + + // Verify that `PollWasiEventLoopUntilResolvedVoid` returned // promptly once the main task finished, even if there were other // tasks (e.g. the default 100 second HttpClient timeout) still in // progress. @@ -239,15 +226,4 @@ private static async Task TestHttpAsync(ushort port) Trace.Assert(stopwatch.ElapsedMilliseconds < 1000); } } - - internal static class WasiEventLoop - { - internal static void DispatchWasiEventLoop() - { - CallDispatchWasiEventLoop((Thread)null!); - - [UnsafeAccessor(UnsafeAccessorKind.StaticMethod, Name = "DispatchWasiEventLoop")] - static extern void CallDispatchWasiEventLoop(Thread t); - } - } } diff --git a/src/tests/nativeaot/SmokeTests/SharedLibrary/SharedLibrary.csproj b/src/tests/nativeaot/SmokeTests/SharedLibrary/SharedLibrary.csproj index 34f2b527c56..f2f1f6389c1 100644 --- a/src/tests/nativeaot/SmokeTests/SharedLibrary/SharedLibrary.csproj +++ b/src/tests/nativeaot/SmokeTests/SharedLibrary/SharedLibrary.csproj @@ -13,9 +13,6 @@ true - - true - false @@ -66,6 +63,6 @@ cp SharedLibraryDriver$(NativeExtension) native/SharedLibrary$(NativeExtension) - +