Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

proto_library build rules #52

Closed
davidzchen opened this issue Mar 25, 2015 · 31 comments
Closed

proto_library build rules #52

davidzchen opened this issue Mar 25, 2015 · 31 comments
Assignees
Labels
P2 We'll consider working on this in future. (Assignee optional) type: feature request
Milestone

Comments

@davidzchen
Copy link
Member

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?

@laszlocsomor
Copy link
Contributor

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.

@laszlocsomor laszlocsomor self-assigned this Mar 25, 2015
@laszlocsomor
Copy link
Contributor

(sorry, shouldn't have closed this just yet)

@laszlocsomor laszlocsomor reopened this Mar 25, 2015
@damienmg damienmg added type: feature request P3 We're not considering working on this, but happy to review a PR. (No assignee) labels Mar 26, 2015
@collinw
Copy link

collinw commented Apr 2, 2015

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.

@damienmg
Copy link
Contributor

damienmg commented Apr 3, 2015

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 notifications@github.com
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
#52 (comment).

@schroederc
Copy link
Contributor

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:

@ulfbot
Copy link

ulfbot commented Apr 14, 2015

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 notifications@github.com
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:


Reply to this email directly or view it on GitHub
#52 (comment).

@mzhaom
Copy link
Contributor

mzhaom commented Apr 14, 2015

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

@damienmg
Copy link
Contributor

A quick status update: this is something we working on shiping but it will take a long time

@clconway
Copy link

clconway commented Oct 5, 2015

Any ETA on this? We're using protos in Shipshape and would love to use standard rules.

@damienmg
Copy link
Contributor

damienmg commented Oct 6, 2015

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 notifications@github.com 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
#52 (comment).

@damienmg
Copy link
Contributor

damienmg commented Oct 9, 2015

It should happens this quarter

@damienmg damienmg added P2 We'll consider working on this in future. (Assignee optional) and removed P3 We're not considering working on this, but happy to review a PR. (No assignee) labels Oct 9, 2015
@perezd
Copy link
Contributor

perezd commented Nov 13, 2015

Will this support Go when it ships?

@damienmg
Copy link
Contributor

Yes. It will support both Skylark and native rules.

@arslan-urtashev
Copy link

Hi! Is there any status update? Thanks

@damienmg
Copy link
Contributor

damienmg commented Mar 9, 2016

I think we are moving to making the rules provided by google/protobuf good one instead of shipping our legacy support. No ETA.

@kqyang
Copy link

kqyang commented Jul 14, 2016

Any status update on this?

@robfig
Copy link

robfig commented Jul 31, 2016

What is the current guidance for generating Java from proto files?

@pcj
Copy link
Member

pcj commented Aug 1, 2016

@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.

@jcanizales
Copy link

@pcj I love your graphical explanation of that repo :D

@smr277
Copy link

smr277 commented Aug 25, 2016

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++?

@pcj
Copy link
Member

pcj commented Aug 25, 2016

@smr277 It's probably still premature for native proto_library. However, I've done fair amount of work on https://github.com/pubref/rules_protobuf since last comment. Supports C++ protobufs with gRPC and SSL out of the box.

@ejona86
Copy link

ejona86 commented Aug 25, 2016

@smr277, proto_library doesn't generate for each language at this point. There will need to be per-language support for protobuf, and that is still in the works.

@damienmg damienmg added this to the 1.0 milestone Nov 11, 2016
@cgrushko
Copy link
Contributor

Some form of status update is in
bazel-contrib/rules_go#121 (comment)

@lukaszx0
Copy link

@cgrushko you mentioned in an issue for grpc-java that there's a first class support for java_proto_library but I don't see docs for it. Is it just undocumented yet?

@lukaszx0
Copy link

Oh, they're under java, and I was looking under protocol buffer.

My bad. Please ignore me! Sorry for the noise.

@cgrushko
Copy link
Contributor

(didn't know it got undocumented; I thought that only happens at the next release)
I put together a demo repo in https://github.com/cgrushko/proto_library,
and I'm working on a blog post (or at least a Gist).

@lukaszx0
Copy link

@cgrushko nice, thanks!

@cgrushko
Copy link
Contributor

Blog post: https://bazel.build/blog/index.html#protocol-buffers-in-bazel

I'll close this issue because it seems to have grown to include too many things; if your issue hasn't been addressed, please open a new issue and CC me.

@ejona86
Copy link

ejona86 commented Feb 28, 2017

For posterity, https://bazel.build/blog/2017/02/27/protocol-buffers.html is the permalink to the blog post.

@renning22
Copy link

I failed to compile Bazel from head by Bazel. When will this feature be distributed?

@cgrushko
Copy link
Contributor

Next bazel release. There should be an issue open for it.

tomaszstrejczek pushed a commit to tomaszstrejczek/bazel that referenced this issue Oct 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P2 We'll consider working on this in future. (Assignee optional) type: feature request
Projects
None yet
Development

No branches or pull requests