summaryrefslogtreecommitdiff
path: root/xmake/modules/private/utils/batchcmds.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2026-07-17 23:49:52 +0800
committerruki <[email protected]>2026-07-17 23:49:52 +0800
commitf467d71abc40d4fee6e896d7a0b8e4f5be7e16db (patch)
treec46a673aa416c6b76f7ba4e875cb56e699017e13 /xmake/modules/private/utils/batchcmds.lua
parent0cb38ea4d9823ee49d15debb7a94a2fc9e72d3cc (diff)
add batchcmds:call and transform for bin2obj/c
Diffstat (limited to 'xmake/modules/private/utils/batchcmds.lua')
-rw-r--r--xmake/modules/private/utils/batchcmds.lua18
1 files changed, 17 insertions, 1 deletions
diff --git a/xmake/modules/private/utils/batchcmds.lua b/xmake/modules/private/utils/batchcmds.lua
index 3f584b286..a22879a81 100644
--- a/xmake/modules/private/utils/batchcmds.lua
+++ b/xmake/modules/private/utils/batchcmds.lua
@@ -126,6 +126,16 @@ function _runcmd_vlua(cmd, opt)
end
end
+-- run command: call
+function _runcmd_call(cmd, opt)
+ local func = cmd.func
+ if func then
+ if not opt.dryrun then
+ func(table.unpack(cmd.argv), cmd.opt)
+ end
+ end
+end
+
-- run command: os.mkdir
function _runcmd_mkdir(cmd, opt)
local dir = cmd.dir
@@ -222,6 +232,7 @@ function _runcmd(cmd, opt)
vexecv = _runcmd_vexecv,
lua = _runcmd_lua,
vlua = _runcmd_vlua,
+ call = _runcmd_call,
mkdir = _runcmd_mkdir,
rmdir = _runcmd_rmdir,
cd = _runcmd_cd,
@@ -305,11 +316,16 @@ function batchcmds:lua(script, argv, opt)
table.insert(self:cmds(), {kind = "lua", script = script, argv = argv, opt = opt})
end
--- add command: run lua script file, command or module
+-- add command: run lua script, command or module
function batchcmds:vlua(script, argv, opt)
table.insert(self:cmds(), {kind = "vlua", script = script, argv = argv, opt = opt})
end
+-- add command: call lua function
+function batchcmds:call(func, argv, opt)
+ table.insert(self:cmds(), {kind = "call", func = func, argv = argv, opt = opt})
+end
+
-- add command: compile source files
--
-- @param sourcefiles the source file paths