build.rs — Protobuf Compilation
The build script runs before the Rust compiler and is responsible for compiling all .proto files into Rust code. It does this in several steps:
1. Collect proto files Recursively scans the src-tauri/proto/ directory for .proto files. Only files that are inside a components/ subdirectory are included — this is a deliberate filter to exclude top-level or organisational proto files.
2. Patch proto files Each .proto file is copied to a temporary directory inside OUT_DIR and patched to inject package packets; as the second line. This ensures all generated types end up in a single packets Rust module, regardless of how the source .proto files are organised. The patching is idempotent — it won't inject the package line twice if it is already present.
This means that the basestation protobufers are slightly different from the ones embeded and jonny boi (the jestson) uses. Keep this in mind for debugging
3. Compile with prost The patched files are compiled using prost_build. A type attribute is applied globally:
TODO: Look for a way to sync protos structure with frontend
config.type_attribute(".", "#[derive(serde::Serialize)]");
This means every generated message struct and enum automatically derives serde::Serialize, so they can be passed directly as Tauri event payloads without any manual wrapper types.
4. protoc The protoc compiler binary is sourced from protoc-bin-vendored, so no system installation of protoc is required.
If you add new .proto files, place them inside a components/ subdirectory under src-tauri/proto/ and they will be picked up automatically on the next build.
If you add new protobufers you must explicitly commit and push them into the github submodule, they will NOT sync automatically when you sync the repo.