diff options
author | philwo <philwo@google.com> | 2017-09-15 11:10:32 +0200 |
---|---|---|
committer | Philipp Wollermann <philwo@google.com> | 2017-09-15 11:29:37 +0200 |
commit | bf96c50e0c9afd3da8d937948c3636f09a0e80d7 (patch) | |
tree | 56cfb9431cb1321ef87b256caee9690568ef0ea1 | |
parent | b0b904839b71f2c147a2d04f4e014b687690dd10 (diff) |
Automated rollback of commit ca216f5eb4b1f1892219db0f578495bbbdbaa875.
*** Reason for rollback ***
Breaks Bazel building itself on FreeBSD, also #3739.
*** Original change description ***
Introduce empty "toolchain_category" rule for labels that will be used as
categories of toolchains for the purpose of toolchain selection.
Up to now, we've used the native toolchain_type rule for this purpose. That rule depends on a number of configuration fragments that supply build variables - we don't want toolchains to need to depend on those fragments as well. E.g. toolchain_type depends on JvmConfiguration, but we would like toolchains to work with --experimental_disable_jvm.
PiperOrigin-RevId: 168810566
-rw-r--r-- | src/create_embedded_tools.py | 2 | ||||
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/rules/cpp/CppHelper.java | 2 | ||||
-rw-r--r-- | src/test/java/com/google/devtools/build/lib/packages/util/BazelMockCcSupport.java | 14 | ||||
-rw-r--r-- | tools/BUILD | 2 | ||||
-rw-r--r-- | tools/build_defs/toolchains/BUILD | 14 | ||||
-rw-r--r-- | tools/build_defs/toolchains/toolchain_category.bzl | 25 | ||||
-rw-r--r-- | tools/cpp/BUILD | 7 | ||||
-rw-r--r-- | tools/cpp/BUILD.static | 6 | ||||
-rw-r--r-- | tools/cpp/BUILD.tpl | 6 |
9 files changed, 10 insertions, 68 deletions
diff --git a/src/create_embedded_tools.py b/src/create_embedded_tools.py index 8b013cee44..699edd09f5 100644 --- a/src/create_embedded_tools.py +++ b/src/create_embedded_tools.py @@ -31,8 +31,6 @@ output_paths = [ ('*tools/jdk/BUILD*', lambda x: 'tools/jdk/BUILD'), ('*tools/platforms/platforms.BUILD', lambda x: 'platforms/BUILD'), ('*tools/platforms/*', lambda x: 'platforms/' + os.path.basename(x)), - ('*tools/build_defs/toolchains/*', - lambda x: 'tools/build_defs/toolchains/' + os.path.basename(x)), ('*JavaBuilder*_deploy.jar', lambda x: 'tools/jdk/' + os.path.basename(x)), ('*JacocoCoverage*_deploy.jar', lambda x: 'tools/jdk/JacocoCoverage_deploy.jar'), diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppHelper.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppHelper.java index da85efa79e..981adddf95 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppHelper.java +++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppHelper.java @@ -89,7 +89,7 @@ public class CppHelper { /** Returns label used to select resolved cc_toolchain instances based on platform. */ public static Label getCcToolchainType(String toolsRepository) { - return Label.parseAbsoluteUnchecked(toolsRepository + "//tools/cpp:toolchain_category"); + return Label.parseAbsoluteUnchecked(toolsRepository + "//tools/cpp:toolchain_type"); } private CppHelper() { diff --git a/src/test/java/com/google/devtools/build/lib/packages/util/BazelMockCcSupport.java b/src/test/java/com/google/devtools/build/lib/packages/util/BazelMockCcSupport.java index 2cf84b62d6..b938e5fe93 100644 --- a/src/test/java/com/google/devtools/build/lib/packages/util/BazelMockCcSupport.java +++ b/src/test/java/com/google/devtools/build/lib/packages/util/BazelMockCcSupport.java @@ -78,7 +78,6 @@ public final class BazelMockCcSupport extends MockCcSupport { "/bazel_tools_workspace/tools/cpp/BUILD", "package(default_visibility=['//visibility:public'])", "cc_library(name = 'stl')", - "toolchain_type(name = 'toolchain_type')", "cc_library(name = 'malloc')", "cc_toolchain_suite(", " name = 'toolchain',", @@ -146,17 +145,16 @@ public final class BazelMockCcSupport extends MockCcSupport { " name = 'link_dynamic_library',", " srcs = ['link_dynamic_library.sh'],", ")", - "load('//tools/build_defs/toolchains:toolchain_category.bzl', 'toolchain_category')", - "toolchain_category(name = 'toolchain_category')", + "toolchain_type(name = 'toolchain_type')", "toolchain(", " name = 'toolchain_cc-compiler-piii',", - " toolchain_type = ':toolchain_category',", + " toolchain_type = ':toolchain_type',", " toolchain = '//third_party/crosstool/mock:cc-compiler-piii',", " target_compatible_with = [':mock_value'],", ")", "toolchain(", " name = 'dummy_cc_toolchain',", - " toolchain_type = ':toolchain_category',", + " toolchain_type = ':toolchain_type',", " toolchain = ':dummy_cc_toolchain_impl',", ")", "load(':dummy_toolchain.bzl', 'dummy_toolchain')", @@ -167,12 +165,6 @@ public final class BazelMockCcSupport extends MockCcSupport { " toolchain = platform_common.ToolchainInfo()", " return [toolchain]", "dummy_toolchain = rule(_dummy_toolchain_impl, attrs = {})"); - config.create("/bazel_tools_workspace/tools/build_defs/toolchains/BUILD"); - config.create( - "/bazel_tools_workspace/tools/build_defs/toolchains/toolchain_category.bzl", - "def _toolchain_category_impl(ctx):", - " ctx = ctx", - "toolchain_category = rule(_toolchain_category_impl, attrs = {})"); config.create( "/bazel_tools_workspace/tools/cpp/CROSSTOOL", readCrosstoolFile()); diff --git a/tools/BUILD b/tools/BUILD index 65e1a659a1..3270fcba77 100644 --- a/tools/BUILD +++ b/tools/BUILD @@ -15,7 +15,6 @@ filegroup( "//tools/build_defs/hash:srcs", "//tools/build_defs/pkg:srcs", "//tools/build_defs/repo:srcs", - "//tools/build_defs/toolchains:srcs", "//tools/build_rules:srcs", "//tools/coverage:srcs", "//tools/jdk:srcs", @@ -42,7 +41,6 @@ filegroup( "//tools/build_defs/hash:srcs", "//tools/build_defs/pkg:srcs", "//tools/build_defs/repo:srcs", - "//tools/build_defs/toolchains:srcs", "//tools/build_rules:embedded_tools_srcs", "//tools/buildstamp:srcs", "//tools/coverage:srcs", diff --git a/tools/build_defs/toolchains/BUILD b/tools/build_defs/toolchains/BUILD deleted file mode 100644 index 92d6ec8a7f..0000000000 --- a/tools/build_defs/toolchains/BUILD +++ /dev/null @@ -1,14 +0,0 @@ -# Rules for defining toolchains. - -licenses(["notice"]) # Apache 2.0 - -package(default_visibility = ["//visibility:public"]) - -exports_files( - glob(["**"]), -) - -filegroup( - name = "srcs", - srcs = glob(["**"]), -) diff --git a/tools/build_defs/toolchains/toolchain_category.bzl b/tools/build_defs/toolchains/toolchain_category.bzl deleted file mode 100644 index 4520128921..0000000000 --- a/tools/build_defs/toolchains/toolchain_category.bzl +++ /dev/null @@ -1,25 +0,0 @@ -# pylint: disable=g-bad-file-header -# 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. -"""Skylark rule to be used for toolchain "types". - -Blaze will allow a toolchain category to be any label, but we use an -empty rule in particular in order to add behavior if the need arises. -""" -def _toolchain_category_impl(ctx): - ctx = ctx # unused argument - -toolchain_category = rule(_toolchain_category_impl, attrs = {}) - - diff --git a/tools/cpp/BUILD b/tools/cpp/BUILD index d8ed66b46e..eb75333e75 100644 --- a/tools/cpp/BUILD +++ b/tools/cpp/BUILD @@ -205,10 +205,7 @@ filegroup( srcs = ["link_dynamic_library.sh"], ) -# The c++ toolchain type -load("//tools/build_defs/toolchains:toolchain_category.bzl", "toolchain_category") - -toolchain_category(name = "toolchain_category") +toolchain_type(name = "toolchain_type") # A dummy toolchain is necessary to satisfy toolchain resolution until platforms # are used in c++ by default. @@ -216,7 +213,7 @@ toolchain_category(name = "toolchain_category") toolchain( name = "dummy_cc_toolchain", toolchain = "dummy_cc_toolchain_impl", - toolchain_type = ":toolchain_category", + toolchain_type = ":toolchain_type", ) load(":dummy_toolchain.bzl", "dummy_toolchain") diff --git a/tools/cpp/BUILD.static b/tools/cpp/BUILD.static index d948039c9f..aaadc5bad8 100644 --- a/tools/cpp/BUILD.static +++ b/tools/cpp/BUILD.static @@ -116,9 +116,7 @@ filegroup( srcs = ["link_dynamic_library.sh"], ) -# The c++ toolchain type -load("//tools/build_defs/toolchains:toolchain_category.bzl", "toolchain_category") -toolchain_category(name = "toolchain_category") +toolchain_type(name = "toolchain_type") # A dummy toolchain is necessary to satisfy toolchain resolution until platforms # are used in c++ by default. @@ -126,7 +124,7 @@ toolchain_category(name = "toolchain_category") toolchain( name = "dummy_cc_toolchain", toolchain = "dummy_cc_toolchain_impl", - toolchain_type = ":toolchain_category", + toolchain_type = ":toolchain_type", ) load(":dummy_toolchain.bzl", "dummy_toolchain") diff --git a/tools/cpp/BUILD.tpl b/tools/cpp/BUILD.tpl index d1e81b2f84..170fe3f91d 100644 --- a/tools/cpp/BUILD.tpl +++ b/tools/cpp/BUILD.tpl @@ -76,9 +76,7 @@ cc_toolchain( supports_param_files = 1, ) -# The c++ toolchain type -load("//tools/build_rules:toolchain_category.bzl", "toolchain_category") -toolchain_category(name = "toolchain_category") +toolchain_type(name = "toolchain_type") # A dummy toolchain is necessary to satisfy toolchain resolution until platforms # are used in c++ by default. @@ -86,7 +84,7 @@ toolchain_category(name = "toolchain_category") toolchain( name = "dummy_cc_toolchain", toolchain = "dummy_cc_toolchain_impl", - toolchain_type = ":toolchain_category", + toolchain_type = ":toolchain_type", ) load(":dummy_toolchain.bzl", "dummy_toolchain") |