diff options
| author | ruki <[email protected]> | 2022-10-17 22:55:54 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2022-10-17 22:55:54 +0800 |
| commit | a481c634dcc591198fb4d64a2f376a8da795e23c (patch) | |
| tree | b272020bfd0ef70cac780d5d2f12dae4d70c67a4 /xmake/core/package/package.lua | |
| parent | 3cf635758acdcdafcc7199adc6e05d8747c5910a (diff) | |
get components
Diffstat (limited to 'xmake/core/package/package.lua')
| -rw-r--r-- | xmake/core/package/package.lua | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/xmake/core/package/package.lua b/xmake/core/package/package.lua index e8df7b553..35b2d649c 100644 --- a/xmake/core/package/package.lua +++ b/xmake/core/package/package.lua @@ -41,6 +41,7 @@ local config = require("project/config") local policy = require("project/policy") local platform = require("platform/platform") local platform_menu = require("platform/menu") +local component = require("package/component") local language = require("language/language") local language_menu = require("language/menu") local sandbox = require("sandbox/sandbox") @@ -1754,6 +1755,24 @@ function _instance:resourcedir(name) end end +-- get the given package component +function _instance:component(name) + return self:components()[name] +end + +-- get package components +function _instance:components() + local components = self._COMPONENTS + if not components then + components = {} + for _, name in ipairs(table.wrap(self:get("components"))) do + components[name] = component.new(name, {package = self}) + end + self._COMPONENTS = components + end + return components +end + -- generate lto configs function _instance:_generate_lto_configs(sourcekind) |
