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