diff options
author | Klaus Aehlig <klaus.aehlig@huawei.com> | 2024-11-06 14:45:05 +0100 |
---|---|---|
committer | Klaus Aehlig <klaus.aehlig@huawei.com> | 2024-11-06 14:45:05 +0100 |
commit | 2b07a15b20ed814f253ec3bc7f0ee089ccd066f2 (patch) | |
tree | 9f82bf2e8ee68092eac3431b3423217ddfb531b6 | |
parent | 5803ce704eb9cf9c30235e82856ed738486256e1 (diff) | |
parent | 1e099fbbb5648177ceded11a7a56e6ca9e9103ac (diff) | |
download | rules-cc-2b07a15b20ed814f253ec3bc7f0ee089ccd066f2.tar.gz |
Merge branch 'just-rules' into rules
-rw-r--r-- | CC/EXPRESSIONS | 12 | ||||
-rw-r--r-- | CC/RULES | 18 | ||||
-rw-r--r-- | CC/proto/RULES | 18 | ||||
-rw-r--r-- | CC/test/EXPRESSIONS | 17 | ||||
-rw-r--r-- | EXPRESSIONS | 16 | ||||
-rw-r--r-- | lint/RULES | 25 | ||||
-rw-r--r-- | patch/RULES | 18 | ||||
-rw-r--r-- | shell/RULES | 44 | ||||
-rw-r--r-- | shell/test/RULES | 17 |
9 files changed, 63 insertions, 122 deletions
diff --git a/CC/EXPRESSIONS b/CC/EXPRESSIONS index fe6f9cb..c616dfa 100644 --- a/CC/EXPRESSIONS +++ b/CC/EXPRESSIONS @@ -2829,16 +2829,8 @@ } ] } - , "cmd": - [ "sh" - , "-c" - , { "type": "join" - , "$1": - [ "cd work && " - , {"type": "join_cmd", "$1": {"type": "var", "name": "cmd"}} - ] - } - ] + , "cmd": {"type": "var", "name": "cmd"} + , "cwd": "work" , "env": {"type": "var", "name": "ENV"} } ] @@ -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" @@ -182,17 +181,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 6fb0f40..e7a2f46 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"] @@ -139,17 +138,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/test/EXPRESSIONS b/CC/test/EXPRESSIONS index b12b80d..1389bbc 100644 --- a/CC/test/EXPRESSIONS +++ b/CC/test/EXPRESSIONS @@ -377,19 +377,16 @@ } ] , [ "artifacts" - , { "type": "map_union" + , { "type": "`" , "$1": - [ { "type": "singleton_map" - , "key": "pwd" - , "value": {"type": "BLOB", "data": "/summary"} - } - , {"type": "var", "name": "summary"} - , { "type": "singleton_map" - , "key": "work" - , "value": + { "pwd": + {"type": ",", "$1": {"type": "BLOB", "data": "/summary"}} + , "work": + { "type": "," + , "$1": {"type": "TREE", "$1": {"type": "var", "name": "attempts"}} } - ] + } } ] , [ "runfiles" diff --git a/EXPRESSIONS b/EXPRESSIONS index 52a381f..0c1f611 100644 --- a/EXPRESSIONS +++ b/EXPRESSIONS @@ -126,7 +126,7 @@ , "expression": { "type": "map_union" , "$1": - [ {"type": "singleton_map", "key": "PATH", "value": "/bin:/usr/bin"} + [ {"type": "'", "$1": {"PATH": "/bin:/usr/bin"}} , {"type": "var", "name": "ENV", "default": {"type": "empty_map"}} ] } @@ -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-++"} } - } + ] } } ] @@ -99,8 +93,7 @@ , "call_lint": ["call_lint"] , "call_summary": ["call_summary"] } - , "config_transitions": - {"targets": [{"type": "singleton_map", "key": "LINT", "value": true}]} + , "config_transitions": {"targets": [{"type": "'", "$1": {"LINT": true}}]} , "anonymous": {"lint": {"target": "targets", "provider": "lint", "rule_map": {}}} , "imports": 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 29b670e..7f53a4b 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-++"} } - } + ] } } ] diff --git a/shell/test/RULES b/shell/test/RULES index 1c069dc..bab1d8b 100644 --- a/shell/test/RULES +++ b/shell/test/RULES @@ -331,19 +331,16 @@ } ] , [ "artifacts" - , { "type": "map_union" + , { "type": "`" , "$1": - [ { "type": "singleton_map" - , "key": "pwd" - , "value": {"type": "BLOB", "data": "/summary"} - } - , {"type": "var", "name": "summary"} - , { "type": "singleton_map" - , "key": "work" - , "value": + { "pwd": + {"type": ",", "$1": {"type": "BLOB", "data": "/summary"}} + , "work": + { "type": "," + , "$1": {"type": "TREE", "$1": {"type": "var", "name": "attempts"}} } - ] + } } ] , [ "runfiles" |