• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright 2024 The Pigweed Authors
2#
3# Licensed under the Apache License, Version 2.0 (the "License"); you may not
4# use this file except in compliance with the License. You may obtain a copy of
5# the License at
6#
7#     https://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, WITHOUT
11# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12# License for the specific language governing permissions and limitations under
13# the License.
14
15load("@bazel_skylib//rules:native_binary.bzl", "native_binary")
16load(
17    "//cc_toolchain:defs.bzl",
18    "pw_cc_action_config",
19    "pw_cc_action_files",
20    "pw_cc_action_files_set",
21    "pw_cc_tool",
22)
23load(":test_action_configs.bzl", "test_action_configs")
24
25package(default_visibility = ["//cc_toolchain/tests:__subpackages__"])
26
27pw_cc_tool(
28    name = "system_clang",
29    path = "/usr/bin/clang",
30)
31
32native_binary(
33    name = "clang_wrapper",
34    src = "clang_wrapper.sh",
35    out = "clang_wrapper",
36    data = [":real_clang"],
37)
38
39pw_cc_tool(
40    name = "clang_wrapper_tool",
41    additional_files = ["data.txt"],
42    tool = ":clang_wrapper",
43)
44
45pw_cc_action_config(
46    name = "all_c_compile",
47    action_names = ["//actions:all_c_compiler_actions"],
48    implies = ["//cc_toolchain/tests/features:foo"],
49    tools = [":system_clang"],
50)
51
52pw_cc_action_config(
53    name = "c_compile",
54    action_names = ["//actions:c_compile"],
55    flag_sets = ["//cc_toolchain/tests/flag_sets:env"],
56    tools = [":system_clang"],
57)
58
59pw_cc_action_config(
60    name = "cpp_compile_from_tool",
61    action_names = ["//actions:cpp_compile"],
62    tools = [":clang_wrapper_tool"],
63)
64
65pw_cc_action_config(
66    name = "assemble_from_bin",
67    action_names = ["//actions:assemble"],
68    implies = [],
69    tools = [":clang_wrapper"],
70)
71
72pw_cc_tool(
73    name = "requires_foo_tool",
74    requires_any_of = ["//cc_toolchain/tests/features:foo_only"],
75    tool = ":clang_wrapper",
76)
77
78pw_cc_action_config(
79    name = "requires_foo",
80    action_names = ["//actions:c_compile"],
81    tools = [":requires_foo_tool"],
82)
83
84pw_cc_action_files(
85    name = "c_compiler_data",
86    srcs = ["data.txt"],
87    actions = [
88        "//actions:c_compile",
89        "//actions:assemble",
90    ],
91)
92
93pw_cc_action_files(
94    name = "cpp_compiler_data",
95    srcs = ["clang_wrapper.sh"],
96    actions = [
97        "//actions:cpp_compile",
98        "//actions:assemble",
99    ],
100)
101
102pw_cc_action_files_set(
103    name = "data",
104    srcs = [
105        ":c_compiler_data",
106        ":cpp_compiler_data",
107    ],
108)
109
110test_action_configs(
111    name = "test_action_configs",
112)
113