diff options
| author | ruki <[email protected]> | 2023-02-21 23:23:14 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2023-02-21 23:23:14 +0800 |
| commit | 77c0a9dcfbbad5e72b3b59b02ebdf8f00a3141ac (patch) | |
| tree | d45f6dd8b71b30942a8dcf438d3f6a3c0cb0d741 | |
| parent | d4a354d714f69c598945f91557f7a6eec2334161 (diff) | |
improve check stage
| -rw-r--r-- | xmake/actions/build/check.lua | 17 | ||||
| -rw-r--r-- | xmake/actions/build/main.lua | 4 | ||||
| -rw-r--r-- | xmake/modules/private/check/checker.lua | 28 |
3 files changed, 19 insertions, 30 deletions
diff --git a/xmake/actions/build/check.lua b/xmake/actions/build/check.lua index 6bbb45b8a..e26e4f0d0 100644 --- a/xmake/actions/build/check.lua +++ b/xmake/actions/build/check.lua @@ -44,18 +44,8 @@ function _show(str, opt) end end -function _check_target(target) - local checkers = checker.checkers() - for name, info in table.orderpairs(checkers) do - -- just do some faster checkers - if info.timely then - import("private.check.checkers." .. name, {anonymous = true})({ - target = target, show = _show}) - end - end -end - -function main(targetname) +function main(targetname, opt) + opt = opt or {} -- get targets local targets = {} @@ -75,8 +65,7 @@ function main(targetname) -- do check local checkers = checker.checkers() for name, info in table.orderpairs(checkers) do - -- just do some faster checkers - if info.timely then + if (info.build and opt.build) or (info.build_failure and opt.build_failure) then local check = import("private.check.checkers." .. name, {anonymous = true}) for _, target in ipairs(targets) do check({target = target, show = _show}) diff --git a/xmake/actions/build/main.lua b/xmake/actions/build/main.lua index 355b7753a..31a63b1d1 100644 --- a/xmake/actions/build/main.lua +++ b/xmake/actions/build/main.lua @@ -125,7 +125,7 @@ function _on_exit(ok, errors) -- we just handle the build failure if handled and not ok then - print("build failed") + check_targets(targetname, {build_failure = true}) end end @@ -172,7 +172,7 @@ function main() function () -- do check - check_targets(targetname) + check_targets(targetname, {build = true}) -- do rules before building _do_project_rules("build_before") diff --git a/xmake/modules/private/check/checker.lua b/xmake/modules/private/check/checker.lua index 5ddcc9fdc..eb48a2029 100644 --- a/xmake/modules/private/check/checker.lua +++ b/xmake/modules/private/check/checker.lua @@ -28,32 +28,32 @@ function checkers() checkers = { -- target api checkers ["api.target.version"] = {description = "Check version configuration in target."}, - ["api.target.kind"] = {description = "Check kind configuration in target.", timely = true}, - ["api.target.strip"] = {description = "Check strip configuration in target.", timely = true}, - ["api.target.optimize"] = {description = "Check optimize configuration in target.", timely = true}, - ["api.target.symbols"] = {description = "Check symbols configuration in target.", timely = true}, - ["api.target.fpmodels"] = {description = "Check fpmodels configuration in target.", timely = true}, - ["api.target.warnings"] = {description = "Check warnings configuration in target.", timely = true}, - ["api.target.languages"] = {description = "Check languages configuration in target.", timely = true}, - ["api.target.vectorexts"] = {description = "Check vectorexts configuration in target.", timely = true}, - ["api.target.exceptions"] = {description = "Check exceptions configuration in target.", timely = true}, + ["api.target.kind"] = {description = "Check kind configuration in target.", build = true}, + ["api.target.strip"] = {description = "Check strip configuration in target.", build = true}, + ["api.target.optimize"] = {description = "Check optimize configuration in target.", build = true}, + ["api.target.symbols"] = {description = "Check symbols configuration in target.", build = true}, + ["api.target.fpmodels"] = {description = "Check fpmodels configuration in target.", build = true}, + ["api.target.warnings"] = {description = "Check warnings configuration in target.", build = true}, + ["api.target.languages"] = {description = "Check languages configuration in target.", build = true}, + ["api.target.vectorexts"] = {description = "Check vectorexts configuration in target.", build = true}, + ["api.target.exceptions"] = {description = "Check exceptions configuration in target.", build = true}, ["api.target.packages"] = {description = "Check packages configuration in target."}, ["api.target.files"] = {description = "Check files configuration in target."}, ["api.target.headerfiles"] = {description = "Check header files configuration in target."}, ["api.target.installfiles"] = {description = "Check install files configuration in target."}, ["api.target.configfiles"] = {description = "Check config files configuration in target."}, - ["api.target.linkdirs"] = {description = "Check linkdirs configuration in target.", timely = true}, - ["api.target.includedirs"] = {description = "Check includedirs configuration in target.", timely = true}, - ["api.target.frameworkdirs"] = {description = "Check frameworkdirs configuration in target.", timely = true}, + ["api.target.linkdirs"] = {description = "Check linkdirs configuration in target.", build = true}, + ["api.target.includedirs"] = {description = "Check includedirs configuration in target.", build = true}, + ["api.target.frameworkdirs"] = {description = "Check frameworkdirs configuration in target.", build = true}, ["api.target.cflags"] = {description = "Check c compiler flags configuration in target."}, ["api.target.cxflags"] = {description = "Check c/c++ compiler flags configuration in target."}, ["api.target.cxxflags"] = {description = "Check c++ compiler flags configuration in target."}, ["api.target.asflags"] = {description = "Check assembler flags configuration in target."}, ["api.target.ldflags"] = {description = "Check binary linker flags configuration in target."}, ["api.target.shflags"] = {description = "Check shared library linker flags configuration in target."}, - ["api.target.license"] = {description = "Check license in target and packages.", timely = true}, + ["api.target.license"] = {description = "Check license in target and packages.", build = true}, -- cuda checkers - ["cuda.devlink"] = {description = "Check devlink for targets."}, + ["cuda.devlink"] = {description = "Check devlink for targets.", build_failure = true}, -- clang tidy checker ["clang.tidy"] = {description = "Check project code using clang-tidy.", showstats = false} } |
