diff options
| author | ruki <[email protected]> | 2021-03-12 00:48:47 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2021-03-12 00:48:47 +0800 |
| commit | baa4c6ab9d2c7b6ff03255b8cc1a7890d9ef6602 (patch) | |
| tree | 2fb6b1c1ab7f27413e52fc0bee6bdecb9586349f | |
| parent | 6235369194c12c47b6977970d2ae2b1e92c4deb5 (diff) | |
rename :optional to is_optional
6 files changed, 39 insertions, 39 deletions
diff --git a/xmake/core/package/package.lua b/xmake/core/package/package.lua index 36a50146b..6794a4359 100644 --- a/xmake/core/package/package.lua +++ b/xmake/core/package/package.lua @@ -343,6 +343,38 @@ function _instance:is_fetchonly() return self:get("fetch") and not self:get("install") end +-- is optional package? +function _instance:is_optional() + local requireinfo = self:requireinfo() + return requireinfo and requireinfo.optional or false +end + +-- verify sha256sum and versions? +function _instance:verify() + local requireinfo = self:requireinfo() + local verify = requireinfo and requireinfo.verify + if verify == nil then + verify = true + end + return verify +end + +-- is debug package? +function _instance:debug() + return self:config("debug") +end + +-- is the supported package? +function _instance:supported() + -- attempt to get the install script with the current plat/arch + return self:script("install") ~= nil +end + +-- support parallelize for installation? +function _instance:parallelize() + return self:get("parallelize") ~= false +end + -- get the filelock of the whole package directory function _instance:filelock() local filelock = self._FILELOCK @@ -908,38 +940,6 @@ function _instance:group() end end --- is optional package? -function _instance:optional() - local requireinfo = self:requireinfo() - return requireinfo and requireinfo.optional or false -end - --- verify sha256sum and versions? -function _instance:verify() - local requireinfo = self:requireinfo() - local verify = requireinfo and requireinfo.verify - if verify == nil then - verify = true - end - return verify -end - --- is debug package? -function _instance:debug() - return self:config("debug") -end - --- is the supported package? -function _instance:supported() - -- attempt to get the install script with the current plat/arch - return self:script("install") ~= nil -end - --- support parallelize for installation? -function _instance:parallelize() - return self:get("parallelize") ~= false -end - -- get xxx_script function _instance:script(name, generic) diff --git a/xmake/modules/private/action/require/impl/actions/download.lua b/xmake/modules/private/action/require/impl/actions/download.lua index 93f8d3ddf..adcb7c8ff 100644 --- a/xmake/modules/private/action/require/impl/actions/download.lua +++ b/xmake/modules/private/action/require/impl/actions/download.lua @@ -239,7 +239,7 @@ function main(package) table.insert(urls_failed, url) -- failed? break it - if idx == #urls and not package:optional() then + if idx == #urls and not package:is_optional() then if #urls_failed > 0 then print("") print("we can also download these packages manually:") diff --git a/xmake/modules/private/action/require/impl/install_packages.lua b/xmake/modules/private/action/require/impl/install_packages.lua index d89f83e05..f283b5725 100644 --- a/xmake/modules/private/action/require/impl/install_packages.lua +++ b/xmake/modules/private/action/require/impl/install_packages.lua @@ -64,7 +64,7 @@ end -- get package configs string function _get_package_configs_str(instance) local configs = {} - if instance:optional() then + if instance:is_optional() then table.insert(configs, "optional") end local requireinfo = instance:requireinfo() @@ -443,7 +443,7 @@ function main(requires, opt) packages_download[tostring(instance)] = instance end table.insert(packages_install, instance) - elseif not instance:optional() then + elseif not instance:is_optional() then table.insert(packages_unsupported, instance) end end @@ -463,7 +463,7 @@ function main(requires, opt) if not _get_confirm(packages_install) then local packages_must = {} for _, instance in ipairs(packages_install) do - if not instance:optional() then + if not instance:is_optional() then table.insert(packages_must, instance:displayname()) end end diff --git a/xmake/modules/private/action/require/info.lua b/xmake/modules/private/action/require/info.lua index 1c5977134..6c59cab0a 100644 --- a/xmake/modules/private/action/require/info.lua +++ b/xmake/modules/private/action/require/info.lua @@ -59,7 +59,7 @@ end function _info(instance) local info = instance:version_str() and instance:version_str() or "no version" info = info .. _from(instance) - info = info .. (instance:optional() and ", ${yellow}optional${clear}" or "") + info = info .. (instance:is_optional() and ", ${yellow}optional${clear}" or "") return info end diff --git a/xmake/modules/private/action/require/install.lua b/xmake/modules/private/action/require/install.lua index 7df999c93..3728cf1e7 100644 --- a/xmake/modules/private/action/require/install.lua +++ b/xmake/modules/private/action/require/install.lua @@ -36,7 +36,7 @@ function _check_missing_packages(packages) local optional_missing = {} for _, instance in ipairs(packages) do if package.should_install(instance) or (instance:is_fetchonly() and not instance:exists()) then - if instance:optional() then + if instance:is_optional() then optional_missing[instance:name()] = instance else table.insert(packages_missing, instance:name()) diff --git a/xmake/modules/private/action/require/list.lua b/xmake/modules/private/action/require/list.lua index 95a4158ba..81fa13e61 100644 --- a/xmake/modules/private/action/require/list.lua +++ b/xmake/modules/private/action/require/list.lua @@ -49,7 +49,7 @@ end function _info(instance) local info = instance:version_str() and instance:version_str() or "no version" info = info .. _from(instance) - info = info .. (instance:optional() and ", ${yellow}optional${clear}" or "") + info = info .. (instance:is_optional() and ", ${yellow}optional${clear}" or "") return info end |
