diff options
| author | ruki <[email protected]> | 2021-02-21 18:28:25 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2021-02-21 18:28:25 +0800 |
| commit | bedd0f49b1abf23fe3f7dc72b1d46bcf1c848cff (patch) | |
| tree | 071cd474b4d6c1db4a8cf9b48492dcb447bf8281 /xmake/modules/private/action/require/impl/install_packages.lua | |
| parent | 4ef736be23496aac5a68beb3c4f36e94d5c5b3fd (diff) | |
add should_install module
Diffstat (limited to 'xmake/modules/private/action/require/impl/install_packages.lua')
| -rw-r--r-- | xmake/modules/private/action/require/impl/install_packages.lua | 17 |
1 files changed, 2 insertions, 15 deletions
diff --git a/xmake/modules/private/action/require/impl/install_packages.lua b/xmake/modules/private/action/require/impl/install_packages.lua index 48f159313..7f98c4959 100644 --- a/xmake/modules/private/action/require/impl/install_packages.lua +++ b/xmake/modules/private/action/require/impl/install_packages.lua @@ -31,6 +31,7 @@ import("actions.download", {alias = "action_download"}) import("net.fasturl") import("private.action.require.impl.package") import("private.action.require.impl.register_packages") +import("private.action.require.impl.utils.should_install") -- sort packages urls function _sort_packages_urls(packages) @@ -402,20 +403,6 @@ function _get_package_installdeps(packages) return installdeps end --- should install? -function _should_install(instance) - if instance:parents() then - -- if all the packages that depend on it already exist, then there is no need to install it - for _, parent in pairs(instance:parents()) do - if _should_install(parent) and not parent:exists() then - return true - end - end - else - return not instance:exists() - end -end - -- install packages function main(requires, opt) @@ -451,7 +438,7 @@ function main(requires, opt) local packages_download = {} local packages_unsupported = {} for _, instance in ipairs(packages) do - if _should_install(instance) then + if should_install(instance) then if instance:supported() then if #instance:urls() > 0 then packages_download[tostring(instance)] = instance |
