xref: /aosp_15_r20/external/bazelbuild-rules_python/python/private/proto/BUILD.bazel (revision 60517a1edbc8ecf509223e9af94a7adec7d736b8)
1# Copyright 2022 The Bazel Authors. All rights reserved.
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_skylib//:bzl_library.bzl", "bzl_library")
16load("@rules_proto//proto:defs.bzl", "proto_lang_toolchain")
17
18package(default_visibility = ["//visibility:private"])
19
20licenses(["notice"])
21
22filegroup(
23    name = "distribution",
24    srcs = glob(["**"]),
25    visibility = ["//python/private:__pkg__"],
26)
27
28bzl_library(
29    name = "py_proto_library_bzl",
30    srcs = ["py_proto_library.bzl"],
31    visibility = ["//python:__pkg__"],
32    deps = [
33        "//python:defs_bzl",
34        "@rules_proto//proto:defs",
35    ],
36)
37
38proto_lang_toolchain(
39    name = "python_toolchain",
40    command_line = "--python_out=%s",
41    progress_message = "Generating Python proto_library %{label}",
42    runtime = "@com_google_protobuf//:protobuf_python",
43    # NOTE: This isn't *actually* public. It's an implicit dependency of py_proto_library,
44    # so must be public so user usages of the rule can reference it.
45    visibility = ["//visibility:public"],
46)
47