summaryrefslogtreecommitdiff
path: root/xmake/modules/private/action/require/impl/package.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2021-03-26 00:45:57 +0800
committerruki <[email protected]>2021-03-26 23:09:48 +0800
commit55db717033eac0d71650149d9deef7744ecacd13 (patch)
treea4da30719f76c561de36746cb82259c94b8469ed /xmake/modules/private/action/require/impl/package.lua
parent49953b37d748a0116626a74f87faebf198c2d688 (diff)
linkdeps
Diffstat (limited to 'xmake/modules/private/action/require/impl/package.lua')
-rw-r--r--xmake/modules/private/action/require/impl/package.lua17
1 files changed, 11 insertions, 6 deletions
diff --git a/xmake/modules/private/action/require/impl/package.lua b/xmake/modules/private/action/require/impl/package.lua
index cc6d43afd..ddfb0210e 100644
--- a/xmake/modules/private/action/require/impl/package.lua
+++ b/xmake/modules/private/action/require/impl/package.lua
@@ -195,14 +195,18 @@ end
--
-- orderdeps: c -> b -> a
--
-function _sort_packagedeps(package)
+function _sort_packagedeps(package, onlylink)
+ -- we must use native deps list instead of package:deps() to generate correct linkdeps
+ -- TODO filter package name
local orderdeps = {}
- local deps = package:deps()
+ local deps = package:get("deps")
if deps then
- for _, depname in ipairs(table.orderkeys(deps)) do
- local dep = deps[depname]
- table.join2(orderdeps, _sort_packagedeps(dep))
- table.insert(orderdeps, dep)
+ for _, depname in ipairs(deps) do
+ local dep = package:dep(depname)
+ if dep and (onlylink ~= true or dep:is_library()) then
+ table.join2(orderdeps, _sort_packagedeps(dep, onlylink))
+ table.insert(orderdeps, dep)
+ end
end
end
return orderdeps
@@ -654,6 +658,7 @@ function _load_packages(requires, opt)
end
package._DEPS = packagedeps
package._ORDERDEPS = table.unique(_sort_packagedeps(package))
+ package._LINKDEPS = table.unique(_sort_packagedeps(package, true))
end
end