summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2025-10-29 23:58:15 +0800
committerruki <[email protected]>2025-10-29 23:58:15 +0800
commitd6255d98b9a09366d238e8579b18be9add773222 (patch)
treeaf66755d792b12c4525812f88f12eca54392a804
parenta2974bf870a7ef03a5cf7c5154d65bc5a38b18fa (diff)
add progress.show_output
-rw-r--r--tests/apis/custom_toolchain/xmake/modules/core/tools/cl6x.lua5
-rw-r--r--xmake/actions/build/deprecated/build.lua4
-rw-r--r--xmake/modules/core/tools/armasm.lua5
-rw-r--r--xmake/modules/core/tools/armasm_msvc.lua5
-rw-r--r--xmake/modules/core/tools/armcc.lua5
-rw-r--r--xmake/modules/core/tools/armlink.lua5
-rw-r--r--xmake/modules/core/tools/c51.lua5
-rw-r--r--xmake/modules/core/tools/cl.lua5
-rw-r--r--xmake/modules/core/tools/cl2000.lua5
-rw-r--r--xmake/modules/core/tools/cl6x.lua5
-rw-r--r--xmake/modules/core/tools/gcc.lua5
-rw-r--r--xmake/modules/core/tools/iccarm.lua5
-rw-r--r--xmake/modules/core/tools/nvcc.lua5
-rw-r--r--xmake/modules/core/tools/sdasstm8.lua7
-rw-r--r--xmake/modules/core/tools/sdcc.lua5
-rw-r--r--xmake/modules/utils/progress.lua14
16 files changed, 25 insertions, 65 deletions
diff --git a/tests/apis/custom_toolchain/xmake/modules/core/tools/cl6x.lua b/tests/apis/custom_toolchain/xmake/modules/core/tools/cl6x.lua
index ba6bc6e5e..37ceec0b8 100644
--- a/tests/apis/custom_toolchain/xmake/modules/core/tools/cl6x.lua
+++ b/tests/apis/custom_toolchain/xmake/modules/core/tools/cl6x.lua
@@ -183,10 +183,7 @@ function compile(self, sourcefile, objectfile, dependinfo, flags, opt)
-- print some warnings
if warnings and #warnings > 0 and policy.build_warnings(opt) then
- if progress.showing_without_scroll() then
- print("")
- end
- cprint("${color.warning}%s", table.concat(table.slice(warnings:split('\n'), 1, 8), '\n'))
+ progress.show_output("${color.warning}%s", table.concat(table.slice(warnings:split('\n'), 1, 8), '\n'))
end
-- generate the dependent includes
diff --git a/xmake/actions/build/deprecated/build.lua b/xmake/actions/build/deprecated/build.lua
index 336a7bb0d..26c86c9a3 100644
--- a/xmake/actions/build/deprecated/build.lua
+++ b/xmake/actions/build/deprecated/build.lua
@@ -273,8 +273,8 @@ function main(targets_root, opt)
local curdir = os.curdir()
runjobs("build", batchjobs, {on_exit = function (errors)
import("utils.progress")
- if errors and progress.showing_without_scroll() then
- print("")
+ if errors then
+ progress.show_output(errors)
end
end, comax = option.get("jobs") or 1, curdir = curdir, distcc = distcc})
os.cd(curdir)
diff --git a/xmake/modules/core/tools/armasm.lua b/xmake/modules/core/tools/armasm.lua
index 33b77d915..2324e7d16 100644
--- a/xmake/modules/core/tools/armasm.lua
+++ b/xmake/modules/core/tools/armasm.lua
@@ -128,10 +128,7 @@ function compile(self, sourcefile, objectfile, dependinfo, flags, opt)
-- print some warnings
if warnings and #warnings > 0 and policy.build_warnings(opt) then
- if progress.showing_without_scroll() then
- print("")
- end
- cprint("${color.warning}%s", table.concat(table.slice(warnings:split('\n'), 1, 8), '\n'))
+ progress.show_output("${color.warning}%s", table.concat(table.slice(warnings:split('\n'), 1, 8), '\n'))
end
end
}
diff --git a/xmake/modules/core/tools/armasm_msvc.lua b/xmake/modules/core/tools/armasm_msvc.lua
index 3afac67f4..f62820ce2 100644
--- a/xmake/modules/core/tools/armasm_msvc.lua
+++ b/xmake/modules/core/tools/armasm_msvc.lua
@@ -122,10 +122,7 @@ function compile(self, sourcefile, objectfile, dependinfo, flags, opt)
-- print some warnings
if warnings and #warnings > 0 and policy.build_warnings(opt) then
- if progress.showing_without_scroll() then
- print("")
- end
- cprint("${color.warning}%s", table.concat(table.slice(warnings:split('\n'), 1, 8), '\n'))
+ progress.show_output("${color.warning}%s", table.concat(table.slice(warnings:split('\n'), 1, 8), '\n'))
end
end
}
diff --git a/xmake/modules/core/tools/armcc.lua b/xmake/modules/core/tools/armcc.lua
index 93d59aa8d..5179796c7 100644
--- a/xmake/modules/core/tools/armcc.lua
+++ b/xmake/modules/core/tools/armcc.lua
@@ -177,10 +177,7 @@ function compile(self, sourcefile, objectfile, dependinfo, flags, opt)
-- print some warnings
if warnings and #warnings > 0 and policy.build_warnings(opt) then
- if progress.showing_without_scroll() then
- print("")
- end
- cprint("${color.warning}%s", table.concat(table.slice(warnings:split('\n'), 1, 8), '\n'))
+ progress.show_output("${color.warning}%s", table.concat(table.slice(warnings:split('\n'), 1, 8), '\n'))
end
-- generate the dependent includes
diff --git a/xmake/modules/core/tools/armlink.lua b/xmake/modules/core/tools/armlink.lua
index 8b8639754..7d5184a50 100644
--- a/xmake/modules/core/tools/armlink.lua
+++ b/xmake/modules/core/tools/armlink.lua
@@ -116,10 +116,7 @@ function link(self, objectfiles, targetkind, targetfile, flags, opt)
lines = table.slice(lines, 1, (#lines > 16 and 16 or #lines))
end
local warnings = table.concat(lines, "\n")
- if progress.showing_without_scroll() then
- print("")
- end
- cprint("${color.warning}%s", warnings)
+ progress.show_output("${color.warning}%s", warnings)
end
end
diff --git a/xmake/modules/core/tools/c51.lua b/xmake/modules/core/tools/c51.lua
index 0df971f8d..87a602fcc 100644
--- a/xmake/modules/core/tools/c51.lua
+++ b/xmake/modules/core/tools/c51.lua
@@ -119,10 +119,7 @@ function compile(self, sourcefile, objectfile, dependinfo, flags, opt)
lines = table.slice(lines, 1, (#lines > 16 and 16 or #lines))
end
local warnings = table.concat(lines, "\n")
- if progress.showing_without_scroll() then
- print("")
- end
- cprint("${color.warning}%s", warnings)
+ progress.show_output("${color.warning}%s", warnings)
end
end
end
diff --git a/xmake/modules/core/tools/cl.lua b/xmake/modules/core/tools/cl.lua
index 0a6416ded..fa88ab5a4 100644
--- a/xmake/modules/core/tools/cl.lua
+++ b/xmake/modules/core/tools/cl.lua
@@ -764,10 +764,7 @@ function compile(self, sourcefile, objectfile, dependinfo, flags, opt)
lines = table.slice(lines, 1, (#lines > 16 and 16 or #lines))
end
local warnings = table.concat(lines, "\r\n")
- if progress.showing_without_scroll() then
- print("")
- end
- cprint("${color.warning}%s", warnings)
+ progress.show_output("${color.warning}%s", warnings)
end
end
end
diff --git a/xmake/modules/core/tools/cl2000.lua b/xmake/modules/core/tools/cl2000.lua
index 8b8f1f563..b977bc947 100644
--- a/xmake/modules/core/tools/cl2000.lua
+++ b/xmake/modules/core/tools/cl2000.lua
@@ -183,10 +183,7 @@ function compile(self, sourcefile, objectfile, dependinfo, flags, opt)
-- print some warnings
if warnings and #warnings > 0 and policy.build_warnings(opt) then
- if progress.showing_without_scroll() then
- print("")
- end
- cprint("${color.warning}%s", table.concat(table.slice(warnings:split('\n'), 1, 8), '\n'))
+ progress.show_output("${color.warning}%s", table.concat(table.slice(warnings:split('\n'), 1, 8), '\n'))
end
-- generate the dependent includes
diff --git a/xmake/modules/core/tools/cl6x.lua b/xmake/modules/core/tools/cl6x.lua
index ba6bc6e5e..37ceec0b8 100644
--- a/xmake/modules/core/tools/cl6x.lua
+++ b/xmake/modules/core/tools/cl6x.lua
@@ -183,10 +183,7 @@ function compile(self, sourcefile, objectfile, dependinfo, flags, opt)
-- print some warnings
if warnings and #warnings > 0 and policy.build_warnings(opt) then
- if progress.showing_without_scroll() then
- print("")
- end
- cprint("${color.warning}%s", table.concat(table.slice(warnings:split('\n'), 1, 8), '\n'))
+ progress.show_output("${color.warning}%s", table.concat(table.slice(warnings:split('\n'), 1, 8), '\n'))
end
-- generate the dependent includes
diff --git a/xmake/modules/core/tools/gcc.lua b/xmake/modules/core/tools/gcc.lua
index f4cd684e0..6d5f59fac 100644
--- a/xmake/modules/core/tools/gcc.lua
+++ b/xmake/modules/core/tools/gcc.lua
@@ -1058,10 +1058,7 @@ function compile(self, sourcefile, objectfile, dependinfo, flags, opt)
lines = table.slice(lines, 1, (#lines > 16 and 16 or #lines))
end
local warnings = table.concat(lines, "\n")
- if progress.showing_without_scroll() then
- print("")
- end
- cprint("${color.warning}%s", warnings)
+ progress.show_output("${color.warning}%s", warnings)
end
end
diff --git a/xmake/modules/core/tools/iccarm.lua b/xmake/modules/core/tools/iccarm.lua
index 50f9260cb..c1b763550 100644
--- a/xmake/modules/core/tools/iccarm.lua
+++ b/xmake/modules/core/tools/iccarm.lua
@@ -141,10 +141,7 @@ function compile(self, sourcefile, objectfile, dependinfo, flags, opt)
-- print some warnings
if warnings and #warnings > 0 and not warnings:find("Warnings: none", 1, true) and policy.build_warnings(opt) then
- if progress.showing_without_scroll() then
- print("")
- end
- cprint("${color.warning}%s", table.concat(table.slice(warnings:split('\n'), 1, 8), '\n'))
+ progress.show_output("${color.warning}%s", table.concat(table.slice(warnings:split('\n'), 1, 8), '\n'))
end
end
}
diff --git a/xmake/modules/core/tools/nvcc.lua b/xmake/modules/core/tools/nvcc.lua
index aab088bf4..27f0340f5 100644
--- a/xmake/modules/core/tools/nvcc.lua
+++ b/xmake/modules/core/tools/nvcc.lua
@@ -450,10 +450,7 @@ function compile(self, sourcefile, objectfile, dependinfo, flags, opt)
-- print some warnings
if warnings and #warnings > 0 and policy.build_warnings(opt) then
- if progress.showing_without_scroll() then
- print("")
- end
- cprint("${color.warning}%s", table.concat(table.slice(warnings:split('\n', {plain = true}), 1, 8), '\n'))
+ progress.show_output("${color.warning}%s", table.concat(table.slice(warnings:split('\n', {plain = true}), 1, 8), '\n'))
end
-- generate the dependent includes
diff --git a/xmake/modules/core/tools/sdasstm8.lua b/xmake/modules/core/tools/sdasstm8.lua
index 883d31345..b9ad0e153 100644
--- a/xmake/modules/core/tools/sdasstm8.lua
+++ b/xmake/modules/core/tools/sdasstm8.lua
@@ -83,13 +83,8 @@ function compile(self, sourcefile, objectfile, dependinfo, flags, opt)
finally
{
function (ok, warnings)
-
- -- print some warnings
if warnings and #warnings > 0 and policy.build_warnings(opt) then
- if progress.showing_without_scroll() then
- print("")
- end
- cprint("${color.warning}%s", table.concat(table.slice(warnings:split('\n'), 1, 8), '\n'))
+ progress.show_output("${color.warning}%s", table.concat(table.slice(warnings:split('\n'), 1, 8), '\n'))
end
end
}
diff --git a/xmake/modules/core/tools/sdcc.lua b/xmake/modules/core/tools/sdcc.lua
index b6461cafe..ebf8ef519 100644
--- a/xmake/modules/core/tools/sdcc.lua
+++ b/xmake/modules/core/tools/sdcc.lua
@@ -234,10 +234,7 @@ function compile(self, sourcefile, objectfile, dependinfo, flags, opt)
-- show warnings
if warnings and #warnings > 0 and policy.build_warnings(opt) then
- if progress.showing_without_scroll() then
- print("")
- end
- cprint("${color.warning}%s", table.concat(table.slice(warnings:split('\n'), 1, 8), '\n'))
+ progress.show_output("${color.warning}%s", table.concat(table.slice(warnings:split('\n'), 1, 8), '\n'))
end
-- generate the dependent includes
diff --git a/xmake/modules/utils/progress.lua b/xmake/modules/utils/progress.lua
index fadc443e1..ca6a9ec01 100644
--- a/xmake/modules/utils/progress.lua
+++ b/xmake/modules/utils/progress.lua
@@ -248,11 +248,6 @@ function _show_progress_with_singlerow_refresh(progress, format, ...)
io.flush()
end
--- showing progress line without scroll?
-function showing_without_scroll()
- return _g.showing_without_scroll
-end
-
-- show the message with progress
function show(progress, format, ...)
progress = type(progress) == "table" and progress:percent() or math.floor(progress)
@@ -270,6 +265,15 @@ function show(progress, format, ...)
end
end
+-- print additional output logs with colors outside the progress log area, such as warning logs.
+-- it's used when the progress style is multirow/singlerow refresh.
+function show_output(format, ...)
+ if _g.showing_without_scroll then
+ print("")
+ end
+ cprint(format, ...)
+end
+
-- get the message text with progress
function text(progress, format, ...)
progress = type(progress) == "table" and progress:percent() or math.floor(progress)