• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# -*- bazel-starlark -*-
2# Copyright 2023 The Chromium Authors. All rights reserved.
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 main entry."""
6
7load("@builtin//encoding.star", "json")
8load("@builtin//runtime.star", "runtime")
9load("@builtin//struct.star", "module")
10load("./linux.star", chromium_linux = "chromium")
11load("./mac.star", chromium_mac = "chromium")
12load("./simple.star", "simple")
13load("./windows.star", chromium_windows = "chromium")
14
15def init(ctx):
16    print("runtime: os:%s arch:%s run:%d" % (
17        runtime.os,
18        runtime.arch,
19        runtime.num_cpu,
20    ))
21    host = {
22        "linux": chromium_linux,
23        "darwin": chromium_mac,
24        "windows": chromium_windows,
25    }[runtime.os]
26    step_config = {
27        "platforms": {},
28        "input_deps": {},
29        "rules": [],
30    }
31    step_config = host.step_config(ctx, step_config)
32    step_config = simple.step_config(ctx, step_config)
33
34    filegroups = {}
35    filegroups.update(host.filegroups)
36    filegroups.update(simple.filegroups)
37
38    handlers = {}
39    handlers.update(host.handlers)
40    handlers.update(simple.handlers)
41
42    return module(
43        "config",
44        step_config = json.encode(step_config),
45        filegroups = filegroups,
46        handlers = handlers,
47    )
48