BUILD.bazel 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. # Copyright 2020 The gRPC authors.
  2. #
  3. # Licensed under the Apache License, Version 2.0 (the "License");
  4. # you may not use this file except in compliance with the License.
  5. # You may obtain a copy of the License at
  6. #
  7. # http://www.apache.org/licenses/LICENSE-2.0
  8. #
  9. # Unless required by applicable law or agreed to in writing, software
  10. # distributed under the License is distributed on an "AS IS" BASIS,
  11. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. # See the License for the specific language governing permissions and
  13. # limitations under the License.
  14. load("//bazel:cython_library.bzl", "pyx_library")
  15. load("grpcio_tools.bzl", "internal_copied_filegroup")
  16. package(default_visibility = [
  17. "//examples/python:__subpackages__",
  18. "//src/python:__subpackages__",
  19. "//tools/distrib/python/grpcio_tools:__subpackages__",
  20. ])
  21. cc_library(
  22. name = "protoc_lib",
  23. srcs = ["grpc_tools/main.cc"],
  24. hdrs = ["grpc_tools/main.h"],
  25. includes = ["."],
  26. deps = [
  27. "//src/compiler:grpc_plugin_support",
  28. "@com_google_protobuf//:protoc_lib",
  29. ],
  30. )
  31. pyx_library(
  32. name = "cyprotoc",
  33. srcs = ["grpc_tools/_protoc_compiler.pyx"],
  34. deps = [":protoc_lib"],
  35. )
  36. internal_copied_filegroup(
  37. name = "well_known_protos",
  38. srcs = ["@com_google_protobuf//:well_known_protos"],
  39. dest = "grpc_tools/_proto/",
  40. strip_prefix = "src/",
  41. )
  42. py_library(
  43. name = "grpc_tools",
  44. srcs = [
  45. "grpc_tools/__init__.py",
  46. "grpc_tools/protoc.py",
  47. ],
  48. data = [":well_known_protos"],
  49. imports = ["."],
  50. srcs_version = "PY2AND3",
  51. deps = [
  52. ":cyprotoc",
  53. "//src/python/grpcio/grpc:grpcio",
  54. "@com_google_protobuf//:protobuf_python",
  55. ],
  56. )