diff options
| -rw-r--r-- | xmake/core/package/package.lua | 17 | ||||
| -rw-r--r-- | xmake/modules/private/action/require/impl/package.lua | 1 |
2 files changed, 17 insertions, 1 deletions
diff --git a/xmake/core/package/package.lua b/xmake/core/package/package.lua index b6c444778..f5d550c52 100644 --- a/xmake/core/package/package.lua +++ b/xmake/core/package/package.lua @@ -1110,10 +1110,18 @@ function _instance:_load() self._SOURCE_INITED = true local loaded = self._LOADED if not loaded then + + -- load on_load script local on_load = self:script("load") if on_load then on_load(self) end + + -- load all components + self:_load_components() + + -- load environments from the manifest to enable the environments of on_install() + self:_load_envs() end end @@ -1195,7 +1203,7 @@ function _instance:envs() end -- load the package environments from the manifest -function _instance:envs_load() +function _instance:_load_envs() local manifest = self:manifest_load() if manifest then local envs = self:_rawenvs() @@ -1205,6 +1213,13 @@ function _instance:envs_load() end end +-- load all components +function _instance:_load_components() + for _, component_inst in pairs(self:components()) do + component_inst:_load() + end +end + -- enter the package environments function _instance:envs_enter() local installdir = self:installdir({readonly = true}) diff --git a/xmake/modules/private/action/require/impl/package.lua b/xmake/modules/private/action/require/impl/package.lua index 90efb3751..842a6cd95 100644 --- a/xmake/modules/private/action/require/impl/package.lua +++ b/xmake/modules/private/action/require/impl/package.lua @@ -1033,6 +1033,7 @@ function _load_package(packagename, requireinfo, opt) -- load environments from the manifest to enable the environments of on_install() package:envs_load() + -- check api check_api(package, {load = true}) -- save this package package to cache |
