1# Copyright 2017 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(":version.bzl", "BAZEL_VERSION") 16 17package(default_visibility = ["//visibility:public"]) 18 19licenses(["notice"]) 20 21exports_files([ 22 "LICENSE", 23 "version.bzl", 24]) 25 26filegroup( 27 name = "distribution", 28 srcs = [ 29 "BUILD.bazel", 30 "MODULE.bazel", 31 "WORKSPACE", 32 "internal_deps.bzl", 33 "internal_setup.bzl", 34 "version.bzl", 35 "//python:distribution", 36 "//python/pip_install:distribution", 37 "//tools:distribution", 38 "@rules_python_gazelle_plugin//:distribution", 39 ], 40 visibility = [ 41 "//examples:__pkg__", 42 "//python/tests/toolchains:__pkg__", 43 "//tests:__pkg__", 44 ], 45) 46 47# Reexport of all bzl files used to allow downstream rules to generate docs 48# without shipping with a dependency on Skylib 49filegroup( 50 name = "bzl", 51 srcs = [ 52 "//python/pip_install:bzl", 53 "//python:bzl", 54 # Requires Bazel 0.29 onward for public visibility of these .bzl files. 55 "@bazel_tools//tools/python:python_version.bzl", 56 "@bazel_tools//tools/python:srcs_version.bzl", 57 "@bazel_tools//tools/python:toolchain.bzl", 58 "@bazel_tools//tools/python:utils.bzl", 59 ], 60 visibility = ["//visibility:public"], 61) 62 63genrule( 64 name = "assert_bazelversion", 65 srcs = [".bazelversion"], 66 outs = ["assert_bazelversion_test.sh"], 67 cmd = """\ 68set -o errexit -o nounset -o pipefail 69current=$$(cat "$(execpath .bazelversion)") 70cat > "$@" <<EOF 71#!/usr/bin/env bash 72set -o errexit -o nounset -o pipefail 73if [[ \"$${{current}}\" != \"{expected}\" ]]; then 74 >&2 echo "ERROR: current bazel version '$${{current}}' is not the expected '{expected}'" 75 exit 1 76fi 77EOF 78""".format( 79 expected = BAZEL_VERSION, 80 ), 81 executable = True, 82) 83 84sh_test( 85 name = "assert_bazelversion_test", 86 srcs = [":assert_bazelversion_test.sh"], 87) 88