summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShifftC <[email protected]>2025-09-24 11:04:24 +0200
committerShifftC <[email protected]>2025-09-29 11:24:56 +0200
commit68501abaad6a9e8a99c058fe8c4986fb4cd4e08c (patch)
tree8091ff64f556cadcc1b139fee0bed6acb32fe1da
parent1bb954e2d8294c4813f216bd20153f9eccf53adc (diff)
move check message function to shared module
-rw-r--r--xmake/actions/build/check.lua24
-rw-r--r--xmake/modules/private/check/show.lua40
2 files changed, 42 insertions, 22 deletions
diff --git a/xmake/actions/build/check.lua b/xmake/actions/build/check.lua
index 24f13e2f8..2ec3ebc85 100644
--- a/xmake/actions/build/check.lua
+++ b/xmake/actions/build/check.lua
@@ -22,27 +22,7 @@
import("core.base.option")
import("core.project.project")
import("private.check.checker")
-
-function _show(str, opt)
- opt = opt or {}
- _g.showed = _g.showed or {}
- local showed = _g.showed
- local infostr
- if str and opt.sourcetips then
- infostr = string.format("%s${clear}: %s", opt.sourcetips, str)
- elseif opt.sourcetips and opt.apiname and opt.value ~= nil then
- infostr = string.format("%s${clear}: unknown %s value '%s'", opt.sourcetips, opt.apiname, opt.value)
- elseif str then
- infostr = string.format("${clear}: %s", str)
- end
- if opt.probable_value then
- infostr = string.format("%s, it may be '%s'", infostr, opt.probable_value)
- end
- if not showed[infostr] then
- wprint(infostr)
- showed[infostr] = true
- end
-end
+import("private.check.show")
function main(targetnames, opt)
opt = opt or {}
@@ -70,7 +50,7 @@ function main(targetnames, opt)
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})
+ check({target = target, show = show.wshow})
end
end
end
diff --git a/xmake/modules/private/check/show.lua b/xmake/modules/private/check/show.lua
new file mode 100644
index 000000000..4d94a7c5e
--- /dev/null
+++ b/xmake/modules/private/check/show.lua
@@ -0,0 +1,40 @@
+--!A cross-platform build utility based on Lua
+--
+-- Licensed under the Apache License, Version 2.0 (the "License");
+-- you may not use this file except in compliance with the License.
+-- You may obtain a copy of the License at
+--
+-- http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+--
+-- Copyright (C) 2015-present, Xmake Open Source Community.
+--
+-- @author Shiffted
+-- @file show.lua
+--
+
+function wshow(str, opt)
+ opt = opt or {}
+ _g.showed = _g.showed or {}
+ local showed = _g.showed
+ local infostr
+ if str and opt.sourcetips then
+ infostr = string.format("%s${clear}: %s", opt.sourcetips, str)
+ elseif opt.sourcetips and opt.apiname and opt.value ~= nil then
+ infostr = string.format("%s${clear}: unknown %s value '%s'", opt.sourcetips, opt.apiname, opt.value)
+ elseif str then
+ infostr = string.format("${clear}: %s", str)
+ end
+ if opt.probable_value then
+ infostr = string.format("%s, it may be '%s'", infostr, opt.probable_value)
+ end
+ if not showed[infostr] then
+ wprint(infostr)
+ showed[infostr] = true
+ end
+end