2
0
Fork 0
mirror of https://github.com/bazelbuild/bazel-skylib synced 2024-11-27 05:43:25 +00:00
bazel-skylib/docs/selects_doc.md

1.9 KiB
Executable file

selects.with_or

selects.with_or(input_dict, no_match_error)

Drop-in replacement for select() that supports ORed keys.

Parameters

input_dict required.

The same dictionary `select()` takes, except keys may take either the usual form `"//foo:config1"` or `("//foo:config1", "//foo:config2", ...)` to signify `//foo:config1` OR `//foo:config2` OR `...`.

no_match_error optional. default is ""

Optional custom error to report if no condition matches.

Example:

```build
deps = selects.with_or({
    "//configs:one": [":dep1"],
    ("//configs:two", "//configs:three"): [":dep2or3"],
    "//configs:four": [":dep4"],
    "//conditions:default": [":default"]
})
```

Key labels may appear at most once anywhere in the input.
    </p>
  </td>
</tr>

selects.with_or_dict

selects.with_or_dict(input_dict)

Variation of with_or that returns the dict of the select().

Unlike select(), the contents of the dict can be inspected by Starlark macros.

Parameters

input_dict required.

Same as `with_or`.