1# -*- bazel-starlark -*- 2# Copyright 2023 The Chromium Authors 3# Use of this source code is governed by a BSD-style license that can be 4# found in the LICENSE file. 5"""Siso configuration for clang.""" 6 7load("@builtin//struct.star", "module") 8load("./mac_sdk.star", "mac_sdk") 9load("./win_sdk.star", "win_sdk") 10 11def __filegroups(ctx): 12 fg = { 13 "third_party/libc++/src/include:headers": { 14 "type": "glob", 15 "includes": ["*"], 16 # can't use "*.h", because c++ headers have no extension. 17 }, 18 "third_party/libc++abi/src/include:headers": { 19 "type": "glob", 20 "includes": ["*.h"], 21 }, 22 # vendor provided headers for libc++. 23 "buildtools/third_party/libc++:headers": { 24 "type": "glob", 25 "includes": [ 26 "__*", 27 ], 28 }, 29 30 # toolchain root 31 # :headers for compiling 32 "third_party/llvm-build/Release+Asserts:headers": { 33 "type": "glob", 34 "includes": [ 35 "*.h", 36 "bin/clang", 37 "bin/clang++", 38 "bin/clang-cl", 39 "bin/clang-cl.exe", 40 "*_ignorelist.txt", 41 # https://crbug.com/335997052 42 "clang_rt.profile*.lib", 43 ], 44 }, 45 "third_party/cronet_android_mainline_clang/linux-amd64:headers": { 46 "type": "glob", 47 "includes": [ 48 "*.h", 49 "bin/clang*", 50 ], 51 }, 52 "third_party/cronet_android_mainline_clang/linux-amd64:link": { 53 "type": "glob", 54 "includes": [ 55 "bin/clang*", 56 "bin/ld.lld", 57 "bin/lld", 58 "bin/llvm-nm", 59 "bin/llvm-objcopy", 60 "bin/llvm-readelf", 61 "bin/llvm-readobj", 62 "bin/llvm-strip", 63 "*.so", 64 "*.so.*", 65 "*.a", 66 ], 67 }, 68 } 69 if win_sdk.enabled(ctx): 70 fg.update(win_sdk.filegroups(ctx)) 71 if mac_sdk.enabled(ctx): 72 fg.update(mac_sdk.filegroups(ctx)) 73 return fg 74 75__input_deps = { 76 # need this because we use 77 # third_party/libc++/src/include:headers, 78 # but scandeps doesn't scan `__config` file, which uses 79 # `#include <__config_site>` 80 # also need `__assertion_handler`. b/321171148 81 "third_party/libc++/src/include": [ 82 "buildtools/third_party/libc++:headers", 83 ], 84 "third_party/llvm-build/Release+Asserts/bin/clang": [ 85 "build/config/unsafe_buffers_paths.txt", 86 ], 87 "third_party/llvm-build/Release+Asserts/bin/clang++": [ 88 "build/config/unsafe_buffers_paths.txt", 89 ], 90 "third_party/llvm-build/Release+Asserts/bin/clang-cl": [ 91 "build/config/unsafe_buffers_paths.txt", 92 ], 93 "third_party/llvm-build/Release+Asserts/bin/clang-cl.exe": [ 94 "build/config/unsafe_buffers_paths.txt", 95 ], 96 "build/toolchain/gcc_solink_wrapper.py": [ 97 "build/toolchain/whole_archive.py", 98 "build/toolchain/wrapper_utils.py", 99 ], 100 "build/toolchain/gcc_solink_wrapper.py:link": [ 101 "build/toolchain/gcc_solink_wrapper.py", 102 "build/toolchain/whole_archive.py", 103 "build/toolchain/wrapper_utils.py", 104 ], 105 "build/toolchain/gcc_link_wrapper.py": [ 106 "build/toolchain/whole_archive.py", 107 "build/toolchain/wrapper_utils.py", 108 ], 109 "build/toolchain/gcc_link_wrapper.py:link": [ 110 "build/toolchain/gcc_link_wrapper.py", 111 "build/toolchain/whole_archive.py", 112 "build/toolchain/wrapper_utils.py", 113 ], 114 "build/toolchain/apple/linker_driver.py:link": [ 115 "build/toolchain/apple/linker_driver.py", 116 "build/toolchain/whole_archive.py", 117 ], 118 "build/toolchain/apple/solink_driver.py:link": [ 119 "build/toolchain/apple/linker_driver.py", 120 "build/toolchain/apple/solink_driver.py", 121 "build/toolchain/whole_archive.py", 122 ], 123} 124 125clang_all = module( 126 "clang_all", 127 filegroups = __filegroups, 128 input_deps = __input_deps, 129) 130