diff options
| author | ruki <[email protected]> | 2023-09-27 23:53:21 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2023-09-27 23:53:21 +0800 |
| commit | 6ffb48dd54c6d2d4e6168fac56943481d58e29c4 (patch) | |
| tree | 7a463c358d683d9a9ad047ed0e1a052c488ee8fa /xmake/core/base/scopeinfo.lua | |
| parent | d53b673e631873b21b07665498a142cc31059c81 (diff) | |
add groups for interpreter
Diffstat (limited to 'xmake/core/base/scopeinfo.lua')
| -rw-r--r-- | xmake/core/base/scopeinfo.lua | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/xmake/core/base/scopeinfo.lua b/xmake/core/base/scopeinfo.lua index d7215917f..8254ffc98 100644 --- a/xmake/core/base/scopeinfo.lua +++ b/xmake/core/base/scopeinfo.lua @@ -188,6 +188,66 @@ function _instance:_api_add_values(name, ...) end end +-- set the api groups to the scope info +function _instance:_api_set_groups(name, ...) + + -- get the scope info + local scope = self._INFO + + -- get extra config + local values = {...} + local extra_config = values[#values] + if table.is_dictionary(extra_config) then + table.remove(values) + else + extra_config = nil + end + + -- expand values + values = table.join(table.unpack(values)) + + -- save values + scope[name] = values + + -- save extra config + if extra_config and extra_config.name then + scope["__extra_" .. name] = scope["__extra_" .. name] or {} + local extrascope = scope["__extra_" .. name] + extrascope[extra_config.name] = extra_config + end +end + +-- add the api groups to the scope info +function _instance:_api_add_groups(name, ...) + + -- get the scope info + local scope = self._INFO + + -- get extra config + local values = {...} + local extra_config = values[#values] + if table.is_dictionary(extra_config) then + table.remove(values) + else + extra_config = nil + end + + -- expand values + values = table.join(table.unpack(values)) + + -- save values + scope[name] = scope[name] or {} + table.insert(scope[name], values) + scope[name] = self:_api_handle(name, scope[name]) + + -- save extra config + if extra_config and extra_config.name then + scope["__extra_" .. name] = scope["__extra_" .. name] or {} + local extrascope = scope["__extra_" .. name] + extrascope[extra_config.name] = extra_config + end +end + -- set the api key-values to the scope info function _instance:_api_set_keyvalues(name, key, ...) |
