summaryrefslogtreecommitdiff
path: root/xmake/modules
diff options
context:
space:
mode:
authorruki <[email protected]>2020-05-30 23:18:28 +0800
committerruki <[email protected]>2020-05-30 23:18:28 +0800
commitd50200be0abb94e7e627e7a25b5bab65d420eb16 (patch)
tree06ab0407ff802bee7e9b7275df6081d657fe3609 /xmake/modules
parent8ee95c16390e8dbac222d1c0e665eb7dc43cccc7 (diff)
add progress.show
Diffstat (limited to 'xmake/modules')
-rw-r--r--xmake/modules/private/action/build/object.lua9
-rw-r--r--xmake/modules/private/utils/progress.lua11
2 files changed, 13 insertions, 7 deletions
diff --git a/xmake/modules/private/action/build/object.lua b/xmake/modules/private/action/build/object.lua
index b6e5d63e1..3b5bc1368 100644
--- a/xmake/modules/private/action/build/object.lua
+++ b/xmake/modules/private/action/build/object.lua
@@ -25,6 +25,7 @@ import("core.tool.compiler")
import("core.project.depend")
import("private.tools.ccache")
import("private.async.runjobs")
+import("private.utils.progress")
-- do build file
function _do_build_file(target, sourcefile, opt)
@@ -33,7 +34,6 @@ function _do_build_file(target, sourcefile, opt)
local objectfile = opt.objectfile
local dependfile = opt.dependfile
local sourcekind = opt.sourcekind
- local progress = opt.progress
-- load compiler
local compinst = compiler.load(sourcekind, {target = target})
@@ -60,12 +60,7 @@ function _do_build_file(target, sourcefile, opt)
-- trace progress info
if not opt.quiet then
- local progress_prefix = "${color.build.progress}" .. theme.get("text.build.progress_format") .. ":${clear} "
- if verbose then
- cprint(progress_prefix .. "${dim color.build.object}%scompiling.$(mode) %s", progress, exists_ccache and "ccache " or "", sourcefile)
- else
- cprint(progress_prefix .. "${color.build.object}%scompiling.$(mode) %s", progress, exists_ccache and "ccache " or "", sourcefile)
- end
+ progress.show(opt.progress, "${color.build.object}%scompiling.$(mode) %s", exists_ccache and "ccache " or "", sourcefile)
end
-- trace verbose info
diff --git a/xmake/modules/private/utils/progress.lua b/xmake/modules/private/utils/progress.lua
index eaf82c369..ad1402238 100644
--- a/xmake/modules/private/utils/progress.lua
+++ b/xmake/modules/private/utils/progress.lua
@@ -19,6 +19,7 @@
--
-- imports
+import("core.base.option")
import("core.base.object")
import("core.theme.theme")
@@ -88,6 +89,16 @@ function process:running()
return self._RUNNING and true or false
end
+-- show the message with process
+function show(progress, format, ...)
+ local progress_prefix = "${color.build.progress}" .. theme.get("text.build.progress_format") .. ":${clear} "
+ if option.get("verbose") then
+ cprint(progress_prefix .. "${dim}" .. format, progress, ...)
+ else
+ cprint(progress_prefix .. format, progress, ...)
+ end
+end
+
-- build a progress indicator
-- @params stream - stream to write to, will use io.stdout if not provided
-- @params opt - options