• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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-cl/windows."""
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    # for precomputed subtree
15    "third_party/depot_tools/win_toolchain/vs_files/27370823e7:headers-ci": {
16        "type": "glob",
17        "includes": [
18            "*.h",
19            "*.inl",
20            "*.H",
21            "*.Hxx",
22            "*.hxx",
23            "*.hpp",
24            "VC/Tools/MSVC/*/include/*",
25            "VC/Tools/MSVC/*/include/*/*",
26        ],
27    },
28}
29
30__filegroups.update(clang_all.filegroups)
31
32def __clang_compile_coverage(ctx, cmd):
33    clang_command = clang_code_coverage_wrapper.run(ctx, list(cmd.args))
34    ctx.actions.fix(args = clang_command)
35
36__handlers = {
37    "clang_compile_coverage": __clang_compile_coverage,
38}
39
40def __step_config(ctx, step_config):
41    cfg = "buildtools/reclient_cfgs/chromium-browser-clang/rewrapper_windows.cfg"
42    if ctx.fs.exists(cfg):
43        reproxy_config = rewrapper_cfg.parse(ctx, cfg)
44        step_config["platforms"].update({
45            "clang-cl": reproxy_config["platform"],
46        })
47        step_config["input_deps"].update(clang_all.input_deps)
48        if reproxy_config["platform"]["OSFamily"] == "Windows":
49            step_config["input_deps"].update({
50                "third_party/depot_tools/win_toolchain/vs_files/27370823e7:headers": [
51                    "third_party/depot_tools/win_toolchain/vs_files/27370823e7:headers-ci",
52                ],
53            })
54        else:
55            step_config["input_deps"].update({
56                "third_party/depot_tools/win_toolchain/vs_files/27370823e7:headers": [
57                    "third_party/depot_tools/win_toolchain/vs_files/27370823e7:headers-ci",
58                    # third_party/libc++ includes "DeplayIMP.h"
59                    "third_party/depot_tools/win_toolchain/vs_files/27370823e7/VC/Tools/MSVC/14.34.31933/include/DelayIMP.h",
60                    # third_party/abseil-cpp includes "dbghelp.h"
61                    "third_party/depot_tools/win_toolchain/vs_files/27370823e7/Windows Kits/10/Include/10.0.22621.0/um/dbghelp.h",
62                    # third_party/abseil-cpp includes "aclapi.h"
63                    "third_party/depot_tools/win_toolchain/vs_files/27370823e7/Windows Kits/10/Include/10.0.22621.0/um/aclapi.h",
64                    # base/debug includes "psapi.h"
65                    "third_party/depot_tools/win_toolchain/vs_files/27370823e7/Windows Kits/10/Include/10.0.22621.0/um/psapi.h",
66                    # base/process includes "tlhelp32.h"
67                    "third_party/depot_tools/win_toolchain/vs_files/27370823e7/Windows Kits/10/Include/10.0.22621.0/um/tlhelp32.h",
68                    # base/process includes "userenv.h"
69                    "third_party/depot_tools/win_toolchain/vs_files/27370823e7/Windows Kits/10/Include/10.0.22621.0/um/userenv.h",
70                    # base includes "shlobj.h"
71                    "third_party/depot_tools/win_toolchain/vs_files/27370823e7/Windows Kits/10/Include/10.0.22621.0/um/shlobj.h",
72                    # base/win includes "lm.h"
73                    "third_party/depot_tools/win_toolchain/vs_files/27370823e7/Windows Kits/10/Include/10.0.22621.0/um/lm.h",
74                    # base/win includes "mdmregistration.h"
75                    "third_party/depot_tools/win_toolchain/vs_files/27370823e7/Windows Kits/10/Include/10.0.22621.0/um/mdmregistration.h",
76                    # base/win includes "shellscalingapi.h"
77                    "third_party/depot_tools/win_toolchain/vs_files/27370823e7/Windows Kits/10/Include/10.0.22621.0/um/shellscalingapi.h",
78                    # base/win includes "uiviewsettingsinterop.h"
79                    "third_party/depot_tools/win_toolchain/vs_files/27370823e7/Windows Kits/10/Include/10.0.22621.0/um/uiviewsettingsinterop.h",
80                    # native_client/src/shared/platform/win includes "WinError.h"
81                    "third_party/depot_tools/win_toolchain/vs_files/27370823e7/Windows Kits/10/Include/10.0.22621.0/shared/WinError.h",
82                    # third_party/webrtc/rtc_base/win includes "windows.graphics.directX.direct3d11.h"
83                    "third_party/depot_tools/win_toolchain/vs_files/27370823e7/Windows Kits/10/Include/10.0.22621.0/cppwinrt/winrt/windows.graphics.directX.direct3d11.h",
84                    "third_party/depot_tools/win_toolchain/vs_files/27370823e7/Windows Kits/10/Include/10.0.22621.0/winrt/windows.graphics.directX.direct3d11.h",
85                    # third_party/webrtc/rtc_base/win includes "windows.graphics.directX.direct3d11.interop.h"
86                    "third_party/depot_tools/win_toolchain/vs_files/27370823e7/Windows Kits/10/Include/10.0.22621.0/um/windows.graphics.directX.direct3d11.interop.h",
87                    # third_party/crashpad/crashpad/handler/win includes "werapi.h"
88                    "third_party/depot_tools/win_toolchain/vs_files/27370823e7/Windows Kits/10/Include/10.0.22621.0/um/werapi.h",
89                    # chrome/install_static/ includes "wtsapi32.h"
90                    "third_party/depot_tools/win_toolchain/vs_files/27370823e7/Windows Kits/10/Include/10.0.22621.0/um/wtsapi32.h",
91                    # third_party/dawn/include/dawn/native includes "DXGI1_4.h"
92                    "third_party/depot_tools/win_toolchain/vs_files/27370823e7/Windows Kits/10/Include/10.0.22621.0/shared/DXGI1_4.h",
93                    # v8/src/diagnostics includes "versionhelpers.h"
94                    "third_party/depot_tools/win_toolchain/vs_files/27370823e7/Windows Kits/10/Include/10.0.22621.0/um/versionhelpers.h",
95                    # ui/gfx/ includes "DXGIType.h"
96                    "third_party/depot_tools/win_toolchain/vs_files/27370823e7/Windows Kits/10/Include/10.0.22621.0/shared/DXGIType.h",
97                    # third_party/unrar includes "PowrProf.h"
98                    "third_party/depot_tools/win_toolchain/vs_files/27370823e7/Windows Kits/10/Include/10.0.22621.0/um/PowrProf.h",
99                    # device/base/ includes "dbt.h"
100                    "third_party/depot_tools/win_toolchain/vs_files/27370823e7/Windows Kits/10/Include/10.0.22621.0/um/dbt.h",
101                    # third_party/skia/ includes "ObjBase.h"
102                    "third_party/depot_tools/win_toolchain/vs_files/27370823e7/Windows Kits/10/Include/10.0.22621.0/um/ObjBase.h",
103                    # third_party/webrtc/rtc_base includes "ws2spi.h"
104                    "third_party/depot_tools/win_toolchain/vs_files/27370823e7/Windows Kits/10/Include/10.0.22621.0/um/ws2spi.h",
105                    # third_party/skia/ includes "T2EmbApi.h"
106                    "third_party/depot_tools/win_toolchain/vs_files/27370823e7/Windows Kits/10/Include/10.0.22621.0/um/T2EmbApi.h",
107                    # device/vr/windows/ includes "D3D11_1.h"
108                    "third_party/depot_tools/win_toolchain/vs_files/27370823e7/Windows Kits/10/Include/10.0.22621.0/um/D3D11_1.h",
109                    # rlz/win/ includes "Sddl.h"
110                    "third_party/depot_tools/win_toolchain/vs_files/27370823e7/Windows Kits/10/Include/10.0.22621.0/shared/Sddl.h",
111                    # chrome/common/safe_browsing/ includes "softpub.h"
112                    "third_party/depot_tools/win_toolchain/vs_files/27370823e7/Windows Kits/10/Include/10.0.22621.0/um/softpub.h",
113                    # services/device/generic_sensor/ includes "Sensors.h"
114                    "third_party/depot_tools/win_toolchain/vs_files/27370823e7/Windows Kits/10/Include/10.0.22621.0/um/Sensors.h",
115                    # third_party/webrtc/modules/desktop_capture/win includes "windows.graphics.capture.interop.h"
116                    "third_party/depot_tools/win_toolchain/vs_files/27370823e7/Windows Kits/10/Include/10.0.22621.0/um/windows.graphics.capture.interop.h",
117                    # third_party/skia/ includes "FontSub.h"
118                    "third_party/depot_tools/win_toolchain/vs_files/27370823e7/Windows Kits/10/Include/10.0.22621.0/um/FontSub.h",
119                    # chrome/updater/ includes "regstr.h"
120                    "third_party/depot_tools/win_toolchain/vs_files/27370823e7/Windows Kits/10/Include/10.0.22621.0/um/regstr.h",
121                    # services/device/compute_pressure includes "pdh.h"
122                    "third_party/depot_tools/win_toolchain/vs_files/27370823e7/Windows Kits/10/Include/10.0.22621.0/um/pdh.h",
123                    # chrome/installer/ includes "mshtmhst.h"
124                    "third_party/depot_tools/win_toolchain/vs_files/27370823e7/Windows Kits/10/Include/10.0.22621.0/um/mshtmhst.h",
125                    # net/ssl/ includes "NCrypt.h"
126                    "third_party/depot_tools/win_toolchain/vs_files/27370823e7/Windows Kits/10/Include/10.0.22621.0/um/NCrypt.h",
127                    # device/fido/win/ includes "Combaseapi.h"
128                    "third_party/depot_tools/win_toolchain/vs_files/27370823e7/Windows Kits/10/Include/10.0.22621.0/um/Combaseapi.h",
129                    # components/device_signals/core/system_signals/win includes "wscapi.h"
130                    "third_party/depot_tools/win_toolchain/vs_files/27370823e7/Windows Kits/10/Include/10.0.22621.0/um/wscapi.h",
131                    # net/proxy_resolution/win/ includes "dhcpcsdk.h"
132                    "third_party/depot_tools/win_toolchain/vs_files/27370823e7/Windows Kits/10/Include/10.0.22621.0/um/dhcpcsdk.h",
133                    # third_party/dawn/third_party/glfw includes "xinput.h"
134                    "third_party/depot_tools/win_toolchain/vs_files/27370823e7/Windows Kits/10/Include/10.0.22621.0/um/xinput.h",
135                    # v8/tools/v8windbg includes "pathcch.h"
136                    "third_party/depot_tools/win_toolchain/vs_files/27370823e7/Windows Kits/10/Include/10.0.22621.0/um/pathcch.h",
137                    # remoting/host includes "rpcproxy.h"
138                    "third_party/depot_tools/win_toolchain/vs_files/27370823e7/Windows Kits/10/Include/10.0.22621.0/um/rpcproxy.h",
139                    # sandbox/win includes "Aclapi.h"
140                    "third_party/depot_tools/win_toolchain/vs_files/27370823e7/Windows Kits/10/Include/10.0.22621.0/um/Aclapi.h",
141                    # ui/accessibility/platform includes "uiautomation.h"
142                    "third_party/depot_tools/win_toolchain/vs_files/27370823e7/Windows Kits/10/Include/10.0.22621.0/um/uiautomation.h",
143                    # chrome/credential_provider/gaiacp includes "ntsecapi.h"
144                    "third_party/depot_tools/win_toolchain/vs_files/27370823e7/Windows Kits/10/Include/10.0.22621.0/um/ntsecapi.h",
145                    # net/dns includes "Winsock2.h"
146                    "third_party/depot_tools/win_toolchain/vs_files/27370823e7/Windows Kits/10/Include/10.0.22621.0/um/Winsock2.h",
147                    # media/cdm/win includes "mferror.h"
148                    "third_party/depot_tools/win_toolchain/vs_files/27370823e7/Windows Kits/10/Include/10.0.22621.0/um/mferror.h",
149                    # chrome/credentialProvider/gaiacp includes "Winternl.h"
150                    "third_party/depot_tools/win_toolchain/vs_files/27370823e7/Windows Kits/10/Include/10.0.22621.0/um/Winternl.h",
151                    # media/audio/win includes "audioclient.h"
152                    "third_party/depot_tools/win_toolchain/vs_files/27370823e7/Windows Kits/10/Include/10.0.22621.0/um/audioclient.h",
153                    # media/audio/win includes "MMDeviceAPI.h"
154                    "third_party/depot_tools/win_toolchain/vs_files/27370823e7/Windows Kits/10/Include/10.0.22621.0/um/MMDeviceAPI.h",
155                    # net/proxy_resolution/win includes "dhcpv6csdk.h"
156                    "third_party/depot_tools/win_toolchain/vs_files/27370823e7/Windows Kits/10/Include/10.0.22621.0/um/dhcpv6csdk.h",
157                    # components/system_media_controls/win includes "systemmediatransportcontrolsinterop.h"
158                    "third_party/depot_tools/win_toolchain/vs_files/27370823e7/Windows Kits/10/Include/10.0.22621.0/um/systemmediatransportcontrolsinterop.h",
159                    # ui/native_theme includes "Windows.Media.ClosedCaptioning.h"
160                    "third_party/depot_tools/win_toolchain/vs_files/27370823e7/Windows Kits/10/Include/10.0.22621.0/cppwinrt/winrt/Windows.Media.ClosedCaptioning.h",
161                    "third_party/depot_tools/win_toolchain/vs_files/27370823e7/Windows Kits/10/Include/10.0.22621.0/winrt/Windows.Media.ClosedCaptioning.h",
162                    # media/audio/win includes "Functiondiscoverykeys_devpkey.h"
163                    "third_party/depot_tools/win_toolchain/vs_files/27370823e7/Windows Kits/10/Include/10.0.22621.0/um/Functiondiscoverykeys_devpkey.h",
164                    # device/fido includes "Winuser.h"
165                    "third_party/depot_tools/win_toolchain/vs_files/27370823e7/Windows Kits/10/Include/10.0.22621.0/um/Winuser.h",
166                    # chrome/updater/win includes "msxml2.h"
167                    "third_party/depot_tools/win_toolchain/vs_files/27370823e7/Windows Kits/10/Include/10.0.22621.0/um/msxml2.h",
168                    # remoting/host includes "ime.h"
169                    "third_party/depot_tools/win_toolchain/vs_files/27370823e7/Windows Kits/10/Include/10.0.22621.0/um/ime.h",
170                    # remoting/host/win includes "D3DCommon.h"
171                    "third_party/depot_tools/win_toolchain/vs_files/27370823e7/Windows Kits/10/Include/10.0.22621.0/um/D3DCommon.h",
172                    # ui/views/controls/menu includes "Vssym32.h"
173                    "third_party/depot_tools/win_toolchain/vs_files/27370823e7/Windows Kits/10/Include/10.0.22621.0/um/Vssym32.h",
174                    # third_party/wtl includes "richedit.h"
175                    "third_party/depot_tools/win_toolchain/vs_files/27370823e7/Windows Kits/10/Include/10.0.22621.0/um/richedit.h",
176                    # chrome/updater/net includes "Urlmon.h"
177                    "third_party/depot_tools/win_toolchain/vs_files/27370823e7/Windows Kits/10/Include/10.0.22621.0/um/Urlmon.h",
178                    # device/gamepad includes "XInput.h"
179                    "third_party/depot_tools/win_toolchain/vs_files/27370823e7/Windows Kits/10/Include/10.0.22621.0/um/XInput.h",
180                    # chrome/credential_provider/gaiacp includes "Shlobj.h"
181                    "third_party/depot_tools/win_toolchain/vs_files/27370823e7/Windows Kits/10/Include/10.0.22621.0/um/Shlobj.h",
182                    # content/renderer includes "mlang.h"
183                    "third_party/depot_tools/win_toolchain/vs_files/27370823e7/Windows Kits/10/Include/10.0.22621.0/um/mlang.h",
184                    # components/storage_monitor includes "portabledevice.h"
185                    "third_party/depot_tools/win_toolchain/vs_files/27370823e7/Windows Kits/10/Include/10.0.22621.0/um/portabledevice.h",
186                    # third_party/wtl includes "richole.h"
187                    "third_party/depot_tools/win_toolchain/vs_files/27370823e7/Windows Kits/10/Include/10.0.22621.0/um/richole.h",
188                    # chrome/utility/importer includes "intshcut.h"
189                    "third_party/depot_tools/win_toolchain/vs_files/27370823e7/Windows Kits/10/Include/10.0.22621.0/um/intshcut.h",
190                    # chrome/browser/net includes "Ws2spi.h"
191                    "third_party/depot_tools/win_toolchain/vs_files/27370823e7/Windows Kits/10/Include/10.0.22621.0/um/Ws2spi.h",
192                    # chrome/browser/enterprise/platform_auth includes "proofofpossessioncookieinfo.h"
193                    "third_party/depot_tools/win_toolchain/vs_files/27370823e7/Windows Kits/10/Include/10.0.22621.0/um/proofofpossessioncookieinfo.h",
194                    # chrome/utility/importer includes "urlhist.h"
195                    "third_party/depot_tools/win_toolchain/vs_files/27370823e7/Windows Kits/10/Include/10.0.22621.0/um/urlhist.h",
196                    # chrome/updater/win/installer includes "msiquery.h"
197                    "third_party/depot_tools/win_toolchain/vs_files/27370823e7/Windows Kits/10/Include/10.0.22621.0/um/msiquery.h",
198                ],
199            })
200        step_config["rules"].extend([
201            {
202                "name": "clang-cl/cxx",
203                "action": "(.*_)?cxx",
204                "command_prefix": "..\\..\\third_party\\llvm-build\\Release+Asserts\\bin\\clang-cl.exe",
205                "platform_ref": "clang-cl",
206                "remote": True,
207                "remote_wrapper": reproxy_config["remote_wrapper"],
208            },
209            {
210                "name": "clang-cl/cc",
211                "action": "(.*_)?cc",
212                "command_prefix": "..\\..\\third_party\\llvm-build\\Release+Asserts\\bin\\clang-cl.exe",
213                "platform_ref": "clang-cl",
214                "remote": True,
215                "remote_wrapper": reproxy_config["remote_wrapper"],
216            },
217            {
218                "name": "clang-coverage/cxx",
219                "action": "(.*_)?cxx",
220                "command_prefix": "python3.exe ../../build/toolchain/clang_code_coverage_wrapper.py",
221                "inputs": [
222                    "third_party/llvm-build/Release+Asserts/bin/clang++",
223                ],
224                "handler": "clang_compile_coverage",
225                "platform_ref": "clang-cl",
226                "remote": True,
227                "remote_wrapper": reproxy_config["remote_wrapper"],
228            },
229            {
230                "name": "clang-coverage/cc",
231                "action": "(.*_)?cc",
232                "command_prefix": "python3.exe ../../build/toolchain/clang_code_coverage_wrapper.py",
233                "inputs": [
234                    "third_party/llvm-build/Release+Asserts/bin/clang",
235                ],
236                "handler": "clang_compile_coverage",
237                "platform_ref": "clang-cl",
238                "remote": True,
239                "remote_wrapper": reproxy_config["remote_wrapper"],
240            },
241        ])
242    return step_config
243
244clang = module(
245    "clang",
246    step_config = __step_config,
247    filegroups = __filegroups,
248    handlers = __handlers,
249)
250