From 266f4f7150a4def0c4fc2540ceb1fbf944cbd7ea Mon Sep 17 00:00:00 2001 From: ruki Date: Sat, 20 Feb 2021 18:01:39 +0800 Subject: improve protobuf rule --- xmake/modules/private/utils/batchcmds.lua | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'xmake/modules/private/utils/batchcmds.lua') diff --git a/xmake/modules/private/utils/batchcmds.lua b/xmake/modules/private/utils/batchcmds.lua index f4f5b84a8..617385508 100644 --- a/xmake/modules/private/utils/batchcmds.lua +++ b/xmake/modules/private/utils/batchcmds.lua @@ -25,6 +25,7 @@ import("core.base.tty") import("core.base.colors") import("core.project.depend") import("core.theme.theme") +import("core.tool.compiler") import("private.utils.progress", {alias = "progress_utils"}) -- define module @@ -97,6 +98,15 @@ end -- add command function batchcmds:add_cmd(program, argv, opt) table.insert(self:cmds(), {program = program, argv = argv, runopt = opt}) + self:add_depvalues(program, argv) +end + +-- add compilation command +function batchcmds:add_compcmd(sourcefiles, objectfile, opt) + opt = opt or {} + opt.target = self._TARGET -- bind target if exists + local program, argv = compiler.compargv(sourcefiles, objectfile, opt) + self:add_cmd(program, argv, {envs = opt.envs}) end -- add command tip @@ -154,7 +164,8 @@ function batchcmds:run(opt) if self:empty() then return end - if self:deps() then + local deps = self:deps() + if deps and deps.files then depend.on_changed(function () _runcmds(self:cmds(), opt) end, self:deps()) -- cgit v1.3.1