Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Plugins

Write the same three targets for every Go program in a repository and you soon want a function for it. In buildl that function lives in a plugin: Lua that runs while build files are read, and declares targets for you. A plugin cannot run anything. All it can do is call the same buildl.target a build file calls, so whatever it declares is planned, held to the ceiling, cached and shown by buildl graph like a target you wrote by hand.

A plugin is not trusted just because it is code you loaded. Every target it declares carries its name, and is held to what the plugin said it needs before it is held to the ceiling.

This chapter covers:

  • Writing a Plugin: extension.toml, buildl.use, and where your own logic should live
  • Plugins from Git: a plugin kept in another repository, buildl plugins fetch, and buildl.lock
  • How buildl Decides: what a plugin's targets may want, and how plan, doctor, the approver and graph tell you which plugin wanted it
  • The C and C++ Plugin: the c plugin kept in this repository, compiling one object per source with each object declaring the headers it read
  • The Rust Plugin: the rust plugin kept in this repository, running plain cargo for a binary, a library or a test
  • cargo buildl: the cargo subcommand that sets a Cargo project up for the rust plugin and keeps its build.lua in line with Cargo.toml