summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2024-03-06 00:40:01 +0800
committerruki <[email protected]>2024-03-06 00:40:01 +0800
commitb02da01326793d01af304f912f243a2b38b5bd92 (patch)
tree84ef737b6f1a8d09b7268d6f089425015bde4480
parentae60a1e8e8d44cd54bbbfd5c5054c9b8450a60b8 (diff)
add should fetch package
-rw-r--r--xmake/modules/private/action/require/impl/install_packages.lua12
1 files changed, 9 insertions, 3 deletions
diff --git a/xmake/modules/private/action/require/impl/install_packages.lua b/xmake/modules/private/action/require/impl/install_packages.lua
index dbf13c88e..359392f71 100644
--- a/xmake/modules/private/action/require/impl/install_packages.lua
+++ b/xmake/modules/private/action/require/impl/install_packages.lua
@@ -357,6 +357,14 @@ function _fetch_packages(packages_fetch, installdeps)
isolate = true})
end
+-- should fetch package?
+function _should_fetch_package(instance)
+ if instance:is_fetchonly() or not option.get("force") or
+ (option.get("shallow") and not instance:is_toplevel()) then
+ return true
+ end
+end
+
-- should install package?
function _should_install_package(instance)
_g.package_status_cache = _g.package_status_cache or {}
@@ -672,9 +680,7 @@ function main(requires, opt)
-- fetch and register packages (with system) from local first
local packages_fetch = {}
for _, instance in ipairs(packages) do
- if instance and (instance:is_fetchonly() or
- not option.get("force") or
- (option.get("shallow") and not instance:is_toplevel())) then
+ if _should_fetch_package(instance) then
table.insert(packages_fetch, instance)
end
end