summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--xmake/core/base/interpreter.lua12
-rw-r--r--xmake/includes/xpack/xmake.lua7
2 files changed, 9 insertions, 10 deletions
diff --git a/xmake/core/base/interpreter.lua b/xmake/core/base/interpreter.lua
index 7ba677a8f..e4d6c3046 100644
--- a/xmake/core/base/interpreter.lua
+++ b/xmake/core/base/interpreter.lua
@@ -1897,11 +1897,15 @@ function interpreter:api_interp_add_scopeapis(...)
else
extra_config = nil
end
- local kind = "values"
- if extra_config and extra_config.kind then
- kind = extra_config.kind
+ if extra_config and #apis == 0 then
+ self:api_define(extra_config)
+ else
+ local kind = "values"
+ if extra_config and extra_config.kind then
+ kind = extra_config.kind
+ end
+ return self:api_define({[kind] = apis})
end
- return self:api_define({[kind] = apis})
end
-- get api function
diff --git a/xmake/includes/xpack/xmake.lua b/xmake/includes/xpack/xmake.lua
index 59c813531..30efaf2ac 100644
--- a/xmake/includes/xpack/xmake.lua
+++ b/xmake/includes/xpack/xmake.lua
@@ -52,9 +52,4 @@ local apis = {
"xpack.on_uninstallcmd"
}
}
-for _, apiname in ipairs(apis.values) do
- interp_add_scopeapis(apiname, {kind = "values"})
-end
-for _, apiname in ipairs(apis.script) do
- interp_add_scopeapis(apiname, {kind = "script"})
-end
+interp_add_scopeapis(apis)