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