summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2025-11-01 00:42:25 +0800
committerruki <[email protected]>2025-11-01 00:42:25 +0800
commit4b0a1d6e4eb5ce15b86f75a3e8ca85041c445ad0 (patch)
treea55e26bf3493b3cdab5e2b9739e3d5db49d503f3
parentfe201a2122485acc09e5c5bda75cdb14a7d4d50e (diff)
add build.progress_style policy
-rw-r--r--xmake/core/project/policy.lua2
-rw-r--r--xmake/modules/utils/progress.lua11
-rw-r--r--xmake/themes/ninja/xmake.lua2
-rw-r--r--xmake/themes/soong/xmake.lua2
4 files changed, 10 insertions, 7 deletions
diff --git a/xmake/core/project/policy.lua b/xmake/core/project/policy.lua
index 50d9c25e6..d2aca60cb 100644
--- a/xmake/core/project/policy.lua
+++ b/xmake/core/project/policy.lua
@@ -117,6 +117,8 @@ function policy.policies()
["build.jobgraph"] = {description = "Enable build jobgraph.", default = true, type = "boolean"},
-- Enable build on only remote machines
["build.distcc.remote_only"] = {description = "Enable build on only remote machines.", default = false, type = "boolean"},
+ -- Set the build progress output style, e.g. scroll (default), singlerow, multirow
+ ["build.progress_style"] = {description = "Set the build progress output style.", type = "string", values = {"scroll", "singlerow", "multirow"}},
-- Enable windows UAC and set level, e.g. invoker, admin, highest
["windows.manifest.uac"] = {description = "Enable windows manifest UAC.", type = "string"},
-- Enable ui access for windows UAC
diff --git a/xmake/modules/utils/progress.lua b/xmake/modules/utils/progress.lua
index a29d7cd2b..e3040e94d 100644
--- a/xmake/modules/utils/progress.lua
+++ b/xmake/modules/utils/progress.lua
@@ -25,6 +25,7 @@ import("core.base.colors")
import("core.base.tty")
import("core.base.scheduler")
import("core.theme.theme")
+import("core.project.project")
-- define module
local progress = progress or object { _init = { "_RUNNING", "_INDEX", "_STREAM", "_OPT" } }
@@ -78,7 +79,7 @@ end
function _is_scroll()
local is_scroll = _g.is_scroll
if is_scroll == nil then
- local style = theme.get("text.build.progress_style") or "scroll"
+ local style = project.policy("build.progress_style") or theme.get("text.build.progress_style") or "scroll"
if style == "scroll" then
is_scroll = true
end
@@ -91,8 +92,8 @@ end
function _is_multirow_refresh()
local is_multirow_refresh = _g.is_multirow_refresh
if is_multirow_refresh == nil then
- local style = theme.get("text.build.progress_style")
- if style == "multirow_refresh" and tty.has_vtansi() and io.isatty() then
+ local style = project.policy("build.progress_style") or theme.get("text.build.progress_style")
+ if style == "multirow" and tty.has_vtansi() and io.isatty() then
is_multirow_refresh = true
end
_g.is_multirow_refresh = is_multirow_refresh
@@ -104,8 +105,8 @@ end
function _is_singlerow_refresh()
local is_singlerow_refresh = _g.is_singlerow_refresh
if is_singlerow_refresh == nil then
- local style = theme.get("text.build.progress_style")
- if style == "singlerow_refresh" and tty.has_vtansi() and io.isatty() then
+ local style = project.policy("build.progress_style") or theme.get("text.build.progress_style")
+ if style == "singlerow" and tty.has_vtansi() and io.isatty() then
is_singlerow_refresh = true
end
_g.is_singlerow_refresh = is_singlerow_refresh
diff --git a/xmake/themes/ninja/xmake.lua b/xmake/themes/ninja/xmake.lua
index 99f45e49b..520f5fd5e 100644
--- a/xmake/themes/ninja/xmake.lua
+++ b/xmake/themes/ninja/xmake.lua
@@ -43,7 +43,7 @@ theme("ninja")
-- the building progress
set_text("build.progress_format", "[%3d%%]")
- set_text("build.progress_style", "singlerow_refresh")
+ set_text("build.progress_style", "singlerow")
set_color("build.progress", "green bright")
-- the building object file
diff --git a/xmake/themes/soong/xmake.lua b/xmake/themes/soong/xmake.lua
index 090e8f017..ae74bb0f8 100644
--- a/xmake/themes/soong/xmake.lua
+++ b/xmake/themes/soong/xmake.lua
@@ -43,7 +43,7 @@ theme("soong")
-- the building progress
set_text("build.progress_format", "[%3d%%]")
- set_text("build.progress_style", "multirow_refresh")
+ set_text("build.progress_style", "multirow")
set_color("build.progress", "green bright")
-- only for multirow_refresh
set_color("build.progress_superslow", "red")