diff options
author | Klaus Aehlig <klaus.aehlig@huawei.com> | 2024-08-22 10:27:57 +0200 |
---|---|---|
committer | Klaus Aehlig <klaus.aehlig@huawei.com> | 2024-08-22 13:02:10 +0200 |
commit | 7d54afa1d8543eccb83890f698316b5dd1654c5e (patch) | |
tree | df44900e690b871234b6b43c0dff45d9f035ab93 /lint | |
parent | 5d10279dee1405762cdb43d8b663fbe0e03f350b (diff) | |
download | rules-cc-7d54afa1d8543eccb83890f698316b5dd1654c5e.tar.gz |
Add ["lint", "defaults"] to provide paths for lint actions
... and honor those in ["lint", "targets"].
Diffstat (limited to 'lint')
-rw-r--r-- | lint/RULES | 63 | ||||
-rw-r--r-- | lint/TARGETS | 4 |
2 files changed, 64 insertions, 3 deletions
@@ -1,4 +1,51 @@ -{ "targets": +{ "defaults": + { "doc": + [ "A rule to provide default paths common to all lint targets." + , "" + , "While lint targets bring their own host directory via the" + , "field \"config\", it can still be necessary to bring some" + , "default paths, e.g., for finding the compiler, or the interpreter" + , "for the runner." + ] + , "string_fields": ["PATH"] + , "target_fields": ["base"] + , "field_doc": + { "base": ["Other targets to inherit values from."] + , "PATH": + [ "Paths for looking up system tools." + , "Specifying this field extends values from \"base\"." + ] + } + , "imports": {"base-provides-++": ["CC", "defaults-base-provides-++"]} + , "expression": + { "type": "let*" + , "bindings": + [ [ "PATH" + , { "type": "reverse" + , "$1": + { "type": "nub_right" + , "$1": + { "type": "reverse" + , "$1": + { "type": "++" + , "$1": + [ {"type": "FIELD", "name": "PATH"} + , { "type": "let*" + , "bindings": [["provider", "PATH"]] + , "body": + {"type": "CALL_EXPRESSION", "name": "base-provides-++"} + } + ] + } + } + } + } + ] + ] + , "body": {"type": "RESULT", "provides": {"type": "env", "vars": ["PATH"]}} + } + } +, "targets": { "doc": [ "Run a given linter on the lint information provided by the given targets." ] @@ -41,7 +88,11 @@ , "call_lint": ["Launcher for the linter"] , "call_summary": ["Launcher for the summarizer"] } - , "implicit": {"call_lint": ["call_lint"], "call_summary": ["call_summary"]} + , "implicit": + { "defaults": ["defaults"] + , "call_lint": ["call_lint"] + , "call_summary": ["call_summary"] + } , "config_transitions": {"targets": [{"type": "singleton_map", "key": "LINT", "value": true}]} , "anonymous": @@ -49,6 +100,7 @@ , "imports": { "stage": ["", "stage_singleton_field"] , "artifacts": ["", "field_artifacts"] + , "default-PATH": ["CC", "default-PATH"] } , "expression": { "type": "let*" @@ -71,6 +123,12 @@ , "body": {"type": "CALL_EXPRESSION", "name": "artifacts"} } ] + , [ "PATH" + , { "type": "join" + , "separator": ":" + , "$1": {"type": "CALL_EXPRESSION", "name": "default-PATH"} + } + ] , [ "lint results" , { "type": "foreach" , "range": {"type": "FIELD", "name": "lint"} @@ -121,6 +179,7 @@ , {"type": "var", "name": "cmd"} ] } + , "env": {"type": "env", "vars": ["PATH"]} , "outs": ["stdout", "stderr", "result"] , "out_dirs": ["out"] , "may_fail": ["lint"] diff --git a/lint/TARGETS b/lint/TARGETS index 0967ef4..de52b00 100644 --- a/lint/TARGETS +++ b/lint/TARGETS @@ -1 +1,3 @@ -{} +{ "defaults": + {"type": "defaults", "base": [["CC", "defaults"], ["shell", "defaults"]]} +} |