summaryrefslogtreecommitdiff
path: root/xmake/core/package
diff options
context:
space:
mode:
authorruki <[email protected]>2026-01-05 23:56:13 +0800
committerruki <[email protected]>2026-01-09 17:59:02 +0800
commitc6a5ff9175d280d894126412112aa10db57e6ecb (patch)
tree5551ffa9c6e51989a1ab42747514485c5cac83fa /xmake/core/package
parent7d506590468cc2fc0984a9890b4cefead1a37718 (diff)
improve to load package
Diffstat (limited to 'xmake/core/package')
-rw-r--r--xmake/core/package/package.lua17
1 files changed, 16 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})