diff options
| author | ruki <[email protected]> | 2023-02-02 22:35:45 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2023-02-02 22:35:45 +0800 |
| commit | 3ccae48c676e8a08e811b421676ba682e32ec8a7 (patch) | |
| tree | 500051a06590e38f7c6fdf8a8091338262c83f88 /xmake/plugins/check/checkers/api/api_checker.lua | |
| parent | 1804f783f3b7fa873e9a0f745788cf86518dda26 (diff) | |
improve symbols checker
Diffstat (limited to 'xmake/plugins/check/checkers/api/api_checker.lua')
| -rw-r--r-- | xmake/plugins/check/checkers/api/api_checker.lua | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/xmake/plugins/check/checkers/api/api_checker.lua b/xmake/plugins/check/checkers/api/api_checker.lua index 52a494a47..44cecad28 100644 --- a/xmake/plugins/check/checkers/api/api_checker.lua +++ b/xmake/plugins/check/checkers/api/api_checker.lua @@ -93,8 +93,20 @@ end function check_targets(apiname, opt) opt = opt or {} local level = opt.level or "warning" - local valueset = opt.values and hashset.from(opt.values) or hashset.new() + local valueset + if opt.values and type(opt.values) ~= "function" then + valueset = hashset.from(opt.values) + else + valueset = hashset.new() + end for _, target in pairs(project.targets()) do + local target_valueset = valueset + if type(opt.values) == "function" then + local target_values = opt.values(target) + if target_values then + target_valueset = hashset.from(target_values) + end + end local values = target:get(apiname) for _, value in ipairs(values) do if opt.check then @@ -105,8 +117,8 @@ function check_targets(apiname, opt) checker.update_stats(level) end end - elseif not valueset:has(value) then - local reported = _show(apiname, value, target, {valueset = valueset, level = level}) + elseif not target_valueset:has(value) then + local reported = _show(apiname, value, target, {valueset = target_valueset, level = level}) if reported then checker.update_stats(level) end |
