summaryrefslogtreecommitdiff
path: root/xmake/modules/private/action/require/impl/package.lua
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 /xmake/modules/private/action/require/impl/package.lua
parent2d2192a88204f004b74f04015c8d0bad21cc0eae (diff)
improve should install
Diffstat (limited to 'xmake/modules/private/action/require/impl/package.lua')
-rw-r--r--xmake/modules/private/action/require/impl/package.lua22
1 files changed, 16 insertions, 6 deletions
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 = {}