-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(composition): replace deprecated wasm-tools compose
with wac
#154
fix(composition): replace deprecated wasm-tools compose
with wac
#154
Conversation
fe01c60
to
b27dd6c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is great - your explanation helped me to click with what WAC is doing far better than the WAC documentation itself (although that was admittedly that was the old documentation!).
I did, inevitably, have a bunch of suggestions and questions, but I don't think any of them are blockers except for the possible issue around the name of deps
subdirectory - the rest we can iterate on for sure.
cd .. | ||
wasm-tools compose calculator/target/wasm32-wasi/release/calculator.wasm -d adder/target/wasm32-wasi/release/adder.wasm -o composed.wasm | ||
wasm-tools compose command/target/wasm32-wasi/release/command.wasm -d composed.wasm -o final.wasm | ||
wac plug calculator/target/wasm32-wasi/release/calculator.wasm --plug adder/target/wasm32-wasi/release/adder.wasm -o composed.wasm |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The cd ..
line has been removed - that was an error in the previous text right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe the cd ..
is necessary...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since all of this is taking place in the tutorial directory, the cd ..
was incorrect given that the previous 3 lines do not change your directory
``` | ||
|
||
Here `component.wasm` is the component that imports interfaces from `dep1.wasm` and `dep2.wasm`, which export them. The composed component, with those dependencies satisfied and tucked away inside it, is saved to `composed.wasm`. | ||
|
||
> This syntax doesn't cover transitive dependencies. If, for example, `dep1.wasm` has unsatisfied imports that you want to satisfy from `dep3.wasm`, you'll need to use a [configuration file](https://github.com/bytecodealliance/wasm-tools/blob/main/crates/wasm-compose/CONFIG.md). (Or you can compose `dep1.wasm` with `dep3.wasm` first, then refer to that composed component instead of `dep1.wasm`. This doesn't scale to lots of transitive dependencies though!) | ||
The `plug` syntax doesn't cover transitive dependencies. If, for example, `dep1.wasm` has unsatisfied imports that you want to satisfy from `dep3.wasm`, you'd need to be deliberate about the order of your composition. You could compose `dep1.wasm` with `dep3.wasm` first, then refer to that composed component instead of `dep1.wasm`. However, this doesn't scale to lots of transitive dependencies, which is why WAC files were created. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This paragraph, or somewhere within or around it, feels like it might be the start of a subsection, as it introduces and explains a significant new evolution or problem-solution scenario from what went before.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you thinking we want a subsection on the WAC language?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kate-goldenring No, I was just suggesting a sub-heading signposting that the text is moving on from talking about plug
, to talking about WAC files.
It won't let me leave a suggestion but e.g.
### Using WAC files to go beyond `plug`
or
### Advanced composition with the WAC language
or even
### WAC even the hairiest composition problems into shape with BA's powerful new tools
for the full "MSDN magazine circa 2001" experience
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see! Too many good suggestions to choose from! Updated the doc to use the middle suggestion and added an intro paragraph on "why wac"
cd .. | ||
wasm-tools compose calculator/target/wasm32-wasi/release/calculator.wasm -d adder/target/wasm32-wasi/release/adder.wasm -o composed.wasm | ||
wasm-tools compose command/target/wasm32-wasi/release/command.wasm -d composed.wasm -o final.wasm | ||
wac plug calculator/target/wasm32-wasi/release/calculator.wasm --plug adder/target/wasm32-wasi/release/adder.wasm -o composed.wasm |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe the cd ..
is necessary...
b27dd6c
to
959e63a
Compare
Signed-off-by: Kate Goldenring <[email protected]>
959e63a
to
d058f6d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is terrific, @kate-goldenring - thank you so much for working through this. This provides a great introduction and cookbook for common cases, and a clear conceptual framework for people to get deeper into WAC if they need to. Even having used WAC before, I feel way more confident after reading it!
This updates the composition document and the calculator example to use
wac plug
andwac compose
. Thewac compose
examples are fairly trivial but it is a start to what can become more robust documentation of it as registries support solidifies, which @macovedj is working on in #129