BUILD 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. # gRPC Bazel BUILD file.
  2. #
  3. # Copyright 2019 The gRPC authors.
  4. #
  5. # Licensed under the Apache License, Version 2.0 (the "License");
  6. # you may not use this file except in compliance with the License.
  7. # You may obtain a copy of the License at
  8. #
  9. # http://www.apache.org/licenses/LICENSE-2.0
  10. #
  11. # Unless required by applicable law or agreed to in writing, software
  12. # distributed under the License is distributed on an "AS IS" BASIS,
  13. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. # See the License for the specific language governing permissions and
  15. # limitations under the License.
  16. load("@rules_proto//proto:defs.bzl", "proto_library")
  17. load("//bazel:python_rules.bzl", "py_grpc_library", "py_proto_library")
  18. proto_library(
  19. name = "prime_proto",
  20. srcs = ["prime.proto"],
  21. )
  22. py_proto_library(
  23. name = "prime_proto_pb2",
  24. deps = [":prime_proto"],
  25. )
  26. py_grpc_library(
  27. name = "prime_proto_pb2_grpc",
  28. srcs = [":prime_proto"],
  29. deps = [":prime_proto_pb2"],
  30. )
  31. py_binary(
  32. name = "client",
  33. testonly = 1,
  34. srcs = ["client.py"],
  35. imports = ["."],
  36. python_version = "PY3",
  37. srcs_version = "PY3",
  38. deps = [
  39. ":prime_proto_pb2",
  40. ":prime_proto_pb2_grpc",
  41. "//src/python/grpcio/grpc:grpcio",
  42. ],
  43. )
  44. py_binary(
  45. name = "server",
  46. testonly = 1,
  47. srcs = ["server.py"],
  48. imports = ["."],
  49. python_version = "PY3",
  50. srcs_version = "PY3",
  51. deps = [
  52. "//src/python/grpcio/grpc:grpcio",
  53. ":prime_proto_pb2",
  54. ":prime_proto_pb2_grpc",
  55. ] + select({
  56. "//conditions:default": ["@futures//:futures"],
  57. "//:python3": [],
  58. }),
  59. )
  60. py_test(
  61. name = "test/_multiprocessing_example_test",
  62. size = "small",
  63. srcs = ["test/_multiprocessing_example_test.py"],
  64. data = [
  65. ":client",
  66. ":server",
  67. ],
  68. python_version = "PY3",
  69. )