xref: /aosp_15_r20/external/grpc-grpc/examples/python/multiprocessing/BUILD (revision cc02d7e222339f7a4f6ba5f422e6413f4bd931f2)
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        ":prime_proto_pb2",
59        ":prime_proto_pb2_grpc",
60        "//src/python/grpcio/grpc:grpcio",
61    ],
62)
63
64py_test(
65    name = "test/_multiprocessing_example_test",
66    size = "small",
67    srcs = ["test/_multiprocessing_example_test.py"],
68    data = [
69        ":client",
70        ":server",
71    ],
72    python_version = "PY3",
73)
74