summaryrefslogtreecommitdiff
path: root/xmake/modules/private/check/checkers/api/api_checker.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2026-06-30 23:12:29 +0800
committerruki <[email protected]>2026-06-30 13:21:13 +0800
commitfd5810a06f8aab1f5fa11ce52eb1f006fba9025b (patch)
tree5b386cd0aef2f2970841fb3d6e028fdc4bfb334a /xmake/modules/private/check/checkers/api/api_checker.lua
parent5cb46ce73332d1cb361b1869e92441d24a017469 (diff)
add add_toolset checker
Diffstat (limited to 'xmake/modules/private/check/checkers/api/api_checker.lua')
-rw-r--r--xmake/modules/private/check/checkers/api/api_checker.lua23
1 files changed, 23 insertions, 0 deletions
diff --git a/xmake/modules/private/check/checkers/api/api_checker.lua b/xmake/modules/private/check/checkers/api/api_checker.lua
index 10e3942ac..c52547183 100644
--- a/xmake/modules/private/check/checkers/api/api_checker.lua
+++ b/xmake/modules/private/check/checkers/api/api_checker.lua
@@ -133,6 +133,29 @@ function _check_instance(instance, apiname, valueset, level, opt)
end
end
local values = instance:get(apiname)
+
+ -- check the keyvalues api, e.g. set_toolset("cxx", "clang")
+ -- the values is a dictionary, e.g. {cxx = "clang"}
+ -- @see https://github.com/xmake-io/xmake/pull/7597
+ if opt.keyvalues then
+ for key, value in pairs(table.wrap(values)) do
+ if opt.check then
+ local ok, errors = opt.check(instance, key, value)
+ if not ok then
+ -- we report it on the key, because the sourceinfo is saved on the key
+ local reported = _show(apiname, key, instance, {
+ show = opt.show,
+ showstr = errors,
+ level = level})
+ if reported then
+ checker.update_stats(level)
+ end
+ end
+ end
+ end
+ return
+ end
+
for _, value in ipairs(values) do
if opt.check then
local ok, errors = opt.check(instance, value)