add cargo-generate template for plugin example
This commit is contained in:
parent
2228f584a1
commit
d7601a4352
BIN
examples/plugin/.DS_Store
vendored
Normal file
BIN
examples/plugin/.DS_Store
vendored
Normal file
Binary file not shown.
9
examples/plugin/.template/Cargo.toml
Normal file
9
examples/plugin/.template/Cargo.toml
Normal file
|
@ -0,0 +1,9 @@
|
|||
[package]
|
||||
authors = ["{{authors}}"]
|
||||
name = "{{project-name}}"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
pyo3 = "{{PYO3_VERSION}}"
|
||||
plugin_api = { path = "plugin_api" }
|
17
examples/plugin/.template/plugin_api/Cargo.toml
Normal file
17
examples/plugin/.template/plugin_api/Cargo.toml
Normal file
|
@ -0,0 +1,17 @@
|
|||
[package]
|
||||
name = "plugin_api"
|
||||
version = "0.1.0"
|
||||
description = "Plugin API example"
|
||||
edition = "2021"
|
||||
|
||||
[lib]
|
||||
name = "plugin_api"
|
||||
crate-type = ["cdylib", "rlib"]
|
||||
|
||||
[dependencies]
|
||||
#!!! Important - DO NOT ENABLE extension-module FEATURE HERE!!!
|
||||
pyo3 = "{{PYO3_VERSION}}"
|
||||
|
||||
[features]
|
||||
# instead extension-module feature for pyo3 is enabled conditionally when we want to build a standalone extension module to test our plugins without "main" program
|
||||
extension-module = ["pyo3/extension-module"]
|
4
examples/plugin/.template/pre-script.rhai
Normal file
4
examples/plugin/.template/pre-script.rhai
Normal file
|
@ -0,0 +1,4 @@
|
|||
variable::set("PYO3_VERSION", "0.18.0");
|
||||
file::rename(".template/Cargo.toml", "Cargo.toml");
|
||||
file::rename(".template/plugin_api/Cargo.toml", "plugin_api/Cargo.toml");
|
||||
file::delete(".template");
|
5
examples/plugin/cargo-generate.toml
Normal file
5
examples/plugin/cargo-generate.toml
Normal file
|
@ -0,0 +1,5 @@
|
|||
[template]
|
||||
ignore = [".nox"]
|
||||
|
||||
[hooks]
|
||||
pre = [".template/pre-script.rhai"]
|
Loading…
Reference in a new issue