summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJérôme Leclercq <[email protected]>2021-07-29 01:38:13 +0200
committerGitHub <[email protected]>2021-07-29 01:38:13 +0200
commit9853a1ff86b04ec666ef3cb9ec8d3aa38105b4e2 (patch)
tree683ab33fd1f0baa520064538bcbd345e8726d05e
parent111499e18c11b613e710159c0a27e5f0e4e0d913 (diff)
Improve package loading
-rw-r--r--xmake/modules/private/action/require/impl/package.lua5
1 files changed, 5 insertions, 0 deletions
diff --git a/xmake/modules/private/action/require/impl/package.lua b/xmake/modules/private/action/require/impl/package.lua
index 516b0be89..e33b34bbf 100644
--- a/xmake/modules/private/action/require/impl/package.lua
+++ b/xmake/modules/private/action/require/impl/package.lua
@@ -663,6 +663,11 @@ function _load_package(packagename, requireinfo, opt)
-- get package from cache first
local package_cached = _memcache():get2("packages", packagekey)
if package_cached then
+ -- since toplevel is not part of packagekey, we need to ensure it's part of the cached package table too
+ if requireinfo.is_toplevel and not package_cached:is_toplevel() then
+ package_cached:requireinfo().is_toplevel = true
+ end
+
return package_cached
end