Skip to content

Envoy API proto build rules via Bazel native proto support #1873

@htuch

Description

@htuch

Bazel has some support for generating protos via its inbuilt proto_library and cc_proto_library rules today (see https://docs.bazel.build/versions/master/be/protocol-buffer.html). We've so far been using the imported rules for cc_proto_library etc from https://github.com/google/protobuf/blob/master/protobuf.bzl, because we wanted a high degree of control over the protobuf compiler and runtime (associated largely with our former approach to external dep build for protobuf prior to #1682).

We may now be able to switch to native support, which has the advantage that the proto_library rule provides language neutral support for management of transitive proto dependencies. This is useful when doing things like adding additional proto rules to generate constraint validation code (https://github.com/lyft/protoc-gen-validate) and documentation (#1866), since you can avoid horrible hacks like https://github.com/lyft/protoc-gen-validate/blob/master/bazel/go_proto_library.bzl.diff. This might also make it simpler to add support for additional languages (e.g. Go), since the transitivity management is factored out.

It's a bit unclear to me how mature the support is in native Bazel for the latest protobuf toolchain, so creating this tracking issue to investigate. https://blog.bazel.build/2017/02/27/protocol-buffers.html describes how to get started. One thing we'll need to do is rename our protobuf repo to @com_google_protobuf.

@jmillikin-stripe @lizan for comment. @rodaine for PGV applications.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions