diff options
| author | ruki <[email protected]> | 2021-12-04 22:52:21 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2021-12-04 22:52:21 +0800 |
| commit | dc56afae5c2f826878b06c066436971fd95f8087 (patch) | |
| tree | 1e6c8fe1fa1ddcf115993edd042edea3256c1fd5 /xmake/modules/private/action/require/impl/package.lua | |
| parent | fd8316a7f35ff45dd93a3570a16599fd9d742f63 (diff) | |
Update package.lua
Diffstat (limited to 'xmake/modules/private/action/require/impl/package.lua')
| -rw-r--r-- | xmake/modules/private/action/require/impl/package.lua | 29 |
1 files changed, 25 insertions, 4 deletions
diff --git a/xmake/modules/private/action/require/impl/package.lua b/xmake/modules/private/action/require/impl/package.lua index d920a95a1..1d013b91e 100644 --- a/xmake/modules/private/action/require/impl/package.lua +++ b/xmake/modules/private/action/require/impl/package.lua @@ -254,18 +254,39 @@ end -- -- orderdeps: c -> b -> a -- -function _sort_packagedeps(package, onlylink) +function _sort_packagedeps(package) -- we must use native deps list instead of package:deps() to generate correct linkdeps local orderdeps = {} for _, dep in ipairs(package:plaindeps()) do - if dep and (onlylink ~= true or (dep:is_library() and not dep:is_private())) then - table.join2(orderdeps, _sort_packagedeps(dep, onlylink)) + if dep then + table.join2(orderdeps, _sort_packagedeps(dep)) table.insert(orderdeps, dep) end end return orderdeps end +-- sort link deps +-- +-- e.g. +-- +-- a.deps = b +-- b.deps = c +-- +-- orderdeps: a -> b -> c +-- +function _sort_linkdeps(package) + -- we must use native deps list instead of package:deps() to generate correct linkdeps + local orderdeps = {} + for _, dep in ipairs(package:plaindeps()) do + if dep and dep:is_library() and not dep:is_private() then + table.insert(orderdeps, dep) + table.join2(orderdeps, _sort_linkdeps(dep)) + end + end + return orderdeps +end + -- add some builtin configurations to package function _add_package_configurations(package) -- we can define configs to override it and it's default value in package() @@ -818,7 +839,7 @@ function _load_packages(requires, opt) package._DEPS = packagedeps package._PLAINDEPS = plaindeps package._ORDERDEPS = table.unique(_sort_packagedeps(package)) - package._LINKDEPS = table.reverse_unique(_sort_packagedeps(package, true)) + package._LINKDEPS = table.reverse_unique(_sort_linkdeps(package)) end end |
