diff options
| author | ruki <[email protected]> | 2021-02-03 00:50:56 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2021-02-03 00:50:56 +0800 |
| commit | 28684d867b6e7e9135e1bcdf105df48432951068 (patch) | |
| tree | 0fa437f22980bc5561232472c03b31f4734fbc4d | |
| parent | fdda430c2af3e036683be7c2c4a2fcc37e5d08b8 (diff) | |
rename toolchain api
| -rw-r--r-- | xmake/core/package/package.lua | 11 | ||||
| -rw-r--r-- | xmake/core/platform/platform.lua | 6 | ||||
| -rw-r--r-- | xmake/core/tool/toolchain.lua | 10 |
3 files changed, 18 insertions, 9 deletions
diff --git a/xmake/core/package/package.lua b/xmake/core/package/package.lua index 12d0a722e..2cef80910 100644 --- a/xmake/core/package/package.lua +++ b/xmake/core/package/package.lua @@ -265,7 +265,11 @@ function _instance:revision(url_alias) end end --- get the package kind, binary or nil(library) +-- get the package kind +-- +-- - binary +-- - library(default) +-- function _instance:kind() local kind = self:get("kind") if not kind then @@ -277,6 +281,11 @@ function _instance:kind() return kind end +-- is binary package? +function _instance:is_binary() + return self:kind() == "binary" +end + -- get the filelock of the whole package directory function _instance:filelock() local filelock = self._FILELOCK diff --git a/xmake/core/platform/platform.lua b/xmake/core/platform/platform.lua index 281b716f5..c0bf5a8d9 100644 --- a/xmake/core/platform/platform.lua +++ b/xmake/core/platform/platform.lua @@ -164,7 +164,7 @@ function _instance:toolchains(opt) end -- get the platform toolchains - if (not toolchain_given or not toolchain_given:standalone()) and self._INFO:get("toolchains") then + if (not toolchain_given or not toolchain_given:is_standalone()) and self._INFO:get("toolchains") then names = self._INFO:get("toolchains") end end @@ -288,11 +288,11 @@ function _instance:check() while idx <= num do local toolchain = toolchains[idx] -- we need remove other standalone toolchains if standalone toolchain found - if (standalone and toolchain:standalone()) or not toolchain:check() then + if (standalone and toolchain:is_standalone()) or not toolchain:check() then table.remove(toolchains, idx) num = num - 1 else - if toolchain:standalone() then + if toolchain:is_standalone() then standalone = true end idx = idx + 1 diff --git a/xmake/core/tool/toolchain.lua b/xmake/core/tool/toolchain.lua index d2086bda0..256b9f864 100644 --- a/xmake/core/tool/toolchain.lua +++ b/xmake/core/tool/toolchain.lua @@ -142,8 +142,8 @@ function _instance:kind() return self:info():get("kind") end --- is cross-compilation toolchain -function _instance:cross_toolchain() +-- is cross-compilation toolchain? +function _instance:is_cross() if self:kind() == "cross" then return true elseif self:kind() == "standalone" and (self:cross() or self:sdkdir()) then @@ -152,7 +152,7 @@ function _instance:cross_toolchain() end -- is standalone toolchain? -function _instance:standalone() +function _instance:is_standalone() return self:kind() == "standalone" or self:kind() == "cross" end @@ -292,7 +292,7 @@ end -- on check (builtin) function _instance:_on_check() local on_check = self:info():get("check") - if not on_check and self:cross_toolchain() then + if not on_check and self:is_cross() then on_check = self.check_cross_toolchain end return on_check @@ -301,7 +301,7 @@ end -- on load (builtin) function _instance:_on_load() local on_load = self:info():get("load") - if not on_load and self:cross_toolchain() then + if not on_load and self:is_cross() then on_load = self.load_cross_toolchain end return on_load |
