feat: support WIT source inputs in component bindgen macro#1589
Open
andreiltd wants to merge 3 commits into
Open
feat: support WIT source inputs in component bindgen macro#1589andreiltd wants to merge 3 commits into
andreiltd wants to merge 3 commits into
Conversation
Add explicit wit, wasm, and inline input forms for component bindgen macros. Signed-off-by: Tomasz Andrzejak <andreiltd@gmail.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR extends Hyperlight’s component bindgen proc-macros to accept WIT sources directly (WIT files, WIT package directories, and inline WIT), in addition to the legacy “wasm-encoded WIT” inputs, and updates tests/CI scripts to rely on WIT sources rather than pre-generated .wasm artifacts.
Changes:
- Add a
WitSourceinput abstraction inhyperlight_component_utiland route bindgen through it (WIT file/dir, wasm, inline). - Extend
host_bindgen!/guest_bindgen!parsing to acceptwit:,wasm:, andinline:forms (plusworldselection). - Update test fixtures, integration tests, and CI/Just recipes to use WIT inputs directly and drop the artifact upload/download flow for generated
.wasmWIT containers.
Reviewed changes
Copilot reviewed 9 out of 11 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/tests/rust_guests/witguest/src/bindings.rs | Switch guest bindgen invocation from wasm container to wit: input. |
| src/tests/rust_guests/Cargo.lock | Lockfile updates for rust guest workspace deps. |
| src/hyperlight_host/tests/wit_test.rs | Update host-side bindgen tests to use wit: and add inline-WIT bindgen coverage. |
| src/hyperlight_component_util/tests/wasmtime_guest_codegen.rs | Expand component-util tests to cover WIT/wasm/inline input handling. |
| src/hyperlight_component_util/src/util.rs | Introduce WitSource and unify WIT type reading across input forms. |
| src/hyperlight_component_util/Cargo.toml | Add wit-component / wit-parser dependencies to support WIT parsing/encoding. |
| src/hyperlight_component_macro/src/lib.rs | Extend macro docs + parsing to accept explicit wit:/wasm:/inline: inputs and world selection. |
| Justfile | Remove WIT-to-wasm generation steps; adjust clean/test/clippy targets accordingly. |
| Cargo.lock | Workspace lockfile updates for new WIT-related dependencies. |
| .github/workflows/dep_build_test.yml | Remove download steps for pre-generated WIT .wasm artifacts. |
| .github/workflows/dep_build_guests.yml | Remove upload steps for pre-generated WIT .wasm artifacts. |
Signed-off-by: Tomasz Andrzejak <andreiltd@gmail.com>
Signed-off-by: Tomasz Andrzejak <andreiltd@gmail.com>
danbugs
reviewed
Jun 26, 2026
danbugs
left a comment
Contributor
There was a problem hiding this comment.
Mostly LGTM, just two minor comments.
| fn source_or_env(source: Option<util::WitSource>) -> util::WitSource { | ||
| source.unwrap_or_else(|| { | ||
| util::WitSource::Wasm(std::path::PathBuf::from( | ||
| std::env::var_os("WIT_WORLD").unwrap(), |
Contributor
There was a problem hiding this comment.
If this fails, we'd just get a generic unwrap panic, might want to improve the error msg
| kebab_name | ||
| }, | ||
| ); | ||
| std::fs::remove_file(wasm_path).expect("temporary wasm fixture should be removed"); |
Contributor
There was a problem hiding this comment.
I don't think we reach this if the assert fails?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add explicit wit, wasm, and inline input forms for component bindgen macros. It is backward compatilbe. New macro arguments allow things like: