elliottt opened PR #6160 from elliottt:trevor/bindgen-only-interfaces
to bytecodealliance:main
:
Add the
only_interfaces
andwith
options to thebindgen!
macro. These two
additional options enable the definitions of a use ofbindgen!
to be split up
and reused in the following way:
Passing
only_interfaces: true
to an invocation ofbindgen!
will cause only
the interfaces depended on by the supplied world to be generated, allowing the
interface definitions depended on by two world files to be shared.Passing
with: { "a": module::name }
allows references to thea
import to
be remapped to a known module, in this casemodule::name
. When this option
is supplied, no code will be generated for the interfacea
, assuming that
those definitions came from a previous use ofbindgen!
with
only_interfaces: true
.TODO:
- [ ] Add tests
<!--
Please make sure you include the following information:
If this work has been discussed elsewhere, please include a link to that
conversation. If it was discussed in an issue, just mention "issue #...".Explain why this change is needed. If the details are in an issue already,
this can be brief.Our development process is documented in the Wasmtime book:
https://docs.wasmtime.dev/contributing-development-process.htmlPlease ensure all communication follows the code of conduct:
https://github.com/bytecodealliance/wasmtime/blob/main/CODE_OF_CONDUCT.md
-->
elliottt requested pchickey for a review on PR #6160.
elliottt requested alexcrichton for a review on PR #6160.
elliottt edited PR #6160:
Add the
only_interfaces
andwith
options to thebindgen!
macro. These two
additional options enable the definitions of a use ofbindgen!
to be split up
and reused in the following way:
Passing
only_interfaces: true
to an invocation ofbindgen!
will cause only
the interfaces depended on by the supplied world to be generated, allowing the
interface definitions depended on by two world files to be shared.Passing
with: { "a": module::name }
allows references to thea
import to
be remapped to a known module, in this casemodule::name
. When this option
is supplied, no code will be generated for the interfacea
, assuming that
those definitions came from a previous use ofbindgen!
with
only_interfaces: true
.TODO:
- [ ] Add tests to assert the output of the
bindgen!
macro using these new options<!--
Please make sure you include the following information:
If this work has been discussed elsewhere, please include a link to that
conversation. If it was discussed in an issue, just mention "issue #...".Explain why this change is needed. If the details are in an issue already,
this can be brief.Our development process is documented in the Wasmtime book:
https://docs.wasmtime.dev/contributing-development-process.htmlPlease ensure all communication follows the code of conduct:
https://github.com/bytecodealliance/wasmtime/blob/main/CODE_OF_CONDUCT.md
-->
elliottt edited PR #6160:
Add the
only_interfaces
andwith
options to thebindgen!
macro. These two additional options enable the definitions of a use ofbindgen!
to be split up and reused in the following way:
- Passing
only_interfaces: true
to an invocation ofbindgen!
will cause only the interfaces depended on by the supplied world to be generated, allowing the interface definitions depended on by two world files to be shared.- Passing
with: { "a": module::name }
allows references to thea
import to be remapped to a known module, in this casemodule::name
. When this option is supplied, no code will be generated for the interfacea
, assuming that those definitions came from a previous use ofbindgen!
withonly_interfaces: true
.Here's a use in the
preview2-prototyping
repository for a motivating example of how this can be used with thecommand
world.TODO:
- [ ] Add tests to assert the output of the
bindgen!
macro using these new options<!--
Please make sure you include the following information:
If this work has been discussed elsewhere, please include a link to that
conversation. If it was discussed in an issue, just mention "issue #...".Explain why this change is needed. If the details are in an issue already,
this can be brief.Our development process is documented in the Wasmtime book:
https://docs.wasmtime.dev/contributing-development-process.htmlPlease ensure all communication follows the code of conduct:
https://github.com/bytecodealliance/wasmtime/blob/main/CODE_OF_CONDUCT.md
-->
elliottt updated PR #6160.
elliottt edited PR #6160:
Add the
only_interfaces
andwith
options to thebindgen!
macro. These two additional options enable the definitions of a use ofbindgen!
to be split up and reused in the following way:
- Passing
only_interfaces: true
to an invocation ofbindgen!
will cause only the interfaces depended on by the supplied world to be generated, allowing the interface definitions depended on by two world files to be shared.- Passing
with: { "a": module::name }
allows references to thea
import to be remapped to a known module, in this casemodule::name
. When this option is supplied, no code will be generated for the interfacea
, assuming that those definitions came from a previous use ofbindgen!
withonly_interfaces: true
.Here's a use in the
preview2-prototyping
repository for a motivating example of how this can be used with thecommand
world.<!--
Please make sure you include the following information:
If this work has been discussed elsewhere, please include a link to that
conversation. If it was discussed in an issue, just mention "issue #...".Explain why this change is needed. If the details are in an issue already,
this can be brief.Our development process is documented in the Wasmtime book:
https://docs.wasmtime.dev/contributing-development-process.htmlPlease ensure all communication follows the code of conduct:
https://github.com/bytecodealliance/wasmtime/blob/main/CODE_OF_CONDUCT.md
-->
elliottt has marked PR #6160 as ready for review.
elliottt requested wasmtime-core-reviewers for a review on PR #6160.
alexcrichton submitted PR review.
alexcrichton submitted PR review.
alexcrichton created PR review comment:
Perhaps
opts.with.extend(val)
?
elliottt updated PR #6160.
elliottt created PR review comment:
Yeah, that's much better :)
elliottt submitted PR review.
elliottt updated PR #6160.
elliottt updated PR #6160.
elliottt merged PR #6160.
Last updated: Nov 22 2024 at 16:03 UTC