Imported Upstream version 1.41.0
[platform/upstream/grpc.git] / tools / distrib / python / grpcio_tools / BUILD.bazel
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
15 package(default_visibility = [
16     "//examples/python:__subpackages__",
17     "//src/python:__subpackages__",
18     "//tools/distrib/python/grpcio_tools:__subpackages__",
19 ])
20
21 load("//bazel:cython_library.bzl", "pyx_library")
22 load("grpcio_tools.bzl", "internal_copied_filegroup")
23
24 cc_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_protobuf//:protoc_lib",
32     ],
33 )
34
35 pyx_library(
36     name = "cyprotoc",
37     srcs = ["grpc_tools/_protoc_compiler.pyx"],
38     deps = [":protoc_lib"],
39 )
40
41 internal_copied_filegroup(
42     name = "well_known_protos",
43     srcs = ["@com_google_protobuf//:well_known_protos"],
44     dest = "grpc_tools/_proto/",
45     strip_prefix = "src/",
46 )
47
48 py_library(
49     name = "grpc_tools",
50     srcs = [
51         "grpc_tools/__init__.py",
52         "grpc_tools/protoc.py",
53     ],
54     data = [":well_known_protos"],
55     imports = ["."],
56     srcs_version = "PY2AND3",
57     deps = [
58         ":cyprotoc",
59         "//src/python/grpcio/grpc:grpcio",
60         "@com_google_protobuf//:protobuf_python",
61     ],
62 )