summaryrefslogtreecommitdiff
path: root/xmake/rules/c++/modules/support.lua
diff options
context:
space:
mode:
authorArthur LAURENT <[email protected]>2025-05-18 16:16:52 +0200
committerArthur LAURENT <[email protected]>2025-05-18 16:16:52 +0200
commit3148ec6aad6d665af4cbad310b3cba128038b8ff (patch)
treea3578b6f9cb728285aeee806f4656487c33b139d /xmake/rules/c++/modules/support.lua
parent518ad0095cc6378e7347ab1f54c6a2109be614c9 (diff)
(C++ modules support) fix caching of sourcefiles for _patch_sourcebatch and use jobgraph instead of jobpool for parallelization
Diffstat (limited to 'xmake/rules/c++/modules/support.lua')
-rw-r--r--xmake/rules/c++/modules/support.lua33
1 files changed, 11 insertions, 22 deletions
diff --git a/xmake/rules/c++/modules/support.lua b/xmake/rules/c++/modules/support.lua
index ec2bb53e0..dc838c418 100644
--- a/xmake/rules/c++/modules/support.lua
+++ b/xmake/rules/c++/modules/support.lua
@@ -23,7 +23,6 @@ import("core.base.json")
import("core.base.hashset")
import("core.cache.memcache", {alias = "_memcache"})
import("core.cache.localcache", {alias = "_localcache"})
-import("private.async.jobpool")
import("async.runjobs")
import("lib.detect.find_file")
import("core.project.project")
@@ -236,28 +235,18 @@ function can_be_culled(target, sourcefile)
end
-- load module infos
-function load_moduleinfos(target, sourcebatch)
- local moduleinfos
- local jobs = jobpool.new()
- for _, sourcefile in ipairs(sourcebatch.sourcefiles) do
- jobs:addjob("job/load_moduleinfo/" .. sourcefile, function()
- local reused, from = is_reused(target, sourcefile)
- local dependfile = reused and from:dependfile(sourcefile) or target:dependfile(sourcefile)
- if os.isfile(dependfile) then
- local data = io.load(dependfile)
- if data then
- moduleinfos = moduleinfos or {}
- local moduleinfo = json.decode(data.moduleinfo)
- moduleinfo.sourcefile = sourcefile
- if moduleinfo then
- table.insert(moduleinfos, moduleinfo)
- end
- end
- end
- end)
+function load_moduleinfo(target, sourcefile)
+ local reused, from = is_reused(target, sourcefile)
+ local dependfile = reused and from:dependfile(sourcefile) or target:dependfile(sourcefile)
+ local moduleinfo
+ if os.isfile(dependfile) then
+ local data = io.load(dependfile)
+ if data then
+ moduleinfo = json.decode(data.moduleinfo)
+ moduleinfo.sourcefile = sourcefile
+ end
end
- runjobs(format("loading module infos for target %s", target:fullname()), jobs, {comax = option.get("jobs") or os.default_njob()})
- return moduleinfos
+ return moduleinfo
end
function find_quote_header_file(sourcefile, file)