• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<!-- Generated with Stardoc: http://skydoc.bazel.build -->
2
3Skylib module containing convenience interfaces for select().
4
5<a id="#selects.with_or"></a>
6
7## selects.with_or
8
9<pre>
10selects.with_or(<a href="#selects.with_or-input_dict">input_dict</a>, <a href="#selects.with_or-no_match_error">no_match_error</a>)
11</pre>
12
13Drop-in replacement for `select()` that supports ORed keys.
14
15Example:
16
17      ```build
18      deps = selects.with_or({
19          "//configs:one": [":dep1"],
20          ("//configs:two", "//configs:three"): [":dep2or3"],
21          "//configs:four": [":dep4"],
22          "//conditions:default": [":default"]
23      })
24      ```
25
26      Key labels may appear at most once anywhere in the input.
27
28
29**PARAMETERS**
30
31
32| Name  | Description | Default Value |
33| :------------- | :------------- | :------------- |
34| <a id="selects.with_or-input_dict"></a>input_dict |  The same dictionary <code>select()</code> takes, except keys may take either the usual form <code>"//foo:config1"</code> or <code>("//foo:config1", "//foo:config2", ...)</code> to signify <code>//foo:config1</code> OR <code>//foo:config2</code> OR <code>...</code>.   |  none |
35| <a id="selects.with_or-no_match_error"></a>no_match_error |  Optional custom error to report if no condition matches.   |  <code>""</code> |
36
37**RETURNS**
38
39A native `select()` that expands
40
41`("//configs:two", "//configs:three"): [":dep2or3"]`
42
43to
44
45```build
46"//configs:two": [":dep2or3"],
47"//configs:three": [":dep2or3"],
48```
49
50
51<a id="#selects.with_or_dict"></a>
52
53## selects.with_or_dict
54
55<pre>
56selects.with_or_dict(<a href="#selects.with_or_dict-input_dict">input_dict</a>)
57</pre>
58
59Variation of `with_or` that returns the dict of the `select()`.
60
61Unlike `select()`, the contents of the dict can be inspected by Starlark
62macros.
63
64
65**PARAMETERS**
66
67
68| Name  | Description | Default Value |
69| :------------- | :------------- | :------------- |
70| <a id="selects.with_or_dict-input_dict"></a>input_dict |  Same as <code>with_or</code>.   |  none |
71
72**RETURNS**
73
74A dictionary usable by a native `select()`.
75
76
77<a id="#selects.config_setting_group"></a>
78
79## selects.config_setting_group
80
81<pre>
82selects.config_setting_group(<a href="#selects.config_setting_group-name">name</a>, <a href="#selects.config_setting_group-match_any">match_any</a>, <a href="#selects.config_setting_group-match_all">match_all</a>, <a href="#selects.config_setting_group-visibility">visibility</a>)
83</pre>
84
85Matches if all or any of its member `config_setting`s match.
86
87Example:
88
89  ```build
90  config_setting(name = "one", define_values = {"foo": "true"})
91  config_setting(name = "two", define_values = {"bar": "false"})
92  config_setting(name = "three", define_values = {"baz": "more_false"})
93
94  config_setting_group(
95      name = "one_two_three",
96      match_all = [":one", ":two", ":three"]
97  )
98
99  cc_binary(
100      name = "myapp",
101      srcs = ["myapp.cc"],
102      deps = select({
103          ":one_two_three": [":special_deps"],
104          "//conditions:default": [":default_deps"]
105      })
106  ```
107
108
109**PARAMETERS**
110
111
112| Name  | Description | Default Value |
113| :------------- | :------------- | :------------- |
114| <a id="selects.config_setting_group-name"></a>name |  The group's name. This is how <code>select()</code>s reference it.   |  none |
115| <a id="selects.config_setting_group-match_any"></a>match_any |  A list of <code>config_settings</code>. This group matches if *any* member in the list matches. If this is set, <code>match_all</code> must not be set.   |  <code>[]</code> |
116| <a id="selects.config_setting_group-match_all"></a>match_all |  A list of <code>config_settings</code>. This group matches if *every* member in the list matches. If this is set, <code>match_any</code> must be not set.   |  <code>[]</code> |
117| <a id="selects.config_setting_group-visibility"></a>visibility |  Visibility of the config_setting_group.   |  <code>None</code> |
118
119
120