Skip to content

Commit 28a4821

Browse files
committed
feat: Add platform to per_file rule
1 parent f3f9831 commit 28a4821

2 files changed

Lines changed: 14 additions & 2 deletions

File tree

src/codechecker.bzl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ codechecker = rule(
207207
cfg = "exec",
208208
default = ":compile_commands_filter",
209209
),
210-
},
210+
} | version_specific_attributes(),
211211
outputs = {
212212
"codechecker_commands": "%{name}/codechecker_commands.json",
213213
"codechecker_log": "%{name}/codechecker.log",
@@ -384,6 +384,7 @@ def codechecker_test(
384384
if per_file:
385385
per_file_test(
386386
name = name,
387+
platform = platform,
387388
targets = targets,
388389
options = analyze,
389390
skip = skip,

src/per_file.bzl

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,16 @@ for each translation unit.
1919

2020
load("@rules_cc//cc/common:cc_info.bzl", "CcInfo")
2121
load("codechecker_config.bzl", "get_config_file")
22+
load(
23+
"common.bzl",
24+
"version_specific_attributes",
25+
)
2226
load(
2327
"compile_commands.bzl",
2428
"SourceFilesInfo",
2529
"compile_commands_aspect",
2630
"compile_commands_impl",
31+
"platforms_transition",
2732
)
2833

2934
# buildifier: disable=unused-variable
@@ -261,6 +266,7 @@ per_file_test = rule(
261266
attrs = {
262267
"config": attr.label(
263268
default = None,
269+
cfg = platforms_transition,
264270
doc = "CodeChecker configuration",
265271
),
266272
"default_options": attr.string_list(
@@ -274,6 +280,10 @@ per_file_test = rule(
274280
default = [],
275281
doc = "List of CodeChecker options, e.g.: --ctu",
276282
),
283+
"platform": attr.string(
284+
default = "", #"@platforms//os:linux",
285+
doc = "Platform to build for",
286+
),
277287
"skip": attr.string_list(
278288
default = [],
279289
doc = "List of skip/ignore file rules. " +
@@ -283,6 +293,7 @@ per_file_test = rule(
283293
aspects = [
284294
compile_commands_aspect,
285295
],
296+
cfg = platforms_transition,
286297
doc = "List of compilable targets which should be checked.",
287298
),
288299
"toolchain": attr.label(
@@ -297,7 +308,7 @@ per_file_test = rule(
297308
cfg = "target",
298309
default = ":per_file_script",
299310
),
300-
},
311+
} | version_specific_attributes(),
301312
outputs = {
302313
"compile_commands": "%{name}/compile_commands.json",
303314
"test_script": "%{name}/test_script.sh",

0 commit comments

Comments
 (0)