summaryrefslogtreecommitdiff
path: root/xmake/plugins
diff options
context:
space:
mode:
authorruki <[email protected]>2025-12-27 20:41:50 +0800
committerruki <[email protected]>2025-12-27 20:42:33 +0800
commit0f90b217b3e6351e1e9d2f4145beafbd28553ee2 (patch)
tree37ce71a3f86d4e6f6e8822e2b85ff4a195d1cac2 /xmake/plugins
parent7ee27a5e5a58b4d8a51ec0d2c0fc153239cb6722 (diff)
parallel packpack
Diffstat (limited to 'xmake/plugins')
-rw-r--r--xmake/plugins/pack/main.lua13
-rw-r--r--xmake/plugins/pack/xpack.lua6
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)