From 54bb2a33b3e36123f8f411f77ec8e76f5b021e3d Mon Sep 17 00:00:00 2001 From: Oliver Reiche Date: Wed, 16 Aug 2023 15:10:31 +0200 Subject: 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. --- CC/foreign/EXPRESSIONS | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'CC/foreign/EXPRESSIONS') diff --git a/CC/foreign/EXPRESSIONS b/CC/foreign/EXPRESSIONS index 64e0e27..1692f83 100644 --- a/CC/foreign/EXPRESSIONS +++ b/CC/foreign/EXPRESSIONS @@ -43,6 +43,7 @@ , "imports": { "compiler-cc": ["CC", "compiler-cc"] , "default-ENV": ["CC", "default-ENV"] + , "default-PATH": ["CC", "default-PATH"] , "default-TOOLCHAIN": ["CC", "default-TOOLCHAIN"] , "default-NON_SYSTEM_TOOLS": ["CC", "default-NON_SYSTEM_TOOLS"] } @@ -69,6 +70,36 @@ ] } ] + , [ "ENV_PATH" + , { "type": "lookup" + , "map": {"type": "var", "name": "ENV"} + , "key": "PATH" + } + ] + , [ "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"}] + } + ] + } + } + } + ] + } + ] , [ "expand_exec.c" , { "type": "singleton_map" , "key": "expand_exec.c" -- cgit v1.2.3