Skip to content

Emit WITs during build #3376

@itowlson

Description

@itowlson

We want to make it more seamless for application components to consume dependencies: that is, once you add the dependencies to your spin.toml, the imported interfaces become readily available for you to program and build against in your main component. We've explored various ways of doing this, but the current favourite is to have spin build extract the dependency WITs and emit them to a well-known location.

We have prior art here from the spin deps plugin, but we now want that functionality in the Spin CLI and integrated into spin build. A consequence of this is language neutrality: the spin deps plugin had language commands that did some nice work on the code side, but Spin generally tries not to know about specific languages.

We need to design it so it can be called from outside spin build. We've always had a philosophy that you can build Spin apps using your toolchain of choice, whether that's Spin, make, or whatever. So we should expose the "create or update WITs" functionality in such a way that other toolchains can use it (although spin build will do it automatically). Ideally it should be possible to run continuously or via LSP so that WITs are updated as dependencies are added and removed (and so compiler errors and code completion update), but this may be impractical: in any event, it's not required on day one.

Language templates or SDKs will want to update to integrate seamlessly with the generated WITs but that's out of scope for this issue.

We should agree where to store extracted WITs. spin deps put them under .spin, which is natural - it is a bit of mix of various kinds of data but we can create a subdirectory to isolate the extracted WITs.

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