From f54fda7279b234a3d2960de514339592ef258a2f Mon Sep 17 00:00:00 2001 From: Oliver Reiche Date: Tue, 11 Apr 2023 18:53:05 +0200 Subject: rules: Support install-with-deps rule Backport of commits a382b308b9011606e7d07376808812d51631d558 and 5ae5134804b6edaaffec593868f133dd840ef7df from the rules-cc repository. --- EXPRESSIONS | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) (limited to 'EXPRESSIONS') 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 + } + } + } } -- cgit v1.2.3