diff options
author | John Cater <jcater@google.com> | 2017-05-16 17:29:52 +0200 |
---|---|---|
committer | Dmitry Lomov <dslomov@google.com> | 2017-05-17 15:20:40 +0200 |
commit | d8bb6dc6b1878f408917d4e8fffafa3a7fccadea (patch) | |
tree | 6419e29a4c58ce301a23186e60ca1780af474c70 /tools/platforms | |
parent | de92f9d8ea093416fae999073bbfcf3cf501ab55 (diff) |
Remove toolchain_rule.
It's unneeded syntactic sugar, we can re-introduce it later if it seems
warranted.
Change-Id: If41e10f96ae0b6ac522a1da36237ff1b3c91757d
PiperOrigin-RevId: 156184854
Diffstat (limited to 'tools/platforms')
-rw-r--r-- | tools/platforms/BUILD | 1 | ||||
-rw-r--r-- | tools/platforms/platforms.BUILD | 2 | ||||
-rw-r--r-- | tools/platforms/toolchains.bzl | 63 |
3 files changed, 0 insertions, 66 deletions
diff --git a/tools/platforms/BUILD b/tools/platforms/BUILD index a54e5e6ea9..4e788aea2c 100644 --- a/tools/platforms/BUILD +++ b/tools/platforms/BUILD @@ -6,7 +6,6 @@ filegroup( name = "package-srcs", srcs = [ "platforms.BUILD", - "toolchains.bzl", ], ) diff --git a/tools/platforms/platforms.BUILD b/tools/platforms/platforms.BUILD index dd12d661f4..4e477e72a8 100644 --- a/tools/platforms/platforms.BUILD +++ b/tools/platforms/platforms.BUILD @@ -4,8 +4,6 @@ package( default_visibility = ["//visibility:public"], ) -export_files = ["toolchains.bzl"] - # These match values in //src/main/java/com/google/build/lib/util:CPU.java constraint_setting(name = "cpu") diff --git a/tools/platforms/toolchains.bzl b/tools/platforms/toolchains.bzl deleted file mode 100644 index b931905eeb..0000000000 --- a/tools/platforms/toolchains.bzl +++ /dev/null @@ -1,63 +0,0 @@ -# Copyright 2017 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. -"""Useful functions and rules for defining toolchains.""" - -_default_toolchain_rule_attrs = { - "exec_compatible_with": attr.label_list( - providers = [platform_common.ConstraintValueInfo]), - "target_compatible_with": attr.label_list( - providers = [platform_common.ConstraintValueInfo]), -} - -def default_toolchain_rule_impl(ctx, override_attrs = {}): - """A default implementation for toolchain_rule. - This implementation creates a toolchain provider and adds all extra - attributes. - - Args: - ctx: The rule context. - override_attrs: Any data in this dict will override the corresponding - attribute from the context. toolchain_rule implementations can use this - to customize the values set in the provider. - - Returns: - The created toolchain provider. - """ - toolchain_data = {} - - # Collect the extra_args from ctx.attrs. - attr_names = ctx.attr._extra_attr_names - for name in attr_names: - if name in override_attrs: - attr = override_attrs[name] - else: - attr = getattr(ctx.attr, name) - toolchain_data[name] = attr - - toolchain = platform_common.toolchain( - exec_compatible_with = ctx.attr.exec_compatible_with, - target_compatible_with = ctx.attr.target_compatible_with, - **toolchain_data) - - return [toolchain] - -def toolchain_rule(implementation = default_toolchain_rule_impl, fragments = [], extra_attrs = {}): - return rule( - implementation = implementation, - attrs = _default_toolchain_rule_attrs + extra_attrs + { - # default_toolchain_rule_impl needs this to know what attributes are extra args. - "_extra_attr_names": attr.string_list(default = extra_attrs.keys()), - }, - fragments = fragments, - ) |