diff options
author | Klaus Aehlig <klaus.aehlig@huawei.com> | 2024-11-05 16:27:50 +0100 |
---|---|---|
committer | Klaus Aehlig <klaus.aehlig@huawei.com> | 2024-11-06 14:37:16 +0100 |
commit | 9e7f2b68357dc1fbd073244e5a242a8317c8207d (patch) | |
tree | 971c37e846264da99390077e270b07daf7014caa | |
parent | 197a35703d1ced53f71d6137b9133d2558d888d4 (diff) | |
download | rules-cc-9e7f2b68357dc1fbd073244e5a242a8317c8207d.tar.gz |
Prefer built-in "nub_left"
Now that justbuild 1.4 is available, the workaround of defining
"nub_left" in terms of "reverse" and "nub_right" is no longer
necessary.
-rw-r--r-- | CC/RULES | 18 | ||||
-rw-r--r-- | CC/proto/RULES | 18 | ||||
-rw-r--r-- | EXPRESSIONS | 14 | ||||
-rw-r--r-- | lint/RULES | 22 | ||||
-rw-r--r-- | patch/RULES | 18 | ||||
-rw-r--r-- | shell/RULES | 44 |
6 files changed, 45 insertions, 89 deletions
@@ -99,7 +99,6 @@ , "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" @@ -180,17 +179,14 @@ ] , ["provider", "PATH"] , [ "PATH" - , { "type": "++" + , { "type": "nub_left" , "$1": - [ {"type": "var", "name": "PATH"} - , {"type": "CALL_EXPRESSION", "name": "base-provides-++"} - ] - } - ] - , [ "PATH" - , { "type": "let*" - , "bindings": [["list", {"type": "var", "name": "PATH"}]] - , "body": {"type": "CALL_EXPRESSION", "name": "nub_left"} + { "type": "++" + , "$1": + [ {"type": "var", "name": "PATH"} + , {"type": "CALL_EXPRESSION", "name": "base-provides-++"} + ] + } } ] , ["provider", "ENV"] diff --git a/CC/proto/RULES b/CC/proto/RULES index 2e4b1d3..07b2dad 100644 --- a/CC/proto/RULES +++ b/CC/proto/RULES @@ -83,7 +83,6 @@ , "base-provides-++": ["./", "..", "defaults-base-provides-++"] , "base-provides-list": ["./", "..", "defaults-base-provides-list"] , "artifacts_list": ["", "field_artifacts_list"] - , "nub_left": ["", "nub_left"] , "compile-deps": ["CC", "compile-deps"] , "compile-args-deps": ["CC", "compile-args-deps"] , "link-deps": ["CC", "link-deps"] @@ -137,17 +136,14 @@ ] , ["provider", "PATH"] , [ "PATH" - , { "type": "++" + , { "type": "nub_left" , "$1": - [ {"type": "var", "name": "PATH"} - , {"type": "CALL_EXPRESSION", "name": "base-provides-++"} - ] - } - ] - , [ "PATH" - , { "type": "let*" - , "bindings": [["list", {"type": "var", "name": "PATH"}]] - , "body": {"type": "CALL_EXPRESSION", "name": "nub_left"} + { "type": "++" + , "$1": + [ {"type": "var", "name": "PATH"} + , {"type": "CALL_EXPRESSION", "name": "base-provides-++"} + ] + } } ] , ["provider", "ENV"] diff --git a/EXPRESSIONS b/EXPRESSIONS index 52a381f..b974026 100644 --- a/EXPRESSIONS +++ b/EXPRESSIONS @@ -226,18 +226,4 @@ } } } -, "nub_left": - { "doc": ["Removes all but the leftmost duplicate from the list."] - , "vars": ["list"] - , "vars_doc": {"list": ["The list to remove duplicates from."]} - , "expression": - { "type": "let*" - , "bindings": - [ ["list", {"type": "reverse", "$1": {"type": "var", "name": "list"}}] - , ["list", {"type": "nub_right", "$1": {"type": "var", "name": "list"}}] - , ["list", {"type": "reverse", "$1": {"type": "var", "name": "list"}}] - ] - , "body": {"type": "var", "name": "list"} - } - } } @@ -21,23 +21,17 @@ { "type": "let*" , "bindings": [ [ "PATH" - , { "type": "reverse" + , { "type": "nub_left" , "$1": - { "type": "nub_right" + { "type": "++" , "$1": - { "type": "reverse" - , "$1": - { "type": "++" - , "$1": - [ {"type": "FIELD", "name": "PATH"} - , { "type": "let*" - , "bindings": [["provider", "PATH"]] - , "body": - {"type": "CALL_EXPRESSION", "name": "base-provides-++"} - } - ] + [ {"type": "FIELD", "name": "PATH"} + , { "type": "let*" + , "bindings": [["provider", "PATH"]] + , "body": + {"type": "CALL_EXPRESSION", "name": "base-provides-++"} } - } + ] } } ] diff --git a/patch/RULES b/patch/RULES index c55de58..ea495f0 100644 --- a/patch/RULES +++ b/patch/RULES @@ -32,7 +32,6 @@ , "base-provides-++": ["CC", "defaults-base-provides-++"] , "base-provides-list": ["CC", "defaults-base-provides-list"] , "artifacts_list": ["", "field_artifacts_list"] - , "nub_left": ["", "nub_left"] , "for host": ["transitions", "for host"] } , "config_transitions": @@ -52,17 +51,14 @@ ] , ["provider", "PATH"] , [ "PATH" - , { "type": "++" + , { "type": "nub_left" , "$1": - [ {"type": "var", "name": "PATH"} - , {"type": "CALL_EXPRESSION", "name": "base-provides-++"} - ] - } - ] - , [ "PATH" - , { "type": "let*" - , "bindings": [["list", {"type": "var", "name": "PATH"}]] - , "body": {"type": "CALL_EXPRESSION", "name": "nub_left"} + { "type": "++" + , "$1": + [ {"type": "var", "name": "PATH"} + , {"type": "CALL_EXPRESSION", "name": "base-provides-++"} + ] + } } ] , ["provider", "ENV"] diff --git a/shell/RULES b/shell/RULES index 5ac07e6..b9e91bb 100644 --- a/shell/RULES +++ b/shell/RULES @@ -116,44 +116,32 @@ } ] , [ "PATH" - , { "type": "reverse" + , { "type": "nub_left" , "$1": - { "type": "nub_right" + { "type": "++" , "$1": - { "type": "reverse" - , "$1": - { "type": "++" - , "$1": - [ {"type": "FIELD", "name": "PATH"} - , { "type": "let*" - , "bindings": [["provider", "PATH"]] - , "body": - {"type": "CALL_EXPRESSION", "name": "base-provides-++"} - } - ] + [ {"type": "FIELD", "name": "PATH"} + , { "type": "let*" + , "bindings": [["provider", "PATH"]] + , "body": + {"type": "CALL_EXPRESSION", "name": "base-provides-++"} } - } + ] } } ] , [ "bin dirs" - , { "type": "reverse" + , { "type": "nub_left" , "$1": - { "type": "nub_right" + { "type": "++" , "$1": - { "type": "reverse" - , "$1": - { "type": "++" - , "$1": - [ {"type": "FIELD", "name": "bin dirs"} - , { "type": "let*" - , "bindings": [["provider", "bin dirs"]] - , "body": - {"type": "CALL_EXPRESSION", "name": "base-provides-++"} - } - ] + [ {"type": "FIELD", "name": "bin dirs"} + , { "type": "let*" + , "bindings": [["provider", "bin dirs"]] + , "body": + {"type": "CALL_EXPRESSION", "name": "base-provides-++"} } - } + ] } } ] |