proto_library build rules
The Build Encyclopedia documentation for objc_proto_library references proto_library, which does not seem to have been open sourced yet.
On the same note, objc_proto_library seems to be the only available rule for building proto libraries. What is the plan for proto_library rules for other languages?
We're not yet ready to open-source the more generic proto_library rule. In the meantime you can use genproto, see https://github.com/google/bazel/blob/master/src/main/protobuf/BUILD, or write a genrule.
I'll remove the reference from the BE for now.
(sorry, shouldn't have closed this just yet)
Is there a timeline for releasing proto_library support? We'd love to ditch Kythe's campfire build system, but can't feasibly do so without proto_library.
For now we have a genproto that supports Java using Skylark (see tools/build_rules/genproto.bzl and its usage in the link Laszlo sent. You can easily adapt it for other languages.
On Fri, Apr 3, 2015 at 1:57 AM Collin Winter [email protected] wrote:
Is there a timeline for releasing proto_library support? We'd love to ditch Kythe's campfire build system, but can't feasibly do so without proto_library.
— Reply to this email directly or view it on GitHub https://github.com/google/bazel/issues/52#issuecomment-89084720.
The Kythe team has found that the genproto rule isn't as easy to use as you've suggested. It seems to have at least one severe issue that we'd need fixed before we migrate to using Bazel.
Bazel special-cases the genproto Skylark rule for Java (see BazelJavaRuleClasses.java). It does not, however, support the native C++ rules in the same way. We have thought of a few ways to workaround this problem but feel that they would burden us in the same way as having our own build system. Switching to Bazel (from Campfire) is meant to remove these types of concerns from our team.
Likewise, having to write our own support for C++ (and Go) means maintaining even more build-related logic. It would be nice if C++ was supported in genproto by the Bazel team. That would minimize our need for forking/maintaining the existing rule.
Other Relevant C++ issues:
- https://github.com/google/bazel/issues/114
- https://github.com/google/bazel/issues/117
You should be able to write a genproto rule that generate .c or .cc files and put that into cc_library.srcs. If you want to make it look like what we have internally, you can wrap that in a Skylark macro.
We're working on proto_library as well as go support this quarter. It's unlikely that we'll explicitly support something else before that is ready. If we were in a hurry, go support could be ready in ~weeks, but proper proto_library support is tricky.
On Mon, Apr 13, 2015 at 7:06 PM, Cody Schroeder [email protected] wrote:
The Kythe team has found that the genproto rule isn't as easy to use as you've suggested. It seems to have at least one severe issue that we'd need fixed before we migrate to using Bazel.
Bazel special-cases the genproto Skylark rule for Java (see BazelJavaRuleClasses.java https://github.com/google/bazel/blob/master/src/main/java/com/google/devtools/build/lib/bazel/rules/java/BazelJavaRuleClasses.java#L118). It does not, however, support the native C++ rules in the same way. We have thought of a few ways to workaround this problem but feel that they would burden us in the same way as having our own build system. Switching to Bazel (from Campfire) is meant to remove these types of concerns from our team.
Likewise, having to write our own support for C++ (and Go) means maintaining even more build-related logic. It would be nice if C++ was supported in genproto by the Bazel team. That would minimize our need for forking/maintaining the existing rule.
Other Relevant C++ issues:
- #114 https://github.com/google/bazel/issues/114
- #117 https://github.com/google/bazel/issues/117
— Reply to this email directly or view it on GitHub https://github.com/google/bazel/issues/52#issuecomment-92426443.
I have a simple macro that creates genrule and cc_library targets for proto files, just FYI: https://github.com/mzhaom/trunk/blob/master/third_party/grpc/grpc_proto.bzl
A quick status update: this is something we working on shiping but it will take a long time
Any ETA on this? We're using protos in Shipshape and would love to use standard rules.
Not yet. We are thinking of shipping it by the end of the year but it is not yet decided. You are pinging at the good moment :)
On Tue, Oct 6, 2015, 1:53 AM clconway [email protected] wrote:
Any ETA on this? We're using protos in Shipshape https://github.com/google/shipshape/blob/master/shipshape/proto and would love to use standard rules.
— Reply to this email directly or view it on GitHub https://github.com/bazelbuild/bazel/issues/52#issuecomment-145700737.
It should happens this quarter
Will this support Go when it ships?
Yes. It will support both Skylark and native rules.
Hi! Is there any status update? Thanks
I think we are moving to making the rules provided by google/protobuf good one instead of shipping our legacy support. No ETA.
Any status update on this?
What is the current guidance for generating Java from proto files?
@robfig I just released https://github.com/pubref/rules_protobuf/tree/0.1.1 for my own use but hopefully it's useful for you.
@pcj I love your graphical explanation of that repo :D
It seems that proto_library now exists here: http://bazel.io/docs/be/protocol-buffer.html However, it a) needs the protobuf library to be in third_party/protobuf, and I can't seem to get it working with cc_library. Has anyone used the builtin proto_library with c++?