• 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("@grpc_python_dependencies//:requirements.bzl", "requirement")
18load("@rules_proto//proto:defs.bzl", "proto_library")
19load("//bazel:python_rules.bzl", "py_grpc_library", "py_proto_library")
20
21package(default_testonly = 1)
22
23proto_library(
24    name = "hash_name_proto",
25    srcs = ["hash_name.proto"],
26)
27
28py_proto_library(
29    name = "hash_name_py_pb2",
30    deps = [":hash_name_proto"],
31)
32
33py_grpc_library(
34    name = "hash_name_py_pb2_grpc",
35    srcs = [":hash_name_proto"],
36    deps = [":hash_name_py_pb2"],
37)
38
39py_binary(
40    name = "client",
41    srcs = ["client.py"],
42    python_version = "PY3",
43    srcs_version = "PY2AND3",
44    deps = [
45        ":hash_name_py_pb2",
46        ":hash_name_py_pb2_grpc",
47        "//src/python/grpcio/grpc:grpcio",
48        "@six",
49    ],
50)
51
52py_library(
53    name = "search",
54    srcs = ["search.py"],
55    srcs_version = "PY2AND3",
56    deps = [
57        ":hash_name_py_pb2",
58    ],
59)
60
61py_binary(
62    name = "server",
63    srcs = ["server.py"],
64    python_version = "PY3",
65    srcs_version = "PY2AND3",
66    deps = [
67        "//src/python/grpcio/grpc:grpcio",
68        ":hash_name_py_pb2",
69        ":search",
70    ] + select({
71        "//conditions:default": ["@futures//:futures"],
72        "//:python3": [],
73    }),
74)
75
76py_test(
77    name = "test/_cancellation_example_test",
78    size = "small",
79    srcs = ["test/_cancellation_example_test.py"],
80    data = [
81        ":client",
82        ":server",
83    ],
84    python_version = "PY3",
85)
86