rosica | 3fd5129 | 2019-08-12 10:24:34 -0700 | [diff] [blame] | 1 | # Copyright 2019 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. |
| 14 | |
| 15 | """A fake C++ toolchain configuration rule""" |
| 16 | |
| 17 | def _impl(ctx): |
| 18 | out = ctx.actions.declare_file(ctx.label.name) |
| 19 | ctx.actions.write(out, "Fake executable") |
| 20 | return [ |
| 21 | cc_common.create_cc_toolchain_config_info( |
| 22 | ctx = ctx, |
| 23 | toolchain_identifier = "local_linux", |
| 24 | host_system_name = "local", |
| 25 | target_system_name = "local", |
| 26 | target_cpu = "local", |
| 27 | target_libc = "local", |
| 28 | compiler = "compiler", |
| 29 | abi_version = "local", |
| 30 | abi_libc_version = "local", |
| 31 | ), |
| 32 | DefaultInfo( |
| 33 | executable = out, |
| 34 | ), |
| 35 | ] |
| 36 | |
| 37 | cc_toolchain_config = rule( |
| 38 | implementation = _impl, |
| 39 | attrs = {}, |
| 40 | provides = [CcToolchainConfigInfo], |
| 41 | executable = True, |
| 42 | ) |