alexcrichton opened PR #6836 from alexcrichton:component-cli
to bytecodealliance:main
:
This commit refactors the
wasmtime
CLI executable to be able to
support not only compiling components but additionally executing
components. While I was doing this I've additionally added a new
--preview2
argument to enable using the new experimental
implementation of preview1 based on preview2 type/structs. This is
off-by-default but is expected to become the default in the future.Some notable features of this change are:
The preview1-implemented-with-preview2 module now sports
add_to_linker_{async,sync}
to replace the previousadd_to_linker
which always did async.Some trait bounds in the preview1-implemented-with-preview2 module are
simplified.Some minor changes were made to
wiggle
's macros to support a "block
on" that isn't the default wiggle dummy executor (as now we actually
do need Tokio)Many options related to core wasm
Linker
configuration, such as
--default-values-unknown-imports
, are not implemented for components
at this time. When used with components these options return an error.Construction of WASI contexts has been refactored to pass around fewer
arguments to avoid threading through lots of values for both preview1
and preview2.Reading the input to the Wasmtime CLI has been updated to read the
input in therun
subcommand before handing it off to thewasmtime
crate's API to enable the CLI to use the contents of what's loaded to
determine what to do next.Our generic
./ci/run-tests.sh
script has been updated to pass the
--features component-model
flag to ensure that this CLI support is
tested during the normal test suite.
Procedural Note: this PR is based on https://github.com/bytecodealliance/wasmtime/pull/6833 and https://github.com/bytecodealliance/wasmtime/pull/6823 so the first few commits can be ignored.
alexcrichton requested pchickey for a review on PR #6836.
alexcrichton requested wasmtime-core-reviewers for a review on PR #6836.
alexcrichton requested wasmtime-default-reviewers for a review on PR #6836.
pchickey submitted PR review:
Various conflicts with main, and I'd like to leave the flush stuff out, but otherwise the meat of this is great.
pchickey created PR review comment:
lets keep this change out please, if possible... even if you need to just sleep(100ms) for now to get stdout/stderr to flush, I want to take the time to get the streams design right rather than merge it in and then back it out immediately.
pchickey submitted PR review:
Various conflicts with main, and I'd like to leave the flush stuff out, but otherwise the meat of this is great.
pchickey created PR review comment:
thanks this is a really good idea. we should do the exact same in wasmtime-wit-bindgen.
pchickey created PR review comment:
Ty, this set of traits got even worse with my cli world update, your change is the right way to handle it.
alexcrichton updated PR #6836.
alexcrichton edited PR #6836:
This commit refactors the
wasmtime
CLI executable to be able to
support not only compiling components but additionally executing
components. While I was doing this I've additionally added a new
--preview2
argument to enable using the new experimental
implementation of preview1 based on preview2 type/structs. This is
off-by-default but is expected to become the default in the future.Some notable features of this change are:
The preview1-implemented-with-preview2 module now sports
add_to_linker_{async,sync}
to replace the previousadd_to_linker
which always did async.Some trait bounds in the preview1-implemented-with-preview2 module are
simplified.Some minor changes were made to
wiggle
's macros to support a "block
on" that isn't the default wiggle dummy executor (as now we actually
do need Tokio)Many options related to core wasm
Linker
configuration, such as
--default-values-unknown-imports
, are not implemented for components
at this time. When used with components these options return an error.Construction of WASI contexts has been refactored to pass around fewer
arguments to avoid threading through lots of values for both preview1
and preview2.Reading the input to the Wasmtime CLI has been updated to read the
input in therun
subcommand before handing it off to thewasmtime
crate's API to enable the CLI to use the contents of what's loaded to
determine what to do next.Our generic
./ci/run-tests.sh
script has been updated to pass the
--features component-model
flag to ensure that this CLI support is
tested during the normal test suite.
Procedural Note: this PR is based on https://github.com/bytecodealliance/wasmtime/pull/6833 and https://github.com/bytecodealliance/wasmtime/pull/6823 so the first few commits can be ignored.
pchickey submitted PR review.
alexcrichton merged PR #6836.
Last updated: Nov 22 2024 at 16:03 UTC