summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2022-07-10 23:46:35 +0800
committerruki <[email protected]>2022-07-10 23:46:35 +0800
commit3c5afa6aa05090189e9bdf7e679bcae68511c33c (patch)
tree2208d7262419de901aacd0641647d6541aa1ec05
parent2d2192a88204f004b74f04015c8d0bad21cc0eae (diff)
improve should install
-rw-r--r--xmake/modules/private/action/require/impl/install_packages.lua2
-rw-r--r--xmake/modules/private/action/require/impl/package.lua22
2 files changed, 17 insertions, 7 deletions
diff --git a/xmake/modules/private/action/require/impl/install_packages.lua b/xmake/modules/private/action/require/impl/install_packages.lua
index b69d8531d..c2e7f61d7 100644
--- a/xmake/modules/private/action/require/impl/install_packages.lua
+++ b/xmake/modules/private/action/require/impl/install_packages.lua
@@ -393,7 +393,7 @@ function _install_packages(packages_install, packages_download, installdeps)
local dep_not_found = nil
for _, dep in pairs(installdeps[tostring(pkg)]) do
local installed = packages_installed[tostring(dep)]
- if installed == false or (installed == nil and not dep:exists() and not dep:is_optional()) then
+ if installed == false or (installed == nil and package.should_install(dep) and not dep:is_optional()) then
ready = false
dep_not_found = dep
break
diff --git a/xmake/modules/private/action/require/impl/package.lua b/xmake/modules/private/action/require/impl/package.lua
index 5c644be1c..66b26a602 100644
--- a/xmake/modules/private/action/require/impl/package.lua
+++ b/xmake/modules/private/action/require/impl/package.lua
@@ -942,13 +942,8 @@ function _must_depend_on(package, dep)
end
end
--- the cache directory
-function cachedir()
- return path.join(global.directory(), "cache", "packages")
-end
-
-- this package should be install?
-function should_install(package)
+function _should_install(package)
if package:is_template() or package:exists() then
return false
end
@@ -987,6 +982,21 @@ function should_install(package)
end
end
+-- the cache directory
+function cachedir()
+ return path.join(global.directory(), "cache", "packages")
+end
+
+-- this package should be install?
+function should_install(package)
+ local result = _memcache():get2("should_install", tostring(package))
+ if result == nil then
+ result = _should_install(package) or false
+ _memcache():set2("should_install", tostring(package), result)
+ end
+ return result
+end
+
-- get package configs string
function get_configs_str(package)
local configs = {}