• 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"""Config module for checking siso -config flags."""
6
7load("@builtin//struct.star", "module")
8
9__KNOWN_CONFIG_OPTIONS = [
10    # Indicates that the build runs on a builder.
11    "builder",
12
13    # TODO: b/308405411 - Enable this config for all builders.
14    "remote-devtools-frontend-typescript",
15
16    # TODO: b/314693395 - Enable reproxy mode for cros by default.
17    "reproxy-cros",
18]
19
20def __check(ctx):
21    if "config" in ctx.flags:
22        for cfg in ctx.flags["config"].split(","):
23            if cfg not in __KNOWN_CONFIG_OPTIONS:
24                print("unknown config: %s" % cfg)
25
26def __get(ctx, key):
27    if "config" in ctx.flags:
28        for cfg in ctx.flags["config"].split(","):
29            if cfg == key:
30                return True
31    return False
32
33config = module(
34    "config",
35    check = __check,
36    get = __get,
37)
38