diff options
| author | ruki <[email protected]> | 2023-02-20 22:47:16 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2023-02-20 22:47:16 +0800 |
| commit | 2e04812cae7e38d9b097b40cce90b34ec6fb8fca (patch) | |
| tree | fc25c1fb5259908a3a6d4c6e97ca22a2361cb19a /xmake/plugins | |
| parent | 1ceae4d5e4b2786c395a705f7c89601e6ef8aedc (diff) | |
improve target checkers
Diffstat (limited to 'xmake/plugins')
23 files changed, 83 insertions, 60 deletions
diff --git a/xmake/plugins/check/checkers/api/target/asflags.lua b/xmake/plugins/check/checkers/api/target/asflags.lua index ad98a329b..07de9c4ec 100644 --- a/xmake/plugins/check/checkers/api/target/asflags.lua +++ b/xmake/plugins/check/checkers/api/target/asflags.lua @@ -22,12 +22,13 @@ import("core.tool.compiler") import(".api_checker") -function main() - api_checker.check_targets("asflags", {check = function(target, value) +function main(opt) + opt = opt or {} + api_checker.check_targets("asflags", table.join(opt, {check = function(target, value) local compinst = target:compiler("as") if not compinst:has_flags(value) then return false, string.format("%s: unknown assembler flag '%s'", compinst:name(), value) end return true - end}) + end})) end diff --git a/xmake/plugins/check/checkers/api/target/cflags.lua b/xmake/plugins/check/checkers/api/target/cflags.lua index df9a34830..db35a7bcf 100644 --- a/xmake/plugins/check/checkers/api/target/cflags.lua +++ b/xmake/plugins/check/checkers/api/target/cflags.lua @@ -22,12 +22,13 @@ import("core.tool.compiler") import(".api_checker") -function main() - api_checker.check_targets("cflags", {check = function(target, value) +function main(opt) + opt = opt or {} + api_checker.check_targets("cflags", table.join(opt, {check = function(target, value) local compinst = target:compiler("cc") if not compinst:has_flags(value) then return false, string.format("%s: unknown c compiler flag '%s'", compinst:name(), value) end return true - end}) + end})) end diff --git a/xmake/plugins/check/checkers/api/target/configfiles.lua b/xmake/plugins/check/checkers/api/target/configfiles.lua index 5819278c0..a8965eebe 100644 --- a/xmake/plugins/check/checkers/api/target/configfiles.lua +++ b/xmake/plugins/check/checkers/api/target/configfiles.lua @@ -21,12 +21,13 @@ -- imports import(".api_checker") -function main() - api_checker.check_targets("configfiles", {check = function(target, value) +function main(opt) + opt = opt or {} + api_checker.check_targets("configfiles", table.join(opt, {check = function(target, value) local configfiles = os.files(value) if not configfiles or #configfiles == 0 then return false, string.format("configfiles '%s' not found", value) end return true - end}) + end})) end diff --git a/xmake/plugins/check/checkers/api/target/cxflags.lua b/xmake/plugins/check/checkers/api/target/cxflags.lua index 9c8df747a..ba09366e0 100644 --- a/xmake/plugins/check/checkers/api/target/cxflags.lua +++ b/xmake/plugins/check/checkers/api/target/cxflags.lua @@ -22,12 +22,13 @@ import("core.tool.compiler") import(".api_checker") -function main() - api_checker.check_targets("cxflags", {check = function(target, value) +function main(opt) + opt = opt or {} + api_checker.check_targets("cxflags", table.join(opt, {check = function(target, value) local compinst = target:compiler("cxx") if not compinst:has_flags(value) then return false, string.format("%s: unknown c/c++ compiler flag '%s'", compinst:name(), value) end return true - end}) + end})) end diff --git a/xmake/plugins/check/checkers/api/target/cxxflags.lua b/xmake/plugins/check/checkers/api/target/cxxflags.lua index 6756b07d4..84660cfa4 100644 --- a/xmake/plugins/check/checkers/api/target/cxxflags.lua +++ b/xmake/plugins/check/checkers/api/target/cxxflags.lua @@ -22,12 +22,13 @@ import("core.tool.compiler") import(".api_checker") -function main() - api_checker.check_targets("cxxflags", {check = function(target, value) +function main(opt) + opt = opt or {} + api_checker.check_targets("cxxflags", table.join(opt, {check = function(target, value) local compinst = target:compiler("cxx") if not compinst:has_flags(value) then return false, string.format("%s: unknown c++ compiler flag '%s'", compinst:name(), value) end return true - end}) + end})) end diff --git a/xmake/plugins/check/checkers/api/target/exceptions.lua b/xmake/plugins/check/checkers/api/target/exceptions.lua index 551595e7b..e9570a894 100644 --- a/xmake/plugins/check/checkers/api/target/exceptions.lua +++ b/xmake/plugins/check/checkers/api/target/exceptions.lua @@ -21,6 +21,7 @@ -- imports import(".api_checker") -function main() - api_checker.check_targets("exceptions", {values = {"none", "cxx", "objc", "no-cxx", "no-objc"}}) +function main(opt) + opt = opt or {} + api_checker.check_targets("exceptions", table.join(opt, {values = {"none", "cxx", "objc", "no-cxx", "no-objc"}})) end diff --git a/xmake/plugins/check/checkers/api/target/files.lua b/xmake/plugins/check/checkers/api/target/files.lua index dfc4eda89..a523a7413 100644 --- a/xmake/plugins/check/checkers/api/target/files.lua +++ b/xmake/plugins/check/checkers/api/target/files.lua @@ -21,12 +21,13 @@ -- imports import(".api_checker") -function main() - api_checker.check_targets("files", {check = function(target, value) +function main(opt) + opt = opt or {} + api_checker.check_targets("files", table.join(opt, {check = function(target, value) local files = os.files(value) if not files or #files == 0 then return false, string.format("files '%s' not found", value) end return true - end}) + end})) end diff --git a/xmake/plugins/check/checkers/api/target/fpmodels.lua b/xmake/plugins/check/checkers/api/target/fpmodels.lua index 25c6c239b..61231109e 100644 --- a/xmake/plugins/check/checkers/api/target/fpmodels.lua +++ b/xmake/plugins/check/checkers/api/target/fpmodels.lua @@ -21,6 +21,7 @@ -- imports import(".api_checker") -function main() - api_checker.check_targets("fpmodels", {values = {"none", "precise", "fast", "strict", "except", "noexcept"}}) +function main(opt) + opt = opt or {} + api_checker.check_targets("fpmodels", table.join(opt, {values = {"none", "precise", "fast", "strict", "except", "noexcept"}})) end diff --git a/xmake/plugins/check/checkers/api/target/frameworkdirs.lua b/xmake/plugins/check/checkers/api/target/frameworkdirs.lua index f21629fe5..088aa7114 100644 --- a/xmake/plugins/check/checkers/api/target/frameworkdirs.lua +++ b/xmake/plugins/check/checkers/api/target/frameworkdirs.lua @@ -21,11 +21,12 @@ -- imports import(".api_checker") -function main() - api_checker.check_targets("frameworkdirs", {check = function(target, value) +function main(opt) + opt = opt or {} + api_checker.check_targets("frameworkdirs", table.join(opt, {check = function(target, value) if not os.isdir(value) then return false, string.format("frameworkdir '%s' not found", value) end return true - end}) + end})) end diff --git a/xmake/plugins/check/checkers/api/target/headerfiles.lua b/xmake/plugins/check/checkers/api/target/headerfiles.lua index 5777f27f8..af262b91c 100644 --- a/xmake/plugins/check/checkers/api/target/headerfiles.lua +++ b/xmake/plugins/check/checkers/api/target/headerfiles.lua @@ -21,13 +21,14 @@ -- imports import(".api_checker") -function main() - api_checker.check_targets("headerfiles", {check = function(target, value) +function main(opt) + opt = opt or {} + api_checker.check_targets("headerfiles", table.join(opt, {check = function(target, value) value = value:gsub("[()]", "") local headerfiles = os.files(value) if not headerfiles or #headerfiles == 0 then return false, string.format("headerfiles '%s' not found", value) end return true - end}) + end})) end diff --git a/xmake/plugins/check/checkers/api/target/installfiles.lua b/xmake/plugins/check/checkers/api/target/installfiles.lua index cdf0a927e..7a294f60f 100644 --- a/xmake/plugins/check/checkers/api/target/installfiles.lua +++ b/xmake/plugins/check/checkers/api/target/installfiles.lua @@ -21,13 +21,14 @@ -- imports import(".api_checker") -function main() - api_checker.check_targets("installfiles", {check = function(target, value) +function main(opt) + opt = opt or {} + api_checker.check_targets("installfiles", table.join(opt, {check = function(target, value) value = value:gsub("[()]", "") local installfiles = os.files(value) if not installfiles or #installfiles == 0 then return false, string.format("installfiles '%s' not found", value) end return true - end}) + end})) end diff --git a/xmake/plugins/check/checkers/api/target/kind.lua b/xmake/plugins/check/checkers/api/target/kind.lua index e84bf890d..127f78ad5 100644 --- a/xmake/plugins/check/checkers/api/target/kind.lua +++ b/xmake/plugins/check/checkers/api/target/kind.lua @@ -21,6 +21,7 @@ -- imports import(".api_checker") -function main() - api_checker.check_targets("kind", {values = {"object", "binary", "static", "shared", "headeronly", "phony"}}) +function main(opt) + opt = opt or {} + api_checker.check_targets("kind", table.join(opt, {values = {"object", "binary", "static", "shared", "headeronly", "phony"}})) end diff --git a/xmake/plugins/check/checkers/api/target/languages.lua b/xmake/plugins/check/checkers/api/target/languages.lua index 9831bc2f5..f01499225 100644 --- a/xmake/plugins/check/checkers/api/target/languages.lua +++ b/xmake/plugins/check/checkers/api/target/languages.lua @@ -21,7 +21,8 @@ -- imports import(".api_checker") -function main() +function main(opt) + opt = opt or {} local values = { "ansi", "c89", "c90", "c99", "c11", "c17", "clatest", "cxx98", "cxx11", "cxx14", "cxx17", "cxx1z", "cxx20", "cxx2a", "cxx23", "cxx2b", "cxxlatest" @@ -36,5 +37,5 @@ function main() table.insert(languages, "gnu" .. value:sub(2)) end end - api_checker.check_targets("languages", {values = languages}) + api_checker.check_targets("languages", table.join(opt, {values = languages})) end diff --git a/xmake/plugins/check/checkers/api/target/ldflags.lua b/xmake/plugins/check/checkers/api/target/ldflags.lua index efe176aa5..e06d5bb09 100644 --- a/xmake/plugins/check/checkers/api/target/ldflags.lua +++ b/xmake/plugins/check/checkers/api/target/ldflags.lua @@ -22,8 +22,9 @@ import("core.tool.compiler") import(".api_checker") -function main() - api_checker.check_targets("ldflags", {check = function(target, value) +function main(opt) + opt = opt or {} + api_checker.check_targets("ldflags", table.join(opt, {check = function(target, value) if target:is_binary() then local linker = target:linker() if not linker:has_flags(value) then @@ -31,5 +32,5 @@ function main() end end return true - end}) + end})) end diff --git a/xmake/plugins/check/checkers/api/target/linkdirs.lua b/xmake/plugins/check/checkers/api/target/linkdirs.lua index 3980f2eae..3f05bfa16 100644 --- a/xmake/plugins/check/checkers/api/target/linkdirs.lua +++ b/xmake/plugins/check/checkers/api/target/linkdirs.lua @@ -21,11 +21,12 @@ -- imports import(".api_checker") -function main() - api_checker.check_targets("linkdirs", {check = function(target, value) +function main(opt) + opt = opt or {} + api_checker.check_targets("linkdirs", table.join(opt, {check = function(target, value) if not os.isdir(value) then return false, string.format("linkdir '%s' not found", value) end return true - end}) + end})) end diff --git a/xmake/plugins/check/checkers/api/target/optimize.lua b/xmake/plugins/check/checkers/api/target/optimize.lua index c8bc6eb60..99731ba19 100644 --- a/xmake/plugins/check/checkers/api/target/optimize.lua +++ b/xmake/plugins/check/checkers/api/target/optimize.lua @@ -21,6 +21,7 @@ -- imports import(".api_checker") -function main() - api_checker.check_targets("optimize", {values = {"none", "fast", "faster", "fastest", "smallest", "aggressive"}}) +function main(opt) + opt = opt or {} + api_checker.check_targets("optimize", table.join(opt, {values = {"none", "fast", "faster", "fastest", "smallest", "aggressive"}})) end diff --git a/xmake/plugins/check/checkers/api/target/packages.lua b/xmake/plugins/check/checkers/api/target/packages.lua index e34f602db..994ea5c2a 100644 --- a/xmake/plugins/check/checkers/api/target/packages.lua +++ b/xmake/plugins/check/checkers/api/target/packages.lua @@ -22,11 +22,12 @@ import("core.project.project") import(".api_checker") -function main() +function main(opt) + opt = opt or {} local packages = {} local requires = project.required_packages() if requires then table.join2(packages, table.orderkeys(requires)) end - api_checker.check_targets("packages", {values = packages, level = "note"}) + api_checker.check_targets("packages", table.join(opt, {values = packages, level = "note"})) end diff --git a/xmake/plugins/check/checkers/api/target/shflags.lua b/xmake/plugins/check/checkers/api/target/shflags.lua index bb518015a..20b2f6a05 100644 --- a/xmake/plugins/check/checkers/api/target/shflags.lua +++ b/xmake/plugins/check/checkers/api/target/shflags.lua @@ -22,8 +22,9 @@ import("core.tool.compiler") import(".api_checker") -function main() - api_checker.check_targets("shflags", {check = function(target, value) +function main(opt) + opt = opt or {} + api_checker.check_targets("shflags", table.join(opt, {check = function(target, value) if target:is_shared() then local linker = target:linker() if not linker:has_flags(value) then @@ -31,5 +32,5 @@ function main() end end return true - end}) + end})) end diff --git a/xmake/plugins/check/checkers/api/target/strip.lua b/xmake/plugins/check/checkers/api/target/strip.lua index cf14c607b..c6074bc12 100644 --- a/xmake/plugins/check/checkers/api/target/strip.lua +++ b/xmake/plugins/check/checkers/api/target/strip.lua @@ -21,6 +21,7 @@ -- imports import(".api_checker") -function main() - api_checker.check_targets("strip", {values = {"none", "debug", "all"}}) +function main(opt) + opt = opt or {} + api_checker.check_targets("strip", table.join(opt, {values = {"none", "debug", "all"}})) end diff --git a/xmake/plugins/check/checkers/api/target/symbols.lua b/xmake/plugins/check/checkers/api/target/symbols.lua index 8f4472a9b..839bd0ede 100644 --- a/xmake/plugins/check/checkers/api/target/symbols.lua +++ b/xmake/plugins/check/checkers/api/target/symbols.lua @@ -21,13 +21,14 @@ -- imports import(".api_checker") -function main() - api_checker.check_targets("symbols", {values = function (target) +function main(opt) + opt = opt or {} + api_checker.check_targets("symbols", table.join(opt, {values = function (target) local values = {"none", "debug", "hidden", "hidden_cxx"} if target:is_plat("windows") and (target:has_tool("cc", "cl") or target:has_tool("cxx", "cl")) then table.insert(values, "edit") table.insert(values, "embed") end return values - end}) + end})) end diff --git a/xmake/plugins/check/checkers/api/target/vectorexts.lua b/xmake/plugins/check/checkers/api/target/vectorexts.lua index dc6a1a755..77f9ee48c 100644 --- a/xmake/plugins/check/checkers/api/target/vectorexts.lua +++ b/xmake/plugins/check/checkers/api/target/vectorexts.lua @@ -21,6 +21,7 @@ -- imports import(".api_checker") -function main() - api_checker.check_targets("vectorexts", {values = {"none", "sse", "sse2", "sse3", "ssse3", "avx", "avx2", "neon"}}) +function main(opt) + opt = opt or {} + api_checker.check_targets("vectorexts", table.join(opt, {values = {"none", "sse", "sse2", "sse3", "ssse3", "avx", "avx2", "neon"}})) end diff --git a/xmake/plugins/check/checkers/api/target/version.lua b/xmake/plugins/check/checkers/api/target/version.lua index e476cd8d4..889864f5b 100644 --- a/xmake/plugins/check/checkers/api/target/version.lua +++ b/xmake/plugins/check/checkers/api/target/version.lua @@ -22,8 +22,9 @@ import("core.base.semver") import(".api_checker") -function main() - api_checker.check_targets("version", {check = function(target, value) +function main(opt) + opt = opt or {} + api_checker.check_targets("version", table.join(opt, {check = function(target, value) local errors local ok = try { function() @@ -37,5 +38,5 @@ function main() } } return ok, errors - end, level = "error"}) + end, level = "error"})) end diff --git a/xmake/plugins/check/checkers/api/target/warnings.lua b/xmake/plugins/check/checkers/api/target/warnings.lua index 2d2159e91..4e6cf5794 100644 --- a/xmake/plugins/check/checkers/api/target/warnings.lua +++ b/xmake/plugins/check/checkers/api/target/warnings.lua @@ -21,6 +21,7 @@ -- imports import(".api_checker") -function main() - api_checker.check_targets("warnings", {values = {"none", "less", "more", "all", "allextra", "everything", "error"}}) +function main(opt) + opt = opt or {} + api_checker.check_targets("warnings", table.join(opt, {values = {"none", "less", "more", "all", "allextra", "everything", "error"}})) end |
