Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Protobuf Processor

Purpose

Compiles Protocol Buffer (.proto) files to generated source code using protoc.

The Rust alternative is iprotobuf: the files compiled in-process with protox (descriptors byte-identical to protoc’s) and Rust code generated with prost, one file per package. It emits Rust only; a repo that needs the C++ output stays here.

How It Works

Files matching configured extensions in the proto/ directory are compiled using the Protocol Buffer compiler. Output is written to out/processor.generator.protobuf/:

proto/hello.proto  →  out/processor.generator.protobuf/hello.pb.cc

The --proto_path is automatically set to the parent directory of each input file.

Source Files

  • Input: proto/**/*.proto
  • Output: out/processor.generator.protobuf/ with .pb.cc extension

Configuration

[processor.generator.protobuf]
command = "protoc"                        # Protoc binary (default: "protoc")
src_extensions = [".proto"]                   # File extensions to process
output_dir = "out/processor.generator.protobuf"              # Output directory (default: "out/processor.generator.protobuf")
dep_inputs = []                         # Additional files that trigger rebuilds
KeyTypeDefaultDescription
commandstring"protoc"Path to protoc compiler
src_extensionsstring[][".proto"]File extensions to discover
output_dirstring"out/processor.generator.protobuf"Output directory
dep_inputsstring[][]Extra files whose changes trigger rebuilds

Batch support

Each input file is processed individually, producing its own output file.

Clean behavior

This processor is a Generator — rsconstruct clean outputs removes each declared output file individually with no directory recursion. After all per-product cleans complete, the orchestrator removes any parent directories that are now empty. Pass --no-empty-dirs to keep them. See Clean behavior and rsconstruct clean.