Remove tools/config/common_settings.bzl. It is unused by Bazel. RELNOTES: @bazel_tools//config:common_settings.bzl has been removed. Use @bazel_skylib//rules:common_settings.bzl instead. PiperOrigin-RevId: 516377712 Change-Id: I6753edbe12f88f43d582d814679202adb6e1c72f
diff --git a/tools/BUILD b/tools/BUILD index 15255ba..4102c0a 100644 --- a/tools/BUILD +++ b/tools/BUILD
@@ -10,7 +10,6 @@ "//tools/build_defs:srcs", "//tools/build_rules:srcs", "//tools/compliance:srcs", - "//tools/config:srcs", "//tools/coverage:srcs", "//tools/ctexplain:srcs", "//tools/distributions:srcs", @@ -47,7 +46,6 @@ "//tools/build_defs:embedded_tools", "//tools/build_rules:embedded_tools_srcs", "//tools/buildstamp:srcs", - "//tools/config:srcs", "//tools/coverage:srcs", "//tools/cpp:embedded_tools", "//tools/genrule:srcs", @@ -80,7 +78,6 @@ "//tools/android:bzl_srcs", "//tools/build_defs:bzl_srcs", "//tools/build_rules:bzl_srcs", - "//tools/config:common_settings.bzl", "//tools/cpp:bzl_srcs", "//tools/jdk:bzl_srcs", "//tools/osx:bzl_srcs",
diff --git a/tools/config/BUILD b/tools/config/BUILD deleted file mode 100644 index b87c7f2..0000000 --- a/tools/config/BUILD +++ /dev/null
@@ -1,23 +0,0 @@ -# Common config settings and flags. -# -# These definitions are only for local use within Bazel built-in tools. -# In all other cases, use types from github.com/bazelbuild/bazel-skylib. - -licenses(["notice"]) # Apache 2.0 - -filegroup( - name = "srcs", - srcs = glob(["**"]), - visibility = [ - "//tools:__subpackages__", - "@bazel_tools//tools:__subpackages__", - ], -) - -exports_files( - ["common_settings.bzl"], - visibility = [ - "//tools:__subpackages__", - "@bazel_tools//tools:__subpackages__", - ], -)
diff --git a/tools/config/README.md b/tools/config/README.md deleted file mode 100644 index 3d74a09..0000000 --- a/tools/config/README.md +++ /dev/null
@@ -1,44 +0,0 @@ -# Common scalar build settings. - -## Overview - -These definitions are only for use in Bazel built-in tools. In all -other cases, use flag type definitions from -github.com/bazelbuild/bazel-skylib/rules/common_settings.bzl. - -<a name="basic-example"></a> -## Basic Example - -### //tools/my_pkg/BUILD - -```python -load("//tools/config:common_settings.bzl", "bool_flag") - -bool_flag( - name = "experimental_new_behavior", - build_setting_default = False, -) -``` - -### //tools/my_pkg/myrule.bzl - -```python -load("//tools/flags:flags.bzl", "BuildSettingInfo") - - -def _myrule_impl(ctx): - if ctx.attr._experimental_new_behavior[BuildSettingInfo].value: - ... - ... - - -myrule = rule( - implementation = _myrule_impl. - attrs = { - ... - - "_experimental_new_behavior": attr.label( - default = "//tools/my_pkg:experimental_new_behavior"), - }, -) -```
diff --git a/tools/config/common_settings.bzl b/tools/config/common_settings.bzl deleted file mode 100644 index 0bb7dd4..0000000 --- a/tools/config/common_settings.bzl +++ /dev/null
@@ -1,104 +0,0 @@ -# Copyright 2019 The Bazel Authors. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -"""Common build setting rules for use in Bazel tools - -Warning: The content of this file is copied from -https://github.com/bazelbuild/bazel-skylib/rules/common_settings.bzl -We maintain this private copy only to prevent taking a dependency on skylib. -Please do not innovate make modifications here. - -These rules return a BuildSettingInfo with the value of the build setting. -For label-typed settings, use the native label_flag and label_setting rules. - -More documentation on how to use build settings at -https://bazel.build/rules/config#user-defined-build-settings -""" - -BuildSettingInfo = provider( - doc = "A singleton provider that contains the raw value of a build setting", - fields = { - "value": "The value of the build setting in the current configuration. " + - "This value may come from the command line or an upstream transition, " + - "or else it will be the build setting's default.", - }, -) - -def _impl(ctx): - return BuildSettingInfo(value = ctx.build_setting_value) - -int_flag = rule( - implementation = _impl, - build_setting = config.int(flag = True), - doc = "An int-typed build setting that can be set on the command line", -) - -int_setting = rule( - implementation = _impl, - build_setting = config.int(), - doc = "An int-typed build setting that cannot be set on the command line", -) - -bool_flag = rule( - implementation = _impl, - build_setting = config.bool(flag = True), - doc = "A bool-typed build setting that can be set on the command line", -) - -bool_setting = rule( - implementation = _impl, - build_setting = config.bool(), - doc = "A bool-typed build setting that cannot be set on the command line", -) - -string_list_flag = rule( - implementation = _impl, - build_setting = config.string_list(flag = True), - doc = "A string list-typed build setting that can be set on the command line", -) - -string_list_setting = rule( - implementation = _impl, - build_setting = config.string_list(), - doc = "A string list-typed build setting that cannot be set on the command line", -) - -def _string_impl(ctx): - allowed_values = ctx.attr.values - value = ctx.build_setting_value - if len(allowed_values) == 0 or value in ctx.attr.values: - return BuildSettingInfo(value = value) - else: - fail("Error setting " + str(ctx.label) + ": invalid value '" + value + "'. Allowed values are " + str(allowed_values)) - -string_flag = rule( - implementation = _string_impl, - build_setting = config.string(flag = True), - attrs = { - "values": attr.string_list( - doc = "The list of allowed values for this setting. An error is raised if any other value is given.", - ), - }, - doc = "A string-typed build setting that can be set on the command line", -) - -string_setting = rule( - implementation = _string_impl, - build_setting = config.string(), - attrs = { - "values": attr.string_list( - doc = "The list of allowed values for this setting. An error is raised if any other value is given.", - ), - }, - doc = "A string-typed build setting that cannot be set on the command line", -)