Building a Plugin
This section writes a Plugin from nothing and takes it as far as somebody else can use it. It starts from the family's template, which the composer turns into a Plugin project, and goes through the program, a run under a Core, the other things a Plugin can be asked to do, and the tag it is published at. Every page also keeps, at its end, the same steps by hand. What a Plugin is, and how it differs from an application, is Plugins and applications; this section assumes it.
One Plugin runs through every page: com.example.greeter. It answers the question greeter.hello
with a greeting, and later it is also told which greeting to use. It is written five times, once with
each family's library, and every page shows the five as tabs. Choosing a language on one page chooses it
on all of them.
| Page | What it covers |
|---|---|
| Starting it | the Plugin project the composer makes from the family's template, and the library it depends on |
| The program | the declaration, the start, answering a question, the orderly close, the build, and the Manifest kept in the source |
| Trying it | try/, the smallest application around it, a run under a local Core, a grant, and what to read when it is refused |
| More than a question | a command it acknowledges, an occurrence it reports, and the streams and needs it may declare |
| Using another unit | a need of class unit: asking another unit's questions and following its streams, through a channel the Core binds |
| Handing it on | the source at a tag, the executable and the Manifest, and where each form of an application takes them |
A Plugin is used in an application, and a Plugin is not an application. This section builds the smallest application only to run the Plugin. Writing a real one, from Plugins that already exist, is Building an application.
What you need
Yoke installed on this machine, with the composer. Setting up Yoke obtains the two
files of a release: yoke-<version>-linux-<arch>.tar.gz, the programs a host runs, and
yoke-conformance-<version>-linux-<arch>.tar.gz, which carries yoke-compose. It then
installs them. Installing for your account alone is enough, and
nothing in this section needs root. The composer starts a Plugin from a template its family publishes
with each release: Go, Rust, C and C++ have one; Python's comes later, and a Python Plugin is started by
hand.
And the toolchain of the language you write in:
- Go
- Rust
- Python
- C
- C++
| You need | For |
|---|---|
| Go 1.26 or newer | building; the library is a module, fetched by go get |
| You need | For |
|---|---|
| Rust 1.88 or newer, with Cargo | building; the library is the crate yoke-sdk, fetched by Cargo |
| You need | For |
|---|---|
Python 3.10 or newer, with venv and pip | running; the library is the package yoke-sdk, installed in an environment of the Plugin's own |
| You need | For |
|---|---|
a C compiler, CMake 3.25 or newer, pkg-config | building the library from its source, then the Plugin |
| the development packages of gRPC (its core C API), protobuf-c, OpenSSL and json-c | what the library links against; on Debian, libgrpc-dev libprotobuf-c-dev libssl-dev libjson-c-dev |
| You need | For |
|---|---|
a C++ compiler, CMake 3.25 or newer, pkg-config | building the library from its source, which is C++17, then the Plugin, which this section writes in C++20 |
| the development packages of gRPC's C++ API, protobuf, nlohmann-json and OpenSSL | what the library and the template build against; on Debian, libgrpc++-dev libprotobuf-dev nlohmann-json3-dev libssl-dev |
Every family offers the same contract, and the model is the same in each: a declaration, a start that registers, events to answer, an orderly close. Only the spelling follows the language (what each family offers).