summaryrefslogtreecommitdiff
path: root/rules
diff options
context:
space:
mode:
authorOliver Reiche <oliver.reiche@huawei.com>2023-04-25 17:35:35 +0200
committerOliver Reiche <oliver.reiche@huawei.com>2023-04-26 11:31:04 +0200
commit8c6b892d05403b75650bdb494c9cc7dd94d77ba4 (patch)
treeefb1789fefe5d69c05619675ebb19de30b31204f /rules
parent91c21de2706b7705a23a328d7fa1fa3944a0d223 (diff)
downloadjustbuild-8c6b892d05403b75650bdb494c9cc7dd94d77ba4.tar.gz
rules: Support mixing system/toolchain for protoc/grpc
Diffstat (limited to 'rules')
-rw-r--r--rules/CC/proto/EXPRESSIONS38
-rw-r--r--rules/CC/proto/RULES41
2 files changed, 77 insertions, 2 deletions
diff --git a/rules/CC/proto/EXPRESSIONS b/rules/CC/proto/EXPRESSIONS
index 6f514964..894b80bc 100644
--- a/rules/CC/proto/EXPRESSIONS
+++ b/rules/CC/proto/EXPRESSIONS
@@ -75,6 +75,28 @@
, "body": {"type": "CALL_EXPRESSION", "name": "map_provider"}
}
}
+, "default-NON_SYSTEM_TOOLS":
+ { "vars": ["defaults-transition"]
+ , "expression":
+ { "type": "map_union"
+ , "$1":
+ { "type": "foreach"
+ , "var": "x"
+ , "range": {"type": "FIELD", "name": "proto-defaults"}
+ , "body":
+ { "type": "DEP_PROVIDES"
+ , "dep": {"type": "var", "name": "x"}
+ , "provider": "NON_SYSTEM_TOOLS"
+ , "transition":
+ { "type": "var"
+ , "name": "defaults-transition"
+ , "default": {"type": "empty_map"}
+ }
+ , "default": {"type": "empty_map"}
+ }
+ }
+ }
+ }
, "protoc-deps":
{ "imports": {"map_provider": ["./", "../..", "field_map_provider"]}
, "expression":
@@ -107,6 +129,7 @@
, "default-GRPC_PLUGIN": "default-GRPC_PLUGIN"
, "default-ENV": "default-ENV"
, "default-TOOLCHAIN": "default-TOOLCHAIN"
+ , "default-NON_SYSTEM_TOOLS": "default-NON_SYSTEM_TOOLS"
}
, "expression":
{ "type": "let*"
@@ -125,13 +148,20 @@
, "else": {"type": "empty_map"}
}
]
+ , [ "NON_SYSTEM_TOOLS"
+ , {"type": "CALL_EXPRESSION", "name": "default-NON_SYSTEM_TOOLS"}
+ ]
, [ "PROTOC"
, { "type": "join"
, "$1":
{ "type": "++"
, "$1":
[ { "type": "if"
- , "cond": {"type": "var", "name": "TOOLCHAIN"}
+ , "cond":
+ { "type": "lookup"
+ , "key": "PROTOC"
+ , "map": {"type": "var", "name": "NON_SYSTEM_TOOLS"}
+ }
, "then": ["./", {"type": "var", "name": "TOOLCHAIN_DIR"}, "/"]
}
, {"type": "CALL_EXPRESSION", "name": "default-PROTOC"}
@@ -145,7 +175,11 @@
{ "type": "++"
, "$1":
[ { "type": "if"
- , "cond": {"type": "var", "name": "TOOLCHAIN"}
+ , "cond":
+ { "type": "lookup"
+ , "key": "GRPC_PLUGIN"
+ , "map": {"type": "var", "name": "NON_SYSTEM_TOOLS"}
+ }
, "then": ["./", {"type": "var", "name": "TOOLCHAIN_DIR"}, "/"]
}
, {"type": "CALL_EXPRESSION", "name": "default-GRPC_PLUGIN"}
diff --git a/rules/CC/proto/RULES b/rules/CC/proto/RULES
index c6568cd9..6d2e7251 100644
--- a/rules/CC/proto/RULES
+++ b/rules/CC/proto/RULES
@@ -115,6 +115,46 @@
, "else": {"type": "CALL_EXPRESSION", "name": "base-provides"}
}
]
+ , ["provider", "NON_SYSTEM_TOOLS"]
+ , ["default", {"type": "empty_map"}]
+ , [ "NON_SYSTEM_TOOLS"
+ , { "type": "map_union"
+ , "$1":
+ { "type": "++"
+ , "$1":
+ [ [{"type": "CALL_EXPRESSION", "name": "base-provides"}]
+ , { "type": "if"
+ , "cond": {"type": "FIELD", "name": "PROTOC"}
+ , "then":
+ [ { "type": "singleton_map"
+ , "key": "PROTOC"
+ , "value":
+ { "type": "if"
+ , "cond": {"type": "FIELD", "name": "toolchain"}
+ , "then": true
+ , "else": false
+ }
+ }
+ ]
+ }
+ , { "type": "if"
+ , "cond": {"type": "FIELD", "name": "GRPC_PLUGIN"}
+ , "then":
+ [ { "type": "singleton_map"
+ , "key": "GRPC_PLUGIN"
+ , "value":
+ { "type": "if"
+ , "cond": {"type": "FIELD", "name": "toolchain"}
+ , "then": true
+ , "else": false
+ }
+ }
+ ]
+ }
+ ]
+ }
+ }
+ ]
, ["provider", "TOOLCHAIN"]
, ["default", {"type": "empty_map"}]
, [ "TOOLCHAIN"
@@ -171,6 +211,7 @@
, "GRPC_PLUGIN"
, "ENV"
, "TOOLCHAIN"
+ , "NON_SYSTEM_TOOLS"
, "compile-deps"
, "compile-args"
, "link-deps"