From 5e1c83cd320a6c05d262cdaa9dcbb74fd4c5ef01 Mon Sep 17 00:00:00 2001 From: "F.Tibor" Date: Thu, 27 Aug 2026 11:22:14 +0200 Subject: [PATCH] feat: Add platform to per_file rule --- src/codechecker.bzl | 1 + src/per_file.bzl | 13 ++++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/codechecker.bzl b/src/codechecker.bzl index 395666ae..0f3d4dec 100644 --- a/src/codechecker.bzl +++ b/src/codechecker.bzl @@ -357,6 +357,7 @@ def codechecker_test( if per_file: per_file_test( name = name, + platform = platform, targets = targets, options = analyze, skip = skip, diff --git a/src/per_file.bzl b/src/per_file.bzl index 41139567..d33b85dd 100644 --- a/src/per_file.bzl +++ b/src/per_file.bzl @@ -19,11 +19,16 @@ for each translation unit. load("@rules_cc//cc/common:cc_info.bzl", "CcInfo") load("codechecker_config.bzl", "get_config_file") +load( + "common.bzl", + "version_specific_attributes", +) load( "compile_commands.bzl", "SourceFilesInfo", "compile_commands_aspect", "compile_commands_impl", + "platforms_transition", ) # buildifier: disable=unused-variable @@ -255,6 +260,7 @@ per_file_test = rule( attrs = { "config": attr.label( default = None, + cfg = platforms_transition, doc = "CodeChecker configuration", ), "default_options": attr.string_list( @@ -268,6 +274,10 @@ per_file_test = rule( default = [], doc = "List of CodeChecker options, e.g.: --ctu", ), + "platform": attr.string( + default = "", #"@platforms//os:linux", + doc = "Platform to build for", + ), "skip": attr.string_list( default = [], doc = "List of skip/ignore file rules. " + @@ -277,6 +287,7 @@ per_file_test = rule( aspects = [ compile_commands_aspect, ], + cfg = platforms_transition, doc = "List of compilable targets which should be checked.", ), "toolchain": attr.label( @@ -290,7 +301,7 @@ per_file_test = rule( cfg = "exec", default = ":per_file_script", ), - }, + } | version_specific_attributes(), outputs = { "compile_commands": "%{name}/compile_commands.json", "test_script": "%{name}/test_script.sh",