summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/xpack.lua2
-rw-r--r--xmake/plugins/pack/main.lua13
-rw-r--r--xmake/plugins/pack/xpack.lua6
3 files changed, 17 insertions, 4 deletions
diff --git a/core/xpack.lua b/core/xpack.lua
index f33ba2994..9f1721e5a 100644
--- a/core/xpack.lua
+++ b/core/xpack.lua
@@ -97,7 +97,7 @@ xpack("xmakesrc")
before_package(function (package)
import("devel.git")
- local rootdir = path.join(os.tmpfile(package:basename()) .. ".dir", "repo")
+ local rootdir = path.join(os.tmpfile(package:basename() .. "_" .. package:format()) .. ".dir", "repo")
if not os.isdir(rootdir) then
os.tryrm(rootdir)
os.cp(path.directory(os.projectdir()), rootdir)
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)