{"id":28902883,"url":"https://github.com/bufbuild/rules_buf","last_synced_at":"2025-08-28T12:41:07.605Z","repository":{"id":37073131,"uuid":"428778062","full_name":"bufbuild/rules_buf","owner":"bufbuild","description":"Bazel rules for Buf.","archived":false,"fork":false,"pushed_at":"2025-08-22T13:24:10.000Z","size":403,"stargazers_count":54,"open_issues_count":10,"forks_count":31,"subscribers_count":16,"default_branch":"main","last_synced_at":"2025-08-22T15:36:29.391Z","etag":null,"topics":["bazel","bazel-rules","buf","grpc","protobuf"],"latest_commit_sha":null,"homepage":"","language":"Starlark","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bufbuild.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2021-11-16T18:53:34.000Z","updated_at":"2025-08-22T13:24:14.000Z","dependencies_parsed_at":"2023-10-12T19:33:06.041Z","dependency_job_id":"6bb91882-e26c-443d-ac39-d846eabb90ef","html_url":"https://github.com/bufbuild/rules_buf","commit_stats":{"total_commits":61,"total_committers":6,"mean_commits":"10.166666666666666","dds":0.5737704918032787,"last_synced_commit":"abbbfce7c3fccf1d4b87afa28140d9ce53f80057"},"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/bufbuild/rules_buf","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bufbuild%2Frules_buf","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bufbuild%2Frules_buf/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bufbuild%2Frules_buf/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bufbuild%2Frules_buf/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bufbuild","download_url":"https://codeload.github.com/bufbuild/rules_buf/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bufbuild%2Frules_buf/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272498937,"owners_count":24944822,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-28T02:00:10.768Z","response_time":74,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bazel","bazel-rules","buf","grpc","protobuf"],"created_at":"2025-06-21T12:01:06.404Z","updated_at":"2025-08-28T12:41:07.594Z","avatar_url":"https://github.com/bufbuild.png","language":"Starlark","funding_links":[],"categories":["Starlark"],"sub_categories":[],"readme":"# rules_buf\n\nBazel rules for [Buf](https://buf.build/). The rules work alongside the `proto_library` rule of [rules_proto](https://github.com/bazelbuild/rules_proto).\n\n## Status\n\nThis module is a beta, but we may make a few changes as we gather feedback from early adopters.\n\n## Setup\n\nInclude the following snippet in the Workspace file to setup `rules_buf`. Refer to [release notes](https://github.com/bufbuild/rules_buf/releases) of a specific version for setup instructions.\n\n```starlark\nload(\"@bazel_tools//tools/build_defs/repo:http.bzl\", \"http_archive\")\n\nhttp_archive(\n    name = \"rules_buf\",\n    integrity = \"sha256-Hr64Q/CaYr0E3ptAjEOgdZd1yc+cBjp7OG1wzuf3DIs=\",\n    strip_prefix = \"rules_buf-0.3.0\",\n    urls = [\n        \"https://github.com/bufbuild/rules_buf/archive/refs/tags/v0.3.0.zip\",\n    ],\n)\n\nload(\"@rules_buf//buf:repositories.bzl\", \"rules_buf_dependencies\", \"rules_buf_toolchains\")\n\nrules_buf_dependencies()\n\nrules_buf_toolchains(version = \"v1.32.1\")\n\n# rules_proto\nload(\"@rules_proto//proto:repositories.bzl\", \"rules_proto_dependencies\", \"rules_proto_toolchains\")\n\nrules_proto_dependencies()\n\nrules_proto_toolchains()\n```\n\nRefer the [docs](https://docs.buf.build/build-systems/bazel) or browse the [examples](examples) on how to setup and use for various scenarios.\n\n## List of rules\n\n- [buf_dependencies](https://docs.buf.build/build-systems/bazel#buf-dependencies)\n- [buf_lint_test](https://docs.buf.build/build-systems/bazel#buf-lint-test)\n- [buf_breaking_test](https://docs.buf.build/build-systems/bazel#buf-breaking-test)\n\n## Gazelle Extension\n\nThe repo also offers a Gazelle extension for generating the rules.\n\nPlease refer to the [gazelle section](https://docs.buf.build/build-systems/bazel#gazelle) in the docs.\n\n## Development\n\nThe repository follows the [official recommendation](https://bazel.build/rules/deploying) on deploying bazel rules.\nAll the rule definitions are in [buf/internal](buf/internal).\n\n### Gazelle\n\nGazelle extension is in [gazelle/buf](gazelle/buf). Before looking at the code it would be best to understand the [architecture of gazelle](https://github.com/bazelbuild/bazel-gazelle/blob/master/Design.rst). The file structure is loosely based on the `go` and `proto` [extensions](https://github.com/bazelbuild/bazel-gazelle/tree/master/language) that are shipped with gazelle.\nThey are also excellent to better understand the architecture.\n\nThe main entry point to the extension is via the `NewLanguage` function in [gazelle/buf/buf.go](gazelle/buf/buf.go). Gazelle mostly depends on [`Language`](https://pkg.go.dev/github.com/bazelbuild/bazel-gazelle@v0.25.0/language#Language) interface. Apart from that one can also implement some optional interfaces.\n\nWe implement the following interfaces,\n\n- [`Language`](https://pkg.go.dev/github.com/bazelbuild/bazel-gazelle@v0.25.0/language#Language): Required. Used for build/test rule generation and label resolutions for these rules.\n- [`RepoImporter`](https://pkg.go.dev/github.com/bazelbuild/bazel-gazelle@v0.25.0/language#RepoImporter): Optional. Used to generate `buf_dependencies` rule from `buf.yaml`/`buf.work.yaml`.\n- [`CrossResolver`](https://pkg.go.dev/github.com/bazelbuild/bazel-gazelle@v0.25.0/resolve#CrossResolver): Optional. Used to resolve dependencies across extensions/languages. We use it to resolve any proto files that are part of `buf_dependencies` rules.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbufbuild%2Frules_buf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbufbuild%2Frules_buf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbufbuild%2Frules_buf/lists"}