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("@rules_python//python:defs.bzl", "py_library") 16load("//bazel:cython_library.bzl", "pyx_library") 17load("grpcio_tools.bzl", "internal_copied_filegroup") 18 19package(default_visibility = [ 20 "//examples/python:__subpackages__", 21 "//src/python:__subpackages__", 22 "//tools/distrib/python/grpcio_tools:__subpackages__", 23]) 24 25cc_library( 26 name = "protoc_lib", 27 srcs = ["grpc_tools/main.cc"], 28 hdrs = ["grpc_tools/main.h"], 29 includes = ["."], 30 deps = [ 31 "//src/compiler:grpc_plugin_support", 32 "@com_google_absl//absl/strings", 33 "@com_google_protobuf//:protoc_lib", 34 ], 35) 36 37pyx_library( 38 name = "cyprotoc", 39 srcs = ["grpc_tools/_protoc_compiler.pyx"], 40 deps = [":protoc_lib"], 41) 42 43internal_copied_filegroup( 44 name = "well_known_protos", 45 srcs = ["@com_google_protobuf//:well_known_type_protos"], 46 dest = "grpc_tools/_proto/", 47 strip_prefix = "src/", 48) 49 50py_library( 51 name = "grpc_tools", 52 srcs = [ 53 "grpc_tools/__init__.py", 54 "grpc_tools/grpc_version.py", 55 "grpc_tools/protoc.py", 56 ], 57 data = [":well_known_protos"], 58 imports = ["."], 59 srcs_version = "PY2AND3", 60 deps = [ 61 ":cyprotoc", 62 "//src/python/grpcio/grpc:grpcio", 63 "@com_google_protobuf//:protobuf_python", 64 ], 65) 66