summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2025-04-06 21:38:39 +0800
committerruki <[email protected]>2025-04-08 15:31:57 +0800
commit54227eb4e653a46b8eb9ad9642d7641db052288b (patch)
treeb13e7ed3a43a0126ef8b4c9c420ce7e51cca929b
parentda540028213b73ca014bc7aa0f7938a12e344ee8 (diff)
fix progress
-rw-r--r--xmake/actions/build/build.lua2
-rw-r--r--xmake/actions/build/build_files.lua2
-rw-r--r--xmake/actions/build/target_utils.lua4
-rw-r--r--xmake/modules/async/runjobs.lua3
4 files changed, 8 insertions, 3 deletions
diff --git a/xmake/actions/build/build.lua b/xmake/actions/build/build.lua
index 22097669a..d3fdd8e80 100644
--- a/xmake/actions/build/build.lua
+++ b/xmake/actions/build/build.lua
@@ -30,6 +30,7 @@ import("deprecated.build", {alias = "deprecated_build"})
function _prepare(targets_root, opt)
opt = opt or {}
opt.job_kind = "prepare"
+ opt.progress_factor = 0.05
target_utils.run_targetjobs(targets_root, opt)
end
@@ -37,6 +38,7 @@ end
function _build(targets_root, opt)
opt = opt or {}
opt.job_kind = "build"
+ opt.progress_factor = 0.95
if distcc_build_client.is_connected() then
opt.distcc = distcc_build_client.singleton()
end
diff --git a/xmake/actions/build/build_files.lua b/xmake/actions/build/build_files.lua
index e26c11aae..854f7de3f 100644
--- a/xmake/actions/build/build_files.lua
+++ b/xmake/actions/build/build_files.lua
@@ -75,6 +75,7 @@ end
function _prepare_files(targets_root, opt)
opt = opt or {}
opt.job_kind = "prepare"
+ opt.progress_factor = 0.05
opt.filepatterns = _get_file_patterns(opt.sourcefiles)
target_utils.run_filejobs(targets_root, opt)
end
@@ -83,6 +84,7 @@ end
function _build_files(targets_root, opt)
opt = opt or {}
opt.job_kind = "build"
+ opt.progress_factor = 0.95
opt.filepatterns = _get_file_patterns(opt.sourcefiles)
if distcc_build_client.is_connected() then
opt.distcc = distcc_build_client.singleton()
diff --git a/xmake/actions/build/target_utils.lua b/xmake/actions/build/target_utils.lua
index 92723d46c..147c25187 100644
--- a/xmake/actions/build/target_utils.lua
+++ b/xmake/actions/build/target_utils.lua
@@ -686,7 +686,7 @@ function run_targetjobs(targets_root, opt)
if errors and progress.showing_without_scroll() then
print("")
end
- end, comax = option.get("jobs") or 1, curdir = curdir, distcc = opt.distcc})
+ end, comax = option.get("jobs") or 1, curdir = curdir, distcc = opt.distcc, progress_factor = opt.progress_factor})
os.cd(curdir)
return true
end
@@ -704,7 +704,7 @@ function run_filejobs(targets_root, opt)
if errors and progress.showing_without_scroll() then
print("")
end
- end, comax = option.get("jobs") or 1, curdir = curdir, distcc = opt.distcc})
+ end, comax = option.get("jobs") or 1, curdir = curdir, distcc = opt.distcc, progress_factor = opt.progress_factor})
os.cd(curdir)
return true
end
diff --git a/xmake/modules/async/runjobs.lua b/xmake/modules/async/runjobs.lua
index d2af72843..adf68018d 100644
--- a/xmake/modules/async/runjobs.lua
+++ b/xmake/modules/async/runjobs.lua
@@ -163,6 +163,7 @@ function main(name, jobs, opt)
local abort_errors
local progress_wrapper = {}
local job_pending
+ local progress_factor = opt.progress_factor or 1.0
progress_wrapper.current = function ()
return count
end
@@ -171,7 +172,7 @@ function main(name, jobs, opt)
end
progress_wrapper.percent = function ()
if total and total > 0 then
- return math.floor((count * 100) / total)
+ return math.floor((count * progress_factor * 100) / total)
else
return 0
end