-
Notifications
You must be signed in to change notification settings - Fork 582
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
Break dependency on protobuf.bzl from google/protobuf for C++ #92
Conversation
This replaces the use of cc_proto_library / proto_gen from the @com_google_protobuf//:protobuf.bzl. The reason for doing so is that newer versions of google/protobuf have changed cc_proto_library + proto_gen so that they no longer work with pgv_cc_proto_library. pgv_proto_library now takes a proto_library containing the protos instead of a list of proto files. The approach for generating the protoc command line arguments was taken from bazelbuild/rules_go The py_proto_library imported from @com_google_protobuf//:protobuf.bzl is used by Envoy, so we left it in. Signed-off-by: Andrew Keesler <[email protected]> Signed-off-by: Amin Jamali <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks like a fantastic improvement; moving to proto_library
inputs was the long term vision, nice to see it happening. @akonradi can you take a quick look and see how this aligns with earlier work that you did in this area?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool, I'm glad we're moving towards using the native proto_library
rules. A few nits but otherwise looking good.
bazel/pgv_proto_library.bzl
Outdated
"""Bazel rule to create a C++ protobuf validation library from proto source files | ||
Args: | ||
name: the name of the pgv_cc_proto_library. | ||
proto: a single proto_library rule which contains the necessary .proto files. Note that this |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bazel's native cc_proto_library rule uses deps
for the set of proto_library
dependencies. It might be worth doing the same here, and using cc_deps
or similar for C++ dependencies.
bazel/protobuf.bzl
Outdated
outputs=out_files, | ||
arguments=args + [_proto_path(proto) for proto in protos], | ||
executable=ctx.executable._protoc, | ||
mnemonic="ProtoGenValidateCompile", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Compile" seems inaccurate. What do you think about "CcGenerate"?
- change mnemonic to ProtoGenValidateCcGenerate - accept array of proto_library rules as argument Signed-off-by: Sam Smith <[email protected]>
This replaces the use of cc_proto_library / proto_gen from the
@com_google_protobuf//:protobuf.bzl. The reason for doing so is that
newer versions of google/protobuf have changed cc_proto_library +
proto_gen so that they no longer work with pgv_cc_proto_library.
pgv_proto_library now takes a proto_library containing the protos
instead of a list of proto files. The approach for generating the protoc
command line arguments was taken from bazelbuild/rules_go
The py_proto_library imported from @com_google_protobuf//:protobuf.bzl
is used by Envoy, so we left it in.
Note: when integrating this commit with Envoy, we see the error:
It looks like that error should be fixed by lyft/protoc-gen-star#28, however