Skip to content

Handle wit files that have imports in a folder #22

@jsturtevant

Description

@jsturtevant

Given a folder of Wit, some of the wit may import other files.

For example, wit in wasi-http has imports: https://github.com/WebAssembly/wasi-http/tree/main/wit

When you include this in the project you will get:

  Executing wit-bindgen...
EXEC : error : interface or world `imports` not found in package [C:\Users\jstur\projects\component\dotnet9-wasi-http-example\App.csproj]
       --> wit\deps\cli\command.wit:4:11
        |
      4 |   include imports;
        |           ^------
C:\Users\jstur\projects\component\dotnet9-wasi-http-example\.packages\bytecodealliance.componentize.dotnet.witbindgen\0.1.0-preview00003\buil 
d\ByteCodeAlliance.Componentize.DotNet.WitBindgen.targets(79,9): error MSB3073: The command "C:\Users\jstur\projects\component\dotnet9-wasi-h 
ttp-example\.packages\bytecodealliance.componentize.dotnet.witbindgen\0.1.0-preview00003\build\..\tools\win-x64\wit-bindgen.exe c-sharp wit\d 
eps\cli\command.wit  --runtime native-aot --out-dir obj\Debug\net8.0\wasi-wasm\wit_bindgen\" exited with code 1. [C:\Users\jstur\projects\com 
ponent\dotnet9-wasi-http-example\App.csproj]

This is because currently all files are executed individually

Ideally, we could execute the wit-bindgen command on a folder and only once.

This was found when trying out https://github.com/dicej/dotnet9-wasi-http-example.

See example in https://github.com/dicej/dotnet9-wasi-http-example/compare/main...jsturtevant:dotnet9-wasi-http-example:use-wasm-sdk?expand=1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions