summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2025-01-07 23:34:46 +0800
committerruki <[email protected]>2025-01-07 23:34:46 +0800
commit545c0558aff2883735ae6dddbf831567d29d21f1 (patch)
tree772a33b7bb6d11820556c4613149cc0c39bb1b6d
parentbd6ded54efbea8fe01040941ce8d39951a8431c9 (diff)
merge root scope for namespace
-rw-r--r--xmake/core/base/interpreter.lua20
1 files changed, 16 insertions, 4 deletions
diff --git a/xmake/core/base/interpreter.lua b/xmake/core/base/interpreter.lua
index 2ae021f79..6f006efff 100644
--- a/xmake/core/base/interpreter.lua
+++ b/xmake/core/base/interpreter.lua
@@ -260,7 +260,7 @@ function interpreter:_api_register_xxx_values(scope_kind, action, apifunc, ...)
-- init current root scope
local rootkey = scope_kind
- if namespace and scope_kind ~= "__rootkind" then
+ if namespace then
rootkey = scope_kind .. "@@" .. namespace .. "::"
end
local root = scopes._ROOT[rootkey] or {}
@@ -543,7 +543,6 @@ function interpreter:_make(scope_kind, deduplicate, enable_filter)
local results = {}
local scope_opt = {interpreter = self, deduplicate = deduplicate, enable_filter = enable_filter}
if scope_kind and scope_kind:startswith("root.") then
-
local root_scope = scopes._ROOT[scope_kind:sub(6)]
if root_scope then
results = self:_handle(root_scope, deduplicate, enable_filter)
@@ -552,8 +551,21 @@ function interpreter:_make(scope_kind, deduplicate, enable_filter)
-- get the root scope info without scope kind
elseif scope_kind == "root" or scope_kind == nil then
-
- local root_scope = scopes._ROOT["__rootkind"]
+ local root_scope = {}
+ local empty = true
+ for scopekind, scope in pairs(scopes._ROOT) do
+ if scopekind:startswith("__rootkind") then
+ local namespace = scopekind:match("__rootkind@@(.+)::")
+ for k, v in pairs(scope) do
+ if namespace then
+ root_scope[namespace .. "::" .. k] = v
+ else
+ root_scope[k] = v
+ end
+ end
+ empty = false
+ end
+ end
if root_scope then
results = self:_handle(root_scope, deduplicate, enable_filter)
end