bytecodealliance / bytecodealliance/wasmtime

Support nested vendored dependencies in `bindgen!`

Open
#9,303 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
18.6k
Forks
1.8k
Avg merge
1d 19h
Merged PRs (30d)
121

Description

Thanks for filing a feature request! Please fill out the TODOs below.

#### Feature
It seems that the only way to import other packages right now is to vendor them, so I tried to do that by symlinking the dependee
into the dependant `deps` folder (showing dirs only for conciseness):
```
❯ tree -d -l wit
wit
└── deps -> ../../wasi-http/wit
└── deps
├── cli
├── clocks
├── filesystem
├── io
├── random
└── sockets
```

Then i attempt to generate bindings like so:
```rust
bindgen!({
path: "../adhoc/wit",
with: {
"wasi:http/proxy@0.2.1": http_proxy,
}
});
```

and I get the following compile error:
```
error: failed to resolve directory while parsing WIT for path [/Users/mpostma/Documents/code/rust/wasm-experiments/adhoc/wit]

Caused by:
0: failed to parse dependency directory: /Users/mpostma/Documents/code/rust/wasm-experiments/adhoc/wit/deps
1: failed to parse package: /Users/mpostma/Documents/code/rust/wasm-experiments/adhoc/wit/deps/deps
2: no `package` header was found in any WIT file for this package
```
It seems to be because the second level of `deps` doesn't contain any `WIT` file, but only directories.

#### Benefit

I'm not sure what's the current plan, or the recommended way to deal with imports right now. I suspect that all of this will converge to a more streamlined experience, but until then, it would be nice if we could just symlink components as dependency for other components.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.