xref: /aosp_15_r20/external/cronet/build/config/siso/mojo.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 mojo."""
6
7load("@builtin//runtime.star", "runtime")
8load("@builtin//struct.star", "module")
9load("./platform.star", "platform")
10
11def __step_config(ctx, step_config):
12    # mojom_bindings_generator.py will run faster on n2-highmem-8 than
13    # n2-custom-2-3840
14    # e.g.
15    #  n2-highmem-8: exec: 880.202978ms
16    #  n2-custom-2-3840: exec: 2.42808488s
17    platform_ref = "large"
18    step_config["rules"].extend([
19        {
20            "name": "mojo/mojom_bindings_generator",
21            "command_prefix": platform.python_bin + " ../../mojo/public/tools/bindings/mojom_bindings_generator.py",
22            "indirect_inputs": {
23                "includes": [
24                    "*.js",
25                    "*.mojom",
26                    "*.mojom-module",
27                    "*.test-mojom",
28                    "*.test-mojom-module",
29                    "*.zip",
30                ],
31            },
32            "exclude_input_patterns": [
33                "*.stamp",
34            ],
35            "restat": True,
36            "remote": True,
37            "canonicalize_dir": True,
38            "timeout": "2m",
39            "output_local": True,
40            "platform_ref": platform_ref,
41        },
42        {
43            "name": "mojo/mojom_parser",
44            "command_prefix": platform.python_bin + " ../../mojo/public/tools/mojom/mojom_parser.py",
45            "indirect_inputs": {
46                "includes": [
47                    "*.build_metadata",
48                    "*.mojom",
49                    "*.mojom-module",
50                    "*.test-mojom",
51                    "*.test-mojom-module",
52                ],
53            },
54            "exclude_input_patterns": [
55                "*.stamp",
56            ],
57            # TODO(b/288523418): missing inputs for mojom_parser?
58            "outputs_map": {
59                "./gen/mojo/public/interfaces/bindings/tests/sample_import2.mojom-module": {
60                    "inputs": [
61                        "./gen/mojo/public/interfaces/bindings/tests/test_mojom_import_wrapper.build_metadata",
62                        "./gen/mojo/public/interfaces/bindings/tests/test_mojom_import_wrapper_wrapper.build_metadata",
63                    ],
64                },
65                "./gen/mojo/public/interfaces/bindings/tests/math_calculator.mojom-module": {
66                    "inputs": [
67                        "./gen/mojo/public/interfaces/bindings/tests/test_mojom_import_wrapper.build_metadata",
68                        "./gen/mojo/public/interfaces/bindings/tests/test_mojom_import_wrapper_wrapper.build_metadata",
69                    ],
70                },
71                "./gen/mojo/public/interfaces/bindings/tests/test_associated_interfaces.mojom-module": {
72                    "inputs": [
73                        "./gen/mojo/public/interfaces/bindings/tests/test_mojom_import_wrapper.build_metadata",
74                        "./gen/mojo/public/interfaces/bindings/tests/test_mojom_import_wrapper_wrapper.build_metadata",
75                    ],
76                },
77            },
78            # TODO: b/285078792 - Win cross compile on Linux worker doesn't work with input_root_absolute_path=true.
79            "remote": runtime.os != "windows",
80            "canonicalize_dir": True,
81            "input_root_absolute_path": True,
82            "output_local": True,
83            "platform_ref": platform_ref,
84        },
85        {
86            "name": "mojo/validate_typemap_config",
87            "command_prefix": platform.python_bin + " ../../mojo/public/tools/bindings/validate_typemap_config.py",
88            "remote": True,
89            "canonicalize_dir": True,
90            "output_local": True,
91            "platform_ref": platform_ref,
92        },
93        {
94            "name": "mojo/generate_type_mappings",
95            "command_prefix": platform.python_bin + " ../../mojo/public/tools/bindings/generate_type_mappings.py",
96            "remote": True,
97            "canonicalize_dir": True,
98            "output_local": True,
99            "platform_ref": platform_ref,
100        },
101    ])
102    return step_config
103
104mojo = module(
105    "mojo",
106    step_config = __step_config,
107)
108