diff options
| author | ruki <[email protected]> | 2021-02-04 22:50:04 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2021-02-04 22:50:04 +0800 |
| commit | 21f54de18ca93ef952e5c5711fa491330cf9f49f (patch) | |
| tree | 7ca2ab9a95c2021ad6c494802b7edc4212498b33 /xmake/core/tool/toolchain.lua | |
| parent | b90547ab8d1436d268b09ec424df3069d77ecb35 (diff) | |
add packages toolchain
Diffstat (limited to 'xmake/core/tool/toolchain.lua')
| -rw-r--r-- | xmake/core/tool/toolchain.lua | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/xmake/core/tool/toolchain.lua b/xmake/core/tool/toolchain.lua index 31daea468..cd71245bf 100644 --- a/xmake/core/tool/toolchain.lua +++ b/xmake/core/tool/toolchain.lua @@ -273,20 +273,21 @@ end function _instance:packages() local packages = self._PACKAGES if packages == nil then - packages = {} local project = require("project/project") - for _, pkgname in ipairs(table.wrap(self:config("packages"))) do + -- we will get packages from `set_toolchains("", {packages})` or `toolchain().add_packages()` + for _, pkgname in ipairs(table.wrap(self:config("packages") or self:info():get("packages"))) do local requires = project.requires() if requires then local pkginfo = requires[pkgname] if pkginfo then + packages = packages or {} table.insert(packages, pkginfo) end end end - self._PACKAGES = packages + self._PACKAGES = packages or false end - return packages + return packages or nil end -- on check (builtin) @@ -466,8 +467,10 @@ function toolchain.apis() , "toolchain.set_bindir" , "toolchain.set_sdkdir" , "toolchain.set_archs" + , "toolchain.set_packages" , "toolchain.set_homepage" , "toolchain.set_description" + , "toolchain.add_packages" } , keyvalues = { |
