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