xref: /aosp_15_r20/external/angle/build/config/siso/mac.star (revision 8975f5c5ed3d1c378011245431ada316dfb6f244)
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
18def __codesign(ctx, cmd):
19    # codesign.py uses the last arguments as bundle.path
20    # and it would remove existing files under bundle.path,
21    # but siso could not detect such removal, so would cause failure
22    # in subsequent steps. https://crbug.com/372628498
23    # To capture such removal, specify the bundle path as output,
24    # so hashfs.RetrieveUpdateEntriesFromLocal can detect them.
25    bundle_path = ctx.fs.canonpath(cmd.args[-1])
26    ctx.actions.fix(reconcile_outputdirs = [bundle_path])
27
28__handlers = {
29    "codesign": __codesign,
30}
31__handlers.update(clang.handlers)
32__handlers.update(typescript.handlers)
33
34def __step_config(ctx, step_config):
35    config.check(ctx)
36    step_config = clang.step_config(ctx, step_config)
37    step_config = typescript.step_config(ctx, step_config)
38    step_config["rules"].extend([
39        {
40            "name": "codesign",
41            "command_prefix": "python3 ../../build/config/apple/codesign.py ",
42            "handler": "codesign",
43        },
44    ])
45    return step_config
46
47chromium = module(
48    "chromium",
49    step_config = __step_config,
50    filegroups = __filegroups,
51    handlers = __handlers,
52)
53