Skip to content

Add plugin support

Frans Skarman requested to merge plugins into master

This adds plumbing support for writing plugins which augment the normal compilation flow with extra steps. An example plugin can be found here: https://gitlab.com/TheZoq2/swim-var-mapping

Plugins used in a project are specified using [plugin] in the swim.toml. They behave just like libraries, so you can have path or git plugins as desired.

When plugins are loaded, they can specify commands to run, which can do things like building yosys plugins (like the example here), or generating spade code (for example if you would like to write a plugin for compiling asm code)

They provide a list of files which they are going to modify which can trigger certain rebuild steps. For example, in the yosys plugin example, I trigger a re-synthesis if the yosys plugin binary has been modified.

Small TODOs remaining:

  • Requires CXX needs to actually be used
  • Add a similar requirement for python

One question/concern with the current implementation is that you can only run commands before any other build flow. That disallows a plugin that looks at any of the artefacts that are produced in previous steps. Is this something we'd want? I can't think of a use case right now

@sornas I don't know if I did the library+lockfile stuff correctly and/or if the way I did it is an ugly hack, do let me know :)

Edited by Frans Skarman

Merge request reports