diff options
| author | ruki <[email protected]> | 2026-03-10 00:53:43 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2026-03-10 00:53:43 +0800 |
| commit | 85d6d2e1647374020ea63791bbe15b55d700b094 (patch) | |
| tree | d5015a52003f2edc99d012c055aac655cecfa52b | |
| parent | dbd3e1a81718585105ed342ecc128df149590f70 (diff) | |
improve set target
| -rw-r--r-- | xmake/modules/private/action/build/target.lua | 8 | ||||
| -rw-r--r-- | xmake/modules/utils/progress.lua | 2 |
2 files changed, 3 insertions, 7 deletions
diff --git a/xmake/modules/private/action/build/target.lua b/xmake/modules/private/action/build/target.lua index ad50390ae..a324fd214 100644 --- a/xmake/modules/private/action/build/target.lua +++ b/xmake/modules/private/action/build/target.lua @@ -480,9 +480,7 @@ function add_filejobs_for_script(jobgraph, target, instance, sourcebatch, opt) for _, sourcefile in ipairs(sourcebatch.sourcefiles) do local jobname = string.format("%s/%s/%s", job_prefix, script_file_name, sourcefile) jobgraph:add(jobname, function (index, total, opt) - if opt.progress and opt.progress.set then - opt.progress:set("target_name", target:fullname()) - end + progress_utils.set_target(opt.progress, target) script_file(target, sourcefile, {progress = opt.progress, sourcekind = sourcekind, distcc = distcc}) end) end @@ -544,9 +542,7 @@ function add_filejobs_for_script(jobgraph, target, instance, sourcebatch, opt) for _, sourcefile in ipairs(sourcebatch.sourcefiles) do local jobname = string.format("%s/%s/%s", job_prefix, scriptcmd_file_name, sourcefile) jobgraph:add(jobname, function (index, total, opt) - if opt.progress and opt.progress.set then - opt.progress:set("target_name", target:fullname()) - end + progress_utils.set_target(opt.progress, target) local batchcmds_ = batchcmds.new({target = target}) scriptcmd_file(target, batchcmds_, sourcefile, {progress = opt.progress, sourcekind = sourcekind, distcc = distcc}) batchcmds_:runcmds({changed = target:is_rebuilt(), dryrun = option.get("dry-run")}) diff --git a/xmake/modules/utils/progress.lua b/xmake/modules/utils/progress.lua index 40cab5ec3..3e7598ac2 100644 --- a/xmake/modules/utils/progress.lua +++ b/xmake/modules/utils/progress.lua @@ -378,7 +378,7 @@ end -- set the associated target name for the progress object (coroutine-local) -- it's safe to call with non-table progress (e.g. number), it will be ignored function set_target(progress, target) - if type(progress) == "table" and progress.set then + if _is_show_target_enabled() and type(progress) == "table" and progress.set then progress:set("target_name", target:fullname()) end end |
