Setup
Prerequisites
Exograph is built using Rust, and makes use of Rust-specific frameworks and features. Because of this, plugins are written in Rust as well. You must first set up the Rust toolchain in your development environment.
There are many resources available online to set up Rust! As such, this guide will not cover setting up the toolchain.
Exograph plugins currently target the internal Rust ABI! Because of this, plugins currently need to be built in-tree inside the Exograph source repository in order to work properly.
Steps
-
Make a project folder.
mkdir exograph-kv-plugin
cd exograph-kv-plugin -
Using
cargo, create new Rust library projects for each component:cargo new --lib kv-model
cargo new --lib kv-model-builder
cargo new --lib kv-resolver -
Create a
Cargo.tomlfile with the following contents. This will declare a workspace to hold our crates.[workspace]
members = [
"kv-model",
"kv-model-builder",
"kv-resolver"
]
# Exograph dependency
[workspace.dependencies]
core-plugin-interface = { git = "https://github.com/exograph/exograph" }
We now have a skeleton project for our plugin!
kv-modelwill define the internal model of our plugin. This is what ultimately gets serialized into.exo_irfiles.kv-model-builderwill output a shared library used at build time to parse the.exoAST and build a plugin model (the builder portion of our plugin).kv-resolverwill output a shared library used at runtime to resolve plugin operations (the resolver portion of our plugin).
Do the following for the three crates:
- In
Cargo.toml, add a dependency on thecore-plugin-interfacecrate:[dependencies]
core-plugin-interface.workspace = true