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/mac.""" 6 7load("@builtin//path.star", "path") 8load("@builtin//struct.star", "module") 9load("./clang_all.star", "clang_all") 10load("./clang_code_coverage_wrapper.star", "clang_code_coverage_wrapper") 11load("./rewrapper_cfg.star", "rewrapper_cfg") 12 13def __filegroups(ctx): 14 fg = { 15 "build/mac_files/xcode_binaries/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk:headers": { 16 "type": "glob", 17 "includes": [ 18 "*.h", 19 "*.json", 20 "*.modulemap", 21 "Current", 22 "Frameworks", 23 "Headers", 24 "Modules", 25 "crt*.o", 26 "usr/include/c++/v1/*", 27 "usr/include/c++/v1/*/*", 28 ], 29 }, 30 } 31 fg.update(clang_all.filegroups(ctx)) 32 return fg 33 34def __clang_compile_coverage(ctx, cmd): 35 clang_command = clang_code_coverage_wrapper.run(ctx, list(cmd.args)) 36 ctx.actions.fix(args = clang_command) 37 38__handlers = { 39 "clang_compile_coverage": __clang_compile_coverage, 40} 41 42def __step_config(ctx, step_config): 43 cfg = "buildtools/reclient_cfgs/chromium-browser-clang/rewrapper_mac.cfg" 44 if ctx.fs.exists(cfg): 45 reproxy_config = rewrapper_cfg.parse(ctx, cfg) 46 step_config["platforms"].update({ 47 "clang": reproxy_config["platform"], 48 }) 49 step_config["input_deps"].update(clang_all.input_deps) 50 step_config["rules"].extend([ 51 { 52 "name": "clang/cxx", 53 "action": "(.*_)?cxx", 54 "command_prefix": "../../third_party/llvm-build/Release+Asserts/bin/clang++", 55 "platform_ref": "clang", 56 "remote": True, 57 "remote_wrapper": reproxy_config["remote_wrapper"], 58 }, 59 { 60 "name": "clang/cc", 61 "action": "(.*_)?cc", 62 "command_prefix": "../../third_party/llvm-build/Release+Asserts/bin/clang", 63 "platform_ref": "clang", 64 "remote": True, 65 "remote_wrapper": reproxy_config["remote_wrapper"], 66 }, 67 { 68 "name": "clang/objcxx", 69 "action": "(.*_)?objcxx", 70 "command_prefix": "../../third_party/llvm-build/Release+Asserts/bin/clang++", 71 "platform_ref": "clang", 72 "remote": True, 73 "remote_wrapper": reproxy_config["remote_wrapper"], 74 }, 75 { 76 "name": "clang/objc", 77 "action": "(.*_)?objc", 78 "command_prefix": "../../third_party/llvm-build/Release+Asserts/bin/clang", 79 "platform_ref": "clang", 80 "remote": True, 81 "remote_wrapper": reproxy_config["remote_wrapper"], 82 }, 83 { 84 "name": "clang-coverage/cxx", 85 "action": "(.*_)?cxx", 86 "command_prefix": "python3 ../../build/toolchain/clang_code_coverage_wrapper.py", 87 "inputs": [ 88 "third_party/llvm-build/Release+Asserts/bin/clang++", 89 ], 90 "handler": "clang_compile_coverage", 91 "platform_ref": "clang", 92 "remote": True, 93 "remote_wrapper": reproxy_config["remote_wrapper"], 94 }, 95 { 96 "name": "clang-coverage/cc", 97 "action": "(.*_)?cc", 98 "command_prefix": "python3 ../../build/toolchain/clang_code_coverage_wrapper.py", 99 "inputs": [ 100 "third_party/llvm-build/Release+Asserts/bin/clang", 101 ], 102 "handler": "clang_compile_coverage", 103 "platform_ref": "clang", 104 "remote": True, 105 "remote_wrapper": reproxy_config["remote_wrapper"], 106 }, 107 { 108 "name": "clang-coverage/objcxx", 109 "action": "(.*_)?objcxx", 110 "command_prefix": "python3 ../../build/toolchain/clang_code_coverage_wrapper.py", 111 "inputs": [ 112 "third_party/llvm-build/Release+Asserts/bin/clang++", 113 ], 114 "handler": "clang_compile_coverage", 115 "platform_ref": "clang", 116 "remote": True, 117 "remote_wrapper": reproxy_config["remote_wrapper"], 118 }, 119 { 120 "name": "clang-coverage/objc", 121 "action": "(.*_)?objc", 122 "command_prefix": "python3 ../../build/toolchain/clang_code_coverage_wrapper.py", 123 "inputs": [ 124 "third_party/llvm-build/Release+Asserts/bin/clang", 125 ], 126 "handler": "clang_compile_coverage", 127 "platform_ref": "clang", 128 "remote": True, 129 "remote_wrapper": reproxy_config["remote_wrapper"], 130 }, 131 ]) 132 return step_config 133 134clang = module( 135 "clang", 136 step_config = __step_config, 137 filegroups = __filegroups, 138 handlers = __handlers, 139) 140