bazel icon indicating copy to clipboard operation
bazel copied to clipboard

Update third_party/protoc to support proto3

Open collinw opened this issue 11 years ago • 4 comments

Early support for the proto3 syntax was released in February: https://github.com/google/protobuf/releases/tag/v3.0.0-alpha-2. Can Bazel's copies of the proto compiler be updated to include this support?

collinw avatar Apr 03 '15 19:04 collinw

We can't use proto3 in Bazel right now, as the protos (and code) also need to work internally, where we're still using proto2 for various reasons (and we also need to ensure that the proto runtime and the compiler are updated in sync; we've seen incompatible changes in the past). If you want to use proto3 in your own project, you will probably have to compile the protocol compiler yourself.

ulfjack avatar Apr 07 '15 12:04 ulfjack

If you have a more specific / bazel use case in mind, please reopen with more details.

ulfjack avatar Apr 07 '15 12:04 ulfjack

FWIW, I'm not asking that Bazel be migrated to use syntax="proto3"; I'm asking that the compiler be updated to include support for that syntax. The same compiler can handle both proto2 and proto3 syntax.

It certainly possible that I can build my own copy of the proto compiler. Is there documentation about how the binaries in third_party/protobuf/protoc* were produced?

collinw avatar Apr 07 '15 19:04 collinw

We just did a static compilation of the proto compiler. Using external repositories (see http://bazel.io/docs/build-encyclopedia.html#local_repository and http://bazel.io/docs/build-encyclopedia.html#bind), you can bind your local proto compiler in your repository. Or you can simply modify the genproto.bzl to use whatever compiler you want.

We checked-in a static binary so we can compile bazel on any machine. It is not part of an "official" proto support.

damienmg avatar Apr 08 '15 08:04 damienmg