summaryrefslogtreecommitdiff
path: root/xmake/modules
diff options
context:
space:
mode:
authorruki <[email protected]>2025-03-19 23:03:25 +0800
committerruki <[email protected]>2025-04-08 15:31:54 +0800
commit6785ce5822f298ce64684548dfc9d35ec8dd5030 (patch)
treeb9a4dc5298695b320b3e0bdf709a7a759d0ec24d /xmake/modules
parent1621db050a13474f4d79d02c4d306013770d35b4 (diff)
improve runjobs tests
Diffstat (limited to 'xmake/modules')
-rw-r--r--xmake/modules/async/jobgraph.lua15
1 files changed, 15 insertions, 0 deletions
diff --git a/xmake/modules/async/jobgraph.lua b/xmake/modules/async/jobgraph.lua
index 3fd36194a..30513ae56 100644
--- a/xmake/modules/async/jobgraph.lua
+++ b/xmake/modules/async/jobgraph.lua
@@ -31,6 +31,21 @@ function jobgraph:jobs()
return self._jobs
end
+-- add a job to the jobgraph
+--
+-- e.g.
+-- jobgraph:add_job("xxx", function (job, opt)
+-- end)
+--
+-- @param name the job name
+-- @param run the job run command/script
+-- @param opt the job options
+--
+function jobgraph:add_job(name, run, opt)
+ local job = {name = name, run = run, opt = opt}
+ self:jobs():insert(job)
+end
+
-- tostring
function jobgraph:__tostring()
return string.format("<jobgraph:%s>", self:jobs():size())