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_library", "py_test") 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 ], 49) 50 51py_library( 52 name = "search", 53 srcs = ["search.py"], 54 srcs_version = "PY2AND3", 55 deps = [ 56 ":hash_name_py_pb2", 57 ], 58) 59 60py_binary( 61 name = "server", 62 srcs = ["server.py"], 63 python_version = "PY3", 64 srcs_version = "PY2AND3", 65 deps = [ 66 ":hash_name_py_pb2", 67 ":search", 68 "//src/python/grpcio/grpc:grpcio", 69 ], 70) 71 72py_test( 73 name = "test/_cancellation_example_test", 74 size = "small", 75 srcs = ["test/_cancellation_example_test.py"], 76 data = [ 77 ":client", 78 ":server", 79 ], 80 python_version = "PY3", 81) 82