diff options
author | Oliver Reiche <oliver.reiche@huawei.com> | 2023-07-21 15:20:51 +0200 |
---|---|---|
committer | Oliver Reiche <oliver.reiche@huawei.com> | 2023-08-16 15:30:32 +0200 |
commit | 161772df4241adefd2ff3440f00ee72d13987bf8 (patch) | |
tree | 2221d244c567708879c6905af1c410eb14399971 /CC/RULES | |
parent | f61161f05e88b42e9ee141a8fd4809f0e4f4e0c6 (diff) | |
download | rules-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/RULES')
-rw-r--r-- | CC/RULES | 35 |
1 files changed, 20 insertions, 15 deletions
@@ -66,7 +66,7 @@ ] , "PATH": [ "Path for looking up the compilers. Individual paths are joined" - , "with \":\"." + , "with \":\". Specifying this field extends values from \"base\"." ] } , "config_vars": ["ARCH", "HOST_ARCH"] @@ -74,6 +74,7 @@ { "base-provides": "defaults-base-provides" , "base-provides-list": "defaults-base-provides-list" , "artifacts_list": ["./", "..", "field_artifacts_list"] + , "nub_left": ["", "nub_left"] , "compile-deps": "compile-deps" , "compile-args-deps": "compile-args-deps" , "link-deps": "link-deps" @@ -142,23 +143,26 @@ , "else": {"type": "CALL_EXPRESSION", "name": "base-provides"} } ] - , ["provider", "ENV"] - , ["default", {"type": "empty_map"}] - , [ "ENV" - , { "type": "if" - , "cond": {"type": "var", "name": "PATH"} - , "then": - { "type": "singleton_map" - , "key": "PATH" - , "value": - { "type": "join" - , "separator": ":" - , "$1": {"type": "var", "name": "PATH"} + , ["provider", "PATH"] + , [ "PATH" + , { "type": "++" + , "$1": + [ {"type": "var", "name": "PATH"} + , { "type": "++" + , "$1": {"type": "CALL_EXPRESSION", "name": "base-provides-list"} } - } - , "else": {"type": "CALL_EXPRESSION", "name": "base-provides"} + ] + } + ] + , [ "PATH" + , { "type": "let*" + , "bindings": [["list", {"type": "var", "name": "PATH"}]] + , "body": {"type": "CALL_EXPRESSION", "name": "nub_left"} } ] + , ["provider", "ENV"] + , ["default", {"type": "empty_map"}] + , ["ENV", {"type": "CALL_EXPRESSION", "name": "base-provides"}] , ["provider", "NON_SYSTEM_TOOLS"] , ["default", {"type": "empty_map"}] , [ "NON_SYSTEM_TOOLS" @@ -299,6 +303,7 @@ , "CXXFLAGS" , "LDFLAGS" , "AR" + , "PATH" , "ENV" , "TOOLCHAIN" , "NON_SYSTEM_TOOLS" |