1# Copyright 2021 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("//python:versions.bzl", "print_toolchains_checksums") 17load(":stamp.bzl", "stamp_build_setting") 18 19licenses(["notice"]) 20 21filegroup( 22 name = "distribution", 23 srcs = glob(["**"]) + ["//python/private/proto:distribution"], 24 visibility = ["//python:__pkg__"], 25) 26 27filegroup( 28 name = "coverage_deps", 29 srcs = ["coverage_deps.bzl"], 30 visibility = ["//tools/private/update_deps:__pkg__"], 31) 32 33# Filegroup of bzl files that can be used by downstream rules for documentation generation 34filegroup( 35 name = "bzl", 36 srcs = glob(["**/*.bzl"]), 37 visibility = ["//python:__pkg__"], 38) 39 40bzl_library( 41 name = "reexports_bzl", 42 srcs = ["reexports.bzl"], 43 visibility = [ 44 "//docs:__pkg__", 45 "//python:__pkg__", 46 ], 47 deps = [":bazel_tools_bzl"], 48) 49 50bzl_library( 51 name = "util_bzl", 52 srcs = ["util.bzl"], 53 visibility = [ 54 "//docs:__subpackages__", 55 "//python:__subpackages__", 56 ], 57 deps = ["@bazel_skylib//lib:types"], 58) 59 60bzl_library( 61 name = "which_bzl", 62 srcs = ["which.bzl"], 63 visibility = [ 64 "//docs:__subpackages__", 65 "//python:__subpackages__", 66 ], 67) 68 69bzl_library( 70 name = "py_cc_toolchain_bzl", 71 srcs = [ 72 "py_cc_toolchain_macro.bzl", 73 "py_cc_toolchain_rule.bzl", 74 ], 75 visibility = [ 76 "//docs:__subpackages__", 77 "//python/cc:__pkg__", 78 ], 79 deps = [ 80 ":py_cc_toolchain_info_bzl", 81 ":util_bzl", 82 ], 83) 84 85bzl_library( 86 name = "py_cc_toolchain_info_bzl", 87 srcs = ["py_cc_toolchain_info.bzl"], 88 visibility = ["//python/cc:__pkg__"], 89) 90 91# @bazel_tools can't define bzl_library itself, so we just put a wrapper around it. 92bzl_library( 93 name = "bazel_tools_bzl", 94 srcs = [ 95 "@bazel_tools//tools/python:srcs_version.bzl", 96 "@bazel_tools//tools/python:toolchain.bzl", 97 "@bazel_tools//tools/python:utils.bzl", 98 ], 99 visibility = ["//python:__pkg__"], 100) 101 102# Needed to define bzl_library targets for docgen. (We don't define the 103# bzl_library target here because it'd give our users a transitive dependency 104# on Skylib.) 105exports_files( 106 [ 107 "coverage.patch", 108 "py_package.bzl", 109 "py_wheel.bzl", 110 "reexports.bzl", 111 "stamp.bzl", 112 "util.bzl", 113 "py_cc_toolchain_rule.bzl", 114 ], 115 visibility = ["//docs:__pkg__"], 116) 117 118# Used to determine the use of `--stamp` in Starlark rules 119stamp_build_setting(name = "stamp") 120 121print_toolchains_checksums(name = "print_toolchains_checksums") 122