diff options
author | Oliver Reiche <oliver.reiche@huawei.com> | 2022-04-26 16:51:01 +0200 |
---|---|---|
committer | Oliver Reiche <oliver.reiche@huawei.com> | 2022-04-26 18:24:36 +0200 |
commit | 8bbb5274b2779aae44a0c4f76da8df08cf63da84 (patch) | |
tree | 5787e11a0e441a23c37976f02b92ab6ff96064bd /EXPRESSIONS | |
parent | 6fa381769ea5ac3505cc202ae442eb7fee35f4ce (diff) | |
download | rules-cc-8bbb5274b2779aae44a0c4f76da8df08cf63da84.tar.gz |
rules: Add field_artifacts_list and field_runfiles_list
... which are more efficient if the caller wants to perform
the union manually (because disjointness should be enforced
or additional maps should be added to the union, etc.). As a
positive side effect, code reuse is slightly increased by
consistently calling these newly introduced expressions for
obtaining the artifacts/runfiles from all targets of a
target field.
Diffstat (limited to 'EXPRESSIONS')
-rw-r--r-- | EXPRESSIONS | 86 |
1 files changed, 54 insertions, 32 deletions
diff --git a/EXPRESSIONS b/EXPRESSIONS index 8c53612..3251f92 100644 --- a/EXPRESSIONS +++ b/EXPRESSIONS @@ -1,43 +1,65 @@ -{ "field_artifacts": - { "vars": ["fieldname", "transition"] +{ "field_artifacts_list": + { "doc": ["Query list of artifacts from target_field's targets"] + , "vars": ["fieldname", "transition"] + , "vars_doc": + { "fieldname": "The name of the target_field to query." + , "transition": "The optional configuration transition for the targets." + } + , "expression": + { "type": "foreach" + , "var": "x" + , "range": {"type": "FIELD", "name": {"type": "var", "name": "fieldname"}} + , "body": + { "type": "DEP_ARTIFACTS" + , "dep": {"type": "var", "name": "x"} + , "transition": + {"type": "var", "name": "transition", "default": {"type": "empty_map"}} + } + } + } +, "field_artifacts": + { "doc": ["Query and merge artifacts from target_field's targets"] + , "vars": ["fieldname", "transition"] + , "vars_doc": + { "fieldname": "The name of the target_field to query." + , "transition": "The optional configuration transition for the targets." + } + , "imports": {"artifacts_list": "field_artifacts_list"} , "expression": { "type": "map_union" - , "$1": - { "type": "foreach" - , "var": "x" - , "range": - {"type": "FIELD", "name": {"type": "var", "name": "fieldname"}} - , "body": - { "type": "DEP_ARTIFACTS" - , "dep": {"type": "var", "name": "x"} - , "transition": - { "type": "var" - , "name": "transition" - , "default": {"type": "empty_map"} - } - } + , "$1": {"type": "CALL_EXPRESSION", "name": "artifacts_list"} + } + } +, "field_runfiles_list": + { "doc": ["Query list of runfiles from target_field's targets"] + , "vars": ["fieldname", "transition"] + , "vars_doc": + { "fieldname": "The name of the target_field to query." + , "transition": "The optional configuration transition for the targets." + } + , "expression": + { "type": "foreach" + , "var": "x" + , "range": {"type": "FIELD", "name": {"type": "var", "name": "fieldname"}} + , "body": + { "type": "DEP_RUNFILES" + , "dep": {"type": "var", "name": "x"} + , "transition": + {"type": "var", "name": "transition", "default": {"type": "empty_map"}} } } } , "field_runfiles": - { "vars": ["fieldname", "transition"] + { "doc": ["Query and merge runfiles from target_field's targets"] + , "vars": ["fieldname", "transition"] + , "vars_doc": + { "fieldname": "The name of the target_field to query." + , "transition": "The optional configuration transition for the targets." + } + , "imports": {"runfiles_list": "field_runfiles_list"} , "expression": { "type": "map_union" - , "$1": - { "type": "foreach" - , "var": "x" - , "range": - {"type": "FIELD", "name": {"type": "var", "name": "fieldname"}} - , "body": - { "type": "DEP_RUNFILES" - , "dep": {"type": "var", "name": "x"} - , "transition": - { "type": "var" - , "name": "transition" - , "default": {"type": "empty_map"} - } - } - } + , "$1": {"type": "CALL_EXPRESSION", "name": "runfiles_list"} } } , "action_env": |