• 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 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            "timeout": "2m",
38            "output_local": True,
39            "platform_ref": platform_ref,
40        },
41        {
42            "name": "mojo/mojom_parser",
43            "command_prefix": platform.python_bin + " ../../mojo/public/tools/mojom/mojom_parser.py",
44            "indirect_inputs": {
45                "includes": [
46                    "*.build_metadata",
47                    "*.mojom",
48                    "*.mojom-module",
49                    "*.test-mojom",
50                    "*.test-mojom-module",
51                ],
52            },
53            "exclude_input_patterns": [
54                "*.stamp",
55            ],
56            # TODO(b/288523418): missing inputs for mojom_parser?
57            "outputs_map": {
58                "./gen/mojo/public/interfaces/bindings/tests/sample_import2.mojom-module": {
59                    "inputs": [
60                        "./gen/mojo/public/interfaces/bindings/tests/test_mojom_import_wrapper.build_metadata",
61                        "./gen/mojo/public/interfaces/bindings/tests/test_mojom_import_wrapper_wrapper.build_metadata",
62                    ],
63                },
64                "./gen/mojo/public/interfaces/bindings/tests/math_calculator.mojom-module": {
65                    "inputs": [
66                        "./gen/mojo/public/interfaces/bindings/tests/test_mojom_import_wrapper.build_metadata",
67                        "./gen/mojo/public/interfaces/bindings/tests/test_mojom_import_wrapper_wrapper.build_metadata",
68                    ],
69                },
70                "./gen/mojo/public/interfaces/bindings/tests/test_associated_interfaces.mojom-module": {
71                    "inputs": [
72                        "./gen/mojo/public/interfaces/bindings/tests/test_mojom_import_wrapper.build_metadata",
73                        "./gen/mojo/public/interfaces/bindings/tests/test_mojom_import_wrapper_wrapper.build_metadata",
74                    ],
75                },
76            },
77            # TODO: b/285078792 - Win cross compile on Linux worker doesn't work with input_root_absolute_path=true.
78            "remote": runtime.os != "windows",
79            "input_root_absolute_path": True,
80            "output_local": True,
81            "platform_ref": platform_ref,
82        },
83        {
84            "name": "mojo/validate_typemap_config",
85            "command_prefix": platform.python_bin + " ../../mojo/public/tools/bindings/validate_typemap_config.py",
86            "remote": True,
87            "output_local": True,
88            "platform_ref": platform_ref,
89        },
90        {
91            "name": "mojo/generate_type_mappings",
92            "command_prefix": platform.python_bin + " ../../mojo/public/tools/bindings/generate_type_mappings.py",
93            "remote": True,
94            "output_local": True,
95            "platform_ref": platform_ref,
96        },
97    ])
98    return step_config
99
100mojo = module(
101    "mojo",
102    step_config = __step_config,
103)
104