diff options
author | Paul Cristian Sarbu <paul.cristian.sarbu@huawei.com> | 2025-04-07 12:24:57 +0200 |
---|---|---|
committer | Paul Cristian Sarbu <paul.cristian.sarbu@huawei.com> | 2025-04-23 15:26:15 +0200 |
commit | 293488e5c0fb4416e7ac0f60e3bf6348334dda82 (patch) | |
tree | 3589ffa422dee4dc8baad9130c3aa2d2404c41a6 | |
parent | 3af43b1bbeaa83f946621ee075a060033b0880ad (diff) | |
download | rules-cc-293488e5c0fb4416e7ac0f60e3bf6348334dda82.tar.gz |
rules CC: Support debug fission in linting
As the command passed to the linter can produce additional outputs
if debug fission is enabled, pass those artifact paths in a new
variable "extra outs", which the ["lint", "targets"] rule can then
make it available in the meta.json file expected by the linter.
-rw-r--r-- | CC/EXPRESSIONS | 38 | ||||
-rw-r--r-- | lint/RULES | 14 |
2 files changed, 48 insertions, 4 deletions
diff --git a/CC/EXPRESSIONS b/CC/EXPRESSIONS index 202496e..03c9c07 100644 --- a/CC/EXPRESSIONS +++ b/CC/EXPRESSIONS @@ -1217,10 +1217,12 @@ ] } ] + , ["extra outs", []] ] , "body": { "type": "env" - , "vars": ["cmd", "src", "direct deps artifact names"] + , "vars": + ["cmd", "src", "direct deps artifact names", "extra outs"] } } } @@ -1272,6 +1274,33 @@ , "$1": ["work", {"type": "var", "name": "out"}] } ] + , [ "dwarf out" + , { "type": "change_ending" + , "$1": {"type": "var", "name": "src_name"} + , "ending": ".dwo" + } + ] + , [ "work dwarf out" + , { "type": "join" + , "separator": "/" + , "$1": ["work", {"type": "var", "name": "dwarf out"}] + } + ] + , [ "extra outs" + , { "type": "if" + , "cond": + { "type": "lookup" + , "key": "USE_DEBUG_FISSION" + , "map": + { "type": "var" + , "name": "DEBUG" + , "default": {"type": "empty_map"} + } + } + , "then": [{"type": "var", "name": "work dwarf out"}] + , "else": [] + } + ] , [ "cmd" , { "type": "++" , "$1": @@ -1295,7 +1324,12 @@ [["src", {"type": "var", "name": "work src_name"}]] , "body": { "type": "env" - , "vars": ["cmd", "src", "direct deps artifact names"] + , "vars": + [ "cmd" + , "src" + , "direct deps artifact names" + , "extra outs" + ] } } } @@ -58,10 +58,13 @@ , " by the field \"config\", and" , "- OUT pointing to a directory to which files with the lint result" , " can be written." - , "- META pointing to a json file contaning" + , "- META pointing to a json file containing" , " - at key \"direct deps artifact names\" a list of all input" , " artifacts that come from the target itself or are runfiles of a" , " direct dependency." + , " - at key \"extra outs\" a list of extra output artifacts that the" + , " command might produce, such as DWARF objects if debug fission is" + , " enabled." , "- TMPDIR pointing to a directory location that can be used to" , " create additional temporary files." , "It is supposed to indicate by the exit code whether the file to lint" @@ -163,6 +166,12 @@ , "provider": "direct deps artifact names" } ] + , [ "extra outs" + , { "type": "DEP_PROVIDES" + , "dep": {"type": "var", "name": "_"} + , "provider": "extra outs" + } + ] ] , "body": { "type": "TREE" @@ -189,7 +198,8 @@ { "type": "json_encode" , "$1": { "type": "env" - , "vars": ["direct deps artifact names"] + , "vars": + ["direct deps artifact names", "extra outs"] } } } |