Closed antoninbas closed 4 years ago
Just a heads-up. I tried adding Bazel rules for Python and encountered issue https://github.com/grpc/grpc/issues/21830. When the Python gRPC target is defined here, it can not be used by other projects: ERROR: 1b07b1db06ec9ee22c71eac6f0bd4549/external/com_github_p4lang_p4runtime/p4/v1/BUILD:13:1: output 'external/com_github_p4lang_p4runtime/p4/v1/p4data_pb2.py' was not created
Just applies the Python, C++ seems fine.
We should try to remove the dependency on https://github.com/stackb/rules_proto and use the official gRPC rules: https://github.com/grpc/grpc/blob/master/bazel/cc_grpc_library.bzl
The recent support for
strip_import_prefix
(https://docs.bazel.build/versions/master/be/protocol-buffer.html#proto_library.strip_import_prefix) in theproto_library
native Bazel rule would enable us to cleanly solve the issue of the protos not being properly "rooted" in the WORKSPACE (they are under theproto/
subdirectory).strip_import_prefix
works well with thecc_proto_library
rule in recent Bazel versions (I tried with 1.0.1) but breaks thecc_grpc_library
rule even with very recent gRPC versions (I tried with 1.25.0-pre1). Probably connected to this issue: https://github.com/grpc/grpc/issues/20675. If it is resolved, we should consider rewriting our Bazel rules for P4Runtime.