From 9853a1ff86b04ec666ef3cb9ec8d3aa38105b4e2 Mon Sep 17 00:00:00 2001 From: Jérôme Leclercq Date: Thu, 29 Jul 2021 01:38:13 +0200 Subject: Improve package loading --- xmake/modules/private/action/require/impl/package.lua | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'xmake/modules/private/action/require/impl/package.lua') 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 -- cgit v1.3.1