summaryrefslogtreecommitdiff
path: root/xmake/modules
diff options
context:
space:
mode:
authorruki <[email protected]>2021-05-12 06:15:20 +0800
committerGitHub <[email protected]>2021-05-12 06:15:20 +0800
commit0c8ee70f2cf09156d728decc44a28c756e1beded (patch)
treea0f9258a2f79b6f9960c6eb07365520bf3e92fa9 /xmake/modules
parent29cf1854c5dd3ceedc4d89aa35ac6b100fd56571 (diff)
parent78778eb35d7b5d9c6fac432d4ed4a67dc4cbd5d3 (diff)
Merge pull request #1404 from xmake-io/jobenvs
improve envs
Diffstat (limited to 'xmake/modules')
-rw-r--r--xmake/modules/private/action/build/object.lua2
-rw-r--r--xmake/modules/private/action/require/check.lua2
-rw-r--r--xmake/modules/private/action/require/impl/install_packages.lua7
-rw-r--r--xmake/modules/private/action/require/impl/package.lua1
-rw-r--r--xmake/modules/private/async/jobpool.lua7
-rw-r--r--xmake/modules/private/async/runjobs.lua8
6 files changed, 15 insertions, 12 deletions
diff --git a/xmake/modules/private/action/build/object.lua b/xmake/modules/private/action/build/object.lua
index 7a4e3620f..50397cda4 100644
--- a/xmake/modules/private/action/build/object.lua
+++ b/xmake/modules/private/action/build/object.lua
@@ -114,6 +114,6 @@ function main(target, batchjobs, sourcebatch, opt)
batchjobs:addjob(sourcefile, function (index, total)
local build_opt = table.join({objectfile = objectfile, dependfile = dependfile, sourcekind = sourcekind, progress = (index * 100) / total}, opt)
_build_object(target, sourcefile, build_opt)
- end, rootjob)
+ end, {rootjob = rootjob})
end
end
diff --git a/xmake/modules/private/action/require/check.lua b/xmake/modules/private/action/require/check.lua
index 9b20b1310..6b37eeb8b 100644
--- a/xmake/modules/private/action/require/check.lua
+++ b/xmake/modules/private/action/require/check.lua
@@ -48,7 +48,7 @@ function main(requires_raw)
instance:fetch()
os.setenvs(oldenvs)
end
- end, {total = #packages})
+ end, {total = #packages, isolate = true})
-- register all required root packages to local cache
register_packages(packages)
diff --git a/xmake/modules/private/action/require/impl/install_packages.lua b/xmake/modules/private/action/require/impl/install_packages.lua
index 2b482b0e9..0adea1fc9 100644
--- a/xmake/modules/private/action/require/impl/install_packages.lua
+++ b/xmake/modules/private/action/require/impl/install_packages.lua
@@ -238,7 +238,10 @@ function _install_packages(packages_install, packages_download, installdeps)
packages_installing[index] = nil
packages_downloading[index] = nil
- end, {total = #packages_install, comax = (option.get("verbose") or option.get("diagnosis")) and 1 or 4, on_timer = function (running_jobs_indices)
+ end, {total = #packages_install,
+ comax = (option.get("verbose") or option.get("diagnosis")) and 1 or 4,
+ isolate = true,
+ on_timer = function (running_jobs_indices)
-- do not print progress info if be verbose
if option.get("verbose") or not show_wait then
@@ -385,7 +388,7 @@ function main(requires, opt)
instance:fetch()
os.setenvs(oldenvs)
end
- end, {total = #packages})
+ end, {total = #packages, isolate = true})
-- register all required root packages to local cache
register_packages(packages)
diff --git a/xmake/modules/private/action/require/impl/package.lua b/xmake/modules/private/action/require/impl/package.lua
index 8b29a83d7..598acd251 100644
--- a/xmake/modules/private/action/require/impl/package.lua
+++ b/xmake/modules/private/action/require/impl/package.lua
@@ -22,7 +22,6 @@
import("core.base.semver")
import("core.base.option")
import("core.base.global")
-import("private.async.runjobs")
import("private.utils.progress")
import("core.cache.memcache")
import("core.project.project")
diff --git a/xmake/modules/private/async/jobpool.lua b/xmake/modules/private/async/jobpool.lua
index eb7d5ffc1..299700534 100644
--- a/xmake/modules/private/async/jobpool.lua
+++ b/xmake/modules/private/async/jobpool.lua
@@ -39,10 +39,11 @@ end
--
-- @param name the job name
-- @param run the run command/script
--- @param rootjob the root job node (optional)
+-- @param opt the options (rootjob)
--
-function jobpool:addjob(name, run, rootjob)
- return self:add({name = name, run = run}, rootjob)
+function jobpool:addjob(name, run, opt)
+ opt = opt or {}
+ return self:add({name = name, run = run}, opt.rootjob)
end
-- add job to the given job node
diff --git a/xmake/modules/private/async/runjobs.lua b/xmake/modules/private/async/runjobs.lua
index 307adfa55..6a2964a90 100644
--- a/xmake/modules/private/async/runjobs.lua
+++ b/xmake/modules/private/async/runjobs.lua
@@ -46,7 +46,7 @@ end
-- for i = 1, 3 do
-- local job = jobs:addjob("job/" .. i, function (idx, total)
-- print(idx, total)
--- end, root)
+-- end, {rootjob = root})
-- end
-- runjobs("test", jobs, {comax = 6, timeout = 1000, on_timer = function (running_jobs_indices) end})
--
@@ -77,7 +77,7 @@ function main(name, jobs, opt)
local stop = false
local running_jobs_indices = {}
if opt.on_timer then
- scheduler.co_start_named(name .. "/timer", function ()
+ scheduler.co_start_withopt({name = name .. "/timer", isolate = opt.isolate}, function ()
while not stop do
os.sleep(timeout)
if not stop then
@@ -90,7 +90,7 @@ function main(name, jobs, opt)
end
end)
elseif showprogress then
- scheduler.co_start_named(name .. "/tips", function ()
+ scheduler.co_start_withopt({name = name .. "/tips", isolate = opt.isolate}, function ()
while not stop do
os.sleep(timeout)
if not stop then
@@ -181,7 +181,7 @@ function main(name, jobs, opt)
-- start this job
index = index + 1
- scheduler.co_start_named(name .. '/' .. jobname, function(i)
+ scheduler.co_start_withopt({name = name .. '/' .. jobname, isolate = opt.isolate}, function(i)
try
{
function()