1# Copyright 2020 The gRPC authors. 2# 3# Licensed under the Apache License, Version 2.0 (the "License"); 4# you may not use this file except in compliance with the License. 5# You may obtain a copy of the License at 6# 7# http://www.apache.org/licenses/LICENSE-2.0 8# 9# Unless required by applicable law or agreed to in writing, software 10# distributed under the License is distributed on an "AS IS" BASIS, 11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12# See the License for the specific language governing permissions and 13# limitations under the License. 14 15load("//bazel:cython_library.bzl", "pyx_library") 16load("grpcio_tools.bzl", "internal_copied_filegroup") 17 18package(default_visibility = [ 19 "//examples/python:__subpackages__", 20 "//src/python:__subpackages__", 21 "//tools/distrib/python/grpcio_tools:__subpackages__", 22]) 23 24cc_library( 25 name = "protoc_lib", 26 srcs = ["grpc_tools/main.cc"], 27 hdrs = ["grpc_tools/main.h"], 28 includes = ["."], 29 deps = [ 30 "//src/compiler:grpc_plugin_support", 31 "@com_google_absl//absl/strings", 32 "@com_google_protobuf//:protoc_lib", 33 ], 34) 35 36pyx_library( 37 name = "cyprotoc", 38 srcs = ["grpc_tools/_protoc_compiler.pyx"], 39 deps = [":protoc_lib"], 40) 41 42internal_copied_filegroup( 43 name = "well_known_protos", 44 srcs = ["@com_google_protobuf//:well_known_type_protos"], 45 dest = "grpc_tools/_proto/", 46 strip_prefix = "src/", 47) 48 49py_library( 50 name = "grpc_tools", 51 srcs = [ 52 "grpc_tools/__init__.py", 53 "grpc_tools/grpc_version.py", 54 "grpc_tools/protoc.py", 55 ], 56 data = [":well_known_protos"], 57 imports = ["."], 58 srcs_version = "PY2AND3", 59 deps = [ 60 ":cyprotoc", 61 "//src/python/grpcio/grpc:grpcio", 62 "@com_google_protobuf//:protobuf_python", 63 ], 64) 65