commit | a76db53e8a7b9eb1fabfe17faae2b71537d2c132 | [log] [tgz] |
---|---|---|
author | Alex Eagle <alex@aspect.dev> | Tue Oct 10 09:01:15 2023 -0700 |
committer | Alex Eagle <alex@aspect.dev> | Tue Oct 10 09:01:15 2023 -0700 |
tree | bed973e80b041713abc1dafba5deec6e3b0212a9 | |
parent | 2d33f813c203e4a00ac61941cec83b4d9b56039b [diff] |
chore: add a pre-commit hook config. This matches the Bazel recommendation from https://github.com/bazel-contrib/rules-template for configuring an optional, client-side automation for formatting BUILD/bzl files before sending a PR. It has been found to save a bunch of time for contributors who otherwise trip over the server-side CI check and have to do an extra iteration to get their PR green. I imagine Googlers are already relying on some Piper feature to do the equivalent when they work on this code, so they haven't noticed the deficiency.
This repository contains a Starlark implementation of proto_library
and related “base layer” rules in Bazel. It does not provide rules for any specific languages. These are typically expected to be provided in the ruleset for the language.
For a high-level overview of using Protocol Buffers and gRPC with Bazel, see https://bazel-contrib.github.io/SIG-rules-authors/proto-grpc.html.
For the list of Proto rules, see the Bazel documentation.
As of September 2023, this repo is mostly empty and contains stubs for proto_library
, ProtoInfo
and other proto toolchain support rules.
This will change soon, around the time Bazel 7 is released (in Oct/Nov 2023), because the stubs will be replaced with actual implementations. We plan to remove the native implementations in Bazel 8, at which point rules_proto will be the only way to build Protobuf rules.
As such it's recommended to use this repository now, so that the removal of implementations from Bazel 8 does not cause you problems.
To get started with rules_proto
, add the WORKSPACE
file snippet from the latest release.
Then, in your BUILD
files, import and use the rules:
load("@rules_proto//proto:defs.bzl", "proto_library") proto_library( ... )
If you're migrating from the native proto rules to rules_proto
, you can use the following buildifier command to automate the changes to your BUILD
and .bzl
files:
buildifier --lint=fix --warnings=native-proto <path/to/BUILD>
Bazel and rules_proto
are the work of many contributors. We appreciate your help!
To contribute, please read the contribution guidelines: CONTRIBUTING.md.
Note that the rules_proto
use the GitHub issue tracker for bug reports and feature requests only.
For asking questions see:
#proto
on slack.bazel.build