summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2021-02-20 00:55:30 +0800
committerruki <[email protected]>2021-02-20 00:55:30 +0800
commitbf08fd02abb79831f72598a9347e9a7b3ac87989 (patch)
tree1a7b80e13b684ee9f8b9d6ac04aa5c74606df2a3
parent9dec8733c04c91f1dd145b5ff4455db6e940e140 (diff)
support depend for buildcmd
-rw-r--r--xmake/actions/build/kinds/object.lua21
1 files changed, 13 insertions, 8 deletions
diff --git a/xmake/actions/build/kinds/object.lua b/xmake/actions/build/kinds/object.lua
index 98141fbf9..23cbcd3f5 100644
--- a/xmake/actions/build/kinds/object.lua
+++ b/xmake/actions/build/kinds/object.lua
@@ -22,6 +22,7 @@
import("core.base.option")
import("core.project.rule")
import("core.project.config")
+import("core.project.depend")
import("core.project.project")
import("private.async.runjobs")
@@ -65,10 +66,12 @@ function _add_batchjobs_for_rule(batchjobs, rootjob, target, sourcebatch, suffix
script = ruleinst:script(scriptname)
if script then
batchjobs:addjob("rule/" .. rulename .. "/" .. scriptname, function (index, total)
- local cmds = script(target, sourcebatch, {progress = (index * 100) / total})
- for _, cmd in ipairs(cmds) do
- os.vrunv(cmd[1], table.slice(cmd, 2))
- end
+ local cmds, dependopt = script(target, sourcebatch, {progress = (index * 100) / total})
+ depend.on_changed(function ()
+ for _, cmd in ipairs(cmds) do
+ os.vrunv(cmd[1], table.slice(cmd, 2))
+ end
+ end, dependopt or {always_changed = true})
end, rootjob)
end
end
@@ -81,10 +84,12 @@ function _add_batchjobs_for_rule(batchjobs, rootjob, target, sourcebatch, suffix
local sourcekind = sourcebatch.sourcekind
for _, sourcefile in ipairs(sourcebatch.sourcefiles) do
batchjobs:addjob(sourcefile, function (index, total)
- local cmds = script(target, sourcefile, {sourcekind = sourcekind, progress = (index * 100) / total})
- for _, cmd in ipairs(cmds) do
- os.vrunv(cmd[1], table.slice(cmd, 2))
- end
+ local cmds, dependopt = script(target, sourcefile, {sourcekind = sourcekind, progress = (index * 100) / total})
+ depend.on_changed(function ()
+ for _, cmd in ipairs(cmds) do
+ os.vrunv(cmd[1], table.slice(cmd, 2))
+ end
+ end, dependopt or {always_changed = true})
end, rootjob)
end
end