summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2025-11-20 00:41:24 +0800
committerruki <[email protected]>2025-11-20 00:41:24 +0800
commitd4f99444640e55c2170c7407ca567af2047dc558 (patch)
tree746a3513f4d8d9582461d2665a1a5bfb5fedfac9
parent660450b6adb49c5a8b792a0c844a414d0a1b7379 (diff)
improve progress
-rw-r--r--xmake/modules/async/runjobs.lua2
-rw-r--r--xmake/modules/private/check/checkers/clang/tidy.lua6
-rw-r--r--xmake/plugins/format/main.lua8
3 files changed, 10 insertions, 6 deletions
diff --git a/xmake/modules/async/runjobs.lua b/xmake/modules/async/runjobs.lua
index 286047199..9254cf499 100644
--- a/xmake/modules/async/runjobs.lua
+++ b/xmake/modules/async/runjobs.lua
@@ -203,8 +203,8 @@ function _consume_jobs_loop(state, run_in_remote)
if curdir then
os.cd(curdir)
end
- state.finished_count = state.finished_count + 1
job_func(job_index, total, {progress = state.progress_wrapper})
+ state.finished_count = state.finished_count + 1
end
state.running_jobs_indices[job_index] = nil
co_running:data_set("runjobs.running", false)
diff --git a/xmake/modules/private/check/checkers/clang/tidy.lua b/xmake/modules/private/check/checkers/clang/tidy.lua
index fc42a77cc..edd671db3 100644
--- a/xmake/modules/private/check/checkers/clang/tidy.lua
+++ b/xmake/modules/private/check/checkers/clang/tidy.lua
@@ -85,7 +85,7 @@ end
-- check a single sourcefile
function _check_sourcefile(clang_tidy, sourcefile, opt)
- progress.show(opt.progress_percent, "clang-tidy.analyzing %s", sourcefile)
+ progress.show(opt.progress, "clang-tidy.analyzing %s", sourcefile)
try
{
function ()
@@ -161,9 +161,9 @@ function _check_sourcefiles(clang_tidy, sourcefiles, opt)
_check_sourcefile(clang_tidy, sourcefile, {
tidy_argv = tidy_argv,
projectdir = projectdir,
- progress_percent = index * 100 / total
+ progress = job_opt.progress
})
- end, {total = #sourcefiles, comax = opt.jobs or os.default_njob()})
+ end, {total = #sourcefiles, comax = opt.jobs or os.default_njob(), showtips = false})
analyze_time = os.mclock() - analyze_time
progress.show(100, "${color.success}clang-tidy analyzed %d files, spent %.3fs", #sourcefiles, analyze_time / 1000)
end
diff --git a/xmake/plugins/format/main.lua b/xmake/plugins/format/main.lua
index aa2814af8..743f67eb5 100644
--- a/xmake/plugins/format/main.lua
+++ b/xmake/plugins/format/main.lua
@@ -219,9 +219,13 @@ function main()
runjobs("clang-format", function (index, total, opt)
local sourcefile = sourcefiles[index]
local format_argv = table.join(argv, {sourcefile})
- progress.show(index * 100 / total, "clang-format.formatting %s", sourcefile)
+ progress.show(opt.progress, "clang-format.formatting %s", sourcefile)
os.execv(clang_format.program, format_argv, {curdir = projectdir})
- end, {total = #sourcefiles, comax = jobs})
+ end, {
+ total = #sourcefiles,
+ comax = jobs,
+ showtips = false
+ })
format_time = os.mclock() - format_time
progress.show(100, "${color.success}clang-format formatted %d files, spent %.3fs", #sourcefiles, format_time / 1000)
end