Skip to content

Commit

Permalink
add should fetch package
Browse files Browse the repository at this point in the history
  • Loading branch information
waruqi committed Mar 5, 2024
1 parent ae60a1e commit b02da01
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions xmake/modules/private/action/require/impl/install_packages.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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 {}
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit b02da01

Please sign in to comment.