summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2025-03-27 00:57:36 +0800
committerruki <[email protected]>2025-04-08 15:31:55 +0800
commit881671b9516d2e5b76436db1c9456aa02625ec52 (patch)
tree1b274ecde810f85f30efa6dde9890c6d7f46ab6e
parent37c593a71339240ea880ab5478f2f5120af992cc (diff)
fix instances list
-rw-r--r--xmake/actions/build/target_utils.lua8
1 files changed, 7 insertions, 1 deletions
diff --git a/xmake/actions/build/target_utils.lua b/xmake/actions/build/target_utils.lua
index aa5413995..1fef599ac 100644
--- a/xmake/actions/build/target_utils.lua
+++ b/xmake/actions/build/target_utils.lua
@@ -43,9 +43,14 @@ function _add_stage_jobs_for_target(jobgraph, target, stage, opt)
-- the command script name, e.g. before/after_preparecmd, before/after_buildcmd
local scriptcmd_name = stage ~= "" and (job_kind .. "cmd_" .. stage) or (job_kind .. "cmd")
+ -- TODO sort them
+ local instances = {target}
+ for _, r in ipairs(target:orderules()) do
+ table.insert(instances, r)
+ end
+
-- call target and rules script
local jobdeps = {}
- local instances = table.join(target, target:orderules()) -- TODO sort them
for _, instance in ipairs(instances) do
local script = instance:script(script_name)
if script then
@@ -60,6 +65,7 @@ function _add_stage_jobs_for_target(jobgraph, target, stage, opt)
if scriptcmd then
local jobname = string.format("%s/%s/%s", instance == target and "target" or "rule", instance:fullname(), scriptcmd_name)
jobgraph:add(jobname, function (index, total, opt)
+ -- TODO bind target envs
local batchcmds_ = batchcmds.new({target = target})
scriptcmd(target, batchcmds_, {progress = progress})
batchcmds_:runcmds({changed = target:is_rebuilt(), dryrun = option.get("dry-run")})