blob: 8dd2242dcfba8759db7b973ea9bb6ac3699e1516 [file] [log] [blame]
Matt Moore9160fc72017-08-11 10:06:19 -07001# 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.
Thulio Ferraz Assis7f301132022-10-05 12:42:44 -070014
Richard Levasseur423c1de2023-10-04 15:26:38 -070015load("@bazel_skylib//:bzl_library.bzl", "bzl_library")
Thulio Ferraz Assis7f301132022-10-05 12:42:44 -070016load(":version.bzl", "BAZEL_VERSION")
Thulio Ferraz Assisa5a7ffb2021-11-16 21:09:59 -060017
Matt Moore9160fc72017-08-11 10:06:19 -070018package(default_visibility = ["//visibility:public"])
19
Richard Levasseurb9865472023-02-22 19:21:18 -080020licenses(["notice"])
Matt Moore9160fc72017-08-11 10:06:19 -070021
Marcel Hlopko230f6d12019-10-23 23:28:11 +020022exports_files([
23 "LICENSE",
24 "version.bzl",
25])
aiutoe953b0a2019-10-04 16:29:41 -040026
27filegroup(
28 name = "distribution",
29 srcs = [
Greg Roodt50ba3ed2022-12-27 05:44:48 +110030 "BUILD.bazel",
Alex Eagle35391d92022-07-11 22:14:44 -060031 "MODULE.bazel",
Alex Eagle0597cdf2022-01-02 12:03:27 -080032 "WORKSPACE",
aiutoe953b0a2019-10-04 16:29:41 -040033 "internal_deps.bzl",
34 "internal_setup.bzl",
Ignas Anikevicius64d9d6f2023-02-16 13:11:23 +090035 "version.bzl",
aiutoe953b0a2019-10-04 16:29:41 -040036 "//python:distribution",
UebelAndrebc256ef2021-04-07 06:45:21 -070037 "//python/pip_install:distribution",
aiutoe953b0a2019-10-04 16:29:41 -040038 "//tools:distribution",
Ignas Anikeviciusfd5f5312023-01-26 04:20:12 +090039 "@rules_python_gazelle_plugin//:distribution",
aiutoe953b0a2019-10-04 16:29:41 -040040 ],
UebelAndre66b06b12022-02-08 10:11:45 -080041 visibility = [
42 "//examples:__pkg__",
43 "//tests:__pkg__",
Ignas Anikeviciusbaad5fb2023-10-18 11:32:10 +090044 "//tests/toolchains:__pkg__",
UebelAndre66b06b12022-02-08 10:11:45 -080045 ],
aiutoe953b0a2019-10-04 16:29:41 -040046)
Matt Mackayc7e573e2021-03-29 12:16:35 -040047
Richard Levasseur423c1de2023-10-04 15:26:38 -070048bzl_library(
49 name = "version_bzl",
50 srcs = ["version.bzl"],
51 visibility = ["//:__subpackages__"],
52)
53
Matt Mackayc7e573e2021-03-29 12:16:35 -040054# Reexport of all bzl files used to allow downstream rules to generate docs
55# without shipping with a dependency on Skylib
56filegroup(
57 name = "bzl",
58 srcs = [
59 "//python/pip_install:bzl",
60 "//python:bzl",
61 # Requires Bazel 0.29 onward for public visibility of these .bzl files.
Matt Mackayc7e573e2021-03-29 12:16:35 -040062 "@bazel_tools//tools/python:python_version.bzl",
63 "@bazel_tools//tools/python:srcs_version.bzl",
64 "@bazel_tools//tools/python:toolchain.bzl",
65 "@bazel_tools//tools/python:utils.bzl",
66 ],
67 visibility = ["//visibility:public"],
68)
Thulio Ferraz Assisa5a7ffb2021-11-16 21:09:59 -060069
Thulio Ferraz Assis7f301132022-10-05 12:42:44 -070070genrule(
71 name = "assert_bazelversion",
72 srcs = [".bazelversion"],
73 outs = ["assert_bazelversion_test.sh"],
74 cmd = """\
75set -o errexit -o nounset -o pipefail
76current=$$(cat "$(execpath .bazelversion)")
77cat > "$@" <<EOF
78#!/usr/bin/env bash
79set -o errexit -o nounset -o pipefail
80if [[ \"$${{current}}\" != \"{expected}\" ]]; then
81 >&2 echo "ERROR: current bazel version '$${{current}}' is not the expected '{expected}'"
82 exit 1
83fi
84EOF
85""".format(
86 expected = BAZEL_VERSION,
87 ),
88 executable = True,
89)
90
91sh_test(
92 name = "assert_bazelversion_test",
93 srcs = [":assert_bazelversion_test.sh"],
94)