From 79b405c24dfbb5e13ff021f83d1b34167ef5aaf8 Mon Sep 17 00:00:00 2001 From: James Sturtevant Date: Tue, 26 Nov 2024 14:33:47 -0800 Subject: [PATCH] Use Wac for composition Signed-off-by: James Sturtevant --- README.md | 8 +-- .../CalculatorComposed.csproj | 2 +- .../WasmComponent.Sdk.csproj | 54 +++++++++++++------ ...lliance.Componentize.DotNet.Wasm.SDK.props | 14 +++-- .../testapps/E2EConsumer/E2EConsumer.csproj | 2 +- .../SimpleConsumer/SimpleConsumer.csproj | 2 +- 6 files changed, 54 insertions(+), 28 deletions(-) diff --git a/README.md b/README.md index b6e1861..b17fcd4 100644 --- a/README.md +++ b/README.md @@ -179,10 +179,10 @@ world root { ## Composing components -Once you have a components containing the Adder and Calculator host, you can use [wasm-tools](https://github.com/bytecodealliance/wasm-tools) to compose a runnable application: +Once you have a components containing the Adder and Calculator host, you can use [wac](https://github.com/bytecodealliance/wac) to compose a runnable application: ```bash -wasm-tools compose -o composed.wasm MyApp.wasm -d AddImplementation.wasm +wac plug MyApp.wasm --plug AddImplementation.wasm -o composed.wasm ``` then run it: @@ -191,7 +191,7 @@ then run it: 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: +While you can run wac 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 @@ -201,7 +201,7 @@ While you can run wasm-tools manually, you can also generate this automatically. - + ``` diff --git a/samples/calculator/CalculatorComposed/CalculatorComposed.csproj b/samples/calculator/CalculatorComposed/CalculatorComposed.csproj index 3d62ff9..0603bf6 100644 --- a/samples/calculator/CalculatorComposed/CalculatorComposed.csproj +++ b/samples/calculator/CalculatorComposed/CalculatorComposed.csproj @@ -23,7 +23,7 @@ - + diff --git a/src/WasmComponent.Sdk/WasmComponent.Sdk.csproj b/src/WasmComponent.Sdk/WasmComponent.Sdk.csproj index 18f543a..bad1420 100644 --- a/src/WasmComponent.Sdk/WasmComponent.Sdk.csproj +++ b/src/WasmComponent.Sdk/WasmComponent.Sdk.csproj @@ -19,12 +19,14 @@ false - 1.219.1 - https://github.com/bytecodealliance/wasm-tools/releases/download/v$(PrebuiltWasmToolsVersion)/wasm-tools-$(PrebuiltWasmToolsVersion) - 21.0.1 - $(MSBuildThisFileDirectory)..\..\modules\wasm-tools\ + 1.220.0 + https://github.com/bytecodealliance/wasm-tools/releases/download/v$(WasmToolsVersion)/wasm-tools-$(WasmToolsVersion) + + v0.6.1 + https://github.com/bytecodealliance/wac/releases/download/$(WacVersion)/wac-cli + true false @@ -56,28 +58,48 @@ - + - + - - - - + + + + - + - + - - - - + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/WasmComponent.Sdk/build/BytecodeAlliance.Componentize.DotNet.Wasm.SDK.props b/src/WasmComponent.Sdk/build/BytecodeAlliance.Componentize.DotNet.Wasm.SDK.props index 7d246cd..a6f34e1 100644 --- a/src/WasmComponent.Sdk/build/BytecodeAlliance.Componentize.DotNet.Wasm.SDK.props +++ b/src/WasmComponent.Sdk/build/BytecodeAlliance.Componentize.DotNet.Wasm.SDK.props @@ -9,12 +9,16 @@ true true - win - linux - osx - $(WasmToolsTarget)-$([System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture.ToString().ToLower()) - $(MSBuildThisFileDirectory)..\tools\$(WasmToolsTarget)\wasm-tools + win + linux + osx + $(ToolsTarget)-$([System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture.ToString().ToLower()) + + $(MSBuildThisFileDirectory)..\tools\$(ToolsTarget)\wasm-tools $(WasmToolsExe).exe + + $(MSBuildThisFileDirectory)..\tools\$(ToolsTarget)\wac + $(WacExe).exe diff --git a/test/E2ETest/testapps/E2EConsumer/E2EConsumer.csproj b/test/E2ETest/testapps/E2EConsumer/E2EConsumer.csproj index 4b16062..4fac070 100644 --- a/test/E2ETest/testapps/E2EConsumer/E2EConsumer.csproj +++ b/test/E2ETest/testapps/E2EConsumer/E2EConsumer.csproj @@ -35,7 +35,7 @@ - + diff --git a/test/WasmComponentSdkTest/testapps/SimpleConsumer/SimpleConsumer.csproj b/test/WasmComponentSdkTest/testapps/SimpleConsumer/SimpleConsumer.csproj index 4b9a886..af3e961 100644 --- a/test/WasmComponentSdkTest/testapps/SimpleConsumer/SimpleConsumer.csproj +++ b/test/WasmComponentSdkTest/testapps/SimpleConsumer/SimpleConsumer.csproj @@ -33,7 +33,7 @@ - +