| # Copyright 2024 The Pigweed Authors |
| # |
| # 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 |
| # |
| # https://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. |
| |
| load("@bazel_skylib//rules:native_binary.bzl", "native_binary") |
| load( |
| "//cc_toolchain:defs.bzl", |
| "pw_cc_action_config", |
| "pw_cc_action_files", |
| "pw_cc_action_files_set", |
| "pw_cc_tool", |
| ) |
| load(":test_action_configs.bzl", "test_action_configs") |
| |
| package(default_visibility = ["//cc_toolchain/tests:__subpackages__"]) |
| |
| pw_cc_tool( |
| name = "system_clang", |
| path = "/usr/bin/clang", |
| ) |
| |
| native_binary( |
| name = "clang_wrapper", |
| src = "clang_wrapper.sh", |
| out = "clang_wrapper", |
| data = [":real_clang"], |
| ) |
| |
| pw_cc_tool( |
| name = "clang_wrapper_tool", |
| additional_files = ["data.txt"], |
| tool = ":clang_wrapper", |
| ) |
| |
| pw_cc_action_config( |
| name = "all_c_compile", |
| action_names = ["//actions:all_c_compiler_actions"], |
| implies = ["//cc_toolchain/tests/features:foo"], |
| tools = [":system_clang"], |
| ) |
| |
| pw_cc_action_config( |
| name = "c_compile", |
| action_names = ["//actions:c_compile"], |
| tools = [":system_clang"], |
| ) |
| |
| pw_cc_action_config( |
| name = "cpp_compile_from_tool", |
| action_names = ["//actions:cpp_compile"], |
| tools = [":clang_wrapper_tool"], |
| ) |
| |
| pw_cc_action_config( |
| name = "assemble_from_bin", |
| action_names = ["//actions:assemble"], |
| implies = [], |
| tools = [":clang_wrapper"], |
| ) |
| |
| pw_cc_tool( |
| name = "requires_foo_tool", |
| requires_any_of = ["//cc_toolchain/tests/features:foo_only"], |
| tool = ":clang_wrapper", |
| ) |
| |
| pw_cc_action_config( |
| name = "requires_foo", |
| action_names = ["//actions:c_compile"], |
| tools = [":requires_foo_tool"], |
| ) |
| |
| pw_cc_action_files( |
| name = "c_compiler_data", |
| srcs = ["data.txt"], |
| actions = [ |
| "//actions:c_compile", |
| "//actions:assemble", |
| ], |
| ) |
| |
| pw_cc_action_files( |
| name = "cpp_compiler_data", |
| srcs = ["clang_wrapper.sh"], |
| actions = [ |
| "//actions:cpp_compile", |
| "//actions:assemble", |
| ], |
| ) |
| |
| pw_cc_action_files_set( |
| name = "data", |
| srcs = [ |
| ":c_compiler_data", |
| ":cpp_compiler_data", |
| ], |
| ) |
| |
| test_action_configs( |
| name = "test_action_configs", |
| ) |