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