diff options
| author | ruki <[email protected]> | 2021-02-20 00:37:00 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2021-02-20 00:37:00 +0800 |
| commit | 6b4a46cfb23bae8f32594ca72223326f9821d849 (patch) | |
| tree | 7247da091df9e5abb83be5ed358eed6c3420a6d1 | |
| parent | 032eeb310a9b82ba0798422de376765f875eb653 (diff) | |
add xx_buildcmd_files for build/objects
| -rw-r--r-- | xmake/actions/build/kinds/object.lua | 38 |
1 files changed, 36 insertions, 2 deletions
diff --git a/xmake/actions/build/kinds/object.lua b/xmake/actions/build/kinds/object.lua index baf2d2f11..98141fbf9 100644 --- a/xmake/actions/build/kinds/object.lua +++ b/xmake/actions/build/kinds/object.lua @@ -32,7 +32,7 @@ function _add_batchjobs_for_rule(batchjobs, rootjob, target, sourcebatch, suffix local rulename = assert(sourcebatch.rulename, "unknown rule for sourcebatch!") local ruleinst = assert(project.rule(rulename) or rule.rule(rulename), "unknown rule: %s", rulename) - -- add batch jobs + -- add batch jobs for xx_build_files local scriptname = "build_files" .. (suffix and ("_" .. suffix) or "") local script = ruleinst:script(scriptname) if script then @@ -43,7 +43,10 @@ function _add_batchjobs_for_rule(batchjobs, rootjob, target, sourcebatch, suffix script(target, sourcebatch, {progress = (index * 100) / total}) end, rootjob) end - else + end + + -- add batch jobs for xx_build_file + if not script then scriptname = "build_file" .. (suffix and ("_" .. suffix) or "") script = ruleinst:script(scriptname) if script then @@ -55,6 +58,37 @@ function _add_batchjobs_for_rule(batchjobs, rootjob, target, sourcebatch, suffix end end end + + -- add batch jobs for xx_buildcmd_files + if not script then + scriptname = "buildcmd_files" .. (suffix and ("_" .. suffix) or "") + 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 + end, rootjob) + end + end + + -- add batch jobs for xx_buildcmd_file + if not script then + scriptname = "buildcmd_file" .. (suffix and ("_" .. suffix) or "") + script = ruleinst:script(scriptname) + if script then + 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 + end, rootjob) + end + end + end end -- add batch jobs for target |
