summaryrefslogtreecommitdiff
path: root/xmake/plugins
diff options
context:
space:
mode:
authorruki <[email protected]>2021-02-20 10:25:49 +0800
committerruki <[email protected]>2021-02-20 10:25:49 +0800
commit5f25a00cd3f3708ad133dbd1c376cfdd34a3de94 (patch)
tree7815e0fce42dec2fb8a2b749959d0f50f0678e2b /xmake/plugins
parentbf08fd02abb79831f72598a9347e9a7b3ac87989 (diff)
add batchcmds
Diffstat (limited to 'xmake/plugins')
-rw-r--r--xmake/plugins/project/clang/compile_commands.lua19
1 files changed, 13 insertions, 6 deletions
diff --git a/xmake/plugins/project/clang/compile_commands.lua b/xmake/plugins/project/clang/compile_commands.lua
index 48cd0ed96..1d3f02b6d 100644
--- a/xmake/plugins/project/clang/compile_commands.lua
+++ b/xmake/plugins/project/clang/compile_commands.lua
@@ -23,6 +23,7 @@ import("core.tool.compiler")
import("core.project.rule")
import("core.project.project")
import("core.language.language")
+import("private.utils.batchcmds")
-- escape path
function _escape_path(p)
@@ -97,9 +98,12 @@ function _make_commands_for_objectrules(jsonfile, target, sourcebatch, suffix)
local scriptname = "buildcmd_files" .. (suffix and ("_" .. suffix) or "")
local script = ruleinst:script(scriptname)
if script then
- local cmds = script(target, sourcebatch)
- for _, cmd in ipairs(cmds) do
- _make_arguments(jsonfile, cmd)
+ local batchcmds_ = batchcmds.new({target = target})
+ script(target, batchcmds_, sourcebatch, {})
+ if not batchcmds_:empty() then
+ for _, cmd in ipairs(batchcmds_:cmds()) do
+ _make_arguments(jsonfile, table.join(cmd.program, cmd.argv))
+ end
end
end
@@ -110,9 +114,12 @@ function _make_commands_for_objectrules(jsonfile, target, sourcebatch, suffix)
if script then
local sourcekind = sourcebatch.sourcekind
for _, sourcefile in ipairs(sourcebatch.sourcefiles) do
- local cmds = script(target, sourcefile)
- for _, cmd in ipairs(cmds) do
- _make_arguments(jsonfile, cmd)
+ local batchcmds_ = batchcmds.new({target = target})
+ script(target, batchcmds_, sourcefile, {})
+ if not batchcmds_:empty() then
+ for _, cmd in ipairs(batchcmds_:cmds()) do
+ _make_arguments(jsonfile, table.join(cmd.program, cmd.argv))
+ end
end
end
end