diff options
| author | ruki <[email protected]> | 2026-03-10 00:52:32 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2026-03-10 00:52:32 +0800 |
| commit | dbd3e1a81718585105ed342ecc128df149590f70 (patch) | |
| tree | ea03f47a403a0e51d60539017b311bd7adacc5fb /xmake/modules/async | |
| parent | 1ec51411988ae0ca5adcaeeb383a107d305f9907 (diff) | |
show target name in progress
Diffstat (limited to 'xmake/modules/async')
| -rw-r--r-- | xmake/modules/async/runjobs.lua | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/xmake/modules/async/runjobs.lua b/xmake/modules/async/runjobs.lua index 20e8890a1..224841c12 100644 --- a/xmake/modules/async/runjobs.lua +++ b/xmake/modules/async/runjobs.lua @@ -66,6 +66,7 @@ function _init_progress(state, opt) state.progress_finished_count = 0 state.progress_factor = opt.progress_factor or 1.0 local progress_wrapper = {} + local progress_wrapper_data = {} progress_wrapper.current = function () return state.progress_finished_count end @@ -80,6 +81,26 @@ function _init_progress(state, opt) return 0 end end + progress_wrapper.set = function (_, key, value) + local running = scheduler.co_running() + if running then + local co_data = progress_wrapper_data[running] + if not co_data then + co_data = {} + progress_wrapper_data[running] = co_data + end + co_data[key] = value + end + end + progress_wrapper.get = function (_, key) + local running = scheduler.co_running() + if running then + local co_data = progress_wrapper_data[running] + if co_data then + return co_data[key] + end + end + end debug.setmetatable(progress_wrapper, { __tostring = function () return string.format("%d%%", progress_wrapper.percent()) |
