-
Notifications
You must be signed in to change notification settings - Fork 312
Description
Zulip context: https://bytecodealliance.zulipchat.com/#narrow/stream/327223-wit-bindgen/topic/WIT.20directory.20structure
Currently, most WIT tooling expects a specific directory layout, typically rooted in a directory named wit/:
wit/*.wit: Mandatory "default" package
wit/deps/*/*.wit: Optional "dependency" packages, which can be referenced by other packages
The only way to store multiple packages in the same place is to (often arbitrarily) partition them into one default package and all others as "deps". This is awkward for repositories that don't have exactly one natural default package, such as the WASI 0.2 repo (ref #1433).
I'm proposing two changes:
- Relax this directory structure into basically one rule: any directory under a "WIT root" (including the root itself) that contains at least one
.witfile will be parsed as a package. - Update tooling to accept multiple WIT root directories to resolve, still defaulting to
["wit/"]where appropriate.
These changes should be backward compatible with the existing layout and permit some new conventions, such as:
- The WASI 0.2 repo doesn't have to change; if someone wants to consume it directly they can point at the entire
preview2/directory or individualpreview2/*packages as WIT roots. - Projects with many dependencies can organize them by namespace, e.g.
wit/wasi/{http,io}/*.wit,wit/my-namespace/my-package@1.0.0/*.wit - Registry tooling can use unambiguous paths with e.g. content-addressed files