xref: /aosp_15_r20/external/cronet/build/config/siso/linux.star (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
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 step config should be added before clang step config for link step
60    # rules.
61    step_config = nacl.step_config(ctx, step_config)
62
63    step_config = clang.step_config(ctx, step_config)
64    step_config = cros.step_config(ctx, step_config)
65    step_config = devtools_frontend.step_config(ctx, step_config)
66    step_config = nasm.step_config(ctx, step_config)
67    step_config = proto.step_config(ctx, step_config)
68    step_config = rust.step_config(ctx, step_config)
69    step_config = typescript.step_config(ctx, step_config)
70    step_config = v8.step_config(ctx, step_config)
71
72    step_config["rules"].extend([
73        {
74            "name": "write_buildflag_header",
75            "command_prefix": "python3 ../../build/write_buildflag_header.py",
76            "remote": config.get(ctx, "cog"),
77            "canonicalize_dir": True,
78            "timeout": "2m",
79        },
80        {
81            "name": "write_build_date_header",
82            "command_prefix": "python3 ../../base/write_build_date_header.py",
83            "remote": config.get(ctx, "cog"),
84            "canonicalize_dir": True,
85            "timeout": "2m",
86        },
87        {
88            "name": "version_py",
89            "command_prefix": "python3 ../../build/util/version.py ",
90            "inputs": [
91                "build/util/android_chrome_version.py",
92                "build/util/LASTCHANGE",
93            ],
94            "remote": config.get(ctx, "cog"),
95            "canonicalize_dir": True,
96            "timeout": "2m",
97        },
98        {
99            "name": "perfetto/touch_file",
100            "command_prefix": "python3 ../../third_party/perfetto/tools/touch_file.py",
101            "remote": config.get(ctx, "cog"),
102            "replace": True,
103            "canonicalize_dir": True,
104            "timeout": "2m",
105        },
106        {
107            "name": "perfetto/write_buildflag_header",
108            "command_prefix": "python3 ../../third_party/perfetto/gn/write_buildflag_header.py",
109            "remote": config.get(ctx, "cog"),
110            "canonicalize_dir": True,
111            "timeout": "2m",
112        },
113        {
114            "name": "perfetto/gen_tp_table_headers",
115            "command_prefix": "python3 ../../third_party/perfetto/tools/gen_tp_table_headers.py",
116            "inputs": [
117                "third_party/perfetto/python:python",
118                "third_party/perfetto/src/trace_processor:trace_processor",
119            ],
120            "remote": config.get(ctx, "cog"),
121            "canonicalize_dir": True,
122            "timeout": "2m",
123        },
124        {
125            "name": "perfetto/gen_cc_proto_descriptor",
126            "command_prefix": "python3 ../../third_party/perfetto/tools/gen_cc_proto_descriptor.py",
127            "remote": config.get(ctx, "cog"),
128            "canonicalize_dir": True,
129            "timeout": "2m",
130        },
131        {
132            # b/331716896: local fails due to link(2) error.
133            "name": "generate_fontconfig_cache",
134            "command_prefix": "python3 ../../build/gn_run_binary.py generate_fontconfig_caches",
135            "inputs": ["./etc/fonts/fonts.conf"],
136            "remote": config.get(ctx, "cog"),
137            "canonicalize_dir": True,
138            "timeout": "2m",
139        },
140    ])
141
142    return step_config
143
144chromium = module(
145    "chromium",
146    step_config = __step_config,
147    filegroups = __filegroups,
148    handlers = __handlers,
149)
150