-
-
Notifications
You must be signed in to change notification settings - Fork 0
Developing plugins
Developing plugins is pretty simple!
To create a plugin project, follow these steps:
- Create a project using
cargo new --lib <proj_name>
- Add this part:
[lib]
crate-type = ["cdylib"]
to Cargo.toml, to compile to a dynamic lib
- Add
kumitateru_pdk
dependency, recommended to use the latest version
And to the code part!:
- Clear lib.rs and add this function:
#[no_mangle]
pub extern "C" fn activate() -> kumitateru_pdk::PluginConfig {
return kumitateru_pdk::PluginConfig {
name: "Sample".to_string(),
version: "0.1.0".to_string(),
author: "ggoraa".to_string(),
subscriptions: vec![]
}
}
As an entry point to the plugin, which activates the thing.
Documentation on structs can be found here: https://docs.rs/kumitateru_pdk
A plugin bundle is basically a .zip
file, which content structure is:
plugin.kpb
├── darwin.dylib
├── win.dll
├── linux.so
└── manifest.toml
darwin.dylib
is a macOS distribution of a plugin, linux.so
is a Linux distribution, and win.dll
is a Windows one.
The manifest.toml
is a manifest, that describes a plugin. Contains name, version, and author
You can build a bundle by manually crafting a .zip
archive and changing it's extension to .kpb
, or by using cargo createkpb
subcommand (installed using cargo install cargo-createkpb), which is preferred.