From 0c86722b300911ab07c600b3e305388c89ed6fc9 Mon Sep 17 00:00:00 2001 From: James Sturtevant Date: Mon, 25 Nov 2024 16:26:28 -0800 Subject: [PATCH] Fix so that compilation runs in correct order Signed-off-by: James Sturtevant Signed-off-by: James Sturtevant Signed-off-by: James Sturtevant --- README.md | 2 +- .../CalculatorComposed/CalculatorComposed.csproj | 2 +- ...eAlliance.Componentize.DotNet.Wasm.SDK.targets | 8 ++++---- .../testapps/E2EConsumer/E2EConsumer.csproj | 2 +- .../SimpleProducerConsumerTest.cs | 15 +++++++++++---- .../testapps/SimpleConsumer/SimpleConsumer.csproj | 2 +- 6 files changed, 19 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 1d331e3..b6e1861 100644 --- a/README.md +++ b/README.md @@ -194,7 +194,7 @@ wasmtime composed.wasm While you can run wasm-tools manually, you can also generate this automatically. One way to do this is to [create a new project](./samples/calculator/CalculatorComposed/) and add the following: ```xml - + ../CalculatorHost/bin/$(Configuration)/$(TargetFramework)/wasi-wasm/native/calculatorhost.wasm ../Adder/bin/$(Configuration)/$(TargetFramework)/wasi-wasm/native/adder.wasm diff --git a/samples/calculator/CalculatorComposed/CalculatorComposed.csproj b/samples/calculator/CalculatorComposed/CalculatorComposed.csproj index 8d3965c..3d62ff9 100644 --- a/samples/calculator/CalculatorComposed/CalculatorComposed.csproj +++ b/samples/calculator/CalculatorComposed/CalculatorComposed.csproj @@ -16,7 +16,7 @@ - + ../CalculatorHost/bin/$(Configuration)/$(TargetFramework)/wasi-wasm/native/CalculatorHost.wasm ../Adder/bin/$(Configuration)/$(TargetFramework)/wasi-wasm/native/adder.wasm diff --git a/src/WasmComponent.Sdk/build/BytecodeAlliance.Componentize.DotNet.Wasm.SDK.targets b/src/WasmComponent.Sdk/build/BytecodeAlliance.Componentize.DotNet.Wasm.SDK.targets index 4f10238..06648c7 100644 --- a/src/WasmComponent.Sdk/build/BytecodeAlliance.Componentize.DotNet.Wasm.SDK.targets +++ b/src/WasmComponent.Sdk/build/BytecodeAlliance.Componentize.DotNet.Wasm.SDK.targets @@ -1,6 +1,6 @@ - - - + + diff --git a/test/E2ETest/testapps/E2EConsumer/E2EConsumer.csproj b/test/E2ETest/testapps/E2EConsumer/E2EConsumer.csproj index 1ba5f6b..4b16062 100644 --- a/test/E2ETest/testapps/E2EConsumer/E2EConsumer.csproj +++ b/test/E2ETest/testapps/E2EConsumer/E2EConsumer.csproj @@ -29,7 +29,7 @@ - + ../E2EProducer/bin/$(Configuration)/$(TargetFramework)/wasi-wasm/native/e2eproducer.wasm diff --git a/test/WasmComponentSdkTest/WasmComponentSdkTest/SimpleProducerConsumerTest.cs b/test/WasmComponentSdkTest/WasmComponentSdkTest/SimpleProducerConsumerTest.cs index ba08a91..9d1bcf5 100644 --- a/test/WasmComponentSdkTest/WasmComponentSdkTest/SimpleProducerConsumerTest.cs +++ b/test/WasmComponentSdkTest/WasmComponentSdkTest/SimpleProducerConsumerTest.cs @@ -49,7 +49,7 @@ public void CanComposeImportWithExport() [Fact] public void CanBuildAppFromOci() { - var composed = FindModulePath("../testapps/OciWit", "ociwit.wasm"); + var composed = FindModulePath($"../testapps/OciWit/bin/{Config}", "ociwit.wasm"); var stdout = ExecuteCommandComponent(composed); Assert.StartsWith("Oci is awesome!", stdout); } @@ -89,11 +89,18 @@ private static string FindModulePath(string searchDir, string filename) } var matches = Directory.GetFiles(resolvedSearchDir, filename, SearchOption.AllDirectories); - if (matches.Count() != 1) + if (matches.Count() == 1) { + return Path.GetFullPath(matches.Single()); + } + else if (matches.Count() == 2 && matches.Any(x => Path.GetFullPath(x).Contains($"wasi-wasm\\native"))) { + return Path.GetFullPath(matches.First(x => Path.GetFullPath(x).Contains($"wasi-wasm\\native"))); + } + else if (matches.Count() == 2 && matches.Any(x => Path.GetFullPath(x).Contains($"wasi-wasm/native"))) { + return Path.GetFullPath(matches.First(x => Path.GetFullPath(x).Contains($"wasi-wasm/native"))); + } + else { throw new Exception($"Failed to get modules path, matched {matches.Count()} entries for directory {resolvedSearchDir} and filename {filename}."); } - - return Path.GetFullPath(matches.Single()); } } diff --git a/test/WasmComponentSdkTest/testapps/SimpleConsumer/SimpleConsumer.csproj b/test/WasmComponentSdkTest/testapps/SimpleConsumer/SimpleConsumer.csproj index 8b4ecd6..4b9a886 100644 --- a/test/WasmComponentSdkTest/testapps/SimpleConsumer/SimpleConsumer.csproj +++ b/test/WasmComponentSdkTest/testapps/SimpleConsumer/SimpleConsumer.csproj @@ -27,7 +27,7 @@ - + ../SimpleProducer/bin/$(Configuration)/$(TargetFramework)/wasi-wasm/native/simpleproducer.wasm