summaryrefslogtreecommitdiff
path: root/CC/proto/EXPRESSIONS
diff options
context:
space:
mode:
authorOliver Reiche <oliver.reiche@huawei.com>2023-07-21 15:20:51 +0200
committerOliver Reiche <oliver.reiche@huawei.com>2023-08-16 15:30:32 +0200
commit161772df4241adefd2ff3440f00ee72d13987bf8 (patch)
tree2221d244c567708879c6905af1c410eb14399971 /CC/proto/EXPRESSIONS
parentf61161f05e88b42e9ee141a8fd4809f0e4f4e0c6 (diff)
downloadrules-cc-161772df4241adefd2ff3440f00ee72d13987bf8.tar.gz
rules: Propagate PATH list from defaults
... instead of creating an ENV from it and propagating this. The idea is to keep PATH entries separate and only join them with ":" when we need it. In this way, we can accumulate PATHs from multiple defaults later, and perform a deduplication ("nub_left") to shorten the final string length.
Diffstat (limited to 'CC/proto/EXPRESSIONS')
-rw-r--r--CC/proto/EXPRESSIONS46
1 files changed, 45 insertions, 1 deletions
diff --git a/CC/proto/EXPRESSIONS b/CC/proto/EXPRESSIONS
index 84d3d55..29c205c 100644
--- a/CC/proto/EXPRESSIONS
+++ b/CC/proto/EXPRESSIONS
@@ -51,6 +51,19 @@
, "body": {"type": "CALL_EXPRESSION", "name": "map_provider"}
}
}
+, "default-PATH":
+ { "vars": ["defaults-transition"]
+ , "imports": {"list_provider": ["./", "../..", "field_list_provider"]}
+ , "expression":
+ { "type": "let*"
+ , "bindings":
+ [ ["fieldname", "proto-defaults"]
+ , ["provider", "PATH"]
+ , ["transition", {"type": "var", "name": "defaults-transition"}]
+ ]
+ , "body": {"type": "CALL_EXPRESSION", "name": "list_provider"}
+ }
+ }
, "default-TOOLCHAIN":
{ "vars": ["defaults-transition"]
, "imports": {"map_provider": ["./", "../..", "field_map_provider"]}
@@ -118,6 +131,7 @@
, "default-LDFLAGS": "default-LDFLAGS"
, "default-GRPC_PLUGIN": "default-GRPC_PLUGIN"
, "default-ENV": "default-ENV"
+ , "default-PATH": "default-PATH"
, "default-TOOLCHAIN": "default-TOOLCHAIN"
, "default-NON_SYSTEM_TOOLS": "default-NON_SYSTEM_TOOLS"
}
@@ -172,7 +186,7 @@
}
}
]
- , [ "protoc-ENV"
+ , [ "ENV"
, { "type": "map_union"
, "$1":
[ {"type": "CALL_EXPRESSION", "name": "default-ENV"}
@@ -180,6 +194,36 @@
]
}
]
+ , [ "ENV_PATH"
+ , { "type": "lookup"
+ , "map": {"type": "var", "name": "ENV"}
+ , "key": "PATH"
+ }
+ ]
+ , [ "protoc-ENV"
+ , { "type": "map_union"
+ , "$1":
+ [ {"type": "var", "name": "ENV"}
+ , { "type": "singleton_map"
+ , "key": "PATH"
+ , "value":
+ { "type": "join"
+ , "separator": ":"
+ , "$1":
+ { "type": "++"
+ , "$1":
+ [ {"type": "CALL_EXPRESSION", "name": "default-PATH"}
+ , { "type": "if"
+ , "cond": {"type": "var", "name": "ENV_PATH"}
+ , "then": [{"type": "var", "name": "ENV_PATH"}]
+ }
+ ]
+ }
+ }
+ }
+ ]
+ }
+ ]
, ["protoc-deps", {"type": "CALL_EXPRESSION", "name": "protoc-deps"}]
, [ "proto srcs"
, { "type": "disjoint_map_union"