summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2024-04-23 23:17:31 +0800
committerruki <[email protected]>2024-04-23 23:17:31 +0800
commitee9a482a5579e99f922a6df77f0336ce96e98373 (patch)
treef12df251f8f6c24d00180d11c7e3df92f3a919f5
parent01966666e2c6cd565c227b4274c3ae5a723ba837 (diff)
get some apis
-rw-r--r--xmake/core/sandbox/modules/import/core/tool/toolchain.lua3
-rw-r--r--xmake/plugins/show/lists/apis.lua19
2 files changed, 22 insertions, 0 deletions
diff --git a/xmake/core/sandbox/modules/import/core/tool/toolchain.lua b/xmake/core/sandbox/modules/import/core/tool/toolchain.lua
index 667019b1a..46bd9fb1d 100644
--- a/xmake/core/sandbox/modules/import/core/tool/toolchain.lua
+++ b/xmake/core/sandbox/modules/import/core/tool/toolchain.lua
@@ -27,6 +27,9 @@ local toolchain = require("tool/toolchain")
local project = require("project/project")
local raise = require("sandbox/modules/raise")
+-- inherit some builtin interfaces
+sandbox_core_tool_toolchain.apis = toolchain.apis
+
-- get all toolchains list
function sandbox_core_tool_toolchain.list()
local names = table.copy(platform.toolchains())
diff --git a/xmake/plugins/show/lists/apis.lua b/xmake/plugins/show/lists/apis.lua
index b5d8c5cfe..57acb3448 100644
--- a/xmake/plugins/show/lists/apis.lua
+++ b/xmake/plugins/show/lists/apis.lua
@@ -24,6 +24,7 @@ import("core.project.rule")
import("core.project.target")
import("core.project.option")
import("core.package.package")
+import("core.tool.toolchain")
import(".showlist")
-- get target apis
@@ -97,6 +98,23 @@ function package_apis()
return result
end
+-- get toolchain apis
+function toolchain_apis()
+ local result = {}
+ for _, names in pairs(toolchain.apis()) do
+ for _, name in ipairs(names) do
+ table.insert(result, name)
+ end
+ end
+ local instance = toolchain.load("clang")
+ for k, v in pairs(instance) do
+ if not k:startswith("_") and type(v) == "function" then
+ table.insert(result, "toolchain:" .. k)
+ end
+ end
+ return result
+end
+
-- get all apis
function apis()
local result = {}
@@ -104,6 +122,7 @@ function apis()
table.join2(result, option_apis())
table.join2(result, rule_apis())
table.join2(result, package_apis())
+ table.join2(result, toolchain_apis())
return result
end