summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKlaus Aehlig <klaus.aehlig@huawei.com>2022-05-12 14:18:24 +0200
committerKlaus Aehlig <klaus.aehlig@huawei.com>2022-05-12 14:33:55 +0200
commit7990e2dd1c3cfd99d216afd91b638a0e12156de2 (patch)
tree4a20c941747f734d8746a4953381267c246a49a4
parentb49842343371d1b0c99c3abf438a2490e1be372e (diff)
downloadrules-cc-7990e2dd1c3cfd99d216afd91b638a0e12156de2.tar.gz
["data", "staged"] Allow direct dependencies
Add a "deps" field to ["data", "staged"] from which the runfiles also added, without being staged, e.g., another ["data", "staged"] target, possibly with a different stage. This allows convenient collection of files, logically put to different directories.
-rw-r--r--data/RULES28
1 files changed, 24 insertions, 4 deletions
diff --git a/data/RULES b/data/RULES
index df6acce..02f8e11 100644
--- a/data/RULES
+++ b/data/RULES
@@ -1,6 +1,6 @@
{ "staged":
{ "doc": ["Stage data to a logical subdirectory."]
- , "target_fields": ["srcs"]
+ , "target_fields": ["srcs", "deps"]
, "string_fields": ["stage"]
, "field_doc":
{ "srcs": ["The files to be staged"]
@@ -8,10 +8,15 @@
[ "The logical directory to stage the files to."
, "Individual directory components are joined with \"/\"."
]
+ , "deps":
+ [ "Targets of with their runfiles should be added as well."
+ , "Their staging is not changed."
+ ]
}
, "artifacts_doc":
[ "The runfiles of the \"srcs\" targets staged to the directory"
- , "specified in \"stage\"."
+ , "specified in \"stage\" together the runfiles of the targets"
+ , "specied in the field \"deps\" (in their original location)."
]
, "runfiles_doc": ["Same as artifacts"]
, "imports": {"runfiles": ["./", "..", "field_runfiles"]}
@@ -36,11 +41,26 @@
, "$1": {"type": "var", "name": "srcs"}
}
]
+ , [ "dep stage"
+ , { "type": "let*"
+ , "bindings": [["fieldname", "deps"]]
+ , "body": {"type": "CALL_EXPRESSION", "name": "runfiles"}
+ }
+ ]
+ , [ "total"
+ , { "type": "disjoint_map_union"
+ , "msg": "Conflict between staged data and dependencies"
+ , "$1":
+ [ {"type": "var", "name": "dep stage"}
+ , {"type": "var", "name": "staged"}
+ ]
+ }
+ ]
]
, "body":
{ "type": "RESULT"
- , "artifacts": {"type": "var", "name": "staged"}
- , "runfiles": {"type": "var", "name": "staged"}
+ , "artifacts": {"type": "var", "name": "total"}
+ , "runfiles": {"type": "var", "name": "total"}
}
}
}