xref: /aosp_15_r20/external/cronet/build/config/siso/mac.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 macOS."""
6
7load("@builtin//struct.star", "module")
8load("./clang_mac.star", "clang")
9load("./config.star", "config")
10load("./typescript_unix.star", "typescript")
11
12def __filegroups(ctx):
13    fg = {}
14    fg.update(clang.filegroups(ctx))
15    fg.update(typescript.filegroups(ctx))
16    return fg
17
18# to reduce unnecessary local process and
19# unnecessary digest calculation of output file.
20def __copy_bundle_data(ctx, cmd):
21    input = cmd.inputs[0]
22    out = cmd.outputs[0]
23    ctx.actions.copy(input, out, recursive = ctx.fs.is_dir(input))
24    ctx.actions.exit(exit_status = 0)
25
26__handlers = {
27    "copy_bundle_data": __copy_bundle_data,
28}
29__handlers.update(clang.handlers)
30__handlers.update(typescript.handlers)
31
32def __step_config(ctx, step_config):
33    config.check(ctx)
34    step_config["rules"].extend([
35        {
36            "name": "mac/copy_bundle_data",
37            "action": "(.*)?copy_bundle_data",
38            "handler": "copy_bundle_data",
39        },
40    ])
41    step_config = clang.step_config(ctx, step_config)
42    step_config = typescript.step_config(ctx, step_config)
43    return step_config
44
45chromium = module(
46    "chromium",
47    step_config = __step_config,
48    filegroups = __filegroups,
49    handlers = __handlers,
50)
51