summaryrefslogtreecommitdiff
path: root/xmake/modules/private/action/require/impl/package.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2021-02-21 19:12:01 +0800
committerruki <[email protected]>2021-02-21 19:12:01 +0800
commite53e7a33d47b36ddff4b6ec1ed2a64413760ead6 (patch)
tree4fd1c7525a702813d5bcd074d20703b76d7b76a6 /xmake/modules/private/action/require/impl/package.lua
parent3de14fa6738d4cb9f2bf5b0fc6e635776f82d407 (diff)
move should_install script
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, 17 insertions, 0 deletions
diff --git a/xmake/modules/private/action/require/impl/package.lua b/xmake/modules/private/action/require/impl/package.lua
index abfa91e7b..f31400625 100644
--- a/xmake/modules/private/action/require/impl/package.lua
+++ b/xmake/modules/private/action/require/impl/package.lua
@@ -578,6 +578,23 @@ function _load_package(packagename, requireinfo, opt)
return package
end
+-- this package should be install?
+function should_install(package)
+ if package:exists() then
+ return false
+ end
+ if package:parents() then
+ -- if all the packages that depend on it already exist, then there is no need to install it
+ for _, parent in pairs(package:parents()) do
+ if _should_install(parent) and not parent:exists() then
+ return true
+ end
+ end
+ else
+ return true
+ end
+end
+
-- load all required packages
function _load_packages(requires, opt)