summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKlaus Aehlig <klaus.aehlig@huawei.com>2024-08-14 15:48:06 +0200
committerKlaus Aehlig <klaus.aehlig@huawei.com>2024-08-20 16:39:41 +0200
commitd16aaf412e2d34befe45ca71864f7c981a1ded65 (patch)
tree8821f6c6f2e7acf6c7b88f98907d65b6eb7c1026
parentc5d844c7c3d6f2ec8941e7b3b266775af728c2dc (diff)
downloadjustbuild-d16aaf412e2d34befe45ca71864f7c981a1ded65.tar.gz
["CC", "test"]: support providing lint information
While there, also properly transition "srcs" and "private-hdrs" to the host version.
-rw-r--r--rules/CC/EXPRESSIONS1
-rw-r--r--rules/CC/test/EXPRESSIONS19
-rw-r--r--rules/CC/test/RULES20
3 files changed, 37 insertions, 3 deletions
diff --git a/rules/CC/EXPRESSIONS b/rules/CC/EXPRESSIONS
index ebe40171..2413f98c 100644
--- a/rules/CC/EXPRESSIONS
+++ b/rules/CC/EXPRESSIONS
@@ -815,6 +815,7 @@
, "lint-deps fieldnames"
, "deps-transition"
, "compile-args"
+ , "defaults-transition"
]
, "imports":
{ "objects": "objects"
diff --git a/rules/CC/test/EXPRESSIONS b/rules/CC/test/EXPRESSIONS
index f3e4b047..b42401be 100644
--- a/rules/CC/test/EXPRESSIONS
+++ b/rules/CC/test/EXPRESSIONS
@@ -39,6 +39,7 @@
, "test-data"
, "summarizer"
, "summary artifacts"
+ , "LINT"
]
, "imports":
{ "artifacts": ["./", "../..", "field_artifacts"]
@@ -53,6 +54,7 @@
, "host transition": ["transitions", "for host"]
, "target properties": ["transitions", "target properties"]
, "stage": ["./", "../..", "stage_singleton_field"]
+ , "lint": ["./", "..", "lint information"]
}
, "expression":
{ "type": "let*"
@@ -89,6 +91,21 @@
}
]
, ["binary", {"type": "CALL_EXPRESSION", "name": "binary"}]
+ , [ "lint"
+ , { "type": "if"
+ , "cond": {"type": "var", "name": "LINT"}
+ , "then":
+ { "type": "let*"
+ , "bindings":
+ [ ["hdrs", {"type": "empty_map"}]
+ , [ "lint-deps fieldnames"
+ , ["private-hdrs", "srcs", "private-deps"]
+ ]
+ ]
+ , "body": {"type": "CALL_EXPRESSION", "name": "lint"}
+ }
+ }
+ ]
, [ "staged test binary"
, { "type": "map_union"
, "$1":
@@ -204,6 +221,7 @@
{ "type": "RESULT"
, "artifacts": {"type": "var", "name": "test-results"}
, "runfiles": {"type": "var", "name": "runfiles"}
+ , "provides": {"type": "env", "vars": ["lint"]}
}
}
, "then":
@@ -357,6 +375,7 @@
{ "type": "RESULT"
, "artifacts": {"type": "var", "name": "artifacts"}
, "runfiles": {"type": "var", "name": "runfiles"}
+ , "provides": {"type": "env", "vars": ["lint"]}
}
}
}
diff --git a/rules/CC/test/RULES b/rules/CC/test/RULES
index f61d9f72..c0d54b53 100644
--- a/rules/CC/test/RULES
+++ b/rules/CC/test/RULES
@@ -28,6 +28,7 @@
, "RUNS_PER_TEST"
, "ARCH_DISPATCH"
, "TEST_SUMMARY_EXECUTION_PROPERTIES"
+ , "LINT"
]
, "implicit":
{ "defaults": [["./", "..", "defaults"]]
@@ -136,6 +137,11 @@
[ "Additional remote-execution properties for the test-summarizing action"
, "in case RUNS_PER_TEST is set; defaults to the empty map."
]
+ , "LINT":
+ [ "Also provide nodes describing compile actions and header files;"
+ , "those can be used by lint rules (doing also the config transition)"
+ , "for additional checks."
+ ]
}
, "artifacts_doc":
[ "result: the result of this test (\"PASS\" or \"FAIL\"); useful for"
@@ -163,6 +169,8 @@
, "config_transitions":
{ "defaults": [{"type": "CALL_EXPRESSION", "name": "host transition"}]
, "private-deps": [{"type": "CALL_EXPRESSION", "name": "host transition"}]
+ , "private-hdrs": [{"type": "CALL_EXPRESSION", "name": "host transition"}]
+ , "srcs": [{"type": "CALL_EXPRESSION", "name": "host transition"}]
, "data": [{"type": "CALL_EXPRESSION", "name": "host transition"}]
, "runner": [{"type": "CALL_EXPRESSION", "name": "host transition"}]
}
@@ -182,12 +190,16 @@
, "$1": {"type": "FIELD", "name": "stage"}
}
]
+ , ["host-trans", {"type": "CALL_EXPRESSION", "name": "host transition"}]
, [ "srcs"
, { "type": "to_subdir"
, "subdir": {"type": "var", "name": "stage"}
, "$1":
{ "type": "let*"
- , "bindings": [["fieldname", "srcs"]]
+ , "bindings":
+ [ ["fieldname", "srcs"]
+ , ["transition", {"type": "var", "name": "host-trans"}]
+ ]
, "body": {"type": "CALL_EXPRESSION", "name": "artifacts"}
}
}
@@ -197,12 +209,14 @@
, "subdir": {"type": "var", "name": "stage"}
, "$1":
{ "type": "let*"
- , "bindings": [["fieldname", "private-hdrs"]]
+ , "bindings":
+ [ ["fieldname", "private-hdrs"]
+ , ["transition", {"type": "var", "name": "host-trans"}]
+ ]
, "body": {"type": "CALL_EXPRESSION", "name": "artifacts"}
}
}
]
- , ["host-trans", {"type": "CALL_EXPRESSION", "name": "host transition"}]
, ["defaults-transition", {"type": "var", "name": "host-trans"}]
, ["deps-transition", {"type": "var", "name": "host-trans"}]
, ["deps-fieldnames", ["private-deps", "defaults"]]