From 8d810e663ff4995bbceb1f16e1fb02387d76b68f Mon Sep 17 00:00:00 2001 From: Klaus Aehlig Date: Mon, 22 Aug 2022 12:29:58 +0200 Subject: Add a rule to overlay artifact maps ... in a latest-wins fashion. The intended use case is overlaying globs with individual patched files. --- data/RULES | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/data/RULES b/data/RULES index 02f8e11..99c8e5c 100644 --- a/data/RULES +++ b/data/RULES @@ -64,4 +64,37 @@ } } } +, "overlay": + { "doc": + ["Overlay the artifacts of \"deps\" targets in a latest-wins fashion."] + , "target_fields": ["deps"] + , "field_doc": {"deps": ["The targets of which to overlay the artifacts"]} + , "artifacts_doc": + [ "Artifacts of the targets specified in \"deps\". For conflicting" + , "logical paths, the artifact is taken from the latest target (in" + , "the \"deps\" field) that defines that logical path" + ] + , "runfiles_doc": ["Same as artifacts"] + , "expression": + { "type": "let*" + , "bindings": + [ [ "all" + , { "type": "map_union" + , "$1": + { "type": "foreach" + , "var": "dep" + , "range": {"type": "FIELD", "name": "deps"} + , "body": + {"type": "DEP_ARTIFACTS", "dep": {"type": "var", "name": "dep"}} + } + } + ] + ] + , "body": + { "type": "RESULT" + , "artifacts": {"type": "var", "name": "all"} + , "runfiles": {"type": "var", "name": "all"} + } + } + } } -- cgit v1.2.3