diff options
| author | ruki <[email protected]> | 2025-01-09 10:19:14 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-01-09 10:19:14 +0800 |
| commit | 8e24b5a44dcffbee1444d715909a64014e11e866 (patch) | |
| tree | a2f0aaf7b582dae30d4db636efd199ccb158e0d8 /xmake/core/tool/toolchain.lua | |
| parent | 1cf6a7f479837b471a5f91410359d86983828e6a (diff) | |
| parent | 6317ffd0fe312360eb5f6e079320c01c95870ad0 (diff) | |
Merge pull request #6001 from xmake-io/namespace
Support for namespace
Diffstat (limited to 'xmake/core/tool/toolchain.lua')
| -rw-r--r-- | xmake/core/tool/toolchain.lua | 18 |
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") |
