diff options
author | Oliver Reiche <oliver.reiche@huawei.com> | 2023-04-11 18:53:05 +0200 |
---|---|---|
committer | Klaus Aehlig <klaus.aehlig@huawei.com> | 2023-04-18 12:44:10 +0200 |
commit | f54fda7279b234a3d2960de514339592ef258a2f (patch) | |
tree | afe2e0c1adc324d089bf247803b33eeaa8a259f3 /EXPRESSIONS | |
parent | 6eefec871e09b3d74b4861beec010fdaf9e47b85 (diff) | |
download | rules-cc-f54fda7279b234a3d2960de514339592ef258a2f.tar.gz |
rules: Support install-with-deps rule
Backport of commits a382b308b9011606e7d07376808812d51631d558
and 5ae5134804b6edaaffec593868f133dd840ef7df from the
rules-cc repository.
Diffstat (limited to 'EXPRESSIONS')
-rw-r--r-- | EXPRESSIONS | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/EXPRESSIONS b/EXPRESSIONS index b974026..c84ebf4 100644 --- a/EXPRESSIONS +++ b/EXPRESSIONS @@ -226,4 +226,51 @@ } } } +, "contains": + { "doc": ["Returns the item if it is in the list or \"null\" otherwise."] + , "vars": ["list", "item", "list_prefix"] + , "vars_doc": + { "list": ["The list to look for the item."] + , "item": ["The item to look for in the list."] + , "list_prefix": + [ "An optional string, which every item in the list is prefixed with" + , "before comparison. Note that the returned item is not prefixed." + ] + } + , "expression": + { "type": "let*" + , "bindings": + [ [ "result" + , { "type": "++" + , "$1": + { "type": "foreach" + , "var": "entry" + , "range": {"type": "var", "name": "list"} + , "body": + { "type": "if" + , "cond": + { "type": "==" + , "$1": + { "type": "join" + , "$1": + [ {"type": "var", "name": "list_prefix", "default": ""} + , {"type": "var", "name": "entry"} + ] + } + , "$2": {"type": "var", "name": "item"} + } + , "then": [{"type": "var", "name": "entry"}] + } + } + } + ] + ] + , "body": + { "type": "if" + , "cond": {"type": "var", "name": "result"} + , "then": {"type": "join", "$1": {"type": "var", "name": "result"}} + , "else": null + } + } + } } |