diff options
Diffstat (limited to 'xmake')
| -rw-r--r-- | xmake/plugins/pack/main.lua | 13 | ||||
| -rw-r--r-- | xmake/plugins/pack/xpack.lua | 6 |
2 files changed, 16 insertions, 3 deletions
diff --git a/xmake/plugins/pack/main.lua b/xmake/plugins/pack/main.lua index 8b6a81798..fb0c983a0 100644 --- a/xmake/plugins/pack/main.lua +++ b/xmake/plugins/pack/main.lua @@ -26,6 +26,7 @@ import("core.project.project") import("private.service.remote_build.action", {alias = "remote_build_action"}) import("actions.build.main", {rootdir = os.programdir(), alias = "build_action"}) import("xpack") +import("async.runjobs") -- get packages function _get_packages() @@ -85,9 +86,17 @@ function _pack_package(package) end function _pack_packages() - for _, package in ipairs(_get_packages()) do - _pack_package(package) + local packages = _get_packages() + local jobs = option.get("jobs") + if jobs then + jobs = tonumber(jobs) end + runjobs("pack_packages", function (index) + local package = packages[index] + if package then + _pack_package(package) + end + end, {total = #packages, comax = jobs or os.default_njob(), isolate = true}) end function _build_targets() diff --git a/xmake/plugins/pack/xpack.lua b/xmake/plugins/pack/xpack.lua index bccb93cfa..a20b480bc 100644 --- a/xmake/plugins/pack/xpack.lua +++ b/xmake/plugins/pack/xpack.lua @@ -261,7 +261,11 @@ end -- get the build directory function xpack:builddir() - return path.join(config.builddir(), ".xpack", self:name()) + local dir = path.join(config.builddir(), ".xpack", self:name()) + if self:format() then + dir = path.join(dir, self:format()) + end + return dir end -- get the build directory (deprecated) |
