diff options
Diffstat (limited to 'tools/cpp')
-rw-r--r-- | tools/cpp/BUILD | 15 | ||||
-rw-r--r-- | tools/cpp/BUILD.static | 15 | ||||
-rw-r--r-- | tools/cpp/BUILD.tpl | 15 | ||||
-rw-r--r-- | tools/cpp/cc_configure.bzl | 2 | ||||
-rw-r--r-- | tools/cpp/dummy_toolchain.bzl | 23 |
5 files changed, 70 insertions, 0 deletions
diff --git a/tools/cpp/BUILD b/tools/cpp/BUILD index 1a4dc674ea..eb75333e75 100644 --- a/tools/cpp/BUILD +++ b/tools/cpp/BUILD @@ -204,3 +204,18 @@ filegroup( name = "link_dynamic_library", srcs = ["link_dynamic_library.sh"], ) + +toolchain_type(name = "toolchain_type") + +# A dummy toolchain is necessary to satisfy toolchain resolution until platforms +# are used in c++ by default. +# TODO(b/64754003): Remove once platforms are used in c++ by default. +toolchain( + name = "dummy_cc_toolchain", + toolchain = "dummy_cc_toolchain_impl", + toolchain_type = ":toolchain_type", +) + +load(":dummy_toolchain.bzl", "dummy_toolchain") + +dummy_toolchain(name = "dummy_cc_toolchain_impl") diff --git a/tools/cpp/BUILD.static b/tools/cpp/BUILD.static index 9ae4950d80..aaadc5bad8 100644 --- a/tools/cpp/BUILD.static +++ b/tools/cpp/BUILD.static @@ -115,3 +115,18 @@ filegroup( name = "link_dynamic_library", srcs = ["link_dynamic_library.sh"], ) + +toolchain_type(name = "toolchain_type") + +# A dummy toolchain is necessary to satisfy toolchain resolution until platforms +# are used in c++ by default. +# TODO(b/64754003): Remove once platforms are used in c++ by default. +toolchain( + name = "dummy_cc_toolchain", + toolchain = "dummy_cc_toolchain_impl", + toolchain_type = ":toolchain_type", +) + +load(":dummy_toolchain.bzl", "dummy_toolchain") + +dummy_toolchain(name = "dummy_cc_toolchain_impl") diff --git a/tools/cpp/BUILD.tpl b/tools/cpp/BUILD.tpl index 5ea5368c62..170fe3f91d 100644 --- a/tools/cpp/BUILD.tpl +++ b/tools/cpp/BUILD.tpl @@ -75,3 +75,18 @@ cc_toolchain( strip_files = ":empty", supports_param_files = 1, ) + +toolchain_type(name = "toolchain_type") + +# A dummy toolchain is necessary to satisfy toolchain resolution until platforms +# are used in c++ by default. +# TODO(b/64754003): Remove once platforms are used in c++ by default. +toolchain( + name = "dummy_cc_toolchain", + toolchain = "dummy_cc_toolchain_impl", + toolchain_type = ":toolchain_type", +) + +load(":dummy_toolchain.bzl", "dummy_toolchain") + +dummy_toolchain(name = "dummy_cc_toolchain_impl") diff --git a/tools/cpp/cc_configure.bzl b/tools/cpp/cc_configure.bzl index 70e2fd0ff1..9d6d29fc82 100644 --- a/tools/cpp/cc_configure.bzl +++ b/tools/cpp/cc_configure.bzl @@ -20,6 +20,8 @@ load("@bazel_tools//tools/cpp:unix_cc_configure.bzl", "configure_unix_toolchain" load("@bazel_tools//tools/cpp:lib_cc_configure.bzl", "get_cpu_value") def _impl(repository_ctx): + repository_ctx.symlink( + Label("@bazel_tools//tools/cpp:dummy_toolchain.bzl"), "dummy_toolchain.bzl") cpu_value = get_cpu_value(repository_ctx) if cpu_value == "freebsd": # This is defaulting to the static crosstool, we should eventually diff --git a/tools/cpp/dummy_toolchain.bzl b/tools/cpp/dummy_toolchain.bzl new file mode 100644 index 0000000000..c787f7315d --- /dev/null +++ b/tools/cpp/dummy_toolchain.bzl @@ -0,0 +1,23 @@ +# 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 that stubs a toolchain.""" +def _dummy_toolchain_impl(ctx): + ctx = ctx # unused argument + toolchain = platform_common.ToolchainInfo() + return [toolchain] + +dummy_toolchain = rule(_dummy_toolchain_impl, attrs = {}) + |