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 linux.""" 6 7load("@builtin//struct.star", "module") 8load("./android.star", "android") 9load("./clang_linux.star", "clang") 10load("./config.star", "config") 11load("./cros.star", "cros") 12load("./devtools_frontend.star", "devtools_frontend") 13load("./nacl_linux.star", "nacl") 14load("./nasm_linux.star", "nasm") 15load("./proto_linux.star", "proto") 16load("./reproxy.star", "reproxy") 17load("./rust_linux.star", "rust") 18load("./typescript_unix.star", "typescript") 19load("./v8.star", "v8") 20 21def __filegroups(ctx): 22 fg = {} 23 fg.update(android.filegroups(ctx)) 24 fg.update(clang.filegroups(ctx)) 25 fg.update(cros.filegroups(ctx)) 26 fg.update(devtools_frontend.filegroups(ctx)) 27 fg.update(nacl.filegroups(ctx)) 28 fg.update(nasm.filegroups(ctx)) 29 fg.update(proto.filegroups(ctx)) 30 fg.update(rust.filegroups(ctx)) 31 fg.update(typescript.filegroups(ctx)) 32 fg["third_party/perfetto/python:python"] = { 33 "type": "glob", 34 "includes": ["*.py"], 35 } 36 fg["third_party/perfetto/src/trace_processor:trace_processor"] = { 37 "type": "glob", 38 "includes": ["*.py"], 39 } 40 return fg 41 42__handlers = {} 43__handlers.update(android.handlers) 44__handlers.update(clang.handlers) 45__handlers.update(cros.handlers) 46__handlers.update(devtools_frontend.handlers) 47__handlers.update(nacl.handlers) 48__handlers.update(nasm.handlers) 49__handlers.update(proto.handlers) 50__handlers.update(rust.handlers) 51__handlers.update(typescript.handlers) 52 53def __step_config(ctx, step_config): 54 config.check(ctx) 55 56 if android.enabled(ctx): 57 step_config = android.step_config(ctx, step_config) 58 59 # nacl and cros rules should be added before clang rules for link action. 60 step_config = nacl.step_config(ctx, step_config) 61 62 # cros rules are necessary only for the Siso's builtin RBE client mode. 63 if not reproxy.enabled(ctx): 64 step_config = cros.step_config(ctx, step_config) 65 66 step_config = clang.step_config(ctx, step_config) 67 step_config = devtools_frontend.step_config(ctx, step_config) 68 step_config = nasm.step_config(ctx, step_config) 69 step_config = proto.step_config(ctx, step_config) 70 step_config = rust.step_config(ctx, step_config) 71 step_config = typescript.step_config(ctx, step_config) 72 step_config = v8.step_config(ctx, step_config) 73 74 step_config["rules"].extend([ 75 { 76 "name": "write_buildflag_header", 77 "command_prefix": "python3 ../../build/write_buildflag_header.py", 78 "remote": config.get(ctx, "cog"), 79 "canonicalize_dir": True, 80 "timeout": "2m", 81 }, 82 { 83 "name": "write_build_date_header", 84 "command_prefix": "python3 ../../base/write_build_date_header.py", 85 "remote": config.get(ctx, "cog"), 86 "canonicalize_dir": True, 87 "timeout": "2m", 88 }, 89 { 90 "name": "version_py", 91 "command_prefix": "python3 ../../build/util/version.py", 92 "remote": config.get(ctx, "cog"), 93 "canonicalize_dir": True, 94 "timeout": "2m", 95 }, 96 { 97 "name": "perfetto/touch_file", 98 "command_prefix": "python3 ../../third_party/perfetto/tools/touch_file.py", 99 "remote": config.get(ctx, "cog"), 100 "replace": True, 101 "canonicalize_dir": True, 102 "timeout": "2m", 103 }, 104 { 105 "name": "perfetto/write_buildflag_header", 106 "command_prefix": "python3 ../../third_party/perfetto/gn/write_buildflag_header.py", 107 "remote": config.get(ctx, "cog"), 108 "canonicalize_dir": True, 109 "timeout": "2m", 110 }, 111 { 112 "name": "perfetto/gen_tp_table_headers", 113 "command_prefix": "python3 ../../third_party/perfetto/tools/gen_tp_table_headers.py", 114 "inputs": [ 115 "third_party/perfetto/python:python", 116 "third_party/perfetto/src/trace_processor:trace_processor", 117 ], 118 "remote": config.get(ctx, "cog"), 119 "canonicalize_dir": True, 120 "timeout": "2m", 121 }, 122 { 123 "name": "perfetto/gen_cc_proto_descriptor", 124 "command_prefix": "python3 ../../third_party/perfetto/tools/gen_cc_proto_descriptor.py", 125 "remote": config.get(ctx, "cog"), 126 "canonicalize_dir": True, 127 "timeout": "2m", 128 }, 129 { 130 # b/331716896: local fails due to link(2) error. 131 "name": "generate_fontconfig_cache", 132 "command_prefix": "python3 ../../build/gn_run_binary.py generate_fontconfig_caches", 133 "remote": config.get(ctx, "cog"), 134 "canonicalize_dir": True, 135 "timeout": "2m", 136 }, 137 ]) 138 139 return step_config 140 141chromium = module( 142 "chromium", 143 step_config = __step_config, 144 filegroups = __filegroups, 145 handlers = __handlers, 146) 147