• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
17load("@rules_proto//proto:defs.bzl", "proto_library")
18load("//bazel:python_rules.bzl", "py_grpc_library", "py_proto_library")
19
20proto_library(
21    name = "prime_proto",
22    srcs = ["prime.proto"],
23)
24
25py_proto_library(
26    name = "prime_proto_pb2",
27    deps = [":prime_proto"],
28)
29
30py_grpc_library(
31    name = "prime_proto_pb2_grpc",
32    srcs = [":prime_proto"],
33    deps = [":prime_proto_pb2"],
34)
35
36py_binary(
37    name = "client",
38    testonly = 1,
39    srcs = ["client.py"],
40    imports = ["."],
41    python_version = "PY3",
42    srcs_version = "PY3",
43    deps = [
44        ":prime_proto_pb2",
45        ":prime_proto_pb2_grpc",
46        "//src/python/grpcio/grpc:grpcio",
47    ],
48)
49
50py_binary(
51    name = "server",
52    testonly = 1,
53    srcs = ["server.py"],
54    imports = ["."],
55    python_version = "PY3",
56    srcs_version = "PY3",
57    deps = [
58        "//src/python/grpcio/grpc:grpcio",
59        ":prime_proto_pb2",
60        ":prime_proto_pb2_grpc",
61    ] + select({
62        "//conditions:default": ["@futures//:futures"],
63        "//:python3": [],
64    }),
65)
66
67py_test(
68    name = "test/_multiprocessing_example_test",
69    size = "small",
70    srcs = ["test/_multiprocessing_example_test.py"],
71    data = [
72        ":client",
73        ":server",
74    ],
75    python_version = "PY3",
76)
77