Matt Moore | 9160fc7 | 2017-08-11 10:06:19 -0700 | [diff] [blame] | 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. |
Thulio Ferraz Assis | 7f30113 | 2022-10-05 12:42:44 -0700 | [diff] [blame] | 14 | |
Richard Levasseur | 423c1de | 2023-10-04 15:26:38 -0700 | [diff] [blame] | 15 | load("@bazel_skylib//:bzl_library.bzl", "bzl_library") |
Thulio Ferraz Assis | 7f30113 | 2022-10-05 12:42:44 -0700 | [diff] [blame] | 16 | load(":version.bzl", "BAZEL_VERSION") |
Thulio Ferraz Assis | a5a7ffb | 2021-11-16 21:09:59 -0600 | [diff] [blame] | 17 | |
Matt Moore | 9160fc7 | 2017-08-11 10:06:19 -0700 | [diff] [blame] | 18 | package(default_visibility = ["//visibility:public"]) |
| 19 | |
Richard Levasseur | b986547 | 2023-02-22 19:21:18 -0800 | [diff] [blame] | 20 | licenses(["notice"]) |
Matt Moore | 9160fc7 | 2017-08-11 10:06:19 -0700 | [diff] [blame] | 21 | |
Marcel Hlopko | 230f6d1 | 2019-10-23 23:28:11 +0200 | [diff] [blame] | 22 | exports_files([ |
| 23 | "LICENSE", |
| 24 | "version.bzl", |
| 25 | ]) |
aiuto | e953b0a | 2019-10-04 16:29:41 -0400 | [diff] [blame] | 26 | |
| 27 | filegroup( |
| 28 | name = "distribution", |
| 29 | srcs = [ |
Greg Roodt | 50ba3ed | 2022-12-27 05:44:48 +1100 | [diff] [blame] | 30 | "BUILD.bazel", |
Alex Eagle | 35391d9 | 2022-07-11 22:14:44 -0600 | [diff] [blame] | 31 | "MODULE.bazel", |
Alex Eagle | 0597cdf | 2022-01-02 12:03:27 -0800 | [diff] [blame] | 32 | "WORKSPACE", |
aiuto | e953b0a | 2019-10-04 16:29:41 -0400 | [diff] [blame] | 33 | "internal_deps.bzl", |
| 34 | "internal_setup.bzl", |
Ignas Anikevicius | 64d9d6f | 2023-02-16 13:11:23 +0900 | [diff] [blame] | 35 | "version.bzl", |
aiuto | e953b0a | 2019-10-04 16:29:41 -0400 | [diff] [blame] | 36 | "//python:distribution", |
UebelAndre | bc256ef | 2021-04-07 06:45:21 -0700 | [diff] [blame] | 37 | "//python/pip_install:distribution", |
aiuto | e953b0a | 2019-10-04 16:29:41 -0400 | [diff] [blame] | 38 | "//tools:distribution", |
Ignas Anikevicius | fd5f531 | 2023-01-26 04:20:12 +0900 | [diff] [blame] | 39 | "@rules_python_gazelle_plugin//:distribution", |
aiuto | e953b0a | 2019-10-04 16:29:41 -0400 | [diff] [blame] | 40 | ], |
UebelAndre | 66b06b1 | 2022-02-08 10:11:45 -0800 | [diff] [blame] | 41 | visibility = [ |
| 42 | "//examples:__pkg__", |
| 43 | "//tests:__pkg__", |
Ignas Anikevicius | baad5fb | 2023-10-18 11:32:10 +0900 | [diff] [blame] | 44 | "//tests/toolchains:__pkg__", |
UebelAndre | 66b06b1 | 2022-02-08 10:11:45 -0800 | [diff] [blame] | 45 | ], |
aiuto | e953b0a | 2019-10-04 16:29:41 -0400 | [diff] [blame] | 46 | ) |
Matt Mackay | c7e573e | 2021-03-29 12:16:35 -0400 | [diff] [blame] | 47 | |
Richard Levasseur | 423c1de | 2023-10-04 15:26:38 -0700 | [diff] [blame] | 48 | bzl_library( |
| 49 | name = "version_bzl", |
| 50 | srcs = ["version.bzl"], |
| 51 | visibility = ["//:__subpackages__"], |
| 52 | ) |
| 53 | |
Matt Mackay | c7e573e | 2021-03-29 12:16:35 -0400 | [diff] [blame] | 54 | # Reexport of all bzl files used to allow downstream rules to generate docs |
| 55 | # without shipping with a dependency on Skylib |
| 56 | filegroup( |
| 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 Mackay | c7e573e | 2021-03-29 12:16:35 -0400 | [diff] [blame] | 62 | "@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 Assis | a5a7ffb | 2021-11-16 21:09:59 -0600 | [diff] [blame] | 69 | |
Thulio Ferraz Assis | 7f30113 | 2022-10-05 12:42:44 -0700 | [diff] [blame] | 70 | genrule( |
| 71 | name = "assert_bazelversion", |
| 72 | srcs = [".bazelversion"], |
| 73 | outs = ["assert_bazelversion_test.sh"], |
| 74 | cmd = """\ |
| 75 | set -o errexit -o nounset -o pipefail |
| 76 | current=$$(cat "$(execpath .bazelversion)") |
| 77 | cat > "$@" <<EOF |
| 78 | #!/usr/bin/env bash |
| 79 | set -o errexit -o nounset -o pipefail |
| 80 | if [[ \"$${{current}}\" != \"{expected}\" ]]; then |
| 81 | >&2 echo "ERROR: current bazel version '$${{current}}' is not the expected '{expected}'" |
| 82 | exit 1 |
| 83 | fi |
| 84 | EOF |
| 85 | """.format( |
| 86 | expected = BAZEL_VERSION, |
| 87 | ), |
| 88 | executable = True, |
| 89 | ) |
| 90 | |
| 91 | sh_test( |
| 92 | name = "assert_bazelversion_test", |
| 93 | srcs = [":assert_bazelversion_test.sh"], |
| 94 | ) |