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