summaryrefslogtreecommitdiff
path: root/xmake/core/tool/toolchain.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2025-01-07 22:43:17 +0800
committerruki <[email protected]>2025-01-07 22:43:17 +0800
commitc184146581f86d95536dafcadd64e8ae000341f2 (patch)
tree786c1bfd54940bf7fc62dceea09829fc945c9b1c /xmake/core/tool/toolchain.lua
parent27b25397a70585921df496503060e3bf04f0f38b (diff)
add namespace for toolchain
Diffstat (limited to 'xmake/core/tool/toolchain.lua')
-rw-r--r--xmake/core/tool/toolchain.lua18
1 files changed, 17 insertions, 1 deletions
diff --git a/xmake/core/tool/toolchain.lua b/xmake/core/tool/toolchain.lua
index 29bd5a09f..a19413d34 100644
--- a/xmake/core/tool/toolchain.lua
+++ b/xmake/core/tool/toolchain.lua
@@ -42,7 +42,12 @@ local sandbox_module = require("sandbox/modules/import/core/sandbox/module")
-- new an instance
function _instance.new(name, info, cachekey, is_builtin, configs)
local instance = table.inherit(_instance)
- instance._NAME = name
+ local parts = name:split("::", {plain = true})
+ instance._NAME = parts[#parts]
+ table.remove(parts)
+ if #parts > 0 then
+ instance._NAMESPACE = table.concat(parts, "::")
+ end
instance._INFO = info
instance._IS_BUILTIN = is_builtin
instance._CACHE = toolchain._localcache()
@@ -68,6 +73,17 @@ function _instance:name()
return self._NAME
end
+-- get the namespace
+function _instance:namespace()
+ return self._NAMESPACE
+end
+
+-- get the full name
+function _instance:fullname()
+ local namespace = self:namespace()
+ return namespace and namespace .. "::" .. self:name() or self:name()
+end
+
-- get toolchain platform
function _instance:plat()
return self._PLAT or self:config("plat")