xref: /aosp_15_r20/external/cronet/build/config/siso/nasm_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 nasm/linux."""
6
7load("@builtin//path.star", "path")
8load("@builtin//struct.star", "module")
9load("./config.star", "config")
10load("./nasm_scandeps.star", "nasm_scandeps")
11
12def __filegroups(ctx):
13    return {}
14
15def __nasm(ctx, cmd):
16    inputs = nasm_scandeps.scandeps(ctx, cmd)
17    ctx.actions.fix(inputs = cmd.inputs + inputs)
18
19__handlers = {
20    "nasm": __nasm,
21}
22
23def __step_config(ctx, step_config):
24    remote_run = True  # Turn this to False when you do file access trace.
25    rules = []
26    for toolchain in ["", "clang_x64"]:
27        nasm_path = path.join(toolchain, "nasm")
28        rules.append({
29            "name": path.join("nasm", toolchain),
30            "command_prefix": "python3 ../../build/gn_run_binary.py " + nasm_path,
31            "inputs": [
32                "build/gn_run_binary.py",
33                ctx.fs.canonpath("./" + nasm_path),
34            ],
35            "indirect_inputs": {
36                "includes": ["*.asm"],
37            },
38            "exclude_input_patterns": [
39                "*.stamp",
40            ],
41            "handler": "nasm",
42            "remote": remote_run,
43            # chromeos generates default.profraw?
44            "ignore_extra_output_pattern": ".*default.profraw",
45            "timeout": "2m",
46        })
47    step_config["rules"].extend(rules)
48    return step_config
49
50nasm = module(
51    "nasm",
52    step_config = __step_config,
53    filegroups = __filegroups,
54    handlers = __handlers,
55)
56