Expand description
Build-script (build.rs) helper for compiling witforge-generated .proto schemas with
protox, prost-build, and optional pbjson-build.
witforge-build removes repetitive build.rs boilerplate:
- Discovers every
.protofile underproto_dirin deterministic sorted order while refusing symlinks. - Emits
cargo:rerun-if-changeddirectives forproto_dir, every subdirectory, and every discovered.protofile. - Compiles descriptors with pure-Rust
protox(no externalprotocbinary required) and generates Rust types viaprost-build(plus optionalpbjson-buildbehind thepbjsonfeature). - Writes a consistent
prost_include.rsinclude file whose module layout matcheswitforge gluefor both standalone contracts (v<major>::*) and contracts withdeps/(<namespace>::<package>::v<major>::*), without rewriting unchanged files.
§Example
fn main() -> Result<(), Box<dyn std::error::Error>> {
witforge_build::compile_protos("src/generated/proto")?;
Ok(())
}Structs§
- Build
Output - Summary of the files discovered and generated by
Config::compile_protos. - Config
- Builder configuring how
witforge-generated.protofiles are compiled.
Enums§
- Error
- Error returned when discovering or compiling
witforge-generated.protofiles fails.
Constants§
- DEFAULT_
INCLUDE_ FILE - Default filename written inside
OUT_DIRthat includes all generated protobuf modules.
Functions§
- compile_
protos - Discover and compile every
.protofile underproto_dirwith defaultConfig. - discover_
protos - Discover every
.protofile underproto_dirin deterministic sorted order.