summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOliver Reiche <oliver.reiche@huawei.com>2022-04-26 11:47:35 +0200
committerOliver Reiche <oliver.reiche@huawei.com>2022-04-28 13:44:27 +0200
commit076dd3cdebb6b8662eb1c716261a78b83cb74e0c (patch)
tree940046421100f0398c8cc81997f0bdab038fbfbd
parent6929477049c34c34627c6bba82b35f33c3c84fa0 (diff)
downloadrules-cc-076dd3cdebb6b8662eb1c716261a78b83cb74e0c.tar.gz
rules: Add "field_map_provider" and "field_list_provider"
... to query and merge map/list entries from the provides map of the given target_fields' targets.
-rw-r--r--EXPRESSIONS53
1 files changed, 53 insertions, 0 deletions
diff --git a/EXPRESSIONS b/EXPRESSIONS
index 8ead00f..e725606 100644
--- a/EXPRESSIONS
+++ b/EXPRESSIONS
@@ -62,6 +62,59 @@
, "$1": {"type": "CALL_EXPRESSION", "name": "runfiles_list"}
}
}
+, "field_provider_list":
+ { "doc": ["Query list of providers from targets' provides map"]
+ , "vars": ["fieldname", "provider", "transition", "default"]
+ , "vars_doc":
+ { "fieldname": ["The name of the target_field to query."]
+ , "provider": ["The name of the map provider in the provides map."]
+ , "transition": ["The optional configuration transition for the targets."]
+ , "default": ["The default if the provider was not found (default: [])."]
+ }
+ , "expression":
+ { "type": "foreach"
+ , "var": "x"
+ , "range": {"type": "FIELD", "name": {"type": "var", "name": "fieldname"}}
+ , "body":
+ { "type": "DEP_PROVIDES"
+ , "dep": {"type": "var", "name": "x"}
+ , "provider": {"type": "var", "name": "provider"}
+ , "transition":
+ {"type": "var", "name": "transition", "default": {"type": "empty_map"}}
+ , "default": {"type": "var", "name": "default", "default": []}
+ }
+ }
+ }
+, "field_map_provider":
+ { "doc": ["Query and merge map-providers from targets' provides map"]
+ , "vars": ["fieldname", "provider", "transition"]
+ , "vars_doc":
+ { "fieldname": ["The name of the target_field to query."]
+ , "provider": ["The name of the map provider in the provides map."]
+ , "transition": ["The optional configuration transition for the targets."]
+ }
+ , "imports": {"provider_list": "field_provider_list"}
+ , "expression":
+ { "type": "map_union"
+ , "$1":
+ { "type": "let*"
+ , "bindings": [["default", {"type": "empty_map"}]]
+ , "body": {"type": "CALL_EXPRESSION", "name": "provider_list"}
+ }
+ }
+ }
+, "field_list_provider":
+ { "doc": ["Query and merge list-providers from targets' provides map"]
+ , "vars": ["fieldname", "provider", "transition"]
+ , "vars_doc":
+ { "fieldname": ["The name of the target_field to query."]
+ , "provider": ["The name of the list provider in the provides map."]
+ , "transition": ["The optional configuration transition for the targets."]
+ }
+ , "imports": {"provider_list": "field_provider_list"}
+ , "expression":
+ {"type": "++", "$1": {"type": "CALL_EXPRESSION", "name": "provider_list"}}
+ }
, "action_env":
{ "vars": ["ENV"]
, "expression":