summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOliver Reiche <oliver.reiche@huawei.com>2022-02-24 11:27:51 +0100
committerOliver Reiche <oliver.reiche@huawei.com>2022-02-25 10:34:03 +0100
commit10600edede9d4faf7ee2384ae25d5fb5c9af09b0 (patch)
treeda76d2517638489d68d5c50424dbd6b9bef5d142
parent741ef53eab173e10a6e935319ee1af1acdd37273 (diff)
downloadrules-cc-10600edede9d4faf7ee2384ae25d5fb5c9af09b0.tar.gz
rules: Add CC/proto/IDE headers
... to manually request the generation of headers for CC proto bindings. This is useful for IDEs and needed as implicitly generating those bindings via the `proto` field of CC libraries does not expose the produced headers.
-rw-r--r--CC/proto/IDE/RULES63
1 files changed, 63 insertions, 0 deletions
diff --git a/CC/proto/IDE/RULES b/CC/proto/IDE/RULES
new file mode 100644
index 0000000..558e494
--- /dev/null
+++ b/CC/proto/IDE/RULES
@@ -0,0 +1,63 @@
+{ "headers":
+ { "doc": ["Headers of C++ proto binding"]
+ , "target_fields": ["proto"]
+ , "string_fields": ["stage"]
+ , "field_doc":
+ { "proto": ["The proto source files to create the binding from."]
+ , "stage":
+ [ "The logical location of the header files. Individual directory"
+ , "components are joined with \"/\"."
+ ]
+ }
+ , "anonymous":
+ { "proto-deps":
+ { "target": "proto"
+ , "provider": "proto"
+ , "rule_map":
+ { "library": ["./", "..", "library"]
+ , "service library": ["./", "..", "service library"]
+ }
+ }
+ }
+ , "imports": {"runfiles": ["./", "../../..", "field_runfiles"]}
+ , "expression":
+ { "type": "let*"
+ , "bindings":
+ [ [ "stage"
+ , { "type": "join"
+ , "separator": "/"
+ , "$1": {"type": "FIELD", "name": "stage"}
+ }
+ ]
+ ]
+ , "body":
+ { "type": "RESULT"
+ , "artifacts":
+ { "type": "to_subdir"
+ , "subdir": {"type": "var", "name": "stage"}
+ , "$1":
+ { "type": "map_union"
+ , "$1":
+ [ { "type": "let*"
+ , "bindings": [["fieldname", "proto-deps"]]
+ , "body": {"type": "CALL_EXPRESSION", "name": "runfiles"}
+ }
+ , { "type": "map_union"
+ , "$1":
+ { "type": "foreach"
+ , "var": "x"
+ , "range": {"type": "FIELD", "name": "proto-deps"}
+ , "body":
+ { "type": "DEP_PROVIDES"
+ , "provider": "compile-deps"
+ , "dep": {"type": "var", "name": "x"}
+ }
+ }
+ }
+ ]
+ }
+ }
+ }
+ }
+ }
+}