Skip to content

Latest commit

 

History

History
103 lines (58 loc) · 4.25 KB

File metadata and controls

103 lines (58 loc) · 4.25 KB

rules for building protocol buffers using buf

Overview

The rules work alongside proto_library rule. They support,

Use gazelle to auto generate all of these rules based on buf.yaml.

buf_format

load("@rules_buf//buf:defs.bzl", "buf_format")

buf_format(name)

buf_format rule formats Protobuf files.

ATTRIBUTES

Name Description Type Mandatory Default
name A unique name for this target. Name required

buf_breaking_test

load("@rules_buf//buf:defs.bzl", "buf_breaking_test")

buf_breaking_test(timeout, kwargs)

PARAMETERS

Name Description Default Value
timeout

-

"short"
kwargs

-

none

buf_lint_test

load("@rules_buf//buf:defs.bzl", "buf_lint_test")

buf_lint_test(timeout, kwargs)

PARAMETERS

Name Description Default Value
timeout

-

"short"
kwargs

-

none

buf_dependencies

load("@rules_buf//buf:defs.bzl", "buf_dependencies")

buf_dependencies(name, modules, repo_mapping, toolchain_repo)

buf_dependencies is a repository rule that downloads one or more modules from the BSR and generates build files using Gazelle. Setup Gazelle to use this rule.

For more info please refer to the buf_dependencies section of the docs.

ATTRIBUTES

Name Description Type Mandatory Default
name A unique name for this repository. Name required
modules The module pins //:, example: buf.build/acme/petapis:84a33a06f0954823a6f2a089fb1bb82e List of strings required
repo_mapping In WORKSPACE context only: a dictionary from local repository name to global repository name. This allows controls over workspace dependency resolution for dependencies of this repository.

For example, an entry "@foo": "@bar" declares that, for any time this repository depends on @foo (such as a dependency on @foo//some:target, it should actually resolve that dependency within globally-declared @bar (@bar//some:target).

This attribute is not supported in MODULE.bazel context (when invoking a repository rule inside a module extension's implementation function).
Dictionary: String -> String optional
toolchain_repo The name of the rules_buf_toolchain repo. This is only needed the name of rules_buf_toolchains rule was modified. String optional "rules_buf_toolchains"