protoc
protoc is a dependency that provisions an official Protobuf compiler package and puts its executable directory first in PATH. It is not a function and takes no arguments. Use protobuf_generate for built-in code generators.
Load an exact stable release version in canonical x.y or x.y.z form, without a leading v. Versions before 3.0.0 are unsupported because their packages use a different layout. Package availability also varies by host:
- Linux x86-64 packages start at
3.0.0. - Linux ARM64 packages start at
3.5.0. - Windows x86-64 packages start at
3.7.0. - Windows ARM64 uses the x86-64
win64package through Windows 11 emulation and starts at3.7.0; no native Windows ARM64 package exists yet. - macOS ARM64 packages exist for
3.20.0through3.20.2, disappear for later3.20.xreleases, and return at21.0.
xx retains the package's bundled include tree for code generation, validates archive paths and extracted sizes, and verifies the installed compiler's reported version. GitHub release digests are verified when metadata provides one. Older packages published before GitHub added digests rely on the authenticated release metadata, HTTPS transport, exact official URL, and exact byte size.
Example
load("@[email protected]", "protoc")
load("@os@1", "run")
run(("protoc", "--version"), deps=[protoc])