This example demonstrates using rules_buf with a v2 buf.yaml workspace. A single root buf.yaml declares the workspace's modules under modules: and applies shared lint and breaking configuration across all of them.
- The root
buf.yamlis exported in BUILD. - Each
buf_lint_testandbuf_breaking_testreferences the rootbuf.yamlviaconfig = "//:buf.yaml"and identifies its module with themoduleattribute (e.g.module = "fooapis"). proto_libraryrules usestrip_import_prefixso that imports resolve relative to the module root (fooapis/foo/v1, barapis/bar/v1).
See the Gazelle example for how to generate these rules automatically.