GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - styurin/rules_buf: Bazel rules for Buf.

BranchesTags
Open more actions menu
 
 

Latest commit

 

History

93 Commits
93 Commits

Folders and files

NameName
Last commit message
Last commit date
.github/workflows
.github/workflows
 
 
buf
buf
 
 
examples
examples
 
 
gazelle/buf
gazelle/buf
 
 
tools
tools
 
 
.bazelignore
.bazelignore
 
 
.bazelrc
.bazelrc
 
 
.gitignore
.gitignore
 
 
BUILD.bazel
BUILD.bazel
 
 
LICENSE
LICENSE
 
 
MODULE.bazel
MODULE.bazel
 
 
MODULE.bazel.lock
MODULE.bazel.lock
 
 
Makefile
Makefile
 
 
README.md
README.md
 
 
WORKSPACE
WORKSPACE
 
 
go.mod
go.mod
 
 
go.sum
go.sum
 
 
repositories.bzl
repositories.bzl
 
 

Repository files navigation

rules_buf

Bazel rules for Buf. The rules work alongside the proto_library rule of rules_proto.

Status

This module is a beta, but we may make a few changes as we gather feedback from early adopters.

Setup

Include the following snippet in the Workspace file to setup rules_buf. Refer to release notes of a specific version for setup instructions.

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

http_archive(
    name = "rules_buf",
    integrity = "sha256-Hr64Q/CaYr0E3ptAjEOgdZd1yc+cBjp7OG1wzuf3DIs=",
    strip_prefix = "rules_buf-0.3.0",
    urls = [
        "https://github.com/bufbuild/rules_buf/archive/refs/tags/v0.3.0.zip",
    ],
)

load("@rules_buf//buf:repositories.bzl", "rules_buf_dependencies", "rules_buf_toolchains")

rules_buf_dependencies()

rules_buf_toolchains(version = "v1.32.1")

# rules_proto
load("@rules_proto//proto:repositories.bzl", "rules_proto_dependencies", "rules_proto_toolchains")

rules_proto_dependencies()

rules_proto_toolchains()

Refer the docs or browse the examples on how to setup and use for various scenarios.

List of rules

  • buf_dependencies
  • buf_lint_test
  • buf_breaking_test

Gazelle Extension

The repo also offers a Gazelle extension for generating the rules.

Please refer to the gazelle section in the docs.

Development

The repository follows the official recommendation on deploying bazel rules. All the rule definitions are in buf/internal.

Gazelle

Gazelle extension is in gazelle/buf. Before looking at the code it would be best to understand the architecture of gazelle. The file structure is loosely based on the go and proto extensions that are shipped with gazelle. They are also excellent to better understand the architecture.

The main entry point to the extension is via the NewLanguage function in gazelle/buf/buf.go. Gazelle mostly depends on Language interface. Apart from that one can also implement some optional interfaces.

We implement the following interfaces,

  • Language: Required. Used for build/test rule generation and label resolutions for these rules.
  • RepoImporter: Optional. Used to generate buf_dependencies rule from buf.yaml/buf.work.yaml.
  • CrossResolver: Optional. Used to resolve dependencies across extensions/languages. We use it to resolve any proto files that are part of buf_dependencies rules.

About

Bazel rules for Buf.

Resources

Readme
License
Activity

Stars

0 stars

Watchers

0 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.